public static ItemBase DecodeItemData(ClientConnection pConnection, MaplePacket pPacket) { byte type = pPacket.ReadByte(); ItemBase ret = null; switch (type) { case 1: ret = new ItemEquip(); ret.Amount = 1; break; case 2: ret = new ItemRechargable(); break; case 3: ret = new ItemPet(); ret.Amount = 1; break; default: { Logger.WriteLine("Unkown ItemType: {0}", type); return(null); } } ret.Decode(pConnection, pPacket); return(ret); }
public static ItemBase DecodeItemData(ClientConnection pConnection, MaplePacket pPacket) { byte type = pPacket.ReadByte(); ItemBase ret = null; switch (type) { case 1: ret = new ItemEquip(); ret.Amount = 1; break; case 2: ret = new ItemRechargable(); break; case 3: ret = new ItemPet(); ret.Amount = 1; break; default: { Logger.WriteLine("Unkown ItemType: {0}", type); return null; } } ret.Decode(pConnection, pPacket); return ret; }
public static void SavePet(int pCharacterInternalID, ItemPet pPet, InsertQueryBuilder pInsertBuilder) { if (!pInsertBuilder.HasColumns) { pInsertBuilder.OnDuplicateUpdate = true; pInsertBuilder.AddColumn("character_id", false); pInsertBuilder.AddColumn("cashid", false); pInsertBuilder.AddColumn("name", true); pInsertBuilder.AddColumn("closeness", true); pInsertBuilder.AddColumn("fullness", true); pInsertBuilder.AddColumn("level", true); } pInsertBuilder.AddRow(pCharacterInternalID, pPet.CashID, pPet.Petname, pPet.Closeness, pPet.Fullness, pPet.Level); }