Skip to content

Instantly share code, notes, and snippets.

@JonathanMH
Last active December 3, 2023 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathanMH/450c346d3eca3847d9a44644964bdd64 to your computer and use it in GitHub Desktop.
Save JonathanMH/450c346d3eca3847d9a44644964bdd64 to your computer and use it in GitHub Desktop.
tmp wa
-- fake functions
function GetInstanceInfo()
return '', 'raid', 1, '', '', '', '', '', ''
end
function GetDifficultyInfo(fakeArg1)
return '', '', true, '', true, '', ''
end
-- usually provided by wow API
function strsplit(sep, inputstr)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
function findBoss(msgContent)
if FindSubStr("Gnarlroot", msgContent) then
return {"Touch all roots with the fire debuff!", "Heroic: drop puddles on the adds!"}
end
if FindSubStr("Igira", msgContent) then
return {"SOAK zones from left to right", "TANKS must stack", "help the HEALERS with the heal absorb"}
end
if FindSubStr("Volcoross", msgContent) then
return {"Groups 1,3,5 LEFT, 2,4,6 RIGHT", "SOAK zones!", "TANK must take all stacks, taunt on JAWS"}
end
if FindSubStr("Larodar", msgContent) then
return {"FOCUS damage and healing on Treants and Roots", "TANKS run away from charge"}
end
if FindSubStr("Council", msgContent) then
return {"Help tanks soak the bear charge", "Duck: eat plants, then go to bear and press 2", "KILL them at the same time"}
end
if FindSubStr("Nymue", msgContent) then
return {"Groups 1,3,5 LEFT, 2,4,6 RIGHT in add phase", "SOAK all plants", "Do NOT let adds cross lines"}
end
if FindSubStr("Smolderon", msgContent) then
return {"If you DO NOT have a red circle, SOAK with the tank!", "After knockback, collect 5 red balls!"}
end
if FindSubStr("Tindral", msgContent) then
return {"Stay close to boss for roots AOE", "Tanks take turns on the mushroom soak", "Stomp seeds"}
end
if FindSubStr("Fyrakk", msgContent) then
return {"Catch balls in intermission", "focus adds", "heal souls"}
end
end
function FindSubStr(pattern, message)
if string.find(string.lower(message), string.lower(pattern)) then
return true
else
return false
end
end
function Explain(event, message)
-- START not required in final script
local function strsplit(sep, inputstr)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
-- END not required in final script
local _, _, channel = strsplit("_", event)
print(channel)
local _,type,difficultyID,_,_,_,_,_,_ = GetInstanceInfo()
local _,_,isHeroic,_,displayHeroic,_,_ = GetDifficultyInfo(difficultyID)
local showHeroicText = type == "raid" and isHeroic and displayHeroic;
local explanationLines = findBoss(message)
for _, v in ipairs(explanationLines) do
if (FindSubStr("heroic:", v)) then
if (showHeroicText) then
-- print heroic guide lines if actually in heroic raid
print(v)
else
end
else
-- print normal guide lines
print(v)
end
end
end
Explain('CHAT_MSG_RAID', '!explain gnarlroot')
-- print(table.concat(findBoss("!explain smolderon")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment