diff --git a/wotlk/Talented/DevTools_Dump.lua b/wotlk/Talented/DevTools_Dump.lua index 43eef1d..f48b825 100644 --- a/wotlk/Talented/DevTools_Dump.lua +++ b/wotlk/Talented/DevTools_Dump.lua @@ -53,314 +53,314 @@ local string_gsub = string.gsub; local string_format = string.format; local string_match = string.match; local function GetScrollingMessageFrame() - return DEFAULT_CHAT_FRAME or DeveloperConsole.MessageFrame; + return DEFAULT_CHAT_FRAME or DeveloperConsole.MessageFrame; end local function WriteMessage(msg) - GetScrollingMessageFrame():AddMessage(msg); + GetScrollingMessageFrame():AddMessage(msg); end local function prepSimple(val, context) - local valType = type(val); - if (valType == "nil") then - return "nil"; - elseif (valType == "number") then - return val; - elseif (valType == "boolean") then - if (val) then - return "true"; - else - return "false"; - end - elseif (valType == "string") then - local l = string_len(val); - if ((l > DEVTOOLS_LONG_STRING_CUTOFF) and - (DEVTOOLS_LONG_STRING_CUTOFF > 0)) then - local more = l - DEVTOOLS_LONG_STRING_CUTOFF; - val = string_sub(val, 1, DEVTOOLS_LONG_STRING_CUTOFF); - return string_gsub(string_format("%q...+%s",val,more),"[|]", "||"); - else - return string_gsub(string_format("%q",val),"[|]", "||"); - end - elseif (valType == "function") then - local fName = context:GetFunctionName(val); - if (fName) then - return string_format(FORMATS.opaqueTypeKeyName, valType, fName); - else - return string_format(FORMATS.opaqueTypeKey, valType); - end - return string_format(FORMATS.opaqueTypeKey, valType); - elseif (valType == "userdata") then - local uName = context:GetUserdataName(val); - if (uName) then - return string_format(FORMATS.opaqueTypeKeyName, valType, uName); - else - return string_format(FORMATS.opaqueTypeKey, valType); - end - elseif (valType == 'table') then - local tName = context:GetTableName(val); - if (tName) then - return string_format(FORMATS.opaqueTypeKeyName, valType, tName); - else - return string_format(FORMATS.opaqueTypeKey, valType); - end - end - error("Bad type '" .. valType .. "' to prepSimple"); + local valType = type(val); + if (valType == "nil") then + return "nil"; + elseif (valType == "number") then + return val; + elseif (valType == "boolean") then + if (val) then + return "true"; + else + return "false"; + end + elseif (valType == "string") then + local l = string_len(val); + if ((l > DEVTOOLS_LONG_STRING_CUTOFF) and + (DEVTOOLS_LONG_STRING_CUTOFF > 0)) then + local more = l - DEVTOOLS_LONG_STRING_CUTOFF; + val = string_sub(val, 1, DEVTOOLS_LONG_STRING_CUTOFF); + return string_gsub(string_format("%q...+%s",val,more),"[|]", "||"); + else + return string_gsub(string_format("%q",val),"[|]", "||"); + end + elseif (valType == "function") then + local fName = context:GetFunctionName(val); + if (fName) then + return string_format(FORMATS.opaqueTypeKeyName, valType, fName); + else + return string_format(FORMATS.opaqueTypeKey, valType); + end + return string_format(FORMATS.opaqueTypeKey, valType); + elseif (valType == "userdata") then + local uName = context:GetUserdataName(val); + if (uName) then + return string_format(FORMATS.opaqueTypeKeyName, valType, uName); + else + return string_format(FORMATS.opaqueTypeKey, valType); + end + elseif (valType == 'table') then + local tName = context:GetTableName(val); + if (tName) then + return string_format(FORMATS.opaqueTypeKeyName, valType, tName); + else + return string_format(FORMATS.opaqueTypeKey, valType); + end + end + error("Bad type '" .. valType .. "' to prepSimple"); end local function prepSimpleKey(val, context) - local valType = type(val); - if (valType == "string") then - local l = string_len(val); - if ((l <= DEVTOOLS_LONG_STRING_CUTOFF) or - (DEVTOOLS_LONG_STRING_CUTOFF <= 0)) then - if (string_match(val, "^[a-zA-Z_][a-zA-Z0-9_]*$")) then - return val; - end - end - end - return string_format(FORMATS.bracketTableKey, prepSimple(val, context)); + local valType = type(val); + if (valType == "string") then + local l = string_len(val); + if ((l <= DEVTOOLS_LONG_STRING_CUTOFF) or + (DEVTOOLS_LONG_STRING_CUTOFF <= 0)) then + if (string_match(val, "^[a-zA-Z_][a-zA-Z0-9_]*$")) then + return val; + end + end + end + return string_format(FORMATS.bracketTableKey, prepSimple(val, context)); end local function DevTools_InitFunctionCache(context) - local ret = {}; - for _,k in ipairs(DT.functionSymbols) do - local v = getglobal(k); - if (type(v) == 'function') then - ret[v] = '[' .. k .. ']'; - end - end - for k,v in pairs(getfenv(0)) do - if (type(v) == 'function') then - if (not ret[v]) then - ret[v] = '[' .. k .. ']'; - end - end - end - return ret; + local ret = {}; + for _,k in ipairs(DT.functionSymbols) do + local v = getglobal(k); + if (type(v) == 'function') then + ret[v] = '[' .. k .. ']'; + end + end + for k,v in pairs(getfenv(0)) do + if (type(v) == 'function') then + if (not ret[v]) then + ret[v] = '[' .. k .. ']'; + end + end + end + return ret; end local function DevTools_InitUserdataCache(context) - local ret = {}; - for _,k in ipairs(DT.userdataSymbols) do - local v = getglobal(k); - if (type(v) == 'table') then - local u = rawget(v,0); - if (type(u) == 'userdata') then - ret[u] = k .. '[0]'; - end - end - end - for k,v in pairs(getfenv(0)) do - if (type(v) == 'table') then - local u = rawget(v, 0); - if (type(u) == 'userdata') then - if (not ret[u]) then - ret[u] = k .. '[0]'; - end - end - end - end - return ret; + local ret = {}; + for _,k in ipairs(DT.userdataSymbols) do + local v = getglobal(k); + if (type(v) == 'table') then + local u = rawget(v,0); + if (type(u) == 'userdata') then + ret[u] = k .. '[0]'; + end + end + end + for k,v in pairs(getfenv(0)) do + if (type(v) == 'table') then + local u = rawget(v, 0); + if (type(u) == 'userdata') then + if (not ret[u]) then + ret[u] = k .. '[0]'; + end + end + end + end + return ret; end local function DevTools_Cache_Nil(self, value, newName) - return nil; + return nil; end local function DevTools_Cache_Function(self, value, newName) - if (not self.fCache) then - self.fCache = DevTools_InitFunctionCache(self); - end - local name = self.fCache[value]; - if ((not name) and newName) then - self.fCache[value] = newName; - end - return name; + if (not self.fCache) then + self.fCache = DevTools_InitFunctionCache(self); + end + local name = self.fCache[value]; + if ((not name) and newName) then + self.fCache[value] = newName; + end + return name; end local function DevTools_Cache_Userdata(self, value, newName) - if (not self.uCache) then - self.uCache = DevTools_InitUserdataCache(self); - end - local name = self.uCache[value]; - if ((not name) and newName) then - self.uCache[value] = newName; - end - return name; + if (not self.uCache) then + self.uCache = DevTools_InitUserdataCache(self); + end + local name = self.uCache[value]; + if ((not name) and newName) then + self.uCache[value] = newName; + end + return name; end local function DevTools_Cache_Table(self, value, newName) - if (not self.tCache) then - self.tCache = {}; - end - local name = self.tCache[value]; - if ((not name) and newName) then - self.tCache[value] = newName; - end - return name; + if (not self.tCache) then + self.tCache = {}; + end + local name = self.tCache[value]; + if ((not name) and newName) then + self.tCache[value] = newName; + end + return name; end local function DevTools_Write(self, msg) - GetScrollingMessageFrame():AddMessage(msg); + GetScrollingMessageFrame():AddMessage(msg); end local DevTools_DumpValue; local function DevTools_DumpTableContents(val, prefix, firstPrefix, context) - local showCount = 0; - local oldDepth = context.depth; - local oldKey = context.key; - -- Use this to set the cache name - context:GetTableName(val, oldKey or 'value'); - local iter = pairs(val); - local nextK, nextV = iter(val, nil); - while (nextK) do - local k,v = nextK, nextV; - nextK, nextV = iter(val, k); - showCount = showCount + 1; - if ((showCount <= DEVTOOLS_MAX_ENTRY_CUTOFF) or - (DEVTOOLS_MAX_ENTRY_CUTOFF <= 0)) then - local prepKey = prepSimpleKey(k, context); - if (oldKey == nil) then - context.key = prepKey; - elseif (string_sub(prepKey, 1, 1) == "[") then - context.key = oldKey .. prepKey - else - context.key = oldKey .. "." .. prepKey - end - context.depth = oldDepth + 1; - local rp = string_format(FORMATS.tableKeyAssignPrefix, firstPrefix, - prepKey); - firstPrefix = prefix; - DevTools_DumpValue(v, prefix, rp, - (nextK and ",") or '', - context); - end - end - local cutoff = showCount - DEVTOOLS_MAX_ENTRY_CUTOFF; - if ((cutoff > 0) and (DEVTOOLS_MAX_ENTRY_CUTOFF > 0)) then - context:Write(string_format(FORMATS.tableEntriesSkipped,firstPrefix, - cutoff)); - end - context.key = oldKey; - context.depth = oldDepth; - return (showCount > 0) + local showCount = 0; + local oldDepth = context.depth; + local oldKey = context.key; + -- Use this to set the cache name + context:GetTableName(val, oldKey or 'value'); + local iter = pairs(val); + local nextK, nextV = iter(val, nil); + while (nextK) do + local k,v = nextK, nextV; + nextK, nextV = iter(val, k); + showCount = showCount + 1; + if ((showCount <= DEVTOOLS_MAX_ENTRY_CUTOFF) or + (DEVTOOLS_MAX_ENTRY_CUTOFF <= 0)) then + local prepKey = prepSimpleKey(k, context); + if (oldKey == nil) then + context.key = prepKey; + elseif (string_sub(prepKey, 1, 1) == "[") then + context.key = oldKey .. prepKey + else + context.key = oldKey .. "." .. prepKey + end + context.depth = oldDepth + 1; + local rp = string_format(FORMATS.tableKeyAssignPrefix, firstPrefix, + prepKey); + firstPrefix = prefix; + DevTools_DumpValue(v, prefix, rp, + (nextK and ",") or '', + context); + end + end + local cutoff = showCount - DEVTOOLS_MAX_ENTRY_CUTOFF; + if ((cutoff > 0) and (DEVTOOLS_MAX_ENTRY_CUTOFF > 0)) then + context:Write(string_format(FORMATS.tableEntriesSkipped,firstPrefix, + cutoff)); + end + context.key = oldKey; + context.depth = oldDepth; + return (showCount > 0) end -- Return the specified value function DevTools_DumpValue(val, prefix, firstPrefix, suffix, context) - local valType = type(val); - if (valType == "userdata") then - local uName = context:GetUserdataName(val, 'value'); - if (uName) then - context:Write(string_format(FORMATS.opaqueTypeValName, - firstPrefix, valType, uName, suffix)); - else - context:Write(string_format(FORMATS.opaqueTypeVal, - firstPrefix, valType, suffix)); - end - return; - elseif (valType == "function") then - local fName = context:GetFunctionName(val, 'value'); - if (fName) then - context:Write(string_format(FORMATS.opaqueTypeValName, - firstPrefix, valType, fName, suffix)); - else - context:Write(string_format(FORMATS.opaqueTypeVal, - firstPrefix, valType, suffix)); - end - return; - elseif (valType ~= "table") then - context:Write(string_format(FORMATS.simpleValue, - firstPrefix,prepSimple(val, context), - suffix)); - return; - end - local cacheName = context:GetTableName(val); - if (cacheName) then - context:Write(string_format(FORMATS.tableReference, - firstPrefix, cacheName, suffix)); - return; - end - if ((context.depth >= DEVTOOLS_DEPTH_CUTOFF) and - (DEVTOOLS_DEPTH_CUTOFF > 0)) then - context:Write(string_format(FORMATS.tableTooDeep, - firstPrefix, suffix)); - return; - end - firstPrefix = firstPrefix .. "{"; - local oldPrefix = prefix; - prefix = prefix .. DEVTOOLS_INDENT; - context:Write(firstPrefix); - firstPrefix = prefix; - local anyContents = DevTools_DumpTableContents(val, prefix, firstPrefix, - context); - context:Write(oldPrefix .. "}" .. suffix); + local valType = type(val); + if (valType == "userdata") then + local uName = context:GetUserdataName(val, 'value'); + if (uName) then + context:Write(string_format(FORMATS.opaqueTypeValName, + firstPrefix, valType, uName, suffix)); + else + context:Write(string_format(FORMATS.opaqueTypeVal, + firstPrefix, valType, suffix)); + end + return; + elseif (valType == "function") then + local fName = context:GetFunctionName(val, 'value'); + if (fName) then + context:Write(string_format(FORMATS.opaqueTypeValName, + firstPrefix, valType, fName, suffix)); + else + context:Write(string_format(FORMATS.opaqueTypeVal, + firstPrefix, valType, suffix)); + end + return; + elseif (valType ~= "table") then + context:Write(string_format(FORMATS.simpleValue, + firstPrefix,prepSimple(val, context), + suffix)); + return; + end + local cacheName = context:GetTableName(val); + if (cacheName) then + context:Write(string_format(FORMATS.tableReference, + firstPrefix, cacheName, suffix)); + return; + end + if ((context.depth >= DEVTOOLS_DEPTH_CUTOFF) and + (DEVTOOLS_DEPTH_CUTOFF > 0)) then + context:Write(string_format(FORMATS.tableTooDeep, + firstPrefix, suffix)); + return; + end + firstPrefix = firstPrefix .. "{"; + local oldPrefix = prefix; + prefix = prefix .. DEVTOOLS_INDENT; + context:Write(firstPrefix); + firstPrefix = prefix; + local anyContents = DevTools_DumpTableContents(val, prefix, firstPrefix, + context); + context:Write(oldPrefix .. "}" .. suffix); end local function Pick_Cache_Function(func, setting) - if (setting) then - return func; - else - return DevTools_Cache_Nil; - end + if (setting) then + return func; + else + return DevTools_Cache_Nil; + end end function DevTools_RunDump(value, context) - local prefix = ""; - local firstPrefix = prefix; - local valType = type(value); - if (type(value) == 'table') then - local any = - DevTools_DumpTableContents(value, prefix, firstPrefix, context); - if (context.Result) then - return context:Result(); - end - if (not any) then - context:Write("empty result"); - end - return; - end - DevTools_DumpValue(value, '', '', '', context); - if (context.Result) then - return context:Result(); - end + local prefix = ""; + local firstPrefix = prefix; + local valType = type(value); + if (type(value) == 'table') then + local any = + DevTools_DumpTableContents(value, prefix, firstPrefix, context); + if (context.Result) then + return context:Result(); + end + if (not any) then + context:Write("empty result"); + end + return; + end + DevTools_DumpValue(value, '', '', '', context); + if (context.Result) then + return context:Result(); + end end -- Dump the specified list of value function DevTools_Dump(value, startKey) - local context = { - depth = 0, - key = startKey, - }; - context.GetTableName = Pick_Cache_Function(DevTools_Cache_Table, - DEVTOOLS_USE_TABLE_CACHE); - context.GetFunctionName = Pick_Cache_Function(DevTools_Cache_Function, - DEVTOOLS_USE_FUNCTION_CACHE); - context.GetUserdataName = Pick_Cache_Function(DevTools_Cache_Userdata, - DEVTOOLS_USE_USERDATA_CACHE); - context.Write = DevTools_Write; - DevTools_RunDump(value, context); + local context = { + depth = 0, + key = startKey, + }; + context.GetTableName = Pick_Cache_Function(DevTools_Cache_Table, + DEVTOOLS_USE_TABLE_CACHE); + context.GetFunctionName = Pick_Cache_Function(DevTools_Cache_Function, + DEVTOOLS_USE_FUNCTION_CACHE); + context.GetUserdataName = Pick_Cache_Function(DevTools_Cache_Userdata, + DEVTOOLS_USE_USERDATA_CACHE); + context.Write = DevTools_Write; + DevTools_RunDump(value, context); end function DevTools_DumpCommand(msg, editBox) - forceinsecure(); - if (string_match(msg,"^[A-Za-z_][A-Za-z0-9_]*$")) then - WriteMessage("Dump: " .. msg); - local val = _G[msg]; - local tmp = {}; - if (val == nil) then - local key = string_format(FORMATS.tableKeyAssignPrefix, - '', prepSimpleKey(msg, {})); - WriteMessage(key .. "nil,"); - else - tmp[msg] = val; - end - DevTools_Dump(tmp); - return; - end - WriteMessage("Dump: value=" .. msg); - local func,err = loadstring("return " .. msg); - if (not func) then - WriteMessage("Dump: ERROR: " .. err); - else - DevTools_Dump({ func() }, "value"); - end + forceinsecure(); + if (string_match(msg,"^[A-Za-z_][A-Za-z0-9_]*$")) then + WriteMessage("Dump: " .. msg); + local val = _G[msg]; + local tmp = {}; + if (val == nil) then + local key = string_format(FORMATS.tableKeyAssignPrefix, + '', prepSimpleKey(msg, {})); + WriteMessage(key .. "nil,"); + else + tmp[msg] = val; + end + DevTools_Dump(tmp); + return; + end + WriteMessage("Dump: value=" .. msg); + local func,err = loadstring("return " .. msg); + if (not func) then + WriteMessage("Dump: ERROR: " .. err); + else + DevTools_Dump({ func() }, "value"); + end end DT.functionSymbols = {}; DT.userdataSymbols = {}; local funcSyms = DT.functionSymbols; local userSyms = DT.userdataSymbols; for k,v in pairs(getfenv(0)) do - if (type(v) == 'function') then - table.insert(funcSyms, k); - elseif (type(v) == 'table') then - if (type(rawget(v,0)) == 'userdata') then - table.insert(userSyms, k); - end - end + if (type(v) == 'function') then + table.insert(funcSyms, k); + elseif (type(v) == 'table') then + if (type(rawget(v,0)) == 'userdata') then + table.insert(userSyms, k); + end + end end \ No newline at end of file diff --git a/wotlk/Talented/IndexMatching.lua b/wotlk/Talented/IndexMatching.lua index 490f5b1..aea278e 100644 --- a/wotlk/Talented/IndexMatching.lua +++ b/wotlk/Talented/IndexMatching.lua @@ -6,7 +6,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Talented") function Talented:convertOrderedTalentIndexToWowIndex(classNameToLookup, talentSpecNumber, orderedTalentIndex) -- return Talented_Data[classNameToLookup][talentSpecNumber].talents[orderedTalentIndex].info.wowTreeIndex - return indexToWowIndex[classNameToLookup][talentSpecNumber][orderedTalentIndex] + return indexToWowIndex[classNameToLookup][talentSpecNumber][orderedTalentIndex] end function Talented:convertWowTalentIndexToOrderedIndex(classNameToLookup, talentSpecNumber, wowTalentIndex) @@ -16,91 +16,95 @@ function Talented:convertWowTalentIndexToOrderedIndex(classNameToLookup, talentS -- return index -- end -- end - local list = indexToWowIndex[classNameToLookup][talentSpecNumber] - for k, v in pairs(list) do - if v==wowTalentIndex then - return k - end - end - return nil + local list = indexToWowIndex[classNameToLookup][talentSpecNumber] + for k, v in pairs(list) do + if v==wowTalentIndex then + return k + end + end + return nil end function Talented:OrderedLearnTalent(class, tab, index, isPet) - mappedIndex = Talented:convertOrderedTalentIndexToWowIndex(class, tab, index) - return LearnTalent(tab, mappedIndex, isPet) + local mappedIndex = Talented:convertOrderedTalentIndexToWowIndex(class, tab, index) + local talentGroup = GetActiveTalentGroup(nil, isPet) + return LearnTalent(tab, mappedIndex, isPet, talentGroup) end function Talented:OrderedGetTalentInfo(class, tab, index, isInspect, isPet, talentGroup) - --isInspect: the talents of the player we are inspecting, instead of player talents - --isPet: pet talents, instead of player talents - --talentGroup: 1 for primary talents, 2 for secondary talents, nil for current talents - mappedIndex = Talented:convertOrderedTalentIndexToWowIndex(class, tab, index) - -- print(class, tab, index, "|", tab, mappedIndex, isInspect, isPet, talentGroup) - return GetTalentInfo(tab, mappedIndex, isInspect, isPet, talentGroup) + --isInspect: the talents of the player we are inspecting, instead of player talents + --isPet: pet talents, instead of player talents + --talentGroup: 1 for primary talents, 2 for secondary talents, nil for current talents + local mappedIndex = Talented:convertOrderedTalentIndexToWowIndex(class, tab, index) + talentGroup = talentGroup or GetActiveTalentGroup(isInspect, isPet) + -- print(class, tab, index, "|", tab, mappedIndex, isInspect, isPet, talentGroup) + return GetTalentInfo(tab, mappedIndex, isInspect, isPet, talentGroup) end function Talented:OrderedTalentPrereqs(class, tab, index) - mappedIndex = Talented:convertOrderedTalentIndexToWowIndex(class, tab, index) - return GetTalentPrereqs(tab, mappedIndex) - --n.b. return values are tier, column, isLearnable. They don't need to be mapped back. + local mappedIndex = Talented:convertOrderedTalentIndexToWowIndex(class, tab, index) + return GetTalentPrereqs(tab, mappedIndex) + --n.b. return values are tier, column, isLearnable. They don't need to be mapped back. end indexToWowIndex = { - DEATHKNIGHT = { - {3, 8, 21, 2, 9, 27, 4, 6, 25, 5, 22, 12, 20, 11, 10, 7, 26, 18, 13, 1, 28, 14, 23, 17, 15, 16, 24, 19}, - {19, 15, 1, 20, 3, 16, 22, 26, 24, 23, 7, 2, 9, 18, 6, 27, 11, 10, 28, 14, 17, 29, 25, 5, 12, 4, 21, 13, 8}, - {24, 1, 27, 5, 2, 19, 3, 15, 23, 7, 21, 12, 29, 8, 13, 17, 30, 16, 10, 6, 31, 28, 18, 25, 4, 14, 11, 22, 26, 20, 9} - }, - DRUID = { - {1, 26, 5, 18, 2, 4, 8, 28, 3, 10, 6, 12, 7, 27, 14, 9, 13, 11, 19, 15, 20, 16, 22, 21, 17, 23, 25, 24}, - {3, 2, 6, 11, 1, 12, 15, 5, 8, 9, 7, 22, 4, 10, 16, 29, 13, 18, 14, 21, 17, 28, 19, 24, 26, 20, 25, 23, 30, 27}, - {1, 3, 2, 4, 12, 6, 9, 7, 21, 14, 10, 11, 8, 13, 16, 5, 20, 15, 18, 17, 24, 25, 19, 26, 27, 22, 23} - }, - HUNTER = { - {2, 8, 14, 1, 11, 15, 3, 23, 12, 4, 10, 7, 6, 9, 16, 13, 17, 5, 18, 21, 19, 25, 20, 22, 26, 24}, - {1, 27, 4, 15, 3, 9, 18, 6, 5, 19, 8, 2, 10, 11, 7, 14, 13, 21, 12, 20, 16, 22, 23, 17, 24, 25, 26}, - {14, 21, 12, 6, 2, 3, 16, 13, 20, 7, 5, 28, 4, 27, 9, 8, 1, 15, 18, 11, 17, 19, 22, 23, 10, 24, 25, 26} - }, - MAGE = { - {1, 3, 5, 9, 15, 2, 7, 6, 25, 29, 8, 12, 14, 30, 16, 10, 4, 18, 13, 17, 19, 11, 24, 23, 20, 21, 28, 26, 22, 27}, - {5, 15, 4, 12, 28, 9, 6, 8, 7, 1, 3, 2, 16, 17, 11, 10, 18, 13, 20, 14, 19, 23, 21, 24, 22, 25, 26, 27}, - {2, 1, 4, 15, 12, 17, 7, 3, 11, 5, 16, 8, 9, 14, 6, 18, 19, 10, 28, 13, 20, 21, 23, 24, 22, 25, 26, 27} - }, - PALADIN = { - {1, 10, 5, 7, 14, 3, 9, 4, 8, 6, 25, 15, 2, 11, 16, 13, 18, 12, 17, 21, 19, 20, 26, 24, 22, 23}, - {9, 18, 13, 4, 12, 24, 10, 3, 25, 11, 2, 8, 5, 14, 6, 26, 7, 15, 1, 16, 20, 17, 19, 23, 22, 21}, - {3, 4, 10, 8, 1, 12, 6, 9, 13, 11, 19, 14, 5, 15, 2, 16, 25, 7, 17, 18, 21, 22, 20, 26, 23, 24} - }, - PRIEST = { - {4, 25, 12, 7, 6, 1, 8, 9, 5, 15, 3, 10, 28, 13, 11, 16, 17, 20, 2, 18, 27, 23, 21, 22, 19, 26, 14, 24}, - {8, 6, 2, 9, 12, 11, 15, 1, 14, 7, 4, 10, 13, 3, 18, 5, 20, 16, 17, 27, 19, 24, 22, 21, 23, 25, 26}, - {4, 26, 2, 5, 7, 3, 13, 6, 10, 8, 14, 1, 12, 9, 15, 16, 19, 27, 11, 17, 21, 20, 23, 18, 24, 22, 25} - }, - ROGUE = { - {7, 4, 3, 5, 24, 8, 14, 9, 2, 15, 1, 19, 11, 10, 21, 13, 6, 22, 12, 20, 25, 17, 16, 18, 23, 26, 27}, - {7, 6, 11, 23, 5, 1, 8, 15, 2, 10, 12, 4, 16, 3, 13, 14, 17, 19, 18, 9, 20, 24, 22, 25, 21, 26, 27, 28}, - {28, 1, 6, 15, 7, 2, 5, 11, 14, 4, 3, 8, 16, 10, 9, 13, 20, 17, 18, 12, 22, 19, 23, 24, 21, 25, 26, 27} - }, - SHAMAN = { - {4, 3, 1, 11, 14, 9, 8, 5, 6, 13, 12, 2, 15, 16, 10, 7, 22, 25, 19, 17, 20, 18, 21, 24, 23}, - {6, 27, 9, 5, 8, 3, 4, 7, 12, 1, 2, 10, 15, 11, 26, 16, 14, 29, 19, 17, 13, 22, 28, 21, 18, 20, 23, 24, 25}, - {4, 13, 7, 14, 11, 3, 5, 2, 1, 6, 12, 15, 9, 16, 10, 20, 8, 26, 22, 18, 17, 23, 19, 21, 24, 25} - }, - WARLOCK = { - {15, 5, 3, 6, 14, 7, 4, 27, 1, 12, 8, 2, 21, 20, 10, 13, 22, 11, 25, 18, 9, 17, 16, 23, 19, 28, 24, 26}, - {1, 2, 3, 23, 4, 5, 8, 9, 15, 6, 17, 12, 7, 14, 11, 10, 16, 20, 21, 13, 19, 27, 22, 18, 24, 25, 26}, - {3, 2, 12, 21, 1, 13, 5, 9, 14, 6, 7, 20, 4, 11, 19, 8, 10, 18, 15, 17, 23, 22, 16, 26, 24, 25} - }, - WARRIOR = { - {3, 9, 6, 5, 17, 7, 10, 16, 18, 1, 15, 29, 11, 12, 4, 2, 13, 8, 24, 21, 14, 26, 30, 31, 23, 25, 20, 19, 22, 28, 27}, - {27, 5, 4, 8, 6, 10, 7, 12, 1, 16, 14, 2, 18, 9, 15, 13, 3, 21, 11, 17, 22, 19, 25, 20, 23, 26, 24}, - {4, 15, 3, 5, 1, 13, 7, 18, 2, 27, 11, 6, 10, 12, 9, 14, 16, 8, 19, 17, 21, 25, 20, 24, 22, 26, 23} - }, - Tenacity = {{ 2,17,3,4,7,8,16,5,1,6,10,20,9,11,14,13,15,12,18,19 }}, - Cunning = {{ 1,16,3,4,6,19,13,5,7,8,17,9,11,14,12,15,10,21,20,22 }}, - Ferocity = {{ 2,3,5,6,7,9,8,11,1,12,4,16,10,14,15,13,17,21,20 }} + DEATHKNIGHT = { + {3, 8, 21, 2, 9, 27, 4, 6, 25, 5, 22, 12, 20, 11, 10, 7, 26, 18, 13, 1, 28, 14, 23, 17, 15, 16, 24, 19}, + {19, 15, 1, 20, 3, 16, 22, 26, 24, 23, 7, 2, 9, 18, 6, 27, 11, 10, 28, 14, 17, 29, 25, 5, 12, 4, 21, 13, 8}, + {24, 1, 27, 5, 2, 19, 3, 15, 23, 7, 21, 12, 29, 8, 13, 17, 30, 16, 10, 6, 31, 28, 18, 25, 4, 14, 11, 22, 26, 20, 9} + }, + DRUID = { + {1, 26, 5, 18, 2, 4, 8, 28, 3, 10, 6, 12, 7, 27, 14, 9, 13, 11, 19, 15, 20, 16, 22, 21, 17, 23, 25, 24}, + {3, 2, 6, 11, 1, 12, 15, 5, 8, 9, 7, 22, 4, 10, 16, 29, 13, 18, 14, 21, 17, 28, 19, 24, 26, 20, 25, 23, 30, 27}, + {1, 3, 2, 4, 12, 6, 9, 7, 21, 14, 10, 11, 8, 13, 16, 5, 20, 15, 18, 17, 24, 25, 19, 26, 27, 22, 23} + }, + HUNTER = { + {2, 8, 14, 1, 11, 15, 3, 23, 12, 4, 10, 7, 6, 9, 16, 13, 17, 5, 18, 21, 19, 25, 20, 22, 26, 24}, + {1, 27, 4, 15, 3, 9, 18, 6, 5, 19, 8, 2, 10, 11, 7, 14, 13, 21, 12, 20, 16, 22, 23, 17, 24, 25, 26}, + {14, 21, 12, 6, 2, 3, 16, 13, 20, 7, 5, 28, 4, 27, 9, 8, 1, 15, 18, 11, 17, 19, 22, 23, 10, 24, 25, 26} + }, + MAGE = { + {1, 3, 5, 9, 15, 2, 7, 6, 25, 29, 8, 12, 14, 30, 16, 10, 4, 18, 13, 17, 19, 11, 24, 23, 20, 21, 28, 26, 22, 27}, + {5, 15, 4, 12, 28, 9, 6, 8, 7, 1, 3, 2, 16, 17, 11, 10, 18, 13, 20, 14, 19, 23, 21, 24, 22, 25, 26, 27}, + {2, 1, 4, 15, 12, 17, 7, 3, 11, 5, 16, 8, 9, 14, 6, 18, 19, 10, 28, 13, 20, 21, 23, 24, 22, 25, 26, 27} + }, + PALADIN = { + {1, 10, 5, 7, 14, 3, 9, 4, 8, 6, 25, 15, 2, 11, 16, 13, 18, 12, 17, 21, 19, 20, 26, 24, 22, 23}, + {9, 18, 13, 4, 12, 24, 10, 3, 25, 11, 2, 8, 5, 14, 6, 26, 7, 15, 1, 16, 20, 17, 19, 23, 22, 21}, + {3, 4, 10, 8, 1, 12, 6, 9, 13, 11, 19, 14, 5, 15, 2, 16, 25, 7, 17, 18, 21, 22, 20, 26, 23, 24} + }, + PRIEST = { + {4, 25, 12, 7, 6, 1, 8, 9, 5, 15, 3, 10, 28, 13, 11, 16, 17, 20, 2, 18, 27, 23, 21, 22, 19, 26, 14, 24}, + {8, 6, 2, 9, 12, 11, 15, 1, 14, 7, 4, 10, 13, 3, 18, 5, 20, 16, 17, 27, 19, 24, 22, 21, 23, 25, 26}, + {4, 26, 2, 5, 7, 3, 13, 6, 10, 8, 14, 1, 12, 9, 15, 16, 19, 27, 11, 17, 21, 20, 23, 18, 24, 22, 25} + }, + ROGUE = { + {7, 4, 3, 5, 24, 8, 14, 9, 2, 15, 1, 19, 11, 10, 21, 13, 6, 22, 12, 20, 25, 17, 16, 18, 23, 26, 27}, + {7, 6, 11, 23, 5, 1, 8, 15, 2, 10, 12, 4, 16, 3, 13, 14, 17, 19, 18, 9, 20, 24, 22, 25, 21, 26, 27, 28}, + {28, 1, 6, 15, 7, 2, 5, 11, 14, 4, 3, 8, 16, 10, 9, 13, 20, 17, 18, 12, 22, 19, 23, 24, 21, 25, 26, 27} + }, + SHAMAN = { + {4, 3, 1, 11, 14, 9, 8, 5, 6, 13, 12, 2, 15, 16, 10, 7, 22, 25, 19, 17, 20, 18, 21, 24, 23}, + {6, 27, 9, 5, 8, 3, 4, 7, 12, 1, 2, 10, 15, 11, 26, 16, 14, 29, 19, 17, 13, 22, 28, 21, 18, 20, 23, 24, 25}, + {4, 13, 7, 14, 11, 3, 5, 2, 1, 6, 12, 15, 9, 16, 10, 20, 8, 26, 22, 18, 17, 23, 19, 21, 24, 25} + }, + WARLOCK = { + {15, 5, 3, 6, 14, 7, 4, 27, 1, 12, 8, 2, 21, 20, 10, 13, 22, 11, 25, 18, 9, 17, 16, 23, 19, 28, 24, 26}, + {1, 2, 3, 23, 4, 5, 8, 9, 15, 6, 17, 12, 7, 14, 11, 10, 16, 20, 21, 13, 19, 27, 22, 18, 24, 25, 26}, + {3, 2, 12, 21, 1, 13, 5, 9, 14, 6, 7, 20, 4, 11, 19, 8, 10, 18, 15, 17, 23, 22, 16, 26, 24, 25} + }, + WARRIOR = { + {3, 9, 6, 5, 17, 7, 10, 16, 18, 1, 15, 29, 11, 12, 4, 2, 13, 8, 24, 21, 14, 26, 30, 31, 23, 25, 20, 19, 22, 28, 27}, + {27, 5, 4, 8, 6, 10, 7, 12, 1, 16, 14, 2, 18, 9, 15, 13, 3, 21, 11, 17, 22, 19, 25, 20, 23, 26, 24}, + {4, 15, 3, 5, 1, 13, 7, 18, 2, 27, 11, 6, 10, 12, 9, 14, 16, 8, 19, 17, 21, 25, 20, 24, 22, 26, 23} + }, + Tenacity = {{ 2,17,3,4,7,8,16,5,1,6,10,20,9,11,14,13,15,12,18,19 }}, + -- TODO: Maybe only for WoTLK Chinese Client + -- Cunning = {{ 1,16,3,4,6,19,13,5,7,8,17,9,11,14,12,15,10,21,20,22 }}, + Cunning = {{ 1,2,3,4,6,18,13,5,7,8,17,9,11,14,12,15,10,21,20,22 }}, + Ferocity = {{ 2,3,5,6,7,9,8,11,1,12,4,16,10,14,15,13,17,21,20 }} } --How to acquire these? -- Play each class in turn -- and get a pet of each kind on a hunter -- and run - -- /script Talented:PrintSortedWoWIndices() + -- /script Talented:PrintSortedWoWIndices() -- That will produce the indices. -- You may also need to get the spellIDs and put them into spelldata.lua. The easiest way is to look at the page source of the list of abilities in WoWHead (e.g. view-source:https://www.wowhead.com/wotlk/spells/pet-abilities/hunter/generic#0+1+20 ) and map the names to the IDs with some code. diff --git a/wotlk/Talented/Locales/zhCN.lua b/wotlk/Talented/Locales/zhCN.lua index eaa814f..f678f43 100644 --- a/wotlk/Talented/Locales/zhCN.lua +++ b/wotlk/Talented/Locales/zhCN.lua @@ -1,6 +1,8 @@ local L = LibStub:GetLibrary("AceLocale-3.0"):NewLocale("Talented", "zhCN") if not L then return end +L['CONFIRM_TALENT_WIPE_TEXT'] = "你想遗忘你所有的天赋吗?这将取消召唤任何被控制的宠物,并且每次费用都会增加。"; + L["Talented - Talent Editor"] = "Talented - 天赋编辑器" L["Layout options"] = "样式选项" @@ -32,7 +34,7 @@ L["Output URL in Chat"] = "输出链接到聊天框" L["Directly outputs the URL in Chat instead of using a Dialog."] = "直接输出链接到聊天框。" L["Inspected Characters"] = "观察过的玩家" ---~ L["Talent trees of inspected characters."] = "" +--~ L["Talent trees of inspected characters."] = "观察过的玩家的天赋树" L["Edit template"] = "编辑模板" L["Edit talents"] = "编辑天赋" L["Toggle edition of the template."] = "编辑天赋模板。" @@ -52,7 +54,7 @@ L["Effective tooltip information not available"] = "无有效鼠标提示信息" L["You have %d talent |4point:points; left"] = "您还有%d点天赋点数剩余" L["Are you sure that you want to learn \"%s (%d/%d)\" ?"] = "是否确认学习\“%s (%d/%d)\”?" ---~ L["Open the Talented options panel."] = "" +--~ L["Open the Talented options panel."] = "打开 Talented 选项面板" --~ L["View Current Spec"] = "查看当前配置方案" L["View the Current spec in the Talented frame."] = "在天赋面板上查看当前配置方案。" @@ -92,10 +94,10 @@ L["Error while applying talents! some of the request talents were not set!"] = " L["Error! Talented window has been closed during template application. Please reapply later."] = "天赋面板在应用过程中被关闭!请稍候重新应用。" L["Talent application has been cancelled. %d talent points remaining."] = "应用天赋操作取消,剩余%d天赋点数。" L["Template applied successfully, %d talent points remaining."] = "成功应用模板,剩余%d天赋点数。" +L["Warning - no action was taken, or we ran out of talent points."] = true --TODO: Localise! L["Talented_Data is outdated. It was created for %q, but current build is %q. Please update."] = "Talented_Data 已过期。创建数据属于%q版本,但当前客户端版本是%q。请进行升级。" L["Loading outdated data. |cffff1010WARNING:|r Recent changes in talent trees might not be included in this data."] = "加载过期数据。 |cffff1010警告:|r最新的天赋树改动可能不包含在该数据中。" L["\"%s\" does not appear to be a valid URL!"] = "\"%s\"看起来不是一个有效的链接!" -L["Warning - no action was taken, or we ran out of talent points."] = true --TODO: Localise! L["Import template ..."] = "导入模板…" L["Enter the complete URL of a template from Blizzard talent calculator or wowhead."] = "请粘帖从暴雪官方或 Wowhead 的天赋模拟器获得的天赋配置链接。" @@ -130,6 +132,9 @@ L[" (alt)"] = "(alt)" L["The following templates are no longer valid and have been removed:"] = "以下模板已失效并已被删除:" L["The following templates were converted from a previous version of the addon. Ensure that none are 'invalid' (below); retrieve the backup of your config file from the WTF folder if so."] = true +L["The template '%s' is no longer valid and has been removed."] = "模版 '%s' 失效,已被移除。" +L["The template '%s' had inconsistencies and has been fixed. Please check it before applying."] = "模板 '%s' 冲突,现已修复。请在应用前检查。" + L["Lock frame"] = "锁定框体" L["Can not apply, unknown template \"%s\""] = "不能接受,未知模板\"%s\"" @@ -145,6 +150,8 @@ L["Display options"] = "显示选项" L["Add bottom offset"] = "添加底部偏移" L["Add some space below the talents to show the bottom information."] = "在天赋下面添加间距以显示底部信息。" +L["Right-click to activate this spec"] = "右击激活此天赋" + --~ L["Mode of operation."] = "" --~ L["Toggle editing of the template."] = "" @@ -200,6 +207,7 @@ L["Add some space below the talents to show the bottom information."] = "在天 --~ L["Clone selected"] = "" --~ L["Make a copy of the current template."] = "" +--Locales for new template options L["Template"] = "方案" L["New Template"] = "新建方案" L["Create a new Template."] = "建立一个新的天赋方案" diff --git a/wotlk/Talented/apply.lua b/wotlk/Talented/apply.lua index 61b901f..953fb90 100644 --- a/wotlk/Talented/apply.lua +++ b/wotlk/Talented/apply.lua @@ -54,7 +54,6 @@ function Talented:ApplyCurrentTemplate() end function Talented:ApplyNextTalentPoint() - -- Debug variable to check progress local found = false @@ -108,7 +107,7 @@ function Talented:CheckTalentPointsApplied() for tab, tree in ipairs(self:UncompressSpellData(template.class)) do local ttab = template[tab] for index = 1, #tree do - local delta = ttab[index] - select(5, Talented:OrderedGetTalentInfo(template.class, tab, index, nil, pet)) + local delta = ttab[index] - select(5, Talented:OrderedGetTalentInfo(template.class, tab, index, nil, pet, group)) if delta > 0 then failed = true break diff --git a/wotlk/Talented/core.lua b/wotlk/Talented/core.lua index b3c495d..74194da 100644 --- a/wotlk/Talented/core.lua +++ b/wotlk/Talented/core.lua @@ -21,10 +21,10 @@ end function Talented:MakeTarget(targetName) local tar = self.db.char.targets[targetName] local name = nil; local class = nil - if tar then - name = tar.name - class = tar.class - end + if tar then + name = tar.name + class = tar.class + end local src = tar and self.db.global.templates[class] and self.db.global.templates[class][name] if not src then @@ -193,11 +193,11 @@ do function Talented:CreateEmptyTemplate(class) class = class or select(2, UnitClass"player") - + local template = new(self.db.global.templates, L["Empty"], class) local info = self:UncompressSpellData(class) if not info then return end - + for tab, tree in ipairs(info) do local t = {} template[tab] = t @@ -320,17 +320,17 @@ function Talented:PLAYER_TALENT_UPDATE() end function Talented:CONFIRM_TALENT_WIPE(_, cost) - StaticPopupDialogs["CONFIRM_TALENT_WIPE"].text = L['CONFIRM_TALENT_WIPE_TEXT'] --the problem: text for CONFIRM_TALENT_WIPE are nil, eventualy in conjunction of unregisterevent from uiparent??? now let us set the text manually... + StaticPopupDialogs["CONFIRM_TALENT_WIPE"].text = L['CONFIRM_TALENT_WIPE_TEXT'] --the problem: text for CONFIRM_TALENT_WIPE are nil, eventualy in conjunction of unregisterevent from uiparent??? now let us set the text manually... local dialog = StaticPopup_Show("CONFIRM_TALENT_WIPE") if dialog then MoneyFrame_Update(dialog:GetName().."MoneyFrame", cost) local frame = self.base - if not frame or not frame:IsVisible() then + if not frame or not frame:IsVisible() then self:Update() -- ShowUIPanel(self.base) self.base:Show() end - dialog:SetFrameStrata('FULLSCREEN_DIALOG') + dialog:SetFrameStrata('FULLSCREEN_DIALOG') end end @@ -382,39 +382,39 @@ function Talented:Update() end function Talented:is_class(class) - for index, value in ipairs(classes) do - if class == value then - return true - end - end - return false + for index, value in ipairs(classes) do + if class == value then + return true + end + end + return false end function Talented:MakeSubArrays(db) local madeArrays = 0 - for index, class in ipairs(classes) do - if db[class] == nil then + for index, class in ipairs(classes) do + if db[class] == nil then db[class] = {} madeArrays = 1 - - --If there is an existing template named after the class... - elseif type(db[class]) == "string" then - --rename the template - local count = 1 - local name = class - name = format("%s (%d)", name, count) - while db[name] do - count = count + 1 - template.name = format("%s (%d)", name, count) - end - - --THEN make the class sub-array - db[name] = db[class] + + --If there is an existing template named after the class... + elseif type(db[class]) == "string" then + --rename the template + local count = 1 + local name = class + name = format("%s (%d)", name, count) + while db[name] do + count = count + 1 + template.name = format("%s (%d)", name, count) + end + + --THEN make the class sub-array + db[name] = db[class] db[class] = {} madeArrays = 1 - end + end end - + return madeArrays end @@ -426,7 +426,7 @@ function Talented:LoadTemplates() local invalid = {} for class, classdb in pairs(db) do assert(self:is_class(class)) - + for name, code in pairs(classdb) do if type(code) == "string" then db[class][name] = { @@ -440,7 +440,7 @@ function Talented:LoadTemplates() end end end - + if next(invalid) then table.sort(invalid) self:Print(L["The following templates are no longer valid and have been removed:"]) diff --git a/wotlk/Talented/editmode.lua b/wotlk/Talented/editmode.lua index cb23371..840a564 100644 --- a/wotlk/Talented/editmode.lua +++ b/wotlk/Talented/editmode.lua @@ -111,12 +111,12 @@ function Talented:ValidateTemplate(template, fix) local value = t[i] if not value then return end if value > 0 then - if count < (talent.row - 1) * pointsPerTier or value > (talent.inactive and 0 or #talent.ranks) then + if count < (talent.row - 1) * pointsPerTier or value > (talent.inactive and 0 or #talent.ranks) then if fix then t[i], value, fixed = 0, 0, true else return end end local r = talent.req if r then - if t[r] < #tree[r].ranks then + if t[r] < #tree[r].ranks then if fix then t[i], value, fixed = 0, 0, true else return end end end diff --git a/wotlk/Talented/encode.lua b/wotlk/Talented/encode.lua index c3d6c03..c3a8661 100644 --- a/wotlk/Talented/encode.lua +++ b/wotlk/Talented/encode.lua @@ -260,7 +260,7 @@ end function Talented:UnpackTemplate(template) if template.talentGroup or not template.code then return end self:Debug("UNPACK TEMPLATE", template.name) - self:StringToTemplate(template.code, template) + self:StringToTemplate(template.code, template) template.code = nil if not RAID_CLASS_COLORS[template.class] then self:FixPetTemplate(template) diff --git a/wotlk/Talented/inspectui.lua b/wotlk/Talented/inspectui.lua index aee0d94..bda6ab0 100644 --- a/wotlk/Talented/inspectui.lua +++ b/wotlk/Talented/inspectui.lua @@ -62,7 +62,7 @@ -- end -- local _, class = UnitClass(unit) -- local info = self:UncompressSpellData(class) - + -- local template = inspections[template_name] -- if not template then -- template = { diff --git a/wotlk/Talented/pet.lua b/wotlk/Talented/pet.lua index 8efa870..7361b5c 100644 --- a/wotlk/Talented/pet.lua +++ b/wotlk/Talented/pet.lua @@ -36,7 +36,7 @@ function Talented:PET_TALENT_UPDATE() template.talentGroup = talentGroup template.class = class local info = self:UncompressSpellData(class) - if not info then return end + if not info then return end for tab, tree in ipairs(info) do local ttab = template[tab] if not ttab then @@ -72,8 +72,8 @@ function Talented:FixAlternatesTalents(class) local talentGroup = GetActiveTalentGroup(nil, true) if not Talented:OrderedGetTalentInfo(class, 1, 1, nil, true, talentGroup) then return end local data = self:UncompressSpellData(class) - if not data then return end - data = data[1] + if not data then return end + data = data[1] local count = #data - 1 for index = 1, count do local info = data[index] diff --git a/wotlk/Talented/spelldata.lua b/wotlk/Talented/spelldata.lua index 34b2968..f1b645d 100644 --- a/wotlk/Talented/spelldata.lua +++ b/wotlk/Talented/spelldata.lua @@ -7,10 +7,10 @@ Talented.spelldata = { PRIEST = "!14522;14788;14789;14790;14791,47586;47587;47588;52802;52803,%14523;14784;14785,14747;14770;14771,14749;14767,14531;14774,14521;14776;14777,14751,14748;14768;14769,%33167;33171;33172,14520;14780;14781,!14750;14772,33201;33202,18551;18552;18553;18554;18555,f63574,%33186;33190,!34908;34909;34910,%45234;45243;45244,e10060,63504;63505;63506,%57470;57472,47535;47536;47537,47507;47508,%47509;47511;47515,33206,47516;47517,&52795;52797;52798;52799;52800,&47540|14913;15012,14908;15020;17191,14889;15008;15009;15010;15011,&27900;27901;27902;27903;27904,18530;18531;18533;18534;18535,%19236,27811;27815;27816,!14892;15362;15363,27789;27790,14912;15013;15014,f14909;15017,%14911;15018,20711,14901;15028;15029;15030;15031,%33150;33154,!14898;15349;15354;15355;15356,%34753;34859;34860,e724,33142;33145;33146,%64127;64129,33158;33159;33160;33161;33162,63730;63733;63737,%63534;63542;63543,34861,47558;47559;47560,&47562;47564;47565;47566;47567,&47788|15270;15335;15336,a15337;15338,15259;15307;15308;15309;15310,%15318;15272;15320,15275;15317,15260;15327;15328,%15392;15448,15273;15312;15313;15314;15316,15407,&15274;15311,17322;17323,15257;15331;15332,f15487,15286,a27839;27840,33213;33214;33215,14910;33371,!63625;63626;63627,&e15473,33221;33222;33223;33224;33225,%b47569;47570,!33191;33192;33193,%64044,e34914,47580;47581;47582,'47573;47577;47578;51166;51167,&c47585", Tenacity = "61682;61683,61685,61686;61687;61688,61689;61690,53182;53183;53184,19596,d53481;53482,d53175;53176,61680;61681;52858,53178;53179,53409;53411,63900,\"53450;53451,53427;53429;53430,53478,f53477,d53480,53476,!62764;62765,c62758;62762", -- Cunning = "61682;61683,61684,*23145,61686;61687;61688,61689;61690,19596,e53483;53485,*e53554;53555,53514;53516,53182;53183;53184,61680;61681;52858,53409;53411,54044,&53427;53429;53430,52234;53497,f53511;53512,53508,53517,d53490,53450;53451,d62758;62762,\"b53480", - Cunning = "61682;61683,23145,61686;61687;61688,61689;61690,19596,53554,53514;53516,53182;53183;53184,61680;61681;52858,53409;53411,54044,53427;53429;53430,52234;53497,53511;53512,53508,53517,53490,53450;53451,62758;62762,53480", + Cunning = "61682;61683,61684,61686;61687;61688,61689;61690,19596,d53483;53485,53514;53516,53182;53183;53184,61680;61681;52858,53409;53411,54044,&53427;53429;53430,52234;53497,f53511;53512,53508,53517,d53490,53450;53451,d62758;62762,\"b53480", WARLOCK = "18827;18829,18174;18175;18176,17810;17811;17812;17813;17814,%18179;18180,18213;18372,18182;18183,17804;17805,53754;53759,17783;17784;17785,18288,%18218;18219,18094;18095,!32381;32382;32383,32385;32387;32392;32393;32394,63108,f18223,%54037;54038,c18271;18272;18273;18274;18275,%47195;47196;47197,30060;30061;30062;30063;30064,18220,%30054;30057,!32477;32483;32484,%47198;47199;47200,e30108,a58435,&47201;47202;47203;47204;47205,&48181|18692;18693,18694;18695;18696,18697;18698;18699,47230;47231,18703;18704,18705;18706;18707,18731;18743;18744,%18754;18755;18756,19028,18708,30143;30144;30145,!c18769;18770;18771;18772;18773,c18709;18710,%b30326,!18767;18768,&d23785;23822;23823;23824;23825,47245;47246;47247,%30319;30320;30321,c47193,35691;35692;35693,&30242;30245;30246;30247;30248,63156;63158,%b54347;54348;54349,30146,63117;63121;63123,&47236;47237;47238;47239;47240,&59672|!17793;17796;17801;17802;17803,17788;17789;17790;17791;17792,%18119;18120,63349;63350;63351,17778;17779;17780,%18126;18127,17877,17959;59738;59739;59740;59741,%18135;18136,17917;17918,!17927;17929;17930,c34935;34938;34939,17815;17833;17834,f18130,%30299;30301;30302,!17954;17955;17956;17957;17958,&d17962,30293;30295;30296,18096;18073;63245,!30288;30289;30290;30291;30292,c54117;54118,%e47258;47259;47260,30283,47220;47221;47223,&47266;47267;47268;47269;47270,&50796", -- Ferocity = "61682;61683,61684,*23145,61686;61687;61688,61689;61690,53180;53181,53186;53187,53182;53183;53184,19596,61680;61681;52858,!53409;53411,61685,*52825,!g55709,53203;53204;53205,53427;53429;53430,53401,d53426,d53434,%62759;62760,!b62758;62762", - Ferocity = "61682;61683,61684,61686;61687;61688,61689;61690,53180;53181,53186;53187,53182;53183;53184,19596,61680;61681;52858,53409;53411,61685,55709,53203;53204;53205,53427;53429;53430,53401,53426,53434,62759;62760,62758;62762", + Ferocity = "61682;61683,61684,61686;61687;61688,61689;61690,53180;53181,53186;53187,53182;53183;53184,19596,61680;61681;52858,!53409;53411,61685,!f55709,53203;53204;53205,53427;53429;53430,53401,d53426,d53434,%62759;62760,!b62758;62762", HUNTER = "!19552;19553;19554;19555;19556,19583;19584;19585;19586;19587,%35029;35030,19549;19550;19551,19609;19610;19612,24443;19575,19559;19560,53265,19616;19617;19618;19619;19620,&19572;19573,19598;19599;19600;19601;19602,%19578;20895,19577,!19590;19592,34453;34454,!e19621;19622;19623;19624;19625,%34455;34459;34460,e19574,34462;34464;34465,%c53252;53253,!34466;34467;34468;34469;34470,%53262;53263;53264,e34692,c53256;53259;53260,&56314;56315;56316;56317;56318,&53270|19407;19412,53620;53621;53622,19426;19427;19429;19430;19431,%34482;34483;34484,19421;19422;19423,19485;19487;19488;19489;19490,%34950;34954,19454;19455;19456,c19434,34948;34949,!19464;19465;19466,19416;19417;19418;19419;19420,%35100;35102,23989,19461;19462;24691,%34475;34476,\"19507;19508;19509,53234;53237;53238,e19506,e35104;35110;35111,&34485;34486;34487;34488;34489,53228;53232,%53215;53216;53217,c34490,53221;53222;53224,&53241;53243;53244;53245;53246,&53209|52783;52785;52786;52787;52788,19498;19499;19500,19159;19160,%19290;19294;24283,19184;19387;19388,19376;63457;63458,34494;34496,19255;19256;19257;19258;19259,19503,19295;19297;19298,19286;19287,!56333;56336;56337,!56342;56343;56344,f56339;56340;56341,19370;19371;19373,f19306,%19168;19180;19181;24296;24297,!34491;34492;34493,%b34500;34502;34503,e19386,34497;34498;34499,%34506;34507;34508;34838;34839,c53295;53296;53297,%53298;53299,3674,!53302;53303;53304,\"f53290;53291;53292,&c53301", DRUID = "!16814;16815;16816;16817;16818,57810;57811;57812;57813;57814,%16845;16846;16847,35363;35364,!16821;16822,16836;16839;16840,c16880;61345;61346,d57865,16819;16820,!16909;16910;16911;16912;16913,16850;16923;16924,%33589;33590;33591,5570,a57849;57850;57851,%33597;33599;33956,16896;16897;16899,33592;33596,&24858,a48384;48395;48396,33600;33601;33602,c48389;48392;48393,!33603;33604;33605;33606;33607,%48516;48521;48525,f50516,33831,48488;48514,!48506;48510;48511,&48505|!16934;16935;16936;16937;16938,16858;16859;16860;16861;16862,%16947;16948;16949,16998;16999,16929;16930;16931,%17002;24866,61336,16942;16943;16944,%16966;16968,16972;16974;16975,c37116;37117,d48409;48410,16940;16941,!49377,33872;33873,57878;57880;57881,g17003;17004;17005;17006;24894,33853;33855;33856,&17007,a34297;34300,33851;33852;33957,c57873;57876;57877,!33859;33866;33867,48483;48484;48485,48492;48494;48495,g33917,a48532;48489;48491,&48432;48433;48434;51268;51269,a63503,&50334|17050;17051,17063;17065;17066,17056;17058;17059;17060;17061,%17069;17070;17071;17072;17073,17118;17119;17120,16833;16834;16835,%17106;17107;17108,16864,c48411;48412,&24968;24969;24970;24971;24972,17111;17112;17113,%e17116,17104;24943;24944;24945;24946,!17123;17124,33879;33880,!e17074;17075;17076;17077;17078,%34151;34152;34153,e18562,33881;33882;33883,&33886;33887;33888;33889;33890,48496;48499;48500,%48539;48544;48545,c65139,a48535;48536;48537,%63410;63411,!51179;51180;51181;51182;51183,&d48438", SHAMAN = "!16039;16109;16110;16111;16112,16035;16105;16106;16107;16108,%16038;16160;16161,28996;28997;28998,30160;29179;29180,%16040;16113;16114;16115;16116,16164,16089;60184;60185;60187;60188,%16086;16544,\"29062;29064;29065,28999;29000,e16041,!30664;30665;30666,30672;30673;30674,!g16578;16579;16580;16581;16582,&d16166,51483;51485;51486,%63370;63372,c51466;51470,30675;30678;30679,%51474;51478;51479,30706,51480;51481;51482,&62097;62098;62099;62100;62101,&51490|16259;16295;52456,16043;16130,17485;17486;17487;17488;17489,%16258;16293,16255;16302;16303;16304;16305,16262;16287,16261;16290;51881,16266;29079;29080,!43338,16254;16271;16272,!f16256;16281;16282;16283;16284,16252;16306;16307;16308;16309,%29192;29193,16268,51883;51884;51885,%30802;30808;30809,!29082;29084;29086,63373;63374,A30816;30818;30819,f30798,17364,%51525;51526;51527,c60103,c51521;51522,%30812;30813;30814,30823,51523;51524,&51528;51529;51530;51531;51532,&51533|!16182;16226;16227;16228;16229,16173;16222;16223;16224;16225,%16184;16209,29187;29189;29191,16179;16214;16215;16216;16217,%16180;16196;16198,16181;16230;16232,55198,16176;16235;16240,!16187;16205;16206,16194;16218;16219;16220;16221,%29206;29205;29202,!16188,30864;30865;30866,\"16178;16210;16211;16212;16213,%30881;30883;30884;30885;30886,g16190,c51886,%51554;51555,30872;30873,30867;30868;30869,%51556;51557;51558,974,a51560;51561,&51562;51563;51564;51565;51566,&61295", diff --git a/wotlk/Talented/spellscan.lua b/wotlk/Talented/spellscan.lua index 798a18e..a32d470 100644 --- a/wotlk/Talented/spellscan.lua +++ b/wotlk/Talented/spellscan.lua @@ -4,143 +4,143 @@ local Talented = Talented -- Builds a cache of name/icon pairs from existing spell data -- This is a rather slow operation, so it's only done once, and the result is subsequently saved function Talented:buildSpellCache() - cache = {} - local id = 0 - local misses = 0 - while misses < 50000 do - id = id + 1 - local name, _, icon = GetSpellInfo(id) + local cache = {} + local id = 0 + local misses = 0 + while misses < 50000 do + id = id + 1 + local name, _, icon = GetSpellInfo(id) - if(icon == 136243) then -- 136243 is the a gear icon, we can ignore those spells - misses = 0; - elseif name and name ~= "" and icon then - cache[name] = cache[name] or {} + if(icon == 136243) then -- 136243 is the a gear icon, we can ignore those spells + misses = 0; + elseif name and name ~= "" and icon then + cache[name] = cache[name] or {} - if not cache[name].spells or cache[name].spells == "" then - cache[name].spells = id .. "=" .. icon - else - cache[name].spells = cache[name].spells .. "," .. id .. "=" .. icon - end - misses = 0 - else - misses = misses + 1 - end - end + if not cache[name].spells or cache[name].spells == "" then + cache[name].spells = id .. "=" .. icon + else + cache[name].spells = cache[name].spells .. "," .. id .. "=" .. icon + end + misses = 0 + else + misses = misses + 1 + end + end end function Talented:ReadTalents2() - Talented.buildSpellCache() - local class = select(2, UnitClass"player") - for treeIndex = 1, 3 do - local numTalentsInTree = GetNumTalents(treeIndex) - for i = 1, numTalentsInTree do - local name, icon, row, column, currentRank, ranks, isExceptional, meetsPrereq = Talented:OrderedGetTalentInfo(class, treeIndex, i) - for rank = 1, ranks do - spell = Talented:UncompressSpellData(class)[treeIndex][i].ranks[rank] - GetSpellDescription(spell) - end - end - end + Talented.buildSpellCache() + local class = select(2, UnitClass"player") + for treeIndex = 1, 3 do + local numTalentsInTree = GetNumTalents(treeIndex) + for i = 1, numTalentsInTree do + local name, icon, row, column, currentRank, ranks, isExceptional, meetsPrereq = Talented:OrderedGetTalentInfo(class, treeIndex, i) + for rank = 1, ranks do + local spell = Talented:UncompressSpellData(class)[treeIndex][i].ranks[rank] + GetSpellDescription(spell) + end + end + end end Talented.ReadTalents2() function dump_kv(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. ''..k..' = ' .. dump_v(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end - end - function dump_v(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. dump_v(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end - end - function dump_flat(o) - if type(o) == 'table' then - local s = '' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. dump_flat(v) .. ',' - end - s = strsub(s, 1, strlen(s)-1) - return s - else - return tostring(o) - end - end + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. ''..k..' = ' .. dump_v(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end +function dump_v(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. dump_v(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end +function dump_flat(o) + if type(o) == 'table' then + local s = '' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. dump_flat(v) .. ',' + end + s = strsub(s, 1, strlen(s)-1) + return s + else + return tostring(o) + end +end function Talented:GetWoWIndices(isPet) - --Get the number of trees - numTrees = GetNumTalentTabs(false, isPet) - - --Get the index, row and column of every talent -- and the name, for debugging - trees = {} - for treeIndex = 1, numTrees do - local currentTree = {} - local numTalentsInTree = GetNumTalents(treeIndex, false, isPet) - for i = 1, numTalentsInTree do - local name, icon, row, column, currentRank, ranks, isExceptional, meetsPrereq = GetTalentInfo(treeIndex, i, false, isPet) - if name then --Some indexes to GetTalentInfo return nil -- because of course they do - currentTree[i] = {name, row, column} - end - end - trees[treeIndex] = currentTree - end + --Get the number of trees + local numTrees = GetNumTalentTabs(false, isPet) + + --Get the index, row and column of every talent -- and the name, for debugging + local trees = {} + for treeIndex = 1, numTrees do + local currentTree = {} + local numTalentsInTree = GetNumTalents(treeIndex, false, isPet) + for i = 1, numTalentsInTree do + local name, icon, row, column, currentRank, ranks, isExceptional, meetsPrereq = GetTalentInfo(treeIndex, i, false, isPet) + if name then --Some indexes to GetTalentInfo return nil -- because of course they do + currentTree[i] = {name, row, column} + end + end + trees[treeIndex] = currentTree + end - return trees + return trees end function Talented:PrintSortedWoWIndices(unsortedTrees, isPet) - --Get unsorted trees if not given - if not unsortedTrees then - unsortedTrees = Talented:GetWoWIndices(isPet) - end - sortedTrees = {} + --Get unsorted trees if not given + if not unsortedTrees then + unsortedTrees = Talented:GetWoWIndices(isPet) + end + local sortedTrees = {} - --Get the number of trees and their names - numTrees = GetNumTalentTabs(false, isPet) - treeNames = {} - for treeIndex = 1, numTrees do - local name, _, _, _, _, _, _, _ = GetTalentTabInfo(treeIndex, false, isPet) - treeNames[treeIndex] = name - end + --Get the number of trees and their names + local numTrees = GetNumTalentTabs(false, isPet) + local treeNames = {} + for treeIndex = 1, numTrees do + local name, _, _, _, _, _, _, _ = GetTalentTabInfo(treeIndex, false, isPet) + treeNames[treeIndex] = name + end - --Organise all talents by row and column, then print - for treeIndex = 1, numTrees do - unsortedTree = unsortedTrees[treeIndex] - sortedTree = {} - sortedTreeNames = {} - for k, t in pairs(unsortedTree) do - name, row, column = t[1], t[2], t[3] - if not sortedTree[row] then sortedTree[row] = {} end - if not sortedTreeNames[row] then sortedTreeNames[row] = {} end - sortedTree[row][column] = k -- for indexMatching.lua - sortedTreeNames[row][column] = name -- for debugging and for spelldata.lua - end - sortedTrees[treeIndex] = sortedTree - print(treeNames[treeIndex], '{', dump_flat(sortedTree), '}') -- for indexMatching.lua - print(treeNames[treeIndex], '{', dump_flat(sortedTreeNames), '}') -- for debugging and for spelldata.lua - end + --Organise all talents by row and column, then print + for treeIndex = 1, numTrees do + local unsortedTree = unsortedTrees[treeIndex] + local sortedTree = {} + local sortedTreeNames = {} + for k, t in pairs(unsortedTree) do + local name, row, column = t[1], t[2], t[3] + if not sortedTree[row] then sortedTree[row] = {} end + if not sortedTreeNames[row] then sortedTreeNames[row] = {} end + sortedTree[row][column] = k -- for indexMatching.lua + sortedTreeNames[row][column] = name -- for debugging and for spelldata.lua + end + sortedTrees[treeIndex] = sortedTree + print(treeNames[treeIndex], '{', dump_flat(sortedTree), '}') -- for indexMatching.lua + print(treeNames[treeIndex], '{', dump_flat(sortedTreeNames), '}') -- for debugging and for spelldata.lua + end - if select(2, UnitClass"player") == "HUNTER" and not isPet then - print("Hunter pet talents:") - Talented:PrintSortedWoWIndices(nil, true) - end + if select(2, UnitClass"player") == "HUNTER" and not isPet then + print("Hunter pet talents:") + Talented:PrintSortedWoWIndices(nil, true) + end - return sortedTrees + return sortedTrees end -- /script Talented:PrintSortedWoWIndices() diff --git a/wotlk/Talented/tabdata.lua b/wotlk/Talented/tabdata.lua index 36495a8..1319f70 100644 --- a/wotlk/Talented/tabdata.lua +++ b/wotlk/Talented/tabdata.lua @@ -120,7 +120,7 @@ elseif locale == "zhCN" then tabdata.PALADIN[1].name = "神圣" tabdata.PALADIN[2].name = "防护" tabdata.PALADIN[3].name = "惩戒" - tabdata.Cunning[1].name = "灵巧" + tabdata.Cunning[1].name = "狡诈" tabdata.Tenacity[1].name = "坚毅" tabdata.Ferocity[1].name = "凶暴" elseif locale == "frFR" then diff --git a/wotlk/Talented/talents.lua b/wotlk/Talented/talents.lua index b028265..32f393e 100644 --- a/wotlk/Talented/talents.lua +++ b/wotlk/Talented/talents.lua @@ -14,7 +14,7 @@ -- local GetTalentInfo = GetTalentInfo -- local GetTalentPrereqs = GetTalentPrereqs -- local TOOLTIP_TALENT_LEARN = TOOLTIP_TALENT_LEARN - + -- local function FillPrereqs(...) -- if select("#", ...) < 3 then return end -- local table = {} @@ -24,7 +24,7 @@ -- end -- return table -- end - + -- function BuildTalentInfo(inspect) -- if not G then -- G = LibStub("LibGratuity-3.0") @@ -118,7 +118,7 @@ -- args = {}, -- } -- end - + -- for name, info in pairs(info) do -- local colour = RAID_CLASS_COLORS[name] -- local cname = ("|cff%.2x%.2x%.2x%s|r"):format(colour.r*255, colour.g*255, colour.b*255, name) @@ -147,9 +147,9 @@ -- end -- end -- end - + -- function Talented:DataAddonLoaded() --- if loaded ~= nil then +-- if loaded ~= nil then -- return loaded -- end -- if not IsAddOnLoaded("Talented_Data") and CanLoadDataAddOn() then diff --git a/wotlk/Talented/tips.lua b/wotlk/Talented/tips.lua index f7929cf..3738a1c 100644 --- a/wotlk/Talented/tips.lua +++ b/wotlk/Talented/tips.lua @@ -34,25 +34,24 @@ end local lastTooltipInfo = {} function Talented:AddAfterSpellLoad(template, tab, index) - - local s = self:GetTalentState(template, tab, index) - if self.mode == "edit" then - if template.talentGroup then - if s == "available" or s == "empty" then - addline(TOOLTIP_TALENT_LEARN, GREEN_FONT_COLOR) - end - elseif s == "full" then - addline(TALENT_TOOLTIP_REMOVEPREVIEWPOINT, GREEN_FONT_COLOR) - elseif s == "available" then - GameTooltip:AddDoubleLine( - TALENT_TOOLTIP_ADDPREVIEWPOINT, TALENT_TOOLTIP_REMOVEPREVIEWPOINT, - GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, - GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) - elseif s == "empty" then - addline(TALENT_TOOLTIP_ADDPREVIEWPOINT, GREEN_FONT_COLOR) + local s = self:GetTalentState(template, tab, index) + if self.mode == "edit" then + if template.talentGroup then + if s == "available" or s == "empty" then + addline(TOOLTIP_TALENT_LEARN, GREEN_FONT_COLOR) end + elseif s == "full" then + addline(TALENT_TOOLTIP_REMOVEPREVIEWPOINT, GREEN_FONT_COLOR) + elseif s == "available" then + GameTooltip:AddDoubleLine( + TALENT_TOOLTIP_ADDPREVIEWPOINT, TALENT_TOOLTIP_REMOVEPREVIEWPOINT, + GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, + GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) + elseif s == "empty" then + addline(TALENT_TOOLTIP_ADDPREVIEWPOINT, GREEN_FONT_COLOR) end - GameTooltip:Show() + end + GameTooltip:Show() end function Talented:SetTooltipInfo(frame, class, tab, index) @@ -94,9 +93,8 @@ function Talented:SetTooltipInfo(frame, class, tab, index) if i == ranks then self:AddAfterSpellLoad(template, tab, index) end - GameTooltip:Show() - - end) + GameTooltip:Show() + end) end else if rank > 0 then @@ -105,7 +103,7 @@ function Talented:SetTooltipInfo(frame, class, tab, index) addtipline(tip) self:AddAfterSpellLoad(template, tab, index) end) - --TODO: Make the tooltip update without having to make a new tooltip? + -- TODO: Make the tooltip update without having to make a new tooltip? -- Can ContinueOnSpellLoad do this? https://wowpedia.fandom.com/wiki/SpellMixin#SpellMixin:ContinueOnSpellLoad end if rank < ranks then diff --git a/wotlk/Talented/ui/base.lua b/wotlk/Talented/ui/base.lua index eedd330..a66d0b5 100644 --- a/wotlk/Talented/ui/base.lua +++ b/wotlk/Talented/ui/base.lua @@ -168,7 +168,7 @@ local function CreateBaseButtons(parent) --Just show the role from our current spec according to the Blizzard API, as the button's hidden otherwise role = GetTalentGroupRole(GetActiveTalentGroup()) icon = Talented:GetRoleIcon(role) - self:SetText(icon) + self:SetText(icon) end) local e = CreateFrame("EditBox", nil, parent, "InputBoxTemplate") @@ -203,7 +203,7 @@ local function CreateBaseButtons(parent) local f = CreateFrame("Frame", nil, parent) local fs = f:CreateFontString(nil, "OVERLAY", "GameFontNormal") fs:SetJustifyH("RIGHT") - fs:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -14, 8) + fs:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -8, 10) f:SetPoint("BOTTOMRIGHT") f:SetFrameLevel(parent:GetFrameLevel()+2) f.text = fs @@ -244,7 +244,7 @@ local function CreateBaseButtons(parent) end) cb:SetScript("OnEnter", Frame_OnEnter) cb:SetScript("OnLeave", Frame_OnLeave) - cb:SetPoint("BOTTOMLEFT", parent, "BOTTOMLEFT", 14, 8) + cb:SetPoint("BOTTOMLEFT", parent, "BOTTOMLEFT", 8, 6) cb:SetFrameLevel(parent:GetFrameLevel() + 2) local points = parent:CreateFontString(nil, "OVERLAY", "GameFontNormal") diff --git a/wotlk/Talented/ui/lines.lua b/wotlk/Talented/ui/lines.lua index 41ffd12..59da07e 100644 --- a/wotlk/Talented/ui/lines.lua +++ b/wotlk/Talented/ui/lines.lua @@ -9,7 +9,7 @@ local COORDS = { topright = { left = 0.515625, width = 0.125 }, topleft = { left = 0.640625, width = -0.125 }, }, - arrow = { + arrow = { top = { left = 0, width = 0.5 }, left = { left = 0.5, width = 0.5 }, right = { left = 1.0, width = -0.5 }, @@ -19,11 +19,11 @@ local COORDS = { local function SetTextureCoords(object, type, subtype) local coords = COORDS[type] and COORDS[type][subtype] if not coords then return end - + local left = coords.left local right = left + coords.width local bottom = coords.height or 1 - + object:SetTexCoord(left, right, 0, bottom) end @@ -49,7 +49,7 @@ local function DrawVerticalLine(list, parent, offset, base_row, base_column, row SetTextureCoords(arrow, "arrow", "top") arrow:SetPoint("TOPLEFT", x + 2, y+16) list[#list + 1] = arrow - + return true end @@ -90,7 +90,7 @@ local function DrawHorizontalVerticalLine(list, parent, offset, base_row, base_c FIXME : I need to check if this line is possible and return false if not. Note that for the current trees, it's never impossible. ]] - + if base_column < column then min_column = base_column + 1 max_column = column - 1 @@ -98,7 +98,7 @@ local function DrawHorizontalVerticalLine(list, parent, offset, base_row, base_c min_column = column + 1 max_column = base_column - 1 end - + for i = min_column, max_column do local x, y = offset(row, i) local branch = Talented:MakeBranch(parent) @@ -110,7 +110,7 @@ local function DrawHorizontalVerticalLine(list, parent, offset, base_row, base_c list[#list + 1] = branch SetTextureCoords(branch, "branch", "left") end - + local x, y = offset(row, base_column) local branch = Talented:MakeBranch(parent) branch:SetPoint("TOPLEFT", x + 2, y - 2) @@ -125,7 +125,7 @@ local function DrawHorizontalVerticalLine(list, parent, offset, base_row, base_c branch2:SetPoint("TOPLEFT", x - 29, y - 2) SetTextureCoords(branch, "branch", "topright") end - + for i = row+1, base_row-1 do local x, y = offset(i, base_column) local branch = Talented:MakeBranch(parent) @@ -137,7 +137,7 @@ local function DrawHorizontalVerticalLine(list, parent, offset, base_row, base_c list[#list + 1] = branch SetTextureCoords(branch, "branch", "top") end - + x, y = offset(base_row, base_column) branch = Talented:MakeBranch(parent) branch:SetPoint("TOPLEFT", x + 2, y + 32) @@ -147,7 +147,7 @@ local function DrawHorizontalVerticalLine(list, parent, offset, base_row, base_c SetTextureCoords(arrow, "arrow", "top") arrow:SetPoint("TOPLEFT", x + 2, y + 16) list[#list + 1] = arrow - + return true end @@ -155,7 +155,7 @@ local function DrawVerticalHorizontalLine(list, parent, offset, base_row, base_c --[[ FIXME : I need to check if this line is possible and return false if not. Note that it should never be impossible. - + Also, I need to really implement it. ]] return true diff --git a/wotlk/Talented/ui/menu.lua b/wotlk/Talented/ui/menu.lua index 914f781..5474d78 100644 --- a/wotlk/Talented/ui/menu.lua +++ b/wotlk/Talented/ui/menu.lua @@ -253,7 +253,7 @@ StaticPopupDialogs["TALENTED_IMPORT_URL"] = { self:GetParent():Hide(); end, hideOnEscape = 1 - + } StaticPopupDialogs["TALENTED_EXPORT_TO"] = { @@ -449,7 +449,9 @@ function Talented:MakeActionMenu() end local function PlayerTalentFrameRoleDropDown_OnSelect(self) - SetTalentGroupRole(GetActiveTalentGroup(), self.value) + if SetTalentGroupRole then + SetTalentGroupRole(GetActiveTalentGroup(), self.value) + end icon = Talented:GetRoleIcon(self.value) b = TalentedFrame.brole b:SetText(icon) diff --git a/wotlk/Talented/ui/roleselect.lua b/wotlk/Talented/ui/roleselect.lua index b5e71d8..5c476b3 100644 --- a/wotlk/Talented/ui/roleselect.lua +++ b/wotlk/Talented/ui/roleselect.lua @@ -1,21 +1,21 @@ function Talented:GetTemplateTalentGroupRole() - local currentRole = "NONE" - local templateTalentGroup = self.template and self.template.talentGroup + local currentRole = "NONE" + local templateTalentGroup = self.template and self.template.talentGroup -- local activeTalentGroup = GetActiveTalentGroup() - if templateTalentGroup then - currentRole = GetTalentGroupRole(templateTalentGroup) - end + if templateTalentGroup then + currentRole = GetTalentGroupRole(templateTalentGroup) + end - return currentRole + return currentRole end function Talented:GetRoleIcon(currentRole) - local roleIcon = "NONE" + local roleIcon = "NONE" - if currentRole == "TANK" then roleIcon = INLINE_TANK_ICON - elseif currentRole == "HEALER" then roleIcon = INLINE_HEALER_ICON - elseif currentRole == "DAMAGER" then roleIcon = INLINE_DAMAGER_ICON end + if currentRole == "TANK" then roleIcon = INLINE_TANK_ICON + elseif currentRole == "HEALER" then roleIcon = INLINE_HEALER_ICON + elseif currentRole == "DAMAGER" then roleIcon = INLINE_DAMAGER_ICON end - return roleIcon + return roleIcon end \ No newline at end of file diff --git a/wotlk/Talented/view.lua b/wotlk/Talented/view.lua index 935ed45..6ff0e59 100644 --- a/wotlk/Talented/view.lua +++ b/wotlk/Talented/view.lua @@ -22,7 +22,7 @@ local function RecalcLayout(offset) end end -local function offset(row, column) +local function Offset(row, column) return (column - 1) * LAYOUT_OFFSET_X + LAYOUT_DELTA_X, - ((row - 1) * LAYOUT_OFFSET_Y + LAYOUT_DELTA_Y) end @@ -116,7 +116,7 @@ function TalentView:SetClass(class, force) self:SetUIElement(button, tab, index) - button:SetPoint("TOPLEFT", offset(talent.row, talent.column)) + button:SetPoint("TOPLEFT", Offset(talent.row, talent.column)) button.texture:SetTexture(Talented:GetTalentIcon(class, tab, index)) button:Show() end @@ -126,7 +126,7 @@ function TalentView:SetClass(class, force) local req = talent.req if req then local elements = {} - Talented.DrawLine(elements, frame, offset, talent.row, talent.column, tree[req].row, tree[req].column) + Talented.DrawLine(elements, frame, Offset, talent.row, talent.column, tree[req].row, tree[req].column) self:SetUIElement(elements, tab, index, req) end end @@ -278,7 +278,7 @@ function TalentView:Update() end end - local maxpoints = GetMaxPoints(nil, nil, self.spec) + local maxpoints = GetMaxPoints(nil, self.pet, self.spec) local points = self.frame.points if points then if Talented.db.profile.show_level_req then @@ -325,7 +325,7 @@ function TalentView:Update() local checkbox, activateBtn, roleSelectBtn = self.frame.checkbox, self.frame.bactivate, self.frame.brole if checkbox then - if template.talentGroup == GetActiveTalentGroup() then + if template.talentGroup == GetActiveTalentGroup() then if activateBtn then activateBtn:Hide() end roleSelectBtn:Show() checkbox:Show() @@ -348,7 +348,7 @@ function TalentView:Update() end checkbox:SetChecked(self.mode == "edit") end - + local targetname = self.frame.targetname if targetname then if template.talentGroup then @@ -384,7 +384,7 @@ end function TalentView:UpdateTalent(tab, index, offset) --Don't allow editing of current talents if looking @ current template if self.mode ~= "edit" and self.spec then return end - + if self.spec then -- Applying talent if offset > 0 then diff --git a/wotlk/Talented/viewmode.lua b/wotlk/Talented/viewmode.lua index 50fd06f..661f513 100644 --- a/wotlk/Talented/viewmode.lua +++ b/wotlk/Talented/viewmode.lua @@ -29,8 +29,8 @@ function Talented:UpdatePlayerSpecs() else template.points = nil end - - local total = 0 + + local total = 0 for tab, tree in ipairs(info) do for index, info in ipairs(tree) do local rank = select(5, Talented:OrderedGetTalentInfo(class, tab, index, nil, nil, talentGroup)) @@ -39,7 +39,7 @@ function Talented:UpdatePlayerSpecs() end end self.maxpoints = total + GetUnspentTalentPoints(nil, nil, group) - + self.alternates[talentGroup] = template if self.template == template then self:UpdateTooltip() diff --git a/wotlk/Talented/wowhead.lua b/wotlk/Talented/wowhead.lua index 55f2793..ced7d5a 100644 --- a/wotlk/Talented/wowhead.lua +++ b/wotlk/Talented/wowhead.lua @@ -15,7 +15,7 @@ Talented.importers[".*/talent.calc/(.-)/(%d*)-?(%d*)-?(%d*).*"] = function (self --death-knight -> deathknight class = select(1, class:gsub("-", "")) - + if not dst then return class:upper() end @@ -25,7 +25,7 @@ Talented.importers[".*/talent.calc/(.-)/(%d*)-?(%d*)-?(%d*).*"] = function (self dst.class = class:upper() local info = self:UncompressSpellData(dst.class) local lens = {t1:len(), t2:len(), t3:len()} - + for tab, tree in ipairs(info) do local count = 1 local t = {}