|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
-- Copyright (c) 2009, Lewis Linn White Jr.
-- All rights reserved.
-- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-- * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-- OF SUCH DAMAGE.
local FFTCasting = {}
FFTCasting.VERSION = "0.2"
_G.FFTCasting = FFTCasting
local frame = _G.FFTCasting_Frame
local castingOn = true
SLASH_FFTCasting1 = "/fftcasting"
SlashCmdList['FFTCasting'] = function(editBox, msg)
if string.lower(msg) == "off" then
castingOn = false
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned off.")
elseif string.lower(msg) == "on" then
castingOn = true
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned on.")
else
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: '" .. msg .. "'")
end
end
function FFTCasting.Say(messageToSay)
SendChatMessage(messageToSay, "SAY")
end
frame:RegisterEvent("CASTING_START")
function FFTCasting:OnEvent(event, ...)
FFTCasting[event](...)
end
function FFTCasting.CASTING_START(spellName, ...)
if spellName == "Flame" then whatToSay = "Star fire, awake and deliver your judgement!"
elseif spellName == "Plasma Arrow" then whatToSay = "Clear with a mighty breeze!"
elseif spellName == "Electric Bolt" then whatToSay = "Heavenly bolts, bring God's justice!"
elseif spellName == "Meteor Shower" then whatToSay = "Time has come...crash down on the wicked!"
elseif spellName == "Electric Explosion" then whatToSay = "Angry spirits of the world strike now!"
elseif spellName == "Static Field" then whatToSay = "Absorb power in the sky and strike!"
elseif spellName == "Rising Tide" then whatToSay = "Effortless water, break your silence, attack!"
elseif spellName == Urgent Heal then whatToSay = "Life's refreshing breeze, heal from the sky!"
elseif spellName == "Heal" then whatToSay = "Ancient light, rise and revive!"
elseif spellName == "Resurrection" then whatToSay = "Spirits of life, give a new life to the soul!"
elseif spellName == "Group Heal" then whatToSay = "Heavenly wind, carry us to fountain of power!"
elseif spellName == "Ice Fog" then whatToSay = "Freezing wind, speak of forgotten truths!"
elseif spellName == "Chain of Light" then whatToSay = "Bright light, shine down on bloody impurity!"
else do return end
end
if whatToSay ~= nil and spellName ~= nil and castingOn then
local whatToSayWithSpellName = whatToSay .. " " .. spellName .. "!"
FFTCasting.Say(whatToSayWithSpellName)
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 |
<Ui xmlns="http://www.runewaker.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.runewaker.com/UI.xsd">
<Frame name="FFTCasting_Frame">
<Scripts>
<OnEvent>
FFTCasting:OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
</OnEvent>
</Scripts>
</Frame>
</Ui>
|
|
|
Source code |
1 |
local frame = _G.FFTCasting_Frame |
|
|
Source code |
1 2 3 4 |
local WhatToSay = {
['Flame'] = "Star fire, awake and deliver your judgement!",
['Plasma Arrow'] = "Clear with a mighty breeze!",
}
|
|
|
Source code |
1 2 3 4 5 |
function FFTCasting.CASTING_START(spellName, ...)
if WhatToSay[(spellName or '')] then
FFTCasting.Say(WhatToSay[spellName] .. " " .. spellName .. "!")
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 |
-- Create the frame
local frame = CreateUIComponent("Frame", "FFTCasting_Frame", "UIParent")
_G['FFTCasting_Frame'] = nil -- remove the global created by CreateUIComponent
-- Set the frame's OnEvent callback
frame:SetScripts("OnEvent", [=[ FFTCasting[event](arg1) ]=])
frame:RegisterEvent("CASTING_START") -- this line was moved to here for code consistency
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
SlashCmdList['FFTCasting'] = function(editBox, msg)
local option = string.lower(msg)
if option == "off" then
castingOn = false
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned off.")
elseif option == "on" then
castingOn = true
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned on.")
else
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: '" .. msg .. "'")
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
local FFTCasting = {}
FFTCasting.VERSION = "0.2"
_G.FFTCasting = FFTCasting
-- Create the frame
local frame = CreateUIComponent("Frame", "FFTCasting_Frame", "UIParent")
_G['FFTCasting_Frame'] = nil -- remove the global created by CreateUIComponent
-- Set the frame's OnEvent callback
frame:SetScripts("OnEvent", [=[ FFTCasting[event](arg1) ]=])
frame:RegisterEvent("CASTING_START") -- this line was moved to here for code consistency
local castingOn = true
SLASH_FFTCasting1 = "/fftcasting"
SlashCmdList['FFTCasting'] = function(editBox, msg)
local option = string.lower(msg)
if option == "off" then
castingOn = false
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned off.")
elseif option == "on" then
castingOn = true
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned on.")
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type /fftcasting to deactivate")
else
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: '" type /fftcasting to activate or deactivate "'")
end
end
function FFTCasting.Say(messageToSay)
SendChatMessage(messageToSay, "SAY")
end
local WhatToSay = {
['Flame'] = "Star fire, awake and deliver your judgement!",
['Plasma Arrow'] = "Clear with a mighty breeze!",
['Electric Bolt'] = "Heavenly bolts, bring God's justice!" ,
[' Meteor Shower '] = "Time has come...crash down on the wicked!" ,
[' Electric Explosion '] = "Angry spirits of the world strike now!" ,
[' Static Field '] = "Absorb power in the sky and strike!" ,
[' Rising Tide '] = "Effortless water, break your silence, attack!" ,
[' Urgent Heal '] = "Life's refreshing breeze, heal from the sky!" ,
[' Heal '] = "Ancient light, rise and revive!" ,
[' Resurrection '] = "Spirits of life, give a new life to the soul!" ,
[' Group Heal '] = "Heavenly wind, carry us to fountain of power!" ,
[' Ice Fog '] = "Freezing wind, speak of forgotten truths!" ,
[' Chain of Light '] = "Bright light, shine down on bloody impurity!" ,
[' Thunderstorm '] = "Winds of destruction, take hold and deliver your wrath!" ,
[' Earth Surge '] = "Earth, groan and awaken your might. Show my foe your Power and strength!" ,
[' Phoenix '] = "Flames, Burst!" ,
}
function FFTCasting.CASTING_START(spellName, ...)
if WhatToSay[(spellName or '')] then
FFTCasting.Say(WhatToSay[spellName] .. " " .. spellName .. "!")
end
end
|
|
|
Source code |
1 |
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: type /fftcasting to activate or deactivate")
|
|
|
Source code |
1 |
frame:SetScripts("OnUpdate", [=[ FFTCasting.OnUpdateHandler(elapsedTime) ]=] )
|
|
|
Source code |
1 2 |
local FFTGlobalCooldown = 5 -- 5 second global cooldown local FFTCurGlobalTime = 0 |
|
|
Source code |
1 2 3 4 |
local WhatToSay = {
['Flame'] = { text = "Star fire, awake and deliver your judgement!", cooldown = 10, curtime = 0 },
['Plasma Arrow'] = { text = "Clear with a mighty breeze!", cooldown = 10, curtime = 0 },
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 |
function FFTCasting.CASTING_START(spellName, ...)
if FFTCurGlobalTime <= 0 then
if WhatToSay[(spellName or '')] then
if WhatToSay[spellName].curtime <= 0 then
FFTCasting.Say(WhatToSay[spellName].text .. " " .. spellName .. "!")
FFTCurGlobalTime = FFTGlobalCooldown
WhatToSay[spellName].curtime = WhatToSay[spellName].cooldown
end
end
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function FFTCasting.OnUpdateHandler(elapsed)
local adjustedTime = FFTCurGlobalTime - elasped
-- Set the new global timer value, capping it to 0 if negative
FFTCurGlobalTime = adjustedTime < 0 and 0 or adjustedTime
for k,v in pairs(WhatToSay) do
if v.curtime > 0 then
adjustedTime = v.curtime - elasped
v.curtime = adjustedTime < 0 and 0 or adjustedTime
end
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
-- Copyright (c) 2009, Lewis Linn White Jr.-- All rights reserved.
-- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-- * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-- OF SUCH DAMAGE.
local FFTGlobalCooldown = 5 -- 5 second global cooldown
local FFTCurGlobalTime = 0
local FFTCasting = {}
FFTCasting.VERSION = "0.4"
_G.FFTCasting = FFTCasting
-- Create the frame
local frame = CreateUIComponent("Frame", "FFTCasting_Frame", "UIParent")
_G['FFTCasting_Frame'] = nil -- remove the global created by CreateUIComponent
-- Set the frame's OnEvent callback
frame:SetScripts("OnEvent", [=[ FFTCasting[event](arg1) ]=])
frame:RegisterEvent("CASTING_START") -- this line was moved to here for code consistency
frame:SetScripts("OnUpdate", [=[ FFTCasting.OnUpdateHandler(elapsedTime) ]=] )
local castingOn = true
SLASH_FFTCasting1 = "/fftcasting"
SlashCmdList['FFTCasting'] = function(editBox, msg)
local option = string.lower(msg)
if option == "off" then
castingOn = false
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned off.")
elseif option == "on" then
castingOn = true
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned on.")
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type /fftcasting to deactivate")
else
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: type '/fftcasting' on to activate or '/fftcasting off' deactivate")
end
end
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type '/fftcasting off' to deactivate and '/fftcasting on' to reactivate")
function FFTCasting.Say(messageToSay)
SendChatMessage(messageToSay, "SAY")
end
local WhatToSay = {
['Flame'] = { text = "Star fire, awake and deliver your judgement!", cooldown = 10, curtime = 0 },
['Plasma Arrow'] = { text = "Clear with a mighty breeze!", cooldown = 10, curtime = 0 },
['Electric Bolt'] = { text = "Heavenly bolts, bring God's justice!" , cooldown = 10, curtime = 0 },
['Meteor Shower'] = { text = "Time has come...crash down on the wicked!" , cooldown = 10, curtime = 0 },
['Electric Explosion'] = "Angry spirits of the world strike now!" , cooldown = 10, curtime = 0 },
['Static Field'] = { text = "Absorb power in the sky and strike!" , cooldown = 10, curtime = 0 },
['Rising Tide'] = { text = "Effortless water, break your silence, attack!" , cooldown = 10, curtime = 0 },
['Urgent Heal'] = { text = "Life's refreshing breeze, heal from the sky!" , cooldown = 10, curtime = 0 },
['Heal'] = { text = "Ancient light, rise and revive!" , cooldown = 10, curtime = 0 },
['Resurrection'] = { text = "Spirits of life, give a new life to the soul!" , cooldown = 10, curtime = 0 },
['Group Heal'] = "Heavenly wind, carry us to fountain of power!" , cooldown = 10, curtime = 0 },
['Ice Fog'] = { text = "Freezing wind, speak of forgotten truths!" , cooldown = 10, curtime = 0 },
['Chain of Light'] = { text = "Bright light, shine down on bloody impurity!" , cooldown = 10, curtime = 0 },
['Thunderstorm'] = { text = "Winds of destruction, take hold and deliver your wrath!" , cooldown = 10, curtime = 0 },
['Earth Surge'] = { text = "Earth, groan and awaken your might. Show my foe your Power and strength!" , cooldown = 10, curtime = 0 },
['Phoenix'] = "Flames, Burst!" , cooldown = 10, curtime = 0 },
['Psychic Arrows'] = { text = "Dark, sinister ambitions, take form and strike!" , cooldown = 10, curtime = 0 },
['Soul Pain'] = { text = "Depths of the soul, go into agony and despair." , cooldown = 10, curtime = 0 },
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
[''] = "" ,
}
function FFTCasting.CASTING_START(spellName, ...)
if FFTCurGlobalTime <= 0 then
if WhatToSay[(spellName or '')] then
if WhatToSay[spellName].curtime <= 0 then
FFTCasting.Say(WhatToSay[spellName].text .. " " .. spellName .. "!")
FFTCurGlobalTime = FFTGlobalCooldown
WhatToSay[spellName].curtime = WhatToSay[spellName].cooldown
end
end
end
end
function FFTCasting.OnUpdateHandler(elapsed)
local adjustedTime = FFTCurGlobalTime - elasped
-- Set the new global timer value, capping it to 0 if negative
FFTCurGlobalTime = adjustedTime < 0 and 0 or adjustedTime
for k,v in pairs(WhatToSay) do
if v.curtime > 0 then
adjustedTime = v.curtime - elasped
v.curtime = adjustedTime < 0 and 0 or adjustedTime
end
end
end
|
Quoted from "ReagenL;542869"
Okay I put in the code parts in. The speeches arent triggering anymore.
...snip...
I changed the version number. And added in a few more spells and some blanks to add more if wanted.
|
|
Source code |
1 |
if WhatToSay[(spellName or '')] then |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function FFTCasting.CASTING_START(spellName, ...)
DEFAULT_CHAT_FRAME:AddMessage("In CASTING_START event")
if FFTCurGlobalTime <= 0 then
DEFAULT_CHAT_FRAME:AddMessage("Global Cooldown is 0")
if WhatToSay[(spellName or '')] then
DEFAULT_CHAT_FRAME:AddMessage("Found entry for "..spellName)
if WhatToSay[spellName].curtime <= 0 then
DEFAULT_CHAT_FRAME:AddMessage(spellName.." cooldown time is 0")
FFTCasting.Say(WhatToSay[spellName].text .. " " .. spellName .. "!")
FFTCurGlobalTime = FFTGlobalCooldown
WhatToSay[spellName].curtime = WhatToSay[spellName].cooldown
end
end
end
DEFAULT_CHAT_FRAME:AddMessage("-------")
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
-- Copyright (c) 2009, Lewis Linn White Jr.-- All rights reserved.
-- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-- * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-- OF SUCH DAMAGE.
local FFTGlobalCooldown = 5 -- 5 second global cooldown
local FFTCurGlobalTime = 0
local FFTCasting = {}
FFTCasting.VERSION = "0.4"
_G.FFTCasting = FFTCasting
-- Create the frame
local frame = CreateUIComponent("Frame", "FFTCasting_Frame", "UIParent")
_G['FFTCasting_Frame'] = nil -- remove the global created by CreateUIComponent
-- Set the frame's OnEvent callback
frame:SetScripts("OnEvent", [=[ FFTCasting[event](arg1) ]=])
frame:RegisterEvent("CASTING_START") -- this line was moved to here for code consistency
frame:SetScripts("OnUpdate", [=[ FFTCasting.OnUpdateHandler(elapsedTime) ]=] )
local castingOn = true
SLASH_FFTCasting1 = "/fftcasting"
SlashCmdList['FFTCasting'] = function(editBox, msg)
local option = string.lower(msg)
if option == "off" then
castingOn = false
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned off.")
elseif option == "on" then
castingOn = true
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned on.")
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type /fftcasting to deactivate")
else
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: type '/fftcasting' on to activate or '/fftcasting off' deactivate")
end
end
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type '/fftcasting off' to deactivate and '/fftcasting on' to reactivate")
function FFTCasting.Say(messageToSay)
SendChatMessage(messageToSay, "SAY")
end
local WhatToSay = {
['Flame'] = { text = "Star fire, awake and deliver your judgement!", cooldown = 10, curtime = 0 },
['Plasma Arrow'] = { text = "Clear with a mighty breeze!", cooldown = 10, curtime = 0 },
['Electric Bolt'] = { text = "Heavenly bolts, bring God's justice!" , cooldown = 10, curtime = 0 },
['Meteor Shower'] = { text = "Time has come...crash down on the wicked!" , cooldown = 10, curtime = 0 },
['Electric Explosion'] = "Angry spirits of the world strike now!" , cooldown = 10, curtime = 0 },
['Static Field'] = { text = "Absorb power in the sky and strike!" , cooldown = 10, curtime = 0 },
['Rising Tide'] = { text = "Effortless water, break your silence, attack!" , cooldown = 10, curtime = 0 },
['Urgent Heal'] = { text = "Life's refreshing breeze, heal from the sky!" , cooldown = 10, curtime = 0 },
['Heal'] = { text = "Ancient light, rise and revive!" , cooldown = 10, curtime = 0 },
['Resurrection'] = { text = "Spirits of life, give a new life to the soul!" , cooldown = 10, curtime = 0 },
['Group Heal'] = "Heavenly wind, carry us to fountain of power!" , cooldown = 10, curtime = 0 },
['Ice Fog'] = { text = "Freezing wind, speak of forgotten truths!" , cooldown = 10, curtime = 0 },
['Chain of Light'] = { text = "Bright light, shine down on bloody impurity!" , cooldown = 10, curtime = 0 },
['Thunderstorm'] = { text = "Winds of destruction, take hold and deliver your wrath!" , cooldown = 10, curtime = 0 },
['Earth Surge'] = { text = "Earth, groan and awaken your might. Show my foe your Power and strength!" , cooldown = 10, curtime = 0 },
['Phoenix'] = "Flames, Burst!" , cooldown = 10, curtime = 0 },
['Psychic Arrows'] = { text = "Dark, sinister ambitions, take form and strike!" , cooldown = 10, curtime = 0 },
['Soul Pain'] = { text = "Depths of the soul, go into agony and despair." , cooldown = 10, curtime = 0 },
}
function FFTCasting.CASTING_START(spellName, ...)
DEFAULT_CHAT_FRAME:AddMessage("In CASTING_START event")
if FFTCurGlobalTime <= 0 then
DEFAULT_CHAT_FRAME:AddMessage("Global Cooldown is 0")
if WhatToSay[(spellName or '')] then
DEFAULT_CHAT_FRAME:AddMessage("Found entry for "..spellName)
if WhatToSay[spellName].curtime <= 0 then
DEFAULT_CHAT_FRAME:AddMessage(spellName.." cooldown time is 0")
FFTCasting.Say(WhatToSay[spellName].text .. " " .. spellName .. "!")
FFTCurGlobalTime = FFTGlobalCooldown
WhatToSay[spellName].curtime = WhatToSay[spellName].cooldown
end
end
end
DEFAULT_CHAT_FRAME:AddMessage("-------")
end
function FFTCasting.OnUpdateHandler(elapsed)
local adjustedTime = FFTCurGlobalTime - elapsed
-- Set the new global timer value, capping it to 0 if negative
FFTCurGlobalTime = adjustedTime < 0 and 0 or adjustedTime
for k,v in pairs(WhatToSay) do
if v.curtime > 0 then
adjustedTime = v.curtime - elapsed
v.curtime = adjustedTime < 0 and 0 or adjustedTime
end
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
-- Copyright (c) 2009, Lewis Linn White Jr.-- All rights reserved.
-- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-- * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-- OF SUCH DAMAGE.
local FFTGlobalCooldown = 5 -- 5 second global cooldown
local FFTCurGlobalTime = 1
local FFTCasting = {}
FFTCasting.VERSION = "0.5"
_G.FFTCasting = FFTCasting
-- Create the frame
local frame = CreateUIComponent("Frame", "FFTCasting_Frame", "UIParent")
_G['FFTCasting_Frame'] = nil -- remove the global created by CreateUIComponent
-- Set the frame's OnEvent callback
frame:SetScripts("OnEvent", [=[ FFTCasting[event](arg1) ]=])
frame:RegisterEvent("CASTING_START") -- this line was moved to here for code consistency
frame:SetScripts("OnUpdate", [=[ FFTCasting.OnUpdateHandler(elapsedTime) ]=] )
local castingOn = true
SLASH_FFTCasting1 = "/fftcasting"
SlashCmdList['FFTCasting'] = function(editBox, msg)
local option = string.lower(msg)
if option == "off" then
castingOn = false
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned off.")
elseif option == "on" then
castingOn = true
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting has been turned on.")
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type '/fftcasting off' to deactivate")
elseif option == "cd" then
DEFAULT_CHAT_FRAME:AddMessage("Testing")
else
DEFAULT_CHAT_FRAME:AddMessage("Not a valid argument: type '/fftcasting on' to activate or '/fftcasting off' deactivate")
end
end
DEFAULT_CHAT_FRAME:AddMessage("FFTCasting is now loaded and ready, type '/fftcasting off' to deactivate and '/fftcasting on' to reactivate")
|