hi just need some 1 help to make an lua code as an active addon (espacially xml toc files and some modification example)
_____
function SpellExist(local Spell)
local SpE = False
local x = True
local i = 1
while X = True do
local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL)
if (not spellName) then
if SpE = False then
SpE = False
return False
end
break
end
if (spellName == Spell) then
SpE = True
return True
X = False
end
i = i + 1
end
end SpE
function SpellIndex( local Spell)
local SpE = False
local x = True
local i = 1
while X = True do
local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL)
if (not spellName) then
if SpE = False then
SpE = False
return False
end
break
end
if (spellName == Spell) then
SpE = I
return I
X = False
end
i = i + 1
end
end SpE
function CounterTarget(local TSpell, PSpell1,PSpell2, Msg1,Msg2)
local PSInd1 = SpellIndex(PSpell1)
local PSInd2 = SpellIndex(PSpell2)
local SpCast, JA, JB, JC, JD, JE = UnitCastingInfo("Target")
local SpChan, JA, JB, JC, JD, JE = UnitChannelInfo("Target")
if SpCast = TSpell Or SpChan = TSpell then
if (IsUsableSpell(PSInd1, BOOKTYPE_SPELL) == 1 and
GetSpellCooldown(PSInd1, BOOKTYPE_SPELL) == 0 and
IsSpellInRange(PSInd1, BOOKTYPE_SPELL) == 1) then
DEFAULT_CHAT_FRAME:AddMessage(Msg1)
end
if (IsUsableSpell(PSInd2, BOOKTYPE_SPELL) == 1 and
GetSpellCooldown(PSInd2, BOOKTYPE_SPELL) == 0 and
IsSpellInRange(PSInd2, BOOKTYPE_SPELL) == 1) then
DEFAULT_CHAT_FRAME:AddMessage(Msg2)
end
end
end
function SpellReady(local Spell)
local SPR = false
local SpI = SpellIndex(Spell)
if (IsUsableSpell(PSInd1, BOOKTYPE_SPELL) == 1 and
GetSpellCooldown(PSInd1, BOOKTYPE_SPELL) == 0 and
IsSpellInRange(PSInd1, BOOKTYPE_SPELL) == 1) then
SPR = true
return true
else
SPR = false
return false
end
end SPR
function RogueAid ()
local Junk, Play = UnitClass("player");
if Play = "Rogue" then
[[ Spell Existance]]
local SpGouge = SpellExist("Gouge")
local SpKick = SpellExist("Kick")
local SpEvasion = SpellExist("Evasion")
local SpSprint = SpellExist("Sprint")
local SpKidney = SpellExist("Kidney Shot")
local SpBlind = SpellExist("Blind")
local SpVanish = SpellExist("Vanish")
local SpColdBlood = SpellExist("Cold Blood")
local SpMutilate = SpellExist("Mutilate")
local SpRiposte = SpellExist("Riposte")
local SpBlade = SpellExist("Blade Flurry")
local SpAdre = SpellExist("Adrenaline Rush")
local SpGhost = SpellExist("Ghostly Strike")
local SpPrepa = SpellExist("Preparation")
local SpPreme = SpellExist("Premeditation")
local SpShad = SpellExist("Shadowstep")
local ComBat = UnitAffectingCombat("Player") = 1
local AtkAct = UnitCanAttack("Player", "Target")
local Pmhp = UnitHealthMax("Player")
local PChp = UnitHealth("Player")
local PerCHP = Abs((PChp/Pmhp)*100)
[[Sound paths]]
[[ Code]]
if AtkAct = true then
if ComBat = true then
if SpGouge = true or SpKick = true then
local Counter = true
if Counter = true and AtkAct = true and then
TargetSpellList("Gouge","Kick","Gouge can be used to counter Target Spell","Kick can be used to counter Target Spell")
end
end
if SpEvasion = true and ComBat = 1 and SpellReady("Evasion")= true then
if PerCHP < 65 then
DEFAULT_CHAT_FRAME:AddMessage("Evasion is ready to be used")
end
end
if SpKidney = true and AtkAct = true then
TargetSpellList("Kidney Shot","Kidney Shot", "Kidney Shot can be used to counter Target Spell", "Kidney Shot can be used to counter Target Spell")
end
if SpBlind = true and AtkAct = true and SpellReady("Blind") = true then
if PerCHP < 35 then
DEFAULT_CHAT_FRAME:AddMessage("Use Blind to avoid being killed and use hp recovry item")
end
end
if SpVanish = true and SpellReady("Vanish") = true then
if PerCHP < 30 then
DEFAULT_CHAT_FRAME:AddMessage("Vanish can be used to avoid being killed")
end
end
if SpColdBlood = true and SpellReady("Cold Blood") = true then
if IsStealthed() = 1 then
DEFAULT_CHAT_FRAME:AddMessage("Cold Blood can be used with Ambush or any other Stealth related attack move")
else
if GetComboPoints() = 5 then
DEFAULT_CHAT_FRAME:AddMessage("Cold Blood can be used with a Finishing Move able to crit")
else
DEFAULT_CHAT_FRAME:AddMessage("Cold Blood can be used with a Move able to crit")
end
end
end
if SpMutilate = true and SpellReady("Mutilate") = true then
DEFAULT_CHAT_FRAME:AddMessage("Mutilate is ready for use")
end
if SpRiposte = true and SpellReady("Riposte") = true then
DEFAULT_CHAT_FRAME:AddMessage("Riposte is ready for use")
end
if SpBlade = true and SpellReady("Blade Flurry") = true then
DEFAULT_CHAT_FRAME:AddMessage("Blade Flurry is ready for use")
end
if SpAdre = true and SpellReady("Adrenaline Rush") = true then
DEFAULT_CHAT_FRAME:AddMessage("Adrenaline Rush is ready for use")
end
if SpGhost = true and SpellReady("Ghostly Strike") = true then
DEFAULT_CHAT_FRAME:AddMessage("Ghostly Strike is ready for use")
end
end
end
if SpSprint = true and SpellReady("Sprint") = true then
DEFAULT_CHAT_FRAME:AddMessage("Sprint is available for use")
end
if SpPrepa = true and SpellReady("Preparation") = true then
DEFAULT_CHAT_FRAME:AddMessage("Preparation is available for use")
end
if SpPreme = true and SpellReady("Premeditation") = true then
DEFAULT_CHAT_FRAME:AddMessage("Premeditation is available for use")
end
if SpShad = true and SpellReady("Shadowstep") = true then
DEFAULT_CHAT_FRAME:AddMessage("Shadowstep is available for use")
end
end
end
function TargetSpellList(local Sp1, Sp2, Msg1, Msg2)
if UnitAffectingCombat("Player") = 1
[[Druid Spells]]
CounterTarget("Healing Touch",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Wrath",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Entangling Roots",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Regrowth",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Hibernate",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Rebirth",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Starfire",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Soothe Animal",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Teranquility",Sp1, Sp2, Msg1, Msg2)
[[Hunter Spells]]
CounterTarget("Revive Pet",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Scare Beast",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Steady Shot",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Aimed Shot",Sp1, Sp2, Msg1, Msg2)
[[Mage Spells ]]
CounterTarget("Fire Ball",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Frostbolt",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Polymorph",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Flamestrike",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Arcane Missiles",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Blizzard",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Pyroblast",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Scorch",Sp1, Sp2, Msg1, Msg2)
CounterTarget("",Sp1, Sp2, Msg1, Msg2)
[[Priest Spells]]
CounterTarget("Leser Heal",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Smite",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Resurrection",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Mind Blast",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Heal",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Flash Heal",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Holy Fire",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Chastise",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Shackle Undead",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Mana Burn",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Prayer of Healing",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Mind Control",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Lightwell",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Vampiric Touch",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Greater Heal",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Binding Heal",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Mass Resurrection",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Mass Dispel",Sp1, Sp2, Msg1, Msg2)
[[Paladin Spells]]
CounterTarget("Holy Light",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Redemption",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Flash of Light",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Turn Undead",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Summon Warhorse",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Hammer of Wrath",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Avenger's Shield",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Holy Wrath",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Summon Charger",Sp1, Sp2, Msg1, Msg2)
[[Rogue Spells]]
CounterTarget("Shoot",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Disarm Trap",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Deadly Throw",Sp1, Sp2, Msg1, Msg2)
[[Shaman Spells]]
CounterTarget("Healing Wave",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Lightning Bolt",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Ancestral Spirit",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Far Sight",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Lesser Healing Wave",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Astral Recall",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Chain Lightning",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Chain Heal",Sp1, Sp2, Msg1, Msg2)
[[Warlock Spells]]
CounterTarget("Summon Imp",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Shadow Bolt",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Immolate",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Corruption",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Fear",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Summon Voidwalker",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Create Healthstone",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Create Soulstone",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Searing Pain",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Summon Succubus",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Ritual of Summoning",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Drain Life",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Drain Mana",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Drain Soul",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Shadowburn",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Howl of Terror",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Enslave Demon",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Create Firestone",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Rain of Fire",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Create Spellstone",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Banish",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Soul Fire",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Siphon Life",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Inferno",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Summon Felguard",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Unstable Affliction",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Shadowfury",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Hellfire",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Ritual of Doom",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Summon Dreadsteed",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Create Soulwell",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Incinerate",Sp1, Sp2, Msg1, Msg2)
[[Warrior Spells]]
CounterTarget("Slam",Sp1, Sp2, Msg1, Msg2)
[[ Racial Long Cast]]
CounterTarget("Gift of the Naaru",Sp1, Sp2, Msg1, Msg2)
CounterTarget("Escape Artist",Sp1, Sp2, Msg1, Msg2)
CounterTarget("War Stomp",Sp1, Sp2, Msg1, Msg2)
end
end
____|||What is it meant to do and what's wrong with it?|||Quote:
What is it meant to do and what's wrong with it?
its ment to warn rogues of spell usability under certian events and there is nothing wrong i need help to improve it but most important for the code i have to use for toc and xml files
for example how to stop a warlock casting fear using kick, gouge and kidney shot
No comments:
Post a Comment