示例#1
0
 public static Packet Equip(ZoneCharacter character, Item equip)
 {
     //B2 00 - AB 38 - 07 - 0D 00 04
     Packet packet = new Packet(SH7Type.ShowEquip);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteUShort(equip.ID);
     packet.WriteByte(equip.UpgradeStats.Upgrades);
     packet.Fill(3, 0xff);
     return packet;
 }
示例#2
0
 public void AddToEquipped(Item pEquip)
 {
     try
     {
         locker.WaitOne();
        Item old = EquippedItems.Find(equip => equip.Slot == pEquip.Slot);
         if (old != null)
         {
             old.IsEquipped = false;
             AddToInventory(old);
             EquippedItems.Remove(old);
         }
         EquippedItems.Add(pEquip);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
示例#3
0
        public static void SendItemUsed(ZoneCharacter character, Item item, ushort error = 1792)
        {
            if (error == 1792)
            {
                SendItemUseOK(character);
            }

            using (var packet = new Packet(SH12Type.ItemUseEffect))
            {
                packet.WriteUShort(error); //when not ok, it'll tell you there will be no effect
                packet.WriteUShort(item.ItemID);
                character.Client.SendPacket(packet);
            }
        }
示例#4
0
 public static void ModifyInventorySlot(ZoneCharacter character, byte inventory, byte newslot, byte oldslot, Item item)
 {
     using (var packet = new Packet(SH12Type.ModifyItemSlot))
     {
         packet.WriteByte(oldslot);
         packet.WriteByte(inventory); //aka 'unequipped' bool
         packet.WriteByte(newslot);
         packet.WriteByte(0x24);
         if (item == null)
         {
             packet.WriteUShort(0xffff);
         }
         else
         {
             if (item is Equip)
             {
                 ((Equip)item).WriteEquipStats(packet);
             }
             else
             {
                 item.WriteItemStats(packet);
             }
         }
         character.Client.SendPacket(packet);
     }
 }
示例#5
0
 public void AddToInventory(Item pItem)
 {
     try
     {
         locker.WaitOne();
         if (this.InventoryItems.ContainsKey((byte)pItem.Slot))
         {
             this.InventoryItems[(byte)pItem.Slot].Delete(); //removes from DB
             this.InventoryItems.Remove((byte)pItem.Slot);
         }
         this.InventoryItems.Add((byte)pItem.Slot, pItem);
     } finally {
         locker.ReleaseMutex();
     }
 }
示例#6
0
 public void RemoveInventory(Item pItem)
 {
     try
     {
         locker.WaitOne();
         Handler12.ModifyInventorySlot(InventoryOwner, 0x24, (byte)pItem.Slot, 0, null);
         pItem.Delete();
         this.InventoryItems.Remove((byte)pItem.Slot);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
示例#7
0
 public Item GetEquiptBySlot(byte slot, out Item Eq)
 {
     Eq = this.EquippedItems.Find(d => d.Slot == slot);
     return Eq;
 }
示例#8
0
 public static Packet Unequip(ZoneCharacter character, Item equip)
 {
     Packet packet = new Packet(SH7Type.ShowUnequip);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteByte((byte)equip.ItemInfo.Slot);
     return packet;
 }
示例#9
0
 public static void UpdateInventorySlot(ZoneCharacter pChar, byte pFromSlot, byte pFromInv, byte pToSlot, Item pItem)
 {
     using (var packet = new Packet(SH12Type.ModifyItemSlot))
     {
         packet.WriteByte(pFromSlot);
         packet.WriteByte(pFromInv);
         packet.WriteByte(pToSlot);
         packet.WriteByte(0x24);         // pToInv
         if (pItem == null)
         {
             packet.WriteUShort(0xffff);
         }
         else
         {
             if (pItem.ItemInfo.Slot == ItemSlot.None)
             {
                 pItem.WriteStats(packet);
             }
             else
             {
                 pItem.WriteEquipStats(packet);
             }
         }
         pChar.Client.SendPacket(packet);
     }
 }
示例#10
0
 public static void ModifyInventorySlot(ZoneCharacter character, byte sourcestate, byte deststate, byte oldslot, byte newslot, Item item)
 {
     using (var packet = new Packet(SH12Type.ModifyItemSlot))
     {
         packet.WriteByte(oldslot);
         packet.WriteByte(sourcestate); //aka 'unequipped' bool
         packet.WriteByte(newslot);
         packet.WriteByte(deststate);
         if (item == null)
         {
             packet.WriteUShort(0xffff);
         }
         else
         {
             if (item.ItemInfo.Slot == ItemSlot.None)
             {
                 item.WriteStats(packet);
             }
             else
             {
                 item.WriteEquipStats(packet);
             }
         }
         character.Client.SendPacket(packet);
     }
 }
示例#11
0
 public static void ModifyInventorySlot(ZoneCharacter character, byte inventory, byte oldslot, byte newslot, Item item)
 {
     ModifyInventorySlot(character, inventory, (byte)0x24, oldslot, newslot, item);
 }
示例#12
0
 private void LoadGuildStorageFromDatabase(int GuildID)
 {
     DataTable GuildItemData = null;
     using (DatabaseClient DBClient = Program.CharDBManager.GetClient())
     {
         GuildItemData = DBClient.ReadDataTable("SELECT * FROM GuildStorage WHERE GuildID=" + GuildID + "");
     }
     if (GuildItemData != null)
     {
         foreach(DataRow row in GuildItemData.Rows)
         {
             ushort ItemID = System.Convert.ToUInt16(row["ItemID"]);
             ushort Amount = System.Convert.ToUInt16(row["Amount"]);
             byte pSlot = System.Convert.ToByte(row["Slot"]);
             Item pItem = new Item(GuildID,ItemID, pSlot, Amount);
             this.GuildStorageItems.Add(pSlot,pItem);
         }
     }
 }