本文整理汇总了C#中WCell.RealmServer.Spells.Spell.GetDuration方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.GetDuration方法的具体用法?C# Spell.GetDuration怎么用?C# Spell.GetDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCell.RealmServer.Spells.Spell
的用法示例。
在下文中一共展示了Spell.GetDuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendTotemCreated
public static bool SendTotemCreated(IPacketReceiver client, Spell totemSpell, EntityId totemEntityId)
{
var chr = client as Character;
if (chr == null)
return false;
var effect = totemSpell.GetEffect(SpellEffectType.Summon);
if (effect == null)
return false;
var slot = effect.SummonEntry.Slot - 1;
using(var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TOTEM_CREATED))
{
packet.Write(slot);
packet.Write(totemEntityId);
packet.Write(totemSpell.GetDuration(chr.SharedReference));
packet.Write(totemSpell.Id);
client.Send(packet);
}
return true;
}
示例2: ApplyAura
public static void ApplyAura(TestCharacter chr, Spell spell)
{
Assert.IsTrue(spell.IsAura || spell.IsAreaAura, "Spell {0} is not an Aura", spell);
chr.EnsureInWorld();
chr.ShapeshiftForm = ShapeshiftForm.Normal;
chr.Auras.Clear();
Assert.AreEqual(0, chr.Auras.Count);
// important: Execute this in the Region's thread
chr.Region.AddMessageAndWait(new Message(() => {
chr.SpellCast.TriggerSelf(spell);
var failure =
chr.FakeClient.DequeueSMSG(RealmServerOpCode.SMSG_SPELL_FAILURE);
Assert.IsNull(failure,
failure != null
? "Spell failed: " + failure["FailReason"].Value
: "");
Assert.AreEqual(1, chr.Auras.Count, "Aura was not added.");
var aura = chr.Auras[spell, !spell.HasHarmfulEffects];
Assert.IsNotNull(aura);
Assert.AreEqual(spell.GetDuration(chr.CasterInfo, chr), (uint)aura.Duration);
Assert.AreNotEqual(0, spell.GetDuration(chr.CasterInfo, chr));
Asser.GreaterOrEqual(spell.GetDuration(chr.CasterInfo, chr), (uint)aura.TimeLeft);
aura.Cancel();
Assert.IsNull(chr.Auras[spell, !spell.HasHarmfulEffects]);
Assert.AreEqual(0, chr.Auras.Count);
}));
}