mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
big commit
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
## Interface: 11200
|
||||
## Title: !Compatibility
|
||||
## Notes: Compatibility functions for Vanilla
|
||||
## Version: 1.0
|
||||
## Version: 1.1
|
||||
|
||||
errorHandler.lua
|
||||
api\api.xml
|
||||
debugTools.lua
|
||||
slashCommands.lua
|
||||
@@ -1,4 +1,5 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="wowLua.lua"/>
|
||||
<Script file="luaAPI.lua"/>
|
||||
<Include file="..\libs\libs.xml"/>
|
||||
<Script file="wowAPI.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,201 @@
|
||||
-- Cache global variables
|
||||
local assert = assert
|
||||
local error = error
|
||||
local geterrorhandler = geterrorhandler
|
||||
local pairs = pairs
|
||||
local pcall = pcall
|
||||
local tostring = tostring
|
||||
local type = type
|
||||
local unpack = unpack
|
||||
local ceil, floor = math.ceil, math.floor
|
||||
local find, format, gsub, sub = string.find, string.format, string.gsub, string.sub
|
||||
local getn, insert = table.getn, table.insert
|
||||
|
||||
math.huge = 1/0
|
||||
string.gmatch = string.gfind
|
||||
|
||||
function difftime(time2, time1)
|
||||
assert(type(time2) == "number", format("bad argument #1 to 'difftime' (number expected, got %s)", time2 and type(time2) or "no value"))
|
||||
assert(not time1 or type(time1) == "number", format("bad argument #2 to 'difftime' (number expected, got %s)", time1 and type(time1) or "no value"))
|
||||
|
||||
return time1 and time2 - time1 or time2
|
||||
end
|
||||
|
||||
function select(n, ...)
|
||||
assert(type(n) == "number" or type(n) == "string", format("bad argument #1 to 'select' (number expected, got %s)", n and type(n) or "no value"))
|
||||
|
||||
if type(n) == "string" and n == "#" then
|
||||
if type(arg) == "table" then
|
||||
return getn(arg)
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
local temp = {}
|
||||
|
||||
for i = n, getn(arg) do
|
||||
insert(temp, arg[i])
|
||||
end
|
||||
|
||||
return unpack(temp)
|
||||
end
|
||||
|
||||
function math.modf(i)
|
||||
assert(type(i) == "number", format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value"))
|
||||
|
||||
local int = i >= 0 and floor(i) or ceil(i)
|
||||
|
||||
return int, i - int
|
||||
end
|
||||
|
||||
function string.join(delimiter, ...)
|
||||
assert(type(delimiter) == "string" or type(delimiter) == "number", format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"))
|
||||
|
||||
local size = getn(arg)
|
||||
if size == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
local text = arg[1]
|
||||
for i = 2, size do
|
||||
text = text..delimiter..arg[i]
|
||||
end
|
||||
|
||||
return text
|
||||
end
|
||||
strjoin = string.join
|
||||
|
||||
function string.match(str, pattern, index)
|
||||
assert(type(str) == "string" or type(str) == "number", format("bad argument #1 to 'match' (string expected, got %s)", str and type(str) or "no value"))
|
||||
assert(type(pattern) == "string", format("bad argument #2 to 'match' (string expected, got %s)", pattern and type(pattern) or "no value"))
|
||||
|
||||
str = type(str) == "number" and tostring(str) or str
|
||||
local _, _, match = find(index and sub(str, index) or str, "("..pattern..")")
|
||||
|
||||
return match
|
||||
end
|
||||
strmatch = string.match
|
||||
|
||||
function string.split(delimiter, str)
|
||||
assert(type(delimiter) == "string" or type(str) == "number", format("bad argument #1 to 'split' (string expected, got %s)", delimiter and type(delimiter) or "no value"))
|
||||
assert(type(str) == "string", format("bad argument #2 to 'split' (string expected, got %s)", str and type(str) or "no value"))
|
||||
|
||||
local fields = {}
|
||||
local pattern = format("([^%s]+)", delimiter)
|
||||
|
||||
str = type(str) == "number" and tostring(str) or str
|
||||
gsub(str, pattern, function(c) fields[getn(fields) + 1] = c end)
|
||||
|
||||
return unpack(fields)
|
||||
end
|
||||
strsplit = string.split
|
||||
|
||||
function string.trim(str, chars)
|
||||
assert(type(str) == "string" or type(str) == "number", format("bad argument #1 to 'trim' (string expected, got %s)", delimiter and type(delimiter) or "no value"))
|
||||
|
||||
str = type(str) == "number" and tostring(str) or str
|
||||
--[[
|
||||
if chars then
|
||||
local size = string.len(chars)
|
||||
local token = ""
|
||||
|
||||
for i = 1, size do
|
||||
token = token .. string.sub(chars, i, i + 1) .. "*"
|
||||
|
||||
if size > 1 and i < size then
|
||||
token = token.."|"
|
||||
end
|
||||
end
|
||||
|
||||
token = "["..token.."]"
|
||||
|
||||
local trimed = 1
|
||||
while trimed == 1 do
|
||||
str, trimed = string.gsub(str, "^"..token.."(._)"..token.."$", "")
|
||||
end
|
||||
else
|
||||
-- remove leading/trailing [space][tab][return][newline]
|
||||
str = string.gsub(str, "^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
|
||||
return str
|
||||
]]
|
||||
|
||||
return string.gsub(str, "^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
strtrim = string.trim
|
||||
|
||||
function table.wipe(t)
|
||||
assert(type(t) == "table", format("bad argument #1 to 'wipe' (table expected, got %s)", t and type(t) or "no value"))
|
||||
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
|
||||
return t
|
||||
end
|
||||
wipe = table.wipe
|
||||
|
||||
local LOCAL_ToStringAllTemp = {}
|
||||
function tostringall(...)
|
||||
local n = getn(arg)
|
||||
-- Simple versions for common argument counts
|
||||
if (n == 1) then
|
||||
return tostring(arg[1])
|
||||
elseif (n == 2) then
|
||||
return tostring(arg[1]), tostring(arg[2])
|
||||
elseif (n == 3) then
|
||||
return tostring(arg[1]), tostring(arg[2]), tostring(arg[3])
|
||||
elseif (n == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
local needfix
|
||||
for i = 1, n do
|
||||
local v = arg[i]
|
||||
if (type(v) ~= "string") then
|
||||
needfix = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if (not needfix) then return unpack(arg) end
|
||||
|
||||
wipe(LOCAL_ToStringAllTemp)
|
||||
for i = 1, needfix - 1 do
|
||||
LOCAL_ToStringAllTemp[i] = arg[i]
|
||||
end
|
||||
for i = needfix, n do
|
||||
LOCAL_ToStringAllTemp[i] = tostring(arg[i])
|
||||
end
|
||||
return unpack(LOCAL_ToStringAllTemp)
|
||||
end
|
||||
|
||||
local LOCAL_PrintHandler = function(...)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(strjoin(" ", tostringall(unpack(arg))))
|
||||
end
|
||||
|
||||
function setprinthandler(func)
|
||||
if (type(func) ~= "function") then
|
||||
error("Invalid print handler")
|
||||
else
|
||||
LOCAL_PrintHandler = func
|
||||
end
|
||||
end
|
||||
|
||||
function getprinthandler() return LOCAL_PrintHandler end
|
||||
|
||||
local function print_inner(...)
|
||||
local ok, err = pcall(LOCAL_PrintHandler, unpack(arg))
|
||||
if (not ok) then
|
||||
local func = geterrorhandler()
|
||||
func(err)
|
||||
end
|
||||
end
|
||||
|
||||
function print(...)
|
||||
pcall(print_inner, unpack(arg))
|
||||
end
|
||||
|
||||
SLASH_PRINT1 = "/print"
|
||||
SlashCmdList["PRINT"] = print
|
||||
@@ -1,39 +1,134 @@
|
||||
--Cache global variables
|
||||
local _G = getfenv()
|
||||
-- Cache global variables
|
||||
local _G = _G
|
||||
local assert = assert
|
||||
local error = error
|
||||
local date = date
|
||||
local pairs = pairs
|
||||
local tonumber = tonumber
|
||||
local type = type
|
||||
local unpack = unpack
|
||||
local date = date
|
||||
local gsub = string.gsub
|
||||
local format, gsub, lower, match, upper = string.format, string.gsub, string.lower, string.match, string.upper
|
||||
local getn = table.getn
|
||||
-- WoW API
|
||||
local GetQuestGreenRange = GetQuestGreenRange
|
||||
local GetRealZoneText = GetRealZoneText
|
||||
local IsInInstance = IsInInstance
|
||||
local UnitBuff = UnitBuff
|
||||
local UnitDebuff = UnitDebuff
|
||||
local UnitLevel = UnitLevel
|
||||
-- WoW Variables
|
||||
local DUNGEON_DIFFICULTY1 = DUNGEON_DIFFICULTY1
|
||||
local TIMEMANAGER_AM = gsub(TIME_TWELVEHOURAM, "^.-(%w+)$", "%1")
|
||||
local TIMEMANAGER_PM = gsub(TIME_TWELVEHOURPM, "^.-(%w+)$", "%1")
|
||||
-- Libs
|
||||
local LBC = LibStub("LibBabble-Class-3.0"):GetLookupTable()
|
||||
local LBZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
|
||||
|
||||
function hooksecurefunc(arg1, arg2, arg3)
|
||||
if type(arg1) == "string" then
|
||||
arg1, arg2, arg3 = _G, arg1, arg2
|
||||
end
|
||||
CLASS_SORT_ORDER = {
|
||||
"WARRIOR",
|
||||
"PALADIN",
|
||||
"PRIEST",
|
||||
"SHAMAN",
|
||||
"DRUID",
|
||||
"ROGUE",
|
||||
"MAGE",
|
||||
"WARLOCK",
|
||||
"HUNTER"
|
||||
}
|
||||
MAX_CLASSES = getn(CLASS_SORT_ORDER)
|
||||
|
||||
local orig = arg1[arg2]
|
||||
if type(orig) ~= "function" then
|
||||
error("The function "..arg2.." does not exist", 2)
|
||||
end
|
||||
LOCALIZED_CLASS_NAMES_MALE = {}
|
||||
LOCALIZED_CLASS_NAMES_FEMALE = {}
|
||||
|
||||
arg1[arg2] = function(...)
|
||||
local tmp = {orig(unpack(arg))}
|
||||
arg3(unpack(arg))
|
||||
return unpack(tmp)
|
||||
CLASS_ICON_TCOORDS = {
|
||||
["WARRIOR"] = {0, 0.25, 0, 0.25},
|
||||
["MAGE"] = {0.25, 0.49609375, 0, 0.25},
|
||||
["ROGUE"] = {0.49609375, 0.7421875, 0, 0.25},
|
||||
["DRUID"] = {0.7421875, 0.98828125, 0, 0.25},
|
||||
["HUNTER"] = {0, 0.25, 0.25, 0.5},
|
||||
["SHAMAN"] = {0.25, 0.49609375, 0.25, 0.5},
|
||||
["PRIEST"] = {0.49609375, 0.7421875, 0.25, 0.5},
|
||||
["WARLOCK"] = {0.7421875, 0.98828125, 0.25, 0.5},
|
||||
["PALADIN"] = {0, 0.25, 0.5, 0.75}
|
||||
}
|
||||
|
||||
QuestDifficultyColors = {
|
||||
["impossible"] = {r = 1.00, g = 0.10, b = 0.10},
|
||||
["verydifficult"] = {r = 1.00, g = 0.50, b = 0.25},
|
||||
["difficult"] = {r = 1.00, g = 1.00, b = 0.00},
|
||||
["standard"] = {r = 0.25, g = 0.75, b = 0.25},
|
||||
["trivial"] = {r = 0.50, g = 0.50, b = 0.50},
|
||||
["header"] = {r = 0.70, g = 0.70, b = 0.70}
|
||||
}
|
||||
|
||||
function HookScript(frame, scriptType, handler)
|
||||
assert(type(frame) == "table" and frame.GetScript and type(scriptType) == "string" and type(handler) == "function", "Usage: HookScript(frame, \"type\", function)")
|
||||
|
||||
local original_scipt = frame:GetScript(scriptType)
|
||||
if original_scipt then
|
||||
frame:SetScript(scriptType, function(...)
|
||||
local original_return = {original_scipt(unpack(arg))}
|
||||
handler(unpack(arg))
|
||||
|
||||
return unpack(original_return)
|
||||
end)
|
||||
else
|
||||
frame:SetScript(scriptType, handler)
|
||||
end
|
||||
end
|
||||
|
||||
local function noop() end
|
||||
function HookScript(frame, method, func)
|
||||
assert(frame, "HookScript: frame argument missing")
|
||||
function hooksecurefunc(arg1, arg2, arg3)
|
||||
local isMethod = type(arg1) == "table" and type(arg2) == "string" and type(arg1[arg2]) == "function" and type(arg3) == "function"
|
||||
assert(isMethod or (type(arg1) == "string" and type(_G[arg1]) == "function" and type(arg2) == "function"), "Usage: hooksecurefunc([table,] \"functionName\", hookfunc)")
|
||||
|
||||
local orig = frame:GetScript(method) or noop
|
||||
frame:SetScript(method, function(...)
|
||||
local tmp = {orig(unpack(arg))}
|
||||
func(unpack(arg))
|
||||
return unpack(tmp)
|
||||
end)
|
||||
if not isMethod then
|
||||
arg1, arg2, arg3 = _G, arg1, arg2
|
||||
end
|
||||
|
||||
local original_func = arg1[arg2]
|
||||
|
||||
arg1[arg2] = function(...)
|
||||
local original_return = {original_func(unpack(arg))}
|
||||
arg3(unpack(arg))
|
||||
|
||||
return unpack(original_return)
|
||||
end
|
||||
end
|
||||
|
||||
--[[ issecurevariable
|
||||
Returns 1, nil for undefined variables. This is because an undefined variable is secure since you have not tainted it.
|
||||
Returns 1, nil for all untainted variables (i.e. Blizzard variables).
|
||||
Returns nil for any global variable that is hooked insecurely (tainted), even unprotected ones like UnitName().
|
||||
Returns nil for all user defined global variables.
|
||||
If a table is passed first, it checks table.variable (e.g. issecurevariable(PlayerFrame, "Show") checks PlayerFrame["Show"] or PlayerFrame.Show (they are the same thing)).
|
||||
]]
|
||||
function issecurevariable(tab, var)
|
||||
-- assert(type(tab) == "table" and type(var) == "string", "Usage: issecurevariable([table,] \"variable\")")
|
||||
return
|
||||
end
|
||||
|
||||
function tContains(table, item)
|
||||
local index = 1
|
||||
|
||||
while table[index] do
|
||||
if item == table[index] then
|
||||
return 1
|
||||
end
|
||||
index = index + 1
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function UnitAura(unit, i, filter)
|
||||
assert((type(unit) == "string" or type(unit) == "number") and (type(i) == "string" or type(i) == "number"), "Usage: UnitAura(\"unit\", index [, filter])")
|
||||
|
||||
if not filter or match(filter, "(HELPFUL)") then
|
||||
local name, rank, aura, count, duration, maxDuration = UnitBuff(unit, i, filter)
|
||||
return name, rank, aura, count, nil, duration or 0, maxDuration or 0
|
||||
else
|
||||
local name, rank, aura, count, dType, duration, maxDuration = UnitDebuff(unit, i, filter)
|
||||
return name, rank, aura, count, dType, duration or 0, maxDuration or 0
|
||||
end
|
||||
end
|
||||
|
||||
function BetterDate(formatString, timeVal)
|
||||
@@ -47,29 +142,8 @@ function BetterDate(formatString, timeVal)
|
||||
return date(formatString, timeVal)
|
||||
end
|
||||
|
||||
RAID_CLASS_COLORS = {
|
||||
["HUNTER"] = {r = 0.67, g = 0.83, b = 0.45},
|
||||
["WARLOCK"] = {r = 0.58, g = 0.51, b = 0.79},
|
||||
["PRIEST"] = {r = 1.0, g = 1.0, b = 1.0},
|
||||
["PALADIN"] = {r = 0.96, g = 0.55, b = 0.73},
|
||||
["MAGE"] = {r = 0.41, g = 0.8, b = 0.94},
|
||||
["ROGUE"] = {r = 1.0, g = 0.96, b = 0.41},
|
||||
["DRUID"] = {r = 1.0, g = 0.49, b = 0.04},
|
||||
["WARRIOR"] = {r = 0.78, g = 0.61, b = 0.43},
|
||||
};
|
||||
|
||||
QuestDifficultyColors = {
|
||||
["impossible"] = {r = 1.00, g = 0.10, b = 0.10};
|
||||
["verydifficult"] = {r = 1.00, g = 0.50, b = 0.25};
|
||||
["difficult"] = {r = 1.00, g = 1.00, b = 0.00};
|
||||
["standard"] = {r = 0.25, g = 0.75, b = 0.25};
|
||||
["trivial"] = {r = 0.50, g = 0.50, b = 0.50};
|
||||
["header"] = {r = 0.70, g = 0.70, b = 0.70};
|
||||
};
|
||||
|
||||
function GetQuestDifficultyColor(level)
|
||||
local levelDiff = level - UnitLevel("player")
|
||||
local color
|
||||
if levelDiff >= 5 then
|
||||
return QuestDifficultyColors["impossible"]
|
||||
elseif levelDiff >= 3 then
|
||||
@@ -83,21 +157,204 @@ function GetQuestDifficultyColor(level)
|
||||
end
|
||||
end
|
||||
|
||||
function EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)
|
||||
if displayMode == "MENU" then
|
||||
menuFrame.displayMode = displayMode
|
||||
end
|
||||
UIDropDownMenu_Initialize(menuFrame, EasyMenu_Initialize, displayMode)
|
||||
ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList)
|
||||
end
|
||||
function FillLocalizedClassList(tab, female)
|
||||
assert(type(tab) == "table", "Usage: FillLocalizedClassList(classTable[, isFemale])")
|
||||
|
||||
function EasyMenu_Initialize()
|
||||
print(level, info)
|
||||
for index = 1, getn(menuList) do
|
||||
local value = menuList[index]
|
||||
if value.text then
|
||||
value.index = index;
|
||||
UIDropDownMenu_AddButton(value, level)
|
||||
for _, engClass in ipairs(CLASS_SORT_ORDER) do
|
||||
if female then
|
||||
tab[engClass] = LBC[engClass]
|
||||
else
|
||||
tab[engClass] = LBC[gsub(lower(engClass), "^%l", upper)]
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
FillLocalizedClassList(LOCALIZED_CLASS_NAMES_MALE)
|
||||
FillLocalizedClassList(LOCALIZED_CLASS_NAMES_FEMALE, true)
|
||||
|
||||
local zoneInfo = {
|
||||
-- Battlegrounds
|
||||
[LBZ["Warsong Gulch"]] = {mapID = 443, maxPlayers = 10},
|
||||
[LBZ["Arathi Basin"]] = {mapID = 461, maxPlayers = 15},
|
||||
[LBZ["Alterac Valley"]] = {mapID = 401, maxPlayers = 40},
|
||||
|
||||
-- Raids
|
||||
[LBZ["Zul'Gurub"]] = {mapID = 309, maxPlayers = 20},
|
||||
[LBZ["Onyxia's Lair"]] = {mapID = 249, maxPlayers = 40},
|
||||
[LBZ["Molten Core"]] = {mapID = 409, maxPlayers = 40},
|
||||
[LBZ["Ruins of Ahn'Qiraj"]] = {mapID = 509, maxPlayers = 20},
|
||||
[LBZ["Temple of Ahn'Qiraj"]] = {mapID = 531, maxPlayers = 40},
|
||||
[LBZ["Blackwing Lair"]] = {mapID = 469, maxPlayers = 40},
|
||||
[LBZ["Naxxramas"]] = {mapID = 533, maxPlayers = 40},
|
||||
}
|
||||
|
||||
local mapByID = {}
|
||||
for mapName in pairs(zoneInfo) do
|
||||
mapByID[zoneInfo[mapName].mapID] = mapName
|
||||
end
|
||||
|
||||
local function GetMaxPlayersByType(instanceType, zoneName)
|
||||
if instanceType == "none" then
|
||||
return 40
|
||||
elseif instanceType == "party" then
|
||||
return 5
|
||||
elseif instanceType == "arena" then
|
||||
return 5
|
||||
elseif zoneName ~= "" and zoneInfo[zoneName] then
|
||||
if instanceType == "pvp" then
|
||||
return zoneInfo[zoneName].maxPlayers
|
||||
elseif instanceType == "raid" then
|
||||
return zoneInfo[zoneName].maxPlayers
|
||||
end
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function GetInstanceInfo()
|
||||
local inInstance, instanceType = IsInInstance()
|
||||
if not inInstance then return end
|
||||
|
||||
local name = GetRealZoneText()
|
||||
|
||||
local difficulty = 1
|
||||
local difficultyName = DUNGEON_DIFFICULTY1
|
||||
local maxPlayers = GetMaxPlayersByType(instanceType, name)
|
||||
|
||||
difficultyName = format("%d %s", maxPlayers, difficultyName)
|
||||
|
||||
return name, instanceType, difficulty, difficultyName, maxPlayers
|
||||
end
|
||||
|
||||
function GetCurrentMapAreaID()
|
||||
if not IsInInstance() then return end
|
||||
local zoneName = GetRealZoneText()
|
||||
|
||||
if zoneName ~= "" and zoneInfo[zoneName] then
|
||||
return zoneInfo[zoneName].mapID
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function GetMapNameByID(id)
|
||||
assert(type(id) == "string" or type(id) == "number", format("Bad argument #1 to \"GetMapNameByID\" (number expected, got %s)", id and type(id) or "no value"))
|
||||
|
||||
return mapByID[tonumber(id)]
|
||||
end
|
||||
|
||||
local arrow
|
||||
function GetPlayerFacing()
|
||||
if not arrow then
|
||||
local obj = Minimap
|
||||
for i = 1, obj:GetNumChildren() do
|
||||
local child = select(i, obj:GetChildren())
|
||||
if child and child.GetModel and child:GetModel() == "interface\\minimap\\minimaparrow.m2" then
|
||||
arrow = child
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return arrow and arrow:GetFacing()
|
||||
end
|
||||
|
||||
function ToggleFrame(frame)
|
||||
if frame:IsShown() then
|
||||
HideUIPanel(frame)
|
||||
else
|
||||
ShowUIPanel(frame)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnOrientationChanged(self, orientation)
|
||||
self.texturePointer.verticalOrientation = orientation == "VERTICAL"
|
||||
|
||||
if self.texturePointer.verticalOrientation then
|
||||
self.texturePointer:SetPoint("BOTTOMLEFT", self)
|
||||
else
|
||||
self.texturePointer:SetPoint("LEFT", self)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnSizeChanged()
|
||||
local width, height = ElvUF_Player.Health:GetWidth(), ElvUF_Player.Health:GetHeight()
|
||||
this.texturePointer.width = width
|
||||
this.texturePointer.height = height
|
||||
this.texturePointer:SetWidth(width)
|
||||
this.texturePointer:SetHeight(height)
|
||||
end
|
||||
|
||||
local function OnValueChanged()
|
||||
local _, max = this:GetMinMaxValues()
|
||||
if this.texturePointer.verticalOrientation then
|
||||
this.texturePointer:SetHeight(this.texturePointer.height * (arg1 / max))
|
||||
else
|
||||
this.texturePointer:SetWidth(this.texturePointer.width * (arg1 / max))
|
||||
end
|
||||
end
|
||||
|
||||
function CreateStatusBarTexturePointer(statusbar)
|
||||
assert(type(statusbar) == "table", format("Bad argument #1 to \"CreateStatusBarTexturePointer\" (table expected, got %s)", statusbar and type(statusbar) or "no value"))
|
||||
assert(statusbar.GetObjectType and statusbar:GetObjectType() == "StatusBar", "Bad argument #1 to \"CreateStatusBarTexturePointer\" (statusbar object expected)")
|
||||
|
||||
local f = statusbar:CreateTexture()
|
||||
f.width = statusbar:GetWidth()
|
||||
f.height = statusbar:GetHeight()
|
||||
f.vertical = statusbar:GetOrientation() == "VERTICAL"
|
||||
f:SetWidth(f.width)
|
||||
f:SetHeight(f.height)
|
||||
|
||||
if f.verticalOrientation then
|
||||
f:SetPoint("BOTTOMLEFT", statusbar)
|
||||
else
|
||||
f:SetPoint("LEFT", statusbar)
|
||||
end
|
||||
|
||||
statusbar.texturePointer = f
|
||||
|
||||
statusbar:SetScript("OnSizeChanged", OnSizeChanged)
|
||||
statusbar:SetScript("OnValueChanged", OnValueChanged)
|
||||
|
||||
hooksecurefunc(statusbar, "SetOrientation", OnOrientationChanged)
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
local threatColors = {
|
||||
[0] = {0.69, 0.69, 0.69},
|
||||
[1] = {1, 1, 0.47},
|
||||
[2] = {1, 0.6, 0},
|
||||
[3] = {1, 0, 0}
|
||||
}
|
||||
|
||||
function GetThreatStatusColor(statusIndex)
|
||||
if not (type(statusIndex) == "number" and statusIndex >= 0 and statusIndex < 4) then
|
||||
statusIndex = 0
|
||||
end
|
||||
|
||||
return threatColors[statusIndex][1], threatColors[statusIndex][2], threatColors[statusIndex][3]
|
||||
end
|
||||
|
||||
function GetThreatStatus(currentThreat, maxThreat)
|
||||
assert(type(currentThreat) == "number" and type(maxThreat) == "number", "Usage: GetThreatStatus(currentThreat, maxThreat)")
|
||||
|
||||
if not maxThreat or maxThreat == 0 then
|
||||
maxThreat = 0
|
||||
maxThreat = 1
|
||||
end
|
||||
|
||||
local threatPercent = currentThreat / maxThreat * 100
|
||||
|
||||
if threatPercent >= 100 then
|
||||
return 3, threatPercent
|
||||
elseif threatPercent < 100 and threatPercent >= 80 then
|
||||
return 2, threatPercent
|
||||
elseif threatPercent < 80 and threatPercent >= 50 then
|
||||
return 1, threatPercent
|
||||
else
|
||||
return 0, threatPercent
|
||||
end
|
||||
end
|
||||
@@ -1,142 +0,0 @@
|
||||
--Cache global variables
|
||||
local assert = assert
|
||||
local error = error
|
||||
local geterrorhandler = geterrorhandler
|
||||
local pairs = pairs
|
||||
local pcall = pcall
|
||||
local tostring = tostring
|
||||
local type = type
|
||||
local unpack = unpack
|
||||
local ceil, floor = math.ceil, math.floor
|
||||
local format, gsub = string.format, string.gsub
|
||||
local getn, insert = table.getn, table.insert
|
||||
|
||||
function select(n, ...)
|
||||
assert(type(n) == "number" or type(n) == "string", "bad argument #1 to 'select' (number expected, got no value)")
|
||||
|
||||
if type(n) == "string" and n == "#" then
|
||||
if type(arg) == "table" then
|
||||
return getn(arg)
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
local temp = {}
|
||||
|
||||
for i = n, getn(arg) do
|
||||
insert(temp, arg[i])
|
||||
end
|
||||
|
||||
return unpack(temp)
|
||||
end
|
||||
|
||||
function math.modf(i)
|
||||
assert(type(i) == "number", "bad argument #1 to 'modf' (number expected, got no value)")
|
||||
|
||||
local int = i >= 0 and floor(i) or ceil(i)
|
||||
|
||||
return int, i - int
|
||||
end
|
||||
|
||||
function string.join(delimiter, ...)
|
||||
-- assert(type(delimiter) == "number", "bad argument #1 to 'join' (string expected, got no value)")
|
||||
|
||||
local size = getn(arg)
|
||||
if size == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
local text = arg[1]
|
||||
for i = 2, size do
|
||||
text = text..delimiter..arg[i]
|
||||
end
|
||||
|
||||
return text
|
||||
end
|
||||
strjoin = string.join
|
||||
|
||||
function string.split(delimiter, subject)
|
||||
assert(type(delimiter) == "string", "bad argument #1 to 'split' (string expected, got no value)")
|
||||
|
||||
local delimiter, fields = delimiter or ":", {}
|
||||
local pattern = format("([^%s]+)", delimiter)
|
||||
gsub(subject, pattern, function(c) fields[getn(fields) + 1] = c end)
|
||||
|
||||
return unpack(fields)
|
||||
end
|
||||
strsplit = string.split
|
||||
|
||||
function table.wipe(t)
|
||||
assert(type(t) == "table", "bad argument #1 to 'wipe' (table expected, got no value)")
|
||||
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
|
||||
return t
|
||||
end
|
||||
wipe = table.wipe
|
||||
|
||||
local LOCAL_ToStringAllTemp = {}
|
||||
function tostringall(...)
|
||||
local n = getn(arg)
|
||||
-- Simple versions for common argument counts
|
||||
if (n == 1) then
|
||||
return tostring(arg[1])
|
||||
elseif (n == 2) then
|
||||
return tostring(arg[1]), tostring(arg[2])
|
||||
elseif (n == 3) then
|
||||
return tostring(arg[1]), tostring(arg[2]), tostring(arg[3])
|
||||
elseif (n == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
local needfix
|
||||
for i = 1, n do
|
||||
local v = arg[i]
|
||||
if (type(v) ~= "string") then
|
||||
needfix = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if (not needfix) then return unpack(arg) end
|
||||
|
||||
wipe(LOCAL_ToStringAllTemp)
|
||||
for i = 1, needfix - 1 do
|
||||
LOCAL_ToStringAllTemp[i] = arg[i]
|
||||
end
|
||||
for i = needfix, n do
|
||||
LOCAL_ToStringAllTemp[i] = tostring(arg[i])
|
||||
end
|
||||
return unpack(LOCAL_ToStringAllTemp)
|
||||
end
|
||||
|
||||
local LOCAL_PrintHandler = function(...)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(strjoin(" ", tostringall(unpack(arg))))
|
||||
end
|
||||
|
||||
function setprinthandler(func)
|
||||
if (type(func) ~= "function") then
|
||||
error("Invalid print handler")
|
||||
else
|
||||
LOCAL_PrintHandler = func
|
||||
end
|
||||
end
|
||||
|
||||
function getprinthandler() return LOCAL_PrintHandler end
|
||||
|
||||
local function print_inner(...)
|
||||
local ok, err = pcall(LOCAL_PrintHandler, unpack(arg))
|
||||
if (not ok) then
|
||||
local func = geterrorhandler()
|
||||
func(err)
|
||||
end
|
||||
end
|
||||
|
||||
function print(...)
|
||||
pcall(print_inner, unpack(arg))
|
||||
end
|
||||
|
||||
SLASH_PRINT1 = "/print"
|
||||
SlashCmdList["PRINT"] = print
|
||||
+8
-29
@@ -1,10 +1,11 @@
|
||||
--Cache global variables
|
||||
_G = getfenv()
|
||||
|
||||
-- Cache global variables
|
||||
local strmatch = strmatch
|
||||
--WoW API
|
||||
-- WoW API
|
||||
local GetCVar = GetCVar
|
||||
local IsAddOnLoaded = IsAddOnLoaded
|
||||
local LoadAddOn = LoadAddOn
|
||||
local UIParentLoadAddOn = UIParentLoadAddOn
|
||||
|
||||
local _ERROR_COUNT = 0
|
||||
local _ERROR_LIMIT = 1000
|
||||
@@ -15,7 +16,7 @@ function _ERRORMESSAGE_NEW(message)
|
||||
LoadAddOn("!DebugTools")
|
||||
local loaded = IsAddOnLoaded("!DebugTools")
|
||||
|
||||
-- if (GetCVar("scriptErrors") == 1) then
|
||||
if (GetCVar("ShowErrors") == "1") then
|
||||
if (not loaded or DEBUG_DEBUGTOOLS) then
|
||||
ScriptErrors_Message:SetText(message)
|
||||
ScriptErrors:Show()
|
||||
@@ -25,9 +26,9 @@ function _ERRORMESSAGE_NEW(message)
|
||||
else
|
||||
ScriptErrorsFrame_OnError(message)
|
||||
end
|
||||
-- elseif (loaded) then
|
||||
-- ScriptErrorsFrame_OnError(message, true)
|
||||
-- end
|
||||
elseif (loaded) then
|
||||
ScriptErrorsFrame_OnError(message, true)
|
||||
end
|
||||
|
||||
_ERROR_COUNT = _ERROR_COUNT + 1
|
||||
if (_ERROR_COUNT == _ERROR_LIMIT) then
|
||||
@@ -44,26 +45,4 @@ function message(text)
|
||||
ScriptErrors_Message:SetText(text)
|
||||
ScriptErrors:Show()
|
||||
end
|
||||
end
|
||||
|
||||
SLASH_FRAMESTACK1 = "/framestack"
|
||||
SLASH_FRAMESTACK2 = "/fstack"
|
||||
SlashCmdList["FRAMESTACK"] = function(msg)
|
||||
UIParentLoadAddOn("!DebugTools")
|
||||
|
||||
|
||||
FrameStackTooltip_Toggle(showHidden)
|
||||
end
|
||||
|
||||
SLASH_EVENTTRACE1 = "/eventtrace"
|
||||
SLASH_EVENTTRACE2 = "/etrace"
|
||||
SlashCmdList["EVENTTRACE"] = function(msg)
|
||||
UIParentLoadAddOn("!DebugTools")
|
||||
EventTraceFrame_HandleSlashCmd(msg)
|
||||
end
|
||||
|
||||
SLASH_DUMP1 = "/dump"
|
||||
SlashCmdList["DUMP"] = function(msg)
|
||||
UIParentLoadAddOn("!DebugTools")
|
||||
DevTools_DumpCommand(msg)
|
||||
end
|
||||
@@ -0,0 +1,292 @@
|
||||
-- LibBabble-3.0 is hereby placed in the Public Domain
|
||||
-- Credits: ckknight
|
||||
local LIBBABBLE_MAJOR, LIBBABBLE_MINOR = "LibBabble-3.0", 2
|
||||
|
||||
local LibBabble = LibStub:NewLibrary(LIBBABBLE_MAJOR, LIBBABBLE_MINOR)
|
||||
if not LibBabble then
|
||||
return
|
||||
end
|
||||
|
||||
local data = LibBabble.data or {}
|
||||
for k,v in pairs(LibBabble) do
|
||||
LibBabble[k] = nil
|
||||
end
|
||||
LibBabble.data = data
|
||||
|
||||
local tablesToDB = {}
|
||||
for namespace, db in pairs(data) do
|
||||
for k,v in pairs(db) do
|
||||
tablesToDB[v] = db
|
||||
end
|
||||
end
|
||||
|
||||
local function warn(message)
|
||||
local _, ret = pcall(error, message, 3)
|
||||
geterrorhandler()(ret)
|
||||
end
|
||||
|
||||
local lookup_mt = { __index = function(self, key)
|
||||
local db = tablesToDB[self]
|
||||
local current_key = db.current[key]
|
||||
if current_key then
|
||||
self[key] = current_key
|
||||
return current_key
|
||||
end
|
||||
local base_key = db.base[key]
|
||||
local real_MAJOR_VERSION
|
||||
for k,v in pairs(data) do
|
||||
if v == db then
|
||||
real_MAJOR_VERSION = k
|
||||
break
|
||||
end
|
||||
end
|
||||
if not real_MAJOR_VERSION then
|
||||
real_MAJOR_VERSION = LIBBABBLE_MAJOR
|
||||
end
|
||||
if base_key then
|
||||
warn(string.format("%s: Translation %q not found for locale %q", real_MAJOR_VERSION, key, GetLocale()))
|
||||
rawset(self, key, base_key)
|
||||
return base_key
|
||||
end
|
||||
warn(string.format("%s: Translation %q not found.", real_MAJOR_VERSION, key))
|
||||
rawset(self, key, key)
|
||||
return key
|
||||
end }
|
||||
|
||||
local function initLookup(module, lookup)
|
||||
local db = tablesToDB[module]
|
||||
for k in pairs(lookup) do
|
||||
lookup[k] = nil
|
||||
end
|
||||
setmetatable(lookup, lookup_mt)
|
||||
tablesToDB[lookup] = db
|
||||
db.lookup = lookup
|
||||
return lookup
|
||||
end
|
||||
|
||||
local function initReverse(module, reverse)
|
||||
local db = tablesToDB[module]
|
||||
for k in pairs(reverse) do
|
||||
reverse[k] = nil
|
||||
end
|
||||
for k,v in pairs(db.current) do
|
||||
reverse[v] = k
|
||||
end
|
||||
tablesToDB[reverse] = db
|
||||
db.reverse = reverse
|
||||
db.reverseIterators = nil
|
||||
return reverse
|
||||
end
|
||||
|
||||
local prototype = {}
|
||||
local prototype_mt = {__index = prototype}
|
||||
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will warn but allow the code to pass through.
|
||||
Returns:
|
||||
A lookup table for english to localized words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local BL = B:GetLookupTable()
|
||||
assert(BL["Some english word"] == "Some localized word")
|
||||
DoSomething(BL["Some english word that doesn't exist"]) -- warning!
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
local lookup = db.lookup
|
||||
if lookup then
|
||||
return lookup
|
||||
end
|
||||
return initLookup(self, {})
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will return nil.
|
||||
Returns:
|
||||
A lookup table for english to localized words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local B_has = B:GetUnstrictLookupTable()
|
||||
assert(B_has["Some english word"] == "Some localized word")
|
||||
assert(B_has["Some english word that doesn't exist"] == nil)
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetUnstrictLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
return db.current
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will return nil.
|
||||
* This is useful for checking if the base (English) table has a key, even if the localized one does not have it registered.
|
||||
Returns:
|
||||
A lookup table for english to localized words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local B_hasBase = B:GetBaseLookupTable()
|
||||
assert(B_hasBase["Some english word"] == "Some english word")
|
||||
assert(B_hasBase["Some english word that doesn't exist"] == nil)
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetBaseLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
return db.base
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will return nil.
|
||||
* This will return only one English word that it maps to, if there are more than one to check, see :GetReverseIterator("word")
|
||||
Returns:
|
||||
A lookup table for localized to english words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local BR = B:GetReverseLookupTable()
|
||||
assert(BR["Some localized word"] == "Some english word")
|
||||
assert(BR["Some localized word that doesn't exist"] == nil)
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetReverseLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
local reverse = db.reverse
|
||||
if reverse then
|
||||
return reverse
|
||||
end
|
||||
return initReverse(self, {})
|
||||
end
|
||||
local blank = {}
|
||||
local weakVal = {__mode="v"}
|
||||
--[[---------------------------------------------------------------------------
|
||||
Arguments:
|
||||
string - the localized word to chek for.
|
||||
Returns:
|
||||
An iterator to traverse all English words that map to the given key
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
for word in B:GetReverseIterator("Some localized word") do
|
||||
DoSomething(word)
|
||||
end
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetReverseIterator(key)
|
||||
local db = tablesToDB[self]
|
||||
local reverseIterators = db.reverseIterators
|
||||
if not reverseIterators then
|
||||
reverseIterators = setmetatable({}, weakVal)
|
||||
db.reverseIterators = reverseIterators
|
||||
elseif reverseIterators[key] then
|
||||
return pairs(reverseIterators[key])
|
||||
end
|
||||
local t
|
||||
for k,v in pairs(db.current) do
|
||||
if v == key then
|
||||
if not t then
|
||||
t = {}
|
||||
end
|
||||
t[k] = true
|
||||
end
|
||||
end
|
||||
reverseIterators[key] = t or blank
|
||||
return pairs(reverseIterators[key])
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Returns:
|
||||
An iterator to traverse all translations English to localized.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
for english, localized in B:Iterate() do
|
||||
DoSomething(english, localized)
|
||||
end
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:Iterate()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
return pairs(db.current)
|
||||
end
|
||||
|
||||
-- #NODOC
|
||||
-- modules need to call this to set the base table
|
||||
function prototype:SetBaseTranslations(base)
|
||||
local db = tablesToDB[self]
|
||||
local oldBase = db.base
|
||||
if oldBase then
|
||||
for k in pairs(oldBase) do
|
||||
oldBase[k] = nil
|
||||
end
|
||||
for k, v in pairs(base) do
|
||||
oldBase[k] = v
|
||||
end
|
||||
base = oldBase
|
||||
else
|
||||
db.base = base
|
||||
end
|
||||
for k,v in pairs(base) do
|
||||
if v == true then
|
||||
base[k] = k
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function init(module)
|
||||
local db = tablesToDB[module]
|
||||
if db.lookup then
|
||||
initLookup(module, db.lookup)
|
||||
end
|
||||
if db.reverse then
|
||||
initReverse(module, db.reverse)
|
||||
end
|
||||
db.reverseIterators = nil
|
||||
end
|
||||
|
||||
-- #NODOC
|
||||
-- modules need to call this to set the current table. if current is true, use the base table.
|
||||
function prototype:SetCurrentTranslations(current)
|
||||
local db = tablesToDB[self]
|
||||
if current == true then
|
||||
db.current = db.base
|
||||
else
|
||||
local oldCurrent = db.current
|
||||
if oldCurrent then
|
||||
for k in pairs(oldCurrent) do
|
||||
oldCurrent[k] = nil
|
||||
end
|
||||
for k, v in pairs(current) do
|
||||
oldCurrent[k] = v
|
||||
end
|
||||
current = oldCurrent
|
||||
else
|
||||
db.current = current
|
||||
end
|
||||
end
|
||||
init(self)
|
||||
end
|
||||
|
||||
for namespace, db in pairs(data) do
|
||||
setmetatable(db.module, prototype_mt)
|
||||
init(db.module)
|
||||
end
|
||||
|
||||
-- #NODOC
|
||||
-- modules need to call this to create a new namespace.
|
||||
function LibBabble:New(namespace, minor)
|
||||
local module, oldminor = LibStub:NewLibrary(namespace, minor)
|
||||
if not module then
|
||||
return
|
||||
end
|
||||
|
||||
if not oldminor then
|
||||
local db = {
|
||||
module = module,
|
||||
}
|
||||
data[namespace] = db
|
||||
tablesToDB[module] = db
|
||||
else
|
||||
for k,v in pairs(module) do
|
||||
module[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
setmetatable(module, prototype_mt)
|
||||
|
||||
return module
|
||||
end
|
||||
@@ -0,0 +1,221 @@
|
||||
--[[
|
||||
Name: LibBabble-Class-3.0
|
||||
Revision: $Rev: 50 $
|
||||
Author(s): ckknight (ckknight@gmail.com)
|
||||
Website: http://ckknight.wowinterface.com/
|
||||
Dependencies: None
|
||||
License: MIT
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "LibBabble-Class-3.0"
|
||||
local MINOR_VERSION = 90000 + tonumber(string.match("$Revision: 50 $", "%d+"))
|
||||
|
||||
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
|
||||
local lib = LibStub("LibBabble-3.0"):New(MAJOR_VERSION, MINOR_VERSION)
|
||||
if not lib then return end
|
||||
|
||||
local GAME_LOCALE = GetLocale()
|
||||
|
||||
lib:SetBaseTranslations {
|
||||
Warlock = true,
|
||||
Warrior = true,
|
||||
Hunter = true,
|
||||
Mage = true,
|
||||
Priest = true,
|
||||
Druid = true,
|
||||
Paladin = true,
|
||||
Shaman = true,
|
||||
Rogue = true,
|
||||
|
||||
WARLOCK = true,
|
||||
WARRIOR = true,
|
||||
HUNTER = true,
|
||||
MAGE = true,
|
||||
PRIEST = true,
|
||||
DRUID = true,
|
||||
PALADIN = true,
|
||||
SHAMAN = true,
|
||||
ROGUE = true,
|
||||
}
|
||||
|
||||
if GAME_LOCALE == "enUS" then
|
||||
lib:SetCurrentTranslations(true)
|
||||
elseif GAME_LOCALE == "deDE" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "Hexenmeister",
|
||||
["Warrior"] = "Krieger",
|
||||
["Hunter"] = "Jäger",
|
||||
["Mage"] = "Magier",
|
||||
["Priest"] = "Priester",
|
||||
["Druid"] = "Druide",
|
||||
["Paladin"] = "Paladin",
|
||||
["Shaman"] = "Schamane",
|
||||
["Rogue"] = "Schurke",
|
||||
|
||||
["WARLOCK"] = "Hexenmeisterin",
|
||||
["WARRIOR"] = "Kriegerin",
|
||||
["HUNTER"] = "Jägerin",
|
||||
["MAGE"] = "Magierin",
|
||||
["PRIEST"] = "Priesterin",
|
||||
["DRUID"] = "Druidin",
|
||||
["PALADIN"] = "Paladin",
|
||||
["SHAMAN"] = "Schamanin",
|
||||
["ROGUE"] = "Schurkin",
|
||||
}
|
||||
elseif GAME_LOCALE == "frFR" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "Démoniste",
|
||||
["Warrior"] = "Guerrier",
|
||||
["Hunter"] = "Chasseur",
|
||||
["Mage"] = "Mage",
|
||||
["Priest"] = "Prêtre",
|
||||
["Druid"] = "Druide",
|
||||
["Paladin"] = "Paladin",
|
||||
["Shaman"] = "Chaman",
|
||||
["Rogue"] = "Voleur",
|
||||
|
||||
["WARLOCK"] = "Démoniste",
|
||||
["WARRIOR"] = "Guerrière",
|
||||
["HUNTER"] = "Chasseresse",
|
||||
["MAGE"] = "Mage",
|
||||
["PRIEST"] = "Prêtresse",
|
||||
["DRUID"] = "Druidesse",
|
||||
["PALADIN"] = "Paladin",
|
||||
["SHAMAN"] = "Chamane",
|
||||
["ROGUE"] = "Voleuse",
|
||||
}
|
||||
elseif GAME_LOCALE == "zhCN" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "术士",
|
||||
["Warrior"] = "战士",
|
||||
["Hunter"] = "猎人",
|
||||
["Mage"] = "法师",
|
||||
["Priest"] = "牧师",
|
||||
["Druid"] = "德鲁伊",
|
||||
["Paladin"] = "圣骑士",
|
||||
["Shaman"] = "萨满祭司",
|
||||
["Rogue"] = "潜行者",
|
||||
|
||||
["WARLOCK"] = "术士",
|
||||
["WARRIOR"] = "战士",
|
||||
["HUNTER"] = "猎人",
|
||||
["MAGE"] = "法师",
|
||||
["PRIEST"] = "牧师",
|
||||
["DRUID"] = "德鲁伊",
|
||||
["PALADIN"] = "圣骑士",
|
||||
["SHAMAN"] = "萨满祭司",
|
||||
["ROGUE"] = "潜行者",
|
||||
}
|
||||
elseif GAME_LOCALE == "zhTW" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "術士",
|
||||
["Warrior"] = "戰士",
|
||||
["Hunter"] = "獵人",
|
||||
["Mage"] = "法師",
|
||||
["Priest"] = "牧師",
|
||||
["Druid"] = "德魯伊",
|
||||
["Paladin"] = "聖騎士",
|
||||
["Shaman"] = "薩滿",
|
||||
["Rogue"] = "盜賊",
|
||||
|
||||
["WARLOCK"] = "術士",
|
||||
["WARRIOR"] = "戰士",
|
||||
["HUNTER"] = "獵人",
|
||||
["MAGE"] = "法師",
|
||||
["PRIEST"] = "牧師",
|
||||
["DRUID"] = "德魯伊",
|
||||
["PALADIN"] = "聖騎士",
|
||||
["SHAMAN"] = "薩滿",
|
||||
["ROGUE"] = "盜賊",
|
||||
}
|
||||
elseif GAME_LOCALE == "koKR" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "흑마법사",
|
||||
["Warrior"] = "전사",
|
||||
["Hunter"] = "사냥꾼",
|
||||
["Mage"] = "마법사",
|
||||
["Priest"] = "사제",
|
||||
["Druid"] = "드루이드",
|
||||
["Paladin"] = "성기사",
|
||||
["Shaman"] = "주술사",
|
||||
["Rogue"] = "도적",
|
||||
|
||||
["WARLOCK"] = "흑마법사",
|
||||
["WARRIOR"] = "전사",
|
||||
["HUNTER"] = "사냥꾼",
|
||||
["MAGE"] = "마법사",
|
||||
["PRIEST"] = "사제",
|
||||
["DRUID"] = "드루이드",
|
||||
["PALADIN"] = "성기사",
|
||||
["SHAMAN"] = "주술사",
|
||||
["ROGUE"] = "도적",
|
||||
}
|
||||
elseif GAME_LOCALE == "esES" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "Brujo",
|
||||
["Warrior"] = "Guerrero",
|
||||
["Hunter"] = "Cazador",
|
||||
["Mage"] = "Mago",
|
||||
["Priest"] = "Sacerdote",
|
||||
["Druid"] = "Druida",
|
||||
["Paladin"] = "Paladín",
|
||||
["Shaman"] = "Chamán",
|
||||
["Rogue"] = "Pícaro",
|
||||
|
||||
["WARLOCK"] = "Bruja",
|
||||
["WARRIOR"] = "Guerrera",
|
||||
["HUNTER"] = "Cazadora",
|
||||
["MAGE"] = "Maga",
|
||||
["PRIEST"] = "Sacerdotisa",
|
||||
["DRUID"] = "Druida",
|
||||
["PALADIN"] = "Paladín",
|
||||
["SHAMAN"] = "Chamán",
|
||||
["ROGUE"] = "Pícara",
|
||||
}
|
||||
elseif GAME_LOCALE == "esMX" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "Brujo",
|
||||
["Warrior"] = "Guerrero",
|
||||
["Hunter"] = "Cazador",
|
||||
["Mage"] = "Mago",
|
||||
["Priest"] = "Sacerdote",
|
||||
["Druid"] = "Druida",
|
||||
["Paladin"] = "Paladín",
|
||||
["Shaman"] = "Chamán",
|
||||
["Rogue"] = "Pícaro",
|
||||
|
||||
["WARLOCK"] = "Bruja",
|
||||
["WARRIOR"] = "Guerrera",
|
||||
["HUNTER"] = "Cazadora",
|
||||
["MAGE"] = "Maga",
|
||||
["PRIEST"] = "Sacerdotisa",
|
||||
["DRUID"] = "Druida",
|
||||
["PALADIN"] = "Paladín",
|
||||
["SHAMAN"] = "Chamán",
|
||||
["ROGUE"] = "Pícara",
|
||||
}
|
||||
elseif GAME_LOCALE == "ruRU" then
|
||||
lib:SetCurrentTranslations {
|
||||
["Warlock"] = "Чернокнижник",
|
||||
["Warrior"] = "Воин",
|
||||
["Hunter"] = "Охотник",
|
||||
["Mage"] = "Маг",
|
||||
["Priest"] = "Жрец",
|
||||
["Druid"] = "Друид",
|
||||
["Paladin"] = "Паладин",
|
||||
["Shaman"] = "Шаман",
|
||||
["Rogue"] = "Разбойник",
|
||||
|
||||
["WARLOCK"] = "Чернокнижница",
|
||||
["WARRIOR"] = "Воин",
|
||||
["HUNTER"] = "Охотница",
|
||||
["MAGE"] = "Маг",
|
||||
["PRIEST"] = "Жрица",
|
||||
["DRUID"] = "Друид",
|
||||
["PALADIN"] = "Паладин",
|
||||
["SHAMAN"] = "Шаманка",
|
||||
["ROGUE"] = "Разбойница",
|
||||
}
|
||||
else
|
||||
error(string.format("%s: Locale %q not supported", MAJOR_VERSION, GAME_LOCALE))
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
-- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
|
||||
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info
|
||||
-- LibStub is hereby placed in the Public Domain
|
||||
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
|
||||
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
|
||||
local LibStub = _G[LIBSTUB_MAJOR]
|
||||
|
||||
-- Check to see is this version of the stub is obsolete
|
||||
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
LibStub = LibStub or {libs = {}, minors = {} }
|
||||
_G[LIBSTUB_MAJOR] = LibStub
|
||||
LibStub.minor = LIBSTUB_MINOR
|
||||
|
||||
-- LibStub:NewLibrary(major, minor)
|
||||
-- major (string) - the major version of the library
|
||||
-- minor (string or number ) - the minor version of the library
|
||||
--
|
||||
-- returns nil if a newer or same version of the lib is already present
|
||||
-- returns empty library object or old library object if upgrade is needed
|
||||
function LibStub:NewLibrary(major, minor)
|
||||
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
||||
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
|
||||
local oldminor = self.minors[major]
|
||||
if oldminor and oldminor >= minor then return nil end
|
||||
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
|
||||
return self.libs[major], oldminor
|
||||
end
|
||||
|
||||
-- LibStub:GetLibrary(major, [silent])
|
||||
-- major (string) - the major version of the library
|
||||
-- silent (boolean) - if true, library is optional, silently return nil if its not found
|
||||
--
|
||||
-- throws an error if the library can not be found (except silent is set)
|
||||
-- returns the library object if found
|
||||
function LibStub:GetLibrary(major, silent)
|
||||
if not self.libs[major] and not silent then
|
||||
error(string.format("Cannot find a library instance of %q.", tostring(major)), 2)
|
||||
end
|
||||
return self.libs[major], self.minors[major]
|
||||
end
|
||||
|
||||
-- LibStub:IterateLibraries()
|
||||
--
|
||||
-- Returns an iterator for the currently registered libraries
|
||||
function LibStub:IterateLibraries()
|
||||
return pairs(self.libs)
|
||||
end
|
||||
|
||||
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="LibStub.lua"/>
|
||||
<Script file="LibBabble-3.0.lua"/>
|
||||
<Script file="LibBabble-Class-3.0.lua"/>
|
||||
<Script file="LibBabble-Zone-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,51 @@
|
||||
-- Cache global variables
|
||||
local strmatch = strmatch
|
||||
|
||||
local checked
|
||||
local function LoadDebugTools()
|
||||
if checked then return end
|
||||
|
||||
local _, _, _, lod, _, reason = GetAddOnInfo("!DebugTools")
|
||||
checked = true
|
||||
|
||||
if reason == "MISSING" then return end
|
||||
|
||||
if lod then
|
||||
LoadAddOn("!DebugTools")
|
||||
else
|
||||
EnableAddOn("!DebugTools")
|
||||
LoadAddOn("!DebugTools")
|
||||
DisableAddOn("!DebugTools")
|
||||
end
|
||||
end
|
||||
|
||||
SLASH_FRAMESTACK1 = "/framestack"
|
||||
SLASH_FRAMESTACK2 = "/fstack"
|
||||
SlashCmdList["FRAMESTACK"] = function(msg)
|
||||
LoadDebugTools()
|
||||
|
||||
if IsAddOnLoaded("!DebugTools") then
|
||||
local showHiddenArg, showRegionsArg = strmatch(msg, "^%s*(%S+)%s+(%S+)%s*$")
|
||||
if (not showHiddenArg or not showRegionsArg) then
|
||||
showHiddenArg = strmatch(msg, "^%s*(%S+)%s*$")
|
||||
showRegionsArg = "1"
|
||||
end
|
||||
local showHidden = showHiddenArg == "true" or showHiddenArg == "1"
|
||||
local showRegions = showRegions == "true" or showRegionsArg == "1"
|
||||
|
||||
FrameStackTooltip_Toggle(showHidden, showRegions)
|
||||
end
|
||||
end
|
||||
|
||||
SLASH_EVENTTRACE1 = "/eventtrace"
|
||||
SLASH_EVENTTRACE2 = "/etrace"
|
||||
SlashCmdList["EVENTTRACE"] = function(msg)
|
||||
LoadDebugTools()
|
||||
EventTraceFrame_HandleSlashCmd(msg)
|
||||
end
|
||||
|
||||
SLASH_DUMP1 = "/dump"
|
||||
SlashCmdList["DUMP"] = function(msg)
|
||||
LoadDebugTools()
|
||||
DevTools_DumpCommand(msg)
|
||||
end
|
||||
Reference in New Issue
Block a user