本文整理汇总了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;
}