public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.ShopWindowOpen) return false; Destination = destination; Type = IncomingPacketType.ShopWindowOpen; byte cap = msg.GetByte(); ShopList = new List<ShopInfo> { }; for (int i = 0; i < cap; i++) { ShopInfo item = new ShopInfo(); item.ItemId = msg.GetUInt16(); item.SubType = msg.GetByte(); item.ItemName = msg.GetString(); item.Weight = msg.GetUInt32(); item.BuyPrice = msg.GetUInt32(); item.SellPrice = msg.GetUInt32(); ShopList.Add(item); } return true; }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.ShopSaleGoldCount) return false; Destination = destination; Type = IncomingPacketType.ShopSaleGoldCount; Cash = msg.GetUInt32(); byte count = msg.GetByte(); ItemList = new List<ShopInfo> { }; for (int i = 0; i < count; i++) { ShopInfo item = new ShopInfo(); item.ItemId = msg.GetUInt16(); item.SubType = msg.GetByte(); ItemList.Add(item); } return true; }