Example #1
0
        public static void SendShopTradeCompleteResponse(IRealmClient client, Asda2Item[] items)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ShopTradeComplete))
            {
                packet.WriteByte(5);
                packet.WriteInt32(client.ActiveCharacter.Asda2Inventory.Weight);
                for (int index = 0; index < 5; ++index)
                {
                    Asda2Item asda2Item = items[index];
                    packet.WriteInt32(asda2Item == null ? 0 : asda2Item.ItemId);
                    packet.WriteByte(asda2Item == null ? (byte)0 : (byte)asda2Item.InventoryType);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Slot);
                    packet.WriteInt16(asda2Item == null ? -1 : (asda2Item.IsDeleted ? -1 : 0));
                    packet.WriteByte(asda2Item == null ? -1 : asda2Item.Durability);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Weight);
                    packet.WriteInt32(0);
                    packet.WriteByte(asda2Item == null ? -1 : asda2Item.Enchant);
                    packet.WriteByte(0);
                    packet.WriteByte(0);
                    packet.WriteByte(0);
                    packet.WriteByte(asda2Item == null ? -1 : asda2Item.SealCount);
                    packet.WriteInt16(asda2Item == null ? -1 : (short)asda2Item.Parametr1Type);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Parametr1Value);
                    packet.WriteInt16(asda2Item == null ? -1 : (short)asda2Item.Parametr2Type);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Parametr2Value);
                    packet.WriteInt16(asda2Item == null ? -1 : (short)asda2Item.Parametr3Type);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Parametr3Value);
                    packet.WriteInt16(asda2Item == null ? -1 : (short)asda2Item.Parametr4Type);
                    if (asda2Item != null && asda2Item.Template.IsAvatar)
                    {
                        Asda2ItemTemplate template1 = Asda2ItemMgr.GetTemplate(asda2Item.Soul2Id);
                        Asda2ItemTemplate template2 = Asda2ItemMgr.GetTemplate(asda2Item.Soul3Id);
                        packet.WriteInt16(template1 == null ? -1 : template1.SowelBonusValue);
                        packet.WriteInt16(-1);
                        packet.WriteInt16(template2 == null ? -1 : template2.SowelBonusValue);
                    }
                    else
                    {
                        packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Parametr4Value);
                        packet.WriteInt16(asda2Item == null ? -1 : (short)asda2Item.Parametr5Type);
                        packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Parametr5Value);
                    }

                    packet.WriteByte(0);
                    packet.WriteItemAmount(asda2Item, false);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Soul1Id);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Soul2Id);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Soul3Id);
                    packet.WriteInt16(asda2Item == null ? -1 : asda2Item.Soul4Id);
                }

                client.Send(packet, false);
            }
        }
Example #2
0
        public static void SendShopTradeCompleteResponse(IRealmClient client, Asda2Item[] items)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.ShopTradeComplete)) //5294
            {
                packet.WriteByte(5);                                                     //{status}default value : 5 Len : 1
                packet.WriteInt32(client.ActiveCharacter.Asda2Inventory.Weight);         //{invWeight}default value : 1394 Len : 4
                for (int i = 0; i < 5; i++)
                {
                    var item = items[i];

                    packet.WriteInt32(item == null ? 0 : item.ItemId);               //{itemID}default value : 28516 Len : 4
                    packet.WriteByte((byte)(item == null ? 0 : item.InventoryType)); //{bagNum}default value : 1 Len : 1
                    packet.WriteInt16(item == null ? -1 : item.Slot);                //{cellNum}default value : 0 Len : 4
                    packet.WriteInt16(item == null ? -1 : item.IsDeleted ? -1 : 0);
                    packet.WriteByte(item == null ? -1 : item.Durability);           //{durability}default value : 100 Len : 1
                    packet.WriteInt16(item == null ? -1 : item.Weight);              //{weight}default value : 677 Len : 2
                    packet.WriteInt32(0);
                    packet.WriteByte(item == null ? -1 : item.Enchant);              //{enchant}default value : 0 Len : 1
                    packet.WriteByte(0);                                             //value name : stab31 default value : stab31Len : 3
                    packet.WriteByte(0);
                    packet.WriteByte(0);
                    packet.WriteByte(item == null ? -1 : item.SealCount);             //{sealCount}default value : 0 Len : 1
                    packet.WriteInt16(item == null ? -1 : (short)item.Parametr1Type);
                    packet.WriteInt16(item == null ? -1 : item.Parametr1Value);       //{stat1Value}default value : 9 Len : 2
                    packet.WriteInt16(item == null ? -1 : (short)item.Parametr2Type);
                    packet.WriteInt16(item == null ? -1 : item.Parametr2Value);       //{stat1Value}default value : 9 Len : 2
                    packet.WriteInt16(item == null ? -1 : (short)item.Parametr3Type); //{stat1Type}default value : 1 Len : 2
                    packet.WriteInt16(item == null ? -1 : item.Parametr3Value);       //{stat1Value}default value : 9 Len : 2
                    packet.WriteInt16(item == null ? -1 : (short)item.Parametr4Type); //{stat1Type}default value : 1 Len : 2
                    if (item != null && item.Template.IsAvatar)
                    {
                        var t1 = Items.Asda2ItemMgr.GetTemplate(item.Soul2Id);
                        var t2 = Items.Asda2ItemMgr.GetTemplate(item.Soul3Id);
                        packet.WriteInt16(t1 == null ? -1 : t1.SowelBonusValue); //{stat1Value}default value : 9 Len : 2
                        packet.WriteInt16(-1);                                   //{stat1Type}default value : 1 Len : 2
                        packet.WriteInt16(t2 == null ? -1 : t2.SowelBonusValue);
                    }
                    else
                    {
                        packet.WriteInt16(item == null ? -1 : item.Parametr4Value);       //{stat1Value}default value : 9 Len : 2
                        packet.WriteInt16(item == null ? -1 : (short)item.Parametr5Type); //{stat1Type}default value : 1 Len : 2
                        packet.WriteInt16(item == null ? -1 : item.Parametr5Value);       //{stat1Value}default value : 9 Len : 2
                    }
                    packet.WriteByte(0);                                                  //value name : unk15 default value : 0Len : 1
                    packet.WriteItemAmount(item);
                    packet.WriteInt16(item == null ? -1 : item.Soul1Id);                  //{soul1Id}default value : 7576 Len : 2
                    packet.WriteInt16(item == null ? -1 : item.Soul2Id);                  //{soul2Id}default value : -1 Len : 2
                    packet.WriteInt16(item == null ? -1 : item.Soul3Id);                  //{soul3Id}default value : -1 Len : 2
                    packet.WriteInt16(item == null ? -1 : item.Soul4Id);                  //{soul4Id}default value : -1 Len : 2
                }
                client.Send(packet, addEnd: false);
            }
        }