public SpellAnimEditor() { try { InitializeComponent(); EntryArrayBox.Load("Spell Animations.txt"); EntryArrayBox.Value = 0; EntryArrayBox.ValueChanged += EntryArrayBox_ValueChanged; Commands = new SpellCommands("Spell Commands.txt"); Anim_CodeBox.KeyDown += new KeyEventHandler(TextBox_SelectAll); Anim_CodeBox.AddSyntax(ASM.GetInstructionsRegex_Thumb(), System.Drawing.Color.Black, FontStyle.Bold | FontStyle.Italic); Anim_CodeBox.AddSyntax(Commands.GetRegex(), SystemColors.Highlight); Anim_CodeBox.AddSyntax(@"((\b[0-9]+)|((\b0x|\$)[0-9a-fA-F]+))\b", System.Drawing.Color.SlateBlue); Anim_CodeBox.AddSyntax("return|label.*", SystemColors.ControlDark); Anim_CodeBox.AddSyntax("@.*", SystemColors.ControlDark); } catch (Exception ex) { Program.ShowError("Could not properly open the " + this.Text, ex); Core_CloseEditor(this, null); } }
public override async Task <bool> Invoke(double manaPercentFloor = 10) { if (Self.Self.Mana.Percent > manaPercentFloor.EvaluateAsPercentage()) { return(false); } var didMageInvoke = false; if (_mageInvokeOrb != null) { didMageInvoke = await SpellCommands.CastAetheredSpell(Self, _mageInvokeOrb, _mageInvokeStatus); } if (didMageInvoke) { InvokeStatus.ResetStatusCooldown(); return(true); } var didInvoke = await SpellCommands.CastAetheredSpell(Self, InvokeSpell, InvokeStatus, true); if (didInvoke) { _mageInvokeStatus?.ResetStatusCooldown(); } return(didInvoke); }
/// <summary> /// Makes the caster invisible to multiply physical attack damage. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Invisible(bool ambush) { _invisibleStatus.Cooldown = ambush && _self.Spells.KeySpells.Ambush != null ? AmbushCooldown : MeleeCooldown; return(await SpellCommands.CastInvisibleSpell(Self, _invisibleSpell, _invisibleStatus)); }
/// <summary> /// Casts a Fury buff. Does not include Rage/Cunning. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Fury() { if (RageSpell != null) { return(false); } return(await SpellCommands.CastAetheredSpell(Self, _furySpell, _furyStatus)); }
/// <summary> /// Casts the Desperate Attack attack spell on the target in front of the caster. /// </summary> /// <param name="minimumVitaPercent">Vita percent threshold below which the spell /// will not be cast.</param> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> DesperateAttack(double minimumVitaPercent = 80) { if (Self.Self.Vita.Percent < minimumVitaPercent.EvaluateAsPercentage()) { return(false); } return(await SpellCommands.CastAetheredSpell(Self, _desperateAttackSpell, _desperateAttackStatus)); }
/// <summary> /// Teleports to the opposite side of the target in front of the caster /// and performs a physical attack on that target. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task Ambush() { await Self.Activity.WaitForMeleeCooldown(); if (await SpellCommands.CastSpell(Self, _ambushSpell, true)) { Self.Activity.ResetCommandCooldown(); } }
/// <summary> /// Casts a Rage/Cunning buff. Does not include Furies. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Rage() { if (_rageSpell == null) { return(false); } return(await SpellCommands.CastAetheredSpell(Self, _rageSpell, _rageStatus)); }
/// <summary> /// Casts the Whirlwind attack spell on the target in front of the caster. /// </summary> /// <param name="minimumVitaPercent">Vita percent threshold below which the spell /// will not be cast.</param> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Whirlwind(double minimumVitaPercent = 80) { if (Self.Self.Vita.Percent < minimumVitaPercent.EvaluateAsPercentage()) { return(false); } return(await SpellCommands.CastAetheredSpell(Self, _whirlwindSpell, _whirlwindStatus)); }
private async Task <bool> Inspire(string targetName, uint targetUid) { if (InvokeSpell == null) { return(false); } return(await SpellCommands.CastTargetableSpell(Self, _inspireSpell, targetUid, targetName, true)); }
/// <summary> /// Casts the Invoke spell to restore mana at the cost of vita but only if current /// mana is less than the specified threshold. Set threshold to 100 to always Invoke /// as soon as possible. /// </summary> /// <param name="manaPercentFloor">The mana percent threshold below which the spell /// is eligible to be cast.</param> /// <returns>True if the spell was cast; false otherwise.</returns> public virtual async Task <bool> Invoke(double manaPercentFloor = 10) { if (Self.Self.Mana.Percent > manaPercentFloor.EvaluateAsPercentage()) { return(false); } return(await SpellCommands.CastAetheredSpell(Self, InvokeSpell, InvokeStatus, true)); }
/// <summary> /// Casts the Sul Slash attack spell on the target in front of the caster. /// </summary> /// <param name="minimumVitaPercent">Vita percent threshold below which the spell /// will not be cast.</param> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> SulSlash(double minimumVitaPercent = 80) { if (Self.Self.Vita.Percent < minimumVitaPercent.EvaluateAsPercentage()) { return(false); } return(await SpellCommands.CastAetheredSpell(Self, _sulSlashOrb, _sulSlashStatus)); }
/// <summary> /// Casts the Hellfire attack spell on a target. /// </summary> /// <param name="target">The NPC to target for the attack.</param> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Hellfire(Npc target) { if (_hellfireStatus.IsActive) // Potentially redundant but required to avoid unnecessary casting of Doze/Sleep. { return(false); } if (!await _self.Commands.Debuffs.Doze(target)) { await _self.Commands.Debuffs.Sleep(target); } return(await SpellCommands.CastAetheredTargetableSpell(Self, _hellfireSpell, _hellfireStatus, target)); }
/// <summary> /// Casts a non-targetable, self-heal spell. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> HealSelf() { return(await SpellCommands.CastSpell(_self, _healSelfSpell)); }
/// <summary> /// Casts the Shadow Figure buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> ShadowFigure() { return(await SpellCommands.CastAetheredSpell(Self, _shadowFigureSpell, _shadowFigureStatus)); }
public override void Execute() { SpellCommands.InterruptSpell(); }
/// <summary> /// Makes the caster invisible to multiply physical attack damage. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Invisible() { return(await SpellCommands.CastInvisibleSpell(Self, _invisibleSpell, _invisibleStatus)); }
/// <summary> /// Casts the Might buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Might() { return(await SpellCommands.CastAetheredSpell(Self, _mightSpell, _mightStatus)); }
/// <summary> /// Casts the Flank buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Flank() { return(await SpellCommands.CastAetheredSpell(Self, _flankSpell, _flankStatus)); }
/// <summary> /// Casts the Potency buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Potence() { return(await SpellCommands.CastAetheredSpell(Self, _potenceSpell, _potenceStatus)); }
/// <summary> /// Casts the Backstab buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Backstab() { return(await SpellCommands.CastAetheredSpell(Self, _backstabSpell, _backstabStatus)); }
/// <summary> /// Casts the Blessing buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Blessing() { return(await SpellCommands.CastAetheredSpell(Self, _blessingSpell, _blessingStatus)); }
/// <summary> /// Zaps a target for ranged magic damage. /// </summary> /// <param name="target">The NPC to target for the attack.</param> /// <param name="isLowCostSpell">If true, a minor mana restoration item will be used if the /// caster lacks sufficient mana to cast the spell. If false, a major mana restoration item /// will be used instead.</param> /// <returns>True if a spell is cast. False otherwise.</returns> public async Task <bool> Zap(Npc target, bool isLowCostSpell = false) { return(await SpellCommands.CastTargetableSpell(Self, ZapSpell, target, isLowCostSpell)); }
/// <summary> /// Casts an Enchantment buff. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task Enchant() { await SpellCommands.CastSpell(Self, _enchantSpell); }
/// <summary> /// Teleports to the opposite side of the target in front of the caster /// and performs a physical attack on that target. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Ambush() { return(await SpellCommands.CastSpell(Self, _ambushSpell, true)); }
private async Task <bool> Restore(uint targetUid, string targetName) { return(await SpellCommands.CastAetheredTargetableSpell(_self, _restoreSpell, _self.Status.Restore, targetUid, targetName)); }
private async Task <bool> Heal(uint targetUid, string targetName) { return(await SpellCommands.CastTargetableSpell(_self, _healSpell, targetUid, targetName)); }
/// <summary> /// Reveals any NPC ambushes hidden on the screen. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> SpotTraps() { return(await SpellCommands.CastAetheredSpell(Self, _spotTrapsSpell, _spotTrapsStatus)); }
public void WillKeepLastBetweenCasts() { Engine.Player = new PlayerMobile(0x01); Engine.PacketWaitEntries = new PacketWaitEntries(); AutoResetEvent are = new AutoResetEvent(false); void OnWaitEntryAddedEvent(PacketWaitEntry entry) { PacketWriter target = new PacketWriter(0x19); target.Write((byte)0x6C); target.Fill(); Engine.SendPacketToClient(target); Engine.PacketWaitEntries.CheckWait(target.ToArray(), PacketDirection.Incoming); } Engine.PacketWaitEntries.WaitEntryAddedEvent += OnWaitEntryAddedEvent; void OnInternalPacketSentEvent(byte[] data, int length) { if (data[0] != 0x6C) { return; } int serial = (data[7] << 24) | (data[8] << 16) | (data[9] << 8) | data[10]; if (serial != 0x00aabbcc) { Assert.Fail(); } are.Set(); } Engine.InternalPacketSentEvent += OnInternalPacketSentEvent; Task.Run(() => SpellCommands.Cast("Explosion", 0x00aabbcc)); bool result = are.WaitOne(60000); Assert.AreEqual(0x00aabbcc, AliasCommands.GetAlias("last")); Assert.IsTrue(result); Task.Run(() => SpellCommands.Cast("Explosion", "last")); result = are.WaitOne(60000); Assert.AreEqual(0x00aabbcc, AliasCommands.GetAlias("last")); Assert.IsTrue(result); Assert.AreEqual(0x00aabbcc, Engine.Player.LastTargetSerial); Engine.PacketWaitEntries.WaitEntryAddedEvent -= OnWaitEntryAddedEvent; Engine.InternalPacketSentEvent -= OnInternalPacketSentEvent; Engine.Player = null; }
/// <summary> /// Casts the Harden Body buff on the caster. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> HardenBody() { return(await SpellCommands.CastAetheredSpell(Self, _hardenBodySpell, _hardenBodyStatus)); }
/// <summary> /// Casts a Rage/Cunning buff. Does not include Furies. /// </summary> /// <returns>True if the spell was cast; false otherwise.</returns> public async Task <bool> Rage() { return(await SpellCommands.CastRage(Self, RageSpell, RageStatus)); }