当前位置: 首页>>代码示例>>C#>>正文


C# Creature.AcquireItem方法代码示例

本文整理汇总了C#中Aura.Channel.World.Entities.Creature.AcquireItem方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.AcquireItem方法的具体用法?C# Creature.AcquireItem怎么用?C# Creature.AcquireItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aura.Channel.World.Entities.Creature的用法示例。


在下文中一共展示了Creature.AcquireItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Reward

		public override void Reward(Creature creature, Quest quest)
		{
			creature.AcquireItem(Item.CreateEnchant(OptionSetId));
		}
开发者ID:evelive3,项目名称:aura,代码行数:4,代码来源:Rewards.cs

示例2: Reward

		public override void Reward(Creature creature, Quest quest)
		{
			creature.AcquireItem(Item.CreateWarpScroll(this.ItemId, this.Portal));
		}
开发者ID:aura-project,项目名称:aura,代码行数:4,代码来源:Rewards.cs

示例3: Burn

        /// <summary>
        /// Handles item burning, retruns whether it was successful.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="item"></param>
        /// <param name="campfire"></param>
        /// <param name="enchantersBurn"></param>
        public bool Burn(Creature creature, Item item, Prop campfire, bool enchantersBurn)
        {
            var skill = creature.Skills.Get(SkillId.Enchant);
            var enchantBurnSuccess = false;
            var powderBurnSuccess = false;
            var exp = 0;

            // Enchanter's Burn
            if (enchantersBurn)
            {
                var rnd = RandomProvider.Get();

                var isEquip = item.HasTag("/equip/");
                var hasEnchantBurnItems = (creature.Inventory.Has(51102) && creature.Inventory.Has(63016)); // Mana Herb + Holy Water

                // Enchant burning
                if (!isEquip || !hasEnchantBurnItems)
                {
                    // Unofficial
                    Send.SystemMessage(creature, Localization.Get("You don't the necessary items."));
                    return false;
                }

                // Get chances
                // All unofficial
                var rank = (skill == null ? 16 : (int)skill.Info.Rank);
                var enchantChance = (skill == null ? 0 : skill.RankData.Var3);

                // Campfire r8+ bonus
                if (enchantChance > 0 && campfire.Temp.CampfireSkillRank.Rank >= SkillRank.R8)
                    enchantChance += (16 - rank);

                // Powder = double enchant chance, based on the Wiki saying
                // r1 doesn't guarantee getting the enchants, but it does
                // guarantee getting powder.
                var powderChance = enchantChance * 2;

                // Debug
                if (creature.Titles.SelectedTitle == TitleId.devCAT)
                    Send.ServerMessage(creature, "Debug: Chance for enchant: {0:0}, chance for powder: {1:0}", enchantChance, powderChance);

                // Try prefix
                if (item.OptionInfo.Prefix != 0 && rnd.Next(100) < enchantChance)
                {
                    var enchant = Item.CreateEnchant(item.OptionInfo.Prefix);
                    creature.AcquireItem(enchant);
                    enchantBurnSuccess = true;
                }

                // Try suffix
                if (item.OptionInfo.Suffix != 0 && rnd.Next(100) < enchantChance)
                {
                    var enchant = Item.CreateEnchant(item.OptionInfo.Suffix);
                    creature.AcquireItem(enchant);
                    enchantBurnSuccess = true;
                }

                // Try suffix
                if (item.OptionInfo.Prefix + item.OptionInfo.Suffix != 0 && rnd.Next(100) < powderChance)
                {
                    var powder = new Item(62003); // Blessed Magic Powder
                    creature.AcquireItem(powder);
                    powderBurnSuccess = true;
                }

                // Reduce items
                creature.Inventory.Remove(51102, 1); // Mana Herb
                creature.Inventory.Remove(63016, 1); // Holy Water

                // Training
                this.BurnTraining(skill, enchantBurnSuccess, powderBurnSuccess);

                // Success/Fail motion
                Send.UseMotion(creature, 14, enchantBurnSuccess ? 0 : 3);
            }

            // Add exp based on item buying price (random+unofficial)
            if (item.OptionInfo.Price > 0)
            {
                exp = 40 + (int)(item.OptionInfo.Price / (float)item.Data.StackMax / 100f * item.Info.Amount);
                creature.GiveExp(exp);
            }

            // Remove item from cursor
            creature.Inventory.Remove(item);

            // Effect
            Send.Effect(MabiId.Broadcast, creature, Effect.BurnItem, campfire.EntityId, enchantBurnSuccess);
            Send.Notice(creature, NoticeType.MiddleSystem, Localization.Get("Burning EXP {0}"), exp);

            return true;
        }
开发者ID:,项目名称:,代码行数:99,代码来源:


注:本文中的Aura.Channel.World.Entities.Creature.AcquireItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。