Example #1
0
File: Food.cs Project: Plover99/ACE
        /// <summary>
        /// This is raised by Player.HandleActionUseItem.<para />
        /// The item should be in the players possession.
        /// </summary>
        public override void UseItem(Player player)
        {
            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.ApplyConsumable(Name, GetSoundDid(), buffType, (uint)Boost, SpellDID);

            player.TryRemoveItemFromInventoryWithNetworkingWithDestroy(this, 1);

            var sendUseDoneEvent = new GameEventUseDone(player.Session);

            player.Session.Network.EnqueueSend(sendUseDoneEvent);
        }
Example #2
0
File: Food.cs Project: klp2/ACE
        /// <summary>
        /// This is raised by Player.HandleActionUseItem.<para />
        /// The item should be in the players possession.
        /// </summary>
        public override void UseItem(Player player)
        {
            var buffType = Player.ConsumableBuffType.Stamina;

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

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

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

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

            player.TryConsumeFromInventoryWithNetworking(this, 1);

            var sendUseDoneEvent = new GameEventUseDone(player.Session);

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