/*
* RetPalaPvE - Retribution Paladin PvE Fight Class
* Clean minimal version
*
* COMBAT ROTATION:
* 1. Seal of Wisdom (buff self)
* 2. Judgement (apply Judgement of Wisdom debuff on target)
* 3. Re-buff Seal of Wisdom
* 4. Crusader Strike on cooldown
* 5. Hammer of Justice if target is casting
* 6. Holy Light (max rank) if HP < 30%
*
* OUT OF COMBAT:
* - Self heal if HP < 60%
* - Aura management
* - Blessing management
*/
using System;
using System.Collections.Generic;
using System.Threading;
using robotManager.Helpful;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Enums;
public class Main : ICustomClass
{
private static WoWLocalPlayer Me = ObjectManager.Me;
public float Range
{
get { return 5f; }
}
private bool _isLaunched;
public void Initialize()
{
_isLaunched = true;
Logging.Write("[RetPalaPvE] Started");
Rotation();
}
public void Dispose()
{
_isLaunched = false;
Logging.Write("[RetPalaPvE] Stopped");
}
public void ShowConfiguration()
{
Logging.Write("[RetPalaPvE] No settings");
}
private void Rotation()
{
while (_isLaunched)
{
try
{
if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Me.IsDead)
{
// Out of combat buffs
if (!Me.InCombatFlagOnly && !Fight.InFight)
{
BuffRoutine();
}
// Combat rotation
if (Fight.InFight && ObjectManager.Target != null && ObjectManager.Target.IsAlive)
{
CombatRoutine();
}
}
}
catch (Exception e)
{
Logging.WriteError("[RetPalaPvE] " + e.ToString());
}
Thread.Sleep(100);
}
}
private void BuffRoutine()
{
if (Me.IsMounted || Me.HaveBuff("Resurrection Sickness"))
return;
// Self heal out of combat
if (Me.HealthPercent < 60 && !Me.HaveBuff("Drink"))
{
CastSpell("Holy Light", true);
}
// Auras
if (SpellManager.KnowSpell("Sanctity Aura") && !Me.HaveBuff("Sanctity Aura"))
{
CastSpell("Sanctity Aura", true);
}
else if (!SpellManager.KnowSpell("Sanctity Aura") && !Me.HaveBuff("Devotion Aura"))
{
CastSpell("Devotion Aura", true);
}
// Blessing
if (!Me.HaveBuff("Blessing of Might") && !Me.HaveBuff("Blessing of Wisdom") && !Me.HaveBuff("Blessing of Kings"))
{
if (SpellManager.KnowSpell("Blessing of Wisdom"))
CastSpell("Blessing of Wisdom", true);
else if (SpellManager.KnowSpell("Blessing of Might"))
CastSpell("Blessing of Might", true);
}
}
private void CombatRoutine()
{
WoWUnit target = ObjectManager.Target;
if (target == null || !target.IsAlive || Me.IsCast)
return;
// === PRIORITY 1: Emergency self-heal at 30% HP ===
if (Me.HealthPercent < 30)
{
CastSpell("Holy Light", true);
return;
}
// === PRIORITY 2: Interrupt with Hammer of Justice ===
if (target.IsCast && target.GetDistance <= 10)
{
CastSpell("Hammer of Justice", false);
}
// === PRIORITY 3: Seal + Judgement management ===
bool knowSealOfWisdom = SpellManager.KnowSpell("Seal of Wisdom");
bool hasSeal = Me.HaveBuff("Seal of Wisdom") || Me.HaveBuff("Seal of Righteousness") || Me.HaveBuff("Seal of Command");
if (knowSealOfWisdom)
{
// --- Seal of Wisdom path: buff → judge for mana regen debuff → rebuff ---
bool hasSealOfWisdom = Me.HaveBuff("Seal of Wisdom");
bool targetHasJudgement = target.HaveBuff("Judgement of Wisdom");
if (!hasSealOfWisdom)
{
CastSpell("Seal of Wisdom", false);
return;
}
// Judge to apply Judgement of Wisdom if target doesn't have it
if (hasSealOfWisdom && !targetHasJudgement && IsSpellReady("Judgement"))
{
CastSpell("Judgement", false);
// Seal consumed, next tick will reapply
return;
}
}
else
{
// --- Fallback: Seal of Righteousness (or Seal of Command if talented) ---
if (!hasSeal)
{
if (SpellManager.KnowSpell("Seal of Command"))
CastSpell("Seal of Command", false);
else if (SpellManager.KnowSpell("Seal of Righteousness"))
CastSpell("Seal of Righteousness", false);
return;
}
// Still judge on cooldown for damage even without Wisdom
if (hasSeal && IsSpellReady("Judgement"))
{
CastSpell("Judgement", false);
return;
}
}
// === PRIORITY 4: Crusader Strike on cooldown ===
if (SpellManager.KnowSpell("Crusader Strike") && IsSpellReady("Crusader Strike"))
{
CastSpell("Crusader Strike", false);
}
// === Blood Elf racials ===
// Arcane Torrent interrupt
if (target.IsCast && target.GetDistance <= 8)
{
CastSpell("Arcane Torrent", false);
}
// Mana Tap
if (SpellManager.KnowSpell("Mana Tap") && TargetHasMana())
{
CastSpell("Mana Tap", false);
}
}
///
/// Casts a spell. Uses Lua for self-cast, SpellManager for target casts.
///
private bool CastSpell(string spellName, bool onSelf)
{
if (!SpellManager.KnowSpell(spellName))
return false;
if (!IsSpellReady(spellName))
return false;
if (onSelf)
{
Lua.LuaDoString("CastSpellByName(\"" + spellName + "\", true)", false);
}
else
{
SpellManager.CastSpellByNameOn(spellName, "target");
}
Thread.Sleep(50);
return true;
}
///
/// Checks if a spell is usable and off cooldown.
/// Uses WRobot API for cooldown + Lua for usability check.
///
private bool IsSpellReady(string spellName)
{
// Check cooldown via WRobot API (returns ms remaining)
int cdLeft = SpellManager.GetSpellCooldownTimeLeftBySpellName(spellName);
if (cdLeft > 0)
return false;
// Check usable via Lua (mana, range, etc.)
string usable = Lua.LuaDoString(
"rpUsable = tostring(IsUsableSpell(\"" + spellName + "\"))",
"rpUsable"
);
return usable == "1" || usable == "true";
}
private bool TargetHasMana()
{
string result = Lua.LuaDoString(
"rpManaCheck = tostring((UnitPowerType(\"target\") == 0 and UnitMana(\"target\") > 0))",
"rpManaCheck"
);
return result == "true";
}
}