Example #1
0
        /// <summary>
        /// Transfers an amount from one stack to another
        /// </summary>
        public void OnInventoryStackTransferMessage(InventoryStackTransferMessage msg)
        {
            Item itemFrom = _owner.World.GetItem(msg.FromID);
            Item itemTo = _owner.World.GetItem(msg.ToID);

            itemFrom.Attributes[GameAttribute.ItemStackQuantityLo] -= (int)msg.Amount;
            itemTo.Attributes[GameAttribute.ItemStackQuantityLo] -= (int)msg.Amount;
            

            // TODO: This needs to change the attribute on the item itself. /komiga
            // Update source
            GameAttributeMap attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = itemFrom.Attributes[GameAttribute.ItemStackQuantityLo];
            attributes.SendMessage(_owner.InGameClient, itemFrom.DynamicID);

            // TODO: This needs to change the attribute on the item itself. /komiga
            // Update target
            attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = itemTo.Attributes[GameAttribute.ItemStackQuantityLo];
            attributes.SendMessage(_owner.InGameClient, itemTo.DynamicID);
        }
Example #2
0
        /// <summary>
        /// Transfers an amount from one stack to another
        /// </summary>
        public void OnInventoryStackTransferMessage(InventoryStackTransferMessage msg)
        {
            Item itemFrom = GetItem(msg.FromID);
            Item itemTo = GetItem(msg.ToID);

            itemFrom.Attributes[GameAttribute.ItemStackQuantityLo] -= (int)msg.Amount;
            itemTo.Attributes[GameAttribute.ItemStackQuantityLo] += (int)msg.Amount;

            itemFrom.Attributes.SendChangedMessage(_owner.InGameClient);
            itemTo.Attributes.SendChangedMessage(_owner.InGameClient);
        }
Example #3
0
        /// <summary>
        /// Transfers an amount from one stack to another
        /// </summary>
        public void OnInventoryStackTransferMessage(InventoryStackTransferMessage msg)
        {
            _owner.InGameClient.items[msg.Field0].Count = (_owner.InGameClient.items[msg.Field0].Count) - ((int)msg.Field2);
            _owner.InGameClient.items[msg.Field1].Count = _owner.InGameClient.items[msg.Field1].Count + (int)msg.Field2;

            // Update source
            GameAttributeMap attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = _owner.InGameClient.items[msg.Field0].Count;
            attributes.SendMessage(_owner.InGameClient, msg.Field0);

            // Update target
            attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = _owner.InGameClient.items[msg.Field1].Count;
            attributes.SendMessage(_owner.InGameClient, msg.Field1);

            _owner.InGameClient.PacketId += 10 * 2;
            _owner.InGameClient.SendMessage(new DWordDataMessage()
            {
                Id = 0x89,
                Field0 = _owner.InGameClient.PacketId,
            });
        }
Example #4
0
        /// <summary>
        /// Transfers an amount from one stack to another
        /// </summary>
        public void OnInventoryStackTransferMessage(InventoryStackTransferMessage msg)
        {
            owner.InGameClient.items[msg.Field0].Count = (owner.InGameClient.items[msg.Field0].Count) - ((int)msg.Field2);
            owner.InGameClient.items[msg.Field1].Count = owner.InGameClient.items[msg.Field1].Count + (int)msg.Field2;
            
            // Update source
            owner.InGameClient.SendMessage(new AttributeSetValueMessage
            {
                Id = (int)Opcodes.AttributeSetValueMessage,
                Field0 = msg.Field0,
                Field1 = new NetAttributeKeyValue
                {
                    Attribute = GameAttribute.Attributes[0x0121],       // ItemStackQuantityLo 
                    Int = owner.InGameClient.items[msg.Field0].Count,   // quantity
                    Float = 0f,
                }
            });

            // Update target
            owner.InGameClient.SendMessage(new AttributeSetValueMessage
            {
                Id = 0x4c,
                Field0 = msg.Field1,
                Field1 = new NetAttributeKeyValue
                {
                    Attribute = GameAttribute.Attributes[0x0121],       // ItemStackQuantityLo 
                    Int = owner.InGameClient.items[msg.Field1].Count,   // count
                    Float = 0f,
                }
            });

            owner.InGameClient.PacketId += 10 * 2;
            owner.InGameClient.SendMessage(new DWordDataMessage()
            {
                Id = 0x89,
                Field0 = owner.InGameClient.PacketId,
            }); 
        }
Example #5
0
        /// <summary>
        /// Transfers an amount from one stack to another
        /// </summary>
        public void OnInventoryStackTransferMessage(InventoryStackTransferMessage msg)
        {
            Item itemFrom = this.Items[msg.FromID];
            Item itemTo = this.Items[msg.ToID];

            itemFrom.Count = (itemFrom.Count) - ((int)msg.Amount);
            itemTo.Count = itemTo.Count + (int)msg.Amount;

            // TODO: This needs to change the attribute on the item itself. /komiga
            // Update source
            GameAttributeMap attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = itemFrom.Count;
            attributes.SendMessage(_owner.InGameClient, itemFrom.DynamicID);

            // TODO: This needs to change the attribute on the item itself. /komiga
            // Update target
            attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = itemTo.Count;
            attributes.SendMessage(_owner.InGameClient, itemTo.DynamicID);

            _owner.InGameClient.PacketId += 10 * 2;
            _owner.InGameClient.SendMessage(new DWordDataMessage()
            {
                Id = 0x89,
                Field0 = _owner.InGameClient.PacketId,
            });
        }