Ejemplo n.º 1
0
        public void ReviewItem(Interfaces.IConquerItem item)
        {
            Database.ConquerItemTable.DeleteItem(item.UID);
            if (item.Position != 0)
            {
                Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                iu.UID = item.UID;
                iu.dwParam = item.Position;
                iu.ID = Network.GamePackets.ItemUsage.UnequipItem;
                Owner.Send(iu);
            }
            Network.GamePackets.ItemUsage iud = new Network.GamePackets.ItemUsage(true);
            iud.UID = item.UID;
            iud.ID = Network.GamePackets.ItemUsage.RemoveInventory;
            Owner.Send(iud);

            Database.ConquerItemTable.AddItem(ref item, Owner);

            item.Send(Owner);
        }
Ejemplo n.º 2
0
        public bool Remove(Interfaces.IConquerItem item, Enums.ItemUse use)
        {
            if (inventory.ContainsKey(item.UID))
            {
                if (!Network.PacketHandler.IsEquipment(item.ID))
                {
                    if (item.StackSize != 0)
                    {
                        item.StackSize--;
                        if (item.StackSize != 0)
                        {
                            Database.ConquerItemTable.UpdateStackItem(item, Owner);
                            item.Mode = Enums.ItemMode.Update;
                            item.Send(Owner);
                            item.Mode = Enums.ItemMode.Default;
                            return true;
                        }
                    }
                }
                switch (use)
                {
                    case Enums.ItemUse.Remove: Database.ConquerItemTable.RemoveItem(item.UID); break;
                    case Enums.ItemUse.Delete: Database.ConquerItemTable.DeleteItem(item.UID); break;
                    case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(item, Owner); break;
                }

                inventory.Remove(item.UID);
                objects = inventory.Values.ToArray();
                Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                iu.UID = item.UID;
                iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                Owner.Send(iu);
                return true;
            }
            return false;
        }
Ejemplo n.º 3
0
 public bool Remove(uint UID, Enums.ItemUse use, bool sendRemove)
 {
     if (inventory.ContainsKey(UID))
     {
         switch (use)
         {
             case Enums.ItemUse.Delete: Database.ConquerItemTable.DeleteItem(UID); break;
             case Enums.ItemUse.Remove: Database.ConquerItemTable.RemoveItem(UID); break;
             case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(inventory[UID], Owner); break;
         }
         inventory.Remove(UID);
         objects = inventory.Values.ToArray();
         if (sendRemove)
         {
             Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
             iu.UID = UID;
             iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
             Owner.Send(iu);
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
        public bool Remove(byte Position)
        {
            if (Position > 19)
                return false;
            if (objects[Position - 1] != null)
            {
                if (Owner.Inventory.Count <= 39)
                {
                    if (Owner.Inventory.Add(objects[Position - 1], Enums.ItemUse.Move))
                    {
                        objects[Position - 1].Position = Position;
                        Owner.UnloadItemStats(objects[Position - 1], false);
                        objects[Position - 1].Position = 0;
                        if (Position == 12)
                            Owner.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                        if (Position == 4)
                            Owner.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Fly);
                        Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                        iu.UID = objects[Position - 1].UID;
                        iu.dwParam = Position;
                        iu.ID = Network.GamePackets.ItemUsage.UnequipItem;
                        Owner.Send(iu);

                        EntityEquipment equips = new EntityEquipment(true);
                        equips.ParseHero(Owner);
                        Owner.Send(equips);
                        ClearItemview(Position);
                        objects[Position - 1] = null;
                        Owner.SendScreenSpawn(Owner.Entity, false);
                        return true;
                    }
                }
                else
                {
                    Owner.Send(new Network.GamePackets.Message("Not enough room in your inventory.", System.Drawing.Color.Blue, Network.GamePackets.Message.TopLeft));
                }
            }
            return false;
        }
Ejemplo n.º 5
0
        public bool RemoveToGround(uint Position)
        {
            if (Position == 0 || Position > 19)
                return true;
            if (objects[Position - 1] != null)
            {
                objects[Position - 1].Position = (ushort)Position;
                Owner.UnloadItemStats(objects[Position - 1], false);
                objects[Position - 1].Position = 0;
                Database.ConquerItemTable.RemoveItem(objects[Position - 1].UID);
                Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                iu.UID = objects[Position - 1].UID;
                iu.dwParam = Position;
                iu.ID = Network.GamePackets.ItemUsage.UnequipItem;
                Owner.Send(iu);
                iu.dwParam = 0;
                iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                Owner.Send(iu);

                EntityEquipment equips = new EntityEquipment(true);
                equips.ParseHero(Owner);
                Owner.Send(equips);
                ClearItemview(Position);
                objects[Position - 1] = null;
                return true;
            }
            return false;
        }
 public bool Remove(string name)
 {
     try {
     foreach (var item in inventory.Values)
     {
         if (Database.ConquerItemInformation.BaseInformations[item.ID].Name.ToLower() == name.ToLower())
         {
            // Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, PhoenixProject.Database.ItemLog.ItemLogAction.Remove);
             Remove(item, Enums.ItemUse.Remove);
             Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
             iu.UID = item.UID;
             iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
             Owner.Send(iu);
             return true;
         }
     }
     }
     catch (Exception e)
     {
         Program.SaveException(e);
     }
     return false;
 }
 public bool Remove(uint ID, byte times)
 {
     if (ID == 0)
         return true;
     List<Interfaces.IConquerItem> items = new List<Interfaces.IConquerItem>();
     byte has = 0;
     foreach (Interfaces.IConquerItem item in Objects)
         if (item.ID == ID)
         {
             if (item.StackSize > 1)
             {
                 //Console.WriteLine(" " + item.StackSize + "");
                 if (item.StackSize >= times)
                 {
                     item.StackSize-= times;
                     if (item.StackSize != 0)
                     {
                         Database.ConquerItemTable.UpdateStack(item);
                         item.Mode = Enums.ItemMode.Update;
                         item.Send(Owner);
                         item.Mode = Enums.ItemMode.Default;
                         return true;
                     }
                     else
                     {
                         Database.ConquerItemTable.DeleteItem(item.UID);
                         inventory.Remove(item.UID);
                         objects = inventory.Values.ToArray();
                         Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                         iu.UID = item.UID;
                         iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                         Owner.Send(iu);
                         return true;
                     }
                 }
                 else
                 {
                     has += (byte)item.StackSize; items.Add(item); if (has >= times) break;
                 }
             }
             else
             {
                 has++; items.Add(item); if (has >= times) break;
             }
         }
     if (has >= times)
         foreach (Interfaces.IConquerItem item in items)
             Remove(item, Enums.ItemUse.Remove);
     return has >= times;
 }
 public bool Remove(uint UID, Enums.ItemUse use, bool sendRemove)
 {
     try {
     if (inventory.ContainsKey(UID))
     {
         switch (use)
         {
             case Enums.ItemUse.Remove: Database.ConquerItemTable.RemoveItem(UID); break;
             case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(inventory[UID], Owner); break;
         }
         Database.ItemLog.LogItem(UID, Owner.Entity.UID, PhoenixProject.Database.ItemLog.ItemLogAction.Remove);
         inventory.Remove(UID);
         objects = inventory.Values.ToArray();
         if (sendRemove)
         {
             Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
             iu.UID = UID;
             iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
             Owner.Send(iu);
         }
         return true;
     }
     }
     catch (Exception e)
     {
         Program.SaveException(e);
     }
     return false;
 }
        public bool Remove(Interfaces.IConquerItem item, Enums.ItemUse use, bool equipment)
        {
            try
            {
                if (inventory.ContainsKey(item.UID))
                {
                    //  Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, PhoenixProject.Database.ItemLog.ItemLogAction.Remove);
                    if (inventory.ContainsKey(item.UID))
                        inventory.Remove(item.UID);
                    else
                        return false;
                    if (objects == null)
                        objects = new Interfaces.IConquerItem[objects.Length];
                    if (inventory.Values.Count >= 0)
                        objects = inventory.Values.ToArray();
                    else
                        return false;
                    Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                    iu.UID = item.UID;
                    iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                    Owner.Send(iu);
                    return true;
                }
            }
            catch (Exception e)
            {
                Program.SaveException(e);

            }
            return false;
        }
        public bool Remove(Interfaces.IConquerItem item, Enums.ItemUse use)
        {
            try
            {
                if (inventory.ContainsKey(item.UID))
                {
                    if (Owner.Entity.UseItem && item.StackSize > 1)
                    {
                        Remove(item.ID, 1);
                        Owner.Entity.UseItem = false;
                        return true;
                    }
                    else
                    {
                        switch (use)
                        {
                            case Enums.ItemUse.Remove: Database.ConquerItemTable.DeleteItem(item.UID); break;
                            case Enums.ItemUse.Delete: Database.ConquerItemTable.DeleteItem(item.UID); break;
                            case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(item, Owner); break;
                        }
                        //Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, PhoenixProject.Database.ItemLog.ItemLogAction.Remove);

                        inventory.Remove(item.UID);
                        objects = inventory.Values.ToArray();
                        Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                        iu.UID = item.UID;
                        iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                        Owner.Send(iu);
                        return true;
                    }
                }
            }
            catch (Exception e)
            {
                Program.SaveException(e);
            }
            return false;
        }
        public bool RemoveToGround(uint Position)
        {
            if (Position == 0 || Position > 29)
                return true;
            if (objects[Position - 1] != null)
            {
                objects[Position - 1].Position = (ushort)Position;
                objects[Position - 1].Position = 0;
                Database.ConquerItemTable.RemoveItem2(objects[Position - 1].UID);
                Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                iu.UID = objects[Position - 1].UID;
                iu.dwParam = Position;
                iu.ID = Network.GamePackets.ItemUsage.UnequipItem;
                Owner.Send(iu);
                iu.dwParam = 0;
                iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                Owner.Send(iu);

                ClearItemview(Position);
                objects[Position - 1] = null;
                return true;
            }
            return false;
        }
        public bool DestroyArrow(uint Position)
        {
            if (objects[Position - 1] != null)
            {
                objects[Position - 1].Position = (ushort)Position;
                if (objects[Position - 1].ID == 0)
                {
                    objects[Position - 1].Position = 0;
                    Database.ConquerItemTable.DeleteItem(objects[Position - 1].UID);
                    objects[Position - 1] = null;
                    return true;
                }
                /*if (!Network.PacketHandler.IsArrow(objects[Position - 1].ID))
                    return false;*/

                //Owner.UnloadItemStats(objects[Position - 1], false);
                Database.ConquerItemTable.DeleteItem(objects[Position - 1].UID);
                Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
                iu.UID = objects[Position - 1].UID;
                iu.dwParam = Position;
                iu.ID = Network.GamePackets.ItemUsage.UnequipItem;
                Owner.Send(iu);
                iu.dwParam = 0;
                iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
                Owner.Send(iu);
                ClearItemview2(Position);
                objects[Position - 1].Position = 0;
                objects[Position - 1] = null;
                return true;
            }
            return false;
        }