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; }
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(); } }
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); } }
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); } }
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(); } }
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(); } }
public Item GetEquiptBySlot(byte slot, out Item Eq) { Eq = this.EquippedItems.Find(d => d.Slot == slot); return Eq; }
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; }
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); } }
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); } }
public static void ModifyInventorySlot(ZoneCharacter character, byte inventory, byte oldslot, byte newslot, Item item) { ModifyInventorySlot(character, inventory, (byte)0x24, oldslot, newslot, item); }
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); } } }