Beispiel #1
0
        /// <summary>
        /// This will be called on server to use item
        /// </summary>
        /// <param name="dataId"></param>
        protected virtual void NetFuncUseItem(short itemIndex)
        {
            if (!CanUseItem())
            {
                return;
            }

            if (itemIndex >= nonEquipItems.Count)
            {
                return;
            }

            CharacterItem characterItem = nonEquipItems[itemIndex];

            if (characterItem.IsLock())
            {
                return;
            }

            Item potionItem = characterItem.GetPotionItem();

            if (potionItem != null && this.DecreaseItemsByIndex(itemIndex, 1))
            {
                ApplyPotionBuff(potionItem, characterItem.level);
            }
            Item petItem = characterItem.GetPetItem();

            if (petItem != null && this.DecreaseItemsByIndex(itemIndex, 1))
            {
                ApplyItemPetSummon(petItem, characterItem.level, characterItem.exp);
            }
        }