wServer.realm.entities.player.Player.UseItem C# (CSharp) Method

UseItem() public method

public UseItem ( RealmTime time, wServer.cliPackets.UseItemPacket pkt ) : void
time RealmTime
pkt wServer.cliPackets.UseItemPacket
return void
        public void UseItem(RealmTime time, UseItemPacket pkt)
        {
            var container = Owner.GetEntity(pkt.Slot.ObjectId) as IContainer;
            var item = container.Inventory[pkt.Slot.SlotId];
            Activate(time, item, pkt.Position);
            if (item.Consumable)
            {
                if (item.SuccessorId != null)
                {
                    if (item.SuccessorId != item.ObjectId)
                    {
                        container.Inventory[pkt.Slot.SlotId] = XmlDatas.ItemDescs[XmlDatas.IdToType[item.SuccessorId]];
                        Owner.GetEntity(pkt.Slot.ObjectId).UpdateCount++;
                        UpdateCount++;
                    }
                }
                else
                {
                    container.Inventory[pkt.Slot.SlotId] = null;
                    Owner.GetEntity(pkt.Slot.ObjectId).UpdateCount++;
                    UpdateCount++;
                }
                SaveToCharacter();
                psr.Save();
            }
            if (container.SlotTypes[pkt.Slot.SlotId] != -1)
                fames.UseAbility();
        }