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


C# WorldObject.Exists方法代码示例

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


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

示例1: RecaclulteState

		private EquipmentTrackedItemState RecaclulteState(WorldObject wo)
		{
			// We need basic IdData to determine if an item is active
			if (!wo.HasIdData)
				return EquipmentTrackedItemState.Unknown;

			// If this item has no spells, its not activateable
			if (wo.SpellCount == 0 || wo.Values(LongValueKey.MaximumMana) == 0)
				return EquipmentTrackedItemState.NotActivatable;

			// If this item has no mana in it, it's not active
			if (wo.Values(LongValueKey.CurrentMana, 0) == 0)
				return EquipmentTrackedItemState.NotActive;


			// Go through and find all of our current active spells (enchantments)
			List<int> activeSpellsOnChar = new List<int>();

			foreach (EnchantmentWrapper wrapper in CoreManager.Current.CharacterFilter.Enchantments)
			{
				// Only add ones that are cast by items (have no duration)
				if (wrapper.TimeRemaining <= 0)
					activeSpellsOnChar.Add(wrapper.SpellId);
			}

			FileService service = CoreManager.Current.Filter<FileService>();


			// Lets check if the item is not active We check to see if this item has any spells that are not activated.
			bool inactiveSpellFound = false;

			// Go through all of this items spells to determine if all are active.
			for (int i = 0 ; i < wo.SpellCount ; i++)
			{
				int spellOnItemId = wo.Spell(i);

				if (wo.Exists(LongValueKey.AssociatedSpell) && (wo.Values(LongValueKey.AssociatedSpell) == spellOnItemId))
					continue;

				Spell spellOnItem = service.SpellTable.GetById(spellOnItemId);

				// If it is offensive, it is probably a cast on strike spell
				if (spellOnItem.IsDebuff || spellOnItem.IsOffensive)
					continue;


				// Check if this particular spell is active
				bool thisSpellIsActive = false;


				// Check to see if this item cast any spells on itself.
				for (int j = 0 ; j < wo.ActiveSpellCount ; j++)
				{
					int activeSpellOnItemId = wo.ActiveSpell(j);

					if ((service.SpellTable.GetById(activeSpellOnItemId).Family == spellOnItem.Family) && (service.SpellTable.GetById(activeSpellOnItemId).Difficulty >= spellOnItem.Difficulty))
					{
						thisSpellIsActive = true;
						break;
					}
				}

				if (thisSpellIsActive)
					continue;


				// Check to see if this item cast any spells on the player.
				foreach (int j in activeSpellsOnChar)
				{
					if (service.SpellTable.GetById(j) != null && (service.SpellTable.GetById(j).Family == spellOnItem.Family) && (service.SpellTable.GetById(j).Difficulty >= spellOnItem.Difficulty))
					{
						thisSpellIsActive = true;
						break;
					}
				}

				if (thisSpellIsActive)
					continue;

				// This item has not cast this particular spell.
				inactiveSpellFound = true;
				break;
			}


			if (inactiveSpellFound)
				return EquipmentTrackedItemState.NotActive;

			return EquipmentTrackedItemState.Active;
		}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:90,代码来源:EquipmentTrackedItem.cs


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