/// <summary> /// Assigns debuff spells from the Poet's spell inventory. /// </summary> /// <param name="self">The game client data for the Poet.</param> public PoetDebuffCommands(PoetClient self) : base(self) { _self = self; _atoneSpell = _self.Spells.KeySpells.Atone; _removeVeilSpell = _self.Spells.KeySpells.RemoveVeil; }
/// <summary> /// Determines whether or not a spell target is currently off-screen. This is used to /// determine whether or not a spell can be cast on the target if attempted. Please /// note that this is unreliable when the caster is off-center in the map due to being /// near one or more of its edges. In that case, it is quite possible for a target to /// be on-screen but still be out of range for spells. There is some risk of the bot /// getting stuck repeatedly attempting to cast a spell on a multibox group member /// target that it thinks is within range. There is also risk of the bot thinking it /// successfully cast a spell on an external group member or NPC target when it did /// not. It is best practice to keep the caster centered within the screen as often as /// possible. /// </summary> /// <param name="targetUid">The UID of the target.</param> /// <param name="targetableSpell">Any targetable spell.</param> /// <returns>True if the target is off-screen; false otherwise.</returns> public async Task <bool> IsTargetOffScreen(uint targetUid, KeySpell targetableSpell) { if (targetableSpell == null) { throw new ArgumentNullException(nameof(targetableSpell), "Cannot determine whether or not a target is off-screen without a targetable spell."); } Targeting.Item = targetUid; Targeting.Spell = targetUid; if (targetUid == Self.Uid) { return(false); } var spellOrItemKey = targetableSpell.IsOrbSpell ? "u" : "Z"; var keys = $"{Keys.Esc}{spellOrItemKey}{targetableSpell.Letter}{Keys.Esc}"; Send(keys); await Task.Delay(20); if (targetableSpell.IsOrbSpell) { return(Targeting.Item == Self.Uid); } return(Targeting.Spell == Self.Uid); }
/// <summary> /// Assigns Harden Armor, Sanctuary, and Valor spells from the Poet's spell inventory. /// </summary> /// <param name="self">The game client data for the Poet.</param> public CasterAsvCommands(PoetClient self) { _self = self; _hardenArmorSpell = self.Spells.KeySpells.HardenArmor; _sanctuarySpell = self.Spells.KeySpells.Sanctuary; _valorSpell = self.Spells.KeySpells.Valor; }
/// <summary> /// Assigns mana restoration spells from a Mage's spell inventory. /// </summary> /// <param name="self">The game client data for the Mage.</param> protected CasterManaCommands(MageClient self) { Self = self; InvokeSpell = self.Spells.KeySpells.Invoke; InvokeStatus = self.Status.Invoke; }
/// <summary> /// Assigns attack spells from the Warrior's spell inventory. /// </summary> /// <param name="self">The game client data for the Warrior.</param> public WarriorAttackCommands(WarriorClient self) : base(self) { _berserkSpell = self.Spells.KeySpells.Berserk; _berserkStatus = self.Status.Berserk; _whirlwindSpell = self.Spells.KeySpells.Whirlwind; _whirlwindStatus = self.Status.Whirlwind; }
/// <summary> /// Assigns attack spells from the Rogue's spell inventory. /// </summary> /// <param name="self">The game client data for the Rogue.</param> public RogueAttackCommands(RogueClient self) : base(self) { _ambushSpell = self.Spells.KeySpells.Ambush; _desperateAttackSpell = self.Spells.KeySpells.DesperateAttack; _desperateAttackStatus = self.Status.DesperateAttack; _lethalStrikeSpell = self.Spells.KeySpells.LethalStrike; _lethalStrikeStatus = self.Status.LethalStrike; }
/// <summary> /// /// Assigns spells and items from the Warrior's spell and item inventories. /// </summary> /// <param name="self">The game client data for the Warrior.</param> protected PeasantCommands(WarriorClient self) { Self = self; _gatewaySpell = self.Spells.KeySpells.Gateway; Items = new PeasantItemCommands(self); Movement = new PeasantMovementCommands(self); }
/// <summary> /// /// Assigns spells and items from the Peasant's spell and item inventories. /// </summary> /// <param name="self">The game client data for the Peasant.</param> public PeasantCommands(PeasantClient self) { Self = self; _gatewaySpell = self.Spells.KeySpells.Gateway; Items = new PeasantItemCommands(self); Movement = new PeasantMovementCommands(self); }
/// <summary> /// Assigns debuff and debuff cure spells from a Poet's spell inventory. /// </summary> /// <param name="self">The game client data for the Poet.</param> protected CasterDebuffCommands(PoetClient self) { _self = self; _cureParalysisSpell = self.Spells.KeySpells.CureParalysis; CurseSpell = self.Spells.KeySpells.Curse; _purgeSpell = self.Spells.KeySpells.Purge; _removeCurseSpell = self.Spells.KeySpells.RemoveCurse; }
/// <summary> /// Assigns spells from the Warrior's spell inventory. /// </summary> /// <param name="self">The game client data for the Warrior.</param> public WarriorCommands(WarriorClient self) : base(self) { _spotTrapsSpell = self.Spells.KeySpells.SpotTraps; _spotTrapsStatus = self.Status.SpotTraps; Attacks = new WarriorAttackCommands(self); Buffs = new WarriorBuffCommands(self); Heal = new PeasantHealCommands(self); }
/// <summary> /// Assigns attack spells from the Mage's spell inventory. /// </summary> /// <param name="self">The game client data for the Mage.</param> public MageAttackCommands(MageClient self) : base(self) { _self = self; _hellfireSpell = self.Spells.KeySpells.Hellfire; _hellfireStatus = self.Status.Hellfire; _infernoSpell = self.Spells.KeySpells.Inferno; _infernoStatus = self.Status.Inferno; }
/// <summary> /// Assigns buff spells from the Rogue's spell inventory. /// </summary> /// <param name="self">The game client data for the Rogue.</param> public RogueBuffCommands(RogueClient self) : base(self) { _invisibleSpell = self.Spells.KeySpells.Invisible; _invisibleStatus = self.Status.Invisible; _mightSpell = self.Spells.KeySpells.Might; _mightStatus = self.Status.Might; _shadowFigureSpell = self.Spells.KeySpells.ShadowFigure; _shadowFigureStatus = self.Status.ShadowFigure; }
/// <summary> /// Assigns buff spells from the Warrior's spell inventory. /// </summary> /// <param name="self">The game client data for the Warrior.</param> protected FighterBuffCommands(WarriorClient self) { Self = self; _rageSpell = self.Spells.KeySpells.Rage; _rageStatus = self.Status.Rage; _enchantSpell = self.Spells.KeySpells.Enchant; _furySpell = self.Spells.KeySpells.Fury; _furyStatus = self.Status.Fury; }
/// <summary> /// Assigns spells from the Poet's spell inventory. /// </summary> /// <param name="self">The game client data for the Poet.</param> public PoetCommands(PoetClient self) : base(self) { _hardenBodySpell = self.Spells.KeySpells.HardenBody; _hardenBodyStatus = self.Status.HardenBody; Attacks = new PoetAttackCommands(self); Debuffs = new PoetDebuffCommands(self); Heal = new PoetHealCommands(self); Mana = new PoetManaCommands(self); }
/// <summary> /// Assigns debuff spells from the Mage's spell inventory. /// </summary> /// <param name="self">The game client data for the Mage.</param> public MageDebuffCommands(MageClient self) : base(self) { _self = self; _blindSpell = self.Spells.KeySpells.Blind; _dozeSpell = self.Spells.KeySpells.Doze; _paralyzeSpell = self.Spells.KeySpells.Paralyze; _sleepSpell = self.Spells.KeySpells.Sleep; _venomSpell = self.Spells.KeySpells.Venom; }
private static async Task RestoreManaForSpell(TkClient itemUser, KeySpell spell, Restoration manaRestorationItem) { await itemUser.Activity.WaitForCommandCooldown(); var currentMana = (int)itemUser.Self.Mana.Current; if (currentMana < spell.Cost) { await UseManaRestorationItem(itemUser, manaRestorationItem, spell.Cost - currentMana); } }
/// <summary> /// Assigns buff spells from the Warrior's spell inventory. /// </summary> /// <param name="self">The game client data for the Warrior.</param> public WarriorBuffCommands(WarriorClient self) : base(self) { _backstabSpell = self.Spells.KeySpells.Backstab; _backstabStatus = self.Status.Backstab; _blessingSpell = self.Spells.KeySpells.Blessing; _blessingStatus = self.Status.Blessing; _flankSpell = self.Spells.KeySpells.Flank; _flankStatus = self.Status.Flank; _potenceSpell = self.Spells.KeySpells.Potence; _potenceStatus = self.Status.Potence; }
/// <summary> /// Assigns mana restoration spells from a Poet's spell inventory. /// </summary> /// <param name="self">The game client data for the Poet.</param> protected CasterManaCommands(PoetClient self) { Self = self; InvokeSpell = self.Spells.KeySpells.Invoke; InvokeStatus = self.Status.Invoke; if (InvokeSpell == null) { Log.Warning($"{self.Self.Name} does not have an Invoke spell. Mana restoration item consumption will be very high."); } }
/// <summary> /// Assigns mana restoration spells from a Mage's spell inventory. /// </summary> /// <param name="self">The game client data for the Mage.</param> public MageManaCommands(MageClient self) : base(self) { if (Self.Inventory.KeyItems.InvokeOrb != null) { _mageInvokeOrb = new KeySpell(Self.Inventory.KeyItems.InvokeOrb); _mageInvokeStatus = self.Status.MageInvoke; } if (InvokeSpell == null && _mageInvokeOrb == null) { Log.Warning($"{self.Self.Name} does not have an Invoke spell. Mana restoration item consumption will be very high."); } }
public void TestDisplayName(string unalignedName, string alignedName, string expectedDisplayName) { var actualDisplayName = new KeySpell(unalignedName, alignedName, 0).DisplayName; Console.WriteLine($@"Actual: {actualDisplayName}"); Console.WriteLine($@"Expect: {expectedDisplayName}"); var result = actualDisplayName == expectedDisplayName; Console.WriteLine($@"Result: {result}"); Assert.IsTrue(result); }
public static async Task <bool> CastTargetableSpell( TkClient caster, KeySpell spell, uint targetUid, string targetName, bool isLowCostSpell = false) { if (spell == null || await caster.IsTargetOffScreen(targetUid, spell)) { return(false); } return(await CastSpell(caster, spell, isLowCostSpell, targetName)); }
/// <summary> /// Assigns debuff spells from the Mage's spell inventory. /// </summary> /// <param name="self">The game client data for the Mage.</param> public MageDebuffCommands(MageClient self) : base(self) { _self = self; _blindSpell = self.Spells.KeySpells.Blind; _dozeSpell = self.Spells.KeySpells.Doze; _paralyzeSpell = self.Spells.KeySpells.Paralyze; _sleepSpell = self.Spells.KeySpells.Sleep; _venomSpell = self.Spells.KeySpells.Venom; _scourgeOrb = self.Inventory.KeyItems.ScourgeOrb == null ? null : new KeySpell(self.Inventory.KeyItems.ScourgeOrb); }
public static async Task <bool> CastInvisibleSpell( TkClient caster, KeySpell spell, InvisibleStatus status) { var didCastSpell = await CastSpell(caster, spell, true); if (didCastSpell) { status.ResetStatusCooldown(); } return(didCastSpell); }
/// <summary> /// Assigns attack spells from the Mage's spell inventory. /// </summary> /// <param name="self">The game client data for the Mage.</param> public MageAttackCommands(MageClient self) : base(self) { _self = self; _hellfireSpell = self.Spells.KeySpells.Hellfire; _hellfireStatus = self.Status.Hellfire; _infernoSpell = self.Spells.KeySpells.Inferno; _infernoStatus = self.Status.Inferno; if (self.Inventory.KeyItems.SulSlashOrb == null) { return; } _sulSlashOrb = new KeySpell(self.Inventory.KeyItems.SulSlashOrb); _sulSlashStatus = self.Status.SulSlash; }
public static async Task <bool> CastTargetableSpell( TkClient caster, KeySpell spell, Npc target, bool isLowCostSpell = false) { if (await CastTargetableSpell(caster, spell, target.Uid, $"NPC {target.Uid}", isLowCostSpell)) { return(true); } if (spell != null) // Indicates that the target is off-screen without having to repeat the relatively inefficient IsTargetOffScreen() check { caster.Npcs.Remove(target); } return(false); }
public static async Task <bool> CastAetheredSpell( TkClient caster, KeySpell spell, BuffStatus status, bool isLowCostSpell = false) { if (status.IsActive) { return(false); } var didCastSpell = await CastSpell(caster, spell, isLowCostSpell); if (didCastSpell) { status.ResetStatusCooldown(); } return(didCastSpell); }
public static async Task <bool> CastRage( TkClient caster, KeySpell spell, RageStatus status) { if (status.IsActive) { return(false); } var didCastSpell = await CastSpell(caster, spell); // ReSharper disable once InvertIf if (didCastSpell) { status.ResetStatusCooldown(); status.CurrentRageLevel++; } return(didCastSpell); }
public static async Task <bool> CastAetheredTargetableSpell( TkClient caster, KeySpell spell, BuffStatus status, uint targetUid, string targetName, bool isLowCostSpell = false) { if (status.IsActive) { return(false); } var didCastSpell = await CastTargetableSpell(caster, spell, targetUid, targetName, isLowCostSpell); if (didCastSpell) { status.ResetStatusCooldown(); } return(didCastSpell); }
/// <summary> /// Assigns heal spells from the Poet's spell inventory. /// </summary> /// <param name="self">The game client data for the Poet.</param> public PoetHealCommands(PoetClient self) : base(self) { _self = self; _restoreSpell = _self.Spells.KeySpells.Restore; }
public static async Task RestoreMinorManaForSpell(TkClient itemUser, KeySpell spell) { await RestoreManaForSpell(itemUser, spell, itemUser.Inventory.KeyItems.MinorManaRestoration); }