- Added Raid Tools bracket on Options Panel.

- Added Interrupt, cooldown usage and death announcers for raid tools.

- New API: _detalhes:SendMsgToChannel (msg, channel, towho) seng a message to a chat channel.
- New API: _detalhes:CreateEventListener() creates a table which accept Details Event Registration with RegisterEvent and receive events through OnDetailsEvent().
- New API: _detalhes:GetCooldownList (class) return a table with spellids of defensive cooldowns of the requested class.
- New Hook: DETAILS_HOOK_INTERRUPT call when a interrupt happens during a combat.
- Framework: Added CreateImage (parent, texture, w, h, layer, coords, member, name)
- Framework: Added CreateSwitch (parent, on_switch, default_value, w, h, ltext, rtext, member, name, color_inverted, switch_func, return_func)
This commit is contained in:
tercio
2014-08-30 18:23:35 -03:00
parent eca87f37f1
commit dcf1453a9d
11 changed files with 729 additions and 30 deletions
+6 -4
View File
File diff suppressed because one or more lines are too long
+34 -10
View File
@@ -112,13 +112,15 @@
local _hook_cooldowns = false
local _hook_deaths = false
local _hook_battleress = false
local _hook_buffs = false --[[REMOVED]]
local _hook_interrupt = false
local _hook_cooldowns_container = _detalhes.hooks ["HOOK_COOLDOWN"]
local _hook_deaths_container = _detalhes.hooks ["HOOK_DEATH"]
local _hook_battleress_container = _detalhes.hooks ["HOOK_BATTLERESS"]
local _hook_buffs_container = _detalhes.hooks ["HOOK_BUFF"] --[[REMOVED]]
local _hook_interrupt_container = _detalhes.hooks ["HOOK_INTERRUPT"]
local _hook_buffs = false --[[REMOVED]]
local _hook_buffs_container = _detalhes.hooks ["HOOK_BUFF"] --[[REMOVED]]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internal functions
@@ -1714,6 +1716,20 @@
else
meu_dono.interrompeu_oque [extraSpellID] = meu_dono.interrompeu_oque [extraSpellID] + 1
end
--> pet interrupt
if (_hook_interrupt) then
for _, func in _ipairs (_hook_interrupt_container) do
func (nil, token, time, meu_dono.serial, meu_dono.nome, meu_dono.flag_original, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool)
end
end
else
--> player interrupt
if (_hook_interrupt) then
for _, func in _ipairs (_hook_interrupt_container) do
func (nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool)
end
end
end
end
@@ -2063,7 +2079,7 @@
func (nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname)
end
end
end
--> actor targets
@@ -2267,6 +2283,8 @@
t = _current_combat:CreateLastEventsTable (alvo_name)
end
--lesses index = older / higher index = newer
local last_index = t.n --or 'next index'
if (last_index < 17 and not t[last_index][4]) then
for i = 1, last_index-1 do
@@ -3199,17 +3217,23 @@
_hook_deaths = false
end
if (_detalhes.hooks ["HOOK_BUFF"].enabled) then --[[REMOVED]]
_hook_buffs = true
else
_hook_buffs = false
end
if (_detalhes.hooks ["HOOK_BATTLERESS"].enabled) then
_hook_battleress = true
else
_hook_battleress = false
end
if (_detalhes.hooks ["HOOK_INTERRUPT"].enabled) then
_hook_interrupt = true
else
_hook_interrupt = false
end
if (_detalhes.hooks ["HOOK_BUFF"].enabled) then --[[REMOVED]]
_hook_buffs = true
else
_hook_buffs = false
end
return _detalhes:ClearParserCache()
end
+223
View File
@@ -12,9 +12,12 @@
--> local pointers
local _math_floor = math.floor --lua local
local _cstr = string.format --lua local
local gump = _detalhes.gump --details local
local _GetSpellInfo = _detalhes.getspellinfo --details api
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
@@ -220,3 +223,223 @@
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> built in announcers
function _detalhes:SendMsgToChannel (msg, channel, towho)
if (channel == "RAID" or channel == "PARTY") then
if (GetNumGroupMembers (LE_PARTY_CATEGORY_INSTANCE) > 0) then
channel = "INSTANCE_CHAT"
end
SendChatMessage (msg, channel)
elseif (channel == "BNET") then
if (type (towho) == "number") then
BNSendWhisper (towho, msg)
elseif (type (towho) == "string") then
local BnetFriends = BNGetNumFriends()
for i = 1, BnetFriends do
local presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, broadcastTime, canSoR = BNGetFriendInfo (i)
if ((presenceName == towho or toonName == towho) and isOnline) then
BNSendWhisper (presenceID, msg)
break
end
end
end
elseif (channel == "CHANNEL") then
SendChatMessage (msg, channel, nil, GetChannelName (towho))
elseif (channel == "WHISPER") then
SendChatMessage (msg, channel, nil, towho)
else
SendChatMessage (msg, channel)
--elseif (channel == "SAY" or channel == "YELL" or channel == "RAID_WARNING" or channel == "OFFICER" or channel == "GUILD" or channel == "EMOTE") then
end
end
--/run local s="teste {spell}"; s=s:gsub("{spell}", "tercio");print(s)
function _detalhes:interrupt_announcer (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool)
if (who_name == _detalhes.playername) then -- and _detalhes.announce_interrupts.enabled
local channel = _detalhes.announce_interrupts.channel
local next = _detalhes.announce_interrupts.next
local custom = _detalhes.announce_interrupts.custom
local spellname
if (spellid > 10) then
spellname = GetSpellLink (extraSpellID)
else
spellname = _GetSpellInfo (extraSpellID)
end
if (custom ~= "") then
custom = custom:gsub ("{spell}", spellname)
custom = custom:gsub ("{next}", next)
_detalhes:SendMsgToChannel (custom, channel, _detalhes.announce_interrupts.whisper)
else
local msg = _cstr (Loc ["STRING_OPTIONS_RT_INTERRUPT"], spellname)
if (next ~= "") then
msg = msg .. " " .. _cstr (Loc ["STRING_OPTIONS_RT_INTERRUPT_NEXT"], next)
end
_detalhes:SendMsgToChannel (msg, channel, _detalhes.announce_interrupts.whisper)
end
end
end
function _detalhes:cooldown_announcer (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname)
if (who_name == _detalhes.playername) then -- and _detalhes.announce_cooldowns.enabled
local ignored = _detalhes.announce_cooldowns.ignored_cooldowns
if (ignored [spellid]) then
return
end
local channel = _detalhes.announce_cooldowns.channel
if (channel == "WHISPER") then
if (alvo_name == _detalhes.playername) then
return
end
if (alvo_name == Loc ["STRING_RAID_WIDE"]) then
channel = "RAID"
end
end
local spellname
if (spellid > 10) then
spellname = GetSpellLink (spellid)
else
spellname = _GetSpellInfo (spellid)
end
local custom = _detalhes.announce_cooldowns.custom
if (custom ~= "") then
custom = custom:gsub ("{spell}", spellname)
custom = custom:gsub ("{target}", alvo_name)
_detalhes:SendMsgToChannel (custom, channel, _detalhes.announce_interrupts.whisper)
else
local msg
if (alvo_name == Loc ["STRING_RAID_WIDE"]) then
msg = _cstr (Loc ["STRING_OPTIONS_RT_COOLDOWN2"], spellname)
else
msg = _cstr (Loc ["STRING_OPTIONS_RT_COOLDOWN1"], spellname, alvo_name)
end
_detalhes:SendMsgToChannel (msg, channel, _detalhes.announce_interrupts.whisper)
end
end
end
function _detalhes:death_announcer (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, death_table, last_cooldown, death_at, max_health)
--if (_detalhes.announce_deaths.enabled) then
local where = _detalhes.announce_deaths.where
local zone = _detalhes:GetZoneType()
local channel = ""
if (where == 1) then
if (zone ~= "party" and zone ~= "raid") then
return
end
if (zone == "raid") then
channel = "RAID"
end
elseif (where == 2) then
if (zone ~= "raid") then
return
end
channel = "RAID"
elseif (where == 3) then
if (zone ~= "party") then
return
end
channel = "PARTY"
end
local only_first = _detalhes.announce_deaths.only_first
--_detalhes:GetCombat ("current"):GetDeaths() is the same thing, but, it's faster without using the API.
if (zone == "raid" and not _detalhes.tabela_vigente.is_boss) then
return
end
if (only_first > 0 and #_detalhes.tabela_vigente.last_events_tables > only_first) then
return
end
alvo_name = _detalhes:GetOnlyName (alvo_name)
local msg = _cstr (Loc ["STRING_OPTIONS_RT_DEATH_MSG"], alvo_name) .. ":"
local spells = ""
local last = #death_table
for i = 1, _detalhes.announce_deaths.last_hits do
for o = last, 1, -1 do
local this_death = death_table [o]
if (type (this_death[1]) == "boolean" and this_death[1] and this_death[4]+5 > time) then
local spelllink
if (this_death [2] > 10) then
spelllink = GetSpellLink (this_death [2])
else
spelllink = "[" .. _GetSpellInfo (this_death [2]) .. "]"
end
spells = spelllink .. ": " .. _detalhes:ToK2 (_math_floor (this_death [3])) .. " " .. spells
last = o-1
break
end
end
end
msg = msg .. " " .. spells
_detalhes:SendMsgToChannel (msg, channel)
--print (msg)
--end
end
function _detalhes:StartAnnouncers()
if (_detalhes.announce_interrupts.enabled) then
_detalhes:InstallHook (DETAILS_HOOK_INTERRUPT, _detalhes.interrupt_announcer)
end
if (_detalhes.announce_cooldowns.enabled) then
_detalhes:InstallHook (DETAILS_HOOK_COOLDOWN, _detalhes.cooldown_announcer)
end
if (_detalhes.announce_deaths.enabled) then
_detalhes:InstallHook (DETAILS_HOOK_DEATH, _detalhes.death_announcer)
end
end
function _detalhes:EnableInterruptAnnouncer()
_detalhes.announce_interrupts.enabled = true
_detalhes:InstallHook (DETAILS_HOOK_INTERRUPT, _detalhes.interrupt_announcer)
end
function _detalhes:DisableInterruptAnnouncer()
_detalhes.announce_interrupts.enabled = false
_detalhes:UnInstallHook (DETAILS_HOOK_INTERRUPT, _detalhes.interrupt_announcer)
end
function _detalhes:EnableCooldownAnnouncer()
_detalhes.announce_cooldowns.enabled = true
_detalhes:InstallHook (DETAILS_HOOK_COOLDOWN, _detalhes.cooldown_announcer)
end
function _detalhes:DisableCooldownAnnouncer()
_detalhes.announce_cooldowns.enabled = false
_detalhes:UnInstallHook (DETAILS_HOOK_COOLDOWN, _detalhes.cooldown_announcer)
end
function _detalhes:EnableDeathAnnouncer()
_detalhes.announce_deaths.enabled = true
_detalhes:InstallHook (DETAILS_HOOK_DEATH, _detalhes.death_announcer)
end
function _detalhes:DisableDeathAnnouncer()
_detalhes.announce_deaths.enabled = false
_detalhes:UnInstallHook (DETAILS_HOOK_DEATH, _detalhes.death_announcer)
end
+4
View File
@@ -204,6 +204,10 @@ local ImageMetaFunctions = {}
------------------------------------------------------------------------------------------------------------
--> object constructor
function gump:CreateImage (parent, texture, w, h, layer, coords, member, name)
return gump:NewImage (parent, texture, w, h, layer, coords, member, name)
end
function gump:NewImage (parent, texture, w, h, layer, coords, member, name)
if (not parent) then
+11 -1
View File
@@ -16,6 +16,7 @@ local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local cleanfunction = function() end
local APISliderFunctions = false
local SliderMetaFunctions = {}
local NameLessSlider = 1
------------------------------------------------------------------------------------------------------------
--> metatables
@@ -807,11 +808,20 @@ local switch_enable = function (self)
return _rawset (self, "lockdown", false)
end
function gump:CreateSwitch (parent, on_switch, default_value, w, h, ltext, rtext, member, name, color_inverted, switch_func, return_func)
local switch = gump:NewSwitch (parent, parent, name, member, w or 60, h or 20, ltext, rtext, default_value, color_inverted, switch_func, return_func)
if (on_switch) then
switch.OnSwitch = on_switch
end
return switch
end
function gump:NewSwitch (parent, container, name, member, w, h, ltext, rtext, default_value, color_inverted, switch_func, return_func)
--> early checks
if (not name) then
return nil
name = "DetailsFrameWorkSlider" .. NameLessSlider
NameLessSlider = NameLessSlider + 1
elseif (not parent) then
return nil
end
+19
View File
@@ -247,3 +247,22 @@ local common_events = {
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> listeners
local listener_meta = setmetatable ({}, _detalhes)
listener_meta.__index = listener_meta
function listener_meta:RegisterEvent (event, func)
return _detalhes:RegisterEvent (self, event, func)
end
function listener_meta:UnregisterEvent (event)
return _detalhes:UnregisterEvent (self, event)
end
function _detalhes:CreateEventListener()
local new = {Enabled = true, __enabled = true}
setmetatable (new, listener_meta)
return new
end
+2
View File
@@ -8,6 +8,7 @@
--[[global]] DETAILS_HOOK_COOLDOWN = "HOOK_COOLDOWN"
--[[global]] DETAILS_HOOK_DEATH = "HOOK_DEATH"
--[[global]] DETAILS_HOOK_BATTLERESS = "HOOK_BATTLERESS"
--[[global]] DETAILS_HOOK_INTERRUPT = "HOOK_INTERRUPT"
--[[global]] DETAILS_HOOK_BUFF = "HOOK_BUFF" --[[REMOVED--]]
@@ -18,6 +19,7 @@
_detalhes.hooks ["HOOK_COOLDOWN"] = {}
_detalhes.hooks ["HOOK_DEATH"] = {}
_detalhes.hooks ["HOOK_BATTLERESS"] = {}
_detalhes.hooks ["HOOK_INTERRUPT"] = {}
_detalhes.hooks ["HOOK_BUFF"] = {} --[[REMOVED--]]
+25
View File
@@ -822,6 +822,31 @@ local default_player_data = {
savedStyles = {},
--> instance config
local_instances_config = {},
--> announcements
announce_deaths = {
enabled = false,
only_first = 5,
last_hits = 1,
where = 1,
},
announce_cooldowns = {
enabled = false,
channel = "RAID",
ignored_cooldowns = {},
custom = "",
},
announce_interrupts = {
enabled = false,
channel = "SAY",
whisper = "",
next = "",
custom = "",
},
announce_prepots = {
enabled = true,
reverse = false,
channel = "SELF",
},
}
_detalhes.default_player_data = default_player_data
+14 -8
View File
@@ -1050,7 +1050,7 @@ do
-- Monk
[122470] = {90, 10}, -- Touch of Karma
[115213] = {180, 6}, -- Avert Harm
["MONK"] = {115295, 115203, 122470, 115176, 116849, 115213, 122278, 122783},
["MONK"] = {122470, 115213, 115295, 115203, 115176, 116849, 122278, 122783, 115310, 119582, 116844, 115308},
-- Paladin
[86659] = {180, 12}, -- Guardian of Ancient Kings
@@ -1060,32 +1060,32 @@ do
[6940] = {120, 12}, -- Hand of Sacrifice
[1022] = {300, 10}, -- Hand of Protection
[1038] = {120, 10}, -- Hand of Salvation
["PALADIN"] = {86659, 31850, 498, 642, 6940, 1022, 1038},
["PALADIN"] = {86659, 31850, 498, 642, 6940, 1022, 1038, 633, 31821},
-- Priest
[15286] = {180, 15}, -- Vampiric Embrace
[47788] = {180, 10}, -- Guardian Spirit
[47585] = {120, 6}, -- Dispersion
[33206] = {180, 8}, -- Pain Suppression
["PRIEST"] = {15286, 47788, 47585, 33206, 62618, 109964, 64843},
["PRIEST"] = {15286, 47788, 47585, 33206, 62618, 109964, 64843, 108968, 142723},
-- Rogue
[1966] = {1.5, 5}, -- Feint
[31224] = {60, 5}, -- Cloak of Shadows
[5277] = {180, 15}, -- Evasion
["ROGUE"] = {1966, 31224, 5277},
["ROGUE"] = {1966, 31224, 5277, 76577},
-- Shaman
[30823] = {60, 15}, -- Shamanistic Rage
[108271] = {120, 6}, -- Astral Shift
["SHAMAN"] = {30823, 108271, 108270},
["SHAMAN"] = {30823, 108271, 108270, 108280, 98008, 108281},
-- Warlock
[104773] = {180, 8}, -- Unending Resolve
[108359] = {120, 12}, -- Dark Regeneration
[110913] = {180, 8}, -- Dark Bargain
["WARLOCK"] = {104773, 108359, 108416, 110913, 6229},
-- Warrior
[871] = {180, 12}, -- Shield Wall
[12975] = {180, 20}, -- Last Stand
@@ -1094,7 +1094,8 @@ do
[118038] = {120, 8}, -- Die by the Sword
[2565] = {90, 6}, -- Shield Block
[112048] = {90, 6}, -- Shield Barrier
["WARRIOR"] = {871, 12975, 23920, 114030, 118038}
["WARRIOR"] = {871, 12975, 23920, 114030, 118038, 114203, 114028, 97462}
}
_detalhes.HarmfulSpells = {
@@ -2009,4 +2010,9 @@ do
return _detalhes.spells_school [school] and _detalhes.spells_school [school].formated or ""
end
function _detalhes:GetCooldownList (class)
class = class or select (2, UnitClass ("player"))
return _detalhes.DefensiveCooldownSpells [class]
end
end
+385 -7
View File
@@ -11,7 +11,7 @@
8 - right menu
9 - wallpaper
10 - performance teaks
11 - captures
11 - raid tools
12 - plugins
13 - profiles
14 - attribute text
@@ -344,7 +344,7 @@ local menus = { --labels nos menus
Loc ["STRING_OPTIONSMENU_WINDOW"], Loc ["STRING_OPTIONSMENU_TITLETEXT"], Loc ["STRING_OPTIONSMENU_LEFTMENU"], Loc ["STRING_OPTIONSMENU_RIGHTMENU"],
Loc ["STRING_OPTIONSMENU_WALLPAPER"], Loc ["STRING_OPTIONSMENU_MISC"]},
{Loc ["STRING_OPTIONSMENU_DATACOLLECT"], Loc ["STRING_OPTIONSMENU_PERFORMANCE"], Loc ["STRING_OPTIONSMENU_PLUGINS"], Loc ["STRING_OPTIONSMENU_SPELLS"],
{Loc ["STRING_OPTIONSMENU_RAIDTOOLS"], Loc ["STRING_OPTIONSMENU_PERFORMANCE"], Loc ["STRING_OPTIONSMENU_PLUGINS"], Loc ["STRING_OPTIONSMENU_SPELLS"],
Loc ["STRING_OPTIONSMENU_DATACHART"]}
}
@@ -359,7 +359,7 @@ local menus = { --labels nos menus
Loc ["STRING_OPTIONSMENU_RIGHTMENU"], --8
Loc ["STRING_OPTIONSMENU_WALLPAPER"], --9
Loc ["STRING_OPTIONSMENU_PERFORMANCE"],--10
Loc ["STRING_OPTIONSMENU_DATACOLLECT"], --11
Loc ["STRING_OPTIONSMENU_RAIDTOOLS"], --11
Loc ["STRING_OPTIONSMENU_PLUGINS"],--12
Loc ["STRING_OPTIONSMENU_PROFILES"], --13
Loc ["STRING_OPTIONSMENU_TITLETEXT"], --14
@@ -6950,12 +6950,390 @@ function window:CreateFrame11()
local frame11 = window.options [11][1]
local label = g:NewLabel (frame11, _, "$parentMovedWarningLabel", "MovedWarningLabel", "This sectiong has been moved to Combat, under General Settings bracket.", "GameFontNormal")
local image = g:NewImage (frame11, [[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]])
--> title
local titulo1 = g:NewLabel (frame11, _, "$parentTituloRaidTools", "RaidToolsLabel", Loc ["STRING_OPTIONS_RT_TITLE"], "GameFontNormal", 16)
local titulo1_desc = g:NewLabel (frame11, _, "$parentTituloRaidToolsDesc", "RaidToolsDescLabel", Loc ["STRING_OPTIONS_RT_TITLE_DESC"], "GameFontNormal", 9, "white")
titulo1_desc.width = 320
label:SetPoint ("center", frame11, "center", 32, 0)
image:SetPoint ("right", label, "left", -7, 0)
local text_entry_size = 140
--announcers anchor
g:NewLabel (frame11, _, "$parentAnnouncersAnchor", "AnnouncersAnchor", Loc ["STRING_OPTIONS_RT_ANNOUNCEMENTS"], "GameFontNormal")
--interrupts
--enable
g:NewLabel (frame11, _, "$parentEnableInterruptsLabel", "EnableInterruptsLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_ONOFF"], "GameFontHighlightLeft")
g:NewSwitch (frame11, _, "$parentEnableInterruptsSlider", "EnableInterruptsSlider", 60, 20, _, _, _detalhes.announce_interrupts.enabled)
frame11.EnableInterruptsSlider:SetPoint ("left", frame11.EnableInterruptsLabel, "right", 2)
frame11.EnableInterruptsSlider.OnSwitch = function (_, _, value)
if (value) then
_detalhes:EnableInterruptAnnouncer()
else
_detalhes:DisableInterruptAnnouncer()
end
end
window:CreateLineBackground2 (frame11, "EnableInterruptsSlider", "EnableInterruptsLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_ONOFF_DESC"])
--whisper target
g:NewLabel (frame11, _, "$parentInterruptsWhisperLabel", "InterruptsWhisperLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_WHISPER"], "GameFontHighlightLeft")
g:NewTextEntry (frame11, _, "$parentInterruptsWhisperEntry", "InterruptsWhisperEntry", text_entry_size, 20)
frame11.InterruptsWhisperEntry:SetPoint ("left", frame11.InterruptsWhisperLabel, "right", 2, -1)
frame11.InterruptsWhisperEntry:SetText (_detalhes.announce_interrupts.whisper)
frame11.InterruptsWhisperEntry:SetHook ("OnTextChanged", function (self, byUser)
if (byUser) then
_detalhes.announce_interrupts.whisper = self:GetText()
end
end)
if (_detalhes.announce_interrupts.channel ~= "WHISPER") then
frame11.InterruptsWhisperEntry:Disable()
frame11.InterruptsWhisperLabel:SetTextColor (1, 1, 1, .4)
end
--channel
local on_select_channel = function (self, _, channel)
_detalhes.announce_interrupts.channel = channel
if (channel == "WHISPER") then
frame11.InterruptsWhisperEntry:Enable()
frame11.InterruptsWhisperLabel:SetTextColor (1, 1, 1, 1)
else
frame11.InterruptsWhisperEntry:Disable()
frame11.InterruptsWhisperLabel:SetTextColor (1, 1, 1, .4)
end
end
local channel_list = {
{value = "SAY", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconsize = {14, 14}, texcoord = {0.0390625, 0.203125, 0.09375, 0.375}, label = Loc ["STRING_CHANNEL_SAY"], onclick = on_select_channel},
{value = "YELL", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconsize = {14, 14}, texcoord = {0.0390625, 0.203125, 0.09375, 0.375}, iconcolor = {1, 0.3, 0, 1}, label = Loc ["STRING_CHANNEL_YELL"], onclick = on_select_channel},
{value = "RAID", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {1, 0.49, 0}, iconsize = {14, 14}, texcoord = {0.53125, 0.7265625, 0.078125, 0.40625}, label = Loc ["STRING_CHANNEL_RAID"], onclick = on_select_channel},
{value = "WHISPER", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {1, 0.49, 1}, iconsize = {14, 14}, texcoord = {0.0546875, 0.1953125, 0.625, 0.890625}, label = Loc ["STRING_CHANNEL_WHISPER"], onclick = on_select_channel},
}
local build_channel_menu = function()
return channel_list
end
g:NewLabel (frame11, _, "$parentInterruptsChannelLabel", "InterruptsChannelLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_CHANNEL"] , "GameFontHighlightLeft")
local d = g:NewDropDown (frame11, _, "$parentInterruptsChannelDropdown", "InterruptsChannelDropdown", DROPDOWN_WIDTH, 20, build_channel_menu, _detalhes.announce_interrupts.channel)
d.onenter_backdrop = dropdown_backdrop_onenter
d.onleave_backdrop = dropdown_backdrop_onleave
d:SetBackdrop (dropdown_backdrop)
d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
frame11.InterruptsChannelDropdown:SetPoint ("left", frame11.InterruptsChannelLabel, "right", 2)
window:CreateLineBackground2 (frame11, "InterruptsChannelDropdown", "InterruptsChannelLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_CHANNEL_DESC"])
--campo para digitar o nome do proximo
g:NewLabel (frame11, _, "$parentInterruptsNextLabel", "InterruptsNextLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_NEXT"], "GameFontHighlightLeft")
g:NewTextEntry (frame11, _, "$parentInterruptsNextEntry", "InterruptsNextEntry", text_entry_size, 20)
frame11.InterruptsNextEntry:SetPoint ("left", frame11.InterruptsNextLabel, "right", 2, -1)
frame11.InterruptsNextEntry:SetText (_detalhes.announce_interrupts.next)
frame11.InterruptsNextEntry:SetHook ("OnTextChanged", function (self, byUser)
_detalhes.announce_interrupts.next = self:GetText()
end)
window:CreateLineBackground2 (frame11, "InterruptsNextEntry", "InterruptsNextLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_NEXT_DESC"])
local reset_next = g:NewButton (frame11.InterruptsNextEntry, _, "$parentResetNextPlayerButton", "ResetNextPlayerButton", 16, 16, function()
frame11.InterruptsNextEntry.text = ""
frame11.InterruptsNextEntry:PressEnter()
end)
reset_next:SetPoint ("left", frame11.InterruptsNextEntry, "right", 0, 0)
reset_next:SetNormalTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Down]])
reset_next:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]])
reset_next:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]])
reset_next:GetNormalTexture():SetDesaturated (true)
reset_next.tooltip = "Reset to Default"
--campo para digitar a fala customizada
g:NewLabel (frame11, _, "$parentInterruptsCustomLabel", "InterruptsCustomLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_CUSTOM"], "GameFontHighlightLeft")
g:NewTextEntry (frame11, _, "$parentInterruptsCustomEntry", "InterruptsCustomEntry", text_entry_size, 20)
frame11.InterruptsCustomEntry:SetPoint ("left", frame11.InterruptsCustomLabel, "right", 2, -1)
frame11.InterruptsCustomEntry:SetText (_detalhes.announce_interrupts.custom)
frame11.InterruptsCustomEntry:SetHook ("OnTextChanged", function (self, byUser)
_detalhes.announce_interrupts.custom = self:GetText()
end)
window:CreateLineBackground2 (frame11, "InterruptsCustomEntry", "InterruptsCustomLabel", Loc ["STRING_OPTIONS_RT_INTERRUPTS_CUSTOM_DESC"])
local reset_custom = g:NewButton (frame11.InterruptsCustomEntry, _, "$parentResetCustomPhraseButton", "ResetCustomPhraseButton", 16, 16, function()
frame11.InterruptsCustomEntry.text = ""
frame11.InterruptsCustomEntry:PressEnter()
end)
reset_custom:SetPoint ("left", frame11.InterruptsCustomEntry, "right", 0, 0)
reset_custom:SetNormalTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Down]])
reset_custom:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]])
reset_custom:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]])
reset_custom:GetNormalTexture():SetDesaturated (true)
reset_custom.tooltip = "Reset to Default"
--cooldowns
g:NewLabel (frame11, _, "$parentEnableCooldownsLabel", "EnableCooldownsLabel", Loc ["STRING_OPTIONS_RT_COOLDOWNS_ONOFF"], "GameFontHighlightLeft")
g:NewSwitch (frame11, _, "$parentEnableCooldownsSlider", "EnableCooldownsSlider", 60, 20, _, _, _detalhes.announce_cooldowns.enabled)
frame11.EnableCooldownsSlider:SetPoint ("left", frame11.EnableCooldownsLabel, "right", 2)
frame11.EnableCooldownsSlider.OnSwitch = function (_, _, value)
if (value) then
_detalhes:EnableCooldownAnnouncer()
else
_detalhes:DisableCooldownAnnouncer()
end
end
window:CreateLineBackground2 (frame11, "EnableCooldownsSlider", "EnableCooldownsLabel", Loc ["STRING_OPTIONS_RT_COOLDOWNS_ONOFF_DESC"])
--dropdown para escolher o canal
local on_select_channel = function (self, _, channel)
_detalhes.announce_cooldowns.channel = channel
end
local channel_list = {
{value = "SAY", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconsize = {14, 14}, texcoord = {0.0390625, 0.203125, 0.09375, 0.375}, label = Loc ["STRING_CHANNEL_SAY"], onclick = on_select_channel},
{value = "YELL", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconsize = {14, 14}, texcoord = {0.0390625, 0.203125, 0.09375, 0.375}, iconcolor = {1, 0.3, 0, 1}, label = Loc ["STRING_CHANNEL_YELL"], onclick = on_select_channel},
{value = "RAID", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {1, 0.49, 0}, iconsize = {14, 14}, texcoord = {0.53125, 0.7265625, 0.078125, 0.40625}, label = Loc ["STRING_CHANNEL_RAID"], onclick = on_select_channel},
{value = "WHISPER", icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {1, 0.49, 1}, iconsize = {14, 14}, texcoord = {0.0546875, 0.1953125, 0.625, 0.890625}, label = Loc ["STRING_CHANNEL_WHISPER_TARGET_COOLDOWN"], onclick = on_select_channel},
}
local build_channel_menu = function()
return channel_list
end
g:NewLabel (frame11, _, "$parentCooldownChannelLabel", "CooldownChannelLabel", Loc ["STRING_OPTIONS_RT_COOLDOWNS_CHANNEL"] , "GameFontHighlightLeft")
local d = g:NewDropDown (frame11, _, "$parentCooldownChannelDropdown", "CooldownChannelDropdown", DROPDOWN_WIDTH, 20, build_channel_menu, _detalhes.announce_cooldowns.channel)
d.onenter_backdrop = dropdown_backdrop_onenter
d.onleave_backdrop = dropdown_backdrop_onleave
d:SetBackdrop (dropdown_backdrop)
d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
frame11.CooldownChannelDropdown:SetPoint ("left", frame11.CooldownChannelLabel, "right", 2)
window:CreateLineBackground2 (frame11, "CooldownChannelDropdown", "CooldownChannelLabel", Loc ["STRING_OPTIONS_RT_COOLDOWNS_CHANNEL_DESC"])
--campo para digitar a frase customizada
g:NewLabel (frame11, _, "$parentCooldownCustomLabel", "CooldownCustomLabel", Loc ["STRING_OPTIONS_RT_COOLDOWNS_CUSTOM"], "GameFontHighlightLeft")
g:NewTextEntry (frame11, _, "$parentCooldownCustomEntry", "CooldownCustomEntry", text_entry_size, 20)
frame11.CooldownCustomEntry:SetPoint ("left", frame11.CooldownCustomLabel, "right", 2, -1)
frame11.CooldownCustomEntry:SetText (_detalhes.announce_cooldowns.custom)
frame11.CooldownCustomEntry:SetHook ("OnTextChanged", function (self, byUser)
_detalhes.announce_cooldowns.custom = self:GetText()
end)
window:CreateLineBackground2 (frame11, "CooldownCustomEntry", "CooldownCustomLabel", Loc ["STRING_OPTIONS_RT_COOLDOWNS_CUSTOM_DESC"])
local reset_custom = g:NewButton (frame11.CooldownCustomEntry, _, "$parentResetCooldownCustomPhraseButton", "ResetCooldownCustomPhraseButton", 16, 16, function()
frame11.CooldownCustomEntry.text = ""
frame11.CooldownCustomEntry:PressEnter()
end)
reset_custom:SetPoint ("left", frame11.CooldownCustomEntry, "right", 0, 0)
reset_custom:SetNormalTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Down]])
reset_custom:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]])
reset_custom:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]])
reset_custom:GetNormalTexture():SetDesaturated (true)
reset_custom.tooltip = "Reset to Default"
--esquema para ativar ou desativar certos cooldowns
--botão que abre um gump estilo welcome, com as spells pegas na lista de cooldowns
g:NewButton (frame11, _, "$parentCooldownIgnoreButton", "CooldownIgnoreButton", 140, 16, function()
if (not DetailsAnnounceSelectCooldownIgnored) then
DetailsAnnounceSelectCooldownIgnored = CreateFrame ("frame", "DetailsAnnounceSelectCooldownIgnored", UIParent)
local f = DetailsAnnounceSelectCooldownIgnored
f:SetSize (250, 400)
f:SetPoint ("center", UIParent, "center", 0, 0)
local bg = f:CreateTexture (nil, "background")
bg:SetAllPoints (f)
bg:SetTexture ([[Interface\AddOns\Details\images\welcome]])
f:SetFrameStrata ("FULLSCREEN")
local close = CreateFrame ("button", "DetailsAnnounceSelectCooldownIgnoredClose", f, "UIPanelCloseButton")
close:SetSize (32, 32)
close:SetPoint ("topright", f, "topright", 0, -12)
f:EnableMouse()
f:SetMovable (true)
f:SetScript ("OnMouseDown", function (self, button)
if (button == "RightButton") then
if (f.IsMoving) then
f.IsMoving = false
f:StopMovingOrSizing()
end
f:Hide()
return
end
f.IsMoving = true
f:StartMoving()
end)
f:SetScript ("OnMouseUp", function (self, button)
if (f.IsMoving) then
f.IsMoving = false
f:StopMovingOrSizing()
end
end)
f.title = g:CreateLabel (f, Loc ["STRING_OPTIONS_RT_IGNORE_TITLE"], 12, nil, "GameFontNormal")
f.title:SetPoint ("top", f, "top", 0, -22)
f.labels = {}
local on_switch_func = function (self, spellid, value)
if (not value) then
_detalhes.announce_cooldowns.ignored_cooldowns [spellid] = nil
else
_detalhes.announce_cooldowns.ignored_cooldowns [spellid] = true
end
end
f:SetScript ("OnHide", function (self)
self:Clear()
end)
function f:Clear()
for _, label in ipairs (self.labels) do
label.icon:Hide()
label.text:Hide()
label.switch:Hide()
end
end
function f:CreateLabel()
local L = {
icon = g:CreateImage (f, nil, 16, 16, "overlay", {0.1, 0.9, 0.1, 0.9}),
text = g:CreateLabel (f, "", 10, "white", "GameFontHighlightSmall"),
switch = g:CreateSwitch (f, on_switch_func, false)
}
L.icon:SetPoint ("topleft", f, "topleft", 10, ((#f.labels*20)*-1)-55)
L.text:SetPoint ("left", L.icon, "right", 2, 0)
L.switch:SetPoint ("left", L.text, "right", 2, 0)
tinsert (f.labels, L)
return L
end
function f:Open()
local _GetSpellInfo = _detalhes.getspellinfo --details api
for index, spellid in ipairs (_detalhes:GetCooldownList()) do
local label = f.labels [index] or f:CreateLabel()
local name, _, icon = _GetSpellInfo (spellid)
label.icon.texture = icon
label.text.text = name .. ":"
label.switch:SetFixedParameter (spellid)
label.switch:SetValue (_detalhes.announce_cooldowns.ignored_cooldowns [spellid])
label.icon:Show()
label.text:Show()
label.switch:Show()
end
f:Show()
end
end
DetailsAnnounceSelectCooldownIgnored:Open()
end, nil, nil, nil, Loc ["STRING_OPTIONS_RT_COOLDOWNS_SELECT"], 1)
frame11.CooldownIgnoreButton:InstallCustomTexture()
window:CreateLineBackground2 (frame11, "CooldownIgnoreButton", "CooldownIgnoreButton", Loc ["STRING_OPTIONS_RT_COOLDOWNS_SELECT_DESC"], nil, {1, 0.8, 0}, button_color_rgb)
frame11.CooldownIgnoreButton:SetIcon ([[Interface\COMMON\UI-DropDownRadioChecks]], nil, nil, nil, {0, 0.5, 0, 0.5})
frame11.CooldownIgnoreButton:SetTextColor (button_color_rgb)
--deaths
g:NewLabel (frame11, _, "$parentEnableDeathsLabel", "EnableDeathsLabel", Loc ["STRING_OPTIONS_RT_DEATHS_ONOFF"], "GameFontHighlightLeft")
g:NewSwitch (frame11, _, "$parentEnableDeathsSlider", "EnableDeathsSlider", 60, 20, _, _, _detalhes.announce_deaths.enabled)
frame11.EnableDeathsSlider:SetPoint ("left", frame11.EnableDeathsLabel, "right", 2)
frame11.EnableDeathsSlider.OnSwitch = function (_, _, value)
if (value) then
_detalhes:EnableDeathAnnouncer()
else
_detalhes:DisableDeathAnnouncer()
end
end
window:CreateLineBackground2 (frame11, "EnableDeathsSlider", "EnableDeathsLabel", Loc ["STRING_OPTIONS_RT_DEATHS_ONOFF_DESC"])
--slider para quantidade de danos a mostrar
g:NewLabel (frame11, _, "$parentDeathsDamageLabel", "DeathsDamageLabel", Loc ["STRING_OPTIONS_RT_DEATHS_HITS"], "GameFontHighlightLeft")
local s = g:NewSlider (frame11, _, "$parentDeathsDamageSlider", "DeathsDamageSlider", SLIDER_WIDTH, 20, 1, 3, 1, _detalhes.announce_deaths.last_hits)
s:SetBackdrop (slider_backdrop)
s:SetBackdropColor (unpack (slider_backdrop_color))
s:SetThumbSize (50)
frame11.DeathsDamageSlider:SetPoint ("left", frame11.DeathsDamageLabel, "right", 2)
frame11.DeathsDamageSlider:SetHook ("OnValueChange", function (self, _, amount)
_detalhes.announce_deaths.last_hits = amount
end)
window:CreateLineBackground2 (frame11, "DeathsDamageSlider", "DeathsDamageLabel", Loc ["STRING_OPTIONS_RT_DEATHS_HITS_DESC"])
--slider para limite de mortes para reportar
g:NewLabel (frame11, _, "$parentDeathsAmountLabel", "DeathsAmountLabel", Loc ["STRING_OPTIONS_RT_DEATHS_FIRST"], "GameFontHighlightLeft")
local s = g:NewSlider (frame11, _, "$parentDeathsAmountSlider", "DeathsAmountSlider", SLIDER_WIDTH, 20, 1, 30, 1, _detalhes.announce_deaths.only_first)
s:SetBackdrop (slider_backdrop)
s:SetBackdropColor (unpack (slider_backdrop_color))
s:SetThumbSize (50)
frame11.DeathsAmountSlider:SetPoint ("left", frame11.DeathsAmountLabel, "right", 2)
frame11.DeathsAmountSlider:SetHook ("OnValueChange", function (self, _, amount)
_detalhes.announce_deaths.only_first = amount
end)
window:CreateLineBackground2 (frame11, "DeathsAmountSlider", "DeathsAmountLabel", Loc ["STRING_OPTIONS_RT_DEATHS_FIRST_DESC"])
--dropdown para WHERE onde anunciar se só em raid e party
local on_select_channel = function (self, _, channel)
_detalhes.announce_deaths.channel = channel
end
local channel_list = {
{value = 1, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {1, 0, 1}, iconsize = {14, 14}, texcoord = {0.53125, 0.7265625, 0.078125, 0.40625}, label = Loc ["STRING_OPTIONS_RT_DEATHS_WHERE1"], onclick = on_select_channel},
{value = 2, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {1, 0.49, 0}, iconsize = {14, 14}, texcoord = {0.53125, 0.7265625, 0.078125, 0.40625}, label = Loc ["STRING_OPTIONS_RT_DEATHS_WHERE2"], onclick = on_select_channel},
{value = 3, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], iconcolor = {0.66, 0.65, 1}, iconsize = {14, 14}, texcoord = {0.53125, 0.7265625, 0.078125, 0.40625}, label = Loc ["STRING_OPTIONS_RT_DEATHS_WHERE3"], onclick = on_select_channel},
}
local build_channel_menu = function()
return channel_list
end
g:NewLabel (frame11, _, "$parentDeathChannelLabel", "DeathChannelLabel", Loc ["STRING_OPTIONS_RT_DEATHS_WHERE"] , "GameFontHighlightLeft")
local d = g:NewDropDown (frame11, _, "$parentDeathChannelDropdown", "DeathChannelDropdown", DROPDOWN_WIDTH, 20, build_channel_menu, _detalhes.announce_deaths.channel)
d.onenter_backdrop = dropdown_backdrop_onenter
d.onleave_backdrop = dropdown_backdrop_onleave
d:SetBackdrop (dropdown_backdrop)
d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
frame11.DeathChannelDropdown:SetPoint ("left", frame11.DeathChannelLabel, "right", 2)
window:CreateLineBackground2 (frame11, "DeathChannelDropdown", "DeathChannelLabel", Loc ["STRING_OPTIONS_RT_DEATHS_WHERE_DESC"])
--> anchors
local x = window.left_start_at
titulo1:SetPoint (x, -30)
titulo1_desc:SetPoint (x, -50)
local left_side = {
{"AnnouncersAnchor", 1, true},
{"EnableInterruptsLabel", 2},
{"InterruptsChannelLabel", 3},
{"InterruptsWhisperLabel", 4},
{"InterruptsNextLabel", 5},
{"InterruptsCustomLabel", 6},
{"EnableCooldownsLabel", 7, true},
{"CooldownChannelLabel", 8},
{"CooldownCustomLabel", 9},
{"CooldownIgnoreButton", 10},
{"EnableDeathsLabel", 11, true},
{"DeathChannelLabel", 12},
{"DeathsDamageLabel", 13},
{"DeathsAmountLabel", 14},
}
window:arrange_menu (frame11, left_side, window.left_start_at, -90)
local right_side = {
{"AnnouncersAnchor", 1, true},
}
--window:arrange_menu (frame11, right_side, window.right_start_at, -90)
end
+6
View File
@@ -419,12 +419,18 @@ function _G._detalhes:Start()
--BNSendFriendInvite ("tercio#1488")
--> get in the realm chat channel
if (not _detalhes.schedule_chat_enter and not _detalhes.schedule_chat_leave) then
_detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 30)
end
--> open profiler
_detalhes:OpenProfiler()
--> start announcers
_detalhes:StartAnnouncers()
--> open welcome
if (self.is_first_run) then
_detalhes:OpenWelcomeWindow()
end