本文整理汇总了C#中WorldObject.ActiveSpell方法的典型用法代码示例。如果您正苦于以下问题:C# WorldObject.ActiveSpell方法的具体用法?C# WorldObject.ActiveSpell怎么用?C# WorldObject.ActiveSpell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldObject
的用法示例。
在下文中一共展示了WorldObject.ActiveSpell方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static MyWorldObject Create(WorldObject wo)
{
MyWorldObject mwo = new MyWorldObject();
Dictionary<int, bool> boolValues = new Dictionary<int,bool>();
Dictionary<int, double> doubleValues = new Dictionary<int,double>();
Dictionary<int, int> intValues = new Dictionary<int, int>();
Dictionary<int, string> stringValues = new Dictionary<int,string>();
List<int> activeSpells = new List<int>();
List<int> spells = new List<int>();
foreach (var key in wo.BoolKeys)
boolValues.Add(key, wo.Values((BoolValueKey)key));
foreach (var key in wo.DoubleKeys)
doubleValues.Add(key, wo.Values((DoubleValueKey)key));
foreach (var key in wo.LongKeys)
intValues.Add(key, wo.Values((LongValueKey)key));
foreach (var key in wo.StringKeys)
stringValues.Add(key, wo.Values((StringValueKey)key));
for (int i = 0 ; i < wo.ActiveSpellCount ; i++)
activeSpells.Add(wo.ActiveSpell(i));
for (int i = 0; i < wo.SpellCount; i++)
spells.Add(wo.Spell(i));
mwo.Init(wo.HasIdData, wo.Id, wo.LastIdTime, (int)wo.ObjectClass, boolValues, doubleValues, intValues, stringValues, activeSpells, spells);
return mwo;
}
示例2: CapturedWorldObject
internal CapturedWorldObject(WorldObject wo)
{
this.Id = wo.Id;
this.Name = wo.Name;
this.ObjectClass = wo.ObjectClass;
this.Behavior = wo.Behavior;
this.Category = wo.Category;
this.Container = wo.Container;
this.GameDataFlags1 = wo.GameDataFlags1;
this.Icon = wo.Icon;
this.LastIdTime = wo.LastIdTime;
this.PhysicsDataFlags = wo.PhysicsDataFlags;
this.Type = wo.Type;
this.HasIdData = wo.HasIdData;
this._coordinates = wo.Coordinates();
this._orientation = wo.Orientation();
this._offset = wo.Offset();
this._rawCoordinates = wo.RawCoordinates();
var tmpIntList = new List<int>();
for (int i = 0; i < wo.ActiveSpellCount; i++)
{
tmpIntList.Add(wo.ActiveSpell(i));
}
this._activeSpells = General.ListOperations.Capture(tmpIntList).AsReadOnly();
tmpIntList.Clear();
for (int i = 0; i < wo.SpellCount; i++)
{
tmpIntList.Add(wo.Spell(i));
}
this._spells = General.ListOperations.Capture(tmpIntList).AsReadOnly();
foreach (var key in wo.BoolKeys)
_boolValues.Add(key, wo.Values((BoolValueKey)key));
foreach (var key in wo.DoubleKeys)
_doubleValues.Add(key, wo.Values((DoubleValueKey)key));
foreach (var key in wo.LongKeys)
this._longValues.Add(key, wo.Values((LongValueKey)key));
foreach (var key in wo.StringKeys)
_stringValues.Add(key, wo.Values((StringValueKey)key));
}
示例3: 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;
}