8.3.0 > 9.0.1

This commit is contained in:
Tercio Jose
2020-10-16 19:51:44 -03:00
parent 530a825358
commit c42a35657d
223 changed files with 93840 additions and 94757 deletions
+1
View File
@@ -30,3 +30,4 @@ Libs/LibTranslit/.pkgmeta
a.lua
functions/pack2.lua
*.json
*.afphoto
+7 -7
View File
@@ -1,10 +1,10 @@
lightweight tag 5bd30e291f18247a7ed005a957407eab6f25176a v8.2.0.7177.140
Author: Tercioo <terciob19@hotmail.com>
Date: Sat Aug 17 09:50:52 2019 -0300
lightweight tag 899ac439a17c19a799d30a6a2a0e2faf5cc215e1 DetailsRetail.8.3.0.7348.141
Author: Tercio Jose <terciob19@hotmail.com>
Date: Mon Jul 6 11:27:35 2020 -0300
commit 5bd30e291f18247a7ed005a957407eab6f25176a
Author: Tercioo <terciob19@hotmail.com>
Date: Sat Aug 17 09:50:52 2019 -0300
commit 899ac439a17c19a799d30a6a2a0e2faf5cc215e1
Author: Tercio Jose <terciob19@hotmail.com>
Date: Mon Jul 6 11:27:35 2020 -0300
Fixed bookmark panel where sometimes it gives errors, version number correction and fixed the classic version warning.
Fixed an issue affecting the Auto Hide for some users
+62 -34
View File
@@ -1,4 +1,4 @@
## Interface: 80300
## Interface: 90001
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## SavedVariables: _detalhes_global
@@ -27,13 +27,13 @@ API.lua
functions\profiles.lua
functions\hooks.lua
functions\bossmods.lua
functions\skins.lua
functions\boss.lua
functions\spells.lua
functions\events.lua
functions\classes.lua
functions\buff.lua
functions\link.lua
functions\spellcache.lua
functions\attributes.lua
functions\savedata.lua
@@ -45,46 +45,74 @@ functions\rowanimation.lua
functions\raidinfo.lua
functions\dungeon.lua
functions\pack.lua
functions\mythicdungeon.lua
functions\immersion.lua
functions\schedules.lua
functions\autorun.lua
functions\deathrecap.lua
functions\plater.lua
functions\deathmenu.lua
functions\macros.lua
functions\testbars.lua
core\timemachine.lua
gumps\anime.lua
gumps\anime.xml
gumps\janela_copy.lua
gumps\janela_options.lua
gumps\janela_info.lua
gumps\janela_report.lua
gumps\janela_principal.lua
gumps\janela_custom.lua
gumps\janela_welcome.lua
gumps\janela_news.lua
gumps\fw_mods.lua
gumps\switch.lua
gumps\toolbar_button.xml
frames\anime.lua
frames\anime.xml
frames\fw_mods.lua
frames\toolbar_button.xml
classes\classe_error.lua
classes\classe_combate.lua
classes\classe_damage.lua
classes\classe_damage_habilidade.lua
classes\classe_heal.lua
classes\classe_heal_habilidade.lua
classes\classe_energy.lua
classes\classe_energy_habilidade.lua
classes\classe_others.lua
classes\classe_others_habilidade.lua
classes\classe_instancia_include.lua
classes\classe_instancia.lua
classes\classe_target.lua
frames\window_copy.lua
frames\window_options2.lua
frames\window_options2_sections.lua
frames\window_api.lua
frames\window_playerbreakdown.lua
frames\window_playerbreakdown_list.lua
frames\window_report.lua
frames\window_main.lua
frames\window_custom.lua
frames\window_welcome.lua
frames\window_news.lua
frames\window_wa.lua
frames\window_forge.lua
frames\window_switch.lua
frames\window_scrolldamage.lua
frames\window_dump.lua
frames\window_eventtracker.lua
frames\window_currentdps.lua
frames\window_benchmark.lua
frames\window_runcode.lua
frames\window_plater.lua
frames\window_macros.lua
frames\window_profiler.lua
frames\window_rowtexteditor.lua
frames\window_brokertexteditor.lua
frames\window_bookmark.lua
frames\window_classcolor.lua
frames\window_statistics.lua
classes\classe_custom.lua
classes\custom_damage_done.lua
classes\custom_healing_done.lua
classes\class_error.lua
classes\class_combat.lua
classes\class_damage.lua
classes\class_spelldamage.lua
classes\class_heal.lua
classes\class_spellhealing.lua
classes\class_resources.lua
classes\class_spellresources.lua
classes\class_utility.lua
classes\class_spellutility.lua
classes\include_instance.lua
classes\class_instance.lua
classes\class_custom.lua
classes\custom_damagedone.lua
classes\custom_healingdone.lua
core\control.lua
classes\container_combatentes.lua
classes\container_habilidades.lua
classes\container_historico.lua
classes\container_actors.lua
classes\container_spells.lua
classes\container_segments.lua
classes\container_pets.lua
core\plugins.lua
-264
View File
@@ -1,264 +0,0 @@
--- A bucket to catch events in. **AceBucket-3.0** provides throttling of events that fire in bursts and
-- your addon only needs to know about the full burst.
--
-- This Bucket implementation works as follows:\\
-- Initially, no schedule is running, and its waiting for the first event to happen.\\
-- The first event will start the bucket, and get the scheduler running, which will collect all
-- events in the given interval. When that interval is reached, the bucket is pushed to the
-- callback and a new schedule is started. When a bucket is empty after its interval, the scheduler is
-- stopped, and the bucket is only listening for the next event to happen, basically back in its initial state.
--
-- In addition, the buckets collect information about the "arg1" argument of the events that fire, and pass those as a
-- table to your callback. This functionality was mostly designed for the UNIT_* events.\\
-- The table will have the different values of "arg1" as keys, and the number of occurances as their value, e.g.\\
-- { ["player"] = 2, ["target"] = 1, ["party1"] = 1 }
--
-- **AceBucket-3.0** can be embeded into your addon, either explicitly by calling AceBucket:Embed(MyAddon) or by
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
-- and can be accessed directly, without having to explicitly call AceBucket itself.\\
-- It is recommended to embed AceBucket, otherwise you'll have to specify a custom `self` on all calls you
-- make into AceBucket.
-- @usage
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("BucketExample", "AceBucket-3.0")
--
-- function MyAddon:OnEnable()
-- -- Register a bucket that listens to all the HP related events,
-- -- and fires once per second
-- self:RegisterBucketEvent({"UNIT_HEALTH", "UNIT_MAXHEALTH"}, 1, "UpdateHealth")
-- end
--
-- function MyAddon:UpdateHealth(units)
-- if units.player then
-- print("Your HP changed!")
-- end
-- end
-- @class file
-- @name AceBucket-3.0.lua
-- @release $Id: AceBucket-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
local MAJOR, MINOR = "AceBucket-3.0", 4
local AceBucket, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceBucket then return end -- No Upgrade needed
AceBucket.buckets = AceBucket.buckets or {}
AceBucket.embeds = AceBucket.embeds or {}
-- the libraries will be lazyly bound later, to avoid errors due to loading order issues
local AceEvent, AceTimer
-- Lua APIs
local tconcat = table.concat
local type, next, pairs, select = type, next, pairs, select
local tonumber, tostring, rawset = tonumber, tostring, rawset
local assert, loadstring, error = assert, loadstring, error
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: LibStub, geterrorhandler
local bucketCache = setmetatable({}, {__mode='k'})
--[[
xpcall safecall implementation
]]
local xpcall = xpcall
local function errorhandler(err)
return geterrorhandler()(err)
end
local function safecall(func, ...)
if func then
return xpcall(func, errorhandler, ...)
end
end
-- FireBucket ( bucket )
--
-- send the bucket to the callback function and schedule the next FireBucket in interval seconds
local function FireBucket(bucket)
local received = bucket.received
-- we dont want to fire empty buckets
if next(received) ~= nil then
local callback = bucket.callback
if type(callback) == "string" then
safecall(bucket.object[callback], bucket.object, received)
else
safecall(callback, received)
end
for k in pairs(received) do
received[k] = nil
end
-- if the bucket was not empty, schedule another FireBucket in interval seconds
bucket.timer = AceTimer.ScheduleTimer(bucket, FireBucket, bucket.interval, bucket)
else -- if it was empty, clear the timer and wait for the next event
bucket.timer = nil
end
end
-- BucketHandler ( event, arg1 )
--
-- callback func for AceEvent
-- stores arg1 in the received table, and schedules the bucket if necessary
local function BucketHandler(self, event, arg1)
if arg1 == nil then
arg1 = "nil"
end
self.received[arg1] = (self.received[arg1] or 0) + 1
-- if we are not scheduled yet, start a timer on the interval for our bucket to be cleared
if not self.timer then
self.timer = AceTimer.ScheduleTimer(self, FireBucket, self.interval, self)
end
end
-- RegisterBucket( event, interval, callback, isMessage )
--
-- event(string or table) - the event, or a table with the events, that this bucket listens to
-- interval(int) - time between bucket fireings
-- callback(func or string) - function pointer, or method name of the object, that gets called when the bucket is cleared
-- isMessage(boolean) - register AceEvent Messages instead of game events
local function RegisterBucket(self, event, interval, callback, isMessage)
-- try to fetch the librarys
if not AceEvent or not AceTimer then
AceEvent = LibStub:GetLibrary("AceEvent-3.0", true)
AceTimer = LibStub:GetLibrary("AceTimer-3.0", true)
if not AceEvent or not AceTimer then
error(MAJOR .. " requires AceEvent-3.0 and AceTimer-3.0", 3)
end
end
if type(event) ~= "string" and type(event) ~= "table" then error("Usage: RegisterBucket(event, interval, callback): 'event' - string or table expected.", 3) end
if not callback then
if type(event) == "string" then
callback = event
else
error("Usage: RegisterBucket(event, interval, callback): cannot omit callback when event is not a string.", 3)
end
end
if not tonumber(interval) then error("Usage: RegisterBucket(event, interval, callback): 'interval' - number expected.", 3) end
if type(callback) ~= "string" and type(callback) ~= "function" then error("Usage: RegisterBucket(event, interval, callback): 'callback' - string or function or nil expected.", 3) end
if type(callback) == "string" and type(self[callback]) ~= "function" then error("Usage: RegisterBucket(event, interval, callback): 'callback' - method not found on target object.", 3) end
local bucket = next(bucketCache)
if bucket then
bucketCache[bucket] = nil
else
bucket = { handler = BucketHandler, received = {} }
end
bucket.object, bucket.callback, bucket.interval = self, callback, tonumber(interval)
local regFunc = isMessage and AceEvent.RegisterMessage or AceEvent.RegisterEvent
if type(event) == "table" then
for _,e in pairs(event) do
regFunc(bucket, e, "handler")
end
else
regFunc(bucket, event, "handler")
end
local handle = tostring(bucket)
AceBucket.buckets[handle] = bucket
return handle
end
--- Register a Bucket for an event (or a set of events)
-- @param event The event to listen for, or a table of events.
-- @param interval The Bucket interval (burst interval)
-- @param callback The callback function, either as a function reference, or a string pointing to a method of the addon object.
-- @return The handle of the bucket (for unregistering)
-- @usage
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceBucket-3.0")
-- MyAddon:RegisterBucketEvent("BAG_UPDATE", 0.2, "UpdateBags")
--
-- function MyAddon:UpdateBags()
-- -- do stuff
-- end
function AceBucket:RegisterBucketEvent(event, interval, callback)
return RegisterBucket(self, event, interval, callback, false)
end
--- Register a Bucket for an AceEvent-3.0 addon message (or a set of messages)
-- @param message The message to listen for, or a table of messages.
-- @param interval The Bucket interval (burst interval)
-- @param callback The callback function, either as a function reference, or a string pointing to a method of the addon object.
-- @return The handle of the bucket (for unregistering)
-- @usage
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceBucket-3.0")
-- MyAddon:RegisterBucketEvent("SomeAddon_InformationMessage", 0.2, "ProcessData")
--
-- function MyAddon:ProcessData()
-- -- do stuff
-- end
function AceBucket:RegisterBucketMessage(message, interval, callback)
return RegisterBucket(self, message, interval, callback, true)
end
--- Unregister any events and messages from the bucket and clear any remaining data.
-- @param handle The handle of the bucket as returned by RegisterBucket*
function AceBucket:UnregisterBucket(handle)
local bucket = AceBucket.buckets[handle]
if bucket then
AceEvent.UnregisterAllEvents(bucket)
AceEvent.UnregisterAllMessages(bucket)
-- clear any remaining data in the bucket
for k in pairs(bucket.received) do
bucket.received[k] = nil
end
if bucket.timer then
AceTimer.CancelTimer(bucket, bucket.timer)
bucket.timer = nil
end
AceBucket.buckets[handle] = nil
-- store our bucket in the cache
bucketCache[bucket] = true
end
end
--- Unregister all buckets of the current addon object (or custom "self").
function AceBucket:UnregisterAllBuckets()
-- hmm can we do this more efficient? (it is not done often so shouldn't matter much)
for handle, bucket in pairs(AceBucket.buckets) do
if bucket.object == self then
AceBucket.UnregisterBucket(self, handle)
end
end
end
-- embedding and embed handling
local mixins = {
"RegisterBucketEvent",
"RegisterBucketMessage",
"UnregisterBucket",
"UnregisterAllBuckets",
}
-- Embeds AceBucket into the target object making the functions from the mixins list available on target:..
-- @param target target object to embed AceBucket in
function AceBucket:Embed( target )
for _, v in pairs( mixins ) do
target[v] = self[v]
end
self.embeds[target] = true
return target
end
function AceBucket:OnEmbedDisable( target )
target:UnregisterAllBuckets()
end
for addon in pairs(AceBucket.embeds) do
AceBucket:Embed(addon)
end
-4
View File
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceBucket-3.0.lua"/>
</Ui>
-58
View File
@@ -1,58 +0,0 @@
--- AceConfig-3.0 wrapper library.
-- Provides an API to register an options table with the config registry,
-- as well as associate it with a slash command.
-- @class file
-- @name AceConfig-3.0
-- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
--[[
AceConfig-3.0
Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole.
]]
local cfgreg = LibStub("AceConfigRegistry-3.0")
local cfgcmd = LibStub("AceConfigCmd-3.0")
local MAJOR, MINOR = "AceConfig-3.0", 3
local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfig then return end
--TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true)
--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true)
-- Lua APIs
local pcall, error, type, pairs = pcall, error, type, pairs
-- -------------------------------------------------------------------
-- :RegisterOptionsTable(appName, options, slashcmd, persist)
--
-- - appName - (string) application name
-- - options - table or function ref, see AceConfigRegistry
-- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command
--- Register a option table with the AceConfig registry.
-- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly.
-- @paramsig appName, options [, slashcmd]
-- @param appName The application name for the config table.
-- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/
-- @param slashcmd A slash command to register for the option table, or a table of slash commands.
-- @usage
-- local AceConfig = LibStub("AceConfig-3.0")
-- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"})
function AceConfig:RegisterOptionsTable(appName, options, slashcmd)
local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options)
if not ok then error(msg, 2) end
if slashcmd then
if type(slashcmd) == "table" then
for _,cmd in pairs(slashcmd) do
cfgcmd:CreateChatCommand(cmd, appName)
end
else
cfgcmd:CreateChatCommand(slashcmd, appName)
end
end
end
-8
View File
@@ -1,8 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Include file="AceConfigRegistry-3.0\AceConfigRegistry-3.0.xml"/>
<Include file="AceConfigCmd-3.0\AceConfigCmd-3.0.xml"/>
<Include file="AceConfigDialog-3.0\AceConfigDialog-3.0.xml"/>
<!--<Include file="AceConfigDropdown-3.0\AceConfigDropdown-3.0.xml"/>-->
<Script file="AceConfig-3.0.lua"/>
</Ui>
@@ -1,794 +0,0 @@
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames.
-- @class file
-- @name AceConfigCmd-3.0
-- @release $Id: AceConfigCmd-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
--[[
AceConfigCmd-3.0
Handles commandline optionstable access
REQUIRES: AceConsole-3.0 for command registration (loaded on demand)
]]
-- TODO: plugin args
local cfgreg = LibStub("AceConfigRegistry-3.0")
local MAJOR, MINOR = "AceConfigCmd-3.0", 14
local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigCmd then return end
AceConfigCmd.commands = AceConfigCmd.commands or {}
local commands = AceConfigCmd.commands
local AceConsole -- LoD
local AceConsoleName = "AceConsole-3.0"
-- Lua APIs
local strsub, strsplit, strlower, strmatch, strtrim = string.sub, string.split, string.lower, string.match, string.trim
local format, tonumber, tostring = string.format, tonumber, tostring
local tsort, tinsert = table.sort, table.insert
local select, pairs, next, type = select, pairs, next, type
local error, assert = error, assert
-- WoW APIs
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: LibStub, SELECTED_CHAT_FRAME, DEFAULT_CHAT_FRAME
local L = setmetatable({}, { -- TODO: replace with proper locale
__index = function(self,k) return k end
})
local function print(msg)
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
end
-- constants used by getparam() calls below
local handlertypes = {["table"]=true}
local handlermsg = "expected a table"
local functypes = {["function"]=true, ["string"]=true}
local funcmsg = "expected function or member name"
-- pickfirstset() - picks the first non-nil value and returns it
local function pickfirstset(...)
for i=1,select("#",...) do
if select(i,...)~=nil then
return select(i,...)
end
end
end
-- err() - produce real error() regarding malformed options tables etc
local function err(info,inputpos,msg )
local cmdstr=" "..strsub(info.input, 1, inputpos-1)
error(MAJOR..": /" ..info[0] ..cmdstr ..": "..(msg or "malformed options table"), 2)
end
-- usererr() - produce chatframe message regarding bad slash syntax etc
local function usererr(info,inputpos,msg )
local cmdstr=strsub(info.input, 1, inputpos-1);
print("/" ..info[0] .. " "..cmdstr ..": "..(msg or "malformed options table"))
end
-- callmethod() - call a given named method (e.g. "get", "set") with given arguments
local function callmethod(info, inputpos, tab, methodtype, ...)
local method = info[methodtype]
if not method then
err(info, inputpos, "'"..methodtype.."': not set")
end
info.arg = tab.arg
info.option = tab
info.type = tab.type
if type(method)=="function" then
return method(info, ...)
elseif type(method)=="string" then
if type(info.handler[method])~="function" then
err(info, inputpos, "'"..methodtype.."': '"..method.."' is not a member function of "..tostring(info.handler))
end
return info.handler[method](info.handler, info, ...)
else
assert(false) -- type should have already been checked on read
end
end
-- callfunction() - call a given named function (e.g. "name", "desc") with given arguments
local function callfunction(info, tab, methodtype, ...)
local method = tab[methodtype]
info.arg = tab.arg
info.option = tab
info.type = tab.type
if type(method)=="function" then
return method(info, ...)
else
assert(false) -- type should have already been checked on read
end
end
-- do_final() - do the final step (set/execute) along with validation and confirmation
local function do_final(info, inputpos, tab, methodtype, ...)
if info.validate then
local res = callmethod(info,inputpos,tab,"validate",...)
if type(res)=="string" then
usererr(info, inputpos, "'"..strsub(info.input, inputpos).."' - "..res)
return
end
end
-- console ignores .confirm
callmethod(info,inputpos,tab,methodtype, ...)
end
-- getparam() - used by handle() to retreive and store "handler", "get", "set", etc
local function getparam(info, inputpos, tab, depth, paramname, types, errormsg)
local old,oldat = info[paramname], info[paramname.."_at"]
local val=tab[paramname]
if val~=nil then
if val==false then
val=nil
elseif not types[type(val)] then
err(info, inputpos, "'" .. paramname.. "' - "..errormsg)
end
info[paramname] = val
info[paramname.."_at"] = depth
end
return old,oldat
end
-- iterateargs(tab) - custom iterator that iterates both t.args and t.plugins.*
local dummytable={}
local function iterateargs(tab)
if not tab.plugins then
return pairs(tab.args)
end
local argtabkey,argtab=next(tab.plugins)
local v
return function(_, k)
while argtab do
k,v = next(argtab, k)
if k then return k,v end
if argtab==tab.args then
argtab=nil
else
argtabkey,argtab = next(tab.plugins, argtabkey)
if not argtabkey then
argtab=tab.args
end
end
end
end
end
local function checkhidden(info, inputpos, tab)
if tab.cmdHidden~=nil then
return tab.cmdHidden
end
local hidden = tab.hidden
if type(hidden) == "function" or type(hidden) == "string" then
info.hidden = hidden
hidden = callmethod(info, inputpos, tab, 'hidden')
info.hidden = nil
end
return hidden
end
local function showhelp(info, inputpos, tab, depth, noHead)
if not noHead then
print("|cff33ff99"..info.appName.."|r: Arguments to |cffffff78/"..info[0].."|r "..strsub(info.input,1,inputpos-1)..":")
end
local sortTbl = {} -- [1..n]=name
local refTbl = {} -- [name]=tableref
for k,v in iterateargs(tab) do
if not refTbl[k] then -- a plugin overriding something in .args
tinsert(sortTbl, k)
refTbl[k] = v
end
end
tsort(sortTbl, function(one, two)
local o1 = refTbl[one].order or 100
local o2 = refTbl[two].order or 100
if type(o1) == "function" or type(o1) == "string" then
info.order = o1
info[#info+1] = one
o1 = callmethod(info, inputpos, refTbl[one], "order")
info[#info] = nil
info.order = nil
end
if type(o2) == "function" or type(o1) == "string" then
info.order = o2
info[#info+1] = two
o2 = callmethod(info, inputpos, refTbl[two], "order")
info[#info] = nil
info.order = nil
end
if o1<0 and o2<0 then return o1<o2 end
if o2<0 then return true end
if o1<0 then return false end
if o1==o2 then return tostring(one)<tostring(two) end -- compare names
return o1<o2
end)
for i = 1, #sortTbl do
local k = sortTbl[i]
local v = refTbl[k]
if not checkhidden(info, inputpos, v) then
if v.type ~= "description" and v.type ~= "header" then
-- recursively show all inline groups
local name, desc = v.name, v.desc
if type(name) == "function" then
name = callfunction(info, v, 'name')
end
if type(desc) == "function" then
desc = callfunction(info, v, 'desc')
end
if v.type == "group" and pickfirstset(v.cmdInline, v.inline, false) then
print(" "..(desc or name)..":")
local oldhandler,oldhandler_at = getparam(info, inputpos, v, depth, "handler", handlertypes, handlermsg)
showhelp(info, inputpos, v, depth, true)
info.handler,info.handler_at = oldhandler,oldhandler_at
else
local key = k:gsub(" ", "_")
print(" |cffffff78"..key.."|r - "..(desc or name or ""))
end
end
end
end
end
local function keybindingValidateFunc(text)
if text == nil or text == "NONE" then
return nil
end
text = text:upper()
local shift, ctrl, alt
local modifier
while true do
if text == "-" then
break
end
modifier, text = strsplit('-', text, 2)
if text then
if modifier ~= "SHIFT" and modifier ~= "CTRL" and modifier ~= "ALT" then
return false
end
if modifier == "SHIFT" then
if shift then
return false
end
shift = true
end
if modifier == "CTRL" then
if ctrl then
return false
end
ctrl = true
end
if modifier == "ALT" then
if alt then
return false
end
alt = true
end
else
text = modifier
break
end
end
if text == "" then
return false
end
if not text:find("^F%d+$") and text ~= "CAPSLOCK" and text:len() ~= 1 and (text:byte() < 128 or text:len() > 4) and not _G["KEY_" .. text] then
return false
end
local s = text
if shift then
s = "SHIFT-" .. s
end
if ctrl then
s = "CTRL-" .. s
end
if alt then
s = "ALT-" .. s
end
return s
end
-- handle() - selfrecursing function that processes input->optiontable
-- - depth - starts at 0
-- - retfalse - return false rather than produce error if a match is not found (used by inlined groups)
local function handle(info, inputpos, tab, depth, retfalse)
if not(type(tab)=="table" and type(tab.type)=="string") then err(info,inputpos) end
-------------------------------------------------------------------
-- Grab hold of handler,set,get,func,etc if set (and remember old ones)
-- Note that we do NOT validate if method names are correct at this stage,
-- the handler may change before they're actually used!
local oldhandler,oldhandler_at = getparam(info,inputpos,tab,depth,"handler",handlertypes,handlermsg)
local oldset,oldset_at = getparam(info,inputpos,tab,depth,"set",functypes,funcmsg)
local oldget,oldget_at = getparam(info,inputpos,tab,depth,"get",functypes,funcmsg)
local oldfunc,oldfunc_at = getparam(info,inputpos,tab,depth,"func",functypes,funcmsg)
local oldvalidate,oldvalidate_at = getparam(info,inputpos,tab,depth,"validate",functypes,funcmsg)
--local oldconfirm,oldconfirm_at = getparam(info,inputpos,tab,depth,"confirm",functypes,funcmsg)
-------------------------------------------------------------------
-- Act according to .type of this table
if tab.type=="group" then
------------ group --------------------------------------------
if type(tab.args)~="table" then err(info, inputpos) end
if tab.plugins and type(tab.plugins)~="table" then err(info,inputpos) end
-- grab next arg from input
local _,nextpos,arg = (info.input):find(" *([^ ]+) *", inputpos)
if not arg then
showhelp(info, inputpos, tab, depth)
return
end
nextpos=nextpos+1
-- loop .args and try to find a key with a matching name
for k,v in iterateargs(tab) do
if not(type(k)=="string" and type(v)=="table" and type(v.type)=="string") then err(info,inputpos, "options table child '"..tostring(k).."' is malformed") end
-- is this child an inline group? if so, traverse into it
if v.type=="group" and pickfirstset(v.cmdInline, v.inline, false) then
info[depth+1] = k
if handle(info, inputpos, v, depth+1, true)==false then
info[depth+1] = nil
-- wasn't found in there, but that's ok, we just keep looking down here
else
return -- done, name was found in inline group
end
-- matching name and not a inline group
elseif strlower(arg)==strlower(k:gsub(" ", "_")) then
info[depth+1] = k
return handle(info,nextpos,v,depth+1)
end
end
-- no match
if retfalse then
-- restore old infotable members and return false to indicate failure
info.handler,info.handler_at = oldhandler,oldhandler_at
info.set,info.set_at = oldset,oldset_at
info.get,info.get_at = oldget,oldget_at
info.func,info.func_at = oldfunc,oldfunc_at
info.validate,info.validate_at = oldvalidate,oldvalidate_at
--info.confirm,info.confirm_at = oldconfirm,oldconfirm_at
return false
end
-- couldn't find the command, display error
usererr(info, inputpos, "'"..arg.."' - " .. L["unknown argument"])
return
end
local str = strsub(info.input,inputpos);
if tab.type=="execute" then
------------ execute --------------------------------------------
do_final(info, inputpos, tab, "func")
elseif tab.type=="input" then
------------ input --------------------------------------------
local res = true
if tab.pattern then
if not(type(tab.pattern)=="string") then err(info, inputpos, "'pattern' - expected a string") end
if not strmatch(str, tab.pattern) then
usererr(info, inputpos, "'"..str.."' - " .. L["invalid input"])
return
end
end
do_final(info, inputpos, tab, "set", str)
elseif tab.type=="toggle" then
------------ toggle --------------------------------------------
local b
local str = strtrim(strlower(str))
if str=="" then
b = callmethod(info, inputpos, tab, "get")
if tab.tristate then
--cycle in true, nil, false order
if b then
b = nil
elseif b == nil then
b = false
else
b = true
end
else
b = not b
end
elseif str==L["on"] then
b = true
elseif str==L["off"] then
b = false
elseif tab.tristate and str==L["default"] then
b = nil
else
if tab.tristate then
usererr(info, inputpos, format(L["'%s' - expected 'on', 'off' or 'default', or no argument to toggle."], str))
else
usererr(info, inputpos, format(L["'%s' - expected 'on' or 'off', or no argument to toggle."], str))
end
return
end
do_final(info, inputpos, tab, "set", b)
elseif tab.type=="range" then
------------ range --------------------------------------------
local val = tonumber(str)
if not val then
usererr(info, inputpos, "'"..str.."' - "..L["expected number"])
return
end
if type(info.step)=="number" then
val = val- (val % info.step)
end
if type(info.min)=="number" and val<info.min then
usererr(info, inputpos, val.." - "..format(L["must be equal to or higher than %s"], tostring(info.min)) )
return
end
if type(info.max)=="number" and val>info.max then
usererr(info, inputpos, val.." - "..format(L["must be equal to or lower than %s"], tostring(info.max)) )
return
end
do_final(info, inputpos, tab, "set", val)
elseif tab.type=="select" then
------------ select ------------------------------------
local str = strtrim(strlower(str))
local values = tab.values
if type(values) == "function" or type(values) == "string" then
info.values = values
values = callmethod(info, inputpos, tab, "values")
info.values = nil
end
if str == "" then
local b = callmethod(info, inputpos, tab, "get")
local fmt = "|cffffff78- [%s]|r %s"
local fmt_sel = "|cffffff78- [%s]|r %s |cffff0000*|r"
print(L["Options for |cffffff78"..info[#info].."|r:"])
for k, v in pairs(values) do
if b == k then
print(fmt_sel:format(k, v))
else
print(fmt:format(k, v))
end
end
return
end
local ok
for k,v in pairs(values) do
if strlower(k)==str then
str = k -- overwrite with key (in case of case mismatches)
ok = true
break
end
end
if not ok then
usererr(info, inputpos, "'"..str.."' - "..L["unknown selection"])
return
end
do_final(info, inputpos, tab, "set", str)
elseif tab.type=="multiselect" then
------------ multiselect -------------------------------------------
local str = strtrim(strlower(str))
local values = tab.values
if type(values) == "function" or type(values) == "string" then
info.values = values
values = callmethod(info, inputpos, tab, "values")
info.values = nil
end
if str == "" then
local fmt = "|cffffff78- [%s]|r %s"
local fmt_sel = "|cffffff78- [%s]|r %s |cffff0000*|r"
print(L["Options for |cffffff78"..info[#info].."|r (multiple possible):"])
for k, v in pairs(values) do
if callmethod(info, inputpos, tab, "get", k) then
print(fmt_sel:format(k, v))
else
print(fmt:format(k, v))
end
end
return
end
--build a table of the selections, checking that they exist
--parse for =on =off =default in the process
--table will be key = true for options that should toggle, key = [on|off|default] for options to be set
local sels = {}
for v in str:gmatch("[^ ]+") do
--parse option=on etc
local opt, val = v:match('(.+)=(.+)')
--get option if toggling
if not opt then
opt = v
end
--check that the opt is valid
local ok
for k,v in pairs(values) do
if strlower(k)==opt then
opt = k -- overwrite with key (in case of case mismatches)
ok = true
break
end
end
if not ok then
usererr(info, inputpos, "'"..opt.."' - "..L["unknown selection"])
return
end
--check that if val was supplied it is valid
if val then
if val == L["on"] or val == L["off"] or (tab.tristate and val == L["default"]) then
--val is valid insert it
sels[opt] = val
else
if tab.tristate then
usererr(info, inputpos, format(L["'%s' '%s' - expected 'on', 'off' or 'default', or no argument to toggle."], v, val))
else
usererr(info, inputpos, format(L["'%s' '%s' - expected 'on' or 'off', or no argument to toggle."], v, val))
end
return
end
else
-- no val supplied, toggle
sels[opt] = true
end
end
for opt, val in pairs(sels) do
local newval
if (val == true) then
--toggle the option
local b = callmethod(info, inputpos, tab, "get", opt)
if tab.tristate then
--cycle in true, nil, false order
if b then
b = nil
elseif b == nil then
b = false
else
b = true
end
else
b = not b
end
newval = b
else
--set the option as specified
if val==L["on"] then
newval = true
elseif val==L["off"] then
newval = false
elseif val==L["default"] then
newval = nil
end
end
do_final(info, inputpos, tab, "set", opt, newval)
end
elseif tab.type=="color" then
------------ color --------------------------------------------
local str = strtrim(strlower(str))
if str == "" then
--TODO: Show current value
return
end
local r, g, b, a
local hasAlpha = tab.hasAlpha
if type(hasAlpha) == "function" or type(hasAlpha) == "string" then
info.hasAlpha = hasAlpha
hasAlpha = callmethod(info, inputpos, tab, 'hasAlpha')
info.hasAlpha = nil
end
if hasAlpha then
if str:len() == 8 and str:find("^%x*$") then
--parse a hex string
r,g,b,a = tonumber(str:sub(1, 2), 16) / 255, tonumber(str:sub(3, 4), 16) / 255, tonumber(str:sub(5, 6), 16) / 255, tonumber(str:sub(7, 8), 16) / 255
else
--parse seperate values
r,g,b,a = str:match("^([%d%.]+) ([%d%.]+) ([%d%.]+) ([%d%.]+)$")
r,g,b,a = tonumber(r), tonumber(g), tonumber(b), tonumber(a)
end
if not (r and g and b and a) then
usererr(info, inputpos, format(L["'%s' - expected 'RRGGBBAA' or 'r g b a'."], str))
return
end
if r >= 0.0 and r <= 1.0 and g >= 0.0 and g <= 1.0 and b >= 0.0 and b <= 1.0 and a >= 0.0 and a <= 1.0 then
--values are valid
elseif r >= 0 and r <= 255 and g >= 0 and g <= 255 and b >= 0 and b <= 255 and a >= 0 and a <= 255 then
--values are valid 0..255, convert to 0..1
r = r / 255
g = g / 255
b = b / 255
a = a / 255
else
--values are invalid
usererr(info, inputpos, format(L["'%s' - values must all be either in the range 0..1 or 0..255."], str))
end
else
a = 1.0
if str:len() == 6 and str:find("^%x*$") then
--parse a hex string
r,g,b = tonumber(str:sub(1, 2), 16) / 255, tonumber(str:sub(3, 4), 16) / 255, tonumber(str:sub(5, 6), 16) / 255
else
--parse seperate values
r,g,b = str:match("^([%d%.]+) ([%d%.]+) ([%d%.]+)$")
r,g,b = tonumber(r), tonumber(g), tonumber(b)
end
if not (r and g and b) then
usererr(info, inputpos, format(L["'%s' - expected 'RRGGBB' or 'r g b'."], str))
return
end
if r >= 0.0 and r <= 1.0 and g >= 0.0 and g <= 1.0 and b >= 0.0 and b <= 1.0 then
--values are valid
elseif r >= 0 and r <= 255 and g >= 0 and g <= 255 and b >= 0 and b <= 255 then
--values are valid 0..255, convert to 0..1
r = r / 255
g = g / 255
b = b / 255
else
--values are invalid
usererr(info, inputpos, format(L["'%s' - values must all be either in the range 0-1 or 0-255."], str))
end
end
do_final(info, inputpos, tab, "set", r,g,b,a)
elseif tab.type=="keybinding" then
------------ keybinding --------------------------------------------
local str = strtrim(strlower(str))
if str == "" then
--TODO: Show current value
return
end
local value = keybindingValidateFunc(str:upper())
if value == false then
usererr(info, inputpos, format(L["'%s' - Invalid Keybinding."], str))
return
end
do_final(info, inputpos, tab, "set", value)
elseif tab.type=="description" then
------------ description --------------------
-- ignore description, GUI config only
else
err(info, inputpos, "unknown options table item type '"..tostring(tab.type).."'")
end
end
--- Handle the chat command.
-- This is usually called from a chat command handler to parse the command input as operations on an aceoptions table.\\
-- AceConfigCmd uses this function internally when a slash command is registered with `:CreateChatCommand`
-- @param slashcmd The slash command WITHOUT leading slash (only used for error output)
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param input The commandline input (as given by the WoW handler, i.e. without the command itself)
-- @usage
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceConsole-3.0")
-- -- Use AceConsole-3.0 to register a Chat Command
-- MyAddon:RegisterChatCommand("mychat", "ChatCommand")
--
-- -- Show the GUI if no input is supplied, otherwise handle the chat input.
-- function MyAddon:ChatCommand(input)
-- -- Assuming "MyOptions" is the appName of a valid options table
-- if not input or input:trim() == "" then
-- LibStub("AceConfigDialog-3.0"):Open("MyOptions")
-- else
-- LibStub("AceConfigCmd-3.0").HandleCommand(MyAddon, "mychat", "MyOptions", input)
-- end
-- end
function AceConfigCmd:HandleCommand(slashcmd, appName, input)
local optgetter = cfgreg:GetOptionsTable(appName)
if not optgetter then
error([[Usage: HandleCommand("slashcmd", "appName", "input"): 'appName' - no options table "]]..tostring(appName)..[[" has been registered]], 2)
end
local options = assert( optgetter("cmd", MAJOR) )
local info = { -- Don't try to recycle this, it gets handed off to callbacks and whatnot
[0] = slashcmd,
appName = appName,
options = options,
input = input,
self = self,
handler = self,
uiType = "cmd",
uiName = MAJOR,
}
handle(info, 1, options, 0) -- (info, inputpos, table, depth)
end
--- Utility function to create a slash command handler.
-- Also registers tab completion with AceTab
-- @param slashcmd The slash command WITHOUT leading slash (only used for error output)
-- @param appName The application name as given to `:RegisterOptionsTable()`
function AceConfigCmd:CreateChatCommand(slashcmd, appName)
if not AceConsole then
AceConsole = LibStub(AceConsoleName)
end
if AceConsole.RegisterChatCommand(self, slashcmd, function(input)
AceConfigCmd.HandleCommand(self, slashcmd, appName, input) -- upgradable
end,
true) then -- succesfully registered so lets get the command -> app table in
commands[slashcmd] = appName
end
end
--- Utility function that returns the options table that belongs to a slashcommand.
-- Designed to be used for the AceTab interface.
-- @param slashcmd The slash command WITHOUT leading slash (only used for error output)
-- @return The options table associated with the slash command (or nil if the slash command was not registered)
function AceConfigCmd:GetChatCommandOptions(slashcmd)
return commands[slashcmd]
end
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceConfigCmd-3.0.lua"/>
</Ui>
File diff suppressed because it is too large Load Diff
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceConfigDialog-3.0.lua"/>
</Ui>
@@ -1,371 +0,0 @@
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules.\\
-- Options tables can be registered as raw tables, OR as function refs that return a table.\\
-- Such functions receive three arguments: "uiType", "uiName", "appName". \\
-- * Valid **uiTypes**: "cmd", "dropdown", "dialog". This is verified by the library at call time. \\
-- * The **uiName** field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.\\
-- * The **appName** field is the options table name as given at registration time \\
--
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName".
-- @class file
-- @name AceConfigRegistry-3.0
-- @release $Id: AceConfigRegistry-3.0.lua 1207 2019-06-23 12:08:33Z nevcairiel $
local CallbackHandler = LibStub("CallbackHandler-1.0")
local MAJOR, MINOR = "AceConfigRegistry-3.0", 20
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigRegistry then return end
AceConfigRegistry.tables = AceConfigRegistry.tables or {}
if not AceConfigRegistry.callbacks then
AceConfigRegistry.callbacks = CallbackHandler:New(AceConfigRegistry)
end
-- Lua APIs
local tinsert, tconcat = table.insert, table.concat
local strfind, strmatch = string.find, string.match
local type, tostring, select, pairs = type, tostring, select, pairs
local error, assert = error, assert
-----------------------------------------------------------------------
-- Validating options table consistency:
AceConfigRegistry.validated = {
-- list of options table names ran through :ValidateOptionsTable automatically.
-- CLEARED ON PURPOSE, since newer versions may have newer validators
cmd = {},
dropdown = {},
dialog = {},
}
local function err(msg, errlvl, ...)
local t = {}
for i=select("#",...),1,-1 do
tinsert(t, (select(i, ...)))
end
error(MAJOR..":ValidateOptionsTable(): "..tconcat(t,".")..msg, errlvl+2)
end
local isstring={["string"]=true, _="string"}
local isstringfunc={["string"]=true,["function"]=true, _="string or funcref"}
local istable={["table"]=true, _="table"}
local ismethodtable={["table"]=true,["string"]=true,["function"]=true, _="methodname, funcref or table"}
local optstring={["nil"]=true,["string"]=true, _="string"}
local optstringfunc={["nil"]=true,["string"]=true,["function"]=true, _="string or funcref"}
local optstringnumberfunc={["nil"]=true,["string"]=true,["number"]=true,["function"]=true, _="string, number or funcref"}
local optnumber={["nil"]=true,["number"]=true, _="number"}
local optmethodfalse={["nil"]=true,["string"]=true,["function"]=true,["boolean"]={[false]=true}, _="methodname, funcref or false"}
local optmethodnumber={["nil"]=true,["string"]=true,["function"]=true,["number"]=true, _="methodname, funcref or number"}
local optmethodtable={["nil"]=true,["string"]=true,["function"]=true,["table"]=true, _="methodname, funcref or table"}
local optmethodbool={["nil"]=true,["string"]=true,["function"]=true,["boolean"]=true, _="methodname, funcref or boolean"}
local opttable={["nil"]=true,["table"]=true, _="table"}
local optbool={["nil"]=true,["boolean"]=true, _="boolean"}
local optboolnumber={["nil"]=true,["boolean"]=true,["number"]=true, _="boolean or number"}
local optstringnumber={["nil"]=true,["string"]=true,["number"]=true, _="string or number"}
local basekeys={
type=isstring,
name=isstringfunc,
desc=optstringfunc,
descStyle=optstring,
order=optmethodnumber,
validate=optmethodfalse,
confirm=optmethodbool,
confirmText=optstring,
disabled=optmethodbool,
hidden=optmethodbool,
guiHidden=optmethodbool,
dialogHidden=optmethodbool,
dropdownHidden=optmethodbool,
cmdHidden=optmethodbool,
icon=optstringnumberfunc,
iconCoords=optmethodtable,
handler=opttable,
get=optmethodfalse,
set=optmethodfalse,
func=optmethodfalse,
arg={["*"]=true},
width=optstringnumber,
}
local typedkeys={
header={
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
description={
image=optstringnumberfunc,
imageCoords=optmethodtable,
imageHeight=optnumber,
imageWidth=optnumber,
fontSize=optstringfunc,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
group={
args=istable,
plugins=opttable,
inline=optbool,
cmdInline=optbool,
guiInline=optbool,
dropdownInline=optbool,
dialogInline=optbool,
childGroups=optstring,
},
execute={
image=optstringnumberfunc,
imageCoords=optmethodtable,
imageHeight=optnumber,
imageWidth=optnumber,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
input={
pattern=optstring,
usage=optstring,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
multiline=optboolnumber,
},
toggle={
tristate=optbool,
image=optstringnumberfunc,
imageCoords=optmethodtable,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
tristate={
},
range={
min=optnumber,
softMin=optnumber,
max=optnumber,
softMax=optnumber,
step=optnumber,
bigStep=optnumber,
isPercent=optbool,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
select={
values=ismethodtable,
sorting=optmethodtable,
style={
["nil"]=true,
["string"]={dropdown=true,radio=true},
_="string: 'dropdown' or 'radio'"
},
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
itemControl=optstring,
},
multiselect={
values=ismethodtable,
style=optstring,
tristate=optbool,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
color={
hasAlpha=optmethodbool,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
keybinding={
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
}
local function validateKey(k,errlvl,...)
errlvl=(errlvl or 0)+1
if type(k)~="string" then
err("["..tostring(k).."] - key is not a string", errlvl,...)
end
if strfind(k, "[%c\127]") then
err("["..tostring(k).."] - key name contained control characters", errlvl,...)
end
end
local function validateVal(v, oktypes, errlvl,...)
errlvl=(errlvl or 0)+1
local isok=oktypes[type(v)] or oktypes["*"]
if not isok then
err(": expected a "..oktypes._..", got '"..tostring(v).."'", errlvl,...)
end
if type(isok)=="table" then -- isok was a table containing specific values to be tested for!
if not isok[v] then
err(": did not expect "..type(v).." value '"..tostring(v).."'", errlvl,...)
end
end
end
local function validate(options,errlvl,...)
errlvl=(errlvl or 0)+1
-- basic consistency
if type(options)~="table" then
err(": expected a table, got a "..type(options), errlvl,...)
end
if type(options.type)~="string" then
err(".type: expected a string, got a "..type(options.type), errlvl,...)
end
-- get type and 'typedkeys' member
local tk = typedkeys[options.type]
if not tk then
err(".type: unknown type '"..options.type.."'", errlvl,...)
end
-- make sure that all options[] are known parameters
for k,v in pairs(options) do
if not (tk[k] or basekeys[k]) then
err(": unknown parameter", errlvl,tostring(k),...)
end
end
-- verify that required params are there, and that everything is the right type
for k,oktypes in pairs(basekeys) do
validateVal(options[k], oktypes, errlvl,k,...)
end
for k,oktypes in pairs(tk) do
validateVal(options[k], oktypes, errlvl,k,...)
end
-- extra logic for groups
if options.type=="group" then
for k,v in pairs(options.args) do
validateKey(k,errlvl,"args",...)
validate(v, errlvl,k,"args",...)
end
if options.plugins then
for plugname,plugin in pairs(options.plugins) do
if type(plugin)~="table" then
err(": expected a table, got '"..tostring(plugin).."'", errlvl,tostring(plugname),"plugins",...)
end
for k,v in pairs(plugin) do
validateKey(k,errlvl,tostring(plugname),"plugins",...)
validate(v, errlvl,k,tostring(plugname),"plugins",...)
end
end
end
end
end
--- Validates basic structure and integrity of an options table \\
-- Does NOT verify that get/set etc actually exist, since they can be defined at any depth
-- @param options The table to be validated
-- @param name The name of the table to be validated (shown in any error message)
-- @param errlvl (optional number) error level offset, default 0 (=errors point to the function calling :ValidateOptionsTable)
function AceConfigRegistry:ValidateOptionsTable(options,name,errlvl)
errlvl=(errlvl or 0)+1
name = name or "Optionstable"
if not options.name then
options.name=name -- bit of a hack, the root level doesn't really need a .name :-/
end
validate(options,errlvl,name)
end
--- Fires a "ConfigTableChange" callback for those listening in on it, allowing config GUIs to refresh.
-- You should call this function if your options table changed from any outside event, like a game event
-- or a timer.
-- @param appName The application name as given to `:RegisterOptionsTable()`
function AceConfigRegistry:NotifyChange(appName)
if not AceConfigRegistry.tables[appName] then return end
AceConfigRegistry.callbacks:Fire("ConfigTableChange", appName)
end
-- -------------------------------------------------------------------
-- Registering and retreiving options tables:
-- validateGetterArgs: helper function for :GetOptionsTable (or, rather, the getter functions returned by it)
local function validateGetterArgs(uiType, uiName, errlvl)
errlvl=(errlvl or 0)+2
if uiType~="cmd" and uiType~="dropdown" and uiType~="dialog" then
error(MAJOR..": Requesting options table: 'uiType' - invalid configuration UI type, expected 'cmd', 'dropdown' or 'dialog'", errlvl)
end
if not strmatch(uiName, "[A-Za-z]%-[0-9]") then -- Expecting e.g. "MyLib-1.2"
error(MAJOR..": Requesting options table: 'uiName' - badly formatted or missing version number. Expected e.g. 'MyLib-1.2'", errlvl)
end
end
--- Register an options table with the config registry.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param options The options table, OR a function reference that generates it on demand. \\
-- See the top of the page for info on arguments passed to such functions.
-- @param skipValidation Skip options table validation (primarily useful for extremely huge options, with a noticeable slowdown)
function AceConfigRegistry:RegisterOptionsTable(appName, options, skipValidation)
if type(options)=="table" then
if options.type~="group" then -- quick sanity checker
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - missing type='group' member in root group", 2)
end
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl)
errlvl=(errlvl or 0)+1
validateGetterArgs(uiType, uiName, errlvl)
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then
AceConfigRegistry:ValidateOptionsTable(options, appName, errlvl) -- upgradable
AceConfigRegistry.validated[uiType][appName] = true
end
return options
end
elseif type(options)=="function" then
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl)
errlvl=(errlvl or 0)+1
validateGetterArgs(uiType, uiName, errlvl)
local tab = assert(options(uiType, uiName, appName))
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable
AceConfigRegistry.validated[uiType][appName] = true
end
return tab
end
else
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - expected table or function reference", 2)
end
end
--- Returns an iterator of ["appName"]=funcref pairs
function AceConfigRegistry:IterateOptionsTables()
return pairs(AceConfigRegistry.tables)
end
--- Query the registry for a specific options table.
-- If only appName is given, a function is returned which you
-- can call with (uiType,uiName) to get the table.\\
-- If uiType&uiName are given, the table is returned.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param uiType The type of UI to get the table for, one of "cmd", "dropdown", "dialog"
-- @param uiName The name of the library/addon querying for the table, e.g. "MyLib-1.0"
function AceConfigRegistry:GetOptionsTable(appName, uiType, uiName)
local f = AceConfigRegistry.tables[appName]
if not f then
return nil
end
if uiType then
return f(uiType,uiName,1) -- get the table for us
else
return f -- return the function
end
end
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceConfigRegistry-3.0.lua"/>
</Ui>
-250
View File
@@ -1,250 +0,0 @@
--- **AceConsole-3.0** provides registration facilities for slash commands.
-- You can register slash commands to your custom functions and use the `GetArgs` function to parse them
-- to your addons individual needs.
--
-- **AceConsole-3.0** can be embeded into your addon, either explicitly by calling AceConsole:Embed(MyAddon) or by
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
-- and can be accessed directly, without having to explicitly call AceConsole itself.\\
-- It is recommended to embed AceConsole, otherwise you'll have to specify a custom `self` on all calls you
-- make into AceConsole.
-- @class file
-- @name AceConsole-3.0
-- @release $Id: AceConsole-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
local MAJOR,MINOR = "AceConsole-3.0", 7
local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConsole then return end -- No upgrade needed
AceConsole.embeds = AceConsole.embeds or {} -- table containing objects AceConsole is embedded in.
AceConsole.commands = AceConsole.commands or {} -- table containing commands registered
AceConsole.weakcommands = AceConsole.weakcommands or {} -- table containing self, command => func references for weak commands that don't persist through enable/disable
-- Lua APIs
local tconcat, tostring, select = table.concat, tostring, select
local type, pairs, error = type, pairs, error
local format, strfind, strsub = string.format, string.find, string.sub
local max = math.max
-- WoW APIs
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: DEFAULT_CHAT_FRAME, SlashCmdList, hash_SlashCmdList
local tmp={}
local function Print(self,frame,...)
local n=0
if self ~= AceConsole then
n=n+1
tmp[n] = "|cff33ff99"..tostring( self ).."|r:"
end
for i=1, select("#", ...) do
n=n+1
tmp[n] = tostring(select(i, ...))
end
frame:AddMessage( tconcat(tmp," ",1,n) )
end
--- Print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function)
-- @paramsig [chatframe ,] ...
-- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function)
-- @param ... List of any values to be printed
function AceConsole:Print(...)
local frame = ...
if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member?
return Print(self, frame, select(2,...))
else
return Print(self, DEFAULT_CHAT_FRAME, ...)
end
end
--- Formatted (using format()) print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function)
-- @paramsig [chatframe ,] "format"[, ...]
-- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function)
-- @param format Format string - same syntax as standard Lua format()
-- @param ... Arguments to the format string
function AceConsole:Printf(...)
local frame = ...
if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member?
return Print(self, frame, format(select(2,...)))
else
return Print(self, DEFAULT_CHAT_FRAME, format(...))
end
end
--- Register a simple chat command
-- @param command Chat command to be registered WITHOUT leading "/"
-- @param func Function to call when the slash command is being used (funcref or methodname)
-- @param persist if false, the command will be soft disabled/enabled when aceconsole is used as a mixin (default: true)
function AceConsole:RegisterChatCommand( command, func, persist )
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist ]): 'command' - expected a string]], 2) end
if persist==nil then persist=true end -- I'd rather have my addon's "/addon enable" around if the author screws up. Having some extra slash regged when it shouldnt be isn't as destructive. True is a better default. /Mikk
local name = "ACECONSOLE_"..command:upper()
if type( func ) == "string" then
SlashCmdList[name] = function(input, editBox)
self[func](self, input, editBox)
end
else
SlashCmdList[name] = func
end
_G["SLASH_"..name.."1"] = "/"..command:lower()
AceConsole.commands[command] = name
-- non-persisting commands are registered for enabling disabling
if not persist then
if not AceConsole.weakcommands[self] then AceConsole.weakcommands[self] = {} end
AceConsole.weakcommands[self][command] = func
end
return true
end
--- Unregister a chatcommand
-- @param command Chat command to be unregistered WITHOUT leading "/"
function AceConsole:UnregisterChatCommand( command )
local name = AceConsole.commands[command]
if name then
SlashCmdList[name] = nil
_G["SLASH_" .. name .. "1"] = nil
hash_SlashCmdList["/" .. command:upper()] = nil
AceConsole.commands[command] = nil
end
end
--- Get an iterator over all Chat Commands registered with AceConsole
-- @return Iterator (pairs) over all commands
function AceConsole:IterateChatCommands() return pairs(AceConsole.commands) end
local function nils(n, ...)
if n>1 then
return nil, nils(n-1, ...)
elseif n==1 then
return nil, ...
else
return ...
end
end
--- Retreive one or more space-separated arguments from a string.
-- Treats quoted strings and itemlinks as non-spaced.
-- @param str The raw argument string
-- @param numargs How many arguments to get (default 1)
-- @param startpos Where in the string to start scanning (default 1)
-- @return Returns arg1, arg2, ..., nextposition\\
-- Missing arguments will be returned as nils. 'nextposition' is returned as 1e9 at the end of the string.
function AceConsole:GetArgs(str, numargs, startpos)
numargs = numargs or 1
startpos = max(startpos or 1, 1)
local pos=startpos
-- find start of new arg
pos = strfind(str, "[^ ]", pos)
if not pos then -- whoops, end of string
return nils(numargs, 1e9)
end
if numargs<1 then
return pos
end
-- quoted or space separated? find out which pattern to use
local delim_or_pipe
local ch = strsub(str, pos, pos)
if ch=='"' then
pos = pos + 1
delim_or_pipe='([|"])'
elseif ch=="'" then
pos = pos + 1
delim_or_pipe="([|'])"
else
delim_or_pipe="([| ])"
end
startpos = pos
while true do
-- find delimiter or hyperlink
local ch,_
pos,_,ch = strfind(str, delim_or_pipe, pos)
if not pos then break end
if ch=="|" then
-- some kind of escape
if strsub(str,pos,pos+1)=="|H" then
-- It's a |H....|hhyper link!|h
pos=strfind(str, "|h", pos+2) -- first |h
if not pos then break end
pos=strfind(str, "|h", pos+2) -- second |h
if not pos then break end
elseif strsub(str,pos, pos+1) == "|T" then
-- It's a |T....|t texture
pos=strfind(str, "|t", pos+2)
if not pos then break end
end
pos=pos+2 -- skip past this escape (last |h if it was a hyperlink)
else
-- found delimiter, done with this arg
return strsub(str, startpos, pos-1), AceConsole:GetArgs(str, numargs-1, pos+1)
end
end
-- search aborted, we hit end of string. return it all as one argument. (yes, even if it's an unterminated quote or hyperlink)
return strsub(str, startpos), nils(numargs-1, 1e9)
end
--- embedding and embed handling
local mixins = {
"Print",
"Printf",
"RegisterChatCommand",
"UnregisterChatCommand",
"GetArgs",
}
-- Embeds AceConsole into the target object making the functions from the mixins list available on target:..
-- @param target target object to embed AceBucket in
function AceConsole:Embed( target )
for k, v in pairs( mixins ) do
target[v] = self[v]
end
self.embeds[target] = true
return target
end
function AceConsole:OnEmbedEnable( target )
if AceConsole.weakcommands[target] then
for command, func in pairs( AceConsole.weakcommands[target] ) do
target:RegisterChatCommand( command, func, false, true ) -- nonpersisting and silent registry
end
end
end
function AceConsole:OnEmbedDisable( target )
if AceConsole.weakcommands[target] then
for command, func in pairs( AceConsole.weakcommands[target] ) do
target:UnregisterChatCommand( command ) -- TODO: this could potentially unregister a command from another application in case of command conflicts. Do we care?
end
end
end
for addon in pairs(AceConsole.embeds) do
AceConsole:Embed(addon)
end
-4
View File
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceConsole-3.0.lua"/>
</Ui>
-744
View File
@@ -1,744 +0,0 @@
--- **AceDB-3.0** manages the SavedVariables of your addon.
-- It offers profile management, smart defaults and namespaces for modules.\\
-- Data can be saved in different data-types, depending on its intended usage.
-- The most common data-type is the `profile` type, which allows the user to choose
-- the active profile, and manage the profiles of all of his characters.\\
-- The following data types are available:
-- * **char** Character-specific data. Every character has its own database.
-- * **realm** Realm-specific data. All of the players characters on the same realm share this database.
-- * **class** Class-specific data. All of the players characters of the same class share this database.
-- * **race** Race-specific data. All of the players characters of the same race share this database.
-- * **faction** Faction-specific data. All of the players characters of the same faction share this database.
-- * **factionrealm** Faction and realm specific data. All of the players characters on the same realm and of the same faction share this database.
-- * **locale** Locale specific data, based on the locale of the players game client.
-- * **global** Global Data. All characters on the same account share this database.
-- * **profile** Profile-specific data. All characters using the same profile share this database. The user can control which profile should be used.
--
-- Creating a new Database using the `:New` function will return a new DBObject. A database will inherit all functions
-- of the DBObjectLib listed here. \\
-- If you create a new namespaced child-database (`:RegisterNamespace`), you'll get a DBObject as well, but note
-- that the child-databases cannot individually change their profile, and are linked to their parents profile - and because of that,
-- the profile related APIs are not available. Only `:RegisterDefaults` and `:ResetProfile` are available on child-databases.
--
-- For more details on how to use AceDB-3.0, see the [[AceDB-3.0 Tutorial]].
--
-- You may also be interested in [[libdualspec-1-0|LibDualSpec-1.0]] to do profile switching automatically when switching specs.
--
-- @usage
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("DBExample")
--
-- -- declare defaults to be used in the DB
-- local defaults = {
-- profile = {
-- setting = true,
-- }
-- }
--
-- function MyAddon:OnInitialize()
-- -- Assuming the .toc says ## SavedVariables: MyAddonDB
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
-- end
-- @class file
-- @name AceDB-3.0.lua
-- @release $Id: AceDB-3.0.lua 1217 2019-07-11 03:06:18Z funkydude $
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 27
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
if not AceDB then return end -- No upgrade needed
-- Lua APIs
local type, pairs, next, error = type, pairs, next, error
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
-- WoW APIs
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: LibStub
AceDB.db_registry = AceDB.db_registry or {}
AceDB.frame = AceDB.frame or CreateFrame("Frame")
local CallbackHandler
local CallbackDummy = { Fire = function() end }
local DBObjectLib = {}
--[[-------------------------------------------------------------------------
AceDB Utility Functions
---------------------------------------------------------------------------]]
-- Simple shallow copy for copying defaults
local function copyTable(src, dest)
if type(dest) ~= "table" then dest = {} end
if type(src) == "table" then
for k,v in pairs(src) do
if type(v) == "table" then
-- try to index the key first so that the metatable creates the defaults, if set, and use that table
v = copyTable(v, dest[k])
end
dest[k] = v
end
end
return dest
end
-- Called to add defaults to a section of the database
--
-- When a ["*"] default section is indexed with a new key, a table is returned
-- and set in the host table. These tables must be cleaned up by removeDefaults
-- in order to ensure we don't write empty default tables.
local function copyDefaults(dest, src)
-- this happens if some value in the SV overwrites our default value with a non-table
--if type(dest) ~= "table" then return end
for k, v in pairs(src) do
if k == "*" or k == "**" then
if type(v) == "table" then
-- This is a metatable used for table defaults
local mt = {
-- This handles the lookup and creation of new subtables
__index = function(t,k)
if k == nil then return nil end
local tbl = {}
copyDefaults(tbl, v)
rawset(t, k, tbl)
return tbl
end,
}
setmetatable(dest, mt)
-- handle already existing tables in the SV
for dk, dv in pairs(dest) do
if not rawget(src, dk) and type(dv) == "table" then
copyDefaults(dv, v)
end
end
else
-- Values are not tables, so this is just a simple return
local mt = {__index = function(t,k) return k~=nil and v or nil end}
setmetatable(dest, mt)
end
elseif type(v) == "table" then
if not rawget(dest, k) then rawset(dest, k, {}) end
if type(dest[k]) == "table" then
copyDefaults(dest[k], v)
if src['**'] then
copyDefaults(dest[k], src['**'])
end
end
else
if rawget(dest, k) == nil then
rawset(dest, k, v)
end
end
end
end
-- Called to remove all defaults in the default table from the database
local function removeDefaults(db, defaults, blocker)
-- remove all metatables from the db, so we don't accidentally create new sub-tables through them
setmetatable(db, nil)
-- loop through the defaults and remove their content
for k,v in pairs(defaults) do
if k == "*" or k == "**" then
if type(v) == "table" then
-- Loop through all the actual k,v pairs and remove
for key, value in pairs(db) do
if type(value) == "table" then
-- if the key was not explicitly specified in the defaults table, just strip everything from * and ** tables
if defaults[key] == nil and (not blocker or blocker[key] == nil) then
removeDefaults(value, v)
-- if the table is empty afterwards, remove it
if next(value) == nil then
db[key] = nil
end
-- if it was specified, only strip ** content, but block values which were set in the key table
elseif k == "**" then
removeDefaults(value, v, defaults[key])
end
end
end
elseif k == "*" then
-- check for non-table default
for key, value in pairs(db) do
if defaults[key] == nil and v == value then
db[key] = nil
end
end
end
elseif type(v) == "table" and type(db[k]) == "table" then
-- if a blocker was set, dive into it, to allow multi-level defaults
removeDefaults(db[k], v, blocker and blocker[k])
if next(db[k]) == nil then
db[k] = nil
end
else
-- check if the current value matches the default, and that its not blocked by another defaults table
if db[k] == defaults[k] and (not blocker or blocker[k] == nil) then
db[k] = nil
end
end
end
end
-- This is called when a table section is first accessed, to set up the defaults
local function initSection(db, section, svstore, key, defaults)
local sv = rawget(db, "sv")
local tableCreated
if not sv[svstore] then sv[svstore] = {} end
if not sv[svstore][key] then
sv[svstore][key] = {}
tableCreated = true
end
local tbl = sv[svstore][key]
if defaults then
copyDefaults(tbl, defaults)
end
rawset(db, section, tbl)
return tableCreated, tbl
end
-- Metatable to handle the dynamic creation of sections and copying of sections.
local dbmt = {
__index = function(t, section)
local keys = rawget(t, "keys")
local key = keys[section]
if key then
local defaultTbl = rawget(t, "defaults")
local defaults = defaultTbl and defaultTbl[section]
if section == "profile" then
local new = initSection(t, section, "profiles", key, defaults)
if new then
-- Callback: OnNewProfile, database, newProfileKey
t.callbacks:Fire("OnNewProfile", t, key)
end
elseif section == "profiles" then
local sv = rawget(t, "sv")
if not sv.profiles then sv.profiles = {} end
rawset(t, "profiles", sv.profiles)
elseif section == "global" then
local sv = rawget(t, "sv")
if not sv.global then sv.global = {} end
if defaults then
copyDefaults(sv.global, defaults)
end
rawset(t, section, sv.global)
else
initSection(t, section, section, key, defaults)
end
end
return rawget(t, section)
end
}
local function validateDefaults(defaults, keyTbl, offset)
if not defaults then return end
offset = offset or 0
for k in pairs(defaults) do
if not keyTbl[k] or k == "profiles" then
error(("Usage: AceDBObject:RegisterDefaults(defaults): '%s' is not a valid datatype."):format(k), 3 + offset)
end
end
end
local preserve_keys = {
["callbacks"] = true,
["RegisterCallback"] = true,
["UnregisterCallback"] = true,
["UnregisterAllCallbacks"] = true,
["children"] = true,
}
local realmKey = GetRealmName()
local charKey = UnitName("player") .. " - " .. realmKey
local _, classKey = UnitClass("player")
local _, raceKey = UnitRace("player")
local factionKey = UnitFactionGroup("player")
local factionrealmKey = factionKey .. " - " .. realmKey
local localeKey = GetLocale():lower()
local regionTable = { "US", "KR", "EU", "TW", "CN" }
local regionKey = regionTable[GetCurrentRegion()]
local factionrealmregionKey = factionrealmKey .. " - " .. regionKey
-- Actual database initialization function
local function initdb(sv, defaults, defaultProfile, olddb, parent)
-- Generate the database keys for each section
-- map "true" to our "Default" profile
if defaultProfile == true then defaultProfile = "Default" end
local profileKey
if not parent then
-- Make a container for profile keys
if not sv.profileKeys then sv.profileKeys = {} end
-- Try to get the profile selected from the char db
profileKey = sv.profileKeys[charKey] or defaultProfile or charKey
-- save the selected profile for later
sv.profileKeys[charKey] = profileKey
else
-- Use the profile of the parents DB
profileKey = parent.keys.profile or defaultProfile or charKey
-- clear the profileKeys in the DB, namespaces don't need to store them
sv.profileKeys = nil
end
-- This table contains keys that enable the dynamic creation
-- of each section of the table. The 'global' and 'profiles'
-- have a key of true, since they are handled in a special case
local keyTbl= {
["char"] = charKey,
["realm"] = realmKey,
["class"] = classKey,
["race"] = raceKey,
["faction"] = factionKey,
["factionrealm"] = factionrealmKey,
["factionrealmregion"] = factionrealmregionKey,
["profile"] = profileKey,
["locale"] = localeKey,
["global"] = true,
["profiles"] = true,
}
validateDefaults(defaults, keyTbl, 1)
-- This allows us to use this function to reset an entire database
-- Clear out the old database
if olddb then
for k,v in pairs(olddb) do if not preserve_keys[k] then olddb[k] = nil end end
end
-- Give this database the metatable so it initializes dynamically
local db = setmetatable(olddb or {}, dbmt)
if not rawget(db, "callbacks") then
-- try to load CallbackHandler-1.0 if it loaded after our library
if not CallbackHandler then CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0", true) end
db.callbacks = CallbackHandler and CallbackHandler:New(db) or CallbackDummy
end
-- Copy methods locally into the database object, to avoid hitting
-- the metatable when calling methods
if not parent then
for name, func in pairs(DBObjectLib) do
db[name] = func
end
else
-- hack this one in
db.RegisterDefaults = DBObjectLib.RegisterDefaults
db.ResetProfile = DBObjectLib.ResetProfile
end
-- Set some properties in the database object
db.profiles = sv.profiles
db.keys = keyTbl
db.sv = sv
--db.sv_name = name
db.defaults = defaults
db.parent = parent
-- store the DB in the registry
AceDB.db_registry[db] = true
return db
end
-- handle PLAYER_LOGOUT
-- strip all defaults from all databases
-- and cleans up empty sections
local function logoutHandler(frame, event)
if event == "PLAYER_LOGOUT" then
for db in pairs(AceDB.db_registry) do
db.callbacks:Fire("OnDatabaseShutdown", db)
db:RegisterDefaults(nil)
-- cleanup sections that are empty without defaults
local sv = rawget(db, "sv")
for section in pairs(db.keys) do
if rawget(sv, section) then
-- global is special, all other sections have sub-entrys
-- also don't delete empty profiles on main dbs, only on namespaces
if section ~= "global" and (section ~= "profiles" or rawget(db, "parent")) then
for key in pairs(sv[section]) do
if not next(sv[section][key]) then
sv[section][key] = nil
end
end
end
if not next(sv[section]) then
sv[section] = nil
end
end
end
end
end
end
AceDB.frame:RegisterEvent("PLAYER_LOGOUT")
AceDB.frame:SetScript("OnEvent", logoutHandler)
--[[-------------------------------------------------------------------------
AceDB Object Method Definitions
---------------------------------------------------------------------------]]
--- Sets the defaults table for the given database object by clearing any
-- that are currently set, and then setting the new defaults.
-- @param defaults A table of defaults for this database
function DBObjectLib:RegisterDefaults(defaults)
if defaults and type(defaults) ~= "table" then
error(("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
end
validateDefaults(defaults, self.keys)
-- Remove any currently set defaults
if self.defaults then
for section,key in pairs(self.keys) do
if self.defaults[section] and rawget(self, section) then
removeDefaults(self[section], self.defaults[section])
end
end
end
-- Set the DBObject.defaults table
self.defaults = defaults
-- Copy in any defaults, only touching those sections already created
if defaults then
for section,key in pairs(self.keys) do
if defaults[section] and rawget(self, section) then
copyDefaults(self[section], defaults[section])
end
end
end
end
--- Changes the profile of the database and all of it's namespaces to the
-- supplied named profile
-- @param name The name of the profile to set as the current profile
function DBObjectLib:SetProfile(name)
if type(name) ~= "string" then
error(("Usage: AceDBObject:SetProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
-- changing to the same profile, dont do anything
if name == self.keys.profile then return end
local oldProfile = self.profile
local defaults = self.defaults and self.defaults.profile
-- Callback: OnProfileShutdown, database
self.callbacks:Fire("OnProfileShutdown", self)
if oldProfile and defaults then
-- Remove the defaults from the old profile
removeDefaults(oldProfile, defaults)
end
self.profile = nil
self.keys["profile"] = name
-- if the storage exists, save the new profile
-- this won't exist on namespaces.
if self.sv.profileKeys then
self.sv.profileKeys[charKey] = name
end
-- populate to child namespaces
if self.children then
for _, db in pairs(self.children) do
DBObjectLib.SetProfile(db, name)
end
end
-- Callback: OnProfileChanged, database, newProfileKey
self.callbacks:Fire("OnProfileChanged", self, name)
end
--- Returns a table with the names of the existing profiles in the database.
-- You can optionally supply a table to re-use for this purpose.
-- @param tbl A table to store the profile names in (optional)
function DBObjectLib:GetProfiles(tbl)
if tbl and type(tbl) ~= "table" then
error(("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected, got %q."):format(type(tbl)), 2)
end
-- Clear the container table
if tbl then
for k,v in pairs(tbl) do tbl[k] = nil end
else
tbl = {}
end
local curProfile = self.keys.profile
local i = 0
for profileKey in pairs(self.profiles) do
i = i + 1
tbl[i] = profileKey
if curProfile and profileKey == curProfile then curProfile = nil end
end
-- Add the current profile, if it hasn't been created yet
if curProfile then
i = i + 1
tbl[i] = curProfile
end
return tbl, i
end
--- Returns the current profile name used by the database
function DBObjectLib:GetCurrentProfile()
return self.keys.profile
end
--- Deletes a named profile. This profile must not be the active profile.
-- @param name The name of the profile to be deleted
-- @param silent If true, do not raise an error when the profile does not exist
function DBObjectLib:DeleteProfile(name, silent)
if type(name) ~= "string" then
error(("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
if self.keys.profile == name then
error(("Cannot delete the active profile (%q) in an AceDBObject."):format(name), 2)
end
if not rawget(self.profiles, name) and not silent then
error(("Cannot delete profile %q as it does not exist."):format(name), 2)
end
self.profiles[name] = nil
-- populate to child namespaces
if self.children then
for _, db in pairs(self.children) do
DBObjectLib.DeleteProfile(db, name, true)
end
end
-- switch all characters that use this profile back to the default
if self.sv.profileKeys then
for key, profile in pairs(self.sv.profileKeys) do
if profile == name then
self.sv.profileKeys[key] = nil
end
end
end
-- Callback: OnProfileDeleted, database, profileKey
self.callbacks:Fire("OnProfileDeleted", self, name)
end
--- Copies a named profile into the current profile, overwriting any conflicting
-- settings.
-- @param name The name of the profile to be copied into the current profile
-- @param silent If true, do not raise an error when the profile does not exist
function DBObjectLib:CopyProfile(name, silent)
if type(name) ~= "string" then
error(("Usage: AceDBObject:CopyProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
if name == self.keys.profile then
error(("Cannot have the same source and destination profiles (%q)."):format(name), 2)
end
if not rawget(self.profiles, name) and not silent then
error(("Cannot copy profile %q as it does not exist."):format(name), 2)
end
-- Reset the profile before copying
DBObjectLib.ResetProfile(self, nil, true)
local profile = self.profile
local source = self.profiles[name]
copyTable(source, profile)
-- populate to child namespaces
if self.children then
for _, db in pairs(self.children) do
DBObjectLib.CopyProfile(db, name, true)
end
end
-- Callback: OnProfileCopied, database, sourceProfileKey
self.callbacks:Fire("OnProfileCopied", self, name)
end
--- Resets the current profile to the default values (if specified).
-- @param noChildren if set to true, the reset will not be populated to the child namespaces of this DB object
-- @param noCallbacks if set to true, won't fire the OnProfileReset callback
function DBObjectLib:ResetProfile(noChildren, noCallbacks)
local profile = self.profile
for k,v in pairs(profile) do
profile[k] = nil
end
local defaults = self.defaults and self.defaults.profile
if defaults then
copyDefaults(profile, defaults)
end
-- populate to child namespaces
if self.children and not noChildren then
for _, db in pairs(self.children) do
DBObjectLib.ResetProfile(db, nil, noCallbacks)
end
end
-- Callback: OnProfileReset, database
if not noCallbacks then
self.callbacks:Fire("OnProfileReset", self)
end
end
--- Resets the entire database, using the string defaultProfile as the new default
-- profile.
-- @param defaultProfile The profile name to use as the default
function DBObjectLib:ResetDB(defaultProfile)
if defaultProfile and type(defaultProfile) ~= "string" then
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected, got %q."):format(type(defaultProfile)), 2)
end
local sv = self.sv
for k,v in pairs(sv) do
sv[k] = nil
end
initdb(sv, self.defaults, defaultProfile, self)
-- fix the child namespaces
if self.children then
if not sv.namespaces then sv.namespaces = {} end
for name, db in pairs(self.children) do
if not sv.namespaces[name] then sv.namespaces[name] = {} end
initdb(sv.namespaces[name], db.defaults, self.keys.profile, db, self)
end
end
-- Callback: OnDatabaseReset, database
self.callbacks:Fire("OnDatabaseReset", self)
-- Callback: OnProfileChanged, database, profileKey
self.callbacks:Fire("OnProfileChanged", self, self.keys["profile"])
return self
end
--- Creates a new database namespace, directly tied to the database. This
-- is a full scale database in it's own rights other than the fact that
-- it cannot control its profile individually
-- @param name The name of the new namespace
-- @param defaults A table of values to use as defaults
function DBObjectLib:RegisterNamespace(name, defaults)
if type(name) ~= "string" then
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected, got %q."):format(type(name)), 2)
end
if defaults and type(defaults) ~= "table" then
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
end
if self.children and self.children[name] then
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace called %q already exists."):format(name), 2)
end
local sv = self.sv
if not sv.namespaces then sv.namespaces = {} end
if not sv.namespaces[name] then
sv.namespaces[name] = {}
end
local newDB = initdb(sv.namespaces[name], defaults, self.keys.profile, nil, self)
if not self.children then self.children = {} end
self.children[name] = newDB
return newDB
end
--- Returns an already existing namespace from the database object.
-- @param name The name of the new namespace
-- @param silent if true, the addon is optional, silently return nil if its not found
-- @usage
-- local namespace = self.db:GetNamespace('namespace')
-- @return the namespace object if found
function DBObjectLib:GetNamespace(name, silent)
if type(name) ~= "string" then
error(("Usage: AceDBObject:GetNamespace(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
if not silent and not (self.children and self.children[name]) then
error(("Usage: AceDBObject:GetNamespace(name): 'name' - namespace %q does not exist."):format(name), 2)
end
if not self.children then self.children = {} end
return self.children[name]
end
--[[-------------------------------------------------------------------------
AceDB Exposed Methods
---------------------------------------------------------------------------]]
--- Creates a new database object that can be used to handle database settings and profiles.
-- By default, an empty DB is created, using a character specific profile.
--
-- You can override the default profile used by passing any profile name as the third argument,
-- or by passing //true// as the third argument to use a globally shared profile called "Default".
--
-- Note that there is no token replacement in the default profile name, passing a defaultProfile as "char"
-- will use a profile named "char", and not a character-specific profile.
-- @param tbl The name of variable, or table to use for the database
-- @param defaults A table of database defaults
-- @param defaultProfile The name of the default profile. If not set, a character specific profile will be used as the default.
-- You can also pass //true// to use a shared global profile called "Default".
-- @usage
-- -- Create an empty DB using a character-specific default profile.
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB")
-- @usage
-- -- Create a DB using defaults and using a shared default profile
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
function AceDB:New(tbl, defaults, defaultProfile)
if type(tbl) == "string" then
local name = tbl
tbl = _G[name]
if not tbl then
tbl = {}
_G[name] = tbl
end
end
if type(tbl) ~= "table" then
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected, got %q."):format(type(tbl)), 2)
end
if defaults and type(defaults) ~= "table" then
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected, got %q."):format(type(defaults)), 2)
end
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
end
return initdb(tbl, defaults, defaultProfile)
end
-- upgrade existing databases
for db in pairs(AceDB.db_registry) do
if not db.parent then
for name,func in pairs(DBObjectLib) do
db[name] = func
end
else
db.RegisterDefaults = DBObjectLib.RegisterDefaults
db.ResetProfile = DBObjectLib.ResetProfile
end
end
-4
View File
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceDB-3.0.lua"/>
</Ui>
-460
View File
@@ -1,460 +0,0 @@
--- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles.
-- @class file
-- @name AceDBOptions-3.0
-- @release $Id: AceDBOptions-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 15
local AceDBOptions = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR)
if not AceDBOptions then return end -- No upgrade needed
-- Lua APIs
local pairs, next = pairs, next
-- WoW APIs
local UnitClass = UnitClass
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NORMAL_FONT_COLOR_CODE, FONT_COLOR_CODE_CLOSE
AceDBOptions.optionTables = AceDBOptions.optionTables or {}
AceDBOptions.handlers = AceDBOptions.handlers or {}
--[[
Localization of AceDBOptions-3.0
]]
local L = {
choose = "Existing Profiles",
choose_desc = "You can either create a new profile by entering a name in the editbox, or choose one of the already existing profiles.",
choose_sub = "Select one of your currently available profiles.",
copy = "Copy From",
copy_desc = "Copy the settings from one existing profile into the currently active profile.",
current = "Current Profile:",
default = "Default",
delete = "Delete a Profile",
delete_confirm = "Are you sure you want to delete the selected profile?",
delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.",
delete_sub = "Deletes a profile from the database.",
intro = "You can change the active database profile, so you can have different settings for every character.",
new = "New",
new_sub = "Create a new empty profile.",
profiles = "Profiles",
profiles_sub = "Manage Profiles",
reset = "Reset Profile",
reset_desc = "Reset the current profile back to its default values, in case your configuration is broken, or you simply want to start over.",
reset_sub = "Reset the current profile to the default",
}
local LOCALE = GetLocale()
if LOCALE == "deDE" then
L["choose"] = "Vorhandene Profile"
L["choose_desc"] = "Du kannst ein neues Profil erstellen, indem du einen neuen Namen in der Eingabebox 'Neu' eingibst, oder wähle eines der vorhandenen Profile aus."
L["choose_sub"] = "Wählt ein bereits vorhandenes Profil aus."
L["copy"] = "Kopieren von..."
L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil."
L["current"] = "Aktuelles Profil:"
L["default"] = "Standard"
L["delete"] = "Profil löschen"
L["delete_confirm"] = "Willst du das ausgewählte Profil wirklich löschen?"
L["delete_desc"] = "Lösche vorhandene oder unbenutzte Profile aus der Datenbank, um Platz zu sparen und die SavedVariables-Datei 'sauber' zu halten."
L["delete_sub"] = "Löscht ein Profil aus der Datenbank."
L["intro"] = "Hier kannst du das aktive Datenbankprofil ändern, damit du verschiedene Einstellungen für jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration möglich wird."
L["new"] = "Neu"
L["new_sub"] = "Ein neues Profil erstellen."
L["profiles"] = "Profile"
L["profiles_sub"] = "Profile verwalten"
L["reset"] = "Profil zurücksetzen"
L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zurück, für den Fall, dass mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst."
L["reset_sub"] = "Das aktuelle Profil auf Standard zurücksetzen."
elseif LOCALE == "frFR" then
L["choose"] = "Profils existants"
L["choose_desc"] = "Vous pouvez créer un nouveau profil en entrant un nouveau nom dans la boîte de saisie, ou en choississant un des profils déjà existants."
L["choose_sub"] = "Permet de choisir un des profils déjà disponibles."
L["copy"] = "Copier à partir de"
L["copy_desc"] = "Copie les paramètres d'un profil déjà existant dans le profil actuellement actif."
L["current"] = "Profil actuel :"
L["default"] = "Défaut"
L["delete"] = "Supprimer un profil"
L["delete_confirm"] = "Etes-vous sûr de vouloir supprimer le profil sélectionné ?"
L["delete_desc"] = "Supprime les profils existants inutilisés de la base de données afin de gagner de la place et de nettoyer le fichier SavedVariables."
L["delete_sub"] = "Supprime un profil de la base de données."
L["intro"] = "Vous pouvez changer le profil actuel afin d'avoir des paramètres différents pour chaque personnage, permettant ainsi d'avoir une configuration très flexible."
L["new"] = "Nouveau"
L["new_sub"] = "Créée un nouveau profil vierge."
L["profiles"] = "Profils"
L["profiles_sub"] = "Gestion des profils"
L["reset"] = "Réinitialiser le profil"
L["reset_desc"] = "Réinitialise le profil actuel au cas où votre configuration est corrompue ou si vous voulez tout simplement faire table rase."
L["reset_sub"] = "Réinitialise le profil actuel avec les paramètres par défaut."
elseif LOCALE == "koKR" then
L["choose"] = "저장 중인 프로필"
L["choose_desc"] = "입력창에 새로운 이름을 입력하거나 저장 중인 프로필 중 하나를 선택하여 새로운 프로필을 만들 수 있습니다."
L["choose_sub"] = "현재 이용할 수 있는 프로필 중 하나를 선택합니다."
L["copy"] = "복사해오기"
L["copy_desc"] = "현재 사용 중인 프로필에 선택한 프로필의 설정을 복사합니다."
L["current"] = "현재 프로필:"
L["default"] = "기본값"
L["delete"] = "프로필 삭제"
L["delete_confirm"] = "정말로 선택한 프로필을 삭제할까요?"
L["delete_desc"] = "저장 공간 절약과 SavedVariables 파일의 정리를 위해 데이터베이스에서 사용하지 않는 프로필을 삭제하세요."
L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다."
L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있고, 각 캐릭터 별로 다른 설정을 할 수 있습니다."
L["new"] = "새로운 프로필"
L["new_sub"] = "새로운 프로필을 만듭니다."
L["profiles"] = "프로필"
L["profiles_sub"] = "프로필 관리"
L["reset"] = "프로필 초기화"
L["reset_desc"] = "설정이 깨졌거나 처음부터 다시 설정을 원하는 경우, 현재 프로필을 기본값으로 초기화하세요."
L["reset_sub"] = "현재 프로필을 기본값으로 초기화합니다"
elseif LOCALE == "esES" or LOCALE == "esMX" then
L["choose"] = "Perfiles existentes"
L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes."
L["choose_sub"] = "Selecciona uno de los perfiles disponibles."
L["copy"] = "Copiar de"
L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual."
L["current"] = "Perfil actual:"
L["default"] = "Por defecto"
L["delete"] = "Borrar un Perfil"
L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?"
L["delete_desc"] = "Borra los perfiles existentes y sin uso de la base de datos para ganar espacio y limpiar el archivo SavedVariables."
L["delete_sub"] = "Borra un perfil de la base de datos."
L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones."
L["new"] = "Nuevo"
L["new_sub"] = "Crear un nuevo perfil vacio."
L["profiles"] = "Perfiles"
L["profiles_sub"] = "Manejar Perfiles"
L["reset"] = "Reiniciar Perfil"
L["reset_desc"] = "Reinicia el perfil actual a los valores por defectos, en caso de que se haya estropeado la configuración o quieras volver a empezar de nuevo."
L["reset_sub"] = "Reinicar el perfil actual al de por defecto"
elseif LOCALE == "zhTW" then
L["choose"] = "現有的設定檔"
L["choose_desc"] = "您可以在文字方塊內輸入名字以建立新的設定檔,或是選擇一個現有的設定檔使用。"
L["choose_sub"] = "從當前可用的設定檔裡面選擇一個。"
L["copy"] = "複製自"
L["copy_desc"] = "從一個現有的設定檔,將設定複製到現在使用中的設定檔。"
L["current"] = "目前設定檔:"
L["default"] = "預設"
L["delete"] = "刪除一個設定檔"
L["delete_confirm"] = "確定要刪除所選擇的設定檔嗎?"
L["delete_desc"] = "從資料庫裡刪除不再使用的設定檔,以節省空間,並且清理 SavedVariables 檔案。"
L["delete_sub"] = "從資料庫裡刪除一個設定檔。"
L["intro"] = "您可以從資料庫中選擇一個設定檔來使用,如此就可以讓每個角色使用不同的設定。"
L["new"] = "新建"
L["new_sub"] = "新建一個空的設定檔。"
L["profiles"] = "設定檔"
L["profiles_sub"] = "管理設定檔"
L["reset"] = "重置設定檔"
L["reset_desc"] = "將現用的設定檔重置為預設值;用於設定檔損壞,或者單純想要重來的情況。"
L["reset_sub"] = "將目前的設定檔重置為預設值"
elseif LOCALE == "zhCN" then
L["choose"] = "现有的配置文件"
L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。"
L["choose_sub"] = "从当前可用的配置文件里面选择一个。"
L["copy"] = "复制自"
L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。"
L["current"] = "当前配置文件:"
L["default"] = "默认"
L["delete"] = "删除一个配置文件"
L["delete_confirm"] = "你确定要删除所选择的配置文件么?"
L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。"
L["delete_sub"] = "从数据库里删除一个配置文件。"
L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。"
L["new"] = "新建"
L["new_sub"] = "新建一个空的配置文件。"
L["profiles"] = "配置文件"
L["profiles_sub"] = "管理配置文件"
L["reset"] = "重置配置文件"
L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。"
L["reset_sub"] = "将当前的配置文件恢复为默认值"
elseif LOCALE == "ruRU" then
L["choose"] = "Существующие профили"
L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
L["choose_sub"] = "Выбор одиного из уже доступных профилей"
L["copy"] = "Скопировать из"
L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный."
L["current"] = "Текущий профиль:"
L["default"] = "По умолчанию"
L["delete"] = "Удалить профиль"
L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?"
L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл."
L["delete_sub"] = "Удаление профиля из БД"
L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа."
L["new"] = "Новый"
L["new_sub"] = "Создать новый чистый профиль"
L["profiles"] = "Профили"
L["profiles_sub"] = "Управление профилями"
L["reset"] = "Сброс профиля"
L["reset_desc"] = "Сбросить текущий профиль к стандартным настройкам, если ваша конфигурация испорчена или вы хотите настроить всё заново."
L["reset_sub"] = "Сброс текущего профиля на стандартный"
elseif LOCALE == "itIT" then
L["choose"] = "Profili Esistenti"
L["choose_desc"] = "Puoi creare un nuovo profilo digitando il nome della casella di testo, oppure scegliendone uno tra i profili già esistenti."
L["choose_sub"] = "Seleziona uno dei profili attualmente disponibili."
L["copy"] = "Copia Da"
L["copy_desc"] = "Copia le impostazioni da un profilo esistente, nel profilo attivo in questo momento."
L["current"] = "Profilo Attivo:"
L["default"] = "Standard"
L["delete"] = "Cancella un Profilo"
L["delete_confirm"] = "Sei sicuro di voler cancellare il profilo selezionato?"
L["delete_desc"] = "Cancella i profili non utilizzati dal database per risparmiare spazio e mantenere puliti i file di configurazione SavedVariables."
L["delete_sub"] = "Cancella un profilo dal Database."
L["intro"] = "Puoi cambiare il profilo attivo, in modo da usare impostazioni diverse per ogni personaggio."
L["new"] = "Nuovo"
L["new_sub"] = "Crea un nuovo profilo vuoto."
L["profiles"] = "Profili"
L["profiles_sub"] = "Gestisci Profili"
L["reset"] = "Reimposta Profilo"
L["reset_desc"] = "Riporta il tuo profilo attivo alle sue impostazioni predefinite, nel caso in cui la tua configurazione si sia corrotta, o semplicemente tu voglia re-inizializzarla."
L["reset_sub"] = "Reimposta il profilo ai suoi valori predefiniti."
elseif LOCALE == "ptBR" then
L["choose"] = "Perfis Existentes"
L["choose_desc"] = "Você pode tanto criar um perfil novo tanto digitando um nome na caixa de texto, quanto escolher um dos perfis já existentes."
L["choose_sub"] = "Selecione um de seus perfis atualmente disponíveis."
L["copy"] = "Copiar De"
L["copy_desc"] = "Copia as definições de um perfil existente no perfil atualmente ativo."
L["current"] = "Perfil Autal:"
L["default"] = "Padrão"
L["delete"] = "Remover um Perfil"
L["delete_confirm"] = "Tem certeza que deseja remover o perfil selecionado?"
L["delete_desc"] = "Remove perfis existentes e inutilizados do banco de dados para economizar espaço, e limpar o arquivo SavedVariables."
L["delete_sub"] = "Remove um perfil do banco de dados."
L["intro"] = "Você pode alterar o perfil do banco de dados ativo, para que possa ter definições diferentes para cada personagem."
L["new"] = "Novo"
L["new_sub"] = "Cria um novo perfil vazio."
L["profiles"] = "Perfis"
L["profiles_sub"] = "Gerenciar Perfis"
L["reset"] = "Resetar Perfil"
L["reset_desc"] = "Reseta o perfil atual para os valores padrões, no caso de sua configuração estar quebrada, ou simplesmente se deseja começar novamente."
L["reset_sub"] = "Resetar o perfil atual ao padrão"
end
local defaultProfiles
local tmpprofiles = {}
-- Get a list of available profiles for the specified database.
-- You can specify which profiles to include/exclude in the list using the two boolean parameters listed below.
-- @param db The db object to retrieve the profiles from
-- @param common If true, getProfileList will add the default profiles to the return list, even if they have not been created yet
-- @param nocurrent If true, then getProfileList will not display the current profile in the list
-- @return Hashtable of all profiles with the internal name as keys and the display name as value.
local function getProfileList(db, common, nocurrent)
local profiles = {}
-- copy existing profiles into the table
local currentProfile = db:GetCurrentProfile()
for i,v in pairs(db:GetProfiles(tmpprofiles)) do
if not (nocurrent and v == currentProfile) then
profiles[v] = v
end
end
-- add our default profiles to choose from ( or rename existing profiles)
for k,v in pairs(defaultProfiles) do
if (common or profiles[k]) and not (nocurrent and k == currentProfile) then
profiles[k] = v
end
end
return profiles
end
--[[
OptionsHandlerPrototype
prototype class for handling the options in a sane way
]]
local OptionsHandlerPrototype = {}
--[[ Reset the profile ]]
function OptionsHandlerPrototype:Reset()
self.db:ResetProfile()
end
--[[ Set the profile to value ]]
function OptionsHandlerPrototype:SetProfile(info, value)
self.db:SetProfile(value)
end
--[[ returns the currently active profile ]]
function OptionsHandlerPrototype:GetCurrentProfile()
return self.db:GetCurrentProfile()
end
--[[
List all active profiles
you can control the output with the .arg variable
currently four modes are supported
(empty) - return all available profiles
"nocurrent" - returns all available profiles except the currently active profile
"common" - returns all avaialble profiles + some commonly used profiles ("char - realm", "realm", "class", "Default")
"both" - common except the active profile
]]
function OptionsHandlerPrototype:ListProfiles(info)
local arg = info.arg
local profiles
if arg == "common" and not self.noDefaultProfiles then
profiles = getProfileList(self.db, true, nil)
elseif arg == "nocurrent" then
profiles = getProfileList(self.db, nil, true)
elseif arg == "both" then -- currently not used
profiles = getProfileList(self.db, (not self.noDefaultProfiles) and true, true)
else
profiles = getProfileList(self.db)
end
return profiles
end
function OptionsHandlerPrototype:HasNoProfiles(info)
local profiles = self:ListProfiles(info)
return ((not next(profiles)) and true or false)
end
--[[ Copy a profile ]]
function OptionsHandlerPrototype:CopyProfile(info, value)
self.db:CopyProfile(value)
end
--[[ Delete a profile from the db ]]
function OptionsHandlerPrototype:DeleteProfile(info, value)
self.db:DeleteProfile(value)
end
--[[ fill defaultProfiles with some generic values ]]
local function generateDefaultProfiles(db)
defaultProfiles = {
["Default"] = L["default"],
[db.keys.char] = db.keys.char,
[db.keys.realm] = db.keys.realm,
[db.keys.class] = UnitClass("player")
}
end
--[[ create and return a handler object for the db, or upgrade it if it already existed ]]
local function getOptionsHandler(db, noDefaultProfiles)
if not defaultProfiles then
generateDefaultProfiles(db)
end
local handler = AceDBOptions.handlers[db] or { db = db, noDefaultProfiles = noDefaultProfiles }
for k,v in pairs(OptionsHandlerPrototype) do
handler[k] = v
end
AceDBOptions.handlers[db] = handler
return handler
end
--[[
the real options table
]]
local optionsTable = {
desc = {
order = 1,
type = "description",
name = L["intro"] .. "\n",
},
descreset = {
order = 9,
type = "description",
name = L["reset_desc"],
},
reset = {
order = 10,
type = "execute",
name = L["reset"],
desc = L["reset_sub"],
func = "Reset",
},
current = {
order = 11,
type = "description",
name = function(info) return L["current"] .. " " .. NORMAL_FONT_COLOR_CODE .. info.handler:GetCurrentProfile() .. FONT_COLOR_CODE_CLOSE end,
width = "default",
},
choosedesc = {
order = 20,
type = "description",
name = "\n" .. L["choose_desc"],
},
new = {
name = L["new"],
desc = L["new_sub"],
type = "input",
order = 30,
get = false,
set = "SetProfile",
},
choose = {
name = L["choose"],
desc = L["choose_sub"],
type = "select",
order = 40,
get = "GetCurrentProfile",
set = "SetProfile",
values = "ListProfiles",
arg = "common",
},
copydesc = {
order = 50,
type = "description",
name = "\n" .. L["copy_desc"],
},
copyfrom = {
order = 60,
type = "select",
name = L["copy"],
desc = L["copy_desc"],
get = false,
set = "CopyProfile",
values = "ListProfiles",
disabled = "HasNoProfiles",
arg = "nocurrent",
},
deldesc = {
order = 70,
type = "description",
name = "\n" .. L["delete_desc"],
},
delete = {
order = 80,
type = "select",
name = L["delete"],
desc = L["delete_sub"],
get = false,
set = "DeleteProfile",
values = "ListProfiles",
disabled = "HasNoProfiles",
arg = "nocurrent",
confirm = true,
confirmText = L["delete_confirm"],
},
}
--- Get/Create a option table that you can use in your addon to control the profiles of AceDB-3.0.
-- @param db The database object to create the options table for.
-- @return The options table to be used in AceConfig-3.0
-- @usage
-- -- Assuming `options` is your top-level options table and `self.db` is your database:
-- options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
function AceDBOptions:GetOptionsTable(db, noDefaultProfiles)
local tbl = AceDBOptions.optionTables[db] or {
type = "group",
name = L["profiles"],
desc = L["profiles_sub"],
}
tbl.handler = getOptionsHandler(db, noDefaultProfiles)
tbl.args = optionsTable
AceDBOptions.optionTables[db] = tbl
return tbl
end
-- upgrade existing tables
for db,tbl in pairs(AceDBOptions.optionTables) do
tbl.handler = getOptionsHandler(db)
tbl.args = optionsTable
end
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceDBOptions-3.0.lua"/>
</Ui>
-126
View File
@@ -1,126 +0,0 @@
--- AceEvent-3.0 provides event registration and secure dispatching.
-- All dispatching is done using **CallbackHandler-1.0**. AceEvent is a simple wrapper around
-- CallbackHandler, and dispatches all game events or addon message to the registrees.
--
-- **AceEvent-3.0** can be embeded into your addon, either explicitly by calling AceEvent:Embed(MyAddon) or by
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
-- and can be accessed directly, without having to explicitly call AceEvent itself.\\
-- It is recommended to embed AceEvent, otherwise you'll have to specify a custom `self` on all calls you
-- make into AceEvent.
-- @class file
-- @name AceEvent-3.0
-- @release $Id: AceEvent-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
local CallbackHandler = LibStub("CallbackHandler-1.0")
local MAJOR, MINOR = "AceEvent-3.0", 4
local AceEvent = LibStub:NewLibrary(MAJOR, MINOR)
if not AceEvent then return end
-- Lua APIs
local pairs = pairs
AceEvent.frame = AceEvent.frame or CreateFrame("Frame", "AceEvent30Frame") -- our event frame
AceEvent.embeds = AceEvent.embeds or {} -- what objects embed this lib
-- APIs and registry for blizzard events, using CallbackHandler lib
if not AceEvent.events then
AceEvent.events = CallbackHandler:New(AceEvent,
"RegisterEvent", "UnregisterEvent", "UnregisterAllEvents")
end
function AceEvent.events:OnUsed(target, eventname)
AceEvent.frame:RegisterEvent(eventname)
end
function AceEvent.events:OnUnused(target, eventname)
AceEvent.frame:UnregisterEvent(eventname)
end
-- APIs and registry for IPC messages, using CallbackHandler lib
if not AceEvent.messages then
AceEvent.messages = CallbackHandler:New(AceEvent,
"RegisterMessage", "UnregisterMessage", "UnregisterAllMessages"
)
AceEvent.SendMessage = AceEvent.messages.Fire
end
--- embedding and embed handling
local mixins = {
"RegisterEvent", "UnregisterEvent",
"RegisterMessage", "UnregisterMessage",
"SendMessage",
"UnregisterAllEvents", "UnregisterAllMessages",
}
--- Register for a Blizzard Event.
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
-- Any arguments to the event will be passed on after that.
-- @name AceEvent:RegisterEvent
-- @class function
-- @paramsig event[, callback [, arg]]
-- @param event The event to register for
-- @param callback The callback function to call when the event is triggered (funcref or method, defaults to a method with the event name)
-- @param arg An optional argument to pass to the callback function
--- Unregister an event.
-- @name AceEvent:UnregisterEvent
-- @class function
-- @paramsig event
-- @param event The event to unregister
--- Register for a custom AceEvent-internal message.
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
-- Any arguments to the event will be passed on after that.
-- @name AceEvent:RegisterMessage
-- @class function
-- @paramsig message[, callback [, arg]]
-- @param message The message to register for
-- @param callback The callback function to call when the message is triggered (funcref or method, defaults to a method with the event name)
-- @param arg An optional argument to pass to the callback function
--- Unregister a message
-- @name AceEvent:UnregisterMessage
-- @class function
-- @paramsig message
-- @param message The message to unregister
--- Send a message over the AceEvent-3.0 internal message system to other addons registered for this message.
-- @name AceEvent:SendMessage
-- @class function
-- @paramsig message, ...
-- @param message The message to send
-- @param ... Any arguments to the message
-- Embeds AceEvent into the target object making the functions from the mixins list available on target:..
-- @param target target object to embed AceEvent in
function AceEvent:Embed(target)
for k, v in pairs(mixins) do
target[v] = self[v]
end
self.embeds[target] = true
return target
end
-- AceEvent:OnEmbedDisable( target )
-- target (object) - target object that is being disabled
--
-- Unregister all events messages etc when the target disables.
-- this method should be called by the target manually or by an addon framework
function AceEvent:OnEmbedDisable(target)
target:UnregisterAllEvents()
target:UnregisterAllMessages()
end
-- Script to fire blizzard events into the event listeners
local events = AceEvent.events
AceEvent.frame:SetScript("OnEvent", function(this, event, ...)
events:Fire(event, ...)
end)
--- Finally: upgrade our old embeds
for target, v in pairs(AceEvent.embeds) do
AceEvent:Embed(target)
end
-4
View File
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceEvent-3.0.lua"/>
</Ui>
File diff suppressed because it is too large Load Diff
-28
View File
@@ -1,28 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceGUI-3.0.lua"/>
<!-- Container -->
<Script file="widgets\AceGUIContainer-BlizOptionsGroup.lua"/>
<Script file="widgets\AceGUIContainer-DropDownGroup.lua"/>
<Script file="widgets\AceGUIContainer-Frame.lua"/>
<Script file="widgets\AceGUIContainer-InlineGroup.lua"/>
<Script file="widgets\AceGUIContainer-ScrollFrame.lua"/>
<Script file="widgets\AceGUIContainer-SimpleGroup.lua"/>
<Script file="widgets\AceGUIContainer-TabGroup.lua"/>
<Script file="widgets\AceGUIContainer-TreeGroup.lua"/>
<Script file="widgets\AceGUIContainer-Window.lua"/>
<!-- Widgets -->
<Script file="widgets\AceGUIWidget-Button.lua"/>
<Script file="widgets\AceGUIWidget-CheckBox.lua"/>
<Script file="widgets\AceGUIWidget-ColorPicker.lua"/>
<Script file="widgets\AceGUIWidget-DropDown.lua"/>
<Script file="widgets\AceGUIWidget-DropDown-Items.lua"/>
<Script file="widgets\AceGUIWidget-EditBox.lua"/>
<Script file="widgets\AceGUIWidget-Heading.lua"/>
<Script file="widgets\AceGUIWidget-Icon.lua"/>
<Script file="widgets\AceGUIWidget-InteractiveLabel.lua"/>
<Script file="widgets\AceGUIWidget-Keybinding.lua"/>
<Script file="widgets\AceGUIWidget-Label.lua"/>
<Script file="widgets\AceGUIWidget-MultiLineEditBox.lua"/>
<Script file="widgets\AceGUIWidget-Slider.lua"/>
</Ui>
@@ -1,138 +0,0 @@
--[[-----------------------------------------------------------------------------
BlizOptionsGroup Container
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
-------------------------------------------------------------------------------]]
local Type, Version = "BlizOptionsGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local CreateFrame = CreateFrame
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function OnShow(frame)
frame.obj:Fire("OnShow")
end
local function OnHide(frame)
frame.obj:Fire("OnHide")
end
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function okay(frame)
frame.obj:Fire("okay")
end
local function cancel(frame)
frame.obj:Fire("cancel")
end
local function default(frame)
frame.obj:Fire("default")
end
local function refresh(frame)
frame.obj:Fire("refresh")
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetName()
self:SetTitle()
end,
-- ["OnRelease"] = nil,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 63
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 26
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end,
["SetName"] = function(self, name, parent)
self.frame.name = name
self.frame.parent = parent
end,
["SetTitle"] = function(self, title)
local content = self.content
content:ClearAllPoints()
if not title or title == "" then
content:SetPoint("TOPLEFT", 10, -10)
self.label:SetText("")
else
content:SetPoint("TOPLEFT", 10, -40)
self.label:SetText(title)
end
content:SetPoint("BOTTOMRIGHT", -10, 10)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame")
frame:Hide()
-- support functions for the Blizzard Interface Options
frame.okay = okay
frame.cancel = cancel
frame.default = default
frame.refresh = refresh
frame:SetScript("OnHide", OnHide)
frame:SetScript("OnShow", OnShow)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
label:SetPoint("TOPLEFT", 10, -15)
label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45)
label:SetJustifyH("LEFT")
label:SetJustifyV("TOP")
--Container Support
local content = CreateFrame("Frame", nil, frame)
content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local widget = {
label = label,
frame = frame,
content = content,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,157 +0,0 @@
--[[-----------------------------------------------------------------------------
DropdownGroup Container
Container controlled by a dropdown on the top.
-------------------------------------------------------------------------------]]
local Type, Version = "DropdownGroup", 22
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local assert, pairs, type = assert, pairs, type
-- WoW APIs
local CreateFrame = CreateFrame
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function SelectedGroup(self, event, value)
local group = self.parentgroup
local status = group.status or group.localstatus
status.selected = value
self.parentgroup:Fire("OnGroupSelected", value)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self.dropdown:SetText("")
self:SetDropdownWidth(200)
self:SetTitle("")
end,
["OnRelease"] = function(self)
self.dropdown.list = nil
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
end,
["SetTitle"] = function(self, title)
self.titletext:SetText(title)
self.dropdown.frame:ClearAllPoints()
if title and title ~= "" then
self.dropdown.frame:SetPoint("TOPRIGHT", -2, 0)
else
self.dropdown.frame:SetPoint("TOPLEFT", -1, 0)
end
end,
["SetGroupList"] = function(self,list,order)
self.dropdown:SetList(list,order)
end,
["SetStatusTable"] = function(self, status)
assert(type(status) == "table")
self.status = status
end,
["SetGroup"] = function(self,group)
self.dropdown:SetValue(group)
local status = self.status or self.localstatus
status.selected = group
self:Fire("OnGroupSelected", group)
end,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 26
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 63
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end,
["LayoutFinished"] = function(self, width, height)
self:SetHeight((height or 0) + 63)
end,
["SetDropdownWidth"] = function(self, width)
self.dropdown:SetWidth(width)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
local function Constructor()
local frame = CreateFrame("Frame")
frame:SetHeight(100)
frame:SetWidth(100)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titletext:SetPoint("TOPLEFT", 4, -5)
titletext:SetPoint("TOPRIGHT", -4, -5)
titletext:SetJustifyH("LEFT")
titletext:SetHeight(18)
local dropdown = AceGUI:Create("Dropdown")
dropdown.frame:SetParent(frame)
dropdown.frame:SetFrameLevel(dropdown.frame:GetFrameLevel() + 2)
dropdown:SetCallback("OnValueChanged", SelectedGroup)
dropdown.frame:SetPoint("TOPLEFT", -1, 0)
dropdown.frame:Show()
dropdown:SetLabel("")
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
border:SetPoint("TOPLEFT", 0, -26)
border:SetPoint("BOTTOMRIGHT", 0, 3)
border:SetBackdrop(PaneBackdrop)
border:SetBackdropColor(0.1,0.1,0.1,0.5)
border:SetBackdropBorderColor(0.4,0.4,0.4)
--Container Support
local content = CreateFrame("Frame", nil, border)
content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local widget = {
frame = frame,
localstatus = {},
titletext = titletext,
dropdown = dropdown,
border = border,
content = content,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
dropdown.parentgroup = widget
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,316 +0,0 @@
--[[-----------------------------------------------------------------------------
Frame Container
-------------------------------------------------------------------------------]]
local Type, Version = "Frame", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs, assert, type = pairs, assert, type
local wipe = table.wipe
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: CLOSE
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Button_OnClick(frame)
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
frame.obj:Hide()
end
local function Frame_OnShow(frame)
frame.obj:Fire("OnShow")
end
local function Frame_OnClose(frame)
frame.obj:Fire("OnClose")
end
local function Frame_OnMouseDown(frame)
AceGUI:ClearFocus()
end
local function Title_OnMouseDown(frame)
frame:GetParent():StartMoving()
AceGUI:ClearFocus()
end
local function MoverSizer_OnMouseUp(mover)
local frame = mover:GetParent()
frame:StopMovingOrSizing()
local self = frame.obj
local status = self.status or self.localstatus
status.width = frame:GetWidth()
status.height = frame:GetHeight()
status.top = frame:GetTop()
status.left = frame:GetLeft()
end
local function SizerSE_OnMouseDown(frame)
frame:GetParent():StartSizing("BOTTOMRIGHT")
AceGUI:ClearFocus()
end
local function SizerS_OnMouseDown(frame)
frame:GetParent():StartSizing("BOTTOM")
AceGUI:ClearFocus()
end
local function SizerE_OnMouseDown(frame)
frame:GetParent():StartSizing("RIGHT")
AceGUI:ClearFocus()
end
local function StatusBar_OnEnter(frame)
frame.obj:Fire("OnEnterStatusBar")
end
local function StatusBar_OnLeave(frame)
frame.obj:Fire("OnLeaveStatusBar")
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self.frame:SetParent(UIParent)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
self:SetTitle()
self:SetStatusText()
self:ApplyStatus()
self:Show()
self:EnableResize(true)
end,
["OnRelease"] = function(self)
self.status = nil
wipe(self.localstatus)
end,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 34
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 57
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end,
["SetTitle"] = function(self, title)
self.titletext:SetText(title)
self.titlebg:SetWidth((self.titletext:GetWidth() or 0) + 10)
end,
["SetStatusText"] = function(self, text)
self.statustext:SetText(text)
end,
["Hide"] = function(self)
self.frame:Hide()
end,
["Show"] = function(self)
self.frame:Show()
end,
["EnableResize"] = function(self, state)
local func = state and "Show" or "Hide"
self.sizer_se[func](self.sizer_se)
self.sizer_s[func](self.sizer_s)
self.sizer_e[func](self.sizer_e)
end,
-- called to set an external table to store status in
["SetStatusTable"] = function(self, status)
assert(type(status) == "table")
self.status = status
self:ApplyStatus()
end,
["ApplyStatus"] = function(self)
local status = self.status or self.localstatus
local frame = self.frame
self:SetWidth(status.width or 700)
self:SetHeight(status.height or 500)
frame:ClearAllPoints()
if status.top and status.left then
frame:SetPoint("TOP", UIParent, "BOTTOM", 0, status.top)
frame:SetPoint("LEFT", UIParent, "LEFT", status.left, 0)
else
frame:SetPoint("CENTER")
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local FrameBackdrop = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
}
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
frame:Hide()
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetResizable(true)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetBackdrop(FrameBackdrop)
frame:SetBackdropColor(0, 0, 0, 1)
frame:SetMinResize(400, 200)
frame:SetToplevel(true)
frame:SetScript("OnShow", Frame_OnShow)
frame:SetScript("OnHide", Frame_OnClose)
frame:SetScript("OnMouseDown", Frame_OnMouseDown)
local closebutton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
closebutton:SetScript("OnClick", Button_OnClick)
closebutton:SetPoint("BOTTOMRIGHT", -27, 17)
closebutton:SetHeight(20)
closebutton:SetWidth(100)
closebutton:SetText(CLOSE)
local statusbg = CreateFrame("Button", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
statusbg:SetPoint("BOTTOMLEFT", 15, 15)
statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
statusbg:SetHeight(24)
statusbg:SetBackdrop(PaneBackdrop)
statusbg:SetBackdropColor(0.1,0.1,0.1)
statusbg:SetBackdropBorderColor(0.4,0.4,0.4)
statusbg:SetScript("OnEnter", StatusBar_OnEnter)
statusbg:SetScript("OnLeave", StatusBar_OnLeave)
local statustext = statusbg:CreateFontString(nil, "OVERLAY", "GameFontNormal")
statustext:SetPoint("TOPLEFT", 7, -2)
statustext:SetPoint("BOTTOMRIGHT", -7, 2)
statustext:SetHeight(20)
statustext:SetJustifyH("LEFT")
statustext:SetText("")
local titlebg = frame:CreateTexture(nil, "OVERLAY")
titlebg:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
titlebg:SetTexCoord(0.31, 0.67, 0, 0.63)
titlebg:SetPoint("TOP", 0, 12)
titlebg:SetWidth(100)
titlebg:SetHeight(40)
local title = CreateFrame("Frame", nil, frame)
title:EnableMouse(true)
title:SetScript("OnMouseDown", Title_OnMouseDown)
title:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
title:SetAllPoints(titlebg)
local titletext = title:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titletext:SetPoint("TOP", titlebg, "TOP", 0, -14)
local titlebg_l = frame:CreateTexture(nil, "OVERLAY")
titlebg_l:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63)
titlebg_l:SetPoint("RIGHT", titlebg, "LEFT")
titlebg_l:SetWidth(30)
titlebg_l:SetHeight(40)
local titlebg_r = frame:CreateTexture(nil, "OVERLAY")
titlebg_r:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63)
titlebg_r:SetPoint("LEFT", titlebg, "RIGHT")
titlebg_r:SetWidth(30)
titlebg_r:SetHeight(40)
local sizer_se = CreateFrame("Frame", nil, frame)
sizer_se:SetPoint("BOTTOMRIGHT")
sizer_se:SetWidth(25)
sizer_se:SetHeight(25)
sizer_se:EnableMouse()
sizer_se:SetScript("OnMouseDown",SizerSE_OnMouseDown)
sizer_se:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
local line1 = sizer_se:CreateTexture(nil, "BACKGROUND")
line1:SetWidth(14)
line1:SetHeight(14)
line1:SetPoint("BOTTOMRIGHT", -8, 8)
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
local x = 0.1 * 14/17
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
local line2 = sizer_se:CreateTexture(nil, "BACKGROUND")
line2:SetWidth(8)
line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
local x = 0.1 * 8/17
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
local sizer_s = CreateFrame("Frame", nil, frame)
sizer_s:SetPoint("BOTTOMRIGHT", -25, 0)
sizer_s:SetPoint("BOTTOMLEFT")
sizer_s:SetHeight(25)
sizer_s:EnableMouse(true)
sizer_s:SetScript("OnMouseDown", SizerS_OnMouseDown)
sizer_s:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
local sizer_e = CreateFrame("Frame", nil, frame)
sizer_e:SetPoint("BOTTOMRIGHT", 0, 25)
sizer_e:SetPoint("TOPRIGHT")
sizer_e:SetWidth(25)
sizer_e:EnableMouse(true)
sizer_e:SetScript("OnMouseDown", SizerE_OnMouseDown)
sizer_e:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
--Container Support
local content = CreateFrame("Frame", nil, frame)
content:SetPoint("TOPLEFT", 17, -27)
content:SetPoint("BOTTOMRIGHT", -17, 40)
local widget = {
localstatus = {},
titletext = titletext,
statustext = statustext,
titlebg = titlebg,
sizer_se = sizer_se,
sizer_s = sizer_s,
sizer_e = sizer_e,
content = content,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
closebutton.obj, statusbg.obj = widget, widget
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,103 +0,0 @@
--[[-----------------------------------------------------------------------------
InlineGroup Container
Simple container widget that creates a visible "box" with an optional title.
-------------------------------------------------------------------------------]]
local Type, Version = "InlineGroup", 22
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(300)
self:SetHeight(100)
self:SetTitle("")
end,
-- ["OnRelease"] = nil,
["SetTitle"] = function(self,title)
self.titletext:SetText(title)
end,
["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end
self:SetHeight((height or 0) + 40)
end,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 20
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 20
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titletext:SetPoint("TOPLEFT", 14, 0)
titletext:SetPoint("TOPRIGHT", -14, 0)
titletext:SetJustifyH("LEFT")
titletext:SetHeight(18)
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
border:SetPoint("TOPLEFT", 0, -17)
border:SetPoint("BOTTOMRIGHT", -1, 3)
border:SetBackdrop(PaneBackdrop)
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
--Container Support
local content = CreateFrame("Frame", nil, border)
content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local widget = {
frame = frame,
content = content,
titletext = titletext,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,215 +0,0 @@
--[[-----------------------------------------------------------------------------
ScrollFrame Container
Plain container that scrolls its content and doesn't grow in height.
-------------------------------------------------------------------------------]]
local Type, Version = "ScrollFrame", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs, assert, type = pairs, assert, type
local min, max, floor = math.min, math.max, math.floor
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function FixScrollOnUpdate(frame)
frame:SetScript("OnUpdate", nil)
frame.obj:FixScroll()
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function ScrollFrame_OnMouseWheel(frame, value)
frame.obj:MoveScroll(value)
end
local function ScrollFrame_OnSizeChanged(frame)
frame:SetScript("OnUpdate", FixScrollOnUpdate)
end
local function ScrollBar_OnScrollValueChanged(frame, value)
frame.obj:SetScroll(value)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetScroll(0)
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
end,
["OnRelease"] = function(self)
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
self.scrollframe:SetPoint("BOTTOMRIGHT")
self.scrollbar:Hide()
self.scrollBarShown = nil
self.content.height, self.content.width, self.content.original_width = nil, nil, nil
end,
["SetScroll"] = function(self, value)
local status = self.status or self.localstatus
local viewheight = self.scrollframe:GetHeight()
local height = self.content:GetHeight()
local offset
if viewheight > height then
offset = 0
else
offset = floor((height - viewheight) / 1000.0 * value)
end
self.content:ClearAllPoints()
self.content:SetPoint("TOPLEFT", 0, offset)
self.content:SetPoint("TOPRIGHT", 0, offset)
status.offset = offset
status.scrollvalue = value
end,
["MoveScroll"] = function(self, value)
local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
if self.scrollBarShown then
local diff = height - viewheight
local delta = 1
if value < 0 then
delta = -1
end
self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end
end,
["FixScroll"] = function(self)
if self.updateLock then return end
self.updateLock = true
local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
local offset = status.offset or 0
-- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
-- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
if viewheight < height + 2 then
if self.scrollBarShown then
self.scrollBarShown = nil
self.scrollbar:Hide()
self.scrollbar:SetValue(0)
self.scrollframe:SetPoint("BOTTOMRIGHT")
if self.content.original_width then
self.content.width = self.content.original_width
end
self:DoLayout()
end
else
if not self.scrollBarShown then
self.scrollBarShown = true
self.scrollbar:Show()
self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
if self.content.original_width then
self.content.width = self.content.original_width - 20
end
self:DoLayout()
end
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.scrollbar:SetValue(value)
self:SetScroll(value)
if value < 1000 then
self.content:ClearAllPoints()
self.content:SetPoint("TOPLEFT", 0, offset)
self.content:SetPoint("TOPRIGHT", 0, offset)
status.offset = offset
end
end
self.updateLock = nil
end,
["LayoutFinished"] = function(self, width, height)
self.content:SetHeight(height or 0 + 20)
-- update the scrollframe
self:FixScroll()
-- schedule another update when everything has "settled"
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
end,
["SetStatusTable"] = function(self, status)
assert(type(status) == "table")
self.status = status
if not status.scrollvalue then
status.scrollvalue = 0
end
end,
["OnWidthSet"] = function(self, width)
local content = self.content
content.width = width - (self.scrollBarShown and 20 or 0)
content.original_width = width
end,
["OnHeightSet"] = function(self, height)
local content = self.content
content.height = height
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
local num = AceGUI:GetNextWidgetNum(Type)
local scrollframe = CreateFrame("ScrollFrame", nil, frame)
scrollframe:SetPoint("TOPLEFT")
scrollframe:SetPoint("BOTTOMRIGHT")
scrollframe:EnableMouseWheel(true)
scrollframe:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
scrollframe:SetScript("OnSizeChanged", ScrollFrame_OnSizeChanged)
local scrollbar = CreateFrame("Slider", ("AceConfigDialogScrollFrame%dScrollBar"):format(num), scrollframe, "UIPanelScrollBarTemplate")
scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16)
scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16)
scrollbar:SetMinMaxValues(0, 1000)
scrollbar:SetValueStep(1)
scrollbar:SetValue(0)
scrollbar:SetWidth(16)
scrollbar:Hide()
-- set the script as the last step, so it doesn't fire yet
scrollbar:SetScript("OnValueChanged", ScrollBar_OnScrollValueChanged)
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetColorTexture(0, 0, 0, 0.4)
--Container Support
local content = CreateFrame("Frame", nil, scrollframe)
content:SetPoint("TOPLEFT")
content:SetPoint("TOPRIGHT")
content:SetHeight(400)
scrollframe:SetScrollChild(content)
local widget = {
localstatus = { scrollvalue = 0 },
scrollframe = scrollframe,
scrollbar = scrollbar,
content = content,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
scrollframe.obj, scrollbar.obj = widget, widget
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,69 +0,0 @@
--[[-----------------------------------------------------------------------------
SimpleGroup Container
Simple container widget that just groups widgets.
-------------------------------------------------------------------------------]]
local Type, Version = "SimpleGroup", 20
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(300)
self:SetHeight(100)
end,
-- ["OnRelease"] = nil,
["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end
self:SetHeight(height or 0)
end,
["OnWidthSet"] = function(self, width)
local content = self.content
content:SetWidth(width)
content.width = width
end,
["OnHeightSet"] = function(self, height)
local content = self.content
content:SetHeight(height)
content.height = height
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
--Container Support
local content = CreateFrame("Frame", nil, frame)
content:SetPoint("TOPLEFT")
content:SetPoint("BOTTOMRIGHT")
local widget = {
frame = frame,
content = content,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,349 +0,0 @@
--[[-----------------------------------------------------------------------------
TabGroup Container
Container that uses tabs on top to switch between groups.
-------------------------------------------------------------------------------]]
local Type, Version = "TabGroup", 37
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab
-- local upvalue storage used by BuildTabs
local widths = {}
local rowwidths = {}
local rowends = {}
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function UpdateTabLook(frame)
if frame.disabled then
PanelTemplates_SetDisabledTabState(frame)
elseif frame.selected then
PanelTemplates_SelectTab(frame)
else
PanelTemplates_DeselectTab(frame)
end
end
local function Tab_SetText(frame, text)
frame:_SetText(text)
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
PanelTemplates_TabResize(frame, 0, nil, nil, width, frame:GetFontString():GetStringWidth())
end
local function Tab_SetSelected(frame, selected)
frame.selected = selected
UpdateTabLook(frame)
end
local function Tab_SetDisabled(frame, disabled)
frame.disabled = disabled
UpdateTabLook(frame)
end
local function BuildTabsOnUpdate(frame)
local self = frame.obj
self:BuildTabs()
frame:SetScript("OnUpdate", nil)
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Tab_OnClick(frame)
if not (frame.selected or frame.disabled) then
PlaySound(841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB
frame.obj:SelectTab(frame.value)
end
end
local function Tab_OnEnter(frame)
local self = frame.obj
self:Fire("OnTabEnter", self.tabs[frame.id].value, frame)
end
local function Tab_OnLeave(frame)
local self = frame.obj
self:Fire("OnTabLeave", self.tabs[frame.id].value, frame)
end
local function Tab_OnShow(frame)
_G[frame:GetName().."HighlightTexture"]:SetWidth(frame:GetTextWidth() + 30)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetTitle()
end,
["OnRelease"] = function(self)
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
self.tablist = nil
for _, tab in pairs(self.tabs) do
tab:Hide()
end
end,
["CreateTab"] = function(self, id)
local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
local tab = CreateFrame("Button", tabname, self.border, "OptionsFrameTabButtonTemplate")
tab.obj = self
tab.id = id
tab.text = _G[tabname .. "Text"]
tab.text:ClearAllPoints()
tab.text:SetPoint("LEFT", 14, -3)
tab.text:SetPoint("RIGHT", -12, -3)
tab:SetScript("OnClick", Tab_OnClick)
tab:SetScript("OnEnter", Tab_OnEnter)
tab:SetScript("OnLeave", Tab_OnLeave)
tab:SetScript("OnShow", Tab_OnShow)
tab._SetText = tab.SetText
tab.SetText = Tab_SetText
tab.SetSelected = Tab_SetSelected
tab.SetDisabled = Tab_SetDisabled
return tab
end,
["SetTitle"] = function(self, text)
self.titletext:SetText(text or "")
if text and text ~= "" then
self.alignoffset = 25
else
self.alignoffset = 18
end
self:BuildTabs()
end,
["SetStatusTable"] = function(self, status)
assert(type(status) == "table")
self.status = status
end,
["SelectTab"] = function(self, value)
local status = self.status or self.localstatus
local found
for i, v in ipairs(self.tabs) do
if v.value == value then
v:SetSelected(true)
found = true
else
v:SetSelected(false)
end
end
status.selected = value
if found then
self:Fire("OnGroupSelected",value)
end
end,
["SetTabs"] = function(self, tabs)
self.tablist = tabs
self:BuildTabs()
end,
["BuildTabs"] = function(self)
local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "")
local tablist = self.tablist
local tabs = self.tabs
if not tablist then return end
local width = self.frame.width or self.frame:GetWidth() or 0
wipe(widths)
wipe(rowwidths)
wipe(rowends)
--Place Text into tabs and get thier initial width
for i, v in ipairs(tablist) do
local tab = tabs[i]
if not tab then
tab = self:CreateTab(i)
tabs[i] = tab
end
tab:Show()
tab:SetText(v.text)
tab:SetDisabled(v.disabled)
tab.value = v.value
widths[i] = tab:GetWidth() - 6 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing, but add a fixed 4px padding for the text
end
for i = (#tablist)+1, #tabs, 1 do
tabs[i]:Hide()
end
--First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
local numtabs = #tablist
local numrows = 1
local usedwidth = 0
for i = 1, #tablist do
--If this is not the first tab of a row and there isn't room for it
if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
rowends[numrows] = i - 1
numrows = numrows + 1
usedwidth = 0
end
usedwidth = usedwidth + widths[i]
end
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
rowends[numrows] = #tablist
--Fix for single tabs being left on the last row, move a tab from the row above if applicable
if numrows > 1 then
--if the last row has only one tab
if rowends[numrows-1] == numtabs-1 then
--if there are more than 2 tabs in the 2nd last row
if (numrows == 2 and rowends[numrows-1] > 2) or (rowends[numrows] - rowends[numrows-1] > 2) then
--move 1 tab from the second last row to the last, if there is enough space
if (rowwidths[numrows] + widths[numtabs-1]) <= width then
rowends[numrows-1] = rowends[numrows-1] - 1
rowwidths[numrows] = rowwidths[numrows] + widths[numtabs-1]
rowwidths[numrows-1] = rowwidths[numrows-1] - widths[numtabs-1]
end
end
end
end
--anchor the rows as defined and resize tabs to fill thier row
local starttab = 1
for row, endtab in ipairs(rowends) do
local first = true
for tabno = starttab, endtab do
local tab = tabs[tabno]
tab:ClearAllPoints()
if first then
tab:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -(hastitle and 14 or 7)-(row-1)*20 )
first = false
else
tab:SetPoint("LEFT", tabs[tabno-1], "RIGHT", -10, 0)
end
end
-- equal padding for each tab to fill the available width,
-- if the used space is above 75% already
-- the 18 pixel is the typical width of a scrollbar, so we can have a tab group inside a scrolling frame,
-- and not have the tabs jump around funny when switching between tabs that need scrolling and those that don't
local padding = 0
if not (numrows == 1 and rowwidths[1] < width*0.75 - 18) then
padding = (width - rowwidths[row]) / (endtab - starttab+1)
end
for i = starttab, endtab do
PanelTemplates_TabResize(tabs[i], padding + 4, nil, nil, width, tabs[i]:GetFontString():GetStringWidth())
end
starttab = endtab + 1
end
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)
self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
end,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 60
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
self:BuildTabs(self)
self.frame:SetScript("OnUpdate", BuildTabsOnUpdate)
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - (self.borderoffset + 23)
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end,
["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end
self:SetHeight((height or 0) + (self.borderoffset + 23))
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame",nil,UIParent)
frame:SetHeight(100)
frame:SetWidth(100)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal")
titletext:SetPoint("TOPLEFT", 14, 0)
titletext:SetPoint("TOPRIGHT", -14, 0)
titletext:SetJustifyH("LEFT")
titletext:SetHeight(18)
titletext:SetText("")
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
border:SetPoint("TOPLEFT", 1, -27)
border:SetPoint("BOTTOMRIGHT", -1, 3)
border:SetBackdrop(PaneBackdrop)
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
local content = CreateFrame("Frame", nil, border)
content:SetPoint("TOPLEFT", 10, -7)
content:SetPoint("BOTTOMRIGHT", -10, 7)
local widget = {
num = num,
frame = frame,
localstatus = {},
alignoffset = 18,
titletext = titletext,
border = border,
borderoffset = 27,
tabs = {},
content = content,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,715 +0,0 @@
--[[-----------------------------------------------------------------------------
TreeGroup Container
Container that uses a tree control to switch between groups.
-------------------------------------------------------------------------------]]
local Type, Version = "TreeGroup", 45
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
local math_min, math_max, floor = math.min, math.max, floor
local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: FONT_COLOR_CODE_CLOSE
-- Recycling functions
local new, del
do
local pool = setmetatable({},{__mode='k'})
function new()
local t = next(pool)
if t then
pool[t] = nil
return t
else
return {}
end
end
function del(t)
for k in pairs(t) do
t[k] = nil
end
pool[t] = true
end
end
local DEFAULT_TREE_WIDTH = 175
local DEFAULT_TREE_SIZABLE = true
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function GetButtonUniqueValue(line)
local parent = line.parent
if parent and parent.value then
return GetButtonUniqueValue(parent).."\001"..line.value
else
return line.value
end
end
local function UpdateButton(button, treeline, selected, canExpand, isExpanded)
local self = button.obj
local toggle = button.toggle
local text = treeline.text or ""
local icon = treeline.icon
local iconCoords = treeline.iconCoords
local level = treeline.level
local value = treeline.value
local uniquevalue = treeline.uniquevalue
local disabled = treeline.disabled
button.treeline = treeline
button.value = value
button.uniquevalue = uniquevalue
if selected then
button:LockHighlight()
button.selected = true
else
button:UnlockHighlight()
button.selected = false
end
button.level = level
if ( level == 1 ) then
button:SetNormalFontObject("GameFontNormal")
button:SetHighlightFontObject("GameFontHighlight")
button.text:SetPoint("LEFT", (icon and 16 or 0) + 8, 2)
else
button:SetNormalFontObject("GameFontHighlightSmall")
button:SetHighlightFontObject("GameFontHighlightSmall")
button.text:SetPoint("LEFT", (icon and 16 or 0) + 8 * level, 2)
end
if disabled then
button:EnableMouse(false)
button.text:SetText("|cff808080"..text..FONT_COLOR_CODE_CLOSE)
else
button.text:SetText(text)
button:EnableMouse(true)
end
if icon then
button.icon:SetTexture(icon)
button.icon:SetPoint("LEFT", 8 * level, (level == 1) and 0 or 1)
else
button.icon:SetTexture(nil)
end
if iconCoords then
button.icon:SetTexCoord(unpack(iconCoords))
else
button.icon:SetTexCoord(0, 1, 0, 1)
end
if canExpand then
if not isExpanded then
toggle:SetNormalTexture(130838) -- Interface\\Buttons\\UI-PlusButton-UP
toggle:SetPushedTexture(130836) -- Interface\\Buttons\\UI-PlusButton-DOWN
else
toggle:SetNormalTexture(130821) -- Interface\\Buttons\\UI-MinusButton-UP
toggle:SetPushedTexture(130820) -- Interface\\Buttons\\UI-MinusButton-DOWN
end
toggle:Show()
else
toggle:Hide()
end
end
local function ShouldDisplayLevel(tree)
local result = false
for k, v in ipairs(tree) do
if v.children == nil and v.visible ~= false then
result = true
elseif v.children then
result = result or ShouldDisplayLevel(v.children)
end
if result then return result end
end
return false
end
local function addLine(self, v, tree, level, parent)
local line = new()
line.value = v.value
line.text = v.text
line.icon = v.icon
line.iconCoords = v.iconCoords
line.disabled = v.disabled
line.tree = tree
line.level = level
line.parent = parent
line.visible = v.visible
line.uniquevalue = GetButtonUniqueValue(line)
if v.children then
line.hasChildren = true
else
line.hasChildren = nil
end
self.lines[#self.lines+1] = line
return line
end
--fire an update after one frame to catch the treeframes height
local function FirstFrameUpdate(frame)
local self = frame.obj
frame:SetScript("OnUpdate", nil)
self:RefreshTree(nil, true)
end
local function BuildUniqueValue(...)
local n = select('#', ...)
if n == 1 then
return ...
else
return (...).."\001"..BuildUniqueValue(select(2,...))
end
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Expand_OnClick(frame)
local button = frame.button
local self = button.obj
local status = (self.status or self.localstatus).groups
status[button.uniquevalue] = not status[button.uniquevalue]
self:RefreshTree()
end
local function Button_OnClick(frame)
local self = frame.obj
self:Fire("OnClick", frame.uniquevalue, frame.selected)
if not frame.selected then
self:SetSelected(frame.uniquevalue)
frame.selected = true
frame:LockHighlight()
self:RefreshTree()
end
AceGUI:ClearFocus()
end
local function Button_OnDoubleClick(button)
local self = button.obj
local status = (self.status or self.localstatus).groups
status[button.uniquevalue] = not status[button.uniquevalue]
self:RefreshTree()
end
local function Button_OnEnter(frame)
local self = frame.obj
self:Fire("OnButtonEnter", frame.uniquevalue, frame)
if self.enabletooltips then
local tooltip = AceGUI.tooltip
tooltip:SetOwner(frame, "ANCHOR_NONE")
tooltip:ClearAllPoints()
tooltip:SetPoint("LEFT",frame,"RIGHT")
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true)
tooltip:Show()
end
end
local function Button_OnLeave(frame)
local self = frame.obj
self:Fire("OnButtonLeave", frame.uniquevalue, frame)
if self.enabletooltips then
AceGUI.tooltip:Hide()
end
end
local function OnScrollValueChanged(frame, value)
if frame.obj.noupdate then return end
local self = frame.obj
local status = self.status or self.localstatus
status.scrollvalue = floor(value + 0.5)
self:RefreshTree()
AceGUI:ClearFocus()
end
local function Tree_OnSizeChanged(frame)
frame.obj:RefreshTree()
end
local function Tree_OnMouseWheel(frame, delta)
local self = frame.obj
if self.showscroll then
local scrollbar = self.scrollbar
local min, max = scrollbar:GetMinMaxValues()
local value = scrollbar:GetValue()
local newvalue = math_min(max,math_max(min,value - delta))
if value ~= newvalue then
scrollbar:SetValue(newvalue)
end
end
end
local function Dragger_OnLeave(frame)
frame:SetBackdropColor(1, 1, 1, 0)
end
local function Dragger_OnEnter(frame)
frame:SetBackdropColor(1, 1, 1, 0.8)
end
local function Dragger_OnMouseDown(frame)
local treeframe = frame:GetParent()
treeframe:StartSizing("RIGHT")
end
local function Dragger_OnMouseUp(frame)
local treeframe = frame:GetParent()
local self = treeframe.obj
local treeframeParent = treeframe:GetParent()
treeframe:StopMovingOrSizing()
--treeframe:SetScript("OnUpdate", nil)
treeframe:SetUserPlaced(false)
--Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize
treeframe:SetHeight(0)
treeframe:ClearAllPoints()
treeframe:SetPoint("TOPLEFT", treeframeParent, "TOPLEFT",0,0)
treeframe:SetPoint("BOTTOMLEFT", treeframeParent, "BOTTOMLEFT",0,0)
local status = self.status or self.localstatus
status.treewidth = treeframe:GetWidth()
treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth())
-- recalculate the content width
treeframe.obj:OnWidthSet(status.fullwidth)
-- update the layout of the content
treeframe.obj:DoLayout()
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
self:EnableButtonTooltips(true)
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
end,
["OnRelease"] = function(self)
self.status = nil
self.tree = nil
self.frame:SetScript("OnUpdate", nil)
for k, v in pairs(self.localstatus) do
if k == "groups" then
for k2 in pairs(v) do
v[k2] = nil
end
else
self.localstatus[k] = nil
end
end
self.localstatus.scrollvalue = 0
self.localstatus.treewidth = DEFAULT_TREE_WIDTH
self.localstatus.treesizable = DEFAULT_TREE_SIZABLE
end,
["EnableButtonTooltips"] = function(self, enable)
self.enabletooltips = enable
end,
["CreateButton"] = function(self)
local num = AceGUI:GetNextWidgetNum("TreeGroupButton")
local button = CreateFrame("Button", ("AceGUI30TreeButton%d"):format(num), self.treeframe, "OptionsListButtonTemplate")
button.obj = self
local icon = button:CreateTexture(nil, "OVERLAY")
icon:SetWidth(14)
icon:SetHeight(14)
button.icon = icon
button:SetScript("OnClick",Button_OnClick)
button:SetScript("OnDoubleClick", Button_OnDoubleClick)
button:SetScript("OnEnter",Button_OnEnter)
button:SetScript("OnLeave",Button_OnLeave)
button.toggle.button = button
button.toggle:SetScript("OnClick",Expand_OnClick)
button.text:SetHeight(14) -- Prevents text wrapping
return button
end,
["SetStatusTable"] = function(self, status)
assert(type(status) == "table")
self.status = status
if not status.groups then
status.groups = {}
end
if not status.scrollvalue then
status.scrollvalue = 0
end
if not status.treewidth then
status.treewidth = DEFAULT_TREE_WIDTH
end
if status.treesizable == nil then
status.treesizable = DEFAULT_TREE_SIZABLE
end
self:SetTreeWidth(status.treewidth,status.treesizable)
self:RefreshTree()
end,
--sets the tree to be displayed
["SetTree"] = function(self, tree, filter)
self.filter = filter
if tree then
assert(type(tree) == "table")
end
self.tree = tree
self:RefreshTree()
end,
["BuildLevel"] = function(self, tree, level, parent)
local groups = (self.status or self.localstatus).groups
for i, v in ipairs(tree) do
if v.children then
if not self.filter or ShouldDisplayLevel(v.children) then
local line = addLine(self, v, tree, level, parent)
if groups[line.uniquevalue] then
self:BuildLevel(v.children, level+1, line)
end
end
elseif v.visible ~= false or not self.filter then
addLine(self, v, tree, level, parent)
end
end
end,
["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
local buttons = self.buttons
local lines = self.lines
for i, v in ipairs(buttons) do
v:Hide()
end
while lines[1] do
local t = tremove(lines)
for k in pairs(t) do
t[k] = nil
end
del(t)
end
if not self.tree then return end
--Build the list of visible entries from the tree and status tables
local status = self.status or self.localstatus
local groupstatus = status.groups
local tree = self.tree
local treeframe = self.treeframe
status.scrollToSelection = status.scrollToSelection or scrollToSelection -- needs to be cached in case the control hasn't been drawn yet (code bails out below)
self:BuildLevel(tree, 1)
local numlines = #lines
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
if maxlines <= 0 then return end
if self.frame:GetParent() == UIParent and not fromOnUpdate then
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
return
end
local first, last
scrollToSelection = status.scrollToSelection
status.scrollToSelection = nil
if numlines <= maxlines then
--the whole tree fits in the frame
status.scrollvalue = 0
self:ShowScroll(false)
first, last = 1, numlines
else
self:ShowScroll(true)
--scrolling will be needed
self.noupdate = true
self.scrollbar:SetMinMaxValues(0, numlines - maxlines)
--check if we are scrolled down too far
if numlines - status.scrollvalue < maxlines then
status.scrollvalue = numlines - maxlines
end
self.noupdate = nil
first, last = status.scrollvalue+1, status.scrollvalue + maxlines
--show selection?
if scrollToSelection and status.selected then
local show
for i,line in ipairs(lines) do -- find the line number
if line.uniquevalue==status.selected then
show=i
end
end
if not show then
-- selection was deleted or something?
elseif show>=first and show<=last then
-- all good
else
-- scrolling needed!
if show<first then
status.scrollvalue = show-1
else
status.scrollvalue = show-maxlines
end
first, last = status.scrollvalue+1, status.scrollvalue + maxlines
end
end
if self.scrollbar:GetValue() ~= status.scrollvalue then
self.scrollbar:SetValue(status.scrollvalue)
end
end
local buttonnum = 1
for i = first, last do
local line = lines[i]
local button = buttons[buttonnum]
if not button then
button = self:CreateButton()
buttons[buttonnum] = button
button:SetParent(treeframe)
button:SetFrameLevel(treeframe:GetFrameLevel()+1)
button:ClearAllPoints()
if buttonnum == 1 then
if self.showscroll then
button:SetPoint("TOPRIGHT", -22, -10)
button:SetPoint("TOPLEFT", 0, -10)
else
button:SetPoint("TOPRIGHT", 0, -10)
button:SetPoint("TOPLEFT", 0, -10)
end
else
button:SetPoint("TOPRIGHT", buttons[buttonnum-1], "BOTTOMRIGHT",0,0)
button:SetPoint("TOPLEFT", buttons[buttonnum-1], "BOTTOMLEFT",0,0)
end
end
UpdateButton(button, line, status.selected == line.uniquevalue, line.hasChildren, groupstatus[line.uniquevalue] )
button:Show()
buttonnum = buttonnum + 1
end
end,
["SetSelected"] = function(self, value)
local status = self.status or self.localstatus
if status.selected ~= value then
status.selected = value
self:Fire("OnGroupSelected", value)
end
end,
["Select"] = function(self, uniquevalue, ...)
self.filter = false
local status = self.status or self.localstatus
local groups = status.groups
local path = {...}
for i = 1, #path do
groups[tconcat(path, "\001", 1, i)] = true
end
status.selected = uniquevalue
self:RefreshTree(true)
self:Fire("OnGroupSelected", uniquevalue)
end,
["SelectByPath"] = function(self, ...)
self:Select(BuildUniqueValue(...), ...)
end,
["SelectByValue"] = function(self, uniquevalue)
self:Select(uniquevalue, ("\001"):split(uniquevalue))
end,
["ShowScroll"] = function(self, show)
self.showscroll = show
if show then
self.scrollbar:Show()
if self.buttons[1] then
self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",-22,-10)
end
else
self.scrollbar:Hide()
if self.buttons[1] then
self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",0,-10)
end
end
end,
["OnWidthSet"] = function(self, width)
local content = self.content
local treeframe = self.treeframe
local status = self.status or self.localstatus
status.fullwidth = width
local contentwidth = width - status.treewidth - 20
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
local maxtreewidth = math_min(400, width - 50)
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
self:SetTreeWidth(maxtreewidth, status.treesizable)
end
treeframe:SetMaxResize(maxtreewidth, 1600)
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 20
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end,
["SetTreeWidth"] = function(self, treewidth, resizable)
if not resizable then
if type(treewidth) == 'number' then
resizable = false
elseif type(treewidth) == 'boolean' then
resizable = treewidth
treewidth = DEFAULT_TREE_WIDTH
else
resizable = false
treewidth = DEFAULT_TREE_WIDTH
end
end
self.treeframe:SetWidth(treewidth)
self.dragger:EnableMouse(resizable)
local status = self.status or self.localstatus
status.treewidth = treewidth
status.treesizable = resizable
-- recalculate the content width
if status.fullwidth then
self:OnWidthSet(status.fullwidth)
end
end,
["GetTreeWidth"] = function(self)
local status = self.status or self.localstatus
return status.treewidth or DEFAULT_TREE_WIDTH
end,
["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end
self:SetHeight((height or 0) + 20)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
local DraggerBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = nil,
tile = true, tileSize = 16, edgeSize = 1,
insets = { left = 3, right = 3, top = 7, bottom = 7 }
}
local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
local treeframe = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
treeframe:SetPoint("TOPLEFT")
treeframe:SetPoint("BOTTOMLEFT")
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
treeframe:EnableMouseWheel(true)
treeframe:SetBackdrop(PaneBackdrop)
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
treeframe:SetResizable(true)
treeframe:SetMinResize(100, 1)
treeframe:SetMaxResize(400, 1600)
treeframe:SetScript("OnUpdate", FirstFrameUpdate)
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
local dragger = CreateFrame("Frame", nil, treeframe, BackdropTemplateMixin and "BackdropTemplate" or nil)
dragger:SetWidth(8)
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
dragger:SetBackdrop(DraggerBackdrop)
dragger:SetBackdropColor(1, 1, 1, 0)
dragger:SetScript("OnEnter", Dragger_OnEnter)
dragger:SetScript("OnLeave", Dragger_OnLeave)
dragger:SetScript("OnMouseDown", Dragger_OnMouseDown)
dragger:SetScript("OnMouseUp", Dragger_OnMouseUp)
local scrollbar = CreateFrame("Slider", ("AceConfigDialogTreeGroup%dScrollBar"):format(num), treeframe, "UIPanelScrollBarTemplate")
scrollbar:SetScript("OnValueChanged", nil)
scrollbar:SetPoint("TOPRIGHT", -10, -26)
scrollbar:SetPoint("BOTTOMRIGHT", -10, 26)
scrollbar:SetMinMaxValues(0,0)
scrollbar:SetValueStep(1)
scrollbar:SetValue(0)
scrollbar:SetWidth(16)
scrollbar:SetScript("OnValueChanged", OnScrollValueChanged)
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetColorTexture(0,0,0,0.4)
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT")
border:SetPoint("BOTTOMRIGHT")
border:SetBackdrop(PaneBackdrop)
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
--Container Support
local content = CreateFrame("Frame", nil, border)
content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local widget = {
frame = frame,
lines = {},
levels = {},
buttons = {},
hasChildren = {},
localstatus = { groups = {}, scrollvalue = 0 },
filter = false,
treeframe = treeframe,
dragger = dragger,
scrollbar = scrollbar,
border = border,
content = content,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
treeframe.obj, dragger.obj, scrollbar.obj = widget, widget, widget
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,336 +0,0 @@
local AceGUI = LibStub("AceGUI-3.0")
-- Lua APIs
local pairs, assert, type = pairs, assert, type
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontNormal
----------------
-- Main Frame --
----------------
--[[
Events :
OnClose
]]
do
local Type = "Window"
local Version = 6
local function frameOnShow(this)
this.obj:Fire("OnShow")
end
local function frameOnClose(this)
this.obj:Fire("OnClose")
end
local function closeOnClick(this)
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
this.obj:Hide()
end
local function frameOnMouseDown(this)
AceGUI:ClearFocus()
end
local function titleOnMouseDown(this)
this:GetParent():StartMoving()
AceGUI:ClearFocus()
end
local function frameOnMouseUp(this)
local frame = this:GetParent()
frame:StopMovingOrSizing()
local self = frame.obj
local status = self.status or self.localstatus
status.width = frame:GetWidth()
status.height = frame:GetHeight()
status.top = frame:GetTop()
status.left = frame:GetLeft()
end
local function sizerseOnMouseDown(this)
this:GetParent():StartSizing("BOTTOMRIGHT")
AceGUI:ClearFocus()
end
local function sizersOnMouseDown(this)
this:GetParent():StartSizing("BOTTOM")
AceGUI:ClearFocus()
end
local function sizereOnMouseDown(this)
this:GetParent():StartSizing("RIGHT")
AceGUI:ClearFocus()
end
local function sizerOnMouseUp(this)
this:GetParent():StopMovingOrSizing()
end
local function SetTitle(self,title)
self.titletext:SetText(title)
end
local function SetStatusText(self,text)
-- self.statustext:SetText(text)
end
local function Hide(self)
self.frame:Hide()
end
local function Show(self)
self.frame:Show()
end
local function OnAcquire(self)
self.frame:SetParent(UIParent)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
self:ApplyStatus()
self:EnableResize(true)
self:Show()
end
local function OnRelease(self)
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
end
-- called to set an external table to store status in
local function SetStatusTable(self, status)
assert(type(status) == "table")
self.status = status
self:ApplyStatus()
end
local function ApplyStatus(self)
local status = self.status or self.localstatus
local frame = self.frame
self:SetWidth(status.width or 700)
self:SetHeight(status.height or 500)
if status.top and status.left then
frame:SetPoint("TOP",UIParent,"BOTTOM",0,status.top)
frame:SetPoint("LEFT",UIParent,"LEFT",status.left,0)
else
frame:SetPoint("CENTER",UIParent,"CENTER")
end
end
local function OnWidthSet(self, width)
local content = self.content
local contentwidth = width - 34
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end
local function OnHeightSet(self, height)
local content = self.content
local contentheight = height - 57
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end
local function EnableResize(self, state)
local func = state and "Show" or "Hide"
self.sizer_se[func](self.sizer_se)
self.sizer_s[func](self.sizer_s)
self.sizer_e[func](self.sizer_e)
end
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
local self = {}
self.type = "Window"
self.Hide = Hide
self.Show = Show
self.SetTitle = SetTitle
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetStatusText = SetStatusText
self.SetStatusTable = SetStatusTable
self.ApplyStatus = ApplyStatus
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
self.EnableResize = EnableResize
self.localstatus = {}
self.frame = frame
frame.obj = self
frame:SetWidth(700)
frame:SetHeight(500)
frame:SetPoint("CENTER",UIParent,"CENTER",0,0)
frame:EnableMouse()
frame:SetMovable(true)
frame:SetResizable(true)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetScript("OnMouseDown", frameOnMouseDown)
frame:SetScript("OnShow",frameOnShow)
frame:SetScript("OnHide",frameOnClose)
frame:SetMinResize(240,240)
frame:SetToplevel(true)
local titlebg = frame:CreateTexture(nil, "BACKGROUND")
titlebg:SetTexture(251966) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background
titlebg:SetPoint("TOPLEFT", 9, -6)
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
dialogbg:SetTexture(137056) -- Interface\\Tooltips\\UI-Tooltip-Background
dialogbg:SetPoint("TOPLEFT", 8, -24)
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
dialogbg:SetVertexColor(0, 0, 0, .75)
local topleft = frame:CreateTexture(nil, "BORDER")
topleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
topleft:SetWidth(64)
topleft:SetHeight(64)
topleft:SetPoint("TOPLEFT")
topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
local topright = frame:CreateTexture(nil, "BORDER")
topright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
topright:SetWidth(64)
topright:SetHeight(64)
topright:SetPoint("TOPRIGHT")
topright:SetTexCoord(0.625, 0.75, 0, 1)
local top = frame:CreateTexture(nil, "BORDER")
top:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
top:SetHeight(64)
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
top:SetTexCoord(0.25, 0.369140625, 0, 1)
local bottomleft = frame:CreateTexture(nil, "BORDER")
bottomleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
bottomleft:SetWidth(64)
bottomleft:SetHeight(64)
bottomleft:SetPoint("BOTTOMLEFT")
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
local bottomright = frame:CreateTexture(nil, "BORDER")
bottomright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
bottomright:SetWidth(64)
bottomright:SetHeight(64)
bottomright:SetPoint("BOTTOMRIGHT")
bottomright:SetTexCoord(0.875, 1, 0, 1)
local bottom = frame:CreateTexture(nil, "BORDER")
bottom:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
bottom:SetHeight(64)
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
local left = frame:CreateTexture(nil, "BORDER")
left:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
left:SetWidth(64)
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
left:SetTexCoord(0.001953125, 0.125, 0, 1)
local right = frame:CreateTexture(nil, "BORDER")
right:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
right:SetWidth(64)
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
right:SetTexCoord(0.1171875, 0.2421875, 0, 1)
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", 2, 1)
close:SetScript("OnClick", closeOnClick)
self.closebutton = close
close.obj = self
local titletext = frame:CreateFontString(nil, "ARTWORK")
titletext:SetFontObject(GameFontNormal)
titletext:SetPoint("TOPLEFT", 12, -8)
titletext:SetPoint("TOPRIGHT", -32, -8)
self.titletext = titletext
local title = CreateFrame("Button", nil, frame)
title:SetPoint("TOPLEFT", titlebg)
title:SetPoint("BOTTOMRIGHT", titlebg)
title:EnableMouse()
title:SetScript("OnMouseDown",titleOnMouseDown)
title:SetScript("OnMouseUp", frameOnMouseUp)
self.title = title
local sizer_se = CreateFrame("Frame",nil,frame)
sizer_se:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0)
sizer_se:SetWidth(25)
sizer_se:SetHeight(25)
sizer_se:EnableMouse()
sizer_se:SetScript("OnMouseDown",sizerseOnMouseDown)
sizer_se:SetScript("OnMouseUp", sizerOnMouseUp)
self.sizer_se = sizer_se
local line1 = sizer_se:CreateTexture(nil, "BACKGROUND")
self.line1 = line1
line1:SetWidth(14)
line1:SetHeight(14)
line1:SetPoint("BOTTOMRIGHT", -8, 8)
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
local x = 0.1 * 14/17
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
local line2 = sizer_se:CreateTexture(nil, "BACKGROUND")
self.line2 = line2
line2:SetWidth(8)
line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
local x = 0.1 * 8/17
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
local sizer_s = CreateFrame("Frame",nil,frame)
sizer_s:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-25,0)
sizer_s:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0)
sizer_s:SetHeight(25)
sizer_s:EnableMouse()
sizer_s:SetScript("OnMouseDown",sizersOnMouseDown)
sizer_s:SetScript("OnMouseUp", sizerOnMouseUp)
self.sizer_s = sizer_s
local sizer_e = CreateFrame("Frame",nil,frame)
sizer_e:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,25)
sizer_e:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
sizer_e:SetWidth(25)
sizer_e:EnableMouse()
sizer_e:SetScript("OnMouseDown",sizereOnMouseDown)
sizer_e:SetScript("OnMouseUp", sizerOnMouseUp)
self.sizer_e = sizer_e
--Container Support
local content = CreateFrame("Frame",nil,frame)
self.content = content
content.obj = self
content:SetPoint("TOPLEFT",frame,"TOPLEFT",12,-32)
content:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-12,13)
AceGUI:RegisterAsContainer(self)
return self
end
AceGUI:RegisterWidgetType(Type,Constructor,Version)
end
@@ -1,103 +0,0 @@
--[[-----------------------------------------------------------------------------
Button Widget
Graphical Button.
-------------------------------------------------------------------------------]]
local Type, Version = "Button", 24
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local _G = _G
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Button_OnClick(frame, ...)
AceGUI:ClearFocus()
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
frame.obj:Fire("OnClick", ...)
end
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
-- restore default values
self:SetHeight(24)
self:SetWidth(200)
self:SetDisabled(false)
self:SetAutoWidth(false)
self:SetText()
end,
-- ["OnRelease"] = nil,
["SetText"] = function(self, text)
self.text:SetText(text)
if self.autoWidth then
self:SetWidth(self.text:GetStringWidth() + 30)
end
end,
["SetAutoWidth"] = function(self, autoWidth)
self.autoWidth = autoWidth
if self.autoWidth then
self:SetWidth(self.text:GetStringWidth() + 30)
end
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.frame:Disable()
else
self.frame:Enable()
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
frame:Hide()
frame:EnableMouse(true)
frame:SetScript("OnClick", Button_OnClick)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
local text = frame:GetFontString()
text:ClearAllPoints()
text:SetPoint("TOPLEFT", 15, -1)
text:SetPoint("BOTTOMRIGHT", -15, 1)
text:SetJustifyV("MIDDLE")
local widget = {
text = text,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,296 +0,0 @@
--[[-----------------------------------------------------------------------------
Checkbox Widget
-------------------------------------------------------------------------------]]
local Type, Version = "CheckBox", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local select, pairs = select, pairs
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: SetDesaturation, GameFontHighlight
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function AlignImage(self)
local img = self.image:GetTexture()
self.text:ClearAllPoints()
if not img then
self.text:SetPoint("LEFT", self.checkbg, "RIGHT")
self.text:SetPoint("RIGHT")
else
self.text:SetPoint("LEFT", self.image, "RIGHT", 1, 0)
self.text:SetPoint("RIGHT")
end
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function CheckBox_OnMouseDown(frame)
local self = frame.obj
if not self.disabled then
if self.image:GetTexture() then
self.text:SetPoint("LEFT", self.image,"RIGHT", 2, -1)
else
self.text:SetPoint("LEFT", self.checkbg, "RIGHT", 1, -1)
end
end
AceGUI:ClearFocus()
end
local function CheckBox_OnMouseUp(frame)
local self = frame.obj
if not self.disabled then
self:ToggleChecked()
if self.checked then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
else -- for both nil and false (tristate)
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
end
self:Fire("OnValueChanged", self.checked)
AlignImage(self)
end
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetType()
self:SetValue(false)
self:SetTriState(nil)
-- height is calculated from the width and required space for the description
self:SetWidth(200)
self:SetImage()
self:SetDisabled(nil)
self:SetDescription(nil)
end,
-- ["OnRelease"] = nil,
["OnWidthSet"] = function(self, width)
if self.desc then
self.desc:SetWidth(width - 30)
if self.desc:GetText() and self.desc:GetText() ~= "" then
self:SetHeight(28 + self.desc:GetStringHeight())
end
end
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.frame:Disable()
self.text:SetTextColor(0.5, 0.5, 0.5)
SetDesaturation(self.check, true)
if self.desc then
self.desc:SetTextColor(0.5, 0.5, 0.5)
end
else
self.frame:Enable()
self.text:SetTextColor(1, 1, 1)
if self.tristate and self.checked == nil then
SetDesaturation(self.check, true)
else
SetDesaturation(self.check, false)
end
if self.desc then
self.desc:SetTextColor(1, 1, 1)
end
end
end,
["SetValue"] = function(self, value)
local check = self.check
self.checked = value
if value then
SetDesaturation(check, false)
check:Show()
else
--Nil is the unknown tristate value
if self.tristate and value == nil then
SetDesaturation(check, true)
check:Show()
else
SetDesaturation(check, false)
check:Hide()
end
end
self:SetDisabled(self.disabled)
end,
["GetValue"] = function(self)
return self.checked
end,
["SetTriState"] = function(self, enabled)
self.tristate = enabled
self:SetValue(self:GetValue())
end,
["SetType"] = function(self, type)
local checkbg = self.checkbg
local check = self.check
local highlight = self.highlight
local size
if type == "radio" then
size = 16
checkbg:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
checkbg:SetTexCoord(0, 0.25, 0, 1)
check:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
check:SetTexCoord(0.25, 0.5, 0, 1)
check:SetBlendMode("ADD")
highlight:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
highlight:SetTexCoord(0.5, 0.75, 0, 1)
else
size = 24
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up
checkbg:SetTexCoord(0, 1, 0, 1)
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
check:SetTexCoord(0, 1, 0, 1)
check:SetBlendMode("BLEND")
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight
highlight:SetTexCoord(0, 1, 0, 1)
end
checkbg:SetHeight(size)
checkbg:SetWidth(size)
end,
["ToggleChecked"] = function(self)
local value = self:GetValue()
if self.tristate then
--cycle in true, nil, false order
if value then
self:SetValue(nil)
elseif value == nil then
self:SetValue(false)
else
self:SetValue(true)
end
else
self:SetValue(not self:GetValue())
end
end,
["SetLabel"] = function(self, label)
self.text:SetText(label)
end,
["SetDescription"] = function(self, desc)
if desc then
if not self.desc then
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
desc:ClearAllPoints()
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
desc:SetWidth(self.frame.width - 30)
desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
desc:SetJustifyH("LEFT")
desc:SetJustifyV("TOP")
self.desc = desc
end
self.desc:Show()
--self.text:SetFontObject(GameFontNormal)
self.desc:SetText(desc)
self:SetHeight(28 + self.desc:GetStringHeight())
else
if self.desc then
self.desc:SetText("")
self.desc:Hide()
end
--self.text:SetFontObject(GameFontHighlight)
self:SetHeight(24)
end
end,
["SetImage"] = function(self, path, ...)
local image = self.image
image:SetTexture(path)
if image:GetTexture() then
local n = select("#", ...)
if n == 4 or n == 8 then
image:SetTexCoord(...)
else
image:SetTexCoord(0, 1, 0, 1)
end
end
AlignImage(self)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Button", nil, UIParent)
frame:Hide()
frame:EnableMouse(true)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
frame:SetScript("OnMouseDown", CheckBox_OnMouseDown)
frame:SetScript("OnMouseUp", CheckBox_OnMouseUp)
local checkbg = frame:CreateTexture(nil, "ARTWORK")
checkbg:SetWidth(24)
checkbg:SetHeight(24)
checkbg:SetPoint("TOPLEFT")
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up
local check = frame:CreateTexture(nil, "OVERLAY")
check:SetAllPoints(checkbg)
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
text:SetJustifyH("LEFT")
text:SetHeight(18)
text:SetPoint("LEFT", checkbg, "RIGHT")
text:SetPoint("RIGHT")
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight
highlight:SetBlendMode("ADD")
highlight:SetAllPoints(checkbg)
local image = frame:CreateTexture(nil, "OVERLAY")
image:SetHeight(16)
image:SetWidth(16)
image:SetPoint("LEFT", checkbg, "RIGHT", 1, 0)
local widget = {
checkbg = checkbg,
check = check,
text = text,
highlight = highlight,
image = image,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,190 +0,0 @@
--[[-----------------------------------------------------------------------------
ColorPicker Widget
-------------------------------------------------------------------------------]]
local Type, Version = "ColorPicker", 25
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: ColorPickerFrame, OpacitySliderFrame
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function ColorCallback(self, r, g, b, a, isAlpha)
if not self.HasAlpha then
a = 1
end
self:SetColor(r, g, b, a)
if ColorPickerFrame:IsVisible() then
--colorpicker is still open
self:Fire("OnValueChanged", r, g, b, a)
else
--colorpicker is closed, color callback is first, ignore it,
--alpha callback is the final call after it closes so confirm now
if isAlpha then
self:Fire("OnValueConfirmed", r, g, b, a)
end
end
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function ColorSwatch_OnClick(frame)
ColorPickerFrame:Hide()
local self = frame.obj
if not self.disabled then
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG")
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
ColorPickerFrame:SetClampedToScreen(true)
ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end
ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end
local r, g, b, a = self.r, self.g, self.b, self.a
if self.HasAlpha then
ColorPickerFrame.opacity = 1 - (a or 0)
end
ColorPickerFrame:SetColorRGB(r, g, b)
ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
end
ColorPickerFrame:Show()
end
AceGUI:ClearFocus()
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetHeight(24)
self:SetWidth(200)
self:SetHasAlpha(false)
self:SetColor(0, 0, 0, 1)
self:SetDisabled(nil)
self:SetLabel(nil)
end,
-- ["OnRelease"] = nil,
["SetLabel"] = function(self, text)
self.text:SetText(text)
end,
["SetColor"] = function(self, r, g, b, a)
self.r = r
self.g = g
self.b = b
self.a = a or 1
self.colorSwatch:SetVertexColor(r, g, b, a)
end,
["SetHasAlpha"] = function(self, HasAlpha)
self.HasAlpha = HasAlpha
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if self.disabled then
self.frame:Disable()
self.text:SetTextColor(0.5, 0.5, 0.5)
else
self.frame:Enable()
self.text:SetTextColor(1, 1, 1)
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Button", nil, UIParent)
frame:Hide()
frame:EnableMouse(true)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
frame:SetScript("OnClick", ColorSwatch_OnClick)
local colorSwatch = frame:CreateTexture(nil, "OVERLAY")
colorSwatch:SetWidth(19)
colorSwatch:SetHeight(19)
colorSwatch:SetTexture(130939) -- Interface\\ChatFrame\\ChatFrameColorSwatch
colorSwatch:SetPoint("LEFT")
local texture = frame:CreateTexture(nil, "BACKGROUND")
colorSwatch.background = texture
texture:SetWidth(16)
texture:SetHeight(16)
texture:SetColorTexture(1, 1, 1)
texture:SetPoint("CENTER", colorSwatch)
texture:Show()
local checkers = frame:CreateTexture(nil, "BACKGROUND")
colorSwatch.checkers = checkers
checkers:SetWidth(14)
checkers:SetHeight(14)
checkers:SetTexture(188523) -- Tileset\\Generic\\Checkers
checkers:SetTexCoord(.25, 0, 0.5, .25)
checkers:SetDesaturated(true)
checkers:SetVertexColor(1, 1, 1, 0.75)
checkers:SetPoint("CENTER", colorSwatch)
checkers:Show()
local text = frame:CreateFontString(nil,"OVERLAY","GameFontHighlight")
text:SetHeight(24)
text:SetJustifyH("LEFT")
text:SetTextColor(1, 1, 1)
text:SetPoint("LEFT", colorSwatch, "RIGHT", 2, 0)
text:SetPoint("RIGHT")
--local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
--highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight
--highlight:SetBlendMode("ADD")
--highlight:SetAllPoints(frame)
local widget = {
colorSwatch = colorSwatch,
text = text,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,471 +0,0 @@
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1202 2019-05-15 23:11:22Z nevcairiel $ ]]--
local AceGUI = LibStub("AceGUI-3.0")
-- Lua APIs
local select, assert = select, assert
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame = CreateFrame
local function fixlevels(parent,...)
local i = 1
local child = select(i, ...)
while child do
child:SetFrameLevel(parent:GetFrameLevel()+1)
fixlevels(child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
local function fixstrata(strata, parent, ...)
local i = 1
local child = select(i, ...)
parent:SetFrameStrata(strata)
while child do
fixstrata(strata, child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
-- ItemBase is the base "class" for all dropdown items.
-- Each item has to use ItemBase.Create(widgetType) to
-- create an initial 'self' value.
-- ItemBase will add common functions and ui event handlers.
-- Be sure to keep basic usage when you override functions.
local ItemBase = {
-- NOTE: The ItemBase version is added to each item's version number
-- to ensure proper updates on ItemBase changes.
-- Use at least 1000er steps.
version = 1000,
counter = 0,
}
function ItemBase.Frame_OnEnter(this)
local self = this.obj
if self.useHighlight then
self.highlight:Show()
end
self:Fire("OnEnter")
if self.specialOnEnter then
self.specialOnEnter(self)
end
end
function ItemBase.Frame_OnLeave(this)
local self = this.obj
self.highlight:Hide()
self:Fire("OnLeave")
if self.specialOnLeave then
self.specialOnLeave(self)
end
end
-- exported, AceGUI callback
function ItemBase.OnAcquire(self)
self.frame:SetToplevel(true)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
end
-- exported, AceGUI callback
function ItemBase.OnRelease(self)
self:SetDisabled(false)
self.pullout = nil
self.frame:SetParent(nil)
self.frame:ClearAllPoints()
self.frame:Hide()
end
-- exported
-- NOTE: this is called by a Dropdown-Pullout.
-- Do not call this method directly
function ItemBase.SetPullout(self, pullout)
self.pullout = pullout
self.frame:SetParent(nil)
self.frame:SetParent(pullout.itemFrame)
self.parent = pullout.itemFrame
fixlevels(pullout.itemFrame, pullout.itemFrame:GetChildren())
end
-- exported
function ItemBase.SetText(self, text)
self.text:SetText(text or "")
end
-- exported
function ItemBase.GetText(self)
return self.text:GetText()
end
-- exported
function ItemBase.SetPoint(self, ...)
self.frame:SetPoint(...)
end
-- exported
function ItemBase.Show(self)
self.frame:Show()
end
-- exported
function ItemBase.Hide(self)
self.frame:Hide()
end
-- exported
function ItemBase.SetDisabled(self, disabled)
self.disabled = disabled
if disabled then
self.useHighlight = false
self.text:SetTextColor(.5, .5, .5)
else
self.useHighlight = true
self.text:SetTextColor(1, 1, 1)
end
end
-- exported
-- NOTE: this is called by a Dropdown-Pullout.
-- Do not call this method directly
function ItemBase.SetOnLeave(self, func)
self.specialOnLeave = func
end
-- exported
-- NOTE: this is called by a Dropdown-Pullout.
-- Do not call this method directly
function ItemBase.SetOnEnter(self, func)
self.specialOnEnter = func
end
function ItemBase.Create(type)
-- NOTE: Most of the following code is copied from AceGUI-3.0/Dropdown widget
local count = AceGUI:GetNextWidgetNum(type)
local frame = CreateFrame("Button", "AceGUI30DropDownItem"..count)
local self = {}
self.frame = frame
frame.obj = self
self.type = type
self.useHighlight = true
frame:SetHeight(17)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
local text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
text:SetTextColor(1,1,1)
text:SetJustifyH("LEFT")
text:SetPoint("TOPLEFT",frame,"TOPLEFT",18,0)
text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-8,0)
self.text = text
local highlight = frame:CreateTexture(nil, "OVERLAY")
highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight
highlight:SetBlendMode("ADD")
highlight:SetHeight(14)
highlight:ClearAllPoints()
highlight:SetPoint("RIGHT",frame,"RIGHT",-3,0)
highlight:SetPoint("LEFT",frame,"LEFT",5,0)
highlight:Hide()
self.highlight = highlight
local check = frame:CreateTexture("OVERLAY")
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint("LEFT",frame,"LEFT",3,-1)
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
check:Hide()
self.check = check
local sub = frame:CreateTexture("OVERLAY")
sub:SetWidth(16)
sub:SetHeight(16)
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
sub:SetTexture(130940) -- Interface\\ChatFrame\\ChatFrameExpandArrow
sub:Hide()
self.sub = sub
frame:SetScript("OnEnter", ItemBase.Frame_OnEnter)
frame:SetScript("OnLeave", ItemBase.Frame_OnLeave)
self.OnAcquire = ItemBase.OnAcquire
self.OnRelease = ItemBase.OnRelease
self.SetPullout = ItemBase.SetPullout
self.GetText = ItemBase.GetText
self.SetText = ItemBase.SetText
self.SetDisabled = ItemBase.SetDisabled
self.SetPoint = ItemBase.SetPoint
self.Show = ItemBase.Show
self.Hide = ItemBase.Hide
self.SetOnLeave = ItemBase.SetOnLeave
self.SetOnEnter = ItemBase.SetOnEnter
return self
end
-- Register a dummy LibStub library to retrieve the ItemBase, so other addons can use it.
local IBLib = LibStub:NewLibrary("AceGUI-3.0-DropDown-ItemBase", ItemBase.version)
if IBLib then
IBLib.GetItemBase = function() return ItemBase end
end
--[[
Template for items:
-- Item:
--
do
local widgetType = "Dropdown-Item-"
local widgetVersion = 1
local function Constructor()
local self = ItemBase.Create(widgetType)
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
end
--]]
-- Item: Header
-- A single text entry.
-- Special: Different text color and no highlight
do
local widgetType = "Dropdown-Item-Header"
local widgetVersion = 1
local function OnEnter(this)
local self = this.obj
self:Fire("OnEnter")
if self.specialOnEnter then
self.specialOnEnter(self)
end
end
local function OnLeave(this)
local self = this.obj
self:Fire("OnLeave")
if self.specialOnLeave then
self.specialOnLeave(self)
end
end
-- exported, override
local function SetDisabled(self, disabled)
ItemBase.SetDisabled(self, disabled)
if not disabled then
self.text:SetTextColor(1, 1, 0)
end
end
local function Constructor()
local self = ItemBase.Create(widgetType)
self.SetDisabled = SetDisabled
self.frame:SetScript("OnEnter", OnEnter)
self.frame:SetScript("OnLeave", OnLeave)
self.text:SetTextColor(1, 1, 0)
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
end
-- Item: Execute
-- A simple button
do
local widgetType = "Dropdown-Item-Execute"
local widgetVersion = 1
local function Frame_OnClick(this, button)
local self = this.obj
if self.disabled then return end
self:Fire("OnClick")
if self.pullout then
self.pullout:Close()
end
end
local function Constructor()
local self = ItemBase.Create(widgetType)
self.frame:SetScript("OnClick", Frame_OnClick)
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
end
-- Item: Toggle
-- Some sort of checkbox for dropdown menus.
-- Does not close the pullout on click.
do
local widgetType = "Dropdown-Item-Toggle"
local widgetVersion = 4
local function UpdateToggle(self)
if self.value then
self.check:Show()
else
self.check:Hide()
end
end
local function OnRelease(self)
ItemBase.OnRelease(self)
self:SetValue(nil)
end
local function Frame_OnClick(this, button)
local self = this.obj
if self.disabled then return end
self.value = not self.value
if self.value then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
else
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
end
UpdateToggle(self)
self:Fire("OnValueChanged", self.value)
end
-- exported
local function SetValue(self, value)
self.value = value
UpdateToggle(self)
end
-- exported
local function GetValue(self)
return self.value
end
local function Constructor()
local self = ItemBase.Create(widgetType)
self.frame:SetScript("OnClick", Frame_OnClick)
self.SetValue = SetValue
self.GetValue = GetValue
self.OnRelease = OnRelease
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
end
-- Item: Menu
-- Shows a submenu on mouse over
-- Does not close the pullout on click
do
local widgetType = "Dropdown-Item-Menu"
local widgetVersion = 2
local function OnEnter(this)
local self = this.obj
self:Fire("OnEnter")
if self.specialOnEnter then
self.specialOnEnter(self)
end
self.highlight:Show()
if not self.disabled and self.submenu then
self.submenu:Open("TOPLEFT", self.frame, "TOPRIGHT", self.pullout:GetRightBorderWidth(), 0, self.frame:GetFrameLevel() + 100)
end
end
local function OnHide(this)
local self = this.obj
if self.submenu then
self.submenu:Close()
end
end
-- exported
local function SetMenu(self, menu)
assert(menu.type == "Dropdown-Pullout")
self.submenu = menu
end
-- exported
local function CloseMenu(self)
self.submenu:Close()
end
local function Constructor()
local self = ItemBase.Create(widgetType)
self.sub:Show()
self.frame:SetScript("OnEnter", OnEnter)
self.frame:SetScript("OnHide", OnHide)
self.SetMenu = SetMenu
self.CloseMenu = CloseMenu
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
end
-- Item: Separator
-- A single line to separate items
do
local widgetType = "Dropdown-Item-Separator"
local widgetVersion = 2
-- exported, override
local function SetDisabled(self, disabled)
ItemBase.SetDisabled(self, disabled)
self.useHighlight = false
end
local function Constructor()
local self = ItemBase.Create(widgetType)
self.SetDisabled = SetDisabled
local line = self.frame:CreateTexture(nil, "OVERLAY")
line:SetHeight(1)
line:SetColorTexture(.5, .5, .5)
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
self.text:Hide()
self.useHighlight = false
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
end
@@ -1,742 +0,0 @@
--[[ $Id: AceGUIWidget-DropDown.lua 1237 2020-07-17 22:50:38Z nevcairiel $ ]]--
local AceGUI = LibStub("AceGUI-3.0")
-- Lua APIs
local min, max, floor = math.min, math.max, math.floor
local select, pairs, ipairs, type, tostring = select, pairs, ipairs, type, tostring
local tsort = table.sort
-- WoW APIs
local PlaySound = PlaySound
local UIParent, CreateFrame = UIParent, CreateFrame
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: CLOSE
local function fixlevels(parent,...)
local i = 1
local child = select(i, ...)
while child do
child:SetFrameLevel(parent:GetFrameLevel()+1)
fixlevels(child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
local function fixstrata(strata, parent, ...)
local i = 1
local child = select(i, ...)
parent:SetFrameStrata(strata)
while child do
fixstrata(strata, child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
do
local widgetType = "Dropdown-Pullout"
local widgetVersion = 4
--[[ Static data ]]--
local backdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
edgeSize = 32,
tileSize = 32,
tile = true,
insets = { left = 11, right = 12, top = 12, bottom = 11 },
}
local sliderBackdrop = {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
}
local defaultWidth = 200
local defaultMaxHeight = 600
--[[ UI Event Handlers ]]--
-- HACK: This should be no part of the pullout, but there
-- is no other 'clean' way to response to any item-OnEnter
-- Used to close Submenus when an other item is entered
local function OnEnter(item)
local self = item.pullout
for k, v in ipairs(self.items) do
if v.CloseMenu and v ~= item then
v:CloseMenu()
end
end
end
-- See the note in Constructor() for each scroll related function
local function OnMouseWheel(this, value)
this.obj:MoveScroll(value)
end
local function OnScrollValueChanged(this, value)
this.obj:SetScroll(value)
end
local function OnSizeChanged(this)
this.obj:FixScroll()
end
--[[ Exported methods ]]--
-- exported
local function SetScroll(self, value)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset
if height > viewheight then
offset = 0
else
offset = floor((viewheight - height) / 1000 * value)
end
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", self.slider:IsShown() and -12 or 0, offset)
status.offset = offset
status.scrollvalue = value
end
-- exported
local function MoveScroll(self, value)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
if height > viewheight then
self.slider:Hide()
else
self.slider:Show()
local diff = height - viewheight
local delta = 1
if value < 0 then
delta = -1
end
self.slider:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end
end
-- exported
local function FixScroll(self)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset = status.offset or 0
if viewheight < height then
self.slider:Hide()
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, offset)
self.slider:SetValue(0)
else
self.slider:Show()
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.slider:SetValue(value)
self:SetScroll(value)
if value < 1000 then
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -12, offset)
status.offset = offset
end
end
end
-- exported, AceGUI callback
local function OnAcquire(self)
self.frame:SetParent(UIParent)
--self.itemFrame:SetToplevel(true)
end
-- exported, AceGUI callback
local function OnRelease(self)
self:Clear()
self.frame:ClearAllPoints()
self.frame:Hide()
end
-- exported
local function AddItem(self, item)
self.items[#self.items + 1] = item
local h = #self.items * 16
self.itemFrame:SetHeight(h)
self.frame:SetHeight(min(h + 34, self.maxHeight)) -- +34: 20 for scrollFrame placement (10 offset) and +14 for item placement
item.frame:SetPoint("LEFT", self.itemFrame, "LEFT")
item.frame:SetPoint("RIGHT", self.itemFrame, "RIGHT")
item:SetPullout(self)
item:SetOnEnter(OnEnter)
end
-- exported
local function Open(self, point, relFrame, relPoint, x, y)
local items = self.items
local frame = self.frame
local itemFrame = self.itemFrame
frame:SetPoint(point, relFrame, relPoint, x, y)
local height = 8
for i, item in pairs(items) do
if i == 1 then
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
else
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
end
item:Show()
height = height + 16
end
itemFrame:SetHeight(height)
fixstrata("TOOLTIP", frame, frame:GetChildren())
frame:Show()
self:Fire("OnOpen")
end
-- exported
local function Close(self)
self.frame:Hide()
self:Fire("OnClose")
end
-- exported
local function Clear(self)
local items = self.items
for i, item in pairs(items) do
AceGUI:Release(item)
items[i] = nil
end
end
-- exported
local function IterateItems(self)
return ipairs(self.items)
end
-- exported
local function SetHideOnLeave(self, val)
self.hideOnLeave = val
end
-- exported
local function SetMaxHeight(self, height)
self.maxHeight = height or defaultMaxHeight
if self.frame:GetHeight() > height then
self.frame:SetHeight(height)
elseif (self.itemFrame:GetHeight() + 34) < height then
self.frame:SetHeight(self.itemFrame:GetHeight() + 34) -- see :AddItem
end
end
-- exported
local function GetRightBorderWidth(self)
return 6 + (self.slider:IsShown() and 12 or 0)
end
-- exported
local function GetLeftBorderWidth(self)
return 6
end
--[[ Constructor ]]--
local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
local self = {}
self.count = count
self.type = widgetType
self.frame = frame
frame.obj = self
self.OnAcquire = OnAcquire
self.OnRelease = OnRelease
self.AddItem = AddItem
self.Open = Open
self.Close = Close
self.Clear = Clear
self.IterateItems = IterateItems
self.SetHideOnLeave = SetHideOnLeave
self.SetScroll = SetScroll
self.MoveScroll = MoveScroll
self.FixScroll = FixScroll
self.SetMaxHeight = SetMaxHeight
self.GetRightBorderWidth = GetRightBorderWidth
self.GetLeftBorderWidth = GetLeftBorderWidth
self.items = {}
self.scrollStatus = {
scrollvalue = 0,
}
self.maxHeight = defaultMaxHeight
frame:SetBackdrop(backdrop)
frame:SetBackdropColor(0, 0, 0)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetClampedToScreen(true)
frame:SetWidth(defaultWidth)
frame:SetHeight(self.maxHeight)
--frame:SetToplevel(true)
-- NOTE: The whole scroll frame code is copied from the AceGUI-3.0 widget ScrollFrame
local scrollFrame = CreateFrame("ScrollFrame", nil, frame)
local itemFrame = CreateFrame("Frame", nil, scrollFrame)
self.scrollFrame = scrollFrame
self.itemFrame = itemFrame
scrollFrame.obj = self
itemFrame.obj = self
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame, BackdropTemplateMixin and "BackdropTemplate" or nil)
slider:SetOrientation("VERTICAL")
slider:SetHitRectInsets(0, 0, -10, 0)
slider:SetBackdrop(sliderBackdrop)
slider:SetWidth(8)
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Vertical")
slider:SetFrameStrata("FULLSCREEN_DIALOG")
self.slider = slider
slider.obj = self
scrollFrame:SetScrollChild(itemFrame)
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -12)
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -6, 12)
scrollFrame:EnableMouseWheel(true)
scrollFrame:SetScript("OnMouseWheel", OnMouseWheel)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:SetToplevel(true)
scrollFrame:SetFrameStrata("FULLSCREEN_DIALOG")
itemFrame:SetPoint("TOPLEFT", scrollFrame, "TOPLEFT", 0, 0)
itemFrame:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -12, 0)
itemFrame:SetHeight(400)
itemFrame:SetToplevel(true)
itemFrame:SetFrameStrata("FULLSCREEN_DIALOG")
slider:SetPoint("TOPLEFT", scrollFrame, "TOPRIGHT", -16, 0)
slider:SetPoint("BOTTOMLEFT", scrollFrame, "BOTTOMRIGHT", -16, 0)
slider:SetScript("OnValueChanged", OnScrollValueChanged)
slider:SetMinMaxValues(0, 1000)
slider:SetValueStep(1)
slider:SetValue(0)
scrollFrame:Show()
itemFrame:Show()
slider:Hide()
self:FixScroll()
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
end
do
local widgetType = "Dropdown"
local widgetVersion = 35
--[[ Static data ]]--
--[[ UI event handler ]]--
local function Control_OnEnter(this)
this.obj.button:LockHighlight()
this.obj:Fire("OnEnter")
end
local function Control_OnLeave(this)
this.obj.button:UnlockHighlight()
this.obj:Fire("OnLeave")
end
local function Dropdown_OnHide(this)
local self = this.obj
if self.open then
self.pullout:Close()
end
end
local function Dropdown_TogglePullout(this)
local self = this.obj
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
if self.open then
self.open = nil
self.pullout:Close()
AceGUI:ClearFocus()
else
self.open = true
self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth())
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0)
AceGUI:SetFocus(self)
end
end
local function OnPulloutOpen(this)
local self = this.userdata.obj
local value = self.value
if not self.multiselect then
for i, item in this:IterateItems() do
item:SetValue(item.userdata.value == value)
end
end
self.open = true
self:Fire("OnOpened")
end
local function OnPulloutClose(this)
local self = this.userdata.obj
self.open = nil
self:Fire("OnClosed")
end
local function ShowMultiText(self)
local text
for i, widget in self.pullout:IterateItems() do
if widget.type == "Dropdown-Item-Toggle" then
if widget:GetValue() then
if text then
text = text..", "..widget:GetText()
else
text = widget:GetText()
end
end
end
end
self:SetText(text)
end
local function OnItemValueChanged(this, event, checked)
local self = this.userdata.obj
if self.multiselect then
self:Fire("OnValueChanged", this.userdata.value, checked)
ShowMultiText(self)
else
if checked then
self:SetValue(this.userdata.value)
self:Fire("OnValueChanged", this.userdata.value)
else
this:SetValue(true)
end
if self.open then
self.pullout:Close()
end
end
end
--[[ Exported methods ]]--
-- exported, AceGUI callback
local function OnAcquire(self)
local pullout = AceGUI:Create("Dropdown-Pullout")
self.pullout = pullout
pullout.userdata.obj = self
pullout:SetCallback("OnClose", OnPulloutClose)
pullout:SetCallback("OnOpen", OnPulloutOpen)
self.pullout.frame:SetFrameLevel(self.frame:GetFrameLevel() + 1)
fixlevels(self.pullout.frame, self.pullout.frame:GetChildren())
self:SetHeight(44)
self:SetWidth(200)
self:SetLabel()
self:SetPulloutWidth(nil)
self.list = {}
end
-- exported, AceGUI callback
local function OnRelease(self)
if self.open then
self.pullout:Close()
end
AceGUI:Release(self.pullout)
self.pullout = nil
self:SetText("")
self:SetDisabled(false)
self:SetMultiselect(false)
self.value = nil
self.list = nil
self.open = nil
self.hasClose = nil
self.frame:ClearAllPoints()
self.frame:Hide()
end
-- exported
local function SetDisabled(self, disabled)
self.disabled = disabled
if disabled then
self.text:SetTextColor(0.5,0.5,0.5)
self.button:Disable()
self.button_cover:Disable()
self.label:SetTextColor(0.5,0.5,0.5)
else
self.button:Enable()
self.button_cover:Enable()
self.label:SetTextColor(1,.82,0)
self.text:SetTextColor(1,1,1)
end
end
-- exported
local function ClearFocus(self)
if self.open then
self.pullout:Close()
end
end
-- exported
local function SetText(self, text)
self.text:SetText(text or "")
end
-- exported
local function SetLabel(self, text)
if text and text ~= "" then
self.label:SetText(text)
self.label:Show()
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-14)
self:SetHeight(40)
self.alignoffset = 26
else
self.label:SetText("")
self.label:Hide()
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,0)
self:SetHeight(26)
self.alignoffset = 12
end
end
-- exported
local function SetValue(self, value)
self:SetText(self.list[value] or "")
self.value = value
end
-- exported
local function GetValue(self)
return self.value
end
-- exported
local function SetItemValue(self, item, value)
if not self.multiselect then return end
for i, widget in self.pullout:IterateItems() do
if widget.userdata.value == item then
if widget.SetValue then
widget:SetValue(value)
end
end
end
ShowMultiText(self)
end
-- exported
local function SetItemDisabled(self, item, disabled)
for i, widget in self.pullout:IterateItems() do
if widget.userdata.value == item then
widget:SetDisabled(disabled)
end
end
end
local function AddListItem(self, value, text, itemType)
if not itemType then itemType = "Dropdown-Item-Toggle" end
local exists = AceGUI:GetWidgetVersion(itemType)
if not exists then error(("The given item type, %q, does not exist within AceGUI-3.0"):format(tostring(itemType)), 2) end
local item = AceGUI:Create(itemType)
item:SetText(text)
item.userdata.obj = self
item.userdata.value = value
item:SetCallback("OnValueChanged", OnItemValueChanged)
self.pullout:AddItem(item)
end
local function AddCloseButton(self)
if not self.hasClose then
local close = AceGUI:Create("Dropdown-Item-Execute")
close:SetText(CLOSE)
self.pullout:AddItem(close)
self.hasClose = true
end
end
-- exported
local sortlist = {}
local function sortTbl(x,y)
local num1, num2 = tonumber(x), tonumber(y)
if num1 and num2 then -- numeric comparison, either two numbers or numeric strings
return num1 < num2
else -- compare everything else tostring'ed
return tostring(x) < tostring(y)
end
end
local function SetList(self, list, order, itemType)
self.list = list or {}
self.pullout:Clear()
self.hasClose = nil
if not list then return end
if type(order) ~= "table" then
for v in pairs(list) do
sortlist[#sortlist + 1] = v
end
tsort(sortlist, sortTbl)
for i, key in ipairs(sortlist) do
AddListItem(self, key, list[key], itemType)
sortlist[i] = nil
end
else
for i, key in ipairs(order) do
AddListItem(self, key, list[key], itemType)
end
end
if self.multiselect then
ShowMultiText(self)
AddCloseButton(self)
end
end
-- exported
local function AddItem(self, value, text, itemType)
self.list[value] = text
AddListItem(self, value, text, itemType)
end
-- exported
local function SetMultiselect(self, multi)
self.multiselect = multi
if multi then
ShowMultiText(self)
AddCloseButton(self)
end
end
-- exported
local function GetMultiselect(self)
return self.multiselect
end
local function SetPulloutWidth(self, width)
self.pulloutWidth = width
end
--[[ Constructor ]]--
local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", nil, UIParent)
local dropdown = CreateFrame("Frame", "AceGUI30DropDown"..count, frame, "UIDropDownMenuTemplate")
local self = {}
self.type = widgetType
self.frame = frame
self.dropdown = dropdown
self.count = count
frame.obj = self
dropdown.obj = self
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.ClearFocus = ClearFocus
self.SetText = SetText
self.SetValue = SetValue
self.GetValue = GetValue
self.SetList = SetList
self.SetLabel = SetLabel
self.SetDisabled = SetDisabled
self.AddItem = AddItem
self.SetMultiselect = SetMultiselect
self.GetMultiselect = GetMultiselect
self.SetItemValue = SetItemValue
self.SetItemDisabled = SetItemDisabled
self.SetPulloutWidth = SetPulloutWidth
self.alignoffset = 26
frame:SetScript("OnHide",Dropdown_OnHide)
dropdown:ClearAllPoints()
dropdown:SetPoint("TOPLEFT",frame,"TOPLEFT",-15,0)
dropdown:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",17,0)
dropdown:SetScript("OnHide", nil)
local left = _G[dropdown:GetName() .. "Left"]
local middle = _G[dropdown:GetName() .. "Middle"]
local right = _G[dropdown:GetName() .. "Right"]
middle:ClearAllPoints()
right:ClearAllPoints()
middle:SetPoint("LEFT", left, "RIGHT", 0, 0)
middle:SetPoint("RIGHT", right, "LEFT", 0, 0)
right:SetPoint("TOPRIGHT", dropdown, "TOPRIGHT", 0, 17)
local button = _G[dropdown:GetName() .. "Button"]
self.button = button
button.obj = self
button:SetScript("OnEnter",Control_OnEnter)
button:SetScript("OnLeave",Control_OnLeave)
button:SetScript("OnClick",Dropdown_TogglePullout)
local button_cover = CreateFrame("BUTTON",nil,self.frame)
self.button_cover = button_cover
button_cover.obj = self
button_cover:SetPoint("TOPLEFT",self.frame,"BOTTOMLEFT",0,25)
button_cover:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT")
button_cover:SetScript("OnEnter",Control_OnEnter)
button_cover:SetScript("OnLeave",Control_OnLeave)
button_cover:SetScript("OnClick",Dropdown_TogglePullout)
local text = _G[dropdown:GetName() .. "Text"]
self.text = text
text.obj = self
text:ClearAllPoints()
text:SetPoint("RIGHT", right, "RIGHT" ,-43, 2)
text:SetPoint("LEFT", left, "LEFT", 25, 2)
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
label:SetJustifyH("LEFT")
label:SetHeight(18)
label:Hide()
self.label = label
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
end
@@ -1,263 +0,0 @@
--[[-----------------------------------------------------------------------------
EditBox Widget
-------------------------------------------------------------------------------]]
local Type, Version = "EditBox", 28
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local tostring, pairs = tostring, pairs
-- WoW APIs
local PlaySound = PlaySound
local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
if not AceGUIEditBoxInsertLink then
-- upgradeable hook
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
end
function _G.AceGUIEditBoxInsertLink(text)
for i = 1, AceGUI:GetWidgetCount(Type) do
local editbox = _G["AceGUI-3.0EditBox"..i]
if editbox and editbox:IsVisible() and editbox:HasFocus() then
editbox:Insert(text)
return true
end
end
end
local function ShowButton(self)
if not self.disablebutton then
self.button:Show()
self.editbox:SetTextInsets(0, 20, 3, 3)
end
end
local function HideButton(self)
self.button:Hide()
self.editbox:SetTextInsets(0, 0, 3, 3)
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Frame_OnShowFocus(frame)
frame.obj.editbox:SetFocus()
frame:SetScript("OnShow", nil)
end
local function EditBox_OnEscapePressed(frame)
AceGUI:ClearFocus()
end
local function EditBox_OnEnterPressed(frame)
local self = frame.obj
local value = frame:GetText()
local cancel = self:Fire("OnEnterPressed", value)
if not cancel then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
HideButton(self)
end
end
local function EditBox_OnReceiveDrag(frame)
local self = frame.obj
local type, id, info = GetCursorInfo()
local name
if type == "item" then
name = info
elseif type == "spell" then
name = GetSpellInfo(id, info)
elseif type == "macro" then
name = GetMacroInfo(id)
end
if name then
self:SetText(name)
self:Fire("OnEnterPressed", name)
ClearCursor()
HideButton(self)
AceGUI:ClearFocus()
end
end
local function EditBox_OnTextChanged(frame)
local self = frame.obj
local value = frame:GetText()
if tostring(value) ~= tostring(self.lasttext) then
self:Fire("OnTextChanged", value)
self.lasttext = value
ShowButton(self)
end
end
local function EditBox_OnFocusGained(frame)
AceGUI:SetFocus(frame.obj)
end
local function Button_OnClick(frame)
local editbox = frame.obj.editbox
editbox:ClearFocus()
EditBox_OnEnterPressed(editbox)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
-- height is controlled by SetLabel
self:SetWidth(200)
self:SetDisabled(false)
self:SetLabel()
self:SetText()
self:DisableButton(false)
self:SetMaxLetters(0)
end,
["OnRelease"] = function(self)
self:ClearFocus()
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.editbox:EnableMouse(false)
self.editbox:ClearFocus()
self.editbox:SetTextColor(0.5,0.5,0.5)
self.label:SetTextColor(0.5,0.5,0.5)
else
self.editbox:EnableMouse(true)
self.editbox:SetTextColor(1,1,1)
self.label:SetTextColor(1,.82,0)
end
end,
["SetText"] = function(self, text)
self.lasttext = text or ""
self.editbox:SetText(text or "")
self.editbox:SetCursorPosition(0)
HideButton(self)
end,
["GetText"] = function(self, text)
return self.editbox:GetText()
end,
["SetLabel"] = function(self, text)
if text and text ~= "" then
self.label:SetText(text)
self.label:Show()
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18)
self:SetHeight(44)
self.alignoffset = 30
else
self.label:SetText("")
self.label:Hide()
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0)
self:SetHeight(26)
self.alignoffset = 12
end
end,
["DisableButton"] = function(self, disabled)
self.disablebutton = disabled
if disabled then
HideButton(self)
end
end,
["SetMaxLetters"] = function (self, num)
self.editbox:SetMaxLetters(num or 0)
end,
["ClearFocus"] = function(self)
self.editbox:ClearFocus()
self.frame:SetScript("OnShow", nil)
end,
["SetFocus"] = function(self)
self.editbox:SetFocus()
if not self.frame:IsShown() then
self.frame:SetScript("OnShow", Frame_OnShowFocus)
end
end,
["HighlightText"] = function(self, from, to)
self.editbox:HighlightText(from, to)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate")
editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal)
editbox:SetScript("OnEnter", Control_OnEnter)
editbox:SetScript("OnLeave", Control_OnLeave)
editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
editbox:SetScript("OnTextChanged", EditBox_OnTextChanged)
editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained)
editbox:SetTextInsets(0, 0, 3, 3)
editbox:SetMaxLetters(256)
editbox:SetPoint("BOTTOMLEFT", 6, 0)
editbox:SetPoint("BOTTOMRIGHT")
editbox:SetHeight(19)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
label:SetPoint("TOPLEFT", 0, -2)
label:SetPoint("TOPRIGHT", 0, -2)
label:SetJustifyH("LEFT")
label:SetHeight(18)
local button = CreateFrame("Button", nil, editbox, "UIPanelButtonTemplate")
button:SetWidth(40)
button:SetHeight(20)
button:SetPoint("RIGHT", -2, 0)
button:SetText(OKAY)
button:SetScript("OnClick", Button_OnClick)
button:Hide()
local widget = {
alignoffset = 30,
editbox = editbox,
label = label,
button = button,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
editbox.obj, button.obj = widget, widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,78 +0,0 @@
--[[-----------------------------------------------------------------------------
Heading Widget
-------------------------------------------------------------------------------]]
local Type, Version = "Heading", 20
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetText()
self:SetFullWidth()
self:SetHeight(18)
end,
-- ["OnRelease"] = nil,
["SetText"] = function(self, text)
self.label:SetText(text or "")
if text and text ~= "" then
self.left:SetPoint("RIGHT", self.label, "LEFT", -5, 0)
self.right:Show()
else
self.left:SetPoint("RIGHT", -3, 0)
self.right:Hide()
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
label:SetPoint("TOP")
label:SetPoint("BOTTOM")
label:SetJustifyH("CENTER")
local left = frame:CreateTexture(nil, "BACKGROUND")
left:SetHeight(8)
left:SetPoint("LEFT", 3, 0)
left:SetPoint("RIGHT", label, "LEFT", -5, 0)
left:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
left:SetTexCoord(0.81, 0.94, 0.5, 1)
local right = frame:CreateTexture(nil, "BACKGROUND")
right:SetHeight(8)
right:SetPoint("RIGHT", -3, 0)
right:SetPoint("LEFT", label, "RIGHT", 5, 0)
right:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
right:SetTexCoord(0.81, 0.94, 0.5, 1)
local widget = {
label = label,
left = left,
right = right,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,140 +0,0 @@
--[[-----------------------------------------------------------------------------
Icon Widget
-------------------------------------------------------------------------------]]
local Type, Version = "Icon", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local select, pairs, print = select, pairs, print
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Button_OnClick(frame, button)
frame.obj:Fire("OnClick", button)
AceGUI:ClearFocus()
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetHeight(110)
self:SetWidth(110)
self:SetLabel()
self:SetImage(nil)
self:SetImageSize(64, 64)
self:SetDisabled(false)
end,
-- ["OnRelease"] = nil,
["SetLabel"] = function(self, text)
if text and text ~= "" then
self.label:Show()
self.label:SetText(text)
self:SetHeight(self.image:GetHeight() + 25)
else
self.label:Hide()
self:SetHeight(self.image:GetHeight() + 10)
end
end,
["SetImage"] = function(self, path, ...)
local image = self.image
image:SetTexture(path)
if image:GetTexture() then
local n = select("#", ...)
if n == 4 or n == 8 then
image:SetTexCoord(...)
else
image:SetTexCoord(0, 1, 0, 1)
end
end
end,
["SetImageSize"] = function(self, width, height)
self.image:SetWidth(width)
self.image:SetHeight(height)
--self.frame:SetWidth(width + 30)
if self.label:IsShown() then
self:SetHeight(height + 25)
else
self:SetHeight(height + 10)
end
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.frame:Disable()
self.label:SetTextColor(0.5, 0.5, 0.5)
self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5)
else
self.frame:Enable()
self.label:SetTextColor(1, 1, 1)
self.image:SetVertexColor(1, 1, 1, 1)
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Button", nil, UIParent)
frame:Hide()
frame:EnableMouse(true)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
frame:SetScript("OnClick", Button_OnClick)
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight")
label:SetPoint("BOTTOMLEFT")
label:SetPoint("BOTTOMRIGHT")
label:SetJustifyH("CENTER")
label:SetJustifyV("TOP")
label:SetHeight(18)
local image = frame:CreateTexture(nil, "BACKGROUND")
image:SetWidth(64)
image:SetHeight(64)
image:SetPoint("TOP", 0, -5)
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
highlight:SetAllPoints(image)
highlight:SetTexture(136580) -- Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight
highlight:SetTexCoord(0, 1, 0.23, 0.77)
highlight:SetBlendMode("ADD")
local widget = {
label = label,
image = image,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,94 +0,0 @@
--[[-----------------------------------------------------------------------------
InteractiveLabel Widget
-------------------------------------------------------------------------------]]
local Type, Version = "InteractiveLabel", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local select, pairs = select, pairs
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Label_OnClick(frame, button)
frame.obj:Fire("OnClick", button)
AceGUI:ClearFocus()
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:LabelOnAcquire()
self:SetHighlight()
self:SetHighlightTexCoord()
self:SetDisabled(false)
end,
-- ["OnRelease"] = nil,
["SetHighlight"] = function(self, ...)
self.highlight:SetTexture(...)
end,
["SetHighlightTexCoord"] = function(self, ...)
local c = select("#", ...)
if c == 4 or c == 8 then
self.highlight:SetTexCoord(...)
else
self.highlight:SetTexCoord(0, 1, 0, 1)
end
end,
["SetDisabled"] = function(self,disabled)
self.disabled = disabled
if disabled then
self.frame:EnableMouse(false)
self.label:SetTextColor(0.5, 0.5, 0.5)
else
self.frame:EnableMouse(true)
self.label:SetTextColor(1, 1, 1)
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
-- create a Label type that we will hijack
local label = AceGUI:Create("Label")
local frame = label.frame
frame:EnableMouse(true)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
frame:SetScript("OnMouseDown", Label_OnClick)
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
highlight:SetTexture(nil)
highlight:SetAllPoints()
highlight:SetBlendMode("ADD")
label.highlight = highlight
label.type = Type
label.LabelOnAcquire = label.OnAcquire
for method, func in pairs(methods) do
label[method] = func
end
return label
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,249 +0,0 @@
--[[-----------------------------------------------------------------------------
Keybinding Widget
Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NOT_BOUND
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Keybinding_OnClick(frame, button)
if button == "LeftButton" or button == "RightButton" then
local self = frame.obj
if self.waitingForKey then
frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
else
frame:EnableKeyboard(true)
frame:EnableMouseWheel(true)
self.msgframe:Show()
frame:LockHighlight()
self.waitingForKey = true
end
end
AceGUI:ClearFocus()
end
local ignoreKeys = {
["BUTTON1"] = true, ["BUTTON2"] = true,
["UNKNOWN"] = true,
["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true,
["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true,
}
local function Keybinding_OnKeyDown(frame, key)
local self = frame.obj
if self.waitingForKey then
local keyPressed = key
if keyPressed == "ESCAPE" then
keyPressed = ""
else
if ignoreKeys[keyPressed] then return end
if IsShiftKeyDown() then
keyPressed = "SHIFT-"..keyPressed
end
if IsControlKeyDown() then
keyPressed = "CTRL-"..keyPressed
end
if IsAltKeyDown() then
keyPressed = "ALT-"..keyPressed
end
end
frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
if not self.disabled then
self:SetKey(keyPressed)
self:Fire("OnKeyChanged", keyPressed)
end
end
end
local function Keybinding_OnMouseDown(frame, button)
if button == "LeftButton" or button == "RightButton" then
return
elseif button == "MiddleButton" then
button = "BUTTON3"
elseif button == "Button4" then
button = "BUTTON4"
elseif button == "Button5" then
button = "BUTTON5"
end
Keybinding_OnKeyDown(frame, button)
end
local function Keybinding_OnMouseWheel(frame, direction)
local button
if direction >= 0 then
button = "MOUSEWHEELUP"
else
button = "MOUSEWHEELDOWN"
end
Keybinding_OnKeyDown(frame, button)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(200)
self:SetLabel("")
self:SetKey("")
self.waitingForKey = nil
self.msgframe:Hide()
self:SetDisabled(false)
self.button:EnableKeyboard(false)
self.button:EnableMouseWheel(false)
end,
-- ["OnRelease"] = nil,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.button:Disable()
self.label:SetTextColor(0.5,0.5,0.5)
else
self.button:Enable()
self.label:SetTextColor(1,1,1)
end
end,
["SetKey"] = function(self, key)
if (key or "") == "" then
self.button:SetText(NOT_BOUND)
self.button:SetNormalFontObject("GameFontNormal")
else
self.button:SetText(key)
self.button:SetNormalFontObject("GameFontHighlight")
end
end,
["GetKey"] = function(self)
local key = self.button:GetText()
if key == NOT_BOUND then
key = nil
end
return key
end,
["SetLabel"] = function(self, label)
self.label:SetText(label or "")
if (label or "") == "" then
self.alignoffset = nil
self:SetHeight(24)
else
self.alignoffset = 30
self:SetHeight(44)
end
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local ControlBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
}
local function keybindingMsgFixWidth(frame)
frame:SetWidth(frame.msg:GetWidth() + 10)
frame:SetScript("OnUpdate", nil)
end
local function Constructor()
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
button:EnableMouse(true)
button:EnableMouseWheel(false)
button:RegisterForClicks("AnyDown")
button:SetScript("OnEnter", Control_OnEnter)
button:SetScript("OnLeave", Control_OnLeave)
button:SetScript("OnClick", Keybinding_OnClick)
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
button:SetPoint("BOTTOMLEFT")
button:SetPoint("BOTTOMRIGHT")
button:SetHeight(24)
button:EnableKeyboard(false)
local text = button:GetFontString()
text:SetPoint("LEFT", 7, 0)
text:SetPoint("RIGHT", -7, 0)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
label:SetPoint("TOPLEFT")
label:SetPoint("TOPRIGHT")
label:SetJustifyH("CENTER")
label:SetHeight(18)
local msgframe = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
msgframe:SetHeight(30)
msgframe:SetBackdrop(ControlBackdrop)
msgframe:SetBackdropColor(0,0,0)
msgframe:SetFrameStrata("FULLSCREEN_DIALOG")
msgframe:SetFrameLevel(1000)
msgframe:SetToplevel(true)
local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal")
msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.")
msgframe.msg = msg
msg:SetPoint("TOPLEFT", 5, -5)
msgframe:SetScript("OnUpdate", keybindingMsgFixWidth)
msgframe:SetPoint("BOTTOM", button, "TOP")
msgframe:Hide()
local widget = {
button = button,
label = label,
msgframe = msgframe,
frame = frame,
alignoffset = 30,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
button.obj = widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,179 +0,0 @@
--[[-----------------------------------------------------------------------------
Label Widget
Displays text and optionally an icon.
-------------------------------------------------------------------------------]]
local Type, Version = "Label", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local max, select, pairs = math.max, select, pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontHighlightSmall
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function UpdateImageAnchor(self)
if self.resizing then return end
local frame = self.frame
local width = frame.width or frame:GetWidth() or 0
local image = self.image
local label = self.label
local height
label:ClearAllPoints()
image:ClearAllPoints()
if self.imageshown then
local imagewidth = image:GetWidth()
if (width - imagewidth) < 200 or (label:GetText() or "") == "" then
-- image goes on top centered when less than 200 width for the text, or if there is no text
image:SetPoint("TOP")
label:SetPoint("TOP", image, "BOTTOM")
label:SetPoint("LEFT")
label:SetWidth(width)
height = image:GetHeight() + label:GetStringHeight()
else
-- image on the left
image:SetPoint("TOPLEFT")
if image:GetHeight() > label:GetStringHeight() then
label:SetPoint("LEFT", image, "RIGHT", 4, 0)
else
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0)
end
label:SetWidth(width - imagewidth - 4)
height = max(image:GetHeight(), label:GetStringHeight())
end
else
-- no image shown
label:SetPoint("TOPLEFT")
label:SetWidth(width)
height = label:GetStringHeight()
end
-- avoid zero-height labels, since they can used as spacers
if not height or height == 0 then
height = 1
end
self.resizing = true
frame:SetHeight(height)
frame.height = height
self.resizing = nil
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
-- set the flag to stop constant size updates
self.resizing = true
-- height is set dynamically by the text and image size
self:SetWidth(200)
self:SetText()
self:SetImage(nil)
self:SetImageSize(16, 16)
self:SetColor()
self:SetFontObject()
self:SetJustifyH("LEFT")
self:SetJustifyV("TOP")
-- reset the flag
self.resizing = nil
-- run the update explicitly
UpdateImageAnchor(self)
end,
-- ["OnRelease"] = nil,
["OnWidthSet"] = function(self, width)
UpdateImageAnchor(self)
end,
["SetText"] = function(self, text)
self.label:SetText(text)
UpdateImageAnchor(self)
end,
["SetColor"] = function(self, r, g, b)
if not (r and g and b) then
r, g, b = 1, 1, 1
end
self.label:SetVertexColor(r, g, b)
end,
["SetImage"] = function(self, path, ...)
local image = self.image
image:SetTexture(path)
if image:GetTexture() then
self.imageshown = true
local n = select("#", ...)
if n == 4 or n == 8 then
image:SetTexCoord(...)
else
image:SetTexCoord(0, 1, 0, 1)
end
else
self.imageshown = nil
end
UpdateImageAnchor(self)
end,
["SetFont"] = function(self, font, height, flags)
self.label:SetFont(font, height, flags)
UpdateImageAnchor(self)
end,
["SetFontObject"] = function(self, font)
self:SetFont((font or GameFontHighlightSmall):GetFont())
end,
["SetImageSize"] = function(self, width, height)
self.image:SetWidth(width)
self.image:SetHeight(height)
UpdateImageAnchor(self)
end,
["SetJustifyH"] = function(self, justifyH)
self.label:SetJustifyH(justifyH)
end,
["SetJustifyV"] = function(self, justifyV)
self.label:SetJustifyV(justifyV)
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
local image = frame:CreateTexture(nil, "BACKGROUND")
-- create widget
local widget = {
label = label,
image = image,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,366 +0,0 @@
local Type, Version = "MultiLineEditBox", 29
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: ACCEPT, ChatFontNormal
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
if not AceGUIMultiLineEditBoxInsertLink then
-- upgradeable hook
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
end
function _G.AceGUIMultiLineEditBoxInsertLink(text)
for i = 1, AceGUI:GetWidgetCount(Type) do
local editbox = _G[("MultiLineEditBox%uEdit"):format(i)]
if editbox and editbox:IsVisible() and editbox:HasFocus() then
editbox:Insert(text)
return true
end
end
end
local function Layout(self)
self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight)
if self.labelHeight == 0 then
self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23)
else
self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19)
end
if self.disablebutton then
self.scrollBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 21)
self.scrollBG:SetPoint("BOTTOMLEFT", 0, 4)
else
self.scrollBar:SetPoint("BOTTOM", self.button, "TOP", 0, 18)
self.scrollBG:SetPoint("BOTTOMLEFT", self.button, "TOPLEFT")
end
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function OnClick(self) -- Button
self = self.obj
self.editBox:ClearFocus()
if not self:Fire("OnEnterPressed", self.editBox:GetText()) then
self.button:Disable()
end
end
local function OnCursorChanged(self, _, y, _, cursorHeight) -- EditBox
self, y = self.obj.scrollFrame, -y
local offset = self:GetVerticalScroll()
if y < offset then
self:SetVerticalScroll(y)
else
y = y + cursorHeight - self:GetHeight()
if y > offset then
self:SetVerticalScroll(y)
end
end
end
local function OnEditFocusLost(self) -- EditBox
self:HighlightText(0, 0)
self.obj:Fire("OnEditFocusLost")
end
local function OnEnter(self) -- EditBox / ScrollFrame
self = self.obj
if not self.entered then
self.entered = true
self:Fire("OnEnter")
end
end
local function OnLeave(self) -- EditBox / ScrollFrame
self = self.obj
if self.entered then
self.entered = nil
self:Fire("OnLeave")
end
end
local function OnMouseUp(self) -- ScrollFrame
self = self.obj.editBox
self:SetFocus()
self:SetCursorPosition(self:GetNumLetters())
end
local function OnReceiveDrag(self) -- EditBox / ScrollFrame
local type, id, info = GetCursorInfo()
if type == "spell" then
info = GetSpellInfo(id, info)
elseif type ~= "item" then
return
end
ClearCursor()
self = self.obj
local editBox = self.editBox
if not editBox:HasFocus() then
editBox:SetFocus()
editBox:SetCursorPosition(editBox:GetNumLetters())
end
editBox:Insert(info)
self.button:Enable()
end
local function OnSizeChanged(self, width, height) -- ScrollFrame
self.obj.editBox:SetWidth(width)
end
local function OnTextChanged(self, userInput) -- EditBox
if userInput then
self = self.obj
self:Fire("OnTextChanged", self.editBox:GetText())
self.button:Enable()
end
end
local function OnTextSet(self) -- EditBox
self:HighlightText(0, 0)
self:SetCursorPosition(self:GetNumLetters())
self:SetCursorPosition(0)
self.obj.button:Disable()
end
local function OnVerticalScroll(self, offset) -- ScrollFrame
local editBox = self.obj.editBox
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
end
local function OnShowFocus(frame)
frame.obj.editBox:SetFocus()
frame:SetScript("OnShow", nil)
end
local function OnEditFocusGained(frame)
AceGUI:SetFocus(frame.obj)
frame.obj:Fire("OnEditFocusGained")
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self.editBox:SetText("")
self:SetDisabled(false)
self:SetWidth(200)
self:DisableButton(false)
self:SetNumLines()
self.entered = nil
self:SetMaxLetters(0)
end,
["OnRelease"] = function(self)
self:ClearFocus()
end,
["SetDisabled"] = function(self, disabled)
local editBox = self.editBox
if disabled then
editBox:ClearFocus()
editBox:EnableMouse(false)
editBox:SetTextColor(0.5, 0.5, 0.5)
self.label:SetTextColor(0.5, 0.5, 0.5)
self.scrollFrame:EnableMouse(false)
self.button:Disable()
else
editBox:EnableMouse(true)
editBox:SetTextColor(1, 1, 1)
self.label:SetTextColor(1, 0.82, 0)
self.scrollFrame:EnableMouse(true)
end
end,
["SetLabel"] = function(self, text)
if text and text ~= "" then
self.label:SetText(text)
if self.labelHeight ~= 10 then
self.labelHeight = 10
self.label:Show()
end
elseif self.labelHeight ~= 0 then
self.labelHeight = 0
self.label:Hide()
end
Layout(self)
end,
["SetNumLines"] = function(self, value)
if not value or value < 4 then
value = 4
end
self.numlines = value
Layout(self)
end,
["SetText"] = function(self, text)
self.editBox:SetText(text)
end,
["GetText"] = function(self)
return self.editBox:GetText()
end,
["SetMaxLetters"] = function (self, num)
self.editBox:SetMaxLetters(num or 0)
end,
["DisableButton"] = function(self, disabled)
self.disablebutton = disabled
if disabled then
self.button:Hide()
else
self.button:Show()
end
Layout(self)
end,
["ClearFocus"] = function(self)
self.editBox:ClearFocus()
self.frame:SetScript("OnShow", nil)
end,
["SetFocus"] = function(self)
self.editBox:SetFocus()
if not self.frame:IsShown() then
self.frame:SetScript("OnShow", OnShowFocus)
end
end,
["HighlightText"] = function(self, from, to)
self.editBox:HighlightText(from, to)
end,
["GetCursorPosition"] = function(self)
return self.editBox:GetCursorPosition()
end,
["SetCursorPosition"] = function(self, ...)
return self.editBox:SetCursorPosition(...)
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local backdrop = {
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16,
insets = { left = 4, right = 3, top = 4, bottom = 3 }
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local widgetNum = AceGUI:GetNextWidgetNum(Type)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4)
label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4)
label:SetJustifyH("LEFT")
label:SetText(ACCEPT)
label:SetHeight(10)
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate")
button:SetPoint("BOTTOMLEFT", 0, 4)
button:SetHeight(22)
button:SetWidth(label:GetStringWidth() + 24)
button:SetText(ACCEPT)
button:SetScript("OnClick", OnClick)
button:Disable()
local text = button:GetFontString()
text:ClearAllPoints()
text:SetPoint("TOPLEFT", button, "TOPLEFT", 5, -5)
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
text:SetJustifyV("MIDDLE")
local scrollBG = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
scrollBG:SetBackdrop(backdrop)
scrollBG:SetBackdropColor(0, 0, 0)
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate")
local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"]
scrollBar:ClearAllPoints()
scrollBar:SetPoint("TOP", label, "BOTTOM", 0, -19)
scrollBar:SetPoint("BOTTOM", button, "TOP", 0, 18)
scrollBar:SetPoint("RIGHT", frame, "RIGHT")
scrollBG:SetPoint("TOPRIGHT", scrollBar, "TOPLEFT", 0, 19)
scrollBG:SetPoint("BOTTOMLEFT", button, "TOPLEFT")
scrollFrame:SetPoint("TOPLEFT", scrollBG, "TOPLEFT", 5, -6)
scrollFrame:SetPoint("BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 4)
scrollFrame:SetScript("OnEnter", OnEnter)
scrollFrame:SetScript("OnLeave", OnLeave)
scrollFrame:SetScript("OnMouseUp", OnMouseUp)
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
editBox:SetAllPoints()
editBox:SetFontObject(ChatFontNormal)
editBox:SetMultiLine(true)
editBox:EnableMouse(true)
editBox:SetAutoFocus(false)
editBox:SetCountInvisibleLetters(false)
editBox:SetScript("OnCursorChanged", OnCursorChanged)
editBox:SetScript("OnEditFocusLost", OnEditFocusLost)
editBox:SetScript("OnEnter", OnEnter)
editBox:SetScript("OnEscapePressed", editBox.ClearFocus)
editBox:SetScript("OnLeave", OnLeave)
editBox:SetScript("OnMouseDown", OnReceiveDrag)
editBox:SetScript("OnReceiveDrag", OnReceiveDrag)
editBox:SetScript("OnTextChanged", OnTextChanged)
editBox:SetScript("OnTextSet", OnTextSet)
editBox:SetScript("OnEditFocusGained", OnEditFocusGained)
scrollFrame:SetScrollChild(editBox)
local widget = {
button = button,
editBox = editBox,
frame = frame,
label = label,
labelHeight = 10,
numlines = 4,
scrollBar = scrollBar,
scrollBG = scrollBG,
scrollFrame = scrollFrame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,284 +0,0 @@
--[[-----------------------------------------------------------------------------
Slider Widget
Graphical Slider, like, for Range values.
-------------------------------------------------------------------------------]]
local Type, Version = "Slider", 23
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local min, max, floor = math.min, math.max, math.floor
local tonumber, pairs = tonumber, pairs
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontHighlightSmall
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function UpdateText(self)
local value = self.value or 0
if self.ispercent then
self.editbox:SetText(("%s%%"):format(floor(value * 1000 + 0.5) / 10))
else
self.editbox:SetText(floor(value * 100 + 0.5) / 100)
end
end
local function UpdateLabels(self)
local min, max = (self.min or 0), (self.max or 100)
if self.ispercent then
self.lowtext:SetFormattedText("%s%%", (min * 100))
self.hightext:SetFormattedText("%s%%", (max * 100))
else
self.lowtext:SetText(min)
self.hightext:SetText(max)
end
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Frame_OnMouseDown(frame)
frame.obj.slider:EnableMouseWheel(true)
AceGUI:ClearFocus()
end
local function Slider_OnValueChanged(frame, newvalue)
local self = frame.obj
if not frame.setup then
if self.step and self.step > 0 then
local min_value = self.min or 0
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value
end
if newvalue ~= self.value and not self.disabled then
self.value = newvalue
self:Fire("OnValueChanged", newvalue)
end
if self.value then
UpdateText(self)
end
end
end
local function Slider_OnMouseUp(frame)
local self = frame.obj
self:Fire("OnMouseUp", self.value)
end
local function Slider_OnMouseWheel(frame, v)
local self = frame.obj
if not self.disabled then
local value = self.value
if v > 0 then
value = min(value + (self.step or 1), self.max)
else
value = max(value - (self.step or 1), self.min)
end
self.slider:SetValue(value)
end
end
local function EditBox_OnEscapePressed(frame)
frame:ClearFocus()
end
local function EditBox_OnEnterPressed(frame)
local self = frame.obj
local value = frame:GetText()
if self.ispercent then
value = value:gsub('%%', '')
value = tonumber(value) / 100
else
value = tonumber(value)
end
if value then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
self.slider:SetValue(value)
self:Fire("OnMouseUp", value)
end
end
local function EditBox_OnEnter(frame)
frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
end
local function EditBox_OnLeave(frame)
frame:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(200)
self:SetHeight(44)
self:SetDisabled(false)
self:SetIsPercent(nil)
self:SetSliderValues(0,100,1)
self:SetValue(0)
self.slider:EnableMouseWheel(false)
end,
-- ["OnRelease"] = nil,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.slider:EnableMouse(false)
self.label:SetTextColor(.5, .5, .5)
self.hightext:SetTextColor(.5, .5, .5)
self.lowtext:SetTextColor(.5, .5, .5)
--self.valuetext:SetTextColor(.5, .5, .5)
self.editbox:SetTextColor(.5, .5, .5)
self.editbox:EnableMouse(false)
self.editbox:ClearFocus()
else
self.slider:EnableMouse(true)
self.label:SetTextColor(1, .82, 0)
self.hightext:SetTextColor(1, 1, 1)
self.lowtext:SetTextColor(1, 1, 1)
--self.valuetext:SetTextColor(1, 1, 1)
self.editbox:SetTextColor(1, 1, 1)
self.editbox:EnableMouse(true)
end
end,
["SetValue"] = function(self, value)
self.slider.setup = true
self.slider:SetValue(value)
self.value = value
UpdateText(self)
self.slider.setup = nil
end,
["GetValue"] = function(self)
return self.value
end,
["SetLabel"] = function(self, text)
self.label:SetText(text)
end,
["SetSliderValues"] = function(self, min, max, step)
local frame = self.slider
frame.setup = true
self.min = min
self.max = max
self.step = step
frame:SetMinMaxValues(min or 0,max or 100)
UpdateLabels(self)
frame:SetValueStep(step or 1)
if self.value then
frame:SetValue(self.value)
end
frame.setup = nil
end,
["SetIsPercent"] = function(self, value)
self.ispercent = value
UpdateLabels(self)
UpdateText(self)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local SliderBackdrop = {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 6, bottom = 6 }
}
local ManualBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true, edgeSize = 1, tileSize = 5,
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:EnableMouse(true)
frame:SetScript("OnMouseDown", Frame_OnMouseDown)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
label:SetPoint("TOPLEFT")
label:SetPoint("TOPRIGHT")
label:SetJustifyH("CENTER")
label:SetHeight(15)
local slider = CreateFrame("Slider", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
slider:SetOrientation("HORIZONTAL")
slider:SetHeight(15)
slider:SetHitRectInsets(0, 0, -10, 0)
slider:SetBackdrop(SliderBackdrop)
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
slider:SetPoint("TOP", label, "BOTTOM")
slider:SetPoint("LEFT", 3, 0)
slider:SetPoint("RIGHT", -3, 0)
slider:SetValue(0)
slider:SetScript("OnValueChanged",Slider_OnValueChanged)
slider:SetScript("OnEnter", Control_OnEnter)
slider:SetScript("OnLeave", Control_OnLeave)
slider:SetScript("OnMouseUp", Slider_OnMouseUp)
slider:SetScript("OnMouseWheel", Slider_OnMouseWheel)
local lowtext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
lowtext:SetPoint("TOPLEFT", slider, "BOTTOMLEFT", 2, 3)
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
local editbox = CreateFrame("EditBox", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
editbox:SetAutoFocus(false)
editbox:SetFontObject(GameFontHighlightSmall)
editbox:SetPoint("TOP", slider, "BOTTOM")
editbox:SetHeight(14)
editbox:SetWidth(70)
editbox:SetJustifyH("CENTER")
editbox:EnableMouse(true)
editbox:SetBackdrop(ManualBackdrop)
editbox:SetBackdropColor(0, 0, 0, 0.5)
editbox:SetBackdropBorderColor(0.3, 0.3, 0.30, 0.80)
editbox:SetScript("OnEnter", EditBox_OnEnter)
editbox:SetScript("OnLeave", EditBox_OnLeave)
editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
local widget = {
label = label,
slider = slider,
lowtext = lowtext,
hightext = hightext,
editbox = editbox,
alignoffset = 25,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
slider.obj, editbox.obj = widget, widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type,Constructor,Version)
-511
View File
@@ -1,511 +0,0 @@
--- **AceHook-3.0** offers safe Hooking/Unhooking of functions, methods and frame scripts.
-- Using AceHook-3.0 is recommended when you need to unhook your hooks again, so the hook chain isn't broken
-- when you manually restore the original function.
--
-- **AceHook-3.0** can be embeded into your addon, either explicitly by calling AceHook:Embed(MyAddon) or by
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
-- and can be accessed directly, without having to explicitly call AceHook itself.\\
-- It is recommended to embed AceHook, otherwise you'll have to specify a custom `self` on all calls you
-- make into AceHook.
-- @class file
-- @name AceHook-3.0
-- @release $Id: AceHook-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
local ACEHOOK_MAJOR, ACEHOOK_MINOR = "AceHook-3.0", 8
local AceHook, oldminor = LibStub:NewLibrary(ACEHOOK_MAJOR, ACEHOOK_MINOR)
if not AceHook then return end -- No upgrade needed
AceHook.embeded = AceHook.embeded or {}
AceHook.registry = AceHook.registry or setmetatable({}, {__index = function(tbl, key) tbl[key] = {} return tbl[key] end })
AceHook.handlers = AceHook.handlers or {}
AceHook.actives = AceHook.actives or {}
AceHook.scripts = AceHook.scripts or {}
AceHook.onceSecure = AceHook.onceSecure or {}
AceHook.hooks = AceHook.hooks or {}
-- local upvalues
local registry = AceHook.registry
local handlers = AceHook.handlers
local actives = AceHook.actives
local scripts = AceHook.scripts
local onceSecure = AceHook.onceSecure
-- Lua APIs
local pairs, next, type = pairs, next, type
local format = string.format
local assert, error = assert, error
-- WoW APIs
local issecurevariable, hooksecurefunc = issecurevariable, hooksecurefunc
local _G = _G
-- functions for later definition
local donothing, createHook, hook
local protectedScripts = {
OnClick = true,
}
-- upgrading of embeded is done at the bottom of the file
local mixins = {
"Hook", "SecureHook",
"HookScript", "SecureHookScript",
"Unhook", "UnhookAll",
"IsHooked",
"RawHook", "RawHookScript"
}
-- AceHook:Embed( target )
-- target (object) - target object to embed AceHook in
--
-- Embeds AceEevent into the target object making the functions from the mixins list available on target:..
function AceHook:Embed( target )
for k, v in pairs( mixins ) do
target[v] = self[v]
end
self.embeded[target] = true
-- inject the hooks table safely
target.hooks = target.hooks or {}
return target
end
-- AceHook:OnEmbedDisable( target )
-- target (object) - target object that is being disabled
--
-- Unhooks all hooks when the target disables.
-- this method should be called by the target manually or by an addon framework
function AceHook:OnEmbedDisable( target )
target:UnhookAll()
end
function createHook(self, handler, orig, secure, failsafe)
local uid
local method = type(handler) == "string"
if failsafe and not secure then
-- failsafe hook creation
uid = function(...)
if actives[uid] then
if method then
self[handler](self, ...)
else
handler(...)
end
end
return orig(...)
end
-- /failsafe hook
else
-- all other hooks
uid = function(...)
if actives[uid] then
if method then
return self[handler](self, ...)
else
return handler(...)
end
elseif not secure then -- backup on non secure
return orig(...)
end
end
-- /hook
end
return uid
end
function donothing() end
function hook(self, obj, method, handler, script, secure, raw, forceSecure, usage)
if not handler then handler = method end
-- These asserts make sure AceHooks's devs play by the rules.
assert(not script or type(script) == "boolean")
assert(not secure or type(secure) == "boolean")
assert(not raw or type(raw) == "boolean")
assert(not forceSecure or type(forceSecure) == "boolean")
assert(usage)
-- Error checking Battery!
if obj and type(obj) ~= "table" then
error(format("%s: 'object' - nil or table expected got %s", usage, type(obj)), 3)
end
if type(method) ~= "string" then
error(format("%s: 'method' - string expected got %s", usage, type(method)), 3)
end
if type(handler) ~= "string" and type(handler) ~= "function" then
error(format("%s: 'handler' - nil, string, or function expected got %s", usage, type(handler)), 3)
end
if type(handler) == "string" and type(self[handler]) ~= "function" then
error(format("%s: 'handler' - Handler specified does not exist at self[handler]", usage), 3)
end
if script then
if not obj or not obj.GetScript or not obj:HasScript(method) then
error(format("%s: You can only hook a script on a frame object", usage), 3)
end
if not secure and obj.IsProtected and obj:IsProtected() and protectedScripts[method] then
error(format("Cannot hook secure script %q; Use SecureHookScript(obj, method, [handler]) instead.", method), 3)
end
else
local issecure
if obj then
issecure = onceSecure[obj] and onceSecure[obj][method] or issecurevariable(obj, method)
else
issecure = onceSecure[method] or issecurevariable(method)
end
if issecure then
if forceSecure then
if obj then
onceSecure[obj] = onceSecure[obj] or {}
onceSecure[obj][method] = true
else
onceSecure[method] = true
end
elseif not secure then
error(format("%s: Attempt to hook secure function %s. Use `SecureHook' or add `true' to the argument list to override.", usage, method), 3)
end
end
end
local uid
if obj then
uid = registry[self][obj] and registry[self][obj][method]
else
uid = registry[self][method]
end
if uid then
if actives[uid] then
-- Only two sane choices exist here. We either a) error 100% of the time or b) always unhook and then hook
-- choice b would likely lead to odd debuging conditions or other mysteries so we're going with a.
error(format("Attempting to rehook already active hook %s.", method))
end
if handlers[uid] == handler then -- turn on a decative hook, note enclosures break this ability, small memory leak
actives[uid] = true
return
elseif obj then -- is there any reason not to call unhook instead of doing the following several lines?
if self.hooks and self.hooks[obj] then
self.hooks[obj][method] = nil
end
registry[self][obj][method] = nil
else
if self.hooks then
self.hooks[method] = nil
end
registry[self][method] = nil
end
handlers[uid], actives[uid], scripts[uid] = nil, nil, nil
uid = nil
end
local orig
if script then
orig = obj:GetScript(method) or donothing
elseif obj then
orig = obj[method]
else
orig = _G[method]
end
if not orig then
error(format("%s: Attempting to hook a non existing target", usage), 3)
end
uid = createHook(self, handler, orig, secure, not (raw or secure))
if obj then
self.hooks[obj] = self.hooks[obj] or {}
registry[self][obj] = registry[self][obj] or {}
registry[self][obj][method] = uid
if not secure then
self.hooks[obj][method] = orig
end
if script then
if not secure then
obj:SetScript(method, uid)
else
obj:HookScript(method, uid)
end
else
if not secure then
obj[method] = uid
else
hooksecurefunc(obj, method, uid)
end
end
else
registry[self][method] = uid
if not secure then
_G[method] = uid
self.hooks[method] = orig
else
hooksecurefunc(method, uid)
end
end
actives[uid], handlers[uid], scripts[uid] = true, handler, script and true or nil
end
--- Hook a function or a method on an object.
-- The hook created will be a "safe hook", that means that your handler will be called
-- before the hooked function ("Pre-Hook"), and you don't have to call the original function yourself,
-- however you cannot stop the execution of the function, or modify any of the arguments/return values.\\
-- This type of hook is typically used if you need to know if some function got called, and don't want to modify it.
-- @paramsig [object], method, [handler], [hookSecure]
-- @param object The object to hook a method from
-- @param method If object was specified, the name of the method, or the name of the function to hook.
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked function)
-- @param hookSecure If true, AceHook will allow hooking of secure functions.
-- @usage
-- -- create an addon with AceHook embeded
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
--
-- function MyAddon:OnEnable()
-- -- Hook ActionButton_UpdateHotkeys, overwriting the secure status
-- self:Hook("ActionButton_UpdateHotkeys", true)
-- end
--
-- function MyAddon:ActionButton_UpdateHotkeys(button, type)
-- print(button:GetName() .. " is updating its HotKey")
-- end
function AceHook:Hook(object, method, handler, hookSecure)
if type(object) == "string" then
method, handler, hookSecure, object = object, method, handler, nil
end
if handler == true then
handler, hookSecure = nil, true
end
hook(self, object, method, handler, false, false, false, hookSecure or false, "Usage: Hook([object], method, [handler], [hookSecure])")
end
--- RawHook a function or a method on an object.
-- The hook created will be a "raw hook", that means that your handler will completly replace
-- the original function, and your handler has to call the original function (or not, depending on your intentions).\\
-- The original function will be stored in `self.hooks[object][method]` or `self.hooks[functionName]` respectively.\\
-- This type of hook can be used for all purposes, and is usually the most common case when you need to modify arguments
-- or want to control execution of the original function.
-- @paramsig [object], method, [handler], [hookSecure]
-- @param object The object to hook a method from
-- @param method If object was specified, the name of the method, or the name of the function to hook.
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked function)
-- @param hookSecure If true, AceHook will allow hooking of secure functions.
-- @usage
-- -- create an addon with AceHook embeded
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
--
-- function MyAddon:OnEnable()
-- -- Hook ActionButton_UpdateHotkeys, overwriting the secure status
-- self:RawHook("ActionButton_UpdateHotkeys", true)
-- end
--
-- function MyAddon:ActionButton_UpdateHotkeys(button, type)
-- if button:GetName() == "MyButton" then
-- -- do stuff here
-- else
-- self.hooks.ActionButton_UpdateHotkeys(button, type)
-- end
-- end
function AceHook:RawHook(object, method, handler, hookSecure)
if type(object) == "string" then
method, handler, hookSecure, object = object, method, handler, nil
end
if handler == true then
handler, hookSecure = nil, true
end
hook(self, object, method, handler, false, false, true, hookSecure or false, "Usage: RawHook([object], method, [handler], [hookSecure])")
end
--- SecureHook a function or a method on an object.
-- This function is a wrapper around the `hooksecurefunc` function in the WoW API. Using AceHook
-- extends the functionality of secure hooks, and adds the ability to unhook once the hook isn't
-- required anymore, or the addon is being disabled.\\
-- Secure Hooks should be used if the secure-status of the function is vital to its function,
-- and taint would block execution. Secure Hooks are always called after the original function was called
-- ("Post Hook"), and you cannot modify the arguments, return values or control the execution.
-- @paramsig [object], method, [handler]
-- @param object The object to hook a method from
-- @param method If object was specified, the name of the method, or the name of the function to hook.
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked function)
function AceHook:SecureHook(object, method, handler)
if type(object) == "string" then
method, handler, object = object, method, nil
end
hook(self, object, method, handler, false, true, false, false, "Usage: SecureHook([object], method, [handler])")
end
--- Hook a script handler on a frame.
-- The hook created will be a "safe hook", that means that your handler will be called
-- before the hooked script ("Pre-Hook"), and you don't have to call the original function yourself,
-- however you cannot stop the execution of the function, or modify any of the arguments/return values.\\
-- This is the frame script equivalent of the :Hook safe-hook. It would typically be used to be notified
-- when a certain event happens to a frame.
-- @paramsig frame, script, [handler]
-- @param frame The Frame to hook the script on
-- @param script The script to hook
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked script)
-- @usage
-- -- create an addon with AceHook embeded
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
--
-- function MyAddon:OnEnable()
-- -- Hook the OnShow of FriendsFrame
-- self:HookScript(FriendsFrame, "OnShow", "FriendsFrameOnShow")
-- end
--
-- function MyAddon:FriendsFrameOnShow(frame)
-- print("The FriendsFrame was shown!")
-- end
function AceHook:HookScript(frame, script, handler)
hook(self, frame, script, handler, true, false, false, false, "Usage: HookScript(object, method, [handler])")
end
--- RawHook a script handler on a frame.
-- The hook created will be a "raw hook", that means that your handler will completly replace
-- the original script, and your handler has to call the original script (or not, depending on your intentions).\\
-- The original script will be stored in `self.hooks[frame][script]`.\\
-- This type of hook can be used for all purposes, and is usually the most common case when you need to modify arguments
-- or want to control execution of the original script.
-- @paramsig frame, script, [handler]
-- @param frame The Frame to hook the script on
-- @param script The script to hook
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked script)
-- @usage
-- -- create an addon with AceHook embeded
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
--
-- function MyAddon:OnEnable()
-- -- Hook the OnShow of FriendsFrame
-- self:RawHookScript(FriendsFrame, "OnShow", "FriendsFrameOnShow")
-- end
--
-- function MyAddon:FriendsFrameOnShow(frame)
-- -- Call the original function
-- self.hooks[frame].OnShow(frame)
-- -- Do our processing
-- -- .. stuff
-- end
function AceHook:RawHookScript(frame, script, handler)
hook(self, frame, script, handler, true, false, true, false, "Usage: RawHookScript(object, method, [handler])")
end
--- SecureHook a script handler on a frame.
-- This function is a wrapper around the `frame:HookScript` function in the WoW API. Using AceHook
-- extends the functionality of secure hooks, and adds the ability to unhook once the hook isn't
-- required anymore, or the addon is being disabled.\\
-- Secure Hooks should be used if the secure-status of the function is vital to its function,
-- and taint would block execution. Secure Hooks are always called after the original function was called
-- ("Post Hook"), and you cannot modify the arguments, return values or control the execution.
-- @paramsig frame, script, [handler]
-- @param frame The Frame to hook the script on
-- @param script The script to hook
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked script)
function AceHook:SecureHookScript(frame, script, handler)
hook(self, frame, script, handler, true, true, false, false, "Usage: SecureHookScript(object, method, [handler])")
end
--- Unhook from the specified function, method or script.
-- @paramsig [obj], method
-- @param obj The object or frame to unhook from
-- @param method The name of the method, function or script to unhook from.
function AceHook:Unhook(obj, method)
local usage = "Usage: Unhook([obj], method)"
if type(obj) == "string" then
method, obj = obj, nil
end
if obj and type(obj) ~= "table" then
error(format("%s: 'obj' - expecting nil or table got %s", usage, type(obj)), 2)
end
if type(method) ~= "string" then
error(format("%s: 'method' - expeting string got %s", usage, type(method)), 2)
end
local uid
if obj then
uid = registry[self][obj] and registry[self][obj][method]
else
uid = registry[self][method]
end
if not uid or not actives[uid] then
-- Declining to error on an unneeded unhook since the end effect is the same and this would just be annoying.
return false
end
actives[uid], handlers[uid] = nil, nil
if obj then
registry[self][obj][method] = nil
registry[self][obj] = next(registry[self][obj]) and registry[self][obj] or nil
-- if the hook reference doesnt exist, then its a secure hook, just bail out and dont do any unhooking
if not self.hooks[obj] or not self.hooks[obj][method] then return true end
if scripts[uid] and obj:GetScript(method) == uid then -- unhooks scripts
obj:SetScript(method, self.hooks[obj][method] ~= donothing and self.hooks[obj][method] or nil)
scripts[uid] = nil
elseif obj and self.hooks[obj] and self.hooks[obj][method] and obj[method] == uid then -- unhooks methods
obj[method] = self.hooks[obj][method]
end
self.hooks[obj][method] = nil
self.hooks[obj] = next(self.hooks[obj]) and self.hooks[obj] or nil
else
registry[self][method] = nil
-- if self.hooks[method] doesn't exist, then this is a SecureHook, just bail out
if not self.hooks[method] then return true end
if self.hooks[method] and _G[method] == uid then -- unhooks functions
_G[method] = self.hooks[method]
end
self.hooks[method] = nil
end
return true
end
--- Unhook all existing hooks for this addon.
function AceHook:UnhookAll()
for key, value in pairs(registry[self]) do
if type(key) == "table" then
for method in pairs(value) do
self:Unhook(key, method)
end
else
self:Unhook(key)
end
end
end
--- Check if the specific function, method or script is already hooked.
-- @paramsig [obj], method
-- @param obj The object or frame to unhook from
-- @param method The name of the method, function or script to unhook from.
function AceHook:IsHooked(obj, method)
-- we don't check if registry[self] exists, this is done by evil magicks in the metatable
if type(obj) == "string" then
if registry[self][obj] and actives[registry[self][obj]] then
return true, handlers[registry[self][obj]]
end
else
if registry[self][obj] and registry[self][obj][method] and actives[registry[self][obj][method]] then
return true, handlers[registry[self][obj][method]]
end
end
return false, nil
end
--- Upgrade our old embeded
for target, v in pairs( AceHook.embeded ) do
AceHook:Embed( target )
end
-4
View File
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceHook-3.0.lua"/>
</Ui>
-446
View File
@@ -1,446 +0,0 @@
--- AceTab-3.0 provides support for tab-completion.
-- Note: This library is not yet finalized.
-- @class file
-- @name AceTab-3.0
-- @release $Id: AceTab-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
local ACETAB_MAJOR, ACETAB_MINOR = 'AceTab-3.0', 9
local AceTab, oldminor = LibStub:NewLibrary(ACETAB_MAJOR, ACETAB_MINOR)
if not AceTab then return end -- No upgrade needed
AceTab.registry = AceTab.registry or {}
-- local upvalues
local _G = _G
local pairs = pairs
local ipairs = ipairs
local type = type
local registry = AceTab.registry
local strfind = string.find
local strsub = string.sub
local strlower = string.lower
local strformat = string.format
local strmatch = string.match
local function printf(...)
DEFAULT_CHAT_FRAME:AddMessage(strformat(...))
end
local function getTextBeforeCursor(this, start)
return strsub(this:GetText(), start or 1, this:GetCursorPosition())
end
-- Hook OnTabPressed and OnTextChanged for the frame, give it an empty matches table, and set its curMatch to 0, if we haven't done so already.
local function hookFrame(f)
if f.hookedByAceTab3 then return end
f.hookedByAceTab3 = true
if f == ChatEdit_GetActiveWindow() then
local origCTP = ChatEdit_CustomTabPressed
function ChatEdit_CustomTabPressed(...)
if AceTab:OnTabPressed(f) then
return origCTP(...)
else
return true
end
end
else
local origOTP = f:GetScript('OnTabPressed')
if type(origOTP) ~= 'function' then
origOTP = function() end
end
f:SetScript('OnTabPressed', function(...)
if AceTab:OnTabPressed(f) then
return origOTP(...)
end
end)
end
f.at3curMatch = 0
f.at3matches = {}
end
local firstPMLength
local fallbacks, notfallbacks = {}, {} -- classifies completions into those which have preconditions and those which do not. Those without preconditions are only considered if no other completions have matches.
local pmolengths = {} -- holds the number of characters to overwrite according to pmoverwrite and the current prematch
-- ------------------------------------------------------------------------------
-- RegisterTabCompletion( descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite )
-- See http://www.wowace.com/wiki/AceTab-2.0 for detailed API documentation
--
-- descriptor string Unique identifier for this tab completion set
--
-- prematches string|table|nil String match(es) AFTER which this tab completion will apply.
-- AceTab will ignore tabs NOT preceded by the string(s).
-- If no value is passed, will check all tabs pressed in the specified editframe(s) UNLESS a more-specific tab complete applies.
--
-- wordlist function|table Function that will be passed a table into which it will insert strings corresponding to all possible completions, or an equivalent table.
-- The text in the editbox, the position of the start of the word to be completed, and the uncompleted partial word
-- are passed as second, third, and fourth arguments, to facilitate pre-filtering or conditional formatting, if desired.
--
-- usagefunc function|boolean|nil Usage statement function. Defaults to the wordlist, one per line. A boolean true squelches usage output.
--
-- listenframes string|table|nil EditFrames to monitor. Defaults to ChatFrameEditBox.
--
-- postfunc function|nil Post-processing function. If supplied, matches will be passed through this function after they've been identified as a match.
--
-- pmoverwrite boolean|number|nil Offset the beginning of the completion string in the editbox when making a completion. Passing a boolean true indicates that we want to overwrite
-- the entire prematch string, and passing a number will overwrite that many characters prior to the cursor.
-- This is useful when you want to use the prematch as an indicator character, but ultimately do not want it as part of the text, itself.
--
-- no return
-- ------------------------------------------------------------------------------
function AceTab:RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite)
-- Arg checks
if type(descriptor) ~= 'string' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'descriptor' - string expected.", 3) end
if prematches and type(prematches) ~= 'string' and type(prematches) ~= 'table' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'prematches' - string, table, or nil expected.", 3) end
if type(wordlist) ~= 'function' and type(wordlist) ~= 'table' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'wordlist' - function or table expected.", 3) end
if usagefunc and type(usagefunc) ~= 'function' and type(usagefunc) ~= 'boolean' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'usagefunc' - function or boolean expected.", 3) end
if listenframes and type(listenframes) ~= 'string' and type(listenframes) ~= 'table' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'listenframes' - string or table expected.", 3) end
if postfunc and type(postfunc) ~= 'function' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'postfunc' - function expected.", 3) end
if pmoverwrite and type(pmoverwrite) ~= 'boolean' and type(pmoverwrite) ~= 'number' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'pmoverwrite' - boolean or number expected.", 3) end
local pmtable
if type(prematches) == 'table' then
pmtable = prematches
notfallbacks[descriptor] = true
else
pmtable = {}
-- Mark this group as a fallback group if no value was passed.
if not prematches then
pmtable[1] = ""
fallbacks[descriptor] = true
-- Make prematches into a one-element table if it was passed as a string.
elseif type(prematches) == 'string' then
pmtable[1] = prematches
if prematches == "" then
fallbacks[descriptor] = true
else
notfallbacks[descriptor] = true
end
end
end
-- Make listenframes into a one-element table if it was not passed a table of frames.
if not listenframes then -- default
listenframes = {}
for i = 1, NUM_CHAT_WINDOWS do
listenframes[i] = _G["ChatFrame"..i.."EditBox"]
end
elseif type(listenframes) ~= 'table' or type(listenframes[0]) == 'userdata' and type(listenframes.IsObjectType) == 'function' then -- single frame or framename
listenframes = { listenframes }
end
-- Hook each registered listenframe and give it a matches table.
for _, f in pairs(listenframes) do
if type(f) == 'string' then
f = _G[f]
end
if type(f) ~= 'table' or type(f[0]) ~= 'userdata' or type(f.IsObjectType) ~= 'function' then
error(format(ACETAB_MAJOR..": Cannot register frame %q; it does not exist", f:GetName()))
end
if f then
if f:GetObjectType() ~= 'EditBox' then
error(format(ACETAB_MAJOR..": Cannot register frame %q; it is not an EditBox", f:GetName()))
else
hookFrame(f)
end
end
end
-- Everything checks out; register this completion.
if not registry[descriptor] then
registry[descriptor] = { prematches = pmtable, wordlist = wordlist, usagefunc = usagefunc, listenframes = listenframes, postfunc = postfunc, pmoverwrite = pmoverwrite }
end
end
function AceTab:IsTabCompletionRegistered(descriptor)
return registry and registry[descriptor]
end
function AceTab:UnregisterTabCompletion(descriptor)
registry[descriptor] = nil
pmolengths[descriptor] = nil
fallbacks[descriptor] = nil
notfallbacks[descriptor] = nil
end
-- ------------------------------------------------------------------------------
-- gcbs( s1, s2 )
--
-- s1 string First string to be compared
--
-- s2 string Second string to be compared
--
-- returns the greatest common substring beginning s1 and s2
-- ------------------------------------------------------------------------------
local function gcbs(s1, s2)
if not s1 and not s2 then return end
if not s1 then s1 = s2 end
if not s2 then s2 = s1 end
if #s2 < #s1 then
s1, s2 = s2, s1
end
if strfind(strlower(s2), "^"..strlower(s1)) then
return s1
else
return gcbs(strsub(s1, 1, -2), s2)
end
end
local cursor -- Holds cursor position. Set in :OnTabPressed().
-- ------------------------------------------------------------------------------
-- cycleTab()
-- For when a tab press has multiple possible completions, we need to allow the user to press tab repeatedly to cycle through them.
-- If we have multiple possible completions, all tab presses after the first will call this function to cycle through and insert the different possible matches.
-- This function will stop being called after OnTextChanged() is triggered by something other than AceTab (i.e. the user inputs a character).
-- ------------------------------------------------------------------------------
local previousLength, cMatch, matched, postmatch
local function cycleTab(this)
cMatch = 0 -- Counter across all sets. The pseudo-index relevant to this value and corresponding to the current match is held in this.at3curMatch
matched = false
-- Check each completion group registered to this frame.
for desc, compgrp in pairs(this.at3matches) do
-- Loop through the valid completions for this set.
for m, pm in pairs(compgrp) do
cMatch = cMatch + 1
if cMatch == this.at3curMatch then -- we're back to where we left off last time through the combined list
this.at3lastMatch = m
this.at3lastWord = pm
this.at3curMatch = cMatch + 1 -- save the new cMatch index
matched = true
break
end
end
if matched then break end
end
-- If our index is beyond the end of the list, reset the original uncompleted substring and let the cycle start over next time tab is pressed.
if not matched then
this.at3lastMatch = this.at3origMatch
this.at3lastWord = this.at3origWord
this.at3curMatch = 1
end
-- Insert the completion.
this:HighlightText(this.at3matchStart-1, cursor)
this:Insert(this.at3lastWord or '')
this.at3_last_precursor = getTextBeforeCursor(this) or ''
end
local IsSecureCmd = IsSecureCmd
local cands, candUsage = {}, {}
local numMatches = 0
local firstMatch, hasNonFallback, allGCBS, setGCBS, usage
local text_precursor, text_all, text_pmendToCursor
local matches, usagefunc -- convenience locals
-- Fill the this.at3matches[descriptor] tables with matching completion pairs for each entry, based on
-- the partial string preceding the cursor position and using the corresponding registered wordlist.
--
-- The entries of the matches tables are of the format raw_match = formatted_match, where raw_match is the plaintext completion and
-- formatted_match is the match after being formatted/altered/processed by the registered postfunc.
-- If no postfunc exists, then the formatted and raw matches are the same.
local pms, pme, pmt, prematchStart, prematchEnd, text_prematch, entry
local function fillMatches(this, desc, fallback)
entry = registry[desc]
-- See what frames are registered for this completion group. If the frame in which we pressed tab is one of them, then we start building matches.
for _, f in ipairs(entry.listenframes) do
if f == this then
-- Try each precondition string registered for this completion group.
for _, prematch in ipairs(entry.prematches) do
-- Test if our prematch string is satisfied.
-- If it is, then we find its last occurence prior to the cursor, calculate and store its pmoverwrite value (if applicable), and start considering completions.
if fallback then prematch = "%s" end
-- Find the last occurence of the prematch before the cursor.
pms, pme, pmt = nil, 1, ''
text_prematch, prematchEnd, prematchStart = nil, nil, nil
while true do
pms, pme, pmt = strfind(text_precursor, "("..prematch..")", pme)
if pms then
prematchStart, prematchEnd, text_prematch = pms, pme, pmt
pme = pme + 1
else
break
end
end
if not prematchStart and fallback then
prematchStart, prematchEnd, text_prematch = 0, 0, ''
end
if prematchStart then
-- text_pmendToCursor should be the sub-word/phrase to be completed.
text_pmendToCursor = strsub(text_precursor, prematchEnd + 1)
-- How many characters should we eliminate before the completion before writing it in.
pmolengths[desc] = entry.pmoverwrite == true and #text_prematch or entry.pmoverwrite or 0
-- This is where we will insert completions, taking the prematch overwrite into account.
this.at3matchStart = prematchEnd + 1 - (pmolengths[desc] or 0)
-- We're either a non-fallback set or all completions thus far have been fallback sets, and the precondition matches.
-- Create cands from the registered wordlist, filling it with all potential (unfiltered) completion strings.
local wordlist = entry.wordlist
local cands = type(wordlist) == 'table' and wordlist or {}
if type(wordlist) == 'function' then
wordlist(cands, text_all, prematchEnd + 1, text_pmendToCursor)
end
if cands ~= false then
matches = this.at3matches[desc] or {}
for i in pairs(matches) do matches[i] = nil end
-- Check each of the entries in cands to see if it completes the word before the cursor.
-- Finally, increment our match count and set firstMatch, if appropriate.
for _, m in ipairs(cands) do
if strfind(strlower(m), strlower(text_pmendToCursor), 1, 1) == 1 then -- we have a matching completion!
hasNonFallback = hasNonFallback or (not fallback)
matches[m] = entry.postfunc and entry.postfunc(m, prematchEnd + 1, text_all) or m
numMatches = numMatches + 1
if numMatches == 1 then
firstMatch = matches[m]
firstPMLength = pmolengths[desc] or 0
end
end
end
this.at3matches[desc] = numMatches > 0 and matches or nil
end
end
end
end
end
end
function AceTab:OnTabPressed(this)
if this:GetText() == '' then return true end
-- allow Blizzard to handle slash commands, themselves
if this == ChatEdit_GetActiveWindow() then
local command = this:GetText()
if strfind(command, "^/[%a%d_]+$") then
return true
end
local cmd = strmatch(command, "^/[%a%d_]+")
if cmd and IsSecureCmd(cmd) then
return true
end
end
cursor = this:GetCursorPosition()
text_all = this:GetText()
text_precursor = getTextBeforeCursor(this) or ''
-- If we've already found some matches and haven't done anything since the last tab press, then (continue) cycling matches.
-- Otherwise, reset this frame's matches and proceed to creating our list of possible completions.
this.at3lastMatch = this.at3curMatch > 0 and (this.at3lastMatch or this.at3origWord)
-- Detects if we've made any edits since the last tab press. If not, continue cycling completions.
if text_precursor == this.at3_last_precursor then
return cycleTab(this)
else
for i in pairs(this.at3matches) do this.at3matches[i] = nil end
this.at3curMatch = 0
this.at3origWord = nil
this.at3origMatch = nil
this.at3lastWord = nil
this.at3lastMatch = nil
this.at3_last_precursor = text_precursor
end
numMatches = 0
firstMatch = nil
firstPMLength = 0
hasNonFallback = false
for i in pairs(pmolengths) do pmolengths[i] = nil end
for desc in pairs(notfallbacks) do
fillMatches(this, desc)
end
if not hasNonFallback then
for desc in pairs(fallbacks) do
fillMatches(this, desc, true)
end
end
if not firstMatch then
this.at3_last_precursor = "\0"
return true
end
-- We want to replace the entire word with our completion, so highlight it up to the cursor.
-- If only one match exists, then stick it in there and append a space.
if numMatches == 1 then
-- HighlightText takes the value AFTER which the highlighting starts, so we have to subtract 1 to have it start before the first character.
this:HighlightText(this.at3matchStart-1, cursor)
this:Insert(firstMatch)
this:Insert(" ")
else
-- Otherwise, we want to begin cycling through the valid completions.
-- Beginning a cycle also causes the usage statement to be printed, if one exists.
-- Print usage statements for each possible completion (and gather up the GCBS of all matches while we're walking the tables).
allGCBS = nil
for desc, matches in pairs(this.at3matches) do
-- Don't print usage statements for fallback completion groups if we have 'real' completion groups with matches.
if hasNonFallback and fallbacks[desc] then break end
-- Use the group's description as a heading for its usage statements.
DEFAULT_CHAT_FRAME:AddMessage(desc..":")
usagefunc = registry[desc].usagefunc
if not usagefunc then
-- No special usage processing; just print a list of the (formatted) matches.
for m, fm in pairs(matches) do
DEFAULT_CHAT_FRAME:AddMessage(fm)
allGCBS = gcbs(allGCBS, m)
end
else
-- Print a usage statement based on the corresponding registered usagefunc.
-- candUsage is the table passed to usagefunc to be filled with candidate = usage_statement pairs.
if type(usagefunc) == 'function' then
for i in pairs(candUsage) do candUsage[i] = nil end
-- usagefunc takes the greatest common substring of valid matches as one of its args, so let's find that now.
-- TODO: Make the GCBS function accept a vararg or table, after which we can just pass in the list of matches.
setGCBS = nil
for m in pairs(matches) do
setGCBS = gcbs(setGCBS, m)
end
allGCBS = gcbs(allGCBS, setGCBS)
usage = usagefunc(candUsage, matches, setGCBS, strsub(text_precursor, 1, prematchEnd))
-- If the usagefunc returns a string, then the entire usage statement has been taken care of by usagefunc, and we need only to print it...
if type(usage) == 'string' then
DEFAULT_CHAT_FRAME:AddMessage(usage)
-- ...otherwise, it should have filled candUsage with candidate-usage statement pairs, and we need to print the matching ones.
elseif next(candUsage) and numMatches > 0 then
for m, fm in pairs(matches) do
if candUsage[m] then DEFAULT_CHAT_FRAME:AddMessage(strformat("%s - %s", fm, candUsage[m])) end
end
end
end
end
if next(matches) then
-- Replace the original string with the greatest common substring of all valid completions.
this.at3curMatch = 1
this.at3origWord = strsub(text_precursor, this.at3matchStart, this.at3matchStart + pmolengths[desc] - 1) .. allGCBS or ""
this.at3origMatch = allGCBS or ""
this.at3lastWord = this.at3origWord
this.at3lastMatch = this.at3origMatch
this:HighlightText(this.at3matchStart-1, cursor)
this:Insert(this.at3origWord)
this.at3_last_precursor = getTextBeforeCursor(this) or ''
end
end
end
end
-4
View File
@@ -1,4 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceTab-3.0.lua"/>
</Ui>
+9 -9
View File
@@ -50,7 +50,7 @@ function DF:LoadAllSpells (hashMap, indexTable, allSpellsSameName)
--pre checking which tables to fill to avoid checking if the table exists during the gigantic loop for performance
if (not DF.LoadingAuraAlertFrame) then
DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent)
DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent, "BackdropTemplate")
DF.LoadingAuraAlertFrame:SetSize (340, 75)
DF.LoadingAuraAlertFrame:SetPoint ("center")
DF.LoadingAuraAlertFrame:SetFrameStrata ("TOOLTIP")
@@ -210,15 +210,15 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
f.db = db
f.OnProfileChanged = on_profile_changed
f.LocTexts = texts
options = options or {}
self.table.deploy (options, aura_panel_defaultoptions)
local f_auto = CreateFrame ("frame", "$parent_Automatic", f)
local f_manual = CreateFrame ("frame", "$parent_Manual", f)
local f_auto = CreateFrame ("frame", "$parent_Automatic", f, "BackdropTemplate")
local f_manual = CreateFrame ("frame", "$parent_Manual", f, "BackdropTemplate")
f_auto:SetPoint ("topleft", f, "topleft", 0, -24)
f_manual:SetPoint ("topleft", f, "topleft", 0, -24)
f_auto:SetSize (600, 600)
@@ -256,7 +256,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
end
end
local background_method_selection = CreateFrame ("frame", nil, f)
local background_method_selection = CreateFrame ("frame", nil, f, "BackdropTemplate")
background_method_selection:SetHeight (82)
background_method_selection:SetPoint ("topleft", f, "topleft", 0, 0)
background_method_selection:SetPoint ("topright", f, "topright", 0, 0)
@@ -342,12 +342,12 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
local textEntryWidth = 120
--create the background
local background_add_blacklist = CreateFrame ("frame", nil, f_auto)
local background_add_blacklist = CreateFrame ("frame", nil, f_auto, "BackdropTemplate")
background_add_blacklist:SetSize (textEntryWidth + 10, 135)
DF:ApplyStandardBackdrop (background_add_blacklist)
background_add_blacklist.__background:SetVertexColor (0.47, 0.27, 0.27)
local background_add_tracklist = CreateFrame ("frame", nil, f_auto)
local background_add_tracklist = CreateFrame ("frame", nil, f_auto, "BackdropTemplate")
background_add_tracklist:SetSize (textEntryWidth + 10, 135)
DF:ApplyStandardBackdrop (background_add_tracklist)
background_add_tracklist.__background:SetVertexColor (0.27, 0.27, 0.47)
@@ -651,7 +651,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
end
local createLineFunc = function (self, index)
local line = CreateFrame ("button", "$parentLine" .. index, self)
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
line:SetPoint ("topleft", self, "topleft", 1, - ((index - 1) * (lineHeight + 1)) - 1)
line:SetSize (scrollWidth - 2, lineHeight)
line:SetScript ("OnEnter", autoTrackList_LineOnEnter)
@@ -815,7 +815,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
end
local scroll_createline = function (self, index)
local line = CreateFrame ("button", "$parentLine" .. index, self)
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1)
line:SetSize (scroll_width - 2, scroll_line_height)
line:SetScript ("OnEnter", line_onenter)
+13 -1
View File
@@ -430,6 +430,18 @@ local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames ["button"]]
end
end
function ButtonMetaFunctions:SetBackdrop(...)
return self.button:SetBackdrop(...)
end
function ButtonMetaFunctions:SetBackdropColor(...)
return self.button:SetBackdropColor(...)
end
function ButtonMetaFunctions:SetBackdropBorderColor(...)
return self.button:SetBackdropBorderColor(...)
end
function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight, short_method)
if (not self.icon) then
self.icon = self:CreateTexture (nil, "artwork")
@@ -1053,7 +1065,7 @@ function DF:NewButton (parent, container, name, member, w, h, func, param1, para
ButtonObject.container = container
ButtonObject.options = {OnGrab = false}
ButtonObject.button = CreateFrame ("button", name, parent)
ButtonObject.button = CreateFrame ("button", name, parent,"BackdropTemplate")
DF:Mixin (ButtonObject.button, DF.WidgetFunctions)
build_button (ButtonObject.button)
+2 -2
View File
@@ -272,7 +272,7 @@ function DF:CreateCoolTip()
--> main frame
local frame1
if (not GameCooltipFrame1) then
frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent)
frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent,"TooltipBackdropTemplate")
tinsert (UISpecialFrames, "GameCooltipFrame1")
DF:CreateFlashAnimation (frame1)
@@ -299,7 +299,7 @@ function DF:CreateCoolTip()
--> secondary frame
local frame2
if (not GameCooltipFrame2) then
frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent)
frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent,"TooltipBackdropTemplate")
tinsert (UISpecialFrames, "GameCooltipFrame2")
DF:CreateFlashAnimation (frame2)
+18 -5
View File
@@ -184,6 +184,19 @@ local DropDownMetaFunctions = _G[DF.GlobalWidgetControlNames ["dropdown"]]
end
------------------------------------------------------------------------------------------------------------
function DropDownMetaFunctions:SetBackdrop(...)
return self.dropdown:SetBackdrop(...)
end
function DropDownMetaFunctions:SetBackdropColor(...)
return self.dropdown:SetBackdropColor(...)
end
function DropDownMetaFunctions:SetBackdropBorderColor(...)
return self.dropdown:SetBackdropBorderColor(...)
end
--> methods
function DropDownMetaFunctions:IsShown()
return self.dropdown:IsShown()
@@ -1122,7 +1135,7 @@ local border_backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1
local child_backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 256, insets = {left = 0, right = 0, top = 0, bottom = 0}}
function DF:CreateNewDropdownFrame (parent, name)
local f = CreateFrame ("button", name, parent)
local f = CreateFrame ("button", name, parent,"BackdropTemplate")
f:SetBackdrop (default_backdrop)
f:SetSize (150, 20)
@@ -1171,7 +1184,7 @@ function DF:CreateNewDropdownFrame (parent, name)
f.arrowTexture2:SetDrawLayer ("OVERLAY", 2)
--dropdown
local border = CreateFrame ("frame", "$Parent_Border", f)
local border = CreateFrame ("frame", "$Parent_Border", f,"BackdropTemplate")
border:Hide()
border:SetFrameStrata ("FULLSCREEN")
border:SetSize (150, 150)
@@ -1182,14 +1195,14 @@ function DF:CreateNewDropdownFrame (parent, name)
border:SetBackdropBorderColor (0, 0, 0, 1)
f.dropdownborder = border
local scroll = CreateFrame ("ScrollFrame", "$Parent_ScrollFrame", f)
local scroll = CreateFrame ("ScrollFrame", "$Parent_ScrollFrame", f,"BackdropTemplate")
scroll:Hide()
scroll:SetFrameStrata ("FULLSCREEN")
scroll:SetSize (150, 150)
scroll:SetPoint ("topleft", f, "bottomleft", 0, 0)
f.dropdownframe = scroll
local child = CreateFrame ("frame", "$Parent_ScrollChild", scroll)
local child = CreateFrame ("frame", "$Parent_ScrollChild", scroll,"BackdropTemplate")
child:SetSize (150, 150)
child:SetPoint ("topleft", scroll, "topleft", 0, 0)
child:SetBackdrop (child_backdrop)
@@ -1221,7 +1234,7 @@ end
function DF:CreateDropdownButton (parent, name)
local f = CreateFrame ("button", name, parent)
local f = CreateFrame ("button", name, parent,"BackdropTemplate")
f:SetSize (150, 20)
local statusbar = f:CreateTexture ("$parent_StatusBarTexture", "ARTWORK")
+227 -25
View File
@@ -1,5 +1,5 @@
local dversion = 195
local dversion = 211
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -1069,6 +1069,8 @@ end
local cur_y = y_offset
local max_x = 0
local latestInlineWidget
local widgetIndexes = {
label = 1,
dropdown = 1,
@@ -1085,6 +1087,12 @@ end
for index, widget_table in ipairs(menu) do
local widget_created
if (latestInlineWidget) then
if (not widget_table.inline) then
latestInlineWidget = nil
cur_y = cur_y - 20
end
end
if (not widget_table.novolatile) then
@@ -1097,21 +1105,19 @@ end
local label = getMenuWidgetVolative(parent, "label", widgetIndexes)
widget_created = label
label.text = widget_table.get() or widget_table.text or ""
label.color = widget_table.color
if (widget_table.font) then
label.fontface = widget_table.font
end
if (widget_table.text_template or text_template) then
label:SetTemplate(widget_table.text_template or text_template)
else
label.fontsize = widget_table.size or 10
end
if (label.fontface) then
label.fontface = widget_table.font or "GameFontHighlightSmall"
end
if (widget_table.color) then
label.fontcolor = widget_table.color
end
label.text = widget_table.get() or widget_table.text or ""
label._get = widget_table.get
label.widget_type = "label"
label:ClearAllPoints()
@@ -1191,6 +1197,13 @@ end
end
end
if (widget_table.width) then
switch:SetWidth(widget_table.width)
end
if (widget_table.height) then
switch:SetHeight(widget_table.height)
end
switch.hasLabel.text = widget_table.name .. (use_two_points and ": " or "")
switch.hasLabel:SetTemplate(widget_table.text_template or text_template)
@@ -1332,7 +1345,18 @@ end
button.textsize = textTemplate.size
button.text = widget_table.name
if (widget_table.inline) then
if (latestInlineWidget) then
button:SetPoint ("left", latestInlineWidget, "right", 2, 0)
latestInlineWidget = button
else
button:SetPoint (cur_x, cur_y)
latestInlineWidget = button
end
else
button:SetPoint (cur_x, cur_y)
end
button.tooltip = widget_table.desc
button.widget_type = "execute"
@@ -1345,6 +1369,13 @@ end
end
end
if (widget_table.width) then
button:SetWidth(widget_table.width)
end
if (widget_table.height) then
button:SetHeight(widget_table.height)
end
if (widget_table.id) then
parent.widgetids [widget_table.id] = button
end
@@ -1360,7 +1391,7 @@ end
local textentry = getMenuWidgetVolative(parent, "textentry", widgetIndexes)
widget_created = textentry
textentry:SetCommitFunction(widget_table.func)
textentry:SetCommitFunction(widget_table.func or widget_table.set)
textentry:SetTemplate(widget_table.template or widget_table.button_template or button_template)
textentry:SetSize(widget_table.width or 120, widget_table.height or 18)
@@ -1368,18 +1399,15 @@ end
textentry.text = widget_table.get()
textentry._get = widget_table.get
textentry.widget_type = "textentry"
textentry:SetHook ("OnEnterPressed", widget_table.set)
textentry:SetHook ("OnEditFocusLost", widget_table.set)
textentry:SetHook ("OnEnterPressed", widget_table.func or widget_table.set)
textentry:SetHook ("OnEditFocusLost", widget_table.func or widget_table.set)
textentry.hasLabel.text = widget_table.name .. (use_two_points and ": " or "")
textentry.hasLabel:SetTemplate(widget_table.text_template or text_template)
textentry:SetPoint ("left", textentry.hasLabel, "right", 2)
textentry.hasLabel:SetPoint (cur_x, cur_y)
if (value_change_hook) then
textentry:SetHook("OnEnterPressed", value_change_hook)
textentry:SetHook("OnEditFocusLost", value_change_hook)
end
--> text entry doesn't trigger global callback
--> hook list
if (widget_table.hooks) then
@@ -1403,11 +1431,13 @@ end
tinsert (disable_on_combat, widget_created)
end
if (not widget_table.inline) then
if (widget_table.spacement) then
cur_y = cur_y - 30
else
cur_y = cur_y - 20
end
end
if (widget_table.type == "breakline" or cur_y < height) then
cur_y = y_offset
@@ -1436,12 +1466,20 @@ end
local max_x = 0
local line_widgets_created = 0 --how many widgets has been created on this line loop pass
local latestInlineWidget
height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
height = height*-1
for index, widget_table in ipairs (menu) do
local widget_created
if (latestInlineWidget) then
if (not widget_table.inline) then
latestInlineWidget = nil
cur_y = cur_y - 28
end
end
if (widget_table.type == "blank" or widget_table.type == "space") then
-- do nothing
@@ -1523,6 +1561,13 @@ end
end
end
if (widget_table.width) then
switch:SetWidth(widget_table.width)
end
if (widget_table.height) then
switch:SetHeight(widget_table.height)
end
local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
if (widget_table.boxfirst) then
switch:SetPoint (cur_x, cur_y)
@@ -1647,13 +1692,29 @@ end
button:InstallCustomTexture()
end
if (widget_table.inline) then
if (latestInlineWidget) then
button:SetPoint ("left", latestInlineWidget, "right", 2, 0)
latestInlineWidget = button
else
button:SetPoint (cur_x, cur_y)
latestInlineWidget = button
end
else
button:SetPoint (cur_x, cur_y)
end
button.tooltip = widget_table.desc
button.widget_type = "execute"
--> execute doesn't trigger global callback
--notice: execute doesn't trigger global callback
--> hook list
--button icon
if (widget_table.icontexture) then
button:SetIcon(widget_table.icontexture, nil, nil, nil, widget_table.icontexcoords, nil, nil, 2)
end
--hook list
if (widget_table.hooks) then
for hookName, hookFunc in pairs (widget_table.hooks) do
button:SetHook (hookName, hookFunc)
@@ -1664,6 +1725,13 @@ end
parent.widgetids [widget_table.id] = button
end
if (widget_table.width) then
button:SetWidth(widget_table.width)
end
if (widget_table.height) then
button:SetHeight(widget_table.height)
end
local size = button:GetWidth() + 4
if (size > max_x) then
max_x = size
@@ -1677,13 +1745,13 @@ end
line_widgets_created = line_widgets_created + 1
elseif (widget_table.type == "textentry") then
local textentry = DF:CreateTextEntry (parent, widget_table.func, 120, 18, nil, "$parentWidget" .. index, nil, button_template)
local textentry = DF:CreateTextEntry (parent, widget_table.func or widget_table.set, 120, 18, nil, "$parentWidget" .. index, nil, button_template)
textentry.tooltip = widget_table.desc
textentry.text = widget_table.get()
textentry._get = widget_table.get
textentry.widget_type = "textentry"
textentry:SetHook ("OnEnterPressed", widget_table.set)
textentry:SetHook ("OnEditFocusLost", widget_table.set)
textentry:SetHook ("OnEnterPressed", widget_table.func or widget_table.set)
textentry:SetHook ("OnEditFocusLost", widget_table.func or widget_table.set)
local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
textentry:SetPoint ("left", label, "right", 2)
@@ -1721,11 +1789,13 @@ end
tinsert (disable_on_combat, widget_created)
end
if (not widget_table.inline) then
if (widget_table.spacement) then
cur_y = cur_y - 30
else
cur_y = cur_y - 20
end
end
if (widget_table.type == "breakline" or cur_y < height) then
cur_y = y_offset
@@ -2055,6 +2125,8 @@ function DF:GetBestFontForLanguage (language, western, cyrillic, china, korean,
end
end
--DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
--DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = DF:GetBestFontForLanguage()}
DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = DF:GetBestFontForLanguage()}
@@ -2234,6 +2306,7 @@ function DF:SetHook (hookType, func)
end
else
if (DF.debug) then
print (debugstack())
error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".")
end
end
@@ -2709,6 +2782,7 @@ local glow_overlay_play = function (self)
self.animOut:Stop()
end
if (not self.animIn:IsPlaying()) then
self.animIn:Stop()
self.animIn:Play()
end
end
@@ -3097,9 +3171,11 @@ function DF:ReskinSlider (slider, heightOffset)
slider.cima:GetPushedTexture():SetPoint ("center", slider.cima, "center", 1, 1)
slider.cima:GetDisabledTexture():SetPoint ("center", slider.cima, "center", 1, 1)
slider.cima:SetSize (16, 16)
--[=[
slider.cima:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
slider.cima:SetBackdropColor (0, 0, 0, 0.3)
slider.cima:SetBackdropBorderColor (0, 0, 0, 1)
]=]
slider.baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
slider.baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
@@ -3111,6 +3187,7 @@ function DF:ReskinSlider (slider, heightOffset)
slider.baixo:GetPushedTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
slider.baixo:GetDisabledTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
slider.baixo:SetSize (16, 16)
--[=[
slider.baixo:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
slider.baixo:SetBackdropColor (0, 0, 0, 0.35)
slider.baixo:SetBackdropBorderColor (0, 0, 0, 1)
@@ -3118,6 +3195,7 @@ function DF:ReskinSlider (slider, heightOffset)
slider.slider:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
slider.slider:SetBackdropColor (0, 0, 0, 0.35)
slider.slider:SetBackdropBorderColor (0, 0, 0, 1)
]=]
--slider.slider:Altura (164)
slider.slider:cimaPoint (0, 13)
@@ -3156,10 +3234,11 @@ function DF:ReskinSlider (slider, heightOffset)
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0)
slider.ScrollBar.ScrollUpButton:SetSize (16, 16)
--[=[
slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
slider.ScrollBar.ScrollUpButton:SetBackdropColor (0, 0, 0, 0.3)
slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor (0, 0, 0, 1)
]=]
--it was having problems with the texture anchor when calling ClearAllPoints() and setting new points different from the original
--now it is using the same points from the original with small offsets tp align correctly
end
@@ -3189,9 +3268,11 @@ function DF:ReskinSlider (slider, heightOffset)
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4)
slider.ScrollBar.ScrollDownButton:SetSize (16, 16)
--[=[
slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
slider.ScrollBar.ScrollDownButton:SetBackdropColor (0, 0, 0, 0.3)
slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor (0, 0, 0, 1)
]=]
--<Anchor point="TOP" relativePoint="BOTTOM"/>
--slider.ScrollBar.ScrollDownButton:SetPoint ("top", slider.ScrollBar, "bottom", 0, 0)
@@ -3211,10 +3292,11 @@ function DF:ReskinSlider (slider, heightOffset)
slider.ScrollBar.ThumbTexture:SetSize (12, 8)
--
--[=[
slider.ScrollBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
slider.ScrollBar:SetBackdropColor (0, 0, 0, 0.35)
slider.ScrollBar:SetBackdropBorderColor (0, 0, 0, 1)
]=]
end
end
@@ -3339,6 +3421,7 @@ DF.ClassIndexToFileName = {
[2] = "PALADIN",
}
DF.ClassFileNameToIndex = {
["DEATHKNIGHT"] = 6,
["WARRIOR"] = 1,
@@ -3910,6 +3993,7 @@ do
if (object) then
tinsert(self.inUse, object)
return object, false
else
--need to create the new object
local newObject = self.newObjectFunc(self, unpack(self.payload))
@@ -3957,7 +4041,7 @@ do
--return the amount of objects
local getamount = function(self)
return #self.notUse + #self.inUse
return #self.notUse + #self.inUse, #self.notUse, #self.inUse
end
local poolMixin = {
@@ -3991,3 +4075,121 @@ do
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------
--> forbidden functions on scripts
--these are functions which scripts cannot run due to security issues
local forbiddenFunction = {
--block mail, trades, action house, banks
["C_AuctionHouse"] = true,
["C_Bank"] = true,
["C_GuildBank"] = true,
["SetSendMailMoney"] = true,
["SendMail"] = true,
["SetTradeMoney"] = true,
["AddTradeMoney"] = true,
["PickupTradeMoney"] = true,
["PickupPlayerMoney"] = true,
["AcceptTrade"] = true,
--frames
["BankFrame"] = true,
["TradeFrame"] = true,
["GuildBankFrame"] = true,
["MailFrame"] = true,
["EnumerateFrames"] = true,
--block run code inside code
["RunScript"] = true,
["securecall"] = true,
["getfenv"] = true,
["getfenv"] = true,
["loadstring"] = true,
["pcall"] = true,
["xpcall"] = true,
["getglobal"] = true,
["setmetatable"] = true,
["DevTools_DumpCommand"] = true,
--avoid creating macros
["SetBindingMacro"] = true,
["CreateMacro"] = true,
["EditMacro"] = true,
["hash_SlashCmdList"] = true,
["SlashCmdList"] = true,
--block guild commands
["GuildDisband"] = true,
["GuildUninvite"] = true,
--other things
["C_GMTicketInfo"] = true,
--deny messing addons with script support
["PlaterDB"] = true,
["_detalhes_global"] = true,
["WeakAurasSaved"] = true,
}
local C_RestrictedSubFunctions = {
["C_GuildInfo"] = {
["RemoveFromGuild"] = true,
},
}
--not in use, can't find a way to check within the environment handle
local addonRestrictedFunctions = {
["DetailsFramework"] = {
["SetEnvironment"] = true,
},
["Plater"] = {
["ImportScriptString"] = true,
["db"] = true,
},
["WeakAuras"] = {
["Add"] = true,
["AddMany"] = true,
["Delete"] = true,
["NewAura"] = true,
},
}
local C_SubFunctionsTable = {}
for globalTableName, functionTable in pairs(C_RestrictedSubFunctions) do
C_SubFunctionsTable [globalTableName] = {}
for functionName, functionObject in pairs(_G[globalTableName]) do
if (not functionTable[functionName]) then
C_SubFunctionsTable [globalTableName][functionName] = functionObject
end
end
end
DF.DefaultSecureScriptEnvironmentHandle = {
__index = function (env, key)
if (forbiddenFunction[key]) then
return nil
elseif (key == "_G") then
return env
elseif (C_SubFunctionsTable[key]) then
return C_SubFunctionsTable[key]
end
return _G[key]
end
}
function DF:SetEnvironment(func, environmentHandle)
environmentHandle = environmentHandle or DF.DefaultSecureScriptEnvironmentHandle
local newEnvironment = {}
setmetatable(newEnvironment, environmentHandle)
_G.setfenv(func, newEnvironment)
end
+1 -1
View File
@@ -50,7 +50,7 @@ end
--find the normalized percent of the value in the range. e.g range of 200-400 and a value of 250 result in 0.25
function DF:GetRangePercent (minValue, maxValue, value)
return (value - minValue) / (maxValue - minValue)
return (value - minValue) / max((maxValue - minValue), SMALL_FLOAT)
end
--find the value in the range given from a normalized percent. e.g range of 200-400 and a percent of 0.8 result in 360
+111 -101
View File
@@ -654,7 +654,7 @@ function DF:NewPanel (parent, container, name, member, w, h, backdrop, backdropc
PanelObject.container = container
PanelObject.rightButtonClose = false
PanelObject.frame = CreateFrame ("frame", name, parent)
PanelObject.frame = CreateFrame ("frame", name, parent,"BackdropTemplate")
PanelObject.frame:SetSize (100, 100)
PanelObject.frame.Gradient = {
["OnEnter"] = {0.3, 0.3, 0.3, 0.5},
@@ -773,7 +773,8 @@ local align_rows = function (self)
end
local cur_width = 0
local row_width = self._width / rows_shown
local row_width = self._width / max (rows_shown, 0.0001)
local sindex = 1
@@ -1075,12 +1076,10 @@ local create_panel_entry = function (self, row)
end
end)
editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1})
editbox:SetBackdropColor (1, 1, 1, 0.1)
editbox:SetBackdropBorderColor (1, 1, 1, 0.1)
editbox.editbox.current_bordercolor = {1, 1, 1, 0.1}
editbox:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
editbox:SetBackdropColor (.2, .2, .2, 0.7)
tinsert (row.entry_available, editbox)
end
@@ -1121,7 +1120,6 @@ end
local create_panel_icon = function (self, row)
row.icon_total = row.icon_total + 1
local iconbutton = DF:NewButton (row, nil, "$parentIconButton" .. row.icon_total, "iconbutton", 22, 20)
iconbutton:InstallCustomTexture()
iconbutton:SetHook ("OnEnter", button_on_enter)
iconbutton:SetHook ("OnLeave", button_on_leave)
@@ -1324,6 +1322,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
if (type (results [index]) == "string") then
local result = results [index]:gsub (".-%\\", "")
iconwidget._icon.texture = results [index]
iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9)
elseif (type (results [index]) == "table") then
iconwidget._icon:SetTexture (results [index].texture)
@@ -1332,7 +1331,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
if (textCoord) then
iconwidget._icon:SetTexCoord (unpack(textCoord))
else
iconwidget._icon:SetTexCoord (0, 1, 0, 1)
iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9)
end
local color = results [index].color
@@ -1344,6 +1343,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
end
else
iconwidget._icon:SetTexture (results [index])
iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9)
end
iconwidget:Show()
@@ -1408,7 +1408,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
panel.scrollframe:Show()
end
local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate")
local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate", "BackdropTemplate")
scrollframe:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, panel.Refresh) end)
scrollframe:SetPoint ("topleft", panel.widget, "topleft", 0, -21)
scrollframe:SetPoint ("topright", panel.widget, "topright", -23, -21)
@@ -1426,7 +1426,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
local amount = math.floor (((panel._height-21) / size))
for i = #scrollframe.lines+1, amount do
local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget)
local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget,"BackdropTemplate")
row:SetSize (1, size)
row.color = {1, 1, 1, .2}
@@ -1518,7 +1518,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
local string_lower = string.lower
DF.IconPickFrame = CreateFrame ("frame", "DetailsFrameworkIconPickFrame", UIParent)
DF.IconPickFrame = CreateFrame ("frame", "DetailsFrameworkIconPickFrame", UIParent, "BackdropTemplate")
tinsert (UISpecialFrames, "DetailsFrameworkIconPickFrame")
DF.IconPickFrame:SetFrameStrata ("TOOLTIP")
@@ -1553,7 +1553,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
DF.IconPickFrame.emptyFunction = function() end
DF.IconPickFrame.callback = DF.IconPickFrame.emptyFunction
DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent)
DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent, "BackdropTemplate")
DF.IconPickFrame.preview:SetFrameStrata ("tooltip")
DF.IconPickFrame.preview:SetFrameLevel (6001)
DF.IconPickFrame.preview:SetSize (76, 76)
@@ -1612,7 +1612,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
end)
--> close button
local close_button = CreateFrame ("button", nil, DF.IconPickFrame, "UIPanelCloseButton")
local close_button = CreateFrame ("button", nil, DF.IconPickFrame, "UIPanelCloseButton", "BackdropTemplate")
close_button:SetWidth (32)
close_button:SetHeight (32)
close_button:SetPoint ("TOPRIGHT", DF.IconPickFrame, "TOPRIGHT", -8, -7)
@@ -1651,8 +1651,9 @@ function DF:IconPick (callback, close_when_select, param1, param2)
for j = offset, tabEnd - 1 do
--to get spell info by slot, you have to pass in a pet argument
local spellType, ID = GetSpellBookItemInfo (j, "player")
if (spellType ~= "FUTURESPELL") then
if (spellType ~= "FLYOUT") then
MACRO_ICON_FILENAMES [index] = GetSpellBookItemTexture (j, "player") or 0
SPELLNAMES_CACHE [index] = GetSpellInfo (ID)
index = index + 1
elseif (spellType == "FLYOUT") then
@@ -1662,6 +1663,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo (ID, k)
if (isKnown) then
MACRO_ICON_FILENAMES [index] = GetSpellTexture (spellID) or 0
SPELLNAMES_CACHE [index] = GetSpellInfo (spellID)
index = index + 1
end
end
@@ -1684,6 +1686,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
DF.IconPickFrame:SetScript ("OnHide", function()
wipe (MACRO_ICON_FILENAMES)
wipe (SPELLNAMES_CACHE)
DF.IconPickFrame.preview:Hide()
collectgarbage()
end)
@@ -1714,7 +1717,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
insets = {left = 0, right = 0, top = 0, bottom = 0}, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10}
for i = 0, 9 do
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..(i+1), DF.IconPickFrame)
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..(i+1), DF.IconPickFrame, "BackdropTemplate")
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..(i+1).."Icon", "overlay")
newcheck.icon = image
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
@@ -1731,7 +1734,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
newcheck:SetScript ("OnLeave", onleave)
end
for i = 11, 20 do
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
newcheck.icon = image
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
@@ -1748,7 +1751,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
newcheck:SetScript ("OnLeave", onleave)
end
for i = 21, 30 do
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
newcheck.icon = image
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
@@ -1765,7 +1768,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
newcheck:SetScript ("OnLeave", onleave)
end
for i = 31, 40 do
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
newcheck.icon = image
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
@@ -1782,7 +1785,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
newcheck:SetScript ("OnLeave", onleave)
end
for i = 41, 50 do
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
newcheck.icon = image
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
@@ -1799,7 +1802,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
newcheck:SetScript ("OnLeave", onleave)
end
for i = 51, 60 do
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
newcheck.icon = image
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
@@ -1816,7 +1819,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
newcheck:SetScript ("OnLeave", onleave)
end
local scroll = CreateFrame ("ScrollFrame", "DetailsFrameworkIconPickFrameScroll", DF.IconPickFrame, "ListScrollFrameTemplate")
local scroll = CreateFrame ("ScrollFrame", "DetailsFrameworkIconPickFrameScroll", DF.IconPickFrame, "ListScrollFrameTemplate", "BackdropTemplate")
DF:ReskinSlider (scroll)
local ChecksFrame_Update = function (self)
@@ -1836,23 +1839,10 @@ function DF:IconPick (callback, close_when_select, param1, param2)
local shown = 0
if (filter and filter ~= "") then
if (#SPELLNAMES_CACHE == 0) then
--build name cache
local GetSpellInfo = GetSpellInfo
for i = 1, #MACRO_ICON_FILENAMES do
local spellName = GetSpellInfo (MACRO_ICON_FILENAMES [i])
if (spellName) then
SPELLNAMES_CACHE [i] = spellName
else
SPELLNAMES_CACHE [i] = MACRO_ICON_FILENAMES [i]
end
end
end
--do the filter
pool = {}
for i = 1, #SPELLNAMES_CACHE do
if (SPELLNAMES_CACHE [i]:find (filter)) then
if (SPELLNAMES_CACHE [i] and SPELLNAMES_CACHE [i]:lower():find (filter)) then
pool [#pool+1] = MACRO_ICON_FILENAMES [i]
shown = shown + 1
end
@@ -1917,7 +1907,7 @@ end
function DF:ShowPanicWarning (text)
if (not DF.PanicWarningWindow) then
DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent)
DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent, "BackdropTemplate")
DF.PanicWarningWindow:SetHeight (80)
DF.PanicWarningWindow:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
DF.PanicWarningWindow:SetBackdropColor (1, 0, 0, 0.2)
@@ -2015,7 +2005,7 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options, db)
panel_options = panel_options or no_options
local f = CreateFrame ("frame", name, UIParent)
local f = CreateFrame ("frame", name, UIParent,"BackdropTemplate")
f:SetSize (w or 400, h or 250)
f:SetPoint ("center", UIParent, "center", 0, 0)
f:SetFrameStrata ("FULLSCREEN")
@@ -2031,7 +2021,7 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options, db)
tinsert (UISpecialFrames, name)
end
local title_bar = CreateFrame ("frame", name .. "TitleBar", f)
local title_bar = CreateFrame ("frame", name .. "TitleBar", f,"BackdropTemplate")
title_bar:SetPoint ("topleft", f, "topleft", 2, -3)
title_bar:SetPoint ("topright", f, "topright", -2, -3)
title_bar:SetHeight (20)
@@ -2190,7 +2180,7 @@ local Panel1PxHasPosition = function (self)
end
function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_special_frame)
local f = CreateFrame ("frame", name, parent or UIParent)
local f = CreateFrame ("frame", name, parent or UIParent, "BackdropTemplate")
f:SetSize (w or 100, h or 75)
f:SetPoint ("center", UIParent, "center")
@@ -2213,7 +2203,7 @@ function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_
--print (config.position.x, config.position.x)
Panel1PxReadConfig (f)
local close = CreateFrame ("button", name and name .. "CloseButton", f)
local close = CreateFrame ("button", name and name .. "CloseButton", f, "BackdropTemplate")
close:SetSize (16, 16)
close:SetNormalTexture (DF.folder .. "icons")
close:SetHighlightTexture (DF.folder .. "icons")
@@ -2223,7 +2213,7 @@ function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_
close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1)
close:SetAlpha (0.7)
local lock = CreateFrame ("button", name and name .. "LockButton", f)
local lock = CreateFrame ("button", name and name .. "LockButton", f, "BackdropTemplate")
lock:SetSize (16, 16)
lock:SetNormalTexture (DF.folder .. "icons")
lock:SetHighlightTexture (DF.folder .. "icons")
@@ -2272,7 +2262,7 @@ end
function DF:ShowPromptPanel (message, func_true, func_false, no_repeated, width)
if (not DetailsFrameworkPromptSimple) then
local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent)
local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent, "BackdropTemplate")
f:SetSize (400, 80)
f:SetFrameStrata ("DIALOG")
f:SetPoint ("center", UIParent, "center", 0, 300)
@@ -2373,7 +2363,7 @@ function DF:ShowTextPromptPanel (message, callback)
if (not DF.text_prompt_panel) then
local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent)
local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent, "BackdropTemplate")
f:SetSize (400, 120)
f:SetFrameStrata ("FULLSCREEN")
f:SetPoint ("center", UIParent, "center", 0, 100)
@@ -2446,7 +2436,7 @@ end
--> options button -- ~options
function DF:CreateOptionsButton (parent, callback, name)
local b = CreateFrame ("button", name, parent)
local b = CreateFrame ("button", name, parent, "BackdropTemplate")
b:SetSize (14, 14)
b:SetNormalTexture (DF.folder .. "icons")
b:SetHighlightTexture (DF.folder .. "icons")
@@ -2474,7 +2464,7 @@ end
--> feedback panel -- ~feedback
function DF:CreateFeedbackButton (parent, callback, name)
local b = CreateFrame ("button", name, parent)
local b = CreateFrame ("button", name, parent, "BackdropTemplate")
b:SetSize (12, 13)
b:SetNormalTexture (DF.folder .. "mail")
b:SetPushedTexture (DF.folder .. "mail")
@@ -2543,7 +2533,7 @@ local feedback_get_fb_line = function (self)
local line = self.feedback_lines [self.next_feedback]
if (not line) then
line = CreateFrame ("frame", "AddonFeedbackPanelFB" .. self.next_feedback, self)
line = CreateFrame ("frame", "AddonFeedbackPanelFB" .. self.next_feedback, self, "BackdropTemplate")
line:SetBackdrop (backdrop_fb_line)
line:SetBackdropColor (0, 0, 0, 0.3)
line:SetSize (390, 42)
@@ -2664,7 +2654,7 @@ local feedback_get_addons_line = function (self)
local line = self.addons_lines [self.next_addons]
if (not line) then
line = CreateFrame ("frame", "AddonFeedbackPanelSA" .. self.next_addons, self)
line = CreateFrame ("frame", "AddonFeedbackPanelSA" .. self.next_addons, self, "BackdropTemplate")
line:SetSize (128, 64)
if (self.next_addons == 1) then
@@ -2977,7 +2967,7 @@ local create_box = function (self, next_box)
thisbox.check = checktexture
thisbox.enabled = true
local button = CreateFrame ("button", nil, self.Graphic)
local button = CreateFrame ("button", nil, self.Graphic, "BackdropTemplate")
button:SetSize (20, 20)
button:SetScript ("OnClick", function()
chart_panel_enable_line (self, thisbox)
@@ -3475,7 +3465,7 @@ function DF:CreateChartPanel (parent, w, h, name)
w = w or 800
h = h or 500
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
f:SetSize (w or 500, h or 400)
f:EnableMouse (true)
f:SetMovable (true)
@@ -3486,7 +3476,7 @@ function DF:CreateChartPanel (parent, w, h, name)
f:SetBackdrop (chart_panel_backdrop)
f:SetBackdropColor (.3, .3, .3, .3)
local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton")
local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton", "BackdropTemplate")
c:SetWidth (32)
c:SetHeight (32)
c:SetPoint ("TOPRIGHT", f, "TOPRIGHT", -3, -7)
@@ -3625,7 +3615,7 @@ end
local gframe_create_line = function (self)
local index = #self._lines+1
local f = CreateFrame ("frame", nil, self)
local f = CreateFrame ("frame", nil, self, "BackdropTemplate")
self._lines [index] = f
f.id = index
f:SetScript ("OnEnter", gframe_on_enter_line)
@@ -3653,7 +3643,7 @@ local gframe_create_line = function (self)
b:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
b:SetSize (16, 16)
f.ball = b
local anchor = CreateFrame ("frame", nil, f)
local anchor = CreateFrame ("frame", nil, f, "BackdropTemplate")
anchor:SetAllPoints (b)
b.tooltip_anchor = anchor
@@ -3760,7 +3750,7 @@ local gframe_update = function (self, lines)
end
function DF:CreateGFrame (parent, w, h, linewidth, onenter, onleave, member, name)
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
f:SetSize (w or 450, h or 150)
--f.CustomLine = [[Interface\AddOns\Details\Libs\LibGraph-2.0\line]]
@@ -3791,7 +3781,7 @@ end
-- ~buttoncontainer
function DF:CreateButtonContainer (parent, name)
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
-- f.
end
@@ -3923,7 +3913,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
local button_anchor_y = options_table.button_y or -32
local button_text_size = options_table.button_text_size or 10
local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent)
local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent, "BackdropTemplate")
mainFrame:SetAllPoints()
DF:Mixin (mainFrame, DF.TabContainerFunctions)
@@ -3946,7 +3936,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
end
for i, frame in ipairs (frame_list) do
local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame)
local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame, "BackdropTemplate")
f:SetAllPoints()
f:SetFrameLevel (210)
f:Hide()
@@ -4163,7 +4153,7 @@ local simple_list_box_SetData = function (self, t)
end
function DF:CreateSimpleListBox (parent, name, title, empty_text, list_table, onclick, options)
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
f.ResetWidgets = simple_list_box_ResetWidgets
f.GetOrCreateWidget = simple_list_box_GetOrCreateWidget
@@ -4380,7 +4370,7 @@ DF.ScrollBoxFunctions.OnSizeChanged = function (self)
end
function DF:CreateScrollBox (parent, name, refresh_func, data, width, height, line_amount, line_height, create_line_func, auto_amount, no_scroll)
local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate")
local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate,BackdropTemplate")
DF:ApplyStandardBackdrop (scroll)
@@ -4413,8 +4403,8 @@ function DF:CreateResizeGrips (parent)
if (parent) then
local parentName = parent:GetName()
local leftResizer = CreateFrame ("button", parentName and parentName .. "LeftResizer" or nil, parent)
local rightResizer = CreateFrame ("button", parentName and parentName .. "RightResizer" or nil, parent)
local leftResizer = CreateFrame ("button", parentName and parentName .. "LeftResizer" or nil, parent, "BackdropTemplate")
local rightResizer = CreateFrame ("button", parentName and parentName .. "RightResizer" or nil, parent, "BackdropTemplate")
leftResizer:SetPoint ("bottomleft", parent, "bottomleft")
rightResizer:SetPoint ("bottomright", parent, "bottomright")
@@ -4509,11 +4499,11 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
local SCROLL_ROLL_AMOUNT = line_amount
--keybind set frame
local new_keybind_frame = CreateFrame ("frame", name, parent)
local new_keybind_frame = CreateFrame ("frame", name, parent, "BackdropTemplate")
new_keybind_frame:SetSize (width, height)
-- keybind scrollframe
local keybindScroll = CreateFrame ("scrollframe", "$parentScrollFrame", new_keybind_frame, "FauxScrollFrameTemplate")
local keybindScroll = CreateFrame ("scrollframe", "$parentScrollFrame", new_keybind_frame, "FauxScrollFrameTemplate, BackdropTemplate")
keybindScroll:SetSize (1019, 348)
keybindScroll.Frames = {}
new_keybind_frame.keybindScroll = keybindScroll
@@ -4607,7 +4597,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
spec4:SetPoint ("topleft", specsTitle, "bottomleft", 0, -70)
end
local enter_the_key = CreateFrame ("frame", nil, new_keybind_frame)
local enter_the_key = CreateFrame ("frame", nil, new_keybind_frame, "BackdropTemplate")
enter_the_key:SetFrameStrata ("tooltip")
enter_the_key:SetSize (200, 60)
enter_the_key:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
@@ -4817,7 +4807,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
local font = "GameFontHighlightSmall"
for i = 1, SCROLL_ROLL_AMOUNT do
local f = CreateFrame ("frame", "$KeyBindFrame" .. i, keybindScroll)
local f = CreateFrame ("frame", "$KeyBindFrame" .. i, keybindScroll, "BackdropTemplate")
f:SetSize (1009, 20)
f:SetPoint ("topleft", keybindScroll, "topleft", 0, -(i-1)*29)
f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
@@ -4866,7 +4856,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
f.ActionText:SetAsAutoComplete ("WordList")
end
local header = CreateFrame ("frame", "$parentOptionsPanelFrameHeader", keybindScroll)
local header = CreateFrame ("frame", "$parentOptionsPanelFrameHeader", keybindScroll, "BackdropTemplate")
header:SetPoint ("bottomleft", keybindScroll, "topleft", 0, 2)
header:SetPoint ("bottomright", keybindScroll, "topright", 0, 2)
header:SetHeight (16)
@@ -5009,6 +4999,10 @@ end
function DF:ApplyStandardBackdrop (f, darkTheme, alphaScale)
alphaScale = alphaScale or 1.0
if(not f.SetBackdrop)then
print(debugstack(1,2,1))
end
if (darkTheme) then
f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Cooldown\cooldown2]], tileSize = 32, tile = true})
f:SetBackdropBorderColor (0, 0, 0, 1)
@@ -5058,7 +5052,7 @@ DF.TitleFunctions = {
function DF:CreateTitleBar (f, titleText)
local titleBar = CreateFrame ("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f)
local titleBar = CreateFrame ("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f,"BackdropTemplate")
titleBar:SetPoint ("topleft", f, "topleft", 2, -3)
titleBar:SetPoint ("topright", f, "topright", -2, -3)
titleBar:SetHeight (20)
@@ -5066,7 +5060,7 @@ function DF:CreateTitleBar (f, titleText)
titleBar:SetBackdropColor (.2, .2, .2, 1)
titleBar:SetBackdropBorderColor (0, 0, 0, 1)
local closeButton = CreateFrame ("button", titleBar:GetName() and titleBar:GetName() .. "CloseButton" or nil, titleBar)
local closeButton = CreateFrame ("button", titleBar:GetName() and titleBar:GetName() .. "CloseButton" or nil, titleBar, "BackdropTemplate")
closeButton:SetSize (16, 16)
closeButton:SetNormalTexture (DF.folder .. "icons")
closeButton:SetHighlightTexture (DF.folder .. "icons")
@@ -5090,6 +5084,9 @@ function DF:CreateTitleBar (f, titleText)
f.CloseButton = closeButton
f.TitleLabel = titleLabel
titleBar.CloseButton = closeButton
titleBar.Text = titleLabel
DF:Mixin (f, DF.TitleFunctions)
return titleBar
@@ -5105,7 +5102,7 @@ DF.IconRowFunctions = {
local iconFrame = self.IconPool [self.NextIcon]
if (not iconFrame) then
local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self)
local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self, "BackdropTemplate")
newIconFrame.Texture = newIconFrame:CreateTexture (nil, "artwork")
PixelUtil.SetPoint (newIconFrame.Texture, "topleft", newIconFrame, "topleft", 1, -1)
@@ -5119,7 +5116,7 @@ DF.IconRowFunctions = {
newIconFrame:SetBackdropBorderColor (0, 0, 0, 0)
newIconFrame:EnableMouse (false)
local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate")
local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate, BackdropTemplate")
cooldownFrame:SetAllPoints()
cooldownFrame:EnableMouse (false)
cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1)
@@ -5352,7 +5349,7 @@ local default_icon_row_options = {
}
function DF:CreateIconRow (parent, name, options)
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame("frame", name, parent, "BackdropTemplate")
f.IconPool = {}
f.NextIcon = 1
@@ -5696,7 +5693,7 @@ DF.HeaderCoreFunctions = {
if (not columnHeader) then
--create a new column header
local newHeader = CreateFrame ("button", "$parentHeaderIndex" .. nextHeader, self)
local newHeader = CreateFrame ("button", "$parentHeaderIndex" .. nextHeader, self,"BackdropTemplate")
newHeader:SetScript ("OnClick", DF.HeaderFunctions.OnClick)
--header icon
@@ -5764,7 +5761,7 @@ local default_header_options = {
}
function DF:CreateHeader (parent, headerTable, options, frameName)
local f = CreateFrame ("frame", frameName or "$parentHeaderLine", parent)
local f = CreateFrame ("frame", frameName or "$parentHeaderLine", parent,"BackdropTemplate")
DF:Mixin (f, DF.OptionsFunctions)
DF:Mixin (f, DF.HeaderCoreFunctions)
@@ -5929,7 +5926,7 @@ DF.RadioGroupCoreFunctions = {
anchorOptions: override options for default_framelayout_options table
--]=]
function DF:CreateRadionGroup (parent, radioOptions, name, options, anchorOptions)
local f = CreateFrame ("frame", name, parent)
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
DF:Mixin (f, DF.OptionsFunctions)
DF:Mixin (f, DF.RadioGroupCoreFunctions)
@@ -6233,8 +6230,8 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
pvptalent = {x2StartAt, -70},
group = {x2StartAt, -210},
affix = {x2StartAt, -270},
encounter_ids = {x2StartAt, -360},
map_ids = {x2StartAt, -400},
encounter_ids = {x2StartAt, -400},
map_ids = {x2StartAt, -440},
}
local editingLabel = DF:CreateLabel (f, "Load Conditions For:")
@@ -6336,7 +6333,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
do
--create a frame to show talents selected in other specs or characters
local otherTalents = CreateFrame ("frame", nil, f)
local otherTalents = CreateFrame ("frame", nil, f, "BackdropTemplate")
otherTalents:SetSize (26, 26)
otherTalents:SetPoint ("left", talentGroup.Title.widget, "right", 10, -2)
otherTalents.Texture = DF:CreateImage (otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24)
@@ -6434,7 +6431,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
do
--create a frame to show talents selected in other specs or characters
local otherTalents = CreateFrame ("frame", nil, f)
local otherTalents = CreateFrame ("frame", nil, f, "BackdropTemplate")
otherTalents:SetSize (26, 26)
otherTalents:SetPoint ("left", pvpTalentGroup.Title.widget, "right", 10, -2)
otherTalents.Texture = DF:CreateImage (otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24)
@@ -6713,7 +6710,7 @@ DF.DataScrollFunctions = {
CreateLine = function (self, index)
--create a new line
local line = CreateFrame ("button", "$parentLine" .. index, self)
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
line.Update = self.options.update_line_func
--set its parameters
@@ -6944,7 +6941,6 @@ end
]]
function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString)
local authorName = DF:CreateLabel (f, "" .. (addonBy or "An addon by") .. "|cFFFFFFFF" .. (authorsNameString or "Terciob") .. "|r")
authorName.textcolor = "silver"
local discordLabel = DF:CreateLabel (f, "Discord: ")
@@ -6969,6 +6965,9 @@ function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString)
discordTextEntry:HighlightText()
end)
f.authorName = authorName
f.discordLabel = discordLabel
f.discordTextEntry = discordTextEntry
end
local statusbar_default_options = {
@@ -6976,7 +6975,7 @@ local statusbar_default_options = {
}
function DF:CreateStatusBar(f, options)
local statusBar = CreateFrame ("frame", nil, f)
local statusBar = CreateFrame ("frame", nil, f, "BackdropTemplate")
DF:Mixin (statusBar, DF.OptionsFunctions)
DF:Mixin (statusBar, DF.LayoutFrame)
@@ -7109,6 +7108,7 @@ DF.StatusBarFunctions = {
dversion = DF.dversion,
}
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["healthBar"]]) then
--get the already existing metaPrototype
@@ -7163,9 +7163,9 @@ DF.StatusBarFunctions = {
healthBarMetaFunctions.HealthBarEvents = {
{"PLAYER_ENTERING_WORLD"},
--{"UNIT_HEALTH", true},
{"UNIT_HEALTH", true},
{"UNIT_MAXHEALTH", true},
{"UNIT_HEALTH_FREQUENT", true},
--{"UNIT_HEALTH_FREQUENT", true},
{"UNIT_HEAL_PREDICTION", true},
{"UNIT_ABSORB_AMOUNT_CHANGED", true},
{"UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true},
@@ -7401,7 +7401,7 @@ function DF:CreateHealthBar (parent, name, settingsOverride)
assert (name or parent:GetName(), "DetailsFramework:CreateHealthBar parameter 'name' omitted and parent has no name.")
local healthBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "HealthBar"), parent)
local healthBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "HealthBar"), parent, "BackdropTemplate")
do --layers
--background
healthBar.background = healthBar:CreateTexture (nil, "background")
@@ -7599,10 +7599,13 @@ DF.PowerFrameFunctions = {
--> when a event different from unit_power_update is triggered, update which type of power the unit should show
UpdatePowerInfo = function (self)
if (self.Settings.ShowAlternatePower) then
local _, minPower, _, _, _, _, showOnRaid = UnitAlternatePowerInfo (self.displayedUnit)
if (showOnRaid and IsInGroup()) then
local barID = UnitPowerBarID(self.displayedUnit)
local barInfo = GetUnitPowerBarInfoByID(barID)
--local name, tooltip, cost = GetUnitPowerBarStringsByID(barID);
--barInfo.barType,barInfo.minPower, barInfo.startInset, barInfo.endInset, barInfo.smooth, barInfo.hideFromOthers, barInfo.showOnRaid, barInfo.opaqueSpark, barInfo.opaqueFlash, barInfo.anchorTop, name, tooltip, cost, barInfo.ID, barInfo.forcePercentage, barInfo.sparkUnderFrame;
if (barInfo and barInfo.showOnRaid and IsInGroup()) then
self.powerType = ALTERNATE_POWER_INDEX
self.minPower = minPower
self.minPower = barInfo.minPower
return
end
end
@@ -7672,7 +7675,7 @@ function DF:CreatePowerBar (parent, name, settingsOverride)
assert (name or parent:GetName(), "DetailsFramework:CreatePowerBar parameter 'name' omitted and parent has no name.")
local powerBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "PowerBar"), parent)
local powerBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "PowerBar"), parent, "BackdropTemplate")
do --layers
--background
powerBar.background = powerBar:CreateTexture (nil, "background")
@@ -8539,7 +8542,7 @@ function DF:CreateCastBar (parent, name, settingsOverride)
assert (name or parent:GetName(), "DetailsFramework:CreateCastBar parameter 'name' omitted and parent has no name.")
local castBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "CastBar"), parent)
local castBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "CastBar"), parent, "BackdropTemplate")
do --layers
@@ -8657,7 +8660,7 @@ function DF:CreateBorderFrame (parent, name)
local parentName = name or "DetailsFrameworkBorderFrame" .. tostring (math.random (1, 100000000))
local f = CreateFrame ("frame", parentName, parent)
local f = CreateFrame ("frame", parentName, parent, "BackdropTemplate")
f:SetFrameLevel (f:GetFrameLevel()+1)
f:SetAllPoints()
@@ -9162,7 +9165,7 @@ function DF:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarS
local parentName = name or ("DetailsFrameworkUnitFrame" .. tostring (math.random (1, 100000000)))
--> create the main unit frame
local f = CreateFrame ("button", parentName, parent)
local f = CreateFrame ("button", parentName, parent, "BackdropTemplate")
--> base level
local baseFrameLevel = f:GetFrameLevel()
@@ -9188,7 +9191,7 @@ function DF:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarS
f.border = borderFrame
--> overlay frame (widgets that need to stay above the unit frame)
local overlayFrame = CreateFrame ("frame", "$parentOverlayFrame", f)
local overlayFrame = CreateFrame ("frame", "$parentOverlayFrame", f, "BackdropTemplate")
borderFrame:SetFrameLevel (f:GetFrameLevel() + 6)
f.overlayFrame = overlayFrame
@@ -9362,7 +9365,7 @@ DF.TimeLineElapsedTimeFunctions = {
--creates a frame to show the elapsed time in a row
function DF:CreateElapsedTimeFrame (parent, name, options)
local elapsedTimeFrame = CreateFrame ("frame", name, parent)
local elapsedTimeFrame = CreateFrame ("frame", name, parent, "BackdropTemplate")
DF:Mixin (elapsedTimeFrame, DF.OptionsFunctions)
DF:Mixin (elapsedTimeFrame, DF.LayoutFrame)
@@ -9429,7 +9432,7 @@ DF.TimeLineBlockFunctions = {
else
self.icon:SetTexture (nil)
self.text:SetText (lineData.text or "")
text:SetPoint ("left", self, "left", 2, 0)
self.text:SetPoint ("left", self, "left", 2, 0)
end
if (self.dataIndex % 2 == 1) then
@@ -9445,6 +9448,8 @@ DF.TimeLineBlockFunctions = {
local spellId = lineData.spellId
local useIconOnBlock = data.useIconOnBlocks
local baseFrameLevel = parent:GetFrameLevel() + 10
for i = 1, #timelineData do
local blockInfo = timelineData [i]
@@ -9453,6 +9458,8 @@ DF.TimeLineBlockFunctions = {
local isAura = blockInfo [3]
local auraDuration = blockInfo [4]
local payload = blockInfo.payload
local xOffset = pixelPerSecond * time
local width = pixelPerSecond * length
@@ -9462,11 +9469,14 @@ DF.TimeLineBlockFunctions = {
local block = self:GetBlock(i)
block:Show()
block:SetFrameLevel(baseFrameLevel + i)
PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0)
block.info.spellId = spellId
block.info.time = time
block.info.duration = auraDuration
block.info.payload = payload
if (useIconOnBlock) then
block.icon:SetTexture (lineData.icon)
@@ -9502,7 +9512,7 @@ DF.TimeLineBlockFunctions = {
GetBlock = function (self, index)
local block = self.blocks [index]
if (not block) then
block = CreateFrame ("frame", nil, self)
block = CreateFrame ("frame", nil, self, "BackdropTemplate")
self.blocks [index] = block
local background = block:CreateTexture (nil, "background")
@@ -9549,7 +9559,7 @@ DF.TimeLineFunctions = {
local line = self.lines [index]
if (not line) then
--create a new line
line = CreateFrame ("frame", "$parentLine" .. index, self.body)
line = CreateFrame ("frame", "$parentLine" .. index, self.body, "BackdropTemplate")
DF:Mixin (line, DF.TimeLineBlockFunctions)
self.lines [index] = line
@@ -9680,7 +9690,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
local scrollWidth = 800 --placeholder until the timeline receives data
local scrollHeight = 800 --placeholder until the timeline receives data
local frameCanvas = CreateFrame ("scrollframe", name, parent)
local frameCanvas = CreateFrame ("scrollframe", name, parent, "BackdropTemplate")
DF:Mixin (frameCanvas, DF.TimeLineFunctions)
frameCanvas.data = {}
@@ -9693,7 +9703,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
insets = {left = 1, right = 1, top = 0, bottom = 1},})
frameCanvas:SetBackdropColor (.1, .1, .1, .3)
local frameBody = CreateFrame ("frame", nil, frameCanvas)
local frameBody = CreateFrame ("frame", nil, frameCanvas, "BackdropTemplate")
frameBody:SetSize (scrollWidth, scrollHeight)
frameCanvas:SetScrollChild (frameBody)
@@ -9708,7 +9718,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
frameCanvas.elapsedTimeFrame = DF:CreateElapsedTimeFrame (frameBody, frameCanvas:GetName() and frameCanvas:GetName() .. "ElapsedTimeFrame", timelineOptions)
--create horizontal slider
local horizontalSlider = CreateFrame ("slider", nil, parent)
local horizontalSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate")
horizontalSlider.bg = horizontalSlider:CreateTexture (nil, "background")
horizontalSlider.bg:SetAllPoints (true)
horizontalSlider.bg:SetTexture (0, 0, 0, 0.5)
@@ -9731,7 +9741,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
horizontalSlider:SetValue (0)
horizontalSlider:SetScript ("OnValueChanged", function (self)
local _, maxValue = horizontalSlider:GetMinMaxValues()
local stepValue = ceil (ceil(self:GetValue() * maxValue)/maxValue)
local stepValue = ceil (ceil(self:GetValue() * maxValue) / max(maxValue, SMALL_FLOAT))
if (stepValue ~= horizontalSlider.currentValue) then
horizontalSlider.currentValue = stepValue
frameCanvas:SetHorizontalScroll (stepValue)
@@ -9741,7 +9751,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
frameCanvas.horizontalSlider = horizontalSlider
--create scale slider
local scaleSlider = CreateFrame ("slider", nil, parent)
local scaleSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate")
scaleSlider.bg = scaleSlider:CreateTexture (nil, "background")
scaleSlider.bg:SetAllPoints (true)
scaleSlider.bg:SetTexture (0, 0, 0, 0.5)
@@ -9775,7 +9785,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
end)
--create vertical slider
local verticalSlider = CreateFrame ("slider", nil, parent)
local verticalSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate")
verticalSlider.bg = verticalSlider:CreateTexture (nil, "background")
verticalSlider.bg:SetAllPoints (true)
verticalSlider.bg:SetTexture (0, 0, 0, 0.5)
@@ -9890,7 +9900,7 @@ f:Hide()
function DF:ShowErrorMessage (errorMessage, titleText)
if (not DF.ErrorMessagePanel) then
local f = CreateFrame ("frame", "DetailsFrameworkErrorMessagePanel", UIParent)
local f = CreateFrame ("frame", "DetailsFrameworkErrorMessagePanel", UIParent, "BackdropTemplate")
f:SetSize (400, 120)
f:SetFrameStrata ("FULLSCREEN")
f:SetPoint ("center", UIParent, "center", 0, 100)
+3 -4
View File
@@ -30,7 +30,7 @@ local CreateImageEditorFrame = function()
edit_texture:SetAllPoints()
_G.DetailsFrameworkImageEdit_EditTexture = edit_texture
local background_frame = CreateFrame ("frame", "DetailsFrameworkImageEditBackground", DetailsFrameworkImageEdit)
local background_frame = CreateFrame ("frame", "DetailsFrameworkImageEditBackground", DetailsFrameworkImageEdit, "BackdropTemplate")
background_frame:SetPoint ("topleft", DetailsFrameworkImageEdit, "topleft", -10, 30)
background_frame:SetFrameStrata ("TOOLTIP")
background_frame:SetFrameLevel (window:GetFrameLevel())
@@ -351,7 +351,7 @@ local CreateImageEditorFrame = function()
end
end)
local resizer = CreateFrame ("Button", nil, window.widget)
local resizer = CreateFrame ("Button", nil, window.widget, "BackdropTemplate")
resizer:SetNormalTexture ([[Interface\AddOns\Details\images\skins\default_skin]])
resizer:SetHighlightTexture ([[Interface\AddOns\Details\images\skins\default_skin]])
resizer:GetNormalTexture():SetTexCoord (0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375)
@@ -419,7 +419,7 @@ local CreateImageEditorFrame = function()
--> select area to crop
local DragFrame = CreateFrame ("frame", nil, background_frame)
local DragFrame = CreateFrame ("frame", nil, background_frame, "BackdropTemplate")
DragFrame:EnableMouse (false)
DragFrame:SetFrameStrata ("TOOLTIP")
DragFrame:SetPoint ("topleft", edit_texture.widget, "topleft")
@@ -474,7 +474,6 @@ local CreateImageEditorFrame = function()
SelectionBox_Left:SetPoint ("topleft", UIParent, "bottomleft", x1, y1)
SelectionBox_Left:SetPoint ("bottomleft", UIParent, "bottomleft", x1, y2)
print (1)
else
--bottom
+3 -3
View File
@@ -10,7 +10,7 @@ end
function DF:NewScrollBar (master, slave, x, y)
local new_slider = CreateFrame ("Slider", nil, master)
local new_slider = CreateFrame ("Slider", nil, master,"BackdropTemplate")
new_slider.scrollMax = 560 --default - tamanho da janela de fundo
-- ///// SLIDER /////
@@ -32,7 +32,7 @@ function DF:NewScrollBar (master, slave, x, y)
new_slider:SetValue(0)
new_slider.ultimo = 0
local botao_cima = CreateFrame ("Button", nil, master)
local botao_cima = CreateFrame ("Button", nil, master,"BackdropTemplate")
botao_cima:SetPoint ("BOTTOM", new_slider, "TOP", 0, -12)
botao_cima.x = 0
@@ -46,7 +46,7 @@ function DF:NewScrollBar (master, slave, x, y)
botao_cima:Show()
botao_cima:Disable()
local botao_baixo = CreateFrame ("Button", nil, master)
local botao_baixo = CreateFrame ("Button", nil, master,"BackdropTemplate")
botao_baixo:SetPoint ("TOP", new_slider, "BOTTOM", 0, 12)
botao_baixo.x = 0
botao_baixo.y = 12
+18 -6
View File
@@ -26,7 +26,7 @@ do
ClearHooks = DF.ClearHooks,
RunHooksForWidget = DF.RunHooksForWidget,
dversion = DF.dversion,
dversion = DF.dversion
}
--check if there's a metaPrototype already existing
@@ -247,6 +247,18 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
return self.thumb:SetSize (w, h)
end
function DFSliderMetaFunctions:SetBackdrop(...)
return self.slider:SetBackdrop(...)
end
function DFSliderMetaFunctions:SetBackdropColor(...)
return self.slider:SetBackdropColor(...)
end
function DFSliderMetaFunctions:SetBackdropBorderColor(...)
return self.slider:SetBackdropBorderColor(...)
end
-- setpoint
function DFSliderMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
@@ -424,7 +436,7 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
end
local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons1", UIParent)
local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons1", UIParent, "BackdropTemplate")
f:Hide()
f:SetHeight (18)
@@ -461,8 +473,8 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
f:SetScript ("OnUpdate", going_hide)
end
local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f)
local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f)
local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f, "BackdropTemplate")
local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f, "BackdropTemplate")
button_plus:SetFrameStrata (f:GetFrameStrata())
button_minor:SetFrameStrata (f:GetFrameStrata())
@@ -638,7 +650,7 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
if (not DFSliderMetaFunctions.editbox_typevalue) then
local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent)
local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent, "BackdropTemplate")
editbox:SetSize (40, 20)
editbox:SetJustifyH ("center")
@@ -1160,7 +1172,7 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de
SliderObject.lockdown = false
SliderObject.container = container
SliderObject.slider = CreateFrame ("slider", name, parent)
SliderObject.slider = CreateFrame ("slider", name, parent,"BackdropTemplate")
SliderObject.widget = SliderObject.slider
SliderObject.useDecimals = isDecemal or false
+244 -163
View File
@@ -14,6 +14,8 @@ DF.CooldownsBySpec = {
-- 4 raid defensive cooldown
-- 5 personal utility cooldown
--Shadowlands 9.0.2 revision by Juliana Maison
--MAGE
--arcane
[62] = {
@@ -22,6 +24,7 @@ DF.CooldownsBySpec = {
[45438] = 2, --Ice Block
[12051] = 5, --Evocation
[110960] = 5, --Greater Invisibility
[235450] = 5, --Prismatic Barrier
},
--fire
[63] = {
@@ -29,36 +32,42 @@ DF.CooldownsBySpec = {
[55342] = 1, --Mirror Image
[45438] = 2, --Ice Block
[66] = 5, --Invisibility
[235313] = 5, --Blazing Barrier
},
--frost
[64] = {
[12472] = 1, --Icy Veins
[205021] = 1, --Ray of Frost
[205021] = 1, --Ray of Frost (talent)
[55342] = 1, --Mirror Image
[45438] = 2, --Ice Block
[66] = 5, --Invisibility
[235219] = 5, --Cold Snap
[11426] = 5, --Ice Barrier
[113724] = 5, --Ring of Frost (talent)
},
--PRIEST
--discipline
[256] = {
[10060] = 1, --Power Infusion
[34433] = 1, --Shadowfiend
[123040] = 1, --Mindbender
[33206] = 3, --Pain Suppression
[62618] = 4, --Power Word: Barrier
[271466] = 4, --Luminous Barrier (talent)
[109964] = 4, --Spirit Shell (talent)
[47536] = 5, --Rapture
[19236] = 5, --Desperate Prayer
[8122] = 5, --Psychic Scream
},
--holy
[257] = {
[10060] = 1, --Power Infusion
[200183] = 2, --Apotheosis
[47788] = 3, --Guardian Spirit
[64844] = 4, --Divine Hymn
[64901] = 4, --Symbol of Hope
[265202] = 4, --Holy Word: Salvation
[265202] = 4, --Holy Word: Salvation (talent)
[88625] = 5, --Holy Word: Chastise
[34861] = 5, --Holy Word: Sanctify
[2050] = 5, --Holy Word: Serenity
@@ -67,13 +76,17 @@ DF.CooldownsBySpec = {
},
--shadow priest
[258] = {
[10060] = 1, --Power Infusion
[34433] = 1, --Shadowfiend
[200174] = 1, --Mindbender
[205385] = 1, --Shadow Clash
[193223] = 1, --Surrender to Madness
[47585] = 2, --Dispersion
[15286] = 4, --Vampiric Embrace
[19236] = 5, --Desperate Prayer
[64044] = 5, --Psychic Horror
[8122] = 5, --Psychic Scream
[205369] = 5, --Mind Bomb
},
--ROGUE
@@ -84,6 +97,7 @@ DF.CooldownsBySpec = {
[5277] = 2, --Evasion
[31224] = 2, --Cloak of Shadows
[2094] = 5, --Blind
[185311] = 5, --Crimson Vial
[114018] = 5, --Shroud of Concealment
},
--outlaw
@@ -92,9 +106,12 @@ DF.CooldownsBySpec = {
[51690] = 1, --Killing Spree (talent)
[199754] = 2, --Riposte
[31224] = 2, --Cloak of Shadows
[5277] = 2, --Evasion
[1856] = 2, --Vanish
[2094] = 5, --Blind
[185311] = 5, --Crimson Vial
[114018] = 5, --Shroud of Concealment
[343142] = 5, --Dreadblades
},
--subtlety
[261] = {
@@ -103,6 +120,7 @@ DF.CooldownsBySpec = {
[1856] = 2, --Vanish
[5277] = 2, --Evasion
[2094] = 5, --Blind
[185311] = 5, --Crimson Vial
[114018] = 5, --Shroud of Concealment
},
@@ -110,17 +128,19 @@ DF.CooldownsBySpec = {
--affliction
[265] = {
[205180] = 1, --Summon Darkglare
[342601] = 1, --Ritual of Doom
[113860] = 1, --Dark Soul: Misery (talent)
[104773] = 2, --Unending Resolve
[108416] = 2, --Dark Pact (talent)
[30283] = 5, --Shadowfury
[6789] = 5, --Mortal Coil
[6789] = 5, --Mortal Coil (talent)
[333889] = 5, --Fel Domination
},
--demo
--demonology
[266] = {
[265187] = 1, --Summon Demonic Tyrant
[342601] = 1, --Ritual of Doom
[267171] = 1, --Demonic Strength (talent)
[111898] = 1, --Grimoire: Felguard (talent)
[267217] = 1, --Nether Portal (talent)
@@ -128,31 +148,31 @@ DF.CooldownsBySpec = {
[108416] = 2, --Dark Pact (talent)
[30283] = 5, --Shadowfury
[6789] = 5, --Mortal Coil
[6789] = 5, --Mortal Coil (talent)
[5484] = 5, --Howl of Terror (talent)
[333889] = 5, --Fel Domination
},
--destro
--destruction
[267] = {
[1122] = 1, --Summon Infernal
[342601] = 1, --Ritual of Doom
[113858] = 1, --Dark Soul: Instability (talent)
[104773] = 2, --Unending Resolve
[108416] = 2, --Dark Pact (talent)
[6789] = 5, --Mortal Coil
[6789] = 5, --Mortal Coil (talent)
[30283] = 5, --Shadowfury
[333889] = 5, --Fel Domination
},
--WARRIOR
--Arms
[71] = {
[107574] = 1, --Avatar
[107574] = 1, --Avatar (talent)
[227847] = 1, --Bladestorm
[152277] = 1, --Ravager (talent)
[118038] = 2, --Die by the Sword
[97462] = 4, --Rallying Cry
[64382] = 5, --Shattering Throw
[18499] = 5, --Berserker Rage
[5246] = 5, --Intimidating Shout
},
@@ -160,11 +180,9 @@ DF.CooldownsBySpec = {
[72] = {
[1719] = 1, --Recklessness
[46924] = 1, --Bladestorm (talent)
[184364] = 2, --Enraged Regeneration
[97462] = 4, --Rallying Cry
[64382] = 5, --Shattering Throw
[18499] = 5, --Berserker Rage
[5246] = 5, --Intimidating Shout
},
@@ -172,12 +190,10 @@ DF.CooldownsBySpec = {
[73] = {
[228920] = 1, --Ravager (talent)
[107574] = 1, --Avatar
[12975] = 2, --Last Stand
[871] = 2, --Shield Wall
[97462] = 4, --Rallying Cry
[64382] = 5, --Shattering Throw
[18499] = 5, --Berserker Rage
[5246] = 5, --Intimidating Shout
},
@@ -187,16 +203,14 @@ DF.CooldownsBySpec = {
[65] = {
[31884] = 1, --Avenging Wrath
[216331] = 1, --Avenging Crusader (talent)
[498] = 2, --Divine Protection
[642] = 2, --Divine Shield
[105809] = 2, --Holy Avenger (talent)
[1022] = 3, --Blessing of Protection
[152262] = 2, --Seraphim
[633] = 3, --Lay on Hands
[1022] = 3, --Blessing of Protection
[6940] = 3, --Blessing of Sacrifice
[31821] = 4, --Aura Mastery
[1044] = 5, --Blessing of Freedom
[853] = 5, --Hammer of Justice
[115750] = 5, --Blinding Light (talent)
@@ -205,16 +219,14 @@ DF.CooldownsBySpec = {
--protection
[66] = {
[31884] = 1, --Avenging Wrath
[327193] = 1, --Moment of Glory (talent)
[31850] = 2, --Ardent Defender
[86659] = 2, --Guardian of Ancient Kings
[105809] = 2, --Holy Avenger (talent)
[152262] = 2, --Seraphim
[1022] = 3, --Blessing of Protection
[204018] = 3, --Blessing of Spellwarding (talent)
[6940] = 3, --Blessing of Sacrifice
[204150] = 4, --Aegis of Light (talent)
[1044] = 5, --Blessing of Freedom
[853] = 5, --Hammer of Justice
[115750] = 5, --Blinding Light (talent)
@@ -224,13 +236,12 @@ DF.CooldownsBySpec = {
[70] = {
[31884] = 1, --Avenging Wrath
[231895] = 1, --Crusade (talent)
[205191] = 2, --Eye for an Eye (talent)
[184662] = 2, --Shield of Vengeance
[642] = 2, --Divine Shield
[1022] = 3, --Blessing of Protection
[6940] = 3, --Blessing of Sacrifice
[633] = 3, --Lay on Hands
[1044] = 5, --Blessing of Freedom
[853] = 5, --Hammer of Justice
[115750] = 5, --Blinding Light (talent)
@@ -239,20 +250,24 @@ DF.CooldownsBySpec = {
--DEMON HUNTER
--havoc
[577] = {
[162264] = 1, --Metamorphosis
[206491] = 1, --Nemesis (talent)
[200166] = 1, --Metamorphosis
[198589] = 2, --Blur
[196555] = 2, --Netherwalk (talent)
[196718] = 4, --Darkness
[188501] = 5, --Spectral Sight
[179057] = 5, --Chaos Nova
[211881] = 5, --Fel Eruption (talent)
},
--vengeance
[581] = {
[320341] = 1, --Bulk Extraction (talent)
[187827] = 2, --Metamorphosis
[204021] = 2, --Fiery Brand
[263648] = 2, --Soul Barrier (talent)
[207684] = 5, --Sigil of Misery
[202137] = 5, --Sigil of Silence
[202138] = 5, --Sigil of Chains (talent)
[188501] = 5, --Spectral Sight
},
--DEATH KNIGHT
@@ -261,78 +276,95 @@ DF.CooldownsBySpec = {
[275699] = 1, --Apocalypse
[42650] = 1, --Army of the Dead
[49206] = 1, --Summon Gargoyle (talent)
[207289] = 1, --Unholy Assault (talent)
[48707] = 2, --Anti-magic Shell
[48792] = 2, --Icebound Fortitude
[48743] = 2, --Death Pact (talent)
[51052] = 4, --Anti-magic Zone
[108194] = 5, --Asphyxiate (talent)
[287081] = 5, --Lichborne
[212552] = 5, --Wraith walk (talent)
},
--frost
[251] = {
[152279] = 1, --Breath of Sindragosa (talent)
[47568] = 1, --Empower Rune Weapon
[279302] = 1, --Frostwyrm's Fury (talent)
[279302] = 1, --Frostwyrm's Fury
[48707] = 2, --Anti-magic Shell
[48792] = 2, --Icebound Fortitude
[48743] = 2, --Death Pact (talent)
[51052] = 4, --Anti-magic Zone
[207167] = 5, --Blinding Sleet (talent)
[108194] = 5, --Asphyxiate (talent)
[287081] = 5, --Lichborne
[212552] = 5, --Wraith walk (talent)
},
--blood
[250] = {
[49028] = 1, --Dancing Rune Weapon
[48707] = 2, --Anti-magic Shell
[48743] = 2, --Death Pact (talent)
[219809] = 2, --Tombstone (talent)
[55233] = 2, --Vampiric Blood
[48792] = 2, --Icebound Fortitude
[51052] = 4, --Anti-magic Zone
[108199] = 5, --Gorefiend's Grasp
[221562] = 5, --Asphyxiate
[212552] = 5, --Wraith walk (talent)
},
--DRUID
--balance
--Balance
[102] = {
[194223] = 1, --Celestial Alignment
[102560] = 1, --Incarnation: Chosen of Elune (talent)
[22812] = 2, --Barkskin
[108238] = 2, --Renewal (talent)
[29166] = 3, --Innervate
[77761] = 4, --Stampeding Roar
[99] = 5, --Incapacitating Roar
[319454] = 5, --Heart of the Wild (talent)
[132469] = 5, --Typhoon
[78675] = 5, --Solar Beam
},
--feral
--Feral
[103] = {
[106951] = 1, --Berserk
[102543] = 1, --Incarnation: King of the Jungle (talent)
[22812] = 2, --Barkskin
[61336] = 2, --Survival Instincts
[108238] = 2, --Renewal (talent)
[77764] = 4, --Stampeding Roar
[132469] = 5, --Typhoon
[319454] = 5, --Heart of the Wild (talent)
},
--guardian
--Guardian
[104] = {
[106951] = 1, --Berserk
[204066] = 1, --Lunar Beam
[22812] = 2, --Barkskin
[61336] = 2, --Survival Instincts
[102558] = 2, --Incarnation: Guardian of Ursoc (talent)
[108238] = 2, --Renewal (talent)
[77761] = 4, --Stampeding Roar
[132469] = 5, --Typhoon
[99] = 5, --Incapacitating Roar
[319454] = 5, --Heart of the Wild (talent)
},
--restoration
--Restoration
[105] = {
[22812] = 2, --Barkskin
[108238] = 2, --Renewal (talent)
[33891] = 2, --Incarnation: Tree of Life (talent)
[102342] = 3, --Ironbark
[29166] = 3, --Innervate
[203651] = 3, --Overgrowth (talent)
[740] = 4, --Tranquility
[197721] = 4, --Flourish (talent)
[77761] = 4, --Stampeding Roar
[319454] = 5, --Heart of the Wild (talent)
[102793] = 5, --Ursol's Vortex
},
@@ -342,31 +374,32 @@ DF.CooldownsBySpec = {
[193530] = 1, --Aspect of the Wild
[19574] = 1, --Bestial Wrath
[201430] = 1, --Stampede (talent)
[194407] = 1, --Spitting Cobra (talent)
[186265] = 2, --Aspect of the Turtle
[109304] = 2, --Exhilaration
[199483] = 2, --Camouflage (talent)
[186257] = 5, --Aspect of the cheetah
[19577] = 5, --Intimidation
[109248] = 5, --Binding Shot (talent)
[187650] = 5, --Freezing Trap
},
--marksmanship
[254] = {
[193526] = 1, --Trueshot
[260402] = 1, --Double tap
[186265] = 2, --Aspect of the Turtle
[199483] = 2, --Camouflage (talent)
[109304] = 2, --Exhilaration
[281195] = 2, --Survival of the Fittest
[186257] = 5, --Aspect of the cheetah
[187650] = 5, --Freezing Trap
},
--survival
[255] = {
[266779] = 1, --Coordinated Assault
[186265] = 2, --Aspect of the Turtle
[199483] = 2, --Camouflage (talent)
[109304] = 2, --Exhilaration
[186289] = 5, --Aspect of the eagle
[19577] = 5, --Intimidation
[187650] = 5, --Freezing Trap
},
@@ -374,33 +407,41 @@ DF.CooldownsBySpec = {
--MONK
--brewmaster
[268] = {
[132578] = 1, --Invoke Niuzao, the Black Ox
[115080] = 1, --Touch of Death
[115203] = 2, --Fortifying Brew
[115399] = 2, --Black Ox brew (talent)
[115176] = 2, --Zen Meditation
[122278] = 2, --Dampen Harm (talent)
[116844] = 5, --Ring of peace (talent)
[119381] = 5, --Leg Sweep
},
--windwalker
[269] = {
[137639] = 1, --Storm, Earth, and Fire
[123904] = 1, --Invoke Xuen, the White Tiger (talent)
[123904] = 1, --Invoke Xuen, the White Tiger
[152173] = 1, --Serenity (talent)
[115080] = 1, --Touch of Death
[115203] = 2, --Fortifying Brew
[122470] = 2, --Touch of Karma
[122278] = 2, --Dampen Harm (talent)
[122783] = 2, --Diffuse Magic (talent)
[116844] = 5, --Ring of peace (talent)
[119381] = 5, --Leg Sweep
},
--mistweaver
[270] = {
[115080] = 1, --Touch of Death
[122278] = 2, --Dampen Harm (talent)
[243435] = 2, --Fortifying Brew
[122783] = 2, --Diffuse Magic (talent)
[116849] = 3, --Life Cocoon
[322118] = 4, --Invoke Yulon, the Jade serpent
[198664] = 4, --Invoke Chi-Ji, the Red Crane (talent)
[115310] = 4, --Revival
[116844] = 5, --Ring of peace (talent)
[197908] = 5, --Mana tea (talent)
[119381] = 5, --Leg Sweep
},
--SHAMAN
@@ -409,17 +450,23 @@ DF.CooldownsBySpec = {
[198067] = 1, --Fire Elemental
[192249] = 1, --Storm Elemental (talent)
[114050] = 1, --Ascendance (talent)
[108271] = 2, --Astral Shift
[108281] = 4, --Ancestral Guidance (talent)
[198103] = 4, --Earth Elemental
[79206] = 5, --Spiritwalkers grace
[65992] = 5, --Tremor Totem
[192058] = 5, --Capacitor Totem
[192077] = 5, --Wind Rush Totem (talent)
},
--enhancement
[263] = {
[51533] = 1, --Feral Spirit
[114051] = 1, --Ascendance (talent)
[108271] = 2, --Astral Shift
[198103] = 4, --Earth Elemental
[65992] = 5, --Tremor Totem
[192058] = 5, --Capacitor Totem
},
--restoration
[263] = {
@@ -427,7 +474,11 @@ DF.CooldownsBySpec = {
[114052] = 2, --Ascendance (talent)
[98008] = 4, --Spirit Link Totem
[108280] = 4, --Healing Tide Totem
[16191] = 4, --Mana Tide Totem
[198103] = 4, --Earth Elemental
[207399] = 4, --Ancestral Protection Totem (talent)
[198103] = 4, --Earth Elemental
[65992] = 5, --Tremor Totem
},
}
@@ -439,16 +490,20 @@ DF.CooldownsInfo = {
[498] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Protection
[642] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Shield
[105809] = {cooldown = 90, duration = 20, talent = 22164, charges = 1, class = "PALADIN", type = 2}, --Holy Avenger (talent)
[1022] = {cooldown = 300, duration = 10, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection
[152262] = { cooldown = 45, duration = 15, talent = 17601, charges = 1, class = "PALADIN", type = 2}, --Seraphim
[633] = {cooldown = 600, duration = false, talent = false, charges = 1, class = "PALADIN", type = 3}, --Lay on Hands
[1022] = {cooldown = 300, duration = 10, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection
[6940] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice
[31821] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 4}, --Aura Mastery
[1044] = {cooldown = 25, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 5}, --Blessing of Freedom
[853] = {cooldown = 60, duration = 6, talent = false, charges = 1, class = "PALADIN", type = 5}, --Hammer of Justice
[115750] = {cooldown = 90, duration = 6, talent = 21811, charges = 1, class = "PALADIN", type = 5}, --Blinding Light(talent)
[327193] = {cooldown = 90, duration = 15, talent = 23468, charges = 1, class = "PALADIN", type = 1}, --Moment of Glory (talent)
[31850] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Ardent Defender
[86659] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Guardian of Ancient Kings
[204018] = {cooldown = 180, duration = 10, talent = 22435, charges = 1, class = "PALADIN", type = 3}, --Blessing of Spellwarding (talent)
[6940] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice
[204150] = {cooldown = 180, duration = 6, talent = 23087, charges = 1, class = "PALADIN", type = 4}, --Aegis of Light (talent)
[231895] = {cooldown = 120, duration = 25, talent = 22215, charges = 1, class = "PALADIN", type = 1}, --Crusade (talent)
[205191] = {cooldown = 60, duration = 10, talent = 22183, charges = 1, class = "PALADIN", type = 2}, --Eye for an Eye (talent)
[184662] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "PALADIN", type = 2}, --Shield of Vengeance
--> warrior
@@ -463,55 +518,79 @@ DF.CooldownsInfo = {
[228920] = {cooldown = 60, duration = 6, talent = 23099, charges = 1, class = "WARRIOR", type = 1}, --Ravager (talent)
[12975] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Last Stand
[871] = {cooldown = 8, duration = 240, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Shield Wall
[64382] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Shattering Throw
[5246] = {cooldown = 90, duration = 8, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Intimidating Shout
--> warlock
[205180] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Darkglare
[342601] = {cooldown = 3600, duration = false, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Ritual of Doom
[113860] = {cooldown = 120, duration = 20, talent = 19293, charges = 1, class = "WARLOCK", type = 1}, --Dark Soul: Misery (talent)
[104773] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "WARLOCK", type = 2}, --Unending Resolve
[108416] = {cooldown = 60, duration = 20, talent = 19286, charges = 1, class = "WARLOCK", type = 2}, --Dark Pact (talent)
[265187] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Demonic Tyrant
[111898] = {cooldown = 120, duration = 15, talent = 21717, charges = 1, class = "WARLOCK", type = 1}, --Grimoire: Felguard
[111898] = {cooldown = 120, duration = 15, talent = 21717, charges = 1, class = "WARLOCK", type = 1}, --Grimoire: Felguard (talent)
[267171] = {cooldown = 60, duration = false, talent = 23138, charges = 1, class = "WARLOCK", type = 1}, --Demonic Strength (talent)
[267217] = {cooldown = 180, duration = 20, talent = 23091, charges = 1, class = "WARLOCK", type = 1}, --Nether Portal
[1122] = {cooldown = 180, duration = 30, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Infernal
[113858] = {cooldown = 120, duration = 20, talent = 23092, charges = 1, class = "WARLOCK", type = 1}, --Dark Soul: Instability (talent)
[30283] = {cooldown = 60, duration = 3, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Shadowfury
[333889] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Fel Domination
--> shaman
[198067] = {cooldown = 150, duration = 30, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Fire Elemental
[192249] = {cooldown = 150, duration = 30, talent = 19272, charges = 1, class = "SHAMAN", type = 1}, --Storm Elemental (talent)
[114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
[108271] = {cooldown = 90, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 2}, --Astral Shift
[108281] = {cooldown = 120, duration = 10, talent = 22172, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Guidance (talent)
[51533] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Feral Spirit
[114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
[114051] = {cooldown = 180, duration = 15, talent = 21972, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
[114052] = {cooldown = 180, duration = 15, talent = 22359, charges = 1, class = "SHAMAN", type = 2}, --Ascendance (talent)
[98008] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Spirit Link Totem
[108280] = {cooldown = 180, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Healing Tide Totem
[207399] = {cooldown = 240, duration = 30, talent = 22323, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Protection Totem (talent)
[16191] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Mana Tide Totem
[198103] = {cooldown = 300, duration = 60, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Earth Elemental
[192058] = {cooldown = 60, duration = false, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Capacitor Totem
[65992] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Tremor Totem
[192077] = {cooldown = 120, duration = 15, talent = 21966, charges = 1, class = "SHAMAN", type = 5}, --Wind Rush Totem (talent)
--> monk
[132578] = {cooldown = 180, duration = 25, talent = false, charges = 1, class = "MONK", type = 1}, --Invoke Niuzao, the Black Ox
[115080] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "MONK", type = 1}, --Touch of Death
[115203] = {cooldown = 420, duration = 15, talent = false, charges = 1, class = "MONK", type = 2}, --Fortifying Brew
[115176] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "MONK", type = 2}, --Zen Meditation
[115399] = {cooldown = 120, duration = false, talent = 19992, charges = 1, class = "MONK", type = 2}, --Black Ox brew (talent)
[122278] = {cooldown = 120, duration = 10, talent = 20175, charges = 1, class = "MONK", type = 2}, --Dampen Harm (talent)
[137639] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "MONK", type = 1}, --Storm, Earth, and Fire
[123904] = {cooldown = 120, duration = 20, talent = 22102, charges = 1, class = "MONK", type = 1}, --Invoke Xuen, the White Tiger (talent)
[123904] = {cooldown = 120, duration = 24, talent = false, charges = 1, class = "MONK", type = 1}, --Invoke Xuen, the White Tiger
[152173] = {cooldown = 90, duration = 12, talent = 21191, charges = 1, class = "MONK", type = 1}, --Serenity (talent)
[122470] = {cooldown = 90, duration = 6, talent = false, charges = 1, class = "MONK", type = 2}, --Touch of Karma
[322118] = {cooldown = 180, duration = 25, talent = false, charges = 1, class = "MONK", type = 4}, --Invoke Yulon, the Jade serpent
[198664] = {cooldown = 180, duration = 25, talent = 22214, charges = 1, class = "MONK", type = 4}, --Invoke Chi-Ji, the Red Crane (talent)
[243435] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "MONK", type = 2}, --Fortifying Brew
[122783] = {cooldown = 90, duration = 6, talent = 20173, charges = 1, class = "MONK", type = 2}, --Diffuse Magic (talent)
[116849] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "MONK", type = 3}, --Life Cocoon
[115310] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "MONK", type = 4}, --Revival
[197908] = {cooldown = 90, duration = 10, talent = 22166, charges = 1, class = "MONK", type = 5}, --Mana tea (talent)
[116844] = {cooldown = 45, duration = 5, talent = 19995, charges = 1, class = "MONK", type = 5}, --Ring of peace (talent)
[119381] = {cooldown = 50, duration = 3, talent = false, charges = 1, class = "MONK", type = 5}, --Leg Sweep
--> hunter
[193530] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Aspect of the Wild
[19574] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "HUNTER", type = 1}, --Bestial Wrath
[201430] = {cooldown = 180, duration = 12, talent = 23044, charges = 1, class = "HUNTER", type = 1}, --Stampede (talent)
[194407] = {cooldown = 90, duration = 20, talent = 22295, charges = 1, class = "HUNTER", type = 1}, --Spitting Cobra (talent)
[193526] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 1}, --Trueshot
[199483] = {cooldown = 60, duration = 60, talent = 23100, charges = 1, class = "HUNTER", type = 2}, --Camouflage (talent)
[281195] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest
[266779] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Coordinated Assault
[186265] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "HUNTER", type = 2}, --Aspect of the Turtle
[109304] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "HUNTER", type = 2}, --Exhilaration
[186257] = {cooldown = 144, duration = 14, talent = false, charges = 1, class = "HUNTER", type = 5}, --Aspect of the cheetah
[19577] = {cooldown = 60, duration = 5, talent = false, charges = 1, class = "HUNTER", type = 5}, --Intimidation
[109248] = {cooldown = 45, duration = 10, talent = 22499, charges = 1, class = "HUNTER", type = 5}, --Binding Shot (talent)
[187650] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "HUNTER", type = 5}, --Freezing Trap
[186289] = {cooldown = 72, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 5}, --Aspect of the eagle
--> druid
[194223] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "DRUID", type = 1}, --Celestial Alignment
@@ -527,42 +606,67 @@ DF.CooldownsInfo = {
[102558] = {cooldown = 180, duration = 30, talent = 22388, charges = 1, class = "DRUID", type = 2}, --Incarnation: Guardian of Ursoc (talent)
[33891] = {cooldown = 180, duration = 30, talent = 22421, charges = 1, class = "DRUID", type = 2}, --Incarnation: Tree of Life (talent)
[102342] = {cooldown = 60, duration = 12, talent = false, charges = 1, class = "DRUID", type = 3}, --Ironbark
[203651] = {cooldown = 60, duration = false, talent = 22422, charges = 1, class = "DRUID", type = 3}, --Overgrowth (talent)
[740] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DRUID", type = 4}, --Tranquility
[197721] = {cooldown = 90, duration = 8, talent = 22404, charges = 1, class = "DRUID", type = 4}, --Flourish (talent)
[132469] = {cooldown = 30, duration = false, talent = false, charges = 1, class = "DRUID", type = 5}, --Typhoon
[319454] = {cooldown = 300, duration = 45, talent = 18577, charges = 1, class = "DRUID", type = 5}, --Heart of the Wild (talent)
--> death knight
[275699] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Apocalypse
[42650] = {cooldown = 480, duration = 30, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Army of the Dead
[49206] = {cooldown = 180, duration = 30, talent = 22538, charges = 1, class = "DEATHKNIGHT", type = 1}, --Summon Gargoyle (talent)
[49206] = {cooldown = 180, duration = 30, talent = 22110, charges = 1, class = "DEATHKNIGHT", type = 1}, --Summon Gargoyle (talent)
[207289] = {cooldown = 78, duration = 12, talent = 22538, charges = 1, class = "DEATHKNIGHT", type = 1}, --Unholy Assault (talent)
[48743] = {cooldown = 120, duration = 15, talent = 23373, charges = 1, class = "DEATHKNIGHT", type = 2}, --Death Pact (talent)
[48707] = {cooldown = 60, duration = 10, talent = 23373, charges = 1, class = "DEATHKNIGHT", type = 2}, --Anti-magic Shell
[152279] = {cooldown = 120, duration = 5, talent = 22537, charges = 1, class = "DEATHKNIGHT", type = 1}, --Breath of Sindragosa (talent)
[47568] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Empower Rune Weapon
[279302] = {cooldown = 120, duration = 10, talent = 22535, charges = 1, class = "DEATHKNIGHT", type = 1}, --Frostwyrm's Fury (talent)
[49028] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Dancing Rune Weapon
[55233] = {cooldown = 90, duration = 10, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Vampiric Blood
[48792] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Icebound Fortitude
[108199] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Gorefiend's Grasp (utility)
[51052] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "DEATHKNIGHT", type = 4}, --Anti-magic Zone
[219809] = {cooldown = 60, duration = 8, talent = 23454, charges = 1, class = "DEATHKNIGHT", type = 2}, --Tombstone (talent)
[108199] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Gorefiend's Grasp
[207167] = {cooldown = 60, duration = 5, talent = 22519, charges = 1, class = "DEATHKNIGHT", type = 5}, --Blinding Sleet (talent)
[108194] = {cooldown = 45, duration = 4, talent = 22520, charges = 1, class = "DEATHKNIGHT", type = 5}, --Asphyxiate (talent)
[221562] = {cooldown = 45, duration = 5, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Asphyxiate
--> demon hunter
[162264] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
[206491] = {cooldown = 120, duration = 60, talent = 22547, charges = 1, class = "DEMONHUNTER", type = 1}, --Nemesis (talent)
[200166] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
[198589] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Blur
[196555] = {cooldown = 120, duration = 5, talent = 21865, charges = 1, class = "DEMONHUNTER", type = 2}, --Netherwalk (talent)
[196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness
[187827] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Metamorphosis
[196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness
[188501] = {cooldown = 30, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Spectral Sight
[179057] = {cooldown = 60, duration = 2, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Chaos Nova
[211881] = {cooldown = 30, duration = 4, talent = 22767, charges = 1, class = "DEMONHUNTER", type = 5}, --Fel Eruption (talent)
[320341] = {cooldown = 90, duration = false, talent = 21902, charges = 1, class = "DEMONHUNTER", type = 1}, --Bulk Extraction (talent)
[204021] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Fiery Brand
[263648] = {cooldown = 30, duration = 12, talent = 22768, charges = 1, class = "DEMONHUNTER", type = 2}, --Soul Barrier (talent)
[207684] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Misery
[202137] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Silence
[202138] = {cooldown = 90, duration = 6, talent = 22511, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Chains (talent)
--> mage
[12042] = {cooldown = 90, duration = 10, talent = false, charges = 1, class = "MAGE", type = 1}, --Arcane Power
[12051] = {cooldown = 90, duration = 6, talent = false, charges = 1, class = "MAGE", type = 1}, --Evocation
[110960] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "MAGE", type = 2}, --Greater Invisibility
[235450] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Prismatic Barrier
[235313] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Blazing Barrier
[11426] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Ice Barrier
[190319] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "MAGE", type = 1}, --Combustion
[55342] = {cooldown = 120, duration = 40, talent = 22445, charges = 1, class = "MAGE", type = 1}, --Mirror Image (talent)
[55342] = {cooldown = 120, duration = 40, talent = 22445, charges = 1, class = "MAGE", type = 1}, --Mirror Image
[66] = {cooldown = 300, duration = 20, talent = false, charges = 1, class = "MAGE", type = 2}, --Invisibility
[12472] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "MAGE", type = 1}, --Icy Veins
[205021] = {cooldown = 78, duration = 5, talent = 22309, charges = 1, class = "MAGE", type = 1}, --Ray of Frost (talent)
[45438] = {cooldown = 240, duration = 10, talent = false, charges = 1, class = "MAGE", type = 2}, --Ice Block
[235219] = {cooldown = 300, duration = false, talent = false, charges = 1, class = "MAGE", type = 5}, --Cold Snap
[113724] = {cooldown = 45, duration = 10, talent = 22471, charges = 1, class = "MAGE", type = 5}, --Ring of Frost (talent)
--> priest
[10060] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "PRIEST", type = 1}, --Power Infusion
[34433] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 1}, --Shadowfiend
[123040] = {cooldown = 60, duration = 12, talent = 22094, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
[33206] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 3}, --Pain Suppression
@@ -575,6 +679,7 @@ DF.CooldownsInfo = {
[64844] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 4}, --Divine Hymn
[64901] = {cooldown = 300, duration = 6, talent = false, charges = 1, class = "PRIEST", type = 4}, --Symbol of Hope
[265202] = {cooldown = 720, duration = false, talent = 23145, charges = 1, class = "PRIEST", type = 4}, --Holy Word: Salvation (talent)
[109964] = {cooldown = 60, duration = 12, talent = 21184, charges = 1, class = "PRIEST", type = 4}, --Spirit Shell (talent)
[8122] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 5}, --Psychic Scream
[200174] = {cooldown = 60, duration = 15, talent = 21719, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
[193223] = {cooldown = 240, duration = 60, talent = 21979, charges = 1, class = "PRIEST", type = 1}, --Surrender to Madness (talent)
@@ -588,10 +693,13 @@ DF.CooldownsInfo = {
[31224] = {cooldown = 120, duration = 5, talent = false, charges = 1, class = "ROGUE", type = 2}, --Cloak of Shadows
[2094] = {cooldown = 120, duration = 60, talent = false, charges = 1, class = "ROGUE", type = 5}, --Blind
[114018] = {cooldown = 360, duration = 15, talent = false, charges = 1, class = "ROGUE", type = 5}, --Shroud of Concealment
[185311] = {cooldown = 30, duration = 15, talent = false, charges = 1, class = "ROGUE", type = 5}, --Crimson Vial
[13750] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Adrenaline Rush
[51690] = {cooldown = 120, duration = 2, talent = 23175, charges = 1, class = "ROGUE", type = 1}, --Killing Spree (talent)
[199754] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "ROGUE", type = 2}, --Riposte
[121471] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shadow Blades
[343142] = {cooldown = 90, duration = 10, talent = 19250, charges = 1, class = "ROGUE", type = 5}, --Dreadblades
[121471] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shadow Blades
}
-- {cooldown = , duration = , talent = false, charges = 1}
@@ -636,7 +744,6 @@ DF.CrowdControlSpells = {
[408] = "ROGUE", --Kidney Shot
[6770] = "ROGUE", --Sap
[1776] = "ROGUE", --Gouge
[199804] = "ROGUE", --Between the Eyes
[853] = "PALADIN", --Hammer of Justice
[20066] = "PALADIN", --Repentance (talent)
@@ -660,7 +767,7 @@ DF.CrowdControlSpells = {
[33786] = "DRUID", --Cyclone (from pvp talent - resto druid)
[3355] = "HUNTER", --Freezing Trap
[203337] = "HUNTER", --Diamond Ice (from pvp talent)
[3355] = "HUNTER", --Diamond Ice (from pvp talent)
[19577] = "HUNTER", --Intimidation
[190927] = "HUNTER", --Harpoon
[162480] = "HUNTER", --Steel Trap
@@ -790,93 +897,67 @@ end
--consumables
DF.FlaskIDs = {
[251836] = true, -- Flask of the Currents agility
[251837] = true, -- Flask of Endless Fathoms intellect
[251838] = true, -- Flask of the Vast Horizon stamina
[251839] = true, -- Flask of the Undertow strength
--Shadowlands
[307185] = true, --Spectral Flask of Power
[307187] = true, --Spectral Stamina Flask
[307166] = true, --Eternal Flask
------------------------------------------------------------------------
--revision ny nullKomplex july 07 2019
[298836] = true, -- Greater Flask of the Currents agility
[298837] = true, -- Greater Flask of Endless Fathoms intellect
[298839] = true, -- Greater Flask of the Vast Horizon stamina
[298841] = true, -- Greater Flask of the Undertow strength
}
DF.FoodIDs = {
[257422] = 41, --Mon'Dazi versatility
[257413] = 41, --Ravenberry Tarts haste
[257418] = 41, --Loa Loaf mastery
[257408] = 41, --Kul Tiramisu critical
[257424] = 55, --Spiced Snapper versatility
[257415] = 55, --Swamp Fish 'n Chips haste
[257420] = 55, --Sailor's Pie mastery
[257410] = 55, --Honey-Glazed Haunches critical
[259448] = 75, --Galley Banquet agility
[259449] = 75, --Galley Banquet intellect
[259453] = 75, --Galley Banquet stamina
[259452] = 75, --Galley Banquet strength
[259454] = 100, --Bountiful Captain's Feast agility
[259455] = 100, --Bountiful Captain's Feast intellect
[259457] = 100, --Bountiful Captain's Feast stamina
[257427] = 100, --Bountiful Captain's Feast strength
------------------------------------------------------------------------
--revision ny nullKomplex july 07 2019
[288074] = 113, -- Wild Berry Bread stamina (maybe fake it as 41?)
[285721] = 60, -- Druid Rebirth trait agility
[285719] = 60, -- Druid Rebirth trait intellect
[285720] = 60, -- Druid Rebirth trait strength
-- Put in 70 section:
[288075] = 150, -- Seasoned Steak and Potatoes (70?)
[290467] = 85, -- Boralus Blood Sausage agility
[290468] = 85, -- Boralus Blood Sausage intellect
[290469] = 85, -- Boralus Blood Sausage strength
[297037] = 93, -- Bil'Tong versatility
[297034] = 93, -- Baked Port Tato haste
[297035] = 93, -- Abyssal-Fried Rissole mastery
[297039] = 93, -- Mech-Dowel's "Big Mech" critical
[297040] = 198, -- Fragrant Kakavia stamina (93?)
[297116] = 131, -- Famine Evaluator And Snack Table agility
[297117] = 131, -- Famine Evaluator And Snack Table intellect
[297118] = 131, -- Famine Evaluator And Snack Table strength
--shadowlands tier 1
[259454] = 1, -- (agility) Feast of Gluttonous Hedonism
[308434] = 1, -- (critical) Phantasmal Souffle and Fries
[308488] = 1, -- (haste) Tenebrous Crown Roast Aspic
[308506] = 1, -- (mastery) Crawler Ravioli with Apple Sauce
[308525] = 1, -- (stamina) Banana Beef Pudding
[308514] = 1, -- (versatility) Steak a la Mode
[327851] = 1, -- (periodicaly heal out of combat) Seraph Tenders
[308637] = 1, -- (periodicaly damage) Smothered Shank
[327715] = 1, -- (speed) Fried Bonefish
}
DF.PotionIDs = {
[279152] = true, --Battle Potion of Agility
[279151] = true, --Battle Potion of Intellect
[279154] = true, --Battle Potion of Stamina
[279153] = true, --Battle Potion of Strength
--Shadowlands
[307159] = true, --Potion of Spectral Agility
[307163] = true, --Potion of Spectral Stamina
[307164] = true, --Potion of Spectral Strength
[307160] = true, --Potion of Hardened Shadows
[307162] = true, --Potion of Spectral Intellect
[307494] = true, --Potion of Empowered Exorcisms
[307495] = true, --Potion of Phantom Fire
[307496] = true, --Potion of Divine Awakening
[307161] = true, --Potion of Spiritual Clarity
[307496] = true, --Potion of Divine Awakening
[307501] = true, --Potion of Specter Swiftness
[322302] = true, --Potion of Sacrificial Anima
[307497] = true, --Potion of Deathly Fixation
[307195] = true, --Potion of the Hidden Spirit
[307199] = true, --Potion of Soul Purity
[307196] = true, --Potion of Shadow Sight
[307192] = true, --Spiritual Healing Potion
[307194] = true, --Spiritual Rejuvenation Potion
[307193] = true, --Spiritual Mana Potion
[323436] = true, --Purify Soul (greek convent)
-- [] = true, --
[307165] = true, --Spiritual Anti-Venom
}
DF.FeastIDs = {
[308462] = true, --Feast of Gluttonous Hedonism
[307153] = true, --Eternal Cauldron
[269853] = true, --Potion of Rising Death (range)
[251316] = true, --Potion of Bursting Blood (melee)
[251231] = true, --Steelskin Potion (tank)
------------------------------------------------------------------------
--revision ny nullKomplex july 07 2019
[298146] = true, -- Superior Battle Potion of Agility
[298152] = true, -- Superior Battle Potion of Intellect
[298153] = true, -- Superior Battle Potion of Stamina
[298154] = true, -- Superior Battle Potion of Strength
[298317] = true, -- Potion of Focused Resolve (crit)
[300714] = true, -- Potion of Unbridled Fury (fire damage)
[298225] = true, -- Potion of Empowered Proximity (main stat per enemy)
[298155] = true, -- Superior Steelskin Potion (tank)
[300741] = true, -- Potion of Wild Mending (healer)
}
DF.RuneIDs = {
[270058] = true, --Battle-Scarred Augment Rune
[317065] = true, --Lightning-Forged Augment Rune
}
-- /dump UnitAura ("player", 1)
+20 -8
View File
@@ -245,6 +245,18 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1
end
end
function TextEntryMetaFunctions:SetBackdrop(...)
return self.editbox:SetBackdrop(...)
end
function TextEntryMetaFunctions:SetBackdropColor(...)
return self.editbox:SetBackdropColor(...)
end
function TextEntryMetaFunctions:SetBackdropBorderColor(...)
return self.editbox:SetBackdropBorderColor(...)
end
--> select all text
function TextEntryMetaFunctions:SelectAll()
self.editbox:HighlightText()
@@ -608,7 +620,7 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p
TextEntryObject.container = container
TextEntryObject.have_tooltip = nil
TextEntryObject.editbox = CreateFrame ("EditBox", name, parent)
TextEntryObject.editbox = CreateFrame ("EditBox", name, parent,"BackdropTemplate")
TextEntryObject.editbox:SetSize (232, 20)
TextEntryObject.editbox:SetBackdrop ({bgFile = [["Interface\DialogFrame\UI-DialogBox-Background"]], tileSize = 64, tile = true, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 0}})
@@ -1111,17 +1123,17 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
name = name:gsub ("$parent", parentName)
end
local borderframe = CreateFrame ("Frame", name, parent)
local borderframe = CreateFrame ("Frame", name, parent,"BackdropTemplate")
borderframe:SetSize (w, h)
if (member) then
parent [member] = borderframe
end
local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate")
local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate")
local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe)
scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe,"BackdropTemplate")
scrollframe.editbox:SetMultiLine (true)
scrollframe.editbox:SetAutoFocus (false)
scrollframe.editbox:SetScript ("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged)
@@ -1131,7 +1143,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
--line number
if (showLineNumbers) then
scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines)
scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines, "BackdropTemplate")
scrollframeNumberLines.editbox:SetMultiLine (true)
scrollframeNumberLines.editbox:SetAutoFocus (false)
scrollframeNumberLines.editbox:SetEnabled (false)
@@ -1190,7 +1202,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
scrollframeNumberLines:SetPoint ("bottomright", borderframe, "bottomright", -10, 10)
scrollframeNumberLines:Hide()
end
--16:40
borderframe.SetAsAutoComplete = TextEntryMetaFunctions.SetAsAutoComplete
scrollframe:SetScript ("OnSizeChanged", function (self)
@@ -1260,7 +1272,7 @@ local function bit (x,b)
end
local function lor (x,y)
result = 0
local result = 0
for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end
return result
end
+77 -50
View File
@@ -1,12 +1,12 @@
--[[--
LibDeflate 1.0.0-release <br>
LibDeflate 1.0.2-release <br>
Pure Lua compressor and decompressor with high compression ratio using
DEFLATE/zlib format.
@file LibDeflate.lua
@author Haoqian He (Github: SafeteeWoW; World of Warcraft: Safetyy-Illidan(US))
@copyright LibDeflate <2018> Haoqian He
@license GNU General Public License Version 3 or later
@copyright LibDeflate <2018-2020> Haoqian He
@license zlib License
This library is implemented according to the following specifications. <br>
Report a bug if LibDeflate is not fully compliant with those specs. <br>
@@ -16,8 +16,10 @@ https://tools.ietf.org/html/rfc1951 <br>
2. RFC1951: ZLIB Compressed Data Format Specification version 3.3 <br>
https://tools.ietf.org/html/rfc1950 <br>
This library requires Lua 5.1/5.2/5.3 interpreter or LuaJIT v2.0+. <br>
This library requires Lua 5.1/5.2/5.3/5.4 interpreter or LuaJIT v2.0+. <br>
This library does not have any dependencies. <br>
Note at the time of this release, Lua 5.4 final is not released yet. <br>
For Lua 5.4, This library is tested with its rc6 version. <br>
<br>
This file "LibDeflate.lua" is the only source file of
the library. <br>
@@ -26,20 +28,33 @@ https://github.com/safeteeWow/LibDeflate/issues
]]
--[[
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
zlib License
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
(C) 2018-2020 Haoqian He
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Credits and Disclaimer:
The following projects are used to the help to test the correctness
of this program. The code of this program (LibDeflate.lua) does not
use their code directly, but uses their ideas and algorithms. Their original
licenses shall be comply when used.
Credits:
1. zlib, by Jean-loup Gailly (compression) and Mark Adler (decompression).
http://www.zlib.net/
Licensed under zlib License. http://www.zlib.net/zlib_license.html
@@ -61,9 +76,9 @@ Credits:
--[[
Curseforge auto-packaging replacements:
Project Date: 2018-07-29T18:58:38Z
Project Hash: 420f583c8c1ad0d4fc12398c86e99a65cf37a79a
Project Version: 1.0.0-release
Project Date: 2020-06-26T15:11:26Z
Project Hash: c19f978f053ebd22950eb6f1df4445677a4b0160
Project Version: 1.0.2-release
--]]
local LibDeflate
@@ -73,23 +88,34 @@ do
-- Suffix can be alpha1, alpha2, beta1, beta2, rc1, rc2, etc.
-- NOTE: Two version numbers needs to modify.
-- 1. On the top of LibDeflate.lua
-- 2. HERE
local _VERSION = "1.0.0-release"
-- 2. _VERSION
-- 3. _MINOR
-- version to store the official version of LibDeflate
local _VERSION = "1.0.2-release"
-- When MAJOR is changed, I should name it as LibDeflate2
local _MAJOR = "LibDeflate"
-- Update this whenever a new version, for LibStub version registration.
-- 0 : v0.x
-- 1 : v1.0.0
-- 2 : v1.0.1
-- 3 : v1.0.2
local _MINOR = 3
local _COPYRIGHT =
"LibDeflate ".._VERSION
.." Copyright (C) 2018 Haoqian He."
.." License GPLv3+: GNU GPL version 3 or later"
.." Copyright (C) 2018-2020 Haoqian He."
.." Licensed under the zlib License"
-- Register in the World of Warcraft library "LibStub" if detected.
if LibStub then
local MAJOR, MINOR = "LibDeflate", -1
-- When MAJOR is changed, I should name it as LibDeflate2
local lib, minor = LibStub:GetLibrary(MAJOR, true)
if lib and minor and minor >= MINOR then -- No need to update.
local lib, minor = LibStub:GetLibrary(_MAJOR, true)
if lib and minor and minor >= _MINOR then -- No need to update.
return lib
else -- Update or first time register
LibDeflate = LibStub:NewLibrary(MAJOR, _VERSION)
LibDeflate = LibStub:NewLibrary(_MAJOR, _MINOR)
-- NOTE: It is important that new version has implemented
-- all exported APIs and tables in the old version,
-- so the old library is fully garbage collected,
@@ -100,6 +126,8 @@ do
end
LibDeflate._VERSION = _VERSION
LibDeflate._MAJOR = _MAJOR
LibDeflate._MINOR = _MINOR
LibDeflate._COPYRIGHT = _COPYRIGHT
end
@@ -1205,6 +1233,8 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
end
end
local dict_string_len_plus3 = dict_string_len + 3
hash = (string_table[block_start-offset] or 0)*256
+ (string_table[block_start+1-offset] or 0)
@@ -1235,6 +1265,7 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
-- because I think this is easier for me to maintain it.
while (index <= index_end) do
local string_table_index = index - offset
local offset_minus_three = offset - 3
prev_len = cur_len
prev_dist = cur_dist
cur_len = 0
@@ -1272,6 +1303,11 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
(config_use_lazy and prev_len >= config_good_prev_length)
and config_good_hash_chain or config_max_hash_chain
local max_len_minus_one = block_end - index
max_len_minus_one = (max_len_minus_one >= 257) and 257 or max_len_minus_one
max_len_minus_one = max_len_minus_one + string_table_index
local string_table_index_plus_three = string_table_index + 3
while chain_index >= 1 and depth > 0 do
local prev = cur_chain[chain_index]
@@ -1279,35 +1315,26 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
break
end
if prev < index then
local j = 3
local sj = string_table_index_plus_three
if prev >= -257 then
local prev_table_index = prev-offset
-- NOTE for author:
-- j < 258 and index + j <= block_end
-- This is the right condition
while (j < 258 and index + j <= block_end) do
if (string_table[prev_table_index+j]
== string_table[string_table_index+j]) then
j = j + 1
else
break
end
local pj = prev - offset_minus_three
while (sj <= max_len_minus_one
and string_table[pj]
== string_table[sj]) do
sj = sj + 1
pj = pj + 1
end
else
local prev_table_index = dict_string_len+prev
-- NOTE for author:
-- j < 258 and index + j <= block_end
-- This is the right condition
while (j < 258 and index + j <= block_end) do
if (dict_string_table[prev_table_index+j]
== string_table[string_table_index+j]) then
j = j + 1
else
break
end
local pj = dict_string_len_plus3 + prev
while (sj <= max_len_minus_one
and dict_string_table[pj]
== string_table[sj]) do
sj = sj + 1
pj = pj + 1
end
end
local j = sj - string_table_index
if j > cur_len then
cur_len = j
cur_dist = index - prev
+126 -45
View File
@@ -37,6 +37,15 @@
-- }
-- ...
-- }
-- .pvp_talents = {
-- [<talent_id>] = {
-- .name_localized
-- .icon
-- .talent_id
-- .spell_id
-- }
-- ...
-- }
-- .lku -- last known unit id
-- .not_visible
--
@@ -62,7 +71,7 @@
-- Returns an array with the set of unit ids for the current group.
--]]
local MAJOR, MINOR = "LibGroupInSpecT-1.1", 90
local MAJOR, MINOR = "LibGroupInSpecT-1.1", 91
if not LibStub then error(MAJOR.." requires LibStub") end
local lib = LibStub:NewLibrary (MAJOR, MINOR)
@@ -154,13 +163,17 @@ local GetClassInfo = _G.GetClassInfo
local GetNumSubgroupMembers = _G.GetNumSubgroupMembers
local GetNumSpecializationsForClassID = _G.GetNumSpecializationsForClassID
local GetPlayerInfoByGUID = _G.GetPlayerInfoByGUID
local GetInspectSelectedPvpTalent = _G.C_SpecializationInfo.GetInspectSelectedPvpTalent
local GetInspectSpecialization = _G.GetInspectSpecialization
local GetSpecialization = _G.GetSpecialization
local GetSpecializationInfo = _G.GetSpecializationInfo
local GetSpecializationInfoForClassID = _G.GetSpecializationInfoForClassID
local GetSpecializationRoleByID = _G.GetSpecializationRoleByID
local GetSpellInfo = _G.GetSpellInfo
local GetPvpTalentInfoByID = _G.GetPvpTalentInfoByID
local GetPvpTalentSlotInfo = _G.C_SpecializationInfo.GetPvpTalentSlotInfo
local GetTalentInfo = _G.GetTalentInfo
local GetTalentInfoByID = _G.GetTalentInfoByID
local IsInRaid = _G.IsInRaid
--local NotifyInspect = _G.NotifyInspect -- Don't cache, as to avoid missing future hooks
local GetNumClasses = _G.GetNumClasses
@@ -172,7 +185,12 @@ local UnitIsConnected = _G.UnitIsConnected
local UnitIsPlayer = _G.UnitIsPlayer
local UnitIsUnit = _G.UnitIsUnit
local UnitName = _G.UnitName
local SendAddonMessage = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage -- XXX 8.0 compat
local SendAddonMessage = _G.C_ChatInfo.SendAddonMessage
local RegisterAddonMessagePrefix = _G.C_ChatInfo.RegisterAddonMessagePrefix
local MAX_TALENT_TIERS = _G.MAX_TALENT_TIERS
local NUM_TALENT_COLUMNS = _G.NUM_TALENT_COLUMNS
local NUM_PVP_TALENT_SLOTS = 4
local global_spec_id_roles_detailed = {
@@ -255,11 +273,7 @@ function lib:PLAYER_LOGIN ()
frame:RegisterEvent ("UNIT_NAME_UPDATE")
frame:RegisterEvent ("UNIT_AURA")
frame:RegisterEvent ("CHAT_MSG_ADDON")
if C_ChatInfo then -- XXX 8.0 compat
C_ChatInfo.RegisterAddonMessagePrefix (COMMS_PREFIX)
else
RegisterAddonMessagePrefix (COMMS_PREFIX)
end
local guid = UnitGUID ("player")
local info = self:BuildInfo ("player")
@@ -307,26 +321,17 @@ lib.static_cache.class_to_class_id = {} -- [CLASS] -> class_id
-- The talents cache can no longer be pre-fetched on login, but is now constructed class-by-class as we inspect people.
-- This probably means we want to only ever access it through the GetCachedTalentInfo() helper function below.
lib.static_cache.talents = {} -- [talent_id] -> { .spell_id, .talent_id, .name_localized, .icon, .tier, .column }
-- Dridzt: I'd love another way but none of the GetTalent* functions return spellID, GetTalentLink() and parsing the link gives talentID that's not related to spellID as well
-- A quick tooltip scan is cheap though so elegance aside this is a good workaround considering this only runs once
local tip = CreateFrame ("GameTooltip", MAJOR.."ScanTip", nil, "GameTooltipTemplate")
tip:SetOwner (UIParent, "ANCHOR_NONE")
lib.static_cache.pvp_talents = {} -- [talent_id] -> { .spell_id, .talent_id, .name_localized, .icon }
function lib:GetCachedTalentInfo (class_id, tier, col, group, is_inspect, unit)
local talents = self.static_cache.talents
local talent_id, name, icon, sel, avail = GetTalentInfo (tier, col, group, is_inspect, unit)
if not talent_id or not class_id then
local talent_id, name, icon, sel, _, spell_id = GetTalentInfo (tier, col, group, is_inspect, unit)
if not talent_id then
--[===[@debug@
debug ("GetCachedTalentInfo("..tostring(class_id)..","..tier..","..col..","..group..","..tostring(is_inspect)..","..tostring(unit)..") returned nil") --@end-debug@]===]
return {}
end
talents[class_id] = talents[class_id] or {}
local class_talents = talents[class_id]
local class_talents = self.static_cache.talents
if not class_talents[talent_id] then
tip:ClearLines ()
tip:SetTalent (talent_id, is_inspect, group)
local _, _,spell_id = tip:GetSpell ()
class_talents[talent_id] = {
spell_id = spell_id,
talent_id = talent_id,
@@ -339,6 +344,45 @@ function lib:GetCachedTalentInfo (class_id, tier, col, group, is_inspect, unit)
return class_talents[talent_id], sel
end
function lib:GetCachedTalentInfoByID (talent_id)
local class_talents = self.static_cache.talents
if talent_id and not class_talents[talent_id] then
local _, name, icon, _, _, spell_id, _, row, col = GetTalentInfoByID (talent_id)
if not name then
--[===[@debug@
debug ("GetCachedTalentInfoByID("..tostring(talent_id)..") returned nil") --@end-debug@]===]
return nil
end
class_talents[talent_id] = {
spell_id = spell_id,
talent_id = talent_id,
name_localized = name,
icon = icon,
tier = row,
column = col,
}
end
return class_talents[talent_id]
end
function lib:GetCachedPvpTalentInfoByID (talent_id)
local pvp_talents = self.static_cache.pvp_talents
if talent_id and not pvp_talents[talent_id] then
local _, name, icon, _, _, spell_id = GetPvpTalentInfoByID (talent_id)
if not name then
--[===[@debug@
debug ("GetCachedPvpTalentInfo("..tostring(talent_id)..") returned nil") --@end-debug@]===]
return nil
end
pvp_talents[talent_id] = {
spell_id = spell_id,
talent_id = talent_id,
name_localized = name,
icon = icon,
}
end
return pvp_talents[talent_id]
end
function lib:CacheGameData ()
local gspecs = self.static_cache.global_specs
@@ -507,13 +551,13 @@ function lib:BuildInfo (unit)
local is_inspect = not UnitIsUnit (unit, "player")
local spec = GetSpecialization ()
info.global_spec_id = is_inspect and GetInspectSpecialization (unit) or spec and GetSpecializationInfo (spec)
local gspec_id = is_inspect and GetInspectSpecialization (unit) or spec and GetSpecializationInfo (spec)
local gspecs = self.static_cache.global_specs
if not info.global_spec_id or not gspecs[info.global_spec_id] then -- not a valid spec_id
if not gspec_id or not gspecs[gspec_id] then -- not a valid spec_id
info.global_spec_id = nil
else
local gspec_id = info.global_spec_id
info.global_spec_id = gspec_id
local spec_info = gspecs[gspec_id]
info.spec_index = spec_info.idx
info.spec_name_localized = spec_info.name_localized
@@ -528,22 +572,42 @@ function lib:BuildInfo (unit)
if not info.spec_role_detailed then info.spec_role_detailed = class and class_fixed_roles_detailed[class] end
info.talents = info.talents or {}
info.pvp_talents = info.pvp_talents or {}
-- If GetPlayerInfoByGUID didn't return the class, we can't do talents yet
if info.class_id then
-- Only scan talents when we have player data
if info.spec_index then
info.spec_group = GetActiveSpecGroup (is_inspect)
wipe (info.talents) -- Due to spec-specific talents we might leave things in on a spec-change otherwise
wipe (info.talents)
for tier = 1, MAX_TALENT_TIERS do
for col = 1, NUM_TALENT_COLUMNS do
local talent, sel = self:GetCachedTalentInfo (info.class_id, tier, col, info.spec_group, is_inspect, unit)
if talent and talent.talent_id and sel then
if sel then
info.talents[talent.talent_id] = talent
end
end
end
wipe (info.pvp_talents)
if is_inspect then
for index = 1, NUM_PVP_TALENT_SLOTS do
local talent_id = GetInspectSelectedPvpTalent (unit, index)
if talent_id then
info.pvp_talents[talent_id] = self:GetCachedPvpTalentInfoByID (talent_id)
end
end
else
-- C_SpecializationInfo.GetAllSelectedPvpTalentIDs will sometimes return a lot of extra talents
for index = 1, NUM_PVP_TALENT_SLOTS do
local slot_info = GetPvpTalentSlotInfo (index)
local talent_id = slot_info and slot_info.selectedTalentID
if talent_id then
info.pvp_talents[talent_id] = self:GetCachedPvpTalentInfoByID (talent_id)
end
end
end
end
info.glyphs = wipe (info.glyphs or {}) -- kept for addons that still refer to this
info.glyphs = info.glyphs or {} -- kept for addons that still refer to this
if is_inspect and not UnitIsVisible (unit) and UnitIsConnected (unit) then info.not_visible = true end
@@ -635,7 +699,7 @@ function lib:SendLatestSpecData ()
local info = self.cache[guid]
if not info then return end
-- fmt, guid, global_spec_id, talent1 -> MAX_TALENT_TIERS
-- fmt, guid, global_spec_id, talent1 -> MAX_TALENT_TIERS, pvptalent1 -> NUM_PVP_TALENT_SLOTS
-- sequentially, allow no gaps for missing talents we decode by index on the receiving end.
local datastr = COMMS_FMT..COMMS_DELIM..guid..COMMS_DELIM..(info.global_spec_id or 0)
local talentCount = 1
@@ -646,6 +710,14 @@ function lib:SendLatestSpecData ()
for i=talentCount,MAX_TALENT_TIERS do
datastr = datastr..COMMS_DELIM..0
end
talentCount = 1
for k in pairs(info.pvp_talents) do
datastr = datastr..COMMS_DELIM..k
talentCount = talentCount + 1
end
for i=talentCount,NUM_PVP_TALENT_SLOTS do
datastr = datastr..COMMS_DELIM..0
end
--[===[@debug@
debug ("Sending LGIST update to "..scope) --@end-debug@]===]
@@ -668,7 +740,9 @@ msg_idx.fmt = 1
msg_idx.guid = msg_idx.fmt + 1
msg_idx.global_spec_id = msg_idx.guid + 1
msg_idx.talents = msg_idx.global_spec_id + 1
msg_idx.end_talents = msg_idx.talents + MAX_TALENT_TIERS - 1
msg_idx.end_talents = msg_idx.talents + MAX_TALENT_TIERS
msg_idx.pvp_talents = msg_idx.end_talents + 1
msg_idx.end_pvp_talents = msg_idx.pvp_talents + NUM_PVP_TALENT_SLOTS - 1
function lib:CHAT_MSG_ADDON (prefix, datastr, scope, sender)
if prefix ~= COMMS_PREFIX or scope ~= self.commScope then return end
@@ -713,27 +787,34 @@ function lib:CHAT_MSG_ADDON (prefix, datastr, scope, sender)
info.spec_role = gspecs[gspec_id].role
info.spec_role_detailed = global_spec_id_roles_detailed[gspec_id]
local need_inspect = nil
local need_inspect = nil -- shouldn't be needed, but just in case
info.talents = wipe (info.talents or {})
local talents = self.static_cache.talents[info.class_id]
if talents then -- The group entry is created before we have inspect-data, so may not have cached talents yet
for i = msg_idx.talents, msg_idx.end_talents do
local talent_id = tonumber (data[i])
if talent_id and talent_id > 0 then
if talents[talent_id] then
info.talents[talent_id] = talents[talent_id]
local talent_id = tonumber (data[i]) or 0
if talent_id > 0 then
local talent = self:GetCachedTalentInfoByID (talent_id)
if talent then
info.talents[talent_id] = talent
else
-- While we had some talents for this class, we apparently didn't have all for this particular spec, so mark for inspect
need_inspect = 1
end
end
end
else
-- Talents weren't pre-cached, so mark for inspect
need_inspect = 1
end
info.glyphs = wipe (info.glyphs or {}) -- kept for addons that still refer to this
info.pvp_talents = wipe (info.pvp_talents or {})
for i = msg_idx.pvp_talents, msg_idx.end_pvp_talents do
local talent_id = tonumber (data[i]) or 0
if talent_id > 0 then
local talent = self:GetCachedPvpTalentInfoByID (talent_id)
if talent then
info.pvp_talents[talent_id] = talent
else
need_inspect = 1
end
end
end
info.glyphs = info.glyphs or {} -- kept for addons that still refer to this
local mainq, staleq = self.state.mainq, self.state.staleq
local want_inspect = not need_inspect and self.inspect_ready_used and (mainq[guid] or staleq[guid]) and 1 or nil
@@ -741,7 +822,7 @@ function lib:CHAT_MSG_ADDON (prefix, datastr, scope, sender)
if need_inspect or want_inspect then self.frame:Show () end
--[===[@debug@
debug ("Firing LGIST update event for unit "..unit..", GUID "..guid) --@end-debug@]===]
debug ("Firing LGIST update event for unit "..unit..", GUID "..guid..", inspect "..tostring(not not need_inspect)) --@end-debug@]===]
self.events:Fire (UPDATE_EVENT, guid, unit, info)
self.events:Fire (QUEUE_EVENT)
end
@@ -817,8 +898,8 @@ function lib:UNIT_AURA (unit)
end
function lib:UNIT_SPELLCAST_SUCCEEDED (unit, spellname, rank, lineid, spellid)
if spellid == 200749 then
function lib:UNIT_SPELLCAST_SUCCEEDED (unit, _, spell_id)
if spell_id == 200749 then -- Activating Specialization
self:Query (unit) -- Definitely changed, so high prio refresh
end
end
@@ -1,7 +1,7 @@
## Interface: 70300
## Interface: 80300
## Title: Lib: GroupInSpecT-1.1
## Notes: Keeps track of group members and keeps an up-to-date cache of their specialization and talents.
## Version: r92
## Version: 1.4.0
## Author: Anyia of HordeYakka (Jubei'Thos)
## X-Category: Library
+1 -1
View File
@@ -4,7 +4,7 @@
## Author: Vardex
## X-Category: Library
## X-License: BSD
## Version: @project-version@
## Version: DetailsRetail.8.3.0.7348.141
## DefaultState: Enabled
## LoadOnDemand: 0
+1 -1
View File
@@ -775,7 +775,7 @@ end
--> choose avatar window
do
local avatar_pick_frame = CreateFrame ("frame", "AvatarPickFrame", UIParent)
local avatar_pick_frame = CreateFrame ("frame", "AvatarPickFrame", UIParent,"BackdropTemplate")
avatar_pick_frame:SetFrameStrata ("DIALOG")
avatar_pick_frame:SetBackdrop ({bgFile = [[Interface\FrameGeneral\UI-Background-Marble]], edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], tile = true, tileSize = 256, edgeSize = 32, insets = {left = 11, right = 12, top = 12, bottom = 11}})
avatar_pick_frame:SetBackdropColor (.3, .3, .3, .9)
+97 -25
View File
File diff suppressed because one or more lines are too long
@@ -334,6 +334,74 @@
return t
end
local tremove = _G.tremove
--delete an actor from the combat ~delete ~erase ~remove
function combate:DeleteActor(attribute, actorName, removeDamageTaken)
local container = self[attribute]
if (container) then
local actorTable = container._ActorTable
--get the object for the deleted actor
local deletedActor = self(attribute, actorName)
if (not deletedActor) then
return
else
for i = 1, #actorTable do
local actor = actorTable[i]
if (actor.nome == actorName) then
print ("Details: found the actor: ", actorName, actor.nome, i)
break
end
end
end
--store the index it was found
local indexToDelete
for i = 1, #actorTable do
local actor = actorTable[i]
--is this the actor we want to remove?
if (actor.nome == actorName or actor == deletedActor) then
indexToDelete = i
else
--get the damage dealt and remove
local damageDoneToRemovedActor = (actor.targets[actorName]) or 0
actor.targets[actorName] = nil
actor.total = actor.total - damageDoneToRemovedActor
actor.total_without_pet = actor.total_without_pet - damageDoneToRemovedActor
--damage taken
if (removeDamageTaken) then
local hadDamageTaken = actor.damage_from[actorName]
if (hadDamageTaken) then
--query the deleted actor to know how much damage it applied to this actor
local damageDoneToActor = (deletedActor.targets[actor.nome]) or 0
actor.damage_taken = actor.damage_taken - damageDoneToActor
end
end
--spells
local spellsTable = actor.spells._ActorTable
for spellId, spellTable in pairs(spellsTable) do
local damageDoneToRemovedActor = (spellTable.targets[actorName]) or 0
spellTable.targets[actorName] = nil
spellTable.total = spellTable.total - damageDoneToRemovedActor
end
end
end
if (indexToDelete) then
tremove(container._ActorTable, indexToDelete)
print("Details: damage done to ".. actorName .." removed.")
else
print("Details: index of the " .. actorName .. " not found on map index.")
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
@@ -63,55 +63,6 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
--from weakauras, list of functions to block on scripts
--source https://github.com/WeakAuras/WeakAuras2/blob/520951a4b49b64cb49d88c1a8542d02bbcdbe412/WeakAuras/AuraEnvironment.lua#L66
local blockedFunctions = {
-- Lua functions that may allow breaking out of the environment
getfenv = true,
getfenv = true,
loadstring = true,
pcall = true,
xpcall = true,
getglobal = true,
-- blocked WoW API
SendMail = true,
SetTradeMoney = true,
AddTradeMoney = true,
PickupTradeMoney = true,
PickupPlayerMoney = true,
TradeFrame = true,
MailFrame = true,
EnumerateFrames = true,
RunScript = true,
AcceptTrade = true,
SetSendMailMoney = true,
EditMacro = true,
SlashCmdList = true,
DevTools_DumpCommand = true,
hash_SlashCmdList = true,
CreateMacro = true,
SetBindingMacro = true,
GuildDisband = true,
GuildUninvite = true,
securecall = true,
--additional
setmetatable = true,
}
local functionFilter = setmetatable ({}, {__index = function (env, key)
if (key == "_G") then
return env
elseif (blockedFunctions [key]) then
return nil
else
return _G [key]
end
end})
function atributo_custom:GetCombatContainerIndex (attribute)
return combat_containers [attribute]
end
@@ -162,7 +113,7 @@
local errortext
func, errortext = loadstring (custom_object.script)
if (func) then
setfenv (func, functionFilter)
DetailsFramework:SetEnvironment(func)
_detalhes.custom_function_cache [instance.customName] = func
else
_detalhes:Msg ("|cFFFF9900error compiling code for custom display " .. (instance.customName or "") .. " |r:", errortext)
@@ -171,7 +122,7 @@
if (custom_object.tooltip) then
local tooltip_script, errortext = loadstring (custom_object.tooltip)
if (tooltip_script) then
setfenv (tooltip_script, functionFilter)
DetailsFramework:SetEnvironment(tooltip_script)
_detalhes.custom_function_cache [instance.customName .. "Tooltip"] = tooltip_script
else
_detalhes:Msg ("|cFFFF9900error compiling tooltip code for custom display " .. (instance.customName or "") .. " |r:", errortext)
@@ -181,7 +132,7 @@
if (custom_object.total_script) then
local total_script, errortext = loadstring (custom_object.total_script)
if (total_script) then
setfenv (total_script, functionFilter)
DetailsFramework:SetEnvironment(total_script)
_detalhes.custom_function_cache [instance.customName .. "Total"] = total_script
else
_detalhes:Msg ("|cFFFF9900error compiling total code for custom display " .. (instance.customName or "") .. " |r:", errortext)
@@ -191,7 +142,7 @@
if (custom_object.percent_script) then
local percent_script, errortext = loadstring (custom_object.percent_script)
if (percent_script) then
setfenv (percent_script, functionFilter)
DetailsFramework:SetEnvironment(percent_script)
_detalhes.custom_function_cache [instance.customName .. "Percent"] = percent_script
else
_detalhes:Msg ("|cFFFF9900error compiling percent code for custom display " .. (instance.customName or "") .. " |r:", errortext)
@@ -315,7 +266,7 @@
return total, instance_container._ActorTable, top, amount, "report_name"
end
instance:AtualizarScrollBar (amount)
instance:RefreshScrollBar (amount)
atributo_custom:Refresh (instance, instance_container, combat, force, total, top, custom_object)
@@ -428,7 +379,7 @@
--> refresh functions
function atributo_custom:Refresh (instance, instance_container, combat, force, total, top, custom_object)
local qual_barra = 1
local whichRowLine = 1
local barras_container = instance.barras
local percentage_type = instance.row_info.percent_type
@@ -456,7 +407,7 @@
if (use_total_bar and instance.barraS[1] == 1) then
qual_barra = 2
whichRowLine = 2
local iter_last = instance.barraS[2]
if (iter_last == instance.rows_fit_in_window) then
iter_last = iter_last - 1
@@ -464,8 +415,8 @@
local row1 = barras_container [1]
row1.minha_tabela = nil
row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"])
row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1.lineText1:SetText (Loc ["STRING_TOTAL"])
row1.lineText4:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1:SetValue (100)
local r, g, b = unpack (instance.total_bar.color)
@@ -477,14 +428,14 @@
gump:Fade (row1, "out")
for i = instance.barraS[1], iter_last, 1 do
instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
else
for i = instance.barraS[1], instance.barraS[2], 1 do
instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
@@ -492,7 +443,7 @@
if (use_total_bar and instance.barraS[1] == 1) then
qual_barra = 2
whichRowLine = 2
local iter_last = instance.barraS[2]
if (iter_last == instance.rows_fit_in_window) then
iter_last = iter_last - 1
@@ -500,8 +451,8 @@
local row1 = barras_container [1]
row1.minha_tabela = nil
row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"])
row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1.lineText1:SetText (Loc ["STRING_TOTAL"])
row1.lineText4:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1:SetValue (100)
local r, g, b = unpack (instance.total_bar.color)
@@ -513,14 +464,14 @@
gump:Fade (row1, "out")
for i = iter_last, instance.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
else
for i = instance.barraS[2], instance.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
@@ -528,7 +479,7 @@
if (force) then
if (instance:IsGroupMode()) then
for i = qual_barra, instance.rows_fit_in_window do
for i = whichRowLine, instance.rows_fit_in_window do
gump:Fade (instance.barras [i], "in", 0.3)
end
end
@@ -584,18 +535,18 @@
return _detalhes:EndRefresh (instance, 0, combat, combat [1])
end
if (type (value) == "number") then
row.texto_direita:SetText (SelectedToKFunction (_, value) .. bars_brackets[1] .. percent .. bars_brackets[2])
row.lineText4:SetText (SelectedToKFunction (_, value) .. bars_brackets[1] .. percent .. bars_brackets[2])
else
row.texto_direita:SetText (value .. bars_brackets[1] .. percent .. bars_brackets[2])
row.lineText4:SetText (value .. bars_brackets[1] .. percent .. bars_brackets[2])
end
else
local formated_value = SelectedToKFunction (_, self.value)
local rightText = formated_value .. bars_brackets[1] .. percent .. bars_brackets[2]
if (UsingCustomRightText) then
row.texto_direita:SetText (_string_replace (instance.row_info.textR_custom_text, formated_value, "", percent, self, combat, instance, rightText))
row.lineText4:SetText (_string_replace (instance.row_info.textR_custom_text, formated_value, "", percent, self, combat, instance, rightText))
else
row.texto_direita:SetText (rightText)
row.lineText4:SetText (rightText)
end
end
@@ -623,7 +574,7 @@
end
function atributo_custom:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container)
function atributo_custom:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container)
--> primeiro colocado
if (esta_barra.colocacao == 1) then
@@ -673,7 +624,7 @@
--> apenas atualizar
if (_detalhes.is_using_row_animations) then
local upRow = barras_container [qual_barra-1]
local upRow = barras_container [whichRowLine-1]
if (upRow) then
if (upRow.statusbar:GetValue() < esta_barra.statusbar:GetValue()) then
esta_barra:SetValue (esta_porcentagem)
@@ -773,7 +724,7 @@
--> left text
self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText)
esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15)
esta_barra.lineText1:SetSize (esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15)
end
File diff suppressed because it is too large Load Diff
+152 -109
View File
@@ -64,7 +64,7 @@ local TooltipMaximizedMethod = 1
local headerColor = "yellow"
local info = _detalhes.janela_info
local info = _detalhes.playerDetailWindow
local keyName
function atributo_heal:NovaTabela (serial, nome, link)
@@ -356,10 +356,10 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
end
--estra mostrando ALL ento posso seguir o padro correto? primeiro, atualiza a scroll bar...
instancia:AtualizarScrollBar (amount)
instancia:RefreshScrollBar (amount)
--depois faz a atualizao normal dele atravs dos iterators
local qual_barra = 1
local whichRowLine = 1
local barras_container = instancia.barras --> evita buscar N vezes a key .barras dentro da instncia
local percentage_type = instancia.row_info.percent_type
local bars_show_data = instancia.row_info.textR_show_data
@@ -407,7 +407,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (use_total_bar and instancia.barraS[1] == 1) then
qual_barra = 2
whichRowLine = 2
local iter_last = instancia.barraS[2]
if (iter_last == instancia.rows_fit_in_window) then
iter_last = iter_last - 1
@@ -415,8 +415,12 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
local row1 = barras_container [1]
row1.minha_tabela = nil
row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"])
row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1.lineText1:SetText (Loc ["STRING_TOTAL"])
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(row1, "", _detalhes:ToK2 (total), _detalhes:ToK (total / combat_time))
else
row1.lineText4:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
end
row1:SetValue (100)
local r, g, b = unpack (instancia.total_bar.color)
@@ -430,19 +434,19 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = instancia.barraS[1], iter_last-1, 1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
else
for i = instancia.barraS[1], iter_last, 1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
end
@@ -451,18 +455,18 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = instancia.barraS[1], instancia.barraS[2]-1, 1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
else
for i = instancia.barraS[1], instancia.barraS[2], 1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
end
@@ -472,7 +476,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (use_total_bar and instancia.barraS[1] == 1) then
qual_barra = 2
whichRowLine = 2
local iter_last = instancia.barraS[2]
if (iter_last == instancia.rows_fit_in_window) then
iter_last = iter_last - 1
@@ -480,8 +484,13 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
local row1 = barras_container [1]
row1.minha_tabela = nil
row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"])
row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1.lineText1:SetText (Loc ["STRING_TOTAL"])
--
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(row1, "", _detalhes:ToK2(total), _detalhes:ToK(total / combat_time))
else
row1.lineText4:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
end
row1:SetValue (100)
local r, g, b = unpack (instancia.total_bar.color)
@@ -495,18 +504,18 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = iter_last-1, instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
else
for i = iter_last, instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
end
@@ -514,18 +523,18 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = instancia.barraS[2]-1, instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
else
for i = instancia.barraS[2], instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
end
@@ -534,7 +543,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
end
if (use_animations) then
instancia:fazer_animacoes (qual_barra - 1)
instancia:PerformAnimations (whichRowLine - 1)
end
if (instancia.atributo == 5) then --> custom
@@ -551,7 +560,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
--> beta, hidar barras no usadas durante um refresh forado
if (forcar) then
if (instancia.modo == 2) then --> group
for i = qual_barra, instancia.rows_fit_in_window do
for i = whichRowLine, instancia.rows_fit_in_window do
gump:Fade (instancia.barras [i], "in", 0.3)
end
end
@@ -564,22 +573,22 @@ end
local actor_class_color_r, actor_class_color_g, actor_class_color_b
--function atributo_heal:AtualizaBarra (instancia, qual_barra, lugar, total, sub_atributo, forcar)
function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
--function atributo_heal:RefreshLine (instancia, whichRowLine, lugar, total, sub_atributo, forcar)
function atributo_heal:RefreshLine(instancia, barras_container, whichRowLine, lugar, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
local esta_barra = instancia.barras[qual_barra] --> pega a referncia da barra na janela
local thisLine = instancia.barras[whichRowLine] --> pega a referncia da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
if (not thisLine) then
print ("DEBUG: problema com <instancia.thisLine> "..whichRowLine.." "..lugar)
return
end
local tabela_anterior = esta_barra.minha_tabela
local tabela_anterior = thisLine.minha_tabela
esta_barra.minha_tabela = self --grava uma referncia dessa classe de dano na barra
self.minha_barra = esta_barra --> salva uma referncia da barra no objeto do jogador
thisLine.minha_tabela = self --grava uma referncia dessa classe de dano na barra
self.minha_barra = thisLine --> salva uma referncia da barra no objeto do jogador
esta_barra.colocacao = lugar --> salva na barra qual a colocao dela.
thisLine.colocacao = lugar --> salva na barra qual a colocao dela.
self.colocacao = lugar --> salva qual a colocao do jogador no objeto dele
local healing_total = self.total --> total de dano que este jogador deu
@@ -591,6 +600,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
if (percentage_type == 1) then
porcentagem = _cstr ("%.1f", self [keyName] / total * 100)
elseif (percentage_type == 2) then
porcentagem = _cstr ("%.1f", self [keyName] / instancia.top * 100)
end
@@ -626,7 +636,12 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
-- >>>>>>>>>>>>>>> texto da direita
if (instancia.atributo == 5) then --> custom
esta_barra.texto_direita:SetText (_detalhes:ToK (self.custom) .. " (" .. porcentagem .. "%)")
--
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, "", _detalhes:ToK (self.custom), porcentagem .. "%")
else
thisLine.lineText4:SetText (_detalhes:ToK (self.custom) .. " (" .. porcentagem .. "%)")
end
esta_porcentagem = _math_floor ((self.custom/instancia.top) * 100)
else
@@ -635,7 +650,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
hps = _math_floor (hps)
local formated_heal = SelectedToKFunction (_, healing_total)
local formated_hps = SelectedToKFunction (_, hps)
esta_barra.ps_text = formated_hps
thisLine.ps_text = formated_hps
if (not bars_show_data [1]) then
formated_heal = ""
@@ -651,9 +666,13 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_heal .. bars_brackets[1] .. formated_hps .. bars_separator .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_heal, formated_hps, porcentagem, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_heal, formated_hps, porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, formated_heal, formated_hps, porcentagem)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((healing_total/instancia.top) * 100)
@@ -662,7 +681,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
hps = _math_floor (hps)
local formated_heal = SelectedToKFunction (_, healing_total)
local formated_hps = SelectedToKFunction (_, hps)
esta_barra.ps_text = formated_hps
thisLine.ps_text = formated_hps
if (not bars_show_data [1]) then
formated_hps = ""
@@ -678,9 +697,13 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_hps .. bars_brackets[1] .. formated_heal .. bars_separator .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_hps, formated_heal, porcentagem, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_hps, formated_heal, porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, formated_hps, formated_heal, porcentagem)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((hps/instancia.top) * 100)
@@ -707,9 +730,13 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_overheal .. bars_brackets[1] .. overheal_percent .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_overheal, "", overheal_percent, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_overheal, "", overheal_percent, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, "", formated_overheal, overheal_percent)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((self.totalover/instancia.top) * 100)
@@ -729,9 +756,13 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_healtaken .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_healtaken, "", porcentagem, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_healtaken, "", porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, "", formated_healtaken, porcentagem)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((self.healing_taken/instancia.top) * 100)
@@ -751,9 +782,13 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_enemyheal .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_enemyheal, "", porcentagem, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_enemyheal, "", porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, "", formated_enemyheal, porcentagem)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((self.heal_enemy_amt/instancia.top) * 100)
@@ -772,9 +807,13 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_absorbs .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_absorbs, "", porcentagem, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_absorbs, "", porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, "", formated_absorbs, porcentagem)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((self.totalabsorb/instancia.top) * 100)
@@ -793,86 +832,90 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = formated_absorbs .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_absorbs, "", porcentagem, self, instancia.showing, instancia, rightText))
thisLine.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_absorbs, "", porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(thisLine, "", formated_absorbs, porcentagem)
else
thisLine.lineText4:SetText(rightText)
end
end
esta_porcentagem = _math_floor ((self.totaldenied/instancia.top) * 100)
end
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
gump:UpdateTooltip (qual_barra, esta_barra, instancia)
if (thisLine.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
gump:UpdateTooltip (whichRowLine, thisLine, instancia)
end
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container, use_animations)
return self:RefreshBarra2 (thisLine, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container, use_animations)
end
function atributo_heal:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container, use_animations)
function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container, use_animations)
--> primeiro colocado
if (esta_barra.colocacao == 1) then
if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then
esta_barra:SetValue (100)
if (thisLine.colocacao == 1) then
if (not tabela_anterior or tabela_anterior ~= thisLine.minha_tabela or forcar) then
thisLine:SetValue (100)
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
gump:Fade (thisLine, "out")
end
return self:RefreshBarra (esta_barra, instancia)
return self:RefreshBarra (thisLine, instancia)
else
return
end
else
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
esta_barra:SetValue (esta_porcentagem)
thisLine:SetValue (esta_porcentagem)
if (use_animations) then
esta_barra.animacao_fim = esta_porcentagem
thisLine.animacao_fim = esta_porcentagem
else
esta_barra.animacao_ignorar = true
thisLine.animacao_ignorar = true
end
gump:Fade (esta_barra, "out")
gump:Fade (thisLine, "out")
if (instancia.row_info.texture_class_colors) then
esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b)
thisLine.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b)
end
if (instancia.row_info.texture_background_class_color) then
esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b)
thisLine.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b)
end
return self:RefreshBarra (esta_barra, instancia)
return self:RefreshBarra (thisLine, instancia)
else
--> agora esta comparando se a tabela da barra diferente da tabela na atualizao anterior
if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then --> aqui diz se a barra do jogador mudou de posio ou se ela apenas ser atualizada
if (not tabela_anterior or tabela_anterior ~= thisLine.minha_tabela or forcar) then --> aqui diz se a barra do jogador mudou de posio ou se ela apenas ser atualizada
if (use_animations) then
esta_barra.animacao_fim = esta_porcentagem
thisLine.animacao_fim = esta_porcentagem
else
esta_barra:SetValue (esta_porcentagem)
esta_barra.animacao_ignorar = true
thisLine:SetValue (esta_porcentagem)
thisLine.animacao_ignorar = true
end
esta_barra.last_value = esta_porcentagem --> reseta o ultimo valor da barra
thisLine.last_value = esta_porcentagem --> reseta o ultimo valor da barra
return self:RefreshBarra (esta_barra, instancia)
return self:RefreshBarra (thisLine, instancia)
elseif (esta_porcentagem ~= esta_barra.last_value) then --> continua mostrando a mesma tabela ento compara a porcentagem
elseif (esta_porcentagem ~= thisLine.last_value) then --> continua mostrando a mesma tabela ento compara a porcentagem
--> apenas atualizar
if (use_animations) then
esta_barra.animacao_fim = esta_porcentagem
thisLine.animacao_fim = esta_porcentagem
else
esta_barra:SetValue (esta_porcentagem)
thisLine:SetValue (esta_porcentagem)
end
esta_barra.last_value = esta_porcentagem
thisLine.last_value = esta_porcentagem
return self:RefreshBarra (esta_barra, instancia)
return self:RefreshBarra (thisLine, instancia)
end
end
@@ -880,7 +923,7 @@ function atributo_heal:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo
end
function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize)
function atributo_heal:RefreshBarra (thisLine, instancia, from_resize)
local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally
@@ -889,13 +932,13 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize)
end
--> icon
self:SetClassIcon (esta_barra.icone_classe, instancia, class)
self:SetClassIcon (thisLine.icone_classe, instancia, class)
--> texture color
self:SetBarColors (esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b)
self:SetBarColors (thisLine, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b)
--> left text
self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText)
self:SetBarLeftText (thisLine, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText)
esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15)
thisLine.lineText1:SetSize (thisLine:GetWidth() - thisLine.lineText4:GetStringWidth() - 20, 15)
end
@@ -1764,10 +1807,10 @@ function atributo_heal:MontaInfoOverHealing()
barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido...
end
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
barra.lineText1:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
local formated_value = SelectedToKFunction (_, _math_floor (tabela[2]))
barra.texto_direita:SetText (formated_value .." (".. _cstr ("%.1f", tabela[3]) .."%)")
barra.lineText4:SetText (formated_value .." (".. _cstr ("%.1f", tabela[3]) .."%)")
barra.icone:SetTexture (tabela[5])
@@ -1815,9 +1858,9 @@ function atributo_heal:MontaInfoOverHealing()
barra.textura:SetValue (tabela[2]/max_*100)
end
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .. _cstr ("%.1f", tabela[3]) .. instancia.divisores.fecha)
barra.texto_esquerdo:SetWidth (barra:GetWidth() - barra.texto_direita:GetStringWidth() - 30)
barra.lineText1:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
barra.lineText4:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .. _cstr ("%.1f", tabela[3]) .. instancia.divisores.fecha)
barra.lineText1:SetWidth (barra:GetWidth() - barra.lineText4:GetStringWidth() - 30)
-- icon
barra.icone:SetTexture ([[Interface\AddOns\Details\images\classes_small]])
@@ -1971,13 +2014,13 @@ function atributo_heal:MontaInfoHealingDone()
barra.icone:SetTexCoord (_unpack (texCoords))
end
barra.texto_esquerdo:SetText (index .. ". " .. _detalhes:GetOnlyName (tabela[1]))
barra.lineText1:SetText (index .. ". " .. _detalhes:GetOnlyName (tabela[1]))
barra.textura:SetStatusBarColor (1, 1, 1, 1)
if (info.sub_atributo == 2) then
barra.texto_direita:SetText (_detalhes:comma_value (_math_floor (tabela[2]/meu_tempo)) .." (" .. _cstr ("%.1f", tabela[3]) .. "%)")
barra.lineText4:SetText (_detalhes:comma_value (_math_floor (tabela[2]/meu_tempo)) .." (" .. _cstr ("%.1f", tabela[3]) .. "%)")
else
barra.texto_direita:SetText (SelectedToKFunction (_, tabela[2]) .. " (" .. _cstr ("%.1f", tabela[3]) .. "%)")
barra.lineText4:SetText (SelectedToKFunction (_, tabela[2]) .. " (" .. _cstr ("%.1f", tabela[3]) .. "%)")
end
barra.minha_tabela = self
@@ -1990,9 +2033,9 @@ function atributo_heal:MontaInfoHealingDone()
end
function atributo_heal:MontaTooltipAlvos (esta_barra, index, instancia)
function atributo_heal:MontaTooltipAlvos (thisLine, index, instancia)
local inimigo = esta_barra.nome_inimigo
local inimigo = thisLine.nome_inimigo
local container = self.spells._ActorTable
local habilidades = {}
local total
@@ -2008,8 +2051,8 @@ function atributo_heal:MontaTooltipAlvos (esta_barra, index, instancia)
end
_detalhes:FormatCooltipForSpells()
GameCooltip:SetOwner(esta_barra, "bottom", "top", 4, -2)
GameCooltip:SetOption ("MinWidth", max(230, esta_barra:GetWidth()*0.98))
GameCooltip:SetOwner(thisLine, "bottom", "top", 4, -2)
GameCooltip:SetOption ("MinWidth", max(230, thisLine:GetWidth()*0.98))
--> add spells
for spellid, tabela in _pairs (container) do
@@ -2151,8 +2194,8 @@ function atributo_heal:MontaDetalhesHealingTaken (nome, barra)
barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido...
end
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[3]) .."%".. instancia.divisores.fecha)
barra.lineText1:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
barra.lineText4:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[3]) .."%".. instancia.divisores.fecha)
barra.icone:SetTexture (tabela[5])
@@ -115,6 +115,31 @@ function _detalhes:InstanciaCallFunctionOffline (funcao, ...)
end
end
function Details:InstanceGroupCall(instance, funcName, ...)
for _, thisInstance in ipairs (instance:GetInstanceGroup()) do
thisInstance[funcName](thisInstance, ...)
end
end
function Details:InstanceGroupEditSetting(instance, keyName, value)
for _, thisInstance in ipairs (instance:GetInstanceGroup()) do
thisInstance[keyName] = value
end
end
function Details:InstanceGroupEditSettingOnTable(instance, table1Key, table2Key, table3Key, value)
for _, thisInstance in ipairs (instance:GetInstanceGroup()) do
if (value == nil) then
local value1 = table3Key
local table1 = thisInstance[table1Key]
table1[table2Key] = value1
else
local table1 = thisInstance[table1Key]
table1[table2Key][table3Key] = value
end
end
end
function _detalhes:GetLowerInstanceNumber()
local lower = 999
for index, instancia in _ipairs (_detalhes.tabela_instancias) do
@@ -347,6 +372,9 @@ end
function _detalhes:ShutDown()
return self:DesativarInstancia()
end
function _detalhes:Shutdown()
return self:DesativarInstancia()
end
function _detalhes:GetNumWindows()
@@ -616,7 +644,6 @@ end
self:ToolbarSide()
self:AttributeMenu()
--[=[ --this block was showing back the window after using /details hide, It's probably a leftover from the new Auto Hide and the old one.
_detalhes.WindowAutoHideTick = _detalhes.WindowAutoHideTick or {}
if (_detalhes.WindowAutoHideTick [self.meu_id]) then
_detalhes.WindowAutoHideTick [self.meu_id]:Cancel()
@@ -632,7 +659,6 @@ end
_detalhes.WindowAutoHideTick [self.meu_id]:Cancel()
end
end)
--]=]
else
self:AdjustAlphaByContext(true)
end
@@ -1430,6 +1456,11 @@ end
--> ao reiniciar o addon esta funo rodada para recriar a janela da instncia
--> search key: ~restaura ~inicio ~start
function Details:RestoreWindow(index, temp, loadOnly)
self:RestauraJanela (index, temp, loadOnly)
end
function _detalhes:RestauraJanela(index, temp, load_only)
--> load
@@ -1492,23 +1523,26 @@ function _detalhes:RestauraJanela (index, temp, load_only)
self.StatusBarSaved = self.StatusBarSaved or {options = {}}
self.StatusBar.options = self.StatusBarSaved.options
if (self.StatusBarSaved.center and self.StatusBarSaved.center == "NONE") then
self.StatusBarSaved.center = "DETAILS_STATUSBAR_PLUGIN_CLOCK"
end
local clock = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.center or "DETAILS_STATUSBAR_PLUGIN_CLOCK")
_detalhes.StatusBar:SetCenterPlugin (self, clock, true)
if (self.StatusBarSaved.left and self.StatusBarSaved.left == "NONE") then
self.StatusBarSaved.left = "DETAILS_STATUSBAR_PLUGIN_PSEGMENT"
end
local segment = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.left or "DETAILS_STATUSBAR_PLUGIN_PSEGMENT")
_detalhes.StatusBar:SetLeftPlugin (self, segment, true)
if (self.StatusBarSaved.right and self.StatusBarSaved.right == "NONE") then
self.StatusBarSaved.right = "DETAILS_STATUSBAR_PLUGIN_PDPS"
if (self.StatusBarSaved.center and self.StatusBarSaved.center == "NONE") then
self.StatusBarSaved.center = "DETAILS_STATUSBAR_PLUGIN_CLOCK"
end
local dps = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.right or "DETAILS_STATUSBAR_PLUGIN_PDPS")
_detalhes.StatusBar:SetRightPlugin (self, dps, true)
local clock = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.center or "DETAILS_STATUSBAR_PLUGIN_CLOCK")
_detalhes.StatusBar:SetCenterPlugin (self, clock, true)
if (self.StatusBarSaved.right and self.StatusBarSaved.right == "NONE") then
self.StatusBarSaved.right = "DETAILS_STATUSBAR_PLUGIN_PDURABILITY"
end
local durability = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.right or "DETAILS_STATUSBAR_PLUGIN_PDURABILITY")
_detalhes.StatusBar:SetRightPlugin (self, durability, true)
--> load mode
@@ -1804,7 +1838,7 @@ function _detalhes:InstanceReset (instance)
self:ResetaGump()
if (not _detalhes.initializing) then
_detalhes:AtualizaGumpPrincipal (self, true) --atualiza todas as instancias
_detalhes:RefreshMainWindow (self, true) --atualiza todas as instancias
end
end
@@ -1905,7 +1939,7 @@ function _detalhes:PostponeSwitchToCurrent (instance)
(instance.ativa) and
(instance.last_interaction+3 < _detalhes._tempo) and
(not DetailsReportWindow or not DetailsReportWindow:IsShown()) and
(not _detalhes.janela_info:IsShown())
(not _detalhes.playerDetailWindow:IsShown())
)
) then
instance._postponing_switch = nil
@@ -1930,7 +1964,7 @@ function _detalhes:CheckSwitchToCurrent()
instance.last_interaction = _detalhes._tempo
end
if ((instance.last_interaction and (instance.last_interaction+3 > _detalhes._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (_detalhes.janela_info:IsShown())) then
if ((instance.last_interaction and (instance.last_interaction+3 > _detalhes._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (_detalhes.playerDetailWindow:IsShown())) then
--> postpone
instance._postponing_switch = _detalhes:ScheduleTimer ("PostponeSwitchToCurrent", 1, instance)
else
@@ -2015,7 +2049,7 @@ function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico)
instancia.showing[instancia.atributo].need_refresh = true
instancia.v_barras = true
instancia:ResetaGump()
instancia:AtualizaGumpPrincipal (true)
instancia:RefreshMainWindow (true)
_detalhes:AtualizarJanela (instancia)
elseif (segmento < _detalhes.segments_amount and segmento > 0) then
@@ -2026,7 +2060,7 @@ function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico)
instancia.showing[instancia.atributo].need_refresh = true
instancia.v_barras = true
instancia:ResetaGump()
instancia:AtualizaGumpPrincipal (true)
instancia:RefreshMainWindow (true)
_detalhes:AtualizarJanela (instancia)
end
@@ -2238,7 +2272,7 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
if (not _detalhes.initializing and not iniciando_instancia) then
instance:ResetaGump()
instance:AtualizaGumpPrincipal (true)
instance:RefreshMainWindow (true)
end
_detalhes:SendEvent ("DETAILS_INSTANCE_CHANGESEGMENT", nil, instance, segmento)
@@ -2286,22 +2320,6 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
_detalhes.popup:Select (2, instancia.sub_atributo, atributo)
end
--_detalhes:SetTutorialCVar ("ATTRIBUTE_SELECT_TUTORIAL1", nil)
if (not _detalhes:GetTutorialCVar ("ATTRIBUTE_SELECT_TUTORIAL1") and not _detalhes.initializing and not iniciando_instancia) then
if (not _G ["DetailsWelcomeWindow"] or not _G ["DetailsWelcomeWindow"]:IsShown()) then
_detalhes:TutorialBookmark (instancia)
end
end
if (not _detalhes:GetTutorialCVar ("ATTRIBUTE_SELECT_TUTORIAL2") and not _detalhes.initializing and not iniciando_instancia) then
if (not _G ["DetailsWelcomeWindow"] or not _G ["DetailsWelcomeWindow"]:IsShown()) then
--_detalhes:SetTutorialCVar ("ATTRIBUTE_SELECT_TUTORIAL2", true)
--_detalhes:TutorialBookmark (instancia)
end
end
if (_detalhes.cloud_process) then
if (_detalhes.debug) then
@@ -2362,11 +2380,11 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
instancia:ChangeIcon()
end
if (_detalhes.janela_info:IsShown() and instancia == _detalhes.janela_info.instancia) then
if (_detalhes.playerDetailWindow:IsShown() and instancia == _detalhes.playerDetailWindow.instancia) then
if (not instancia.showing or instancia.atributo > 4) then
_detalhes:FechaJanelaInfo()
else
local actor = instancia.showing (instancia.atributo, _detalhes.janela_info.jogador.nome)
local actor = instancia.showing (instancia.atributo, _detalhes.playerDetailWindow.jogador.nome)
if (actor) then
instancia:AbreJanelaInfo (actor, true)
else
@@ -2391,7 +2409,7 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
if (not _detalhes.initializing and not iniciando_instancia) then
instancia:ResetaGump()
instancia:AtualizaGumpPrincipal (true)
instancia:RefreshMainWindow (true)
end
end
@@ -2476,10 +2494,7 @@ function _detalhes:MontaSoloOption (instancia)
end
-- ~menu
local menu_wallpaper_tex = {63/512, 331/512, 109/512, 143/512}
local menu_wallpaper_color = {.8, .8, .8, 0.2}
local menu_wallpaper_custom_color = {1, 0, 0, 1}
local wallpaper_bg_color = {.8, .8, .8, 0.2}
local menu_icones = {
"Interface\\AddOns\\Details\\images\\atributos_icones_damage",
@@ -2531,6 +2546,10 @@ function _detalhes:MontaAtributosOption (instancia, func)
local options = sub_atributos [i].lista
if (not instancia.sub_atributo_last) then
instancia.sub_atributo_last = {1, 1, 1, 1, 1}
end
for o = 1, atributos [i] do
if (_detalhes:CaptureIsEnabled ( _detalhes.atributos_capture [gindex] )) then
CoolTip:AddMenu (2, func, true, i, o, options[o], nil, true)
@@ -2614,6 +2633,16 @@ function _detalhes:MontaAtributosOption (instancia, func)
return menu_principal, sub_menus
end
local iconCoords = {
[1] = {-1, 0, 0, 0, -1, -1, 0, 0}, --damage, dps, taken, friendldire, frags, enemy damage taken, auras, by spell
[2] = {0, 1, 1, 1, 0, 0, 1}, --healing, hps, overheal, taken, enemyheal, damageprevented, healabsorbed
[3] = {0, -2, -1, 0, 0, 0}, --mana, rage, energy, rune, other resources, alternate power
[4] = {0, 0, -1, 0, 0, 0, 0, 0}, --ccBreak, res, kick, dispel, deaths, cooldowns, buffUptime, debuffUptime
}
local getFineTunedIconCoords = function(attribute, subAttribute)
return iconCoords[attribute] and iconCoords[attribute][subAttribute] or 0
end
function _detalhes:ChangeIcon(icon)
local skin = _detalhes.skins [self.skin]
@@ -2630,7 +2659,6 @@ function _detalhes:ChangeIcon (icon)
end
if (icon) then
--> plugin chamou uma troca de icone
self.baseframe.cabecalho.atributo_icon:SetTexture (icon)
self.baseframe.cabecalho.atributo_icon:SetTexCoord (5/64, 60/64, 3/64, 62/64)
@@ -2644,7 +2672,7 @@ function _detalhes:ChangeIcon (icon)
self.baseframe.cabecalho.atributo_icon:SetPoint ("TOPRIGHT", self.baseframe.cabecalho.ball_point, "TOPRIGHT", icon_anchor[1], icon_anchor[2])
elseif (self.modo == modo_alone) then --> solo
-- o icone alterado pelo prprio plugin
--icon is set by the plugin
elseif (self.modo == modo_grupo or self.modo == modo_all) then --> grupo
@@ -2664,28 +2692,23 @@ function _detalhes:ChangeIcon (icon)
self.baseframe.cabecalho.atributo_icon:SetPoint ("TOPRIGHT", self.baseframe.cabecalho.ball_point, "TOPRIGHT", icon_anchor[1], icon_anchor[2])
end
else
--> normal
local half = 0.00048828125
local size = 0.03125
--normal icons
--local icones = _detalhes.sub_atributos [self.atributo].icones
--self.baseframe.cabecalho.atributo_icon:SetTexture (icones [self.sub_atributo] [1])
--self.baseframe.cabecalho.atributo_icon:SetTexCoord ( unpack (icones [self.sub_atributo] [2]) )
--default
--self.baseframe.cabecalho.atributo_icon:SetTexture (skin.file)
--self.baseframe.cabecalho.atributo_icon:SetTexCoord ( (0.03125 * (self.atributo-1)) + half, (0.03125 * self.atributo) - half, 0.35693359375, 0.38720703125)
--set the attribute icon
self.baseframe.cabecalho.atributo_icon:SetTexture (menu_icones [self.atributo])
if (self.icon_desaturated) then
self.baseframe.cabecalho.atributo_icon:SetDesaturated(true)
else
self.baseframe.cabecalho.atributo_icon:SetDesaturated(false)
end
local p = 0.125 --> 32/256
self.baseframe.cabecalho.atributo_icon:SetTexCoord (p * (self.sub_atributo-1), p * (self.sub_atributo), 0, 1)
self.baseframe.cabecalho.atributo_icon:SetSize (16, 16)
self.baseframe.cabecalho.atributo_icon:ClearAllPoints()
if (self.menu_attribute_string) then
self.baseframe.cabecalho.atributo_icon:SetPoint ("right", self.menu_attribute_string.widget, "left", -4, -1)
local yOffset = getFineTunedIconCoords(self.atributo, self.sub_atributo)
self.baseframe.cabecalho.atributo_icon:SetPoint ("right", self.menu_attribute_string.widget, "left", -4, 1 + yOffset)
end
if (skin.attribute_icon_anchor) then
@@ -2697,15 +2720,10 @@ function _detalhes:ChangeIcon (icon)
self.baseframe.cabecalho.atributo_icon:SetSize (unpack (skin.attribute_icon_size))
end
-- local icon_anchor = skin.icon_anchor_main
-- self.baseframe.cabecalho.atributo_icon:SetPoint ("TOPRIGHT", self.baseframe.cabecalho.ball_point, "TOPRIGHT", icon_anchor[1], icon_anchor[2])
-- self.baseframe.cabecalho.atributo_icon:SetWidth (32)
-- self.baseframe.cabecalho.atributo_icon:SetHeight (32)
end
elseif (self.modo == modo_raid) then --> raid
-- o icone alterado pelo prprio plugin
--icon is set by the plugin
end
end
@@ -2799,7 +2817,7 @@ function _detalhes:AlteraModo (instancia, qual, from_mode_menu)
instancia.modo = modo_grupo
instancia:ChangeIcon()
instancia:AtualizaGumpPrincipal (true)
instancia:RefreshMainWindow (true)
instancia.last_modo = modo_grupo
_detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEMODE", nil, instancia, modo_grupo)
_detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, instancia.atributo, instancia.sub_atributo)
@@ -2819,7 +2837,7 @@ function _detalhes:AlteraModo (instancia, qual, from_mode_menu)
instancia.modo = modo_all
instancia:ChangeIcon()
instancia:AtualizaGumpPrincipal (true)
instancia:RefreshMainWindow (true)
instancia.last_modo = modo_all
_detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEMODE", nil, instancia, modo_all)
_detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, instancia.atributo, instancia.sub_atributo)
@@ -3150,7 +3168,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
if (self.atributo == 2 and self.sub_atributo == 3) then --overheal
percent = _cstr ("%.1f", actor.totalover / (actor.totalover + actor.total) * 100)
elseif (not is_string) then
percent = _cstr ("%.1f", amount / total * 100)
percent = _cstr ("%.1f", amount / max(total, 0.00001) * 100)
end
-- get the dps
@@ -3193,7 +3211,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
local window_bar = self.barras [i]
if (window_bar) then
if (not window_bar.hidden or window_bar.fading_out) then
raw_data_to_report [#raw_data_to_report+1] = {window_bar.texto_esquerdo:GetText(), window_bar.texto_direita:GetText()}
raw_data_to_report [#raw_data_to_report+1] = {window_bar.lineText1:GetText(), window_bar.lineText4:GetText()}
else
break
end
@@ -58,7 +58,7 @@ local headerColor = "yellow"
local actor_class_color_r, actor_class_color_g, actor_class_color_b
local info = _detalhes.janela_info
local info = _detalhes.playerDetailWindow
local keyName
@@ -195,12 +195,12 @@ local function RefreshBarraResources (tabela, barra, instancia)
tabela:AtualizarResources (tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_energy:AtualizarResources (qual_barra, colocacao, instancia)
function atributo_energy:AtualizarResources (whichRowLine, colocacao, instancia)
local esta_barra = instancia.barras [qual_barra]
local esta_barra = instancia.barras [whichRowLine]
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..colocacao)
print ("DEBUG: problema com <instancia.esta_barra> "..whichRowLine.." "..colocacao)
return
end
@@ -208,7 +208,7 @@ function atributo_energy:AtualizarResources (qual_barra, colocacao, instancia)
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = self
self.minha_barra = qual_barra
self.minha_barra = whichRowLine
esta_barra.colocacao = colocacao
local total = instancia.showing.totals.resources
@@ -245,13 +245,17 @@ function atributo_energy:AtualizarResources (qual_barra, colocacao, instancia)
local rightText = formated_resource .. bars_brackets[1] .. formated_rps .. " r/s" .. bars_separator .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_resource, formated_rps, porcentagem, self, instancia.showing, instancia, rightText))
esta_barra.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_resource, formated_rps, porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(esta_barra, formated_resource, formated_rps .. " r/s", porcentagem .. "%")
else
esta_barra.lineText4:SetText (rightText)
end
end
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. self.nome)
esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15)
esta_barra.lineText1:SetText (colocacao .. ". " .. self.nome)
esta_barra.lineText1:SetSize (esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15)
esta_barra:SetValue (100)
@@ -335,20 +339,20 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
tabela_do_combate.totals.resources = total
instancia:AtualizarScrollBar (amount)
instancia:RefreshScrollBar (amount)
local qual_barra = 1
local whichRowLine = 1
local barras_container = instancia.barras
for i = instancia.barraS[1], instancia.barraS[2], 1 do
conteudo[i]:AtualizarResources (qual_barra, i, instancia)
qual_barra = qual_barra+1
conteudo[i]:AtualizarResources (whichRowLine, i, instancia)
whichRowLine = whichRowLine+1
end
--> beta, hidar barras no usadas durante um refresh forado
if (forcar) then
if (instancia.modo == 2) then --> group
for i = qual_barra, instancia.rows_fit_in_window do
for i = whichRowLine, instancia.rows_fit_in_window do
gump:Fade (instancia.barras [i], "in", 0.3)
end
end
@@ -462,9 +466,9 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --> retorna a tabela que precisa ganhar o refresh
end
instancia:AtualizarScrollBar (amount)
instancia:RefreshScrollBar (amount)
local qual_barra = 1
local whichRowLine = 1
local barras_container = instancia.barras
local percentage_type = instancia.row_info.percent_type
local bars_show_data = instancia.row_info.textR_show_data
@@ -512,7 +516,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
if (use_total_bar and instancia.barraS[1] == 1) then
qual_barra = 2
whichRowLine = 2
local iter_last = instancia.barraS[2]
if (iter_last == instancia.rows_fit_in_window) then
iter_last = iter_last - 1
@@ -520,8 +524,12 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
local row1 = barras_container [1]
row1.minha_tabela = nil
row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"])
row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1.lineText1:SetText (Loc ["STRING_TOTAL"])
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(row1, "", _detalhes:ToK2 (total, _detalhes:ToK (total / combat_time)))
else
row1.lineText4:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
end
row1:SetValue (100)
local r, g, b = unpack (instancia.total_bar.color)
@@ -534,32 +542,32 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = instancia.barraS[1], iter_last-1, 1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
else
for i = instancia.barraS[1], iter_last, 1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
end
else
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = instancia.barraS[1], instancia.barraS[2]-1, 1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
else
for i = instancia.barraS[1], instancia.barraS[2], 1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
end
end
@@ -568,7 +576,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
if (use_total_bar and instancia.barraS[1] == 1) then
qual_barra = 2
whichRowLine = 2
local iter_last = instancia.barraS[2]
if (iter_last == instancia.rows_fit_in_window) then
iter_last = iter_last - 1
@@ -576,8 +584,13 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
local row1 = barras_container [1]
row1.minha_tabela = nil
row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"])
row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
row1.lineText1:SetText (Loc ["STRING_TOTAL"])
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(row1, "", _detalhes:ToK2 (total), _detalhes:ToK (total / combat_time))
else
row1.lineText4:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")")
end
row1:SetValue (100)
local r, g, b = unpack (instancia.total_bar.color)
@@ -590,31 +603,31 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = iter_last-1, instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
else
for i = iter_last, instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
end
else
if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then
for i = instancia.barraS[2]-1, instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
conteudo[myPos]:AtualizaBarra (instancia, barras_container, qual_barra, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
else
for i = instancia.barraS[2], instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> instncia, index, total, valor da 1 barra
whichRowLine = whichRowLine+1
end
end
end
@@ -622,12 +635,12 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
end
if (use_animations) then
instancia:fazer_animacoes (qual_barra-1)
instancia:PerformAnimations (whichRowLine-1)
end
if (forcar) then
if (instancia.modo == 2) then --> group
for i = qual_barra, instancia.rows_fit_in_window do
for i = whichRowLine, instancia.rows_fit_in_window do
gump:Fade (instancia.barras [i], "in", 0.3)
end
end
@@ -637,12 +650,12 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
end
function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
function atributo_energy:RefreshLine (instancia, barras_container, whichRowLine, lugar, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
local esta_barra = instancia.barras[qual_barra] --> pega a referncia da barra na janela
local esta_barra = instancia.barras[whichRowLine] --> pega a referncia da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
print ("DEBUG: problema com <instancia.esta_barra> "..whichRowLine.." "..lugar)
return
end
@@ -679,21 +692,25 @@ function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra,
local rightText = formated_energy .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_energy, "", porcentagem, self, instancia.showing, instancia, rightText))
esta_barra.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_energy, "", porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(esta_barra, "", formated_energy, porcentagem)
else
esta_barra.lineText4:SetText (rightText)
end
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
gump:UpdateTooltip (qual_barra, esta_barra, instancia)
gump:UpdateTooltip (whichRowLine, esta_barra, instancia)
end
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container, use_animations)
return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container, use_animations)
end
function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container, use_animations)
function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container, use_animations)
--> primeiro colocado
if (esta_barra.colocacao == 1) then
@@ -777,7 +794,7 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize)
--> left text
self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText)
esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15)
esta_barra.lineText1:SetSize (esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15)
end
@@ -1172,8 +1189,8 @@ function atributo_energy:MontaInfoRegenRecebido()
barra.textura:SetValue (tabela[2]/max_fontes*100)
end
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1])
barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .. " (" .. _cstr("%.1f", tabela[2]/total_regenerado * 100) .. ")")
barra.lineText1:SetText (index..instancia.divisores.colocacao..tabela[1])
barra.lineText4:SetText (_detalhes:comma_value (tabela[2]) .. " (" .. _cstr("%.1f", tabela[2]/total_regenerado * 100) .. ")")
if (barra.mouse_over) then --> atualizar o tooltip
if (barra.isAlvo) then
@@ -1268,8 +1285,8 @@ function atributo_energy:MontaDetalhesRegenRecebido (nome, barra)
barra.textura:SetValue (tabela[2] / max_ * 100)
end
barra.texto_esquerdo:SetText (index .. "." .. tabela [1])
barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." (" .. _cstr("%.1f", tabela[2] / total_regenerado * 100) .."%)")
barra.lineText1:SetText (index .. "." .. tabela [1])
barra.lineText4:SetText (_detalhes:comma_value (tabela[2]) .." (" .. _cstr("%.1f", tabela[2] / total_regenerado * 100) .."%)")
barra.textura:SetStatusBarColor (_unpack (_detalhes.class_colors [tabela[3]]))
barra.icone:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small")
@@ -70,7 +70,7 @@ local UsingCustomRightText = false
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
local info = _detalhes.janela_info
local info = _detalhes.playerDetailWindow
local keyName
local headerColor = "yellow"
@@ -550,13 +550,13 @@ function atributo_misc:ReportSingleDebuffUptimeLine (misc_actor, instance)
return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instancia)
function atributo_misc:DeadAtualizarBarra (morte, whichRowLine, colocacao, instancia)
morte ["dead"] = true --> marca que esta tabela uma tabela de mortes, usado no controla na hora de montar o tooltip
local esta_barra = instancia.barras[qual_barra] --> pega a referncia da barra na janela
local esta_barra = instancia.barras[whichRowLine] --> pega a referncia da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
print ("DEBUG: problema com <instancia.esta_barra> "..whichRowLine.." "..lugar)
return
end
@@ -565,7 +565,7 @@ function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instanc
esta_barra.minha_tabela = morte
morte.nome = morte [3] --> evita dar erro ao redimencionar a janela
morte.minha_barra = qual_barra
morte.minha_barra = whichRowLine
esta_barra.colocacao = colocacao
if (not _getmetatable (morte)) then
@@ -573,8 +573,8 @@ function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instanc
morte._custom = true
end
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. morte [3]:gsub (("%-.*"), ""))
esta_barra.texto_direita:SetText (morte [6])
esta_barra.lineText1:SetText (colocacao .. ". " .. morte [3]:gsub (("%-.*"), ""))
esta_barra.lineText4:SetText (morte [6])
esta_barra:SetValue (100)
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
@@ -602,10 +602,10 @@ function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instanc
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
gump:UpdateTooltip (qual_barra, esta_barra, instancia)
gump:UpdateTooltip (whichRowLine, esta_barra, instancia)
end
esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15)
esta_barra.lineText1:SetSize (esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15)
end
@@ -693,17 +693,17 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo
end
--estra mostrando ALL ento posso seguir o padro correto? primeiro, atualiza a scroll bar...
instancia:AtualizarScrollBar (total)
instancia:RefreshScrollBar (total)
--depois faz a atualizao normal dele atravs dos_ iterators
local qual_barra = 1
local whichRowLine = 1
local barras_container = instancia.barras
local percentage_type = instancia.row_info.percent_type
for i = instancia.barraS[1], instancia.barraS[2], 1 do --> vai atualizar s o range que esta sendo mostrado
if (mortes[i]) then --> correo para um raro e desconhecido problema onde mortes[i] nil
atributo_misc:DeadAtualizarBarra (mortes[i], qual_barra, i, instancia)
qual_barra = qual_barra+1
atributo_misc:DeadAtualizarBarra (mortes[i], whichRowLine, i, instancia)
whichRowLine = whichRowLine+1
end
end
@@ -786,10 +786,10 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo
end
--estra mostrando ALL ento posso seguir o padro correto? primeiro, atualiza a scroll bar...
instancia:AtualizarScrollBar (amount)
instancia:RefreshScrollBar (amount)
--depois faz a atualizao normal dele atravs dos_ iterators
local qual_barra = 1
local whichRowLine = 1
local barras_container = instancia.barras
local percentage_type = instancia.row_info.percent_type
local bars_show_data = instancia.row_info.textR_show_data
@@ -806,22 +806,22 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo
if (instancia.bars_sort_direction == 1) then --top to bottom
for i = instancia.barraS[1], instancia.barraS[2], 1 do --> vai atualizar s o range que esta sendo mostrado
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
elseif (instancia.bars_sort_direction == 2) then --bottom to top
for i = instancia.barraS[2], instancia.barraS[1], -1 do --> vai atualizar s o range que esta sendo mostrado
if (conteudo[i]) then
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
qual_barra = qual_barra+1
conteudo[i]:RefreshLine (instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
whichRowLine = whichRowLine+1
end
end
end
if (use_animations) then
instancia:fazer_animacoes (qual_barra-1)
instancia:PerformAnimations (whichRowLine-1)
end
if (instancia.atributo == 5) then --> custom
@@ -838,7 +838,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo
--> beta, hidar barras no usadas durante um refresh forado
if (forcar) then
if (instancia.modo == 2) then --> group
for i = qual_barra, instancia.rows_fit_in_window do
for i = whichRowLine, instancia.rows_fit_in_window do
gump:Fade (instancia.barras [i], "in", 0.3)
end
end
@@ -850,12 +850,12 @@ end
local actor_class_color_r, actor_class_color_g, actor_class_color_b
function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, is_dead, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
function atributo_misc:RefreshLine (instancia, barras_container, whichRowLine, lugar, total, sub_atributo, forcar, keyName, is_dead, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
local esta_barra = instancia.barras[qual_barra] --> pega a referncia da barra na janela
local esta_barra = instancia.barras[whichRowLine] --> pega a referncia da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
print ("DEBUG: problema com <instancia.esta_barra> "..whichRowLine.." "..lugar)
return
end
@@ -892,21 +892,25 @@ function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, l
local rightText = meu_total .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, meu_total, "", porcentagem, self, instancia.showing, instancia, rightText))
esta_barra.lineText4:SetText (_string_replace (instancia.row_info.textR_custom_text, meu_total, "", porcentagem, self, instancia.showing, instancia, rightText))
else
esta_barra.texto_direita:SetText (rightText)
if (instancia.use_multi_fontstrings) then
Details:SetTextsOnLine(esta_barra, "", meu_total, porcentagem)
else
esta_barra.lineText4:SetText(rightText)
end
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
gump:UpdateTooltip (qual_barra, esta_barra, instancia)
gump:UpdateTooltip (whichRowLine, esta_barra, instancia)
end
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container, use_animations)
return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container, use_animations)
end
function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container, use_animations)
function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container, use_animations)
--> primeiro colocado
if (esta_barra.colocacao == 1) then
@@ -989,7 +993,7 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize)
--> left text
self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText)
esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15)
esta_barra.lineText1:SetSize (esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15)
end
--------------------------------------------- // TOOLTIPS // ---------------------------------------------
@@ -2066,8 +2070,8 @@ function atributo_misc:MontaInfoInterrupt()
barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido...
end
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
barra.texto_direita:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita
barra.lineText1:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
barra.lineText4:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita
barra.icone:SetTexture (tabela[5])
@@ -2111,8 +2115,8 @@ function atributo_misc:MontaInfoInterrupt()
barra.textura:SetValue (tabela[2]/max_alvos*100)
end
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
barra.texto_direita:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2]/meu_total*100) .. instancia.divisores.fecha) --seta o texto da direita
barra.lineText1:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
barra.lineText4:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2]/meu_total*100) .. instancia.divisores.fecha) --seta o texto da direita
if (barra.mouse_over) then --> atualizar o tooltip
if (barra.isAlvo) then
@@ -2150,7 +2154,7 @@ function atributo_misc:MontaDetalhesInterrupt (spellid, barra)
local nome, _, icone = _GetSpellInfo (spellid)
local infospell = {nome, nil, icone}
_detalhes.janela_info.spell_icone:SetTexture (infospell[3])
_detalhes.playerDetailWindow.spell_icone:SetTexture (infospell[3])
local total = self.interrupt
local meu_total = esta_magia.counter
@@ -2186,8 +2190,8 @@ function atributo_misc:MontaDetalhesInterrupt (spellid, barra)
local nome, _, icone = _GetSpellInfo (tabela[1])
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..nome) --seta o texto da esqueda
barra.texto_direita:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2]/total*100) .."%".. instancia.divisores.fecha) --seta o texto da direita
barra.lineText1:SetText (index..instancia.divisores.colocacao..nome) --seta o texto da esqueda
barra.lineText4:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2]/total*100) .."%".. instancia.divisores.fecha) --seta o texto da direita
barra.icone:SetTexture (icone)
-51
View File
@@ -1,51 +0,0 @@
-- class target file
local _detalhes = _G._detalhes
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _setmetatable = setmetatable --lua local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function alvo_da_habilidade:NovaTabela (link)
local esta_tabela = {total = 0}
_setmetatable (esta_tabela, alvo_da_habilidade)
return esta_tabela
end
function alvo_da_habilidade:AddQuantidade (amt)
self.total = self.total + amt
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
_setmetatable (este_alvo, alvo_da_habilidade)
este_alvo.__index = alvo_da_habilidade
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable [este_alvo.nome]]
end
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
este_alvo.shadow = nil
--este_alvo.__index = {}
este_alvo.__index = nil
end
alvo_da_habilidade.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
if (tabela1.overheal) then
tabela1.overheal = tabela1.overheal - tabela2.overheal
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
end
end
@@ -1,7 +1,8 @@
-- actor container file
local _detalhes = _G._detalhes
local DF = DetailsFramework
local Details = _G.Details
local DF = _G.DetailsFramework
local _
local CONST_CLIENT_LANGUAGE = DF.ClientLanguage
@@ -535,7 +536,29 @@
novo_objeto.flag_original = flag
novo_objeto.serial = serial
--novo_objeto.grupo = true
--get the aID (actor id)
if (serial:match("^C")) then
novo_objeto.aID = tostring(Details:GetNpcIdFromGuid(serial))
if (Details.immersion_special_units) then
novo_objeto.grupo = Details.Immersion.IsNpcInteresting(novo_objeto.aID)
end
elseif (serial:match("^P")) then
novo_objeto.aID = serial:gsub("Player%-", "")
else
novo_objeto.aID = ""
end
--check ownership
if (dono_do_pet and Details.immersion_pets_on_solo_play) then
if (UnitIsUnit("player", dono_do_pet.nome)) then
if (not Details.in_group) then
novo_objeto.grupo = true
end
end
end
--> seta a classe default para desconhecido, assim nenhum objeto fica com classe nil
novo_objeto.classe = "UNKNOW"
+13 -28
View File
@@ -1,15 +1,14 @@
local _detalhes = _G._detalhes
local gump = _detalhes.gump
local container_pets = _detalhes.container_pets
-- api locals
local _UnitGUID = UnitGUID
local _UnitName = UnitName
local _GetUnitName = GetUnitName
local _IsInRaid = IsInRaid
local _IsInGroup = IsInGroup
local _GetNumGroupMembers = GetNumGroupMembers
local _UnitGUID = _G.UnitGUID
local _UnitName = _G.UnitName
local _GetUnitName = _G.GetUnitName
local _IsInRaid = _G.IsInRaid
local _IsInGroup = _G.IsInGroup
local _GetNumGroupMembers = _G.GetNumGroupMembers
-- lua locals
local _setmetatable = setmetatable
@@ -43,7 +42,6 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags)
--> buscar pelo pet no container de pets
local busca = self.pets [pet_serial]
if (busca) then
--in merging operations, make sure to not add the owner name a second time in the name
--check if the pet name already has the owner name in, if not, add it
@@ -55,7 +53,6 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags)
end
return pet_nome, busca[1], busca[2], busca[3] --> [1] dono nome [2] dono serial [3] dono flag
end
--> buscar pelo pet na raide
@@ -122,9 +119,6 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags)
is_ignored [pet_serial] = true
end
end
--> no pode encontrar o dono do pet, coloca-lo na ignore
return
end
@@ -220,19 +214,11 @@ function container_pets:Remover (pet_serial)
end
function container_pets:Adicionar (pet_serial, pet_nome, pet_flags, dono_serial, dono_nome, dono_flags)
if (pet_flags and _bit_band (pet_flags, OBJECT_TYPE_PET) ~= 0 and _bit_band (pet_flags, EM_GRUPO) ~= 0) then
self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, true, pet_nome, pet_serial}
--if (pet_nome == "Guardian of Ancient Kings") then --remover
-- print ("SUMMON", "Adicionou ao container")
--end
else
self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, false, pet_nome, pet_serial}
--if (pet_nome == "Guardian of Ancient Kings") then --remover
-- print ("SUMMON", "Adicionou ao container")
--end
end
end
function _detalhes:WipePets()
@@ -240,17 +226,15 @@ function _detalhes:WipePets()
end
function _detalhes:LimparPets()
--> elimina pets antigos
local _new_PetTable = {}
--> erase old pet table by creating a new one
local newPetTable = {}
--> minimum of 90 minutes to clean a pet from the pet table data
for PetSerial, PetTable in _pairs (_detalhes.tabela_pets.pets) do
if ( (PetTable[4] + 5400 > _detalhes._tempo + 1) or (PetTable[5] and PetTable[4] + 43200 > _detalhes._tempo) ) then
_new_PetTable [PetSerial] = PetTable
newPetTable [PetSerial] = PetTable
end
end
--a tabela antiga ser descartada pelo garbage collector.
--_table_wipe (_detalhes.tabela_pets.pets)
_detalhes.tabela_pets.pets = _new_PetTable
_detalhes.tabela_pets.pets = newPetTable
_detalhes:UpdateContainerCombatentes()
end
@@ -265,11 +249,12 @@ function _detalhes:SchedulePetUpdate (seconds)
return
end
have_schedule = true
_detalhes:ScheduleTimer ("UpdatePets", seconds or 5)
--_detalhes:ScheduleTimer ("UpdatePets", seconds or 5)
Details.Schedules.NewTimer(seconds or 5, Details.UpdatePets, Details)
end
function _detalhes.refresh:r_container_pets (container)
_setmetatable (container, container_pets)
--container.__index = container_pets
end
@@ -138,7 +138,7 @@ function historico:adicionar_overall (tabela)
if (instance:IsEnabled()) then
if (instance:GetSegment() == -1) then
instance:ForceRefresh()
--instance:AtualizaGumpPrincipal (true)
--instance:RefreshMainWindow (true)
--print ("isntance", id, "overall updated.")
end
end
@@ -408,7 +408,7 @@ function _detalhes:CheckFreeze (instancia, index_liberado, tabela)
end
end
function _detalhes:OverallOptions (reset_new_boss, reset_new_challenge, reset_on_logoff)
function _detalhes:SetOverallResetOptions (reset_new_boss, reset_new_challenge, reset_on_logoff)
if (reset_new_boss == nil) then
reset_new_boss = _detalhes.overall_clear_newboss
end
@@ -544,7 +544,7 @@ function historico:resetar()
_detalhes:InstanciaCallFunction (_detalhes.ResetaGump) --_detalhes:ResetaGump ("de todas as instancias")
_detalhes:InstanciaCallFunction (gump.Fade, "in", nil, "barras")
_detalhes:AtualizaGumpPrincipal (-1) --atualiza todas as instancias
_detalhes:RefreshMainWindow (-1) --atualiza todas as instancias
_detalhes:SendEvent ("DETAILS_DATA_RESET", nil, nil)
-312
View File
@@ -1,312 +0,0 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> attributes functions for customs
--> DAMAGEDONE
--> customized display script
local _detalhes = _G._detalhes
local _
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _cstr = string.format --lua local
local _math_floor = math.floor --lua local
local _table_sort = table.sort --lua local
local _table_insert = table.insert --lua local
local _table_size = table.getn --lua local
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
local _rawget= rawget --lua local
local _math_min = math.min --lua local
local _math_max = math.max --lua local
local _bit_band = bit.band --lua local
local _unpack = unpack --lua local
local _type = type --lua local
local _GetSpellInfo = _detalhes.getspellinfo -- api local
local _IsInRaid = IsInRaid -- api local
local _IsInGroup = IsInGroup -- api local
local _GetNumGroupMembers = GetNumGroupMembers -- api local
local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local
local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local
local _GetUnitName = GetUnitName -- api local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local atributo_custom = _detalhes.atributo_custom
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
function atributo_custom:UpdateDamageDoneBracket()
SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation]
TooltipMaximizedMethod = _detalhes.tooltip.maximize_method
end
local temp_table = {}
local target_func = function (main_table)
local i = 1
for name, amount in _pairs (main_table) do
local t = temp_table [i]
if (not t) then
t = {"", 0}
temp_table [i] = t
end
t[1] = name
t[2] = amount
i = i + 1
end
end
local spells_used_func = function (main_table, target)
local i = 1
for spellid, spell_table in _pairs (main_table) do
local target_amount = spell_table.targets [target]
if (target_amount) then
local t = temp_table [i]
if (not t) then
t = {"", 0}
temp_table [i] = t
end
t[1] = spellid
t[2] = target_amount
i = i + 1
end
end
end
local function SortOrder (main_table, func, ...)
for i = 1, #temp_table do
temp_table [i][1] = ""
temp_table [i][2] = 0
end
func (main_table, ...)
_table_sort (temp_table, _detalhes.Sort2)
return temp_table
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> damagedone tooltip
function atributo_custom:damagedoneTooltip (actor, target, spellid, combat, instance)
if (spellid) then
if (instance:GetCustomObject():IsSpellTarget()) then
local targetname = actor.nome
local this_actor = combat (1, targetname)
if (this_actor) then
for name, _ in _pairs (this_actor.damage_from) do
local aggressor = combat (1, name)
if (aggressor) then
local spell = aggressor.spells._ActorTable [spellid]
if (spell) then
local on_me = spell.targets [targetname]
if (on_me) then
GameCooltip:AddLine (aggressor.nome, FormatTooltipNumber (_, on_me))
_detalhes:AddTooltipBackgroundStatusbar()
end
end
end
end
end
return
else
local name, _, icon = _GetSpellInfo (spellid)
GameCooltip:AddLine (name)
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
GameCooltip:AddLine (Loc ["STRING_DAMAGE"] .. ": ", spell.total)
GameCooltip:AddLine (Loc ["STRING_HITS"] .. ": ", spell.counter)
GameCooltip:AddLine (Loc ["STRING_CRITICAL_HITS"] .. ": ", spell.c_amt)
end
elseif (target) then
if (target == "[all]") then
SortOrder (actor.targets, target_func)
for i = 1, #temp_table do
local t = temp_table [i]
if (t[2] < 1) then
break
end
GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2]))
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14)
end
elseif (target == "[raid]") then
local roster = combat.raid_roster
SortOrder (actor.targets, target_func)
for i = 1, #temp_table do
local t = temp_table [i]
if (t[2] < 1) then
break
end
if (roster [t[1]]) then
GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2]))
_detalhes:AddTooltipBackgroundStatusbar()
end
end
elseif (target == "[player]") then
local target_amount = actor.targets [_detalhes.playername]
if (target_amount) then
GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, target_amount))
_detalhes:AddTooltipBackgroundStatusbar()
end
else
SortOrder (actor.spells._ActorTable, spells_used_func, target)
for i = 1, #temp_table do
local t = temp_table [i]
if (t[2] < 1) then
break
end
local name, _, icon = _GetSpellInfo (t[1])
GameCooltip:AddLine (name, FormatTooltipNumber (_, t[2]))
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
end
--for index, pet_name in ipairs (actor.pets) do
--end
end
else
actor:ToolTip_DamageDone (instance)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> damagedone search
function atributo_custom:damagedone (actor, source, target, spellid, combat, instance_container)
if (spellid) then --> spell is always damagedone
local spell = actor.spells._ActorTable [spellid]
if (spell) then
if (target) then
if (target == "[all]") then
for target_name, amount in _pairs (spell.targets) do
--> add amount
--> we need to pass a object here in order to get name and class, so we just get the main damage actor from the combat
instance_container:AddValue (combat (1, target_name), amount, true)
--
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [target_name]) then
atributo_custom._TargetActorsProcessed [target_name] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
elseif (target == "[raid]") then
local roster = combat.raid_roster
for target_name, amount in _pairs (spell.targets) do
if (roster [target_name]) then
--> add amount
instance_container:AddValue (combat (1, target_name), amount, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [target_name]) then
atributo_custom._TargetActorsProcessed [target_name] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
end
return 0, true
elseif (target == "[player]") then
local target_amount = spell.targets [_detalhes.playername]
if (target_amount) then
--> add amount
instance_container:AddValue (combat (1, _detalhes.playername), target_amount, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [_detalhes.playername]) then
atributo_custom._TargetActorsProcessed [_detalhes.playername] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
else
local target_amount = actor.targets [target]
if (target_amount) then
--> add amount
instance_container:AddValue (combat (1, target), target_amount, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [target]) then
atributo_custom._TargetActorsProcessed [target] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
end
else
return spell.total
end
else
return 0
end
elseif (target) then
if (target == "[all]") then
local total = 0
for target_name, amount in _pairs (actor.targets) do
total = total + amount
end
return total
elseif (target == "[raid]") then
local total = 0
for target_name, amount in _pairs (actor.targets) do
if (combat.raid_roster [target_name]) then
total = total + amount
end
end
return total
elseif (target == "[player]") then
return actor.targets [_detalhes.playername] or 0
else
return actor.targets [target] or 0
end
else
return actor.total or 0
end
end
-251
View File
@@ -1,251 +0,0 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> attributes functions for customs
--> DAMAGE TAKEN
--> customized display script
local _detalhes = _G._detalhes
local _
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _cstr = string.format --lua local
local _math_floor = math.floor --lua local
local _table_sort = table.sort --lua local
local _table_insert = table.insert --lua local
local _table_size = table.getn --lua local
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
local _rawget= rawget --lua local
local _math_min = math.min --lua local
local _math_max = math.max --lua local
local _bit_band = bit.band --lua local
local _unpack = unpack --lua local
local _type = type --lua local
local _GetSpellInfo = _detalhes.getspellinfo -- api local
local _IsInRaid = IsInRaid -- api local
local _IsInGroup = IsInGroup -- api local
local _GetNumGroupMembers = GetNumGroupMembers -- api local
local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local
local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local
local _GetUnitName = GetUnitName -- api local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local atributo_custom = _detalhes.atributo_custom
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
function atributo_custom:UpdateDamageTakenBracket()
SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation]
TooltipMaximizedMethod = _detalhes.tooltip.maximize_method
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> damage done tooltip
function atributo_custom:damagetakenTooltip (actor, target, spellid, combat, instance)
if (spellid) then
if (instance:GetCustomObject():IsSpellTarget()) then
local targetname = actor.nome
local this_actor = combat (1, targetname)
if (this_actor) then
for name, _ in _pairs (this_actor.damage_from) do
local aggressor = combat (1, name)
if (aggressor) then
local spell = aggressor.spell_tables._ActorTable [spellid]
if (spell) then
local on_me = spell.targets._NameIndexTable [targetname]
if (on_me) then
on_me = spell.targets._ActorTable [on_me]
GameCooltip:AddLine (aggressor.nome, FormatTooltipNumber (_, on_me.total))
end
end
end
end
end
return
else
local name, _, icon = _GetSpellInfo (spellid)
GameCooltip:AddLine (name)
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
GameCooltip:AddLine (Loc ["STRING_DAMAGE"] .. ": ", spell.total)
GameCooltip:AddLine (Loc ["STRING_HITS"] .. ": ", spell.counter)
GameCooltip:AddLine (Loc ["STRING_CRITICAL_HITS"] .. ": ", spell.c_amt)
end
elseif (target) then
if (target == "[all]") then
actor.targets:SortByKey ("total")
for _, target_object in _ipairs (actor.targets._ActorTable) do
GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total))
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14)
end
elseif (target == "[raid]") then
local roster = combat.raid_roster
actor.targets:SortByKey ("total")
for _, target_object in _ipairs (actor.targets._ActorTable) do
if (roster [target_object.nome]) then
GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total))
end
end
elseif (target == "[player]") then
local targetactor = actor.targets._NameIndexTable [_detalhes.playername]
if (targetactor) then
targetactor = actor.targets._ActorTable [targetactor]
GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, targetactor.total))
end
else
local spells_used = {}
for spellid, spelltable in _pairs (actor.spell_tables._ActorTable) do
local this_target = spelltable.targets._NameIndexTable [target]
if (this_target) then
this_target = spelltable.targets._ActorTable [this_target]
_table_insert (spells_used, {spellid, this_target.total})
end
end
_table_sort (spells_used, _detalhes.Sort2)
for index, spell in _ipairs (spells_used) do
local name, _, icon = _GetSpellInfo (spell [1])
GameCooltip:AddLine (name, FormatTooltipNumber (_, spell [2]))
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
end
--local targetactor = actor.targets._NameIndexTable [target]
--if (targetactor) then
-- targetactor = actor.targets._ActorTable [targetactor]
-- GameCooltip:AddLine (target, FormatTooltipNumber (_, targetactor.total))
--end
end
else
actor:ToolTip_DamageDone (instance)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> damage done search
function atributo_custom:damagetaken (actor, source, target, spellid, combat, instance_container)
if (spellid) then --> spell is always damage done
local spell = actor.spell_tables._ActorTable [spellid]
if (spell) then
if (target) then
if (target == "[all]") then
for _, targetactor in _ipairs (spell.targets._ActorTable) do
--> add amount
instance_container:AddValue (targetactor, targetactor.total, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then
atributo_custom._TargetActorsProcessed [targetactor.nome] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
elseif (target == "[raid]") then
local roster = combat.raid_roster
for _, targetactor in _ipairs (spell.targets._ActorTable) do
if (roster [targetactor.nome]) then
--> add amount
instance_container:AddValue (targetactor, targetactor.total, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then
atributo_custom._TargetActorsProcessed [targetactor.nome] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
end
return 0, true
elseif (target == "[player]") then
local targetactor = spell.targets._NameIndexTable [_detalhes.playername]
if (targetactor) then
targetactor = spell.targets._ActorTable [targetactor]
--> add amount
instance_container:AddValue (targetactor, targetactor.total, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then
atributo_custom._TargetActorsProcessed [targetactor.nome] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
else
local targetactor = actor.targets._NameIndexTable [target]
if (targetactor) then
targetactor = spell.targets._ActorTable [targetactor]
--> add amount
instance_container:AddValue (targetactor, targetactor.total, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then
atributo_custom._TargetActorsProcessed [targetactor.nome] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
end
else
return spell.total
end
else
return 0
end
elseif (target) then
if (target == "[all]") then
return actor.targets:GetTotal()
elseif (target == "[raid]") then
return actor.targets:GetTotalOnRaid (nil, combat)
elseif (target == "[player]") then
local targetactor = actor.targets._NameIndexTable [_detalhes.playername]
if (targetactor) then
return actor.targets._ActorTable [targetactor].total
else
return 0
end
else
--> custom target
local targetactor = actor.targets._NameIndexTable [target]
if (targetactor) then
return actor.targets._ActorTable [targetactor].total
else
return 0
end
end
else
return actor.damage_taken or 0
end
end
+18
View File
@@ -0,0 +1,18 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> attributes functions for customs
--> DAMAGEDONE
--> customized display script
local _detalhes = _G._detalhes
local _
local atributo_custom = _detalhes.atributo_custom
local ToKFunctions = _detalhes.ToKFunctions
function atributo_custom:UpdateDamageDoneBracket()
SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation]
TooltipMaximizedMethod = _detalhes.tooltip.maximize_method
end
-307
View File
@@ -1,307 +0,0 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> attributes functions for customs
--> HEALING DONE
--> customized display script
local _detalhes = _G._detalhes
local _
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _cstr = string.format --lua local
local _math_floor = math.floor --lua local
local _table_sort = table.sort --lua local
local _table_insert = table.insert --lua local
local _table_size = table.getn --lua local
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
local _rawget= rawget --lua local
local _math_min = math.min --lua local
local _math_max = math.max --lua local
local _bit_band = bit.band --lua local
local _unpack = unpack --lua local
local _type = type --lua local
local _GetSpellInfo = _detalhes.getspellinfo -- api local
local _IsInRaid = IsInRaid -- api local
local _IsInGroup = IsInGroup -- api local
local _GetNumGroupMembers = GetNumGroupMembers -- api local
local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local
local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local
local _GetUnitName = GetUnitName -- api local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local atributo_custom = _detalhes.atributo_custom
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
function atributo_custom:UpdateHealingDoneBracket()
SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation]
TooltipMaximizedMethod = _detalhes.tooltip.maximize_method
end
local temp_table = {}
local target_func = function (main_table)
local i = 1
for name, amount in _pairs (main_table) do
local t = temp_table [i]
if (not t) then
t = {"", 0}
temp_table [i] = t
end
t[1] = name
t[2] = amount
i = i + 1
end
end
local spells_used_func = function (main_table, target)
local i = 1
for spellid, spell_table in _pairs (main_table) do
local target_amount = spell_table.targets [target]
if (target_amount) then
local t = temp_table [i]
if (not t) then
t = {"", 0}
temp_table [i] = t
end
t[1] = spellid
t[2] = target_amount
i = i + 1
end
end
end
local function SortOrder (main_table, func, ...)
for i = 1, #temp_table do
temp_table [i][1] = ""
temp_table [i][2] = 0
end
func (main_table, ...)
_table_sort (temp_table, _detalhes.Sort2)
return temp_table
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> healing done tooltip
function atributo_custom:healdoneTooltip (actor, target, spellid, combat, instance)
if (spellid) then
if (instance:GetCustomObject():IsSpellTarget()) then
local targetname = actor.nome
local this_actor = combat (2, targetname)
if (this_actor) then
for name, _ in _pairs (this_actor.healing_from) do
local healer = combat (2, name)
if (healer) then
local spell = healer.spells._ActorTable [spellid]
if (spell) then
local on_me = spell.targets [targetname]
if (on_me) then
GameCooltip:AddLine (healer.nome, FormatTooltipNumber (_, on_me))
end
end
end
end
end
return
else
local name, _, icon = _GetSpellInfo (spellid)
GameCooltip:AddLine (name)
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
GameCooltip:AddLine (Loc ["STRING_HEAL"] .. ": ", spell.total)
GameCooltip:AddLine (Loc ["STRING_HITS"] .. ": ", spell.counter)
GameCooltip:AddLine (Loc ["STRING_CRITICAL_HITS"] .. ": ", spell.c_amt)
end
elseif (target) then
if (target == "[all]") then
SortOrder (actor.targets, target_func)
for i = 1, #temp_table do
local t = temp_table [i]
if (t[2] < 1) then
break
end
GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2]))
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14)
end
elseif (target == "[raid]") then
local roster = combat.raid_roster
SortOrder (actor.targets, target_func)
for i = 1, #temp_table do
local t = temp_table [i]
if (t[2] < 1) then
break
end
if (roster [t[1]]) then
GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2]))
end
end
elseif (target == "[player]") then
local target_amount = actor.targets [_detalhes.playername]
if (target_amount) then
GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, target_amount))
end
else
SortOrder (actor.spells._ActorTable, spells_used_func, target)
for i = 1, #temp_table do
local t = temp_table [i]
if (t[2] < 1) then
break
end
local name, _, icon = _GetSpellInfo (t[1])
GameCooltip:AddLine (name, FormatTooltipNumber (_, t[2]))
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
end
end
else
actor:ToolTip_HealingDone (instance)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> healing done search
function atributo_custom:healdone (actor, source, target, spellid, combat, instance_container)
if (spellid) then --> spell is always healing done
local spell = actor.spells._ActorTable [spellid]
local melee = actor.spells._ActorTable [1]
if (spell) then
if (target) then
if (target == "[all]") then
for target_name, amount in _pairs (spell.targets) do
--> add amount
--> we need to pass a object here in order to get name and class, so we just get the main heal actor from the combat
instance_container:AddValue (combat (1, target_name), amount, true)
--
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [target_name]) then
atributo_custom._TargetActorsProcessed [target_name] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
elseif (target == "[raid]") then
local roster = combat.raid_roster
for target_name, amount in _pairs (spell.targets) do
if (roster [target_name]) then
--> add amount
instance_container:AddValue (combat (1, target_name), amount, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [target_name]) then
atributo_custom._TargetActorsProcessed [target_name] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
end
return 0, true
elseif (target == "[player]") then
local target_amount = spell.targets [_detalhes.playername]
if (target_amount) then
--> add amount
instance_container:AddValue (combat (1, _detalhes.playername), target_amount, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [_detalhes.playername]) then
atributo_custom._TargetActorsProcessed [_detalhes.playername] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
else
local target_amount = actor.targets [target]
if (target_amount) then
--> add amount
instance_container:AddValue (combat (1, target), target_amount, true)
atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount
--> add to processed container
if (not atributo_custom._TargetActorsProcessed [target]) then
atributo_custom._TargetActorsProcessed [target] = true
atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1
end
end
return 0, true
end
else
return spell.total
end
else
return 0
end
elseif (target) then
if (target == "[all]") then
local total = 0
for target_name, amount in _pairs (actor.targets) do
total = total + amount
end
return total
elseif (target == "[raid]") then
local total = 0
for target_name, amount in _pairs (actor.targets) do
if (combat.raid_roster [target_name]) then
total = total + amount
end
end
return total
elseif (target == "[player]") then
return actor.targets [_detalhes.playername] or 0
else
return actor.targets [targetactor] or 0
end
else
return actor.total or 0
end
end
+11
View File
@@ -0,0 +1,11 @@
local _detalhes = _G._detalhes
local _
local atributo_custom = _detalhes.atributo_custom
local ToKFunctions = _detalhes.ToKFunctions
function atributo_custom:UpdateHealingDoneBracket()
SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation]
TooltipMaximizedMethod = _detalhes.tooltip.maximize_method
end
@@ -130,6 +130,8 @@ _detalhes.instance_defaults = {
statusbar_info = {alpha = 1, overlay = {1, 1, 1}},
--hide main window attribute icon
hide_icon = false,
--attribute icon is desaturated
icon_desaturated = false,
--anchor side of main window toolbar (1 = top 2 = bottom)
toolbar_side = 1,
--micro displays side
@@ -152,6 +154,7 @@ _detalhes.instance_defaults = {
--anchor store the anchor point of main menu
menu_anchor = {5, 1, side = 1}, --mode segment attribute report on top position
menu_anchor_down = {5, 1}, --mode segment attribute report on bottom position
menu_icons_alpha = 0.5,
--blackwhiite icons
desaturated_menu = false, --mode segment attribute report
--icons on menu
@@ -171,7 +174,7 @@ _detalhes.instance_defaults = {
shadow = false,
enable_custom_text = false,
custom_text = "{name}",
show_timer = {true, true, true}, --raid encounter, battleground, arena
show_timer = true,
},
--auto hide window borders statusbar main menu
menu_alpha = {enabled = false, iconstoo = true, onenter = 1, onleave = 1, ignorebars = false},
@@ -181,6 +184,14 @@ _detalhes.instance_defaults = {
total_bar = {enabled = false, color = {1, 1, 1}, only_in_group = true, icon = [[Interface\ICONS\INV_Sigil_Thorim]]},
--row animation when show
row_show_animation = {anim = "Fade", options = {}},
--use one fontstring for each value in the lines, e.g. one fontstring to damage done, another fontstring to dps and another to percent amount
use_multi_fontstrings = false,
fontstrings_width = 35, --not in use
fontstrings_text4_anchor = 0,
fontstrings_text3_anchor = 35,
fontstrings_text2_anchor = 70,
--row info
row_info = {
--if true the texture of the bars will have the color of his actor class
@@ -253,7 +264,7 @@ _detalhes.instance_defaults = {
--percent type
percent_type = 1,
--backdrop
backdrop = {enabled = false, size = 12, color = {1, 1, 1, 1}, texture = "Details BarBorder 2"},
backdrop = {enabled = false, size = 12, color = {1, 1, 1, 1}, texture = "Details BarBorder 2"}, --texture is deprecated
--model
models = {
upper_enabled = false,
+579 -563
View File
File diff suppressed because it is too large Load Diff
+189 -52
View File
@@ -19,7 +19,7 @@ if (DetailsFramework.IsClassicWow()) then
LibGroupInSpecT = false
end
local storageDebug = false
local storageDebug = true --remember to turn this to false!
local store_instances = _detalhes.InstancesToStoreData
function _detalhes:UpdateGears()
@@ -250,12 +250,6 @@ end
window2:SaveMainWindowPosition()
-- /dump ChatFrame3Background:GetSize()
--[[
_detalhes.move_janela_func (window1.baseframe, true, window1)
_detalhes.move_janela_func (window1.baseframe, false, window1)
_detalhes.move_janela_func (window2.baseframe, true, window2)
_detalhes.move_janela_func (window2.baseframe, false, window2)
--]]
end
end
end
@@ -494,9 +488,11 @@ function _detalhes:RefreshUpdater (suggested_interval)
end
if (_detalhes.atualizador) then
_detalhes:CancelTimer (_detalhes.atualizador)
--_detalhes:CancelTimer(_detalhes.atualizador)
Details.Schedules.Cancel(_detalhes.atualizador)
end
_detalhes.atualizador = _detalhes:ScheduleRepeatingTimer ("AtualizaGumpPrincipal", updateInterval, -1)
--_detalhes.atualizador = _detalhes:ScheduleRepeatingTimer("RefreshMainWindow", updateInterval, -1)
_detalhes.atualizador = Details.Schedules.NewTicker(updateInterval, Details.RefreshMainWindow, Details, -1)
end
function _detalhes:SetWindowUpdateSpeed(interval, nosave)
@@ -921,6 +917,7 @@ function _detalhes.storage:GetBestFromPlayer (diff, encounter_id, role, playerna
local db = _detalhes.storage:OpenRaidStorage()
if (not db) then
print("DB noot found on GetBestFromPlayer()")
return
end
@@ -1456,7 +1453,53 @@ function _detalhes.OpenStorage()
end
end
function _detalhes:StoreEncounter (combat)
Details.Database = {}
function Details.Database.LoadDB()
--check if the storage is already loaded
if (not IsAddOnLoaded("Details_DataStorage")) then
local loaded, reason = LoadAddOn("Details_DataStorage")
if (not loaded) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
end
--> get the storage table
local db = _G.DetailsDataStorage
if (not db and _detalhes.CreateStorageDB) then
db = _detalhes:CreateStorageDB()
if (not db) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
elseif (not db) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
return db
end
function Details.Database.GetBossKillsDB(db)
--total kills in a boss on raid or dungeon
local totalkills_database = db["totalkills"]
if (not totalkills_database) then
db["totalkills"] = {}
totalkills_database = db["totalkills"]
end
return totalkills_database
end
function Details.Database.StoreWipe(combat)
combat = combat or _detalhes.tabela_vigente
@@ -1488,16 +1531,147 @@ function _detalhes:StoreEncounter (combat)
return
end
--get the difficulty
local diff = combat:GetDifficulty()
--database
local db = Details.Database.LoadDB()
local diff_storage = db [diff]
if (not diff_storage) then
db [diff] = {}
diff_storage = db [diff]
end
local encounter_database = diff_storage [encounter_id]
if (not encounter_database) then
diff_storage [encounter_id] = {}
encounter_database = diff_storage [encounter_id]
end
--total kills in a boss on raid or dungeon
local totalkills_database = Details.Database.GetBossKillsDB(db)
if (IsInRaid()) then
totalkills_database[encounter_id] = totalkills_database[encounter_id] or {}
totalkills_database[encounter_id][diff] = totalkills_database[encounter_id][diff] or {kills = 0, wipes = 0, time_fasterkill = 0, time_fasterkill_when = 0, time_incombat = 0, dps_best = 0, dps_best_when = 0, dps_best_raid = 0, dps_best_raid_when = 0}
local bossData = totalkills_database[encounter_id][diff]
--wipes amount
bossData.wipes = bossData.wipes + 1
Details:Msg("Wipe stored, you have now " .. bossData.wipes .. " wipes on this boss.")
end
end
function Details.Database.StoreEncounter(combat)
--note: this only runs on boss kill
combat = combat or _detalhes.tabela_vigente
if (not combat) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: combat not found.")
end
return
end
local name, type, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo()
local bossCLEUID = combat.boss_info and combat.boss_info.id
if (not store_instances [mapID] and not _detalhes.EncountersToStoreData [bossCLEUID]) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: instance not allowed.")
end
return
end
local boss_info = combat:GetBossInfo()
local encounter_id = boss_info and boss_info.id
if (not encounter_id) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: encounter ID not found.")
end
return
end
--get the difficulty
local diff = combat:GetDifficulty()
--database
local db = Details.Database.LoadDB()
local diff_storage = db [diff]
if (not diff_storage) then
db [diff] = {}
diff_storage = db [diff]
end
local encounter_database = diff_storage [encounter_id]
if (not encounter_database) then
diff_storage [encounter_id] = {}
encounter_database = diff_storage [encounter_id]
end
--total kills in a boss on raid or dungeon
local totalkills_database = Details.Database.GetBossKillsDB(db)
--> store total kills on this boss
--if the player is facing a raid boss
if (IsInRaid()) then
totalkills_database[encounter_id] = totalkills_database[encounter_id] or {}
totalkills_database[encounter_id][diff] = totalkills_database[encounter_id][diff] or {kills = 0, wipes = 0, time_fasterkill = 0, time_fasterkill_when = 0, time_incombat = 0, dps_best = 0, dps_best_when = 0, dps_best_raid = 0, dps_best_raid_when = 0}
local bossData = totalkills_database[encounter_id][diff]
local encounterElapsedTime = combat:GetCombatTime()
--kills amount
bossData.kills = bossData.kills + 1
--best time
if (encounterElapsedTime > bossData.time_fasterkill) then
bossData.time_fasterkill = encounterElapsedTime
bossData.time_fasterkill_when = time()
end
--total time in combat
bossData.time_incombat = bossData.time_incombat + encounterElapsedTime
--player best dps
local player = combat(DETAILS_ATTRIBUTE_DAMAGE, UnitName("player"))
if (player) then
local playerDps = player.total / encounterElapsedTime
if (playerDps > bossData.dps_best) then
bossData.dps_best = playerDps
bossData.dps_best_when = time()
end
end
--raid best dps
local raidTotalDamage = combat:GetTotal(DETAILS_ATTRIBUTE_DAMAGE, false, true)
local raidDps = raidTotalDamage / encounterElapsedTime
if (raidDps > bossData.dps_best_raid) then
bossData.dps_best_raid = raidDps
bossData.dps_best_raid_when = time()
end
end
--> check for heroic and mythic
if (storageDebug or (diff == 15 or diff == 16)) then --test on raid finder ' or diff == 17' -- normal mode: diff == 14 or
if (storageDebug or (diff == 15 or diff == 16 or diff == 17)) then --test on raid finder: ' or diff == 17' -- normal mode: diff == 14 or
--> check the guild name
local match = 0
local guildName = select (1, GetGuildInfo ("player"))
local raid_size = GetNumGroupMembers() or 0
if (not storageDebug) then
if (guildName) then
for i = 1, raid_size do
local gName = select (1, GetGuildInfo ("raid" .. i)) or ""
@@ -1518,46 +1692,8 @@ function _detalhes:StoreEncounter (combat)
end
return
end
--> check if the storage is already loaded
if (not IsAddOnLoaded ("Details_DataStorage")) then
local loaded, reason = LoadAddOn ("Details_DataStorage")
if (not loaded) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
end
--> get the storage table
local db = DetailsDataStorage
if (not db and _detalhes.CreateStorageDB) then
db = _detalhes:CreateStorageDB()
if (not db) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
elseif (not db) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
local diff_storage = db [diff]
if (not diff_storage) then
db [diff] = {}
diff_storage = db [diff]
end
local encounter_database = diff_storage [encounter_id]
if (not encounter_database) then
diff_storage [encounter_id] = {}
encounter_database = diff_storage [encounter_id]
else
guildName = "Test Guild"
end
local this_combat_data = {
@@ -1619,7 +1755,8 @@ function _detalhes:StoreEncounter (combat)
local myrole = UnitGroupRolesAssigned ("player")
local mybest, onencounter = _detalhes.storage:GetBestFromPlayer (diff, encounter_id, myrole, _detalhes.playername, true) --> get dps or hps
local myBestDps = mybest [1] / onencounter.elapsed
local mybest2 = mybest[1] or 0
local myBestDps = mybest2 / onencounter.elapsed
if (mybest) then
local d_one = 0
+2 -2
View File
@@ -737,7 +737,7 @@
instancia.showing[instancia.atributo].need_refresh = true
instancia.v_barras = true
instancia:ResetaGump()
instancia:AtualizaGumpPrincipal (true)
instancia:RefreshMainWindow (true)
end
end
@@ -988,7 +988,7 @@
if (limpados > 0) then
_detalhes:InstanciaCallFunction (_detalhes.ScheduleUpdate)
_detalhes:AtualizaGumpPrincipal (-1)
_detalhes:RefreshMainWindow (-1)
end
return limpados
-190
View File
@@ -595,15 +595,6 @@
--]]
function _detalhes:SendPluginCommMessage(prefix, channel, ...)
if (not _detalhes:IsConnected()) then
return false
end
if (not channel) then
channel = "Details"
end
if (channel == "RAID") then
if (IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
_detalhes:SendCommMessage (prefix, _detalhes:Serialize (self.__version, ...), "INSTANCE_CHAT")
@@ -617,15 +608,6 @@
else
_detalhes:SendCommMessage(prefix, _detalhes:Serialize (self.__version, ...), "PARTY")
end
elseif (channel == "Details") then
local id = _detalhes:GetChannelId (channel)
if (id) then
if (not _detalhes.listener:IsEventRegistered ("CHAT_MSG_CHANNEL")) then
_detalhes.listener:RegisterEvent ("CHAT_MSG_CHANNEL")
end
SendChatMessage (prefix .. "_" .. _detalhes:Serialize (self.__version, ...), "CHANNEL", nil, id)
end
else
_detalhes:SendCommMessage(prefix, _detalhes:Serialize (self.__version, ...), channel)
end
@@ -633,7 +615,6 @@
return true
end
--> send as
function _detalhes:SendRaidDataAs(type, player, realm, ...)
if (not realm) then
@@ -761,174 +742,3 @@
_detalhes:SendGuildData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> sharer
local city_zones = {
["ShattrathCity"] = true,
["Dalaran"] = true,
["AshranHordeFactionHub"] = true,
["AshranAllianceFactionHub"] = true,
["Orgrimmar"] = true,
["Undercity"] = true,
["ThunderBluff"] = true,
["SilvermoonCity"] = true,
["StormwindCity"] = true,
["Darnassus"] = true,
["Ironforge"] = true,
["TheExodar"] = true,
["garrisonffhorde_tier1"] = true,
["garrisonffhorde_tier2"] = true,
["garrisonffhorde_tier3"] = true,
["garrisonsmvalliance_tier1"] = true,
["garrisonsmvalliance_tier2"] = true,
["garrisonsmvalliance_tier3"] = true,
["garrisonsmvalliance_tier4"] = true,
}
local sub_zones = {
["ShrineofTwoMoons"] = true,
["ShrineofSevenStars"] = true,
}
function _detalhes:IsInCity()
if (SetMapToCurrentZone and SetMapToCurrentZone()) then
local mapID = C_Map.GetBestMapForUnit ("player")
if (not mapID) then
--print ("Details! exeption handled: zone has no map")
return
end
local mapFileName, _, _, _, microDungeonMapName = C_Map.GetMapInfo (mapID)
if (city_zones [mapFileName]) then
return true
elseif (microDungeonMapName and type (microDungeonMapName) == "string" and sub_zones [microDungeonMapName]) then
return true
end
end
end
--> entrar no canal aps logar no servidor
function _detalhes:EnterChatChannel()
if (not _detalhes.realm_sync or not CONST_REALM_SYNC_ENABLED) then
return
end
if (not _detalhes:IsInCity()) then
return
end
if (_detalhes.schedule_chat_leave) then
_detalhes:CancelTimer (_detalhes.schedule_chat_leave)
_detalhes.schedule_chat_leave = nil
end
_detalhes.schedule_chat_enter = nil
local realm = GetRealmName()
realm = realm or ""
--> room name
local room_name = "Details"
_detalhes.listener:RegisterEvent ("CHAT_MSG_CHANNEL")
--> already in?
for room_index = 1, 10 do
local _, name = GetChannelName (room_index)
if (name == room_name) then
_detalhes.is_connected = true
return --> already in the room
end
end
--> enter
JoinChannelByName (room_name)
_detalhes.is_connected = true
_detalhes:SendEvent ("REALM_CHANNEL_ENTER")
end
function _detalhes:LeaveChatChannel()
if (not _detalhes.realm_sync or not CONST_REALM_SYNC_ENABLED) then
return
end
if (_detalhes.schedule_chat_enter) then
_detalhes:CancelTimer (_detalhes.schedule_chat_enter)
_detalhes.schedule_chat_enter = nil
end
_detalhes.schedule_chat_leave = nil
local realm = GetRealmName()
realm = realm or ""
--> room name
local room_name = "Details"
local is_in = false
--> already in?
for room_index = 1, 10 do
local _, name = GetChannelName (room_index)
if (name == room_name) then
is_in = true
end
end
if (is_in) then
LeaveChannelByName (room_name)
end
_detalhes.is_connected = false
_detalhes.listener:UnregisterEvent ("CHAT_MSG_CHANNEL")
_detalhes:SendEvent ("REALM_CHANNEL_LEAVE")
end
function _detalhes:DoZoneCheck()
local in_city = _detalhes:IsInCity()
if (not in_city) then
if (_detalhes.schedule_chat_enter) then
_detalhes:CancelTimer (_detalhes.schedule_chat_enter)
end
if (not _detalhes.schedule_chat_leave) then
_detalhes.schedule_chat_leave = _detalhes:ScheduleTimer ("LeaveChatChannel", 5)
end
else
if (in_city) then
local _, name = GetChannelName (2)
if (name) then
if (_detalhes.schedule_chat_leave) then
_detalhes:CancelTimer (_detalhes.schedule_chat_leave)
end
if (not _detalhes.schedule_chat_enter) then
_detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 5)
end
end
end
end
end
function _detalhes:CheckChatOnZoneChange()
if (not _detalhes.realm_sync or not CONST_REALM_SYNC_ENABLED) then
return
end
_detalhes:ScheduleTimer ("DoZoneCheck", 2)
end
function _detalhes:IsConnected()
if (not _detalhes.is_connected) then
local id = _detalhes:GetChannelId ("Details")
if (id) then
_detalhes.is_connected = true
end
end
return _detalhes.is_connected
end
+102 -79
View File
@@ -122,6 +122,7 @@
[216890] = true, --warrior spell reflection (pvp talent)
[213915] = true, --warrior mass spell reflection
[212295] = true, --warlock nether ward
--check pally legendary
}
local reflection_dispelid = {
--> some dispels also reflect, and we can track them
@@ -222,8 +223,7 @@
[32175] = 17364, -- shaman Stormstrike (from Turkar on github)
[32176] = 17364, -- shaman Stormstrike
[271685] = 281686, --Heed my Call
[45284] = 188196, --shaman lightining bolt overloaded
}
@@ -554,73 +554,7 @@
--rules of specific encounters
if (_current_encounter_id == 2273) then --Uu'nat --REMOVE ON 9.0 LAUNCH
if (spellname == SPELLANAME_STORM_OF_ANNIHILATION or spellid == 284601) then
--return --this is parsed as friendly fire
end
elseif (_current_encounter_id == 2263 or _current_encounter_id == 2284) then --grong --REMOVE ON 9.0 LAUNCH
if (spellid == 285660 or spellname == SPELLNAME_GRONG_CORE or spellid == 286435 or spellname == SPELLNAME_GRONG_CORE_ALLIANCE) then
return
end
elseif (_current_encounter_id == 2272) then --king rastakhan --REMOVE ON 9.0 LAUNCH
if (alvo_serial) then
local npcid = _select (6, _strsplit ("-", alvo_serial))
if (npcid == "145644") then --Bwonsamdi
--Bwonsamdi has two buffs: unliving and aura of death, checking the two first buff indexes
local hasUnlivingBuff1 = _UnitBuff ("boss2", 1)
local hasUnlivingBuff2 = _UnitBuff ("boss2", 2)
if (hasUnlivingBuff1 == SPELLNAME_UNLIVING or hasUnlivingBuff2 == SPELLNAME_UNLIVING) then
--> ignore the damage while Bwonsamdi is immune
return
end
end
end
elseif (_current_encounter_id == 2087) then --Yazma - Atal'Dazar --REMOVE ON 9.0 LAUNCH
--rename the add created by the soulrend ability
if (alvo_serial) then
local npcid = _select (6, _strsplit ("-", alvo_serial))
if (npcid == "125828") then --soulrend add
alvo_name = "Soulrend Add"
end
end
if (who_serial) then --which exp was this?
local npcid = _select (6, _strsplit ("-", who_serial))
if (npcid == "125828") then --soulrend add
who_name = "Soulrend Add"
end
end
elseif (_current_encounter_id == 2122 or _current_encounter_id == 2135) then --g'huun and mythrax --REMOVE ON 9.0 LAUNCH
--if (alvo_serial:match ("^Creature%-0%-%d+%-%d+%-%d+%-103679%-%w+$")) then --soul effigy (warlock) --50% more slow than the method below
--check if the target is the amorphous cyst
--for some reason, mythrax fights has some sort of damage on amorphous cyst as well, dunno why
if (alvo_serial) then
local npcid = _select (6, _strsplit ("-", alvo_serial)) -- cost 3 / 1000000
if (npcid) then
if (ignored_npc_ids [npcid]) then
--print ("IGNORED:", alvo_name, npcid)
return
end
if (_track_ghuun_bloodshield and npcid == "132998") then
local hasBloodShield = _UnitBuff ("boss1", 1)
if (not hasBloodShield or hasBloodShield ~= SPELLNAME_BLOODSHIELD) then
--print ("Details Shuting down damage filter on ghuun", hasBloodShield)
_track_ghuun_bloodshield = nil
else
--print ("Details Ghuun Has Blood Shield Damage Ignored", hasBloodShield)
return
end
end
end
end
end
--> if the parser are allowed to replace spellIDs
if (is_using_spellId_override) then
@@ -766,6 +700,12 @@
who_name = who_name .. " <" .. meu_dono.nome .. ">"
end
if (not este_jogador) then
print ("no ente_jogador")
print (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amount)
return
end
--> his target
local jogador_alvo, alvo_dono = damage_cache [alvo_serial] or damage_cache_pets [alvo_serial] or damage_cache [alvo_name], damage_cache_petsOwners [alvo_serial]
@@ -3482,13 +3422,39 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (not este_jogador) then
este_jogador = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true)
end
--[[
Message: Interface\AddOns\Details\core\parser.lua:3418: attempt to index local 'este_jogador' (a nil value)
Time: Sun Aug 30 15:43:58 2020
Count: 39
Stack: Interface\AddOns\Details\core\parser.lua:3418: attempt to index local 'este_jogador' (a nil value)
[string "@Interface\AddOns\Details\core\parser.lua"]:3418: in function <Interface\AddOns\Details\core\parser.lua:3335>
[string "=(tail call)"]: ?
Locals: self = nil
token = "SPELL_CAST_SUCCESS"
time = 1598813037.261000
who_serial = "Vehicle-0-2085-2296-4034-168406-000B4BF36E"
who_name = "Waltzing Venthyr"
who_flags = 2632
alvo_serial = ""
alvo_name = nil
alvo_flags = -2147483648
alvo_flags2 = -2147483648
spellid = 335773
spellname = "Waltzing Venthyr"
spelltype = 1
--]]
if (este_jogador) then
--> actor spells table
local spell = este_jogador.spells._ActorTable [spellid]
local spell = este_jogador.spells._ActorTable [spellid] --line where the actor was nil
if (not spell) then
spell = este_jogador.spells:PegaHabilidade (spellid, true, token)
end
spell.successful_casted = spell.successful_casted + 1
end
end
return
end
end
@@ -3790,11 +3756,59 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
------------------------------------------------------------------------------------------------
--> build dead
--print("dead", alvo_flags, _bit_band (alvo_flags, 0x00000008) ~= 0, _current_encounter_id)
if (_in_combat and alvo_flags and _bit_band (alvo_flags, 0x00000008) ~= 0) then -- and _in_combat --byte 1 = 8 (AFFILIATION_OUTSIDER)
--> outsider death while in combat
--rules for specific encounters
if (_current_encounter_id == 2412) then --> The Council of Blood
if (not Details.exp90temp.delete_damage_TCOB) then
return
end
--what boss died
local bossDeadNpcId = Details:GetNpcIdFromGuid(alvo_serial)
print("Details: boss died:", bossDeadNpcId, alvo_name, alvo_serial)
if (bossDeadNpcId ~= 166969 and bossDeadNpcId ~= 166970 and bossDeadNpcId ~= 166971) then
return
end
--[[
local unitId_BaronessFrieda = alvo_serial:match("166969%-%w+$")
local unitId_LordStavros = alvo_serial:match("166970%-%w+$")
local unitId_CastellanNiklaus = alvo_serial:match("166971%-%w+$")
--]]
if (bossDeadNpcId) then
--iterate among boss targets
for i = 1, 5 do
local unitId = "boss" .. i
if (_G.UnitExists(unitId)) then
local bossHealth = _G.UnitHealth(unitId)
local bossName = _G.UnitName(unitId)
local bossSerial = _G.UnitGUID(unitId)
if (bossHealth and bossHealth > 100000) then
if (bossSerial) then
local bossNpcId = Details:GetNpcIdFromGuid(bossSerial)
if (bossNpcId and bossNpcId ~= bossDeadNpcId) then
print("Details: deleting boss:", bossName)
--remove the damage done
local currentCombat = Details:GetCurrentCombat()
currentCombat:DeleteActor(DETAILS_ATTRIBUTE_DAMAGE, bossName, false)
end
end
end
end
end
end
end
--> frags
if (_detalhes.only_pvp_frags and (_bit_band (alvo_flags, 0x00000400) == 0 or (_bit_band (alvo_flags, 0x00000040) == 0 and _bit_band (alvo_flags, 0x00000020) == 0))) then --byte 2 = 4 (HOSTILE) byte 3 = 4 (OBJECT_TYPE_PLAYER)
@@ -4400,8 +4414,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.time_type = _detalhes.time_type_original
_detalhes:CheckChatOnZoneChange (zoneType)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) zone change:", _detalhes.zone_name, "is a", _detalhes.zone_type, "zone.")
end
@@ -4642,7 +4654,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if ((_detalhes.tabela_vigente:GetEndTime() or 0) + 2 >= _detalhes.encounter_table ["end"]) then
_detalhes.tabela_vigente:SetStartTime (_detalhes.encounter_table ["start"])
_detalhes.tabela_vigente:SetEndTime (_detalhes.encounter_table ["end"])
_detalhes:AtualizaGumpPrincipal (-1, true)
_detalhes:RefreshMainWindow (-1, true)
end
end
@@ -4743,15 +4755,24 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--store a boss encounter when out of combat since it might need to load the storage
if (_detalhes.schedule_store_boss_encounter) then
if (not _detalhes.logoff_saving_data) then
--_detalhes.StoreEncounter()
local successful, errortext = pcall (_detalhes.StoreEncounter)
local successful, errortext = pcall (Details.Database.StoreEncounter)
if (not successful) then
_detalhes:Msg ("error occurred on StoreEncounter():", errortext)
_detalhes:Msg ("error occurred on Details.Database.StoreEncounter():", errortext)
end
end
_detalhes.schedule_store_boss_encounter = nil
end
if (Details.schedule_store_boss_encounter_wipe) then
if (not _detalhes.logoff_saving_data) then
local successful, errortext = pcall (Details.Database.StoreWipe)
if (not successful) then
_detalhes:Msg ("error occurred on Details.Database.StoreWipe():", errortext)
end
end
Details.schedule_store_boss_encounter_wipe = nil
end
--when a large amount of data has been removed and the player is in combat, schedule to run the hard garbage collector (the blizzard one, not the details! internal)
if (_detalhes.schedule_hard_garbage_collect) then
if (_detalhes.debug) then
@@ -5167,7 +5188,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes:LoadConfig()
_detalhes:UpdateParserGears()
--_detalhes:Start()
--load auto run code
Details:StartAutoRun()
end
function _detalhes.parser_functions:ADDON_LOADED (...)
@@ -5180,7 +5203,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local playerLogin = CreateFrame ("frame")
playerLogin:RegisterEvent("PLAYER_LOGIN")
playerLogin:SetScript("OnEvent", function()
Details:Start()
Details:StartMeUp()
end)
function _detalhes.parser_functions:PET_BATTLE_OPENING_START (...)
@@ -5296,7 +5319,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--> end
-- ~parserstart ~startparser
-- ~parserstart ~startparser ~cleu
function _detalhes.OnParserEvent()
-- 8.0 changed
+8 -8
View File
@@ -283,7 +283,7 @@
PluginOptions = PluginOptions or 0x0
local NewPlugin = {__options = PluginOptions, __enabled = true, RegisterEvent = register_event_func, UnregisterEvent = unregister_event_func}
local Frame = CreateFrame ("Frame", FrameName, UIParent)
local Frame = CreateFrame ("Frame", FrameName, UIParent,"BackdropTemplate")
Frame:RegisterEvent ("PLAYER_LOGIN")
Frame:RegisterEvent ("PLAYER_LOGOUT")
@@ -333,7 +333,7 @@
template = template or 1
if (template == 2) then
local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate")
local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate,BackdropTemplate")
tinsert (UISpecialFrames, name)
options_frame:SetSize (500, 200)
@@ -371,7 +371,7 @@
elseif (template == 1) then
local options_frame = CreateFrame ("frame", name, UIParent)
local options_frame = CreateFrame ("frame", name, UIParent,"BackdropTemplate")
tinsert (UISpecialFrames, name)
options_frame:SetSize (500, 200)
@@ -422,7 +422,7 @@
function _detalhes:CreatePluginWindowContainer()
local f = CreateFrame ("frame", "DetailsPluginContainerWindow", UIParent)
local f = CreateFrame ("frame", "DetailsPluginContainerWindow", UIParent,"BackdropTemplate")
f:EnableMouse (true)
f:SetMovable (true)
f:SetPoint ("center", UIParent, "center")
@@ -454,11 +454,11 @@
LibWindow.SavePosition (f)
--> menu background
local menuBackground = CreateFrame ("frame", "$parentMenuFrame", f)
local menuBackground = CreateFrame ("frame", "$parentMenuFrame", f,"BackdropTemplate")
_detalhes:FormatBackground (menuBackground)
--> statusbar
local statusBar = CreateFrame ("frame", nil, menuBackground)
local statusBar = CreateFrame ("frame", nil, menuBackground,"BackdropTemplate")
statusBar:SetPoint ("topleft", menuBackground, "bottomleft", 0, 1)
statusBar:SetPoint ("topright", f, "bottomright", 0, 1)
statusBar:SetHeight (20)
@@ -488,7 +488,7 @@
--
--> plugins menu title bar
local titlebar_plugins = CreateFrame ("frame", nil, menuBackground)
local titlebar_plugins = CreateFrame ("frame", nil, menuBackground,"BackdropTemplate")
PixelUtil.SetPoint (titlebar_plugins, "topleft", menuBackground, "topleft", 2, -3)
PixelUtil.SetPoint (titlebar_plugins, "topright", menuBackground, "topright", -2, -3)
titlebar_plugins:SetHeight (f.TitleHeight)
@@ -501,7 +501,7 @@
PixelUtil.SetPoint (titleLabel, "top", titlebar_plugins , "top", 0, -5)
--> plugins menu title bar
local titlebar_tools = CreateFrame ("frame", nil, menuBackground)
local titlebar_tools = CreateFrame ("frame", nil, menuBackground,"BackdropTemplate")
titlebar_tools:SetHeight (f.TitleHeight)
titlebar_tools:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
titlebar_tools:SetBackdropColor (.5, .5, .5, 1)
+9 -9
View File
@@ -72,7 +72,7 @@
instance:EsconderScrollBar (true) --> hida a scrollbar
end
_detalhes:ResetaGump (instance)
instance:AtualizaGumpPrincipal (true)
instance:RefreshMainWindow (true)
--> get the plugin name
@@ -241,14 +241,14 @@
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
--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
+1 -1
View File
@@ -177,7 +177,7 @@
if (self.rows_created < self.rows_fit_in_window) then
for i = #self.barras+1, self.rows_fit_in_window do
local nova_barra = gump:CriaNovaBarra (self, i, 30) --> cria nova barra
nova_barra.texto_esquerdo:SetText (Loc ["STRING_NEWROW"])
nova_barra.lineText1:SetText (Loc ["STRING_NEWROW"])
nova_barra.statusbar:SetValue (100)
self.barras [i] = nova_barra
end
+18 -57
View File
@@ -72,34 +72,21 @@
return nil
end
function _detalhes.StatusBar:AlignPluginText (child, default)
local side = child.options.textAlign
if (child.options.textAlign == 0) then
side = default
end
child.text:ClearAllPoints()
if (side == 1) then
child.text:SetPoint ("left", child.frame, "left", child.options.textXMod, child.options.textYMod)
elseif (side == 2) then
child.text:SetPoint ("center", child.frame, "center", child.options.textXMod, child.options.textYMod)
elseif (side == 3) then
child.text:SetPoint ("right", child.frame, "right", child.options.textXMod, child.options.textYMod)
end
end
--> functions to set the three statusbar places: left, center and right
function _detalhes.StatusBar:SetCenterPlugin (instance, childObject, fromStartup)
childObject.frame:Show()
childObject.frame:ClearAllPoints()
childObject.options.textAlign = 2
if (instance.micro_displays_side == 2) then --> default - bottom
childObject.frame:SetPoint ("center", instance.baseframe.rodape.StatusBarCenterAnchor, "center")
elseif (instance.micro_displays_side == 1) then --> top side
childObject.frame:SetPoint ("center", instance.baseframe.cabecalho.StatusBarCenterAnchor, "center")
end
_detalhes.StatusBar:AlignPluginText (childObject, 2)
childObject.text:ClearAllPoints()
childObject.text:SetPoint ("center", childObject.frame, "center", childObject.options.textXMod, childObject.options.textYMod)
instance.StatusBar.center = childObject
childObject.anchor = "center"
@@ -127,13 +114,16 @@
childObject.frame:Show()
childObject.frame:ClearAllPoints()
childObject.options.textAlign = 1
if (instance.micro_displays_side == 2) then --> default - bottom
childObject.frame:SetPoint ("left", instance.baseframe.rodape.StatusBarLeftAnchor, "left")
elseif (instance.micro_displays_side == 1) then --> top side
childObject.frame:SetPoint ("left", instance.baseframe.cabecalho.StatusBarLeftAnchor, "left")
end
_detalhes.StatusBar:AlignPluginText (childObject, 1)
childObject.text:ClearAllPoints()
childObject.text:SetPoint ("left", childObject.frame, "left", childObject.options.textXMod, childObject.options.textYMod)
instance.StatusBar.left = childObject
childObject.anchor = "left"
@@ -156,13 +146,16 @@
childObject.frame:Show()
childObject.frame:ClearAllPoints()
childObject.options.textAlign = 3
if (instance.micro_displays_side == 2) then --> default - bottom
childObject.frame:SetPoint ("right", instance.baseframe.rodape.direita, "right", -20, 10)
elseif (instance.micro_displays_side == 1) then --> top side
childObject.frame:SetPoint ("right", instance.baseframe.cabecalho.StatusBarRightAnchor, "right")
end
_detalhes.StatusBar:AlignPluginText (childObject, 3)
childObject.text:ClearAllPoints()
childObject.text:SetPoint ("right", childObject.frame, "right", childObject.options.textXMod, childObject.options.textYMod)
instance.StatusBar.right = childObject
childObject.anchor = "right"
@@ -573,7 +566,7 @@
value = child.options.textSize
end
child.options.textSize = value
child.options.textSize = value or 9
child:SetFontSize (child.text, child.options.textSize)
elseif (option == "textface") then
@@ -1479,23 +1472,22 @@ window.close_with_right = true
window.child = nil
window.instance = nil
window:SetFrameStrata ("FULLSCREEN")
DetailsFramework:ApplyStandardBackdrop(window)
window:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize=12})
window:SetBackdropColor (0, 0, 0, 0.9)
--window:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize=12})
--window:SetBackdropColor (0, 0, 0, 0.9)
local extraWindow = _detalhes.gump:NewPanel (window, nil, "DetailsStatusBarOptions2", "extra", 300, 180)
extraWindow:SetPoint ("left", window, "right")
extraWindow.close_with_right = true
extraWindow.locked = false
extraWindow:Hide()
DetailsFramework:ApplyStandardBackdrop(extraWindow)
extraWindow:SetHook ("OnHide", function()
window:Hide()
end)
extraWindow:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize=12})
extraWindow:SetBackdropColor (0, 0, 0, 0.9)
--> text style
_detalhes.gump:NewLabel (window, _, "$parentTextStyleLabel", "textstyle", Loc ["STRING_PLUGINOPTIONS_TEXTSTYLE"])
window.textstyle:SetPoint (10, -15)
@@ -1579,34 +1571,6 @@ extraWindow:SetBackdropColor (0, 0, 0, 0.9)
_detalhes.StatusBar:ApplyOptions (window.instance.StatusBar.right, "textsize", amount)
end)
--> align
_detalhes.gump:NewLabel (window, _, "$parentTextAlignLabel", "textalign", Loc ["STRING_PLUGINOPTIONS_TEXTALIGN"])
window.textalign:SetPoint (10, -95)
--
_detalhes.gump:NewSlider (window, _, "$parentSliderAlign", "alignSlider", 180, 20, 0, 3, 1)
window.alignSlider:SetPoint ("left", window.textalign, "right")
window.alignSlider:SetThumbSize (75)
window.alignSlider:SetHook ("OnValueChange", function (self, child, side)
side = _math_floor (side)
child.options.textAlign = side
if (side == 0) then
window.alignSlider.amt:SetText (Loc ["STRING_AUTO"])
elseif (side == 1) then
window.alignSlider.amt:SetText (Loc ["STRING_LEFT"])
elseif (side == 2) then
window.alignSlider.amt:SetText (Loc ["STRING_CENTER"])
elseif (side == 3) then
window.alignSlider.amt:SetText (Loc ["STRING_RIGHT"])
end
_detalhes.StatusBar:ReloadAnchors (child.instance)
return true
end)
--> text font
local onSelectFont = function (_, child, fontName)
--_detalhes.StatusBar:ApplyOptions (child, "textface", fontName)
@@ -1666,16 +1630,13 @@ extraWindow:SetBackdropColor (0, 0, 0, 0.9)
window.child = child
window.instance = child.instance
_G.DetailsStatusBarOptionsTextStyleDropdown.MyObject:SetFixedParameter (child)
_G.DetailsStatusBarOptionsTextStyleDropdown.MyObject:Select (child.options.textStyle, true)
_G.DetailsStatusBarOptionsTextColorTexture:SetColorTexture (child.options.textColor[1], child.options.textColor[2], child.options.textColor[3], child.options.textColor[4])
_G.DetailsStatusBarOptionsSliderFontSize.MyObject:SetFixedParameter (child)
_G.DetailsStatusBarOptionsSliderFontSize.MyObject:SetValue (child.options.textSize)
_G.DetailsStatusBarOptionsSliderAlign.MyObject:SetFixedParameter (child)
_G.DetailsStatusBarOptionsSliderAlign.MyObject:SetValue (child.options.textAlign)
_G.DetailsStatusBarOptionsFontDropdown.MyObject:SetFixedParameter (child)
_G.DetailsStatusBarOptionsFontDropdown.MyObject:Select (child.options.textFace)
+14 -63
View File
@@ -457,60 +457,11 @@
_detalhes.atributo_energy:UpdateSelectedToKFunction()
_detalhes.atributo_misc:UpdateSelectedToKFunction()
_detalhes.atributo_custom:UpdateSelectedToKFunction()
_detalhes:AtualizaGumpPrincipal (-1, true)
Details:RefreshMainWindow(-1, true)
end
--------end of ToK functions----
--from weakauras, list of functions to block on scripts
--source https://github.com/WeakAuras/WeakAuras2/blob/520951a4b49b64cb49d88c1a8542d02bbcdbe412/WeakAuras/AuraEnvironment.lua#L66
local blockedFunctions = {
-- Lua functions that may allow breaking out of the environment
getfenv = true,
getfenv = true,
loadstring = true,
pcall = true,
xpcall = true,
getglobal = true,
-- blocked WoW API
SendMail = true,
SetTradeMoney = true,
AddTradeMoney = true,
PickupTradeMoney = true,
PickupPlayerMoney = true,
TradeFrame = true,
MailFrame = true,
EnumerateFrames = true,
RunScript = true,
AcceptTrade = true,
SetSendMailMoney = true,
EditMacro = true,
SlashCmdList = true,
DevTools_DumpCommand = true,
hash_SlashCmdList = true,
CreateMacro = true,
SetBindingMacro = true,
GuildDisband = true,
GuildUninvite = true,
securecall = true,
--additional
setmetatable = true,
}
local functionFilter = setmetatable ({}, {__index = function (env, key)
if (key == "_G") then
return env
elseif (blockedFunctions [key]) then
return nil
else
return _G [key]
end
end})
--> replacing data for custom texts
_detalhes.string = {}
@@ -530,7 +481,7 @@
_detalhes:Msg ("|cFFFF9900error compiling script on custom text|r: ", errortext)
return 0
end
setfenv (func, functionFilter)
DetailsFramework:SetEnvironment(func)
function_cache [str] = func
end
@@ -1372,32 +1323,32 @@ end
function _detalhes:name_space (barra)
--if (barra.icone_secundario_ativo) then
-- local tamanho = barra:GetWidth()-barra.texto_direita:GetStringWidth()-16-barra:GetHeight()
-- barra.texto_esquerdo:SetSize (tamanho-2, 15)
-- local tamanho = barra:GetWidth()-barra.lineText4:GetStringWidth()-16-barra:GetHeight()
-- barra.lineText1:SetSize (tamanho-2, 15)
--else
barra.texto_esquerdo:SetSize (barra:GetWidth()-barra.texto_direita:GetStringWidth()-18, 15)
barra.lineText1:SetSize (barra:GetWidth()-barra.lineText4:GetStringWidth()-18, 15)
--end
end
function _detalhes:name_space_info (barra)
if (barra.icone_secundario_ativo) then
local tamanho = barra:GetWidth()-barra.texto_direita:GetStringWidth()-16-barra:GetHeight()
barra.texto_esquerdo:SetSize (tamanho-10, 15)
local tamanho = barra:GetWidth()-barra.lineText4:GetStringWidth()-16-barra:GetHeight()
barra.lineText1:SetSize (tamanho-10, 15)
else
local tamanho = barra:GetWidth()-barra.texto_direita:GetStringWidth()-16
barra.texto_esquerdo:SetSize (tamanho-10, 15)
local tamanho = barra:GetWidth()-barra.lineText4:GetStringWidth()-16
barra.lineText1:SetSize (tamanho-10, 15)
end
end
function _detalhes:name_space_generic (barra, separador)
local texto_direita_tamanho = barra.texto_direita:GetStringWidth()
local texto_direita_tamanho = barra.lineText4:GetStringWidth()
local tamanho = barra:GetWidth()-texto_direita_tamanho-16
if (separador) then
barra.texto_esquerdo:SetSize (tamanho+separador, 10)
barra.texto_direita:SetSize (texto_direita_tamanho+15, 10)
barra.lineText1:SetSize (tamanho+separador, 10)
barra.lineText4:SetSize (texto_direita_tamanho+15, 10)
else
barra.texto_esquerdo:SetSize (tamanho-10, 15)
barra.texto_direita:SetSize (texto_direita_tamanho+5, 15)
barra.lineText1:SetSize (tamanho-10, 15)
barra.lineText4:SetSize (texto_direita_tamanho+5, 15)
end
end

Some files were not shown because too many files have changed in this diff Show More