From caf5f6c4bf28ed98183309574f2568e313fa1886 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 4 Jul 2011 01:24:22 -0500 Subject: [PATCH 1/2] Fix general tooltip. --- Interface/FilterMenus.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Interface/FilterMenus.lua b/Interface/FilterMenus.lua index 81cd2a6..0debb55 100644 --- a/Interface/FilterMenus.lua +++ b/Interface/FilterMenus.lua @@ -372,7 +372,7 @@ function private.InitializeFilterPanel() general_toggle:SetPoint("TOP", general_frame, "TOP", 0, -7) general_toggle:RegisterForClicks("LeftButtonUp", "RightButtonUp") - private.SetTooltipScripts(general_toggle, L["CLASS_TEXT_DESC"]) + private.SetTooltipScripts(general_toggle, L["GENERAL_TEXT_DESC"]) general_toggle:SetScript("OnClick", function(self, button) -- 1.7.9.5 From 14dc1169f34d9321dc7be8879c0e47b2ed796306 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Wed, 6 Jul 2011 03:15:28 -0500 Subject: [PATCH 2/2] Use string methods rather than string library calls. --- Core.lua | 2 +- Interface/FilterMenus.lua | 8 +-- Interface/List.lua | 64 +++++++------------- Interface/Panel.lua | 3 - Interface/Tabs.lua | 6 +- Recipe.lua | 2 +- Scanner.lua | 148 ++++++++++++++++++++++----------------------- Waypoint.lua | 6 +- 8 files changed, 109 insertions(+), 130 deletions(-) diff --git a/Core.lua b/Core.lua index 08421aa..59b10ba 100644 --- a/Core.lua +++ b/Core.lua @@ -554,7 +554,7 @@ function addon:OnInitialize() if not guid then return end - local id_num = tonumber(string.sub(guid, -12, -9), 16) + local id_num = tonumber(guid:sub(-12,-9), 16) local unit = private.mob_list[id_num] or private.vendor_list[id_num] or private.trainer_list[id_num] if not unit or not unit.item_list then diff --git a/Interface/FilterMenus.lua b/Interface/FilterMenus.lua index 0debb55..0fb2fef 100644 --- a/Interface/FilterMenus.lua +++ b/Interface/FilterMenus.lua @@ -899,7 +899,7 @@ function private.InitializeFilterPanel() -- Used for the tooltip of every reputation checkbox. local function ReputationDesc(text) - return string.format(L["SPECIFIC_REP_DESC"], text) + return L["SPECIFIC_REP_DESC"]:format(text) end -- Toggle the SavedVariables and CheckButtons for the given expansion frame. @@ -1234,9 +1234,9 @@ function private.InitializeFilterPanel() local saved_link = tskl_list[click_info.realm][click_info.name][arg] if click_info.realm ~= _G.GetRealmName() then - local player_guid = string.gsub(_G.UnitGUID("player"), "0x0+", "") - local color, trade_id, cur_lev, max_lev, guid, bitmask = string.split(":", saved_link) - local trade_link = string.join(":", color, trade_id, cur_lev, max_lev, player_guid, bitmask) + local player_guid = _G.UnitGUID("player"):gsub("0x0+","") + local color, trade_id, cur_lev, max_lev, guid, bitmask = (":"):split(saved_link) + local trade_link = (":"):join(color,trade_id,cur_lev,max_lev,player_guid,bitmask) addon:Printf("%s (%s): %s", click_info.name, click_info.realm, trade_link) else diff --git a/Interface/List.lua b/Interface/List.lua index 86f8dfd..4fdef59 100644 --- a/Interface/List.lua +++ b/Interface/List.lua @@ -836,7 +836,7 @@ function private.InitializeListFrame() local percentage = cur_value / max_value * 100 if (math.floor(percentage) < 101) and cur_value >= 0 and max_value >= 0 then - local results = string.format(_G.SINGLE_PAGE_RESULTS_TEMPLATE, recipe_count) + local results = _G.SINGLE_PAGE_RESULTS_TEMPLATE:format(recipe_count) progress_bar.text:SetFormattedText("%d/%d - %1.2f%% (%s)", cur_value, max_value, percentage, results) else progress_bar.text:SetFormattedText("%s", L["NOT_YET_SCANNED"]) @@ -1063,11 +1063,11 @@ function private.InitializeListFrame() local coord_text = "" if trainer.coord_x ~= 0 and trainer.coord_y ~= 0 then - coord_text = SetTextColor(CATEGORY_COLORS["coords"], "(" .. trainer.coord_x .. ", " .. trainer.coord_y .. ")") + coord_text = SetTextColor(CATEGORY_COLORS["coords"], ("(%d, %d)"):format(trainer.coord_x, trainer.coord_y)) end local t = AcquireTable() - t.text = string.format("%s%s %s", PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["trainer"], L["Trainer"])..":", name) + t.text = ("%s%s %s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["trainer"], L["Trainer"]) .. ":", name) t.recipe_id = recipe_id t.npc_id = id_num @@ -1077,8 +1077,7 @@ function private.InitializeListFrame() return entry_index end t = AcquireTable() - t.text = string.format("%s%s%s %s", PADDING, PADDING, - hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], trainer.location), coord_text) + t.text = ("%s%s%s %s"):format(PADDING, PADDING, hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], trainer.location), coord_text) t.recipe_id = recipe_id t.npc_id = id_num @@ -1104,9 +1103,7 @@ function private.InitializeListFrame() local t = AcquireTable() local quantity = vendor.item_list[recipe_id] - t.text = string.format("%s%s %s%s", PADDING, - hide_type and "" or SetTextColor(CATEGORY_COLORS["vendor"], L["Vendor"])..":", name, - type(quantity) == "number" and SetTextColor(BASIC_COLORS["white"], string.format(" (%d)", quantity)) or "") + t.text = ("%s%s %s%s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["vendor"], L["Vendor"]) .. ":", name, type(quantity) == "number" and SetTextColor(BASIC_COLORS["white"], (" (%d)"):format(quantity)) or "") t.recipe_id = recipe_id t.npc_id = id_num @@ -1116,8 +1113,7 @@ function private.InitializeListFrame() return entry_index end t = AcquireTable() - t.text = string.format("%s%s%s %s", PADDING, PADDING, - hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], vendor.location), coord_text) + t.text = ("%s%s%s %s"):format(PADDING, PADDING, hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], vendor.location), coord_text) t.recipe_id = recipe_id t.npc_id = id_num @@ -1134,8 +1130,7 @@ function private.InitializeListFrame() end local t = AcquireTable() - t.text = string.format("%s%s %s", PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["mobdrop"], L["Mob Drop"])..":", - SetTextColor(private.reputation_colors["hostile"], mob.name)) + t.text = ("%s%s %s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["mobdrop"], L["Mob Drop"]) .. ":", SetTextColor(private.reputation_colors["hostile"], mob.name)) t.recipe_id = recipe_id t.npc_id = id_num @@ -1145,8 +1140,7 @@ function private.InitializeListFrame() return entry_index end t = AcquireTable() - t.text = string.format("%s%s%s %s", PADDING, PADDING, hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], mob.location), - coord_text) + t.text = ("%s%s%s %s"):format(PADDING, PADDING, hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], mob.location), coord_text) t.recipe_id = recipe_id t.npc_id = id_num @@ -1167,8 +1161,7 @@ function private.InitializeListFrame() coord_text = SetTextColor(CATEGORY_COLORS["coords"], "(" .. quest.coord_x .. ", " .. quest.coord_y .. ")") end local t = AcquireTable() - - t.text = string.format("%s%s %s", PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["quest"], L["Quest"])..":", name) + t.text = ("%s%s %s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["quest"], L["Quest"]) .. ":", name) t.recipe_id = recipe_id entry_index = ListFrame:InsertEntry(t, parent_entry, entry_index, entry_type, true) @@ -1177,8 +1170,7 @@ function private.InitializeListFrame() return entry_index end t = AcquireTable() - t.text = string.format("%s%s%s %s", PADDING, PADDING, - hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], quest.location), coord_text) + t.text = ("%s%s%s %s"):format(PADDING, PADDING, hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], quest.location), coord_text) t.recipe_id = recipe_id return ListFrame:InsertEntry(t, parent_entry, entry_index, entry_type, true) @@ -1186,10 +1178,7 @@ function private.InitializeListFrame() local function ExpandSeasonalData(entry_index, entry_type, parent_entry, id_num, recipe_id, hide_location, hide_type) local t = AcquireTable() - - t.text = string.format("%s%s %s", PADDING, - hide_type and "" or SetTextColor(CATEGORY_COLORS["seasonal"], private.acquire_names[A.SEASONAL])..":", - SetTextColor(CATEGORY_COLORS["seasonal"], private.seasonal_list[id_num].name)) + t.text = ("%s%s %s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["seasonal"], private.acquire_names[A.SEASONAL]) .. ":", SetTextColor(CATEGORY_COLORS["seasonal"], private.seasonal_list[id_num].name)) t.recipe_id = recipe_id return ListFrame:InsertEntry(t, parent_entry, entry_index, entry_type, true) @@ -1216,9 +1205,7 @@ function private.InitializeListFrame() local name = ColorNameByFaction(rep_vendor.name, rep_vendor.faction) local t = AcquireTable() - - t.text = string.format("%s%s %s", PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["reputation"], _G.REPUTATION)..":", - SetTextColor(CATEGORY_COLORS["repname"], private.reputation_list[rep_id].name)) + t.text = ("%s%s %s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["reputation"], _G.REPUTATION) .. ":", SetTextColor(CATEGORY_COLORS["repname"], private.reputation_list[rep_id].name)) t.recipe_id = recipe_id t.npc_id = vendor_id @@ -1241,8 +1228,7 @@ function private.InitializeListFrame() return entry_index end t = AcquireTable() - t.text = string.format("%s%s%s%s %s", PADDING, PADDING, PADDING, - hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], rep_vendor.location), coord_text) + t.text = ("%s%s%s%s %s"):format(PADDING, PADDING, PADDING, hide_location and "" or SetTextColor(CATEGORY_COLORS["location"], rep_vendor.location), coord_text) t.recipe_id = recipe_id t.npc_id = vendor_id @@ -1253,13 +1239,12 @@ function private.InitializeListFrame() local drop_location = type(id_num) == "string" and BZ[id_num] if drop_location then - drop_location = string.format(": %s", SetTextColor(CATEGORY_COLORS["location"], drop_location)) + drop_location = (": %s"):format(SetTextColor(CATEGORY_COLORS["location"], drop_location)) else drop_location = "" end local t = AcquireTable() - - t.text = string.format("%s|c%s%s|r%s", PADDING, select(4, _G.GetItemQualityColor(private.recipe_list[recipe_id].quality)), L["World Drop"], drop_location) + t.text = ("%s|c%s%s|r%s"):format(PADDING, select(4, _G.GetItemQualityColor(private.recipe_list[recipe_id].quality)), L["World Drop"], drop_location) t.recipe_id = recipe_id return ListFrame:InsertEntry(t, parent_entry, entry_index, entry_type, true) @@ -1267,7 +1252,6 @@ function private.InitializeListFrame() local function ExpandCustomData(entry_index, entry_type, parent_entry, id_num, recipe_id, hide_location, hide_type) local t = AcquireTable() - t.text = PADDING .. SetTextColor(CATEGORY_COLORS["custom"], private.custom_list[id_num].name) t.recipe_id = recipe_id @@ -1276,7 +1260,6 @@ function private.InitializeListFrame() local function ExpandAchievementData(entry_index, entry_type, parent_entry, id_num, recipe_id, hide_location, hide_type) local entry = AcquireTable() - entry.text = ("%s%s %s"):format(PADDING, hide_type and "" or SetTextColor(CATEGORY_COLORS["achievement"], _G.ACHIEVEMENTS) .. ":", SetTextColor(BASIC_COLORS["normal"], select(2, _G.GetAchievementInfo(id_num)))) entry.recipe_id = recipe_id @@ -1321,7 +1304,6 @@ function private.InitializeListFrame() func = ExpandAchievementData elseif acquire_type > num_acquire_types then local t = AcquireTable() - t.text = "Unhandled Acquire Case - Type: " .. acquire_type t.recipe_id = recipe_id @@ -1622,7 +1604,7 @@ do local quantity = vendor.item_list[recipe_id] if type(quantity) == "number" then - addline_func(2, -2, true, L["LIMITED_SUPPLY"], CATEGORY_COLORS["vendor"], string.format("(%d)", quantity), BASIC_COLORS["white"]) + addline_func(2, -2, true, L["LIMITED_SUPPLY"], CATEGORY_COLORS["vendor"], ("(%d)"):format(quantity), BASIC_COLORS["white"]) end end, [A.MOB_DROP] = function(recipe_id, identifier, location, acquire_info, addline_func) @@ -1705,7 +1687,7 @@ do local recipe = private.recipe_list[recipe_id] local recipe_item_id = recipe:RecipeItemID() local recipe_item_level = recipe_item_id and select(4, _G.GetItemInfo(recipe_item_id)) - local quality_color = string.sub(select(4, _G.GetItemQualityColor(recipe.quality)), 3) + local quality_color = select(4, _G.GetItemQualityColor(recipe.quality)):sub(3) local location_text if recipe_item_level then @@ -1878,17 +1860,17 @@ do local skill_level = private.current_profession_scanlevel if recipe.skill_level > skill_level then - ttAdd(0, -1, false, string.format("%s:", _G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["impossible"]) + ttAdd(0, -1, false, ("%s:"):format(_G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["impossible"]) elseif skill_level >= recipe.trivial_level then - ttAdd(0, -1, false, string.format("%s:", _G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["trivial"]) + ttAdd(0, -1, false, ("%s:"):format(_G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["trivial"]) elseif skill_level >= recipe.easy_level then - ttAdd(0, -1, false, string.format("%s:", _G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["easy"]) + ttAdd(0, -1, false, ("%s:"):format(_G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["easy"]) elseif skill_level >= recipe.medium_level then - ttAdd(0, -1, false, string.format("%s:", _G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["medium"]) + ttAdd(0, -1, false, ("%s:"):format(_G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["medium"]) elseif skill_level >= recipe.optimal_level then - ttAdd(0, -1, false, string.format("%s:", _G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["optimal"]) + ttAdd(0, -1, false, ("%s:"):format(_G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["optimal"]) else - ttAdd(0, -1, false, string.format("%s:", _G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["trivial"]) + ttAdd(0, -1, false, ("%s:"):format(_G.SKILL_LEVEL), BASIC_COLORS["normal"], recipe.skill_level, private.difficulty_colors["trivial"]) end acquire_tip:AddSeparator() diff --git a/Interface/Panel.lua b/Interface/Panel.lua index a8d9eac..162c222 100644 --- a/Interface/Panel.lua +++ b/Interface/Panel.lua @@ -19,9 +19,6 @@ This source code is released under All Rights Reserved. local _G = getfenv(0) local string = _G.string -local sformat = string.format -local strlower = string.lower -local smatch = string.match local select = _G.select diff --git a/Interface/Tabs.lua b/Interface/Tabs.lua index 2fbc7c1..6ae42cc 100644 --- a/Interface/Tabs.lua +++ b/Interface/Tabs.lua @@ -241,11 +241,11 @@ function private.InitializeTabs() if count > 0 then local t = AcquireTable() - local acquire_str = string.gsub(private.acquire_strings[acquire_type]:lower(), "_", "") + local acquire_str = private.acquire_strings[acquire_type]:lower():gsub("_","") local color_code = private.category_colors[acquire_str] or "ffffff" local is_expanded = self[prof_name.." expanded"][private.acquire_names[acquire_type]] - t.text = string.format("%s (%d)", SetTextColor(color_code, private.acquire_names[acquire_type]), count) + t.text = ("%s (%d)"):format(SetTextColor(color_code, private.acquire_names[acquire_type]),count) t.acquire_id = acquire_type insert_index = ListFrame:InsertEntry(t, nil, insert_index, "header", is_expanded or expand_mode, is_expanded or expand_mode) @@ -349,7 +349,7 @@ function private.InitializeTabs() local is_expanded = self[prof_name.." expanded"][loc_name] - t.text = string.format("%s (%d)", SetTextColor(private.category_colors["location"], loc_name), count) + t.text = ("%s (%d)"):format(SetTextColor(private.category_colors["location"], loc_name),count) t.location_id = loc_name insert_index = ListFrame:InsertEntry(t, nil, insert_index, "header", is_expanded or expand_mode, is_expanded or expand_mode) diff --git a/Recipe.lua b/Recipe.lua index bd9a466..afb60f8 100644 --- a/Recipe.lua +++ b/Recipe.lua @@ -186,7 +186,7 @@ do local recipe_name = self.name if private.ordered_professions[addon.Frame.profession] == SPELL_ENCHANTING then - recipe_name = string.gsub(recipe_name, _G.ENSCRIBE .. " ", "") + recipe_name = recipe_name:gsub(_G.ENSCRIBE .. " ","") end local has_faction = private.Player:HasProperRepLevel(self.acquire_data[A.REPUTATION]) local skill_level = private.current_profession_scanlevel diff --git a/Scanner.lua b/Scanner.lua index 2c589f8..24731ad 100644 --- a/Scanner.lua +++ b/Scanner.lua @@ -173,7 +173,7 @@ do table.wipe(output) -- Dump out trainer info - local trainer_id = tonumber(string.sub(_G.UnitGUID("target"), -12, -9), 16) + local trainer_id = tonumber(_G.UnitGUID("target"):sub(-12,-9), 16) local trainer_name = _G.UnitName("target") for spell_id, recipe in pairs(recipe_list) do @@ -346,7 +346,7 @@ function addon:GenerateLinks() -- This code adopted from Gnomish Yellow Pages with permission local guid = _G.UnitGUID("player") - local playerGUID = string.gsub(guid, "0x0+", "") + local playerGUID = guid:gsub("0x0+","") -- Listing of all tradeskill professions local tradelist = {51304, 51300, 51313, 51306, 45363, 51311, 51302, 51309, 51296, 45542} @@ -354,7 +354,7 @@ function addon:GenerateLinks() --[[ local encodingLength = floor((#recipeList+5) / 6) - local encodedString = string.rep("/", encodingLength) + local encodedString = ("/"):rep(encodingLength) ]]-- local bitmap = {} bitmap[45542] = "8bffAA" -- First Aid 100% 17/17 recipes @@ -389,7 +389,7 @@ function addon:GenerateLinks() else self:Print("There currently is not a generated tradeskill link for: " .. tradeName) end - -- /script DEFAULT_CHAT_FRAME:AddMessage(string.gsub(GetTradeSkillListLink(), "\124", "\124\124")) +-- /script DEFAULT_CHAT_FRAME:AddMessage(GetTradeSkillListLink():gsub("\124","\124\124")) end end @@ -433,7 +433,7 @@ do end for i in pairs(master_list) do - local prof = string.lower(master_list[i].profession) + local prof = master_list[i].profession:lower() if prof and prof == prof_name then recipe_list[i] = master_list[i] @@ -469,7 +469,7 @@ do end local found = false - prof_name = string.lower(prof_name) + prof_name = prof_name:lower() local scan_all = prof_name == "all" @@ -520,7 +520,7 @@ do prof_name = private.mining_name:lower() end for i in pairs(master_list) do - local prof = string.lower(master_list[i].profession) + local prof = master_list[i].profession:lower() if prof and prof == prof_name then recipe_list[i] = master_list[i] @@ -547,7 +547,7 @@ do end local found = false - prof_name = string.lower(prof_name) + prof_name = prof_name:lower() local scan_all = prof_name == "all" @@ -704,7 +704,7 @@ do return end local vendor_name = _G.UnitName("target") - local vendor_id = tonumber(string.sub(_G.UnitGUID("target"), -12, -9), 16) + local vendor_id = tonumber(_G.UnitGUID("target"):sub(-12,-9), 16) local added_output = false table.wipe(output) @@ -730,7 +730,7 @@ do local item_name, _, _, _, supply = _G.GetMerchantItemInfo(index) if item_name then - local match_text = string.match(item_name, "%a+: ") + local match_text = item_name:match("%a+: ") if match_text and RECIPE_TYPES[match_text:lower()] then local item_id = private.ItemLinkToID(_G.GetMerchantItemLink(index)) @@ -1002,10 +1002,10 @@ do ARLDatamineTT:SetHyperlink(recipe_link) -- Check to see if this is a recipe tooltip. - local text = string.lower(_G["ARLDatamineTTTextLeft1"]:GetText()) - local match_text = string.match(text, "%a+: ") + local text = _G["ARLDatamineTTTextLeft1"]:GetText():lower() + local match_text = text:match("%a+: ") - if not RECIPE_TYPES[match_text] and not (string.find(text, "smelt") or string.find(text, "sunder") or string.find(text, "shatter")) then + if not RECIPE_TYPES[match_text] and not (text:find("smelt") or text:find("sunder") or text:find("shatter")) then ARLDatamineTT:Hide() return end @@ -1220,7 +1220,7 @@ do -- Check for recipe/item binding -- The recipe binding is within the first few lines of the tooltip always - if string.match(text, "binds when picked up") then + if text:match("binds when picked up") then if (i < 3) then scan_data.recipe_bop = true else @@ -1234,7 +1234,7 @@ do end -- Recipe Reputations - local rep, replevel = string.match(text_l, "Requires (.+) %- (.+)") + local rep, replevel = text_l:match("Requires (.+) %- (.+)") if rep and replevel and FACTION_TEXT[rep] then scan_data.repid = FACTION_TEXT[rep] @@ -1248,78 +1248,78 @@ do if not scan_data.verifiedclass then -- Certain stats can be considered for a specific role (aka spell hit == caster dps). - if string.match(text, "strength") and not string.match(text, "strength of the clefthoof") and not string.match(text, "set:") then + if text:match("strength") and not text:match("strength of the clefthoof") and not text:match("set:") then scan_data.dps = true - elseif string.match(text, "agility") then + elseif text:match("agility") then scan_data.dps = true - elseif string.match(text, "spirit") or string.match(text, "intellect") then + elseif text:match("spirit") or text:match("intellect") then scan_data.caster = true scan_data.healer = true - elseif string.match(text, "spell power") then + elseif text:match("spell power") then scan_data.caster = true scan_data.healer = true - elseif string.match(text, "spell crit") then + elseif text:match("spell crit") then scan_data.caster = true scan_data.healer = true - elseif string.match(text, "spell hit") then + elseif text:match("spell hit") then scan_data.caster = true scan_data.verifiedclass = true - elseif string.match(text, "spell penetration") then + elseif text:match("spell penetration") then scan_data.caster = true scan_data.verifiedclass = true - elseif string.match(text, "mana per 5 sec.") or string.match(text, "mana every 5 seconds") then + elseif text:match("mana per 5 sec.") or text:match("mana every 5 seconds") then scan_data.caster = true scan_data.healer = true - elseif string.match(text, "attack power") then + elseif text:match("attack power") then scan_data.dps = true - elseif string.match(text, "expertise") then + elseif text:match("expertise") then scan_data.dps = true scan_data.tank = true - elseif string.match(text, "melee crit") then + elseif text:match("melee crit") then scan_data.dps = true - elseif string.match(text, "critical hit") then + elseif text:match("critical hit") then scan_data.dps = true - elseif string.match(text, "weapon damage") then + elseif text:match("weapon damage") then scan_data.dps = true - elseif string.match(text, "ranged crit") then + elseif text:match("ranged crit") then scan_data.dps = true scan_data.verifiedclass = true - elseif string.match(text, "melee haste") then + elseif text:match("melee haste") then scan_data.dps = true - elseif string.match(text, "ranged haste") then + elseif text:match("ranged haste") then scan_data.dps = true scan_data.verifiedclass = true - elseif string.match(text, "melee hit") then + elseif text:match("melee hit") then scan_data.dps = true - elseif string.match(text, "ranged hit") then + elseif text:match("ranged hit") then scan_data.dps = true scan_data.verifiedclass = true - elseif string.match(text, "armor pen") then + elseif text:match("armor pen") then scan_data.dps = true - elseif string.match(text, "feral attack power") then + elseif text:match("feral attack power") then scan_data.tank = true scan_data.dps = true - elseif string.match(text, "defense") and not string.match(text, "defenseless") then + elseif text:match("defense") and not text:match("defenseless") then scan_data.tank = true scan_data.verifiedclass = true - elseif string.match(text, "block") then + elseif text:match("block") then scan_data.tank = true scan_data.verifiedclass = true - elseif string.match(text, "parry") then + elseif text:match("parry") then scan_data.tank = true scan_data.verifiedclass = true - elseif string.match(text, "dodge") and not string.match(text, "set:") then + elseif text:match("dodge") and not text:match("set:") then scan_data.tank = true scan_data.verifiedclass = true end end -- Classes - local class_type = string.match(text_l, "Classes: (.+)") + local class_type = text_l:match("Classes: (.+)") if class_type then for idx, class in ipairs(ORDERED_CLASS_TYPES) do - if string.match(class_type, class) then + if class_type:match(class) then scan_data[class] = true scan_data.found_class = true end @@ -1338,7 +1338,7 @@ do end -- Enchantment voodoo - local ench_type, _ = string.match(text_l, "Enchant (.+) %- (.+)") + local ench_type, _ = text_l:match("Enchant (.+) %- (.+)") if ench_type then if ITEM_TYPES[ench_type] then @@ -1387,7 +1387,7 @@ do end -- Parse the recipe database until we get a match on the name - local recipe_name = string.gsub(scan_data.match_name, "%a+%?: ", "") + local recipe_name = scan_data.match_name:gsub("%a+%?: ","") local spell_id = scan_data.reverse_lookup[recipe_name] if not spell_id then @@ -1408,16 +1408,16 @@ do if scan_data.is_vendor then -- Check to see if the vendor flag is set if not recipe:HasFilter("common1", "VENDOR") then - table.insert(missing_flags, string.format(flag_format, FS[F.VENDOR])) + table.insert(missing_flags, flag_format:format(FS[F.VENDOR])) end -- Check to see if we're in a PVP zone local subzone_text = _G.GetSubZoneText() if (subzone_text == "Wintergrasp Fortress" or subzone_text == "Halaa") and not recipe:HasFilter("common1", "PVP") then - table.insert(missing_flags, string.format(flag_format, FS[F.PVP])) + table.insert(missing_flags, flag_format:format(FS[F.PVP])) elseif recipe:HasFilter("common1", "PVP") and not (subzone_text == "Wintergrasp Fortress" or subzone_text == "Halaa") then - table.insert(extra_flags, string.format(flag_format, FS[F.PVP])) + table.insert(extra_flags, flag_format:format(FS[F.PVP])) end end @@ -1425,55 +1425,55 @@ do if scan_data.found_class then for k, v in ipairs(ORDERED_CLASS_TYPES) do if scan_data[v] and not recipe:HasFilter("class1", FS[CLASS_TYPES[v]]) then - table.insert(missing_flags, string.format(flag_format, FS[CLASS_TYPES[v]])) + table.insert(missing_flags, flag_format:format(FS[CLASS_TYPES[v]])) elseif not scan_data[v] and recipe:HasFilter("class1", FS[CLASS_TYPES[v]]) then - table.insert(extra_flags, string.format(flag_format, FS[CLASS_TYPES[v]])) + table.insert(extra_flags, flag_format:format(FS[CLASS_TYPES[v]])) end end end if scan_data.item_bop and not recipe:HasFilter("common1", "IBOP") then - table.insert(missing_flags, string.format(flag_format, FS[F.IBOP])) + table.insert(missing_flags, flag_format:format(FS[F.IBOP])) if recipe:HasFilter("common1", "IBOE") then - table.insert(extra_flags, string.format(flag_format, FS[F.IBOE])) + table.insert(extra_flags, flag_format:format(FS[F.IBOE])) end if recipe:HasFilter("common1", "IBOA") then - table.insert(extra_flags, string.format(flag_format, FS[F.IBOA])) + table.insert(extra_flags, flag_format:format(FS[F.IBOA])) end elseif not recipe:HasFilter("common1", "IBOE") and not scan_data.item_bop then - table.insert(missing_flags, string.format(flag_format, FS[F.IBOE])) + table.insert(missing_flags, flag_format:format(FS[F.IBOE])) if recipe:HasFilter("common1", "IBOP") then - table.insert(extra_flags, string.format(flag_format, FS[F.IBOP])) + table.insert(extra_flags, flag_format:format(FS[F.IBOP])) end if recipe:HasFilter("common1", "IBOA") then - table.insert(extra_flags, string.format(flag_format, FS[F.IBOA])) + table.insert(extra_flags, flag_format:format(FS[F.IBOA])) end end if scan_data.recipe_bop and not recipe:HasFilter("common1", "RBOP") then - table.insert(missing_flags, string.format(flag_format, FS[F.RBOP])) + table.insert(missing_flags, flag_format:format(FS[F.RBOP])) if recipe:HasFilter("common1", "RBOE") then - table.insert(extra_flags, string.format(flag_format, FS[F.RBOE])) + table.insert(extra_flags, flag_format:format(FS[F.RBOE])) end if recipe:HasFilter("common1", "RBOA") then - table.insert(extra_flags, string.format(flag_format, FS[F.RBOA])) + table.insert(extra_flags, flag_format:format(FS[F.RBOA])) end elseif not recipe:HasFilter("common1", "TRAINER") and not recipe:HasFilter("common1", "RBOE") and not scan_data.recipe_bop then - table.insert(missing_flags, string.format(flag_format, FS[F.RBOE])) + table.insert(missing_flags, flag_format:format(FS[F.RBOE])) if recipe:HasFilter("common1", "RBOP") then - table.insert(extra_flags, string.format(flag_format, FS[F.RBOP])) + table.insert(extra_flags, flag_format:format(FS[F.RBOP])) end if recipe:HasFilter("common1", "RBOA") then - table.insert(extra_flags, string.format(flag_format, FS[F.RBOA])) + table.insert(extra_flags, flag_format:format(FS[F.RBOA])) end end @@ -1481,17 +1481,17 @@ do local role_string = FS[ROLE_TYPES[v]] if scan_data[v] and not recipe:HasFilter("common1", role_string) then - table.insert(missing_flags, string.format(flag_format, role_string)) + table.insert(missing_flags, flag_format:format(role_string)) elseif not scan_data[v] and recipe:HasFilter("common1", role_string) then - table.insert(extra_flags, string.format(flag_format, role_string)) + table.insert(extra_flags, flag_format:format(role_string)) end end for k, v in ipairs(ORDERED_ITEM_TYPES) do if scan_data[v] and not recipe:HasFilter("item1", FS[ITEM_TYPES[v]]) then - table.insert(missing_flags, string.format(flag_format, FS[ITEM_TYPES[v]])) + table.insert(missing_flags, flag_format:format(FS[ITEM_TYPES[v]])) elseif not scan_data[v] and recipe:HasFilter("item1", FS[ITEM_TYPES[v]]) then - table.insert(extra_flags, string.format(flag_format, FS[ITEM_TYPES[v]])) + table.insert(extra_flags, flag_format:format(FS[ITEM_TYPES[v]])) end end @@ -1528,29 +1528,29 @@ do local flag = ACQUIRE_TO_FILTER_MAP[acquire_type] if flag and not recipe:HasFilter("common1", FS[flag]) then - table.insert(missing_flags, string.format(flag_format, FS[flag])) + table.insert(missing_flags, flag_format:format(FS[flag])) end end if (acquire_data[A.VENDOR] or acquire_data[A.REPUTATION]) and not recipe:HasFilter("common1", "VENDOR") then - table.insert(missing_flags, string.format(flag_format, FS[F.VENDOR])) + table.insert(missing_flags, flag_format:format(FS[F.VENDOR])) end if recipe:HasFilter("common1", "VENDOR") and not (acquire_data[A.VENDOR] or acquire_data[A.REPUTATION]) then - table.insert(extra_flags, string.format(flag_format, FS[F.VENDOR])) + table.insert(extra_flags, flag_format:format(FS[F.VENDOR])) end if acquire_data[A.TRAINER] and not recipe:HasFilter("common1", "TRAINER") then - table.insert(missing_flags, string.format(flag_format, FS[F.TRAINER])) + table.insert(missing_flags, flag_format:format(FS[F.TRAINER])) end if recipe:HasFilter("common1", "TRAINER") and not acquire_data[A.TRAINER] and not acquire_data[A.CUSTOM] then - table.insert(extra_flags, string.format(flag_format, FS[F.TRAINER])) + table.insert(extra_flags, flag_format:format(FS[F.TRAINER])) end for flag, acquire_type in pairs(FILTER_TO_ACQUIRE_MAP) do if recipe:HasFilter("common1", FS[flag]) and not acquire_data[acquire_type] then - table.insert(extra_flags, string.format(flag_format, FS[flag])) + table.insert(extra_flags, flag_format:format(FS[flag])) end end @@ -1625,13 +1625,13 @@ do if scan_data.specialty then if not recipe.specialty then found_problem = true - table.insert(output, string.format(" Missing Specialty: %s", scan_data.specialty)) + table.insert(output, (" Missing Specialty: %s"):format(scan_data.specialty)) elseif recipe.specialty ~= scan_data.specialty then - table.insert(output, string.format(" Wrong Specialty: %s - should be %s ", recipe.specialty, scan_data.specialty)) + table.insert(output, (" Wrong Specialty: %s - should be %s "):format(recipe.specialty,scan_data.specialty)) end elseif recipe.specialty then found_problem = true - table.insert(output, string.format(" Extra Specialty: %s", recipe.specialty)) + table.insert(output, (" Extra Specialty: %s"):format(recipe.specialty)) end if scan_data.quality and scan_data.quality ~= recipe.quality then @@ -1642,7 +1642,7 @@ do end if found_problem then - table.insert(output, 1, string.format("%s: %d", recipe_name, spell_id, spell_id)) + table.insert(output, 1, ("%s: %d"):format(recipe_name,spell_id,spell_id)) return table.concat(output, "\n") else return diff --git a/Waypoint.lua b/Waypoint.lua index 0fab96e..2fff2f8 100644 --- a/Waypoint.lua +++ b/Waypoint.lua @@ -493,13 +493,13 @@ function addon:AddWaypoint(recipe_id, acquire_id, location_id, npc_id) local continent, zone local recipe = recipe_list[spell_id] local _, _, _, quality_color = _G.GetItemQualityColor(recipe.quality) - local acquire_str = string.gsub(private.acquire_strings[waypoint.acquire_type]:lower(), "_", "") + local acquire_str = private.acquire_strings[waypoint.acquire_type]:lower():gsub("_","") local color_code = private.category_colors[acquire_str] or "ffffff" if waypoint.acquire_type == A.QUEST then - name = string.format("Quest: |cff%s%s|r (|c%s%s|r)", color_code, private.quest_names[waypoint.reference_id], quality_color, recipe.name) + name = ("Quest: |cff%s%s|r (|c%s%s|r)"):format(color_code, private.quest_names[waypoint.reference_id], quality_color, recipe.name) else - name = string.format("|cff%s%s|r (|c%s%s|r)", color_code, waypoint.name or _G.UNKNOWN, quality_color, recipe.name) + name = ("|cff%s%s|r (|c%s%s|r)"):format(color_code, waypoint.name or _G.UNKNOWN, quality_color, recipe.name) end waypoint.acquire_type = nil waypoint.reference_id = nil -- 1.7.9.5