Example #1
0
        /// <summary>
        /// This is raised by Player.HandleActionUseItem, and is wrapped in ActionChain.<para />
        /// The actor of the ActionChain is the player using the item.<para />
        /// The item should be in the players possession.
        /// </summary>
        public override void UseItem(Player player, ActionChain actionChain)
        {
            Player.ConsumableBuffType buffType;

            //if (Food)
            //{
            switch (BoostEnum)
            {
            case (int)Player.ConsumableBuffType.Health:
                buffType = Player.ConsumableBuffType.Health;
                break;

            case (int)Player.ConsumableBuffType.Mana:
                buffType = Player.ConsumableBuffType.Mana;
                break;

            default:
                buffType = Player.ConsumableBuffType.Stamina;
                break;
            }
            //}
            //else
            //    buffType = WorldObjects.Player.ConsumableBuffType.Spell;

            player.ApplyComsumable(Name, GetSoundDid(), buffType, (uint)Boost, SpellDID);

            player.TryRemoveItemFromInventoryWithNetworking(this, 1);

            var sendUseDoneEvent = new GameEventUseDone(player.Session);

            player.Session.Network.EnqueueSend(sendUseDoneEvent);
        }