public BuyItem(uint dealerUID, uint itemUID, uint cost, BuyFlags flags) : base(Build(dealerUID, itemUID, cost, flags)) { this.dealerUID = dealerUID; this.itemUID = itemUID; this.cost = cost; this.tradeType = TradeType.BuyItem; this.flags = flags; }
public static byte[] Build(uint dealerUID, uint itemUID, uint cost, BuyFlags flags) { byte[] buffer = new byte[0x11]; buffer[0] = 50; buffer[1] = (byte) dealerUID; buffer[2] = (byte) (dealerUID >> 8); buffer[3] = (byte) (dealerUID >> 0x10); buffer[4] = (byte) (dealerUID >> 0x18); buffer[5] = (byte) itemUID; buffer[6] = (byte) (itemUID >> 8); buffer[7] = (byte) (itemUID >> 0x10); buffer[8] = (byte) (itemUID >> 0x18); buffer[11] = (byte) flags; buffer[12] = (byte) (((ushort) flags) >> 8); buffer[13] = (byte) cost; buffer[14] = (byte) (cost >> 8); buffer[15] = (byte) (cost >> 0x10); buffer[0x10] = (byte) (cost >> 0x18); return buffer; }
// Methods public BuyItem(byte[] data) : base(data) { this.dealerUID = BitConverter.ToUInt32(data, 1); this.itemUID = BitConverter.ToUInt32(data, 5); this.tradeType = (TradeType) BitConverter.ToUInt16(data, 9); this.flags = (BuyFlags) BitConverter.ToUInt16(data, 11); this.cost = BitConverter.ToUInt32(data, 13); }