Code:
-------------------------------------------
-- MageGoPewPew
-------------------------------------------
-- Change your key here.
local PEWPEWKEY = "F";
local HOLDDOWN = false;-- If this is true, you have to hold the key down. If it is false, just press it to turn it on, press again to turn off.
local STOPAFTERCOMBAT = true;-- Disable after combat
local DEBUGMODE = false;-- debugmode
local MODE = "Frost";
-- Frost
local USEFREEZE = true; -- true if you want pet to cast freeze; false otherwise;
local CASTWHILEMOVE = true; -- true if you want to cast icelance while moving
local ICEBARRIER = false; -- set to false to not use ice barrier
local STOPFROSTBOLTS = false;
-- Fire
local FIREBALL_RATE = 100;-- Lower this to cast more scorches, increase it to cast more fireballs.
local SCORCHMANAPERC = 5;-- Only cast scorch rotation when below this %.
-----------------------------DO NOT CHANGE ANYTHING BELOW THIS LINE-------------------------------------------
-----------------------------DO NOT CHANGE ANYTHING BELOW THIS LINE-------------------------------------------
-----------------------------DO NOT CHANGE ANYTHING BELOW THIS LINE-------------------------------------------
-----------------------------DO NOT CHANGE ANYTHING BELOW THIS LINE-------------------------------------------
-----------------------------DO NOT CHANGE ANYTHING BELOW THIS LINE-------------------------------------------
-----------------------------DO NOT CHANGE ANYTHING BELOW THIS LINE-------------------------------------------
local pressed = false;
local f = CreateFrame("Frame");
f:SetFrameStrata("TOOLTIP");
f:Show();
f:SetWidth(1);
f:SetHeight(1);
local b = CreateFrame("CheckButton", "PewPewBtn", nil, "SecureActionButtonTemplate, ActionButtonTemplate");
if HOLDDOWN then
b:RegisterForClicks("AnyUp", "AnyDown");
else
b:RegisterForClicks("AnyUp");
end
b:SetAttribute("downbutton", true);
b:SetAttribute("type", "macro");
b:SetAttribute("macrotext", "/pewpewmagedps");
local lastSpell = "";
local goCombustion = false;
local isCauterized = false;
local function PewPewPrint(...)
if DEBUGMODE then
DEFAULT_CHAT_FRAME:AddMessage(...);
end
end
local function DoesUnitHaveBuff(unit, buff)
if UnitBuff(unit, buff) then
return true;
end
return false;
end
local function DoesUnitHaveDebuff(unit, buff)
local name, _, _, _, _, _, _, unitCaster, _, _, spellId = UnitDebuff(unit, buff);
if name and unitCaster == "player" then
return true;
end
return false;
end
local function GetBuffRemainingTime(unit, spell)
local name, _, _, count, _, duration, expirationTime, _, _, _, _ = UnitBuff(unit, spell);
if name then
return (expirationTime - GetTime()), count;
end
return -1, -1;
end
local function GetSpellCooldownRemaining(spell)
local start, dur, _ = GetSpellCooldown(spell)
if start and dur then
return (start + dur) - GetTime();
end
return 0;
end
local function DoesPlayerHaveManaGems()
if (GetItemCount("Mana Gem") == 1 and GetItemCooldown(36799) == 0) then
return true;
end
return false;
end
local function IsUnitFrozen(unit)
if UnitDebuff(unit, "Frost Nova") then
return true;
end
if UnitDebuff(unit, "Deep Freeze") then
return true;
end
if UnitDebuff(unit, "Freeze") then
return true;
end
return false;
end
local function PewPew(name)
lastSpell = name;
PewPewPrint("Casting: " .. name);
CastSpellByName(name);
end
local function FindAndUseManaGem()
for i=0,4 do
local numSlots = GetContainerNumSlots(i);
for x=1,numSlots do
if GetContainerItemID(i, x) == 36799 then
UseContainerItem(i, x, true)
return;
end
end
end
end
local lastPetHealth = 0;
local petMoving;
local function OnUpdate(...)
if not pressed then return end;
if MODE == "Frost" then
-- Pet Check Before Anything Else
if not UnitExists("playerpet") then
PewPew("Summon Water Elemental");
return;
end
if not IsPetAttackActive() and GetUnitSpeed("playerpet") == 0 and not petMoving then
PewPewPrint("PetAttack, Not Attacking");
PetAttack();
end
if not UnitCastingInfo("playerpet") and not UnitChannelInfo("playerpet") and IsUsableSpell("Waterbolt") and GetUnitSpeed("playerpet") == 0 then
CastSpellByName("Waterbolt");
end
if UnitExists("playerpet") and lastPetHealth > UnitHealth("playerpet") then
petMoving = true;
PetFollow();
end
if UnitExists("playerpet") and petMoving and GetUnitSpeed("playerpet") == 0 and CheckInteractDistance("playerpet", 3) then
petMoving = false;
end
if UnitExists("playerpet") then
lastPetHealth = UnitHealth("playerpet");
end
if STOPFROSTBOLTS and UnitCastingInfo("player") == "Frostbolt" and DoesUnitHaveBuff("player", "Fingers of Frost") then
PewPewPrint("Stopping Frostbolt.");
SpellStopCasting();
end
-- GC Check
if UnitExists("target") and UnitCanAttack("player", "target") then
if IsPetAttackActive() and UnitGUID("pettarget") ~= UnitGUID("playertarget") and not petMoving then
PewPewPrint("PetAttack, Different GUID");
PetAttack();
end
if (((UnitPower("player") / UnitPowerMax("player")) * 100) <= 80) and DoesPlayerHaveManaGems() then
FindAndUseManaGem();
end
if USEFREEZE and IsUsableSpell("Freeze") and GetSpellCooldown("Freeze") == 0 and not DoesUnitHaveBuff("player", "Fingers of Frost") and (GetSpellCooldown("Deep Freeze") == 0 or GetSpellCooldownRemaining("Deep Freeze") >= 20) and not DoesUnitHaveBuff("player", "Fingers of Frost") then
PewPew("Freeze");
CameraOrSelectOrMoveStart();
CameraOrSelectOrMoveStop();
SpellStopTargeting();
end
if GetSpellCooldown("Mage Armor") == 0 and not UnitCastingInfo("player") and not UnitChannelInfo("player") then
if (((UnitPower("player") / UnitPowerMax("player")) * 100) <= 15) and not DoesUnitHaveBuff("player", "Mage Armor") then
PewPew("Mage Armor");
elseif (((UnitPower("player") / UnitPowerMax("player")) * 100) >= 50) and not DoesUnitHaveBuff("player", "Mage Armor") then
PewPew("Molten Armor");
elseif ICEBARRIER and IsUsableSpell("Ice Barrier") and not DoesUnitHaveBuff("player", "Ice Barrier") and GetSpellCooldown("Ice Barrier") == 0 then
PewPew("Ice Barrier");
elseif IsUsableSpell("Deep Freeze") and GetSpellCooldown("Deep Freeze") == 0 and not IsUnitFrozen("target") then
PewPew("Deep Freeze");
elseif IsUsableSpell("Mirror Image") and GetSpellCooldown("Mirror Image") == 0 then
PewPew("Mirror Image");
elseif IsUsableSpell("Flame Orb") and GetSpellCooldown("Flame Orb") == 0 and GetUnitSpeed("player") == 0 then
PewPew("Flame Orb");
elseif IsUsableSpell("Frostfire Bolt") and DoesUnitHaveBuff("player", "Brain Freeze") then
PewPew("Frostfire Bolt");
elseif IsUsableSpell("Icy Veins") and not DoesUnitHaveBuff("player", "Icy Veins") and GetSpellCooldown("Icy Veins") == 0 and GetUnitSpeed("player") == 0 then
PewPew("Icy Veins");
elseif IsUsableSpell("Ice Lance") and DoesUnitHaveBuff("player", "Fingers of Frost") and (not IsUsableSpell("Deep Freeze") or GetSpellCooldown("Deep Freeze") > 0) then
PewPew("Ice Lance");
elseif IsUsableSpell("Ice Lance") and IsUnitFrozen("target") then
PewPew("Ice Lance");
elseif IsUsableSpell("Cold Snap") and GetSpellCooldown("Cold Snap") == 0 and GetSpellCooldownRemaining("Deep Freeze") >= 10 and GetSpellCooldownRemaining("Flame Orb") >= 10 and GetSpellCooldownRemaining("Icy Veins") >= 10 then
PewPew("Cold Snap");
elseif CASTWHILEMOVE and GetUnitSpeed("player") > 0 then
PewPew("Ice Lance");
else
PewPew("Frostbolt");
end
end
end
elseif MODE == "Fire" then
if not DoesUnitHaveBuff("player", "Molten Armor") and GetSpellCooldown("Molten Armor") == 0 then
PewPew("Molten Armor");
end
if DoesUnitHaveDebuff("player", "Cauterize") and GetSpellCooldown("Ice Block") == 0 then
PewPewPrint("Canceling Spell, Iceblocking Cauterize");
SpellStopCasting();
isCauterized = true;
PewPew("Ice Block");
return;
end
if isCauterized and DoesUnitHaveBuff("player", "Ice Block") then
isCauterized = false;
CancelUnitBuff("player", "Ice Block");
return;
end
if UnitExists("target") and UnitCanAttack("player", "target") then
if (((UnitPower("player") / UnitPowerMax("player")) * 100) <= 80) and DoesPlayerHaveManaGems() then
FindAndUseManaGem();
end
if goCombustion and DoesUnitHaveDebuff("target", "Living Bomb") and DoesUnitHaveDebuff("target", "Pyroblast!") and GetSpellCooldown("Combustion") == 0 then
SpellStopCasting();
PewPew("Combustion");
return;
end
if GetSpellCooldown("Molten Armor") == 0
and not UnitCastingInfo("player")
and not UnitChannelInfo("player") then
if goCombustion and DoesUnitHaveDebuff("target", "Living Bomb") and DoesUnitHaveDebuff("target", "Pyroblast!") and GetSpellCooldown("Combustion") == 0 then
SpellStopCasting();
PewPew("Combustion");
return;
end
if DoesUnitHaveBuff("player", "Hot Streak") then
PewPew("Pyroblast");
elseif not UnitDebuff("target", "Critical Mass") and not UnitDebuff("target", "Shadow and Flame") and lastSpell ~= "Scorch" then
PewPew("Scorch");
elseif IsUsableSpell("Living Bomb") and not DoesUnitHaveDebuff("target", "Living Bomb") then
PewPew("Living Bomb");
elseif IsUsableSpell("Flame Orb") and GetSpellCooldown("Flame Orb") == 0 and GetUnitSpeed("player") == 0 then
PewPew("Flame Orb");
elseif IsUsableSpell("Mirror Image") and GetSpellCooldown("Mirror Image") == 0 then
PewPew("Mirror Image");
elseif (GetUnitSpeed("player") > 0) or (((UnitPower("player") / UnitPowerMax("player")) * 100) <= SCORCHMANAPERC) then
PewPew("Scorch");
elseif DoesUnitHaveBuff("player", "Bloodlust") or DoesUnitHaveBuff("player", "Time Warp") or DoesUnitHaveBuff("player", "Dire Magic") or DoesUnitHaveBuff("player", "Lightweave") or DoesUnitHaveBuff("player", "Battle Magic") or DoesUnitHaveBuff("player", "Volcanic Power") or DoesUnitHaveBuff("player", "Power Torrent") or (DoesUnitHaveDebuff("target", "Pyroblast!") and GetSpellCooldown("Combustion") == 0 and IsUsableSpell("Combustion")) or (((UnitHealth("target") / UnitHealthMax("target")) * 100) <= 35) then
PewPew("Fireball");
else
if (random(1,100) >= FIREBALL_RATE) then
PewPew("Scorch");
else
PewPew("Fireball");
end
end
end
end
end
end
function PlayPewPewSounds(...)
DEFAULT_CHAT_FRAME:AddMessage(...);
pressed = not pressed;
goCombustion = false;
if pressed then
DEFAULT_CHAT_FRAME:AddMessage("PewPew: ON");
else
DEFAULT_CHAT_FRAME:AddMessage("PewPew: OFF");
end
end
local combatEvents = {
RANGE_DAMAGE = true,
SPELL_DAMAGE = true,
SPELL_PERIODIC_DAMAGE = true,
}
local function OnEvent(self, event, timestamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, _, spellName, _, amount, _, school, resisted, _, _, critical)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
if not CombatLog_Object_IsA(sourceFlags, COMBATLOG_FILTER_MINE) or not combatEvents[eventType] then
return;
end
if spellName == "Combustion" then
goCombustion = false;
return;
end
if not critical then return end
if spellName == "Fireball" or spellName == "Pyroblast!" then
PewPewPrint("Critical-Go Combustion: " .. spellName);
goCombustion = true;
return;
end
goCombustion = false;
elseif event == "PLAYER_REGEN_ENABLED" then
if pressed then
DEFAULT_CHAT_FRAME:AddMessage("PewPew: OFF");
pressed = false;
goCombustion = false;
end
end
end
local function OnLoad()
f:SetScript("OnUpdate", OnUpdate);
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
if STOPAFTERCOMBAT then
f:RegisterEvent("PLAYER_REGEN_ENABLED");
end
f:SetScript("OnEvent", OnEvent);
SetOverrideBinding(f, true, PEWPEWKEY, "CLICK PewPewBtn:LeftClick");
PewPewPrint("MageGoPewPew Loaded");
end
SLASH_PEWPEWMAGEDPS1 = "/pewpewmagedps";
SlashCmdList["PEWPEWMAGEDPS"] = PlayPewPewSounds;
OnLoad();
Its a REALLY long code and it works for both fire and frost spec