本文整理汇总了C#中WorldObject.Spell方法的典型用法代码示例。如果您正苦于以下问题:C# WorldObject.Spell方法的具体用法?C# WorldObject.Spell怎么用?C# WorldObject.Spell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldObject
的用法示例。
在下文中一共展示了WorldObject.Spell方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例4: PropertySet
public void PropertySet(WorldObject wo)
{
ObjectClass = wo.ObjectClass.ToString();
foreach (var key in wo.BoolKeys)
{
KeyBool kb = new KeyBool();
kb.Key = key;
kb.bValue = wo.Values((BoolValueKey)key);
BoolVals.Add(kb);
if(!MasterKeyClass.BoolKeys.Contains(key)){MasterKeyClass.BoolKeys.Add(key);}
}
foreach (var key in wo.DoubleKeys)
{
KeyDouble kd = new KeyDouble();
kd.Key = key;
kd.dValue = wo.Values((DoubleValueKey)key);
DoubleVals.Add(kd);
if(!MasterKeyClass.DoubleKeys.Contains(key)){MasterKeyClass.DoubleKeys.Add(key);}
}
foreach (var key in wo.LongKeys)
{
KeyLong kl = new KeyLong();
kl.Key = key;
kl.lValue = wo.Values((LongValueKey)key);
LongVals.Add(kl);
if(!MasterKeyClass.LongKeys.Contains(key)){MasterKeyClass.LongKeys.Add(key);}
}
foreach (var key in wo.StringKeys)
{
KeyString ks = new KeyString();
ks.Key = key;
ks.sValue = wo.Values((StringValueKey)key);
StringVals.Add(ks);
if(!MasterKeyClass.StringKeys.Contains(key)){MasterKeyClass.StringKeys.Add(key);}
}
for (int i = 0; i < wo.SpellCount; i++)
{
SpellVals.Add(wo.Spell(i));
}
}
示例5: SpellStringBuilder
public string SpellStringBuilder(WorldObject item)
{
try
{
result.Length = 0;
int scount = item.SpellCount;
for (int i = 0; i < scount; i++) {
string currentspell = Gleaner.SpellIndex.ElementAt(item.Spell(i));
result.Append(currentspell);
if (i < (scount - 1)) {
result.Append(":");
}
}
return result.ToString() + ",";
}
catch
{return String.Empty;}
}