LDSCORE_ActionDifferees = { }; |
|
-- OnLoad |
function LDSCORE_OnLoad() |
this.tempPasse = 0; |
this:RegisterEvent("VARIABLES_LOADED"); |
this:RegisterEvent("CHAT_MSG_EMOTE"); |
-- synchro : CHAT_MSG_ADDON |
end |
|
|
-- OnEvent |
function LDSCOREFrame_OnEvent(event) |
if (event == "VARIABLES_LOADED") then |
LDSCORE_VARIABLES_LOADED(); |
elseif (event == "CHAT_MSG_EMOTE") then |
if (string.find(arg1, LDScoreEmoteWIPE)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\wipe.wav"); |
elseif (string.find(arg1, LDScoreEmoteMORT)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-bare.wav"); |
elseif (string.find(arg1, LDScoreEmoteCIAOtrail)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-barw.wav"); |
elseif (string.find(arg1, LDScoreEmotePRET)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\pret.wav"); |
elseif (string.find(arg1, LDScoreEmoteLEAD)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-aveb.wav"); |
elseif (string.find(arg1, LDScoreEmoteINVIN)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-bar2.wav"); |
elseif (string.find(arg1, LDScoreEmotePOURRIR)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-bar7.wav"); |
elseif (string.find(arg1, LDScoreEmoteCHEF)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-barb.wav"); |
elseif (string.find(arg1, LDScoreEmoteLEADF)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-elf0.wav"); |
elseif (string.find(arg1, LDScoreEmoteCHEFF)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-elfb.wav"); |
elseif (string.find(arg1, LDScoreEmoteMORTF)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-elfe.wav"); |
elseif (string.find(arg1, LDScoreEmoteINVINF)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-elf2.wav"); |
elseif (string.find(arg1, LDScoreEmotePOURRIRF)) then |
PlaySoundFile("Interface\\AddOns\\LDScore\\snd\\nah-elfz.wav"); |
end |
end |
end |
|
function LDSCORE_VARIABLES_LOADED() |
SLASH_LDScoreWIPE1 = "/wipe"; |
SLASH_LDScoreMORT1 = "/mort"; |
SLASH_LDScoreCIAO1 = "/ciao"; |
SLASH_LDScorePRET1 = "/pret"; |
SLASH_LDScoreLEAD1 = "/lead"; |
SLASH_LDScoreINVIN1 = "/invin"; |
SLASH_LDScorePOURRIR1 = "/pour"; |
SLASH_LDScoreCHEF1 = "/chef"; |
SLASH_LDScoreLEADF1 = "/leadf"; |
SLASH_LDScoreCHEFF1 = "/cheff"; |
SLASH_LDScoreMORTF1 = "/mortf"; |
SLASH_LDScoreINVINF1 = "/invinf"; |
SLASH_LDScorePOURRIRF1 = "/pourf"; |
SlashCmdList["LDScoreWIPE"] = LDScoreWIPE_Command; |
SlashCmdList["LDScoreMORT"] = LDScoreMORT_Command; |
SlashCmdList["LDScoreCIAO"] = LDScoreCIAO_Command; |
SlashCmdList["LDScorePRET"] = LDScorePRET_Command; |
SlashCmdList["LDScoreLEAD"] = LDScoreLEAD_Command; |
SlashCmdList["LDScoreINVIN"] = LDScoreINVIN_Command; |
SlashCmdList["LDScorePOURRIR"] = LDScorePOURRIR_Command; |
SlashCmdList["LDScoreCHEF"] = LDScoreCHEF_Command; |
SlashCmdList["LDScoreLEADF"] = LDScoreLEADF_Command; |
SlashCmdList["LDScoreCHEFF"] = LDScoreCHEFF_Command; |
SlashCmdList["LDScoreMORTF"] = LDScoreMORTF_Command; |
SlashCmdList["LDScoreINVINF"] = LDScoreINVINF_Command; |
SlashCmdList["LDScorePOURRIRF"] = LDScorePOURRIRF_Command; |
|
DEFAULT_CHAT_FRAME:AddMessage("core loaded", 1, 1, 1); |
end |
|
-- Lancement des sons |
function LDSCORE_WarningSound(id) |
local soundTable = { |
"Sound\\Doodad\\BellTollHorde.wav", |
"Sound\\Doodad\\BellTollAlliance.wav", |
"Sound\\Doodad\\BellTollNightElf.wav", |
}; |
PlaySoundFile(soundTable[id]); |
end |
|
-- Mise en place d'une action differee |
function LDSCORE_Schedule(nomFonction, tempsAttente, paramOptionnel) |
tinsert(LDSCORE_ActionDifferees, { nomFonction, GetTime()+tempsAttente, paramOptionnel }); |
end |
|
-- Suppression d'une action differee |
function LDSCORE_UnSchedule(nomFonction, paramOptionnel) |
local v; |
for k = getn(LDSCORE_ActionDifferees), 1, -1 do |
v = LDSCORE_ActionDifferees[k]; |
if ( v[1] == nomFonction and ( not paramOptionnel or v[3] == paramOptionnel ) ) then |
tremove(LDSCORE_ActionDifferees, k); |
end |
end |
end |
|
-- Lancement des actions differee |
function LDSCORE_OnUpdate(elapsed) |
this.tempPasse = this.tempPasse + elapsed; |
if ( this.tempPasse >= 0.1 ) then |
this.tempPasse = 0; |
local currTime = GetTime(); |
local v; |
for k = getn(LDSCORE_ActionDifferees), 1, -1 do |
v = LDSCORE_ActionDifferees[k]; |
if ( v and currTime >= v[2] ) then |
tremove(LDSCORE_ActionDifferees, k); |
if ( type(v[1]) == "function" ) then |
v[1](v[3]); |
else |
getglobal(v[1])(v[3]); |
end |
end |
end |
end |
end |
|
-- Lancement des wisp ou affichage sur le canal |
function LDSCORE_Annoncer(msg, dest) |
if (dest) then |
SendChatMessage(msg, "WHISPER", nil, dest); |
else |
SendChatMessage(msg, "RAID_WARNING" , nil, nil); |
end |
end |
|
-- Gestion de la commande wipe |
function LDScoreWIPE_Command(msg) |
SendChatMessage(LDScoreEmoteWIPE, "EMOTE"); |
end |
|
-- Gestion de la commande mort |
function LDScoreMORT_Command(msg) |
SendChatMessage(LDScoreEmoteMORT, "EMOTE"); |
end |
|
-- Gestion de la commande ciao |
function LDScoreCIAO_Command(msg) |
if (UnitExists("target")) then |
SendChatMessage(LDScoreEmoteCIAOhead .. UnitName("target") .. LDScoreEmoteCIAOtrail, "EMOTE"); |
end |
end |
|
-- Gestion de la commande pret |
function LDScorePRET_Command(msg) |
SendChatMessage(LDScoreEmotePRET, "EMOTE"); |
DoReadyCheck(); |
end |
|
-- Gestion de la commande lead |
function LDScoreLEAD_Command(msg) |
SendChatMessage(LDScoreEmoteLEAD, "EMOTE"); |
end |
|
-- Gestion de la commande invin |
function LDScoreINVIN_Command(msg) |
SendChatMessage(LDScoreEmoteINVIN, "EMOTE"); |
end |
|
-- Gestion de la commande pour |
function LDScorePOURRIR_Command(msg) |
SendChatMessage(LDScoreEmotePOURRIR, "EMOTE"); |
end |
|
-- Gestion de la commande chef |
function LDScoreCHEF_Command(msg) |
SendChatMessage(LDScoreEmoteCHEF, "EMOTE"); |
end |
|
-- Gestion de la commande leadf |
function LDScoreLEADF_Command(msg) |
SendChatMessage(LDScoreEmoteLEADF, "EMOTE"); |
end |
|
-- Gestion de la commande cheff |
function LDScoreCHEFF_Command(msg) |
SendChatMessage(LDScoreEmoteCHEFF, "EMOTE"); |
end |
|
-- Gestion de la commande mortf |
function LDScoreMORTF_Command(msg) |
SendChatMessage(LDScoreEmoteMORTF, "EMOTE"); |
end |
|
-- Gestion de la commande invinf |
function LDScoreINVINF_Command(msg) |
SendChatMessage(LDScoreEmoteINVINF, "EMOTE"); |
end |
|
-- Gestion de la commande pourf |
function LDScorePOURRIRF_Command(msg) |
SendChatMessage(LDScoreEmotePOURRIRF, "EMOTE"); |
end |