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


C# Item.HasTag方法代码示例

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


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

示例1: PlayerEquipsItem

	public void PlayerEquipsItem(Creature creature, Item item)
	{
		// Give Ranged Attack when equipping a (cross)bow
		if ((item.HasTag("/bow/|/bow01/|/crossbow/")) && !creature.Skills.Has(SkillId.RangedAttack))
			creature.Skills.Give(SkillId.RangedAttack, SkillRank.Novice);

		// Give Dice Tossing When equiping Dice
		if ((item.HasTag("/dice/")) && !creature.Skills.Has(SkillId.DiceTossing))
			creature.Skills.Give(SkillId.DiceTossing, SkillRank.Novice);

		// Give Playing Instrument when equipping an instrument
		if ((item.HasTag("/instrument/")) && !creature.Skills.Has(SkillId.PlayingInstrument))
			creature.Skills.Give(SkillId.PlayingInstrument, SkillRank.Novice);

		// Give Potion Making when equipping a Potion Concoction Kit
		if ((item.HasTag("/potion_making/kit/")) && !creature.Skills.Has(SkillId.PotionMaking))
			creature.Skills.Give(SkillId.PotionMaking, SkillRank.Novice);

		// Give Handicraft when equipping a Handicraft Kit
		if ((item.HasTag("/handicraft_kit/")) && !creature.Skills.Has(SkillId.Handicraft))
			creature.Skills.Give(SkillId.Handicraft, SkillRank.RF);

		// Give Tailoring when equipping a Tailoring Kit
		if ((item.HasTag("/tailor/kit/")) && !creature.Skills.Has(SkillId.Tailoring))
			creature.Skills.Give(SkillId.Tailoring, SkillRank.Novice);

		// Give Blacksmithing when equipping a Blacksmith Hammer
		if ((item.HasTag("/Blacksmith_Hammer/")) && !creature.Skills.Has(SkillId.Blacksmithing))
			creature.Skills.Give(SkillId.Blacksmithing, SkillRank.Novice);

		// Give Fishing when equipping a Fishing Rod
		if ((item.HasTag("/fishingrod/")) && !creature.Skills.Has(SkillId.Fishing))
			creature.Skills.Give(SkillId.Fishing, SkillRank.Novice);

		// Give Enchant when equipping Magic Powder
		if ((item.HasTag("/enchant/powder/")) && !creature.Skills.Has(SkillId.Enchant))
		{
			creature.Skills.Give(SkillId.Enchant, SkillRank.Novice);
			creature.Skills.Train(SkillId.Enchant, 1);
		}

		// Cancel active bolt skill if weapon changes
		if (ChannelServer.Instance.Conf.World.SwitchCancelBolts)
		{
			if (item.Info.Pocket == creature.Inventory.RightHandPocket || item.Info.Pocket == creature.Inventory.LeftHandPocket || item.Info.Pocket == creature.Inventory.MagazinePocket)
			{
				var skill = creature.Skills.ActiveSkill;
				if (skill != null && skill.Is(SkillId.Icebolt, SkillId.Firebolt, SkillId.Lightningbolt))
					creature.Skills.CancelActiveSkill();
			}
		}
	}
开发者ID:aura-project,项目名称:aura,代码行数:52,代码来源:on_equip.cs

示例2: PlayerEquipsItem

	public void PlayerEquipsItem(Creature creature, Item item)
	{
		// Give Ranged Attack when equipping a (cross)bow
		if ((item.HasTag("/bow/|/bow01/|/crossbow/")) && !creature.Skills.Has(SkillId.RangedAttack))
			creature.Skills.Give(SkillId.RangedAttack, SkillRank.Novice);

		// Give Dice Tossing When equiping Dice
		if ((item.HasTag("/dice/")) && !creature.Skills.Has(SkillId.DiceTossing))
			creature.Skills.Give(SkillId.DiceTossing, SkillRank.Novice);

		// Give Playing Instrument when equipping an instrument
		if ((item.HasTag("/instrument/")) && !creature.Skills.Has(SkillId.PlayingInstrument))
			creature.Skills.Give(SkillId.PlayingInstrument, SkillRank.Novice);

		// Give Potion Making when equipping a Potion Concoction Kit
		if ((item.HasTag("/potion_making/kit/")) && !creature.Skills.Has(SkillId.PotionMaking))
			creature.Skills.Give(SkillId.PotionMaking, SkillRank.Novice);

		// Give Handicraft when equipping a Handicraft Kit
		if ((item.HasTag("/handicraft_kit/")) && !creature.Skills.Has(SkillId.Handicraft))
			creature.Skills.Give(SkillId.Handicraft, SkillRank.RF);

		// Give Tailoring when equipping a Tailoring Kit
		if ((item.HasTag("/tailor/kit/")) && !creature.Skills.Has(SkillId.Tailoring))
			creature.Skills.Give(SkillId.Tailoring, SkillRank.Novice);

		// Give Blacksmithing when equipping a Blacksmith Hammer
		if ((item.HasTag("/tool/blacksmith/")) && !creature.Skills.Has(SkillId.Blacksmithing))
			creature.Skills.Give(SkillId.Blacksmithing, SkillRank.Novice);
	}
开发者ID:tkiapril,项目名称:aura,代码行数:30,代码来源:on_equip.cs

示例3: OnUse

	public override void OnUse(Creature creature, Item item)
	{
		// Avon Feather
		if (item.HasTag("/feather_of_avon/"))
		{
			var regionId = item.MetaData1.GetInt("AFRR");
			var x = item.MetaData1.GetInt("AFRX");
			var y = item.MetaData1.GetInt("AFRY");
			var lastWarp = item.MetaData1.GetDateTime("AFLU");
			var inAvon = (creature.RegionId == AvonRegionId);
			var pos = creature.GetPosition();

			// Stop if on cooldown or creature is in a temp region
			if (DateTime.Now < lastWarp.AddMinutes(AvonCoolDown) || creature.Region.IsTemp)
			{
				Send.ServerMessage(creature, L("Safety error, failed to warp."));
				return;
			}

			// Don't warp if it's the first time and the creature already
			// is in Avon, or if creature already is in the target region.
			if ((regionId == 0 && creature.RegionId == AvonRegionId) || creature.RegionId == regionId)
			{
				Send.ServerMessage(creature, L("Region error, failed to warp."));
				return;
			}

			// Update feather's destination
			item.MetaData1.SetInt("AFRR", creature.RegionId);
			item.MetaData1.SetInt("AFRX", inAvon ? AvonX : pos.X);
			item.MetaData1.SetInt("AFRY", inAvon ? AvonY : pos.Y);
			item.MetaData1.SetLong("AFLU", DateTime.Now);
			Send.ItemUpdate(creature, item);

			// Warp, default to Avon if region is 0
			if (regionId == 0)
				creature.Warp(AvonRegionId, AvonX, AvonY);
			else
				creature.Warp(regionId, x, y);

			return;
		}

		// A few items prepare a skill, instead of sending use, to reduce
		// redundancy we'll call into the skill handler.
		HiddenTownBack.Warp(creature, item);
	}
开发者ID:tkiapril,项目名称:aura,代码行数:47,代码来源:warp_scroll.cs

示例4: PlayerUnequipsItem

	public void PlayerUnequipsItem(Creature creature, Item item)
	{
		// Remove Mana on unequipping wand
		// http://mabinogiworld.com/view/Mana_Evaporation
		if (!IsEnabled("ManaBurnRemove"))
		{
			if (item.HasTag("/wand/|/staff/"))
			{
				var rate = Math2.Clamp(0, 100, 100 - creature.Inventory.GetManaBurnBonus());
				creature.BurnMana(rate);

				if (rate == 100)
					Send.Notice(creature, L("The Mana connected to the Wand has disappeared!"));
				else
					// Unofficial, but makes more sense.
					Send.Notice(creature, L("Some Mana connected to the Wand has disappeared!"));
			}
		}
	}
开发者ID:aura-project,项目名称:aura,代码行数:19,代码来源:on_equip.cs


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