From 8568efa2cac425a01cc153fab40c1525c19080f4 Mon Sep 17 00:00:00 2001 From: Spit <19otari98@gmail.com> Date: Fri, 14 Mar 2025 18:15:30 +0300 Subject: [PATCH] 3.1.0 updated AceLocale lib --- AtlasLoot.toc | 4 +- Core/AtlasLoot.lua | 74 ++++++++++++++-------------- Instances/instances.en.lua | 3 +- Libs/AceLocale/AceLocale-2.2.lua | 83 ++++++++++++++++++++++++-------- TableRegister/loottables.en.lua | 1 + 5 files changed, 102 insertions(+), 63 deletions(-) diff --git a/AtlasLoot.toc b/AtlasLoot.toc index 57f2a44..1076fc9 100644 --- a/AtlasLoot.toc +++ b/AtlasLoot.toc @@ -3,8 +3,7 @@ ## Notes: Shows possible loot from dungeon bosses and other sources. ## Author: Shagu (pfUI update code), Lexie (Turtle WoW fixes/updates), Otari (overhaul/revamp, menu changes, bugfixes/updates) ## LegacyAuthor: Daviesh, Pompa (Turtle WoW World Bosses), Xerron (Turtle WoW World Bosses), Gurky (Turtle WoW 1.16/1.16.1 Dungeons) -## Version: 3.0.9 -## SavedVariables: AtlasLoot_updateavailable +## Version: 3.1.0 ## SavedVariablesPerCharacter: AtlasLootCharDB ## OptionalDeps: Alphamap, AtlasLoader, LootLink, ItemSync, HewdropLib, Ace2, EquipCompare, EQCompare @@ -17,7 +16,6 @@ Libs\AceAddon\AceAddon-2.0.lua Libs\Hewdrop\Hewdrop-2.0.lua Locale\Locale.xml -# Bossnames\BossNames.xml Sets\Sets.xml Crafting\Crafting.xml PvP\PvP.xml diff --git a/Core/AtlasLoot.lua b/Core/AtlasLoot.lua index e6c13bf..e064d1f 100644 --- a/Core/AtlasLoot.lua +++ b/Core/AtlasLoot.lua @@ -214,37 +214,37 @@ function AtlasLoot_OnVariablesLoaded() AtlasLootItemsFrame:Hide(); end --Check and migrate old WishList entry format to the newer one - if version < 40301 then - --Check if we really need to do a migration since it will load all modules - --We also create a helper table here which store IDs that need to search for - local idsToSearch = {}; - for i = 1, table.getn(AtlasLootCharDB["WishList"]) do - if (type(AtlasLootCharDB["WishList"][i][1]) == "number") then - if (AtlasLootCharDB["WishList"][i][1] > 0 and not AtlasLootCharDB["WishList"][i][5]) then - tinsert(idsToSearch, i, AtlasLootCharDB["WishList"][i][1]); - end - end - end - if table.getn(idsToSearch) > 0 then - --Let's do this - for _, dataSource in ipairs(AtlasLoot_SearchTables) do - if AtlasLoot_Data[dataSource] then - for dataID, lootTable in pairs(AtlasLoot_Data[dataSource]) do - for _, entry in ipairs(lootTable) do - for k, v in pairs(idsToSearch) do - if(entry[1] == v)then - AtlasLootCharDB["WishList"][k][5] = dataID.."|"..dataSource; - break; - end - end - end - end - end - end - end - AtlasLootCharDB.AutoQuery = false; - AtlasLootOptions_Init(); - end + -- if version < 40301 then + -- --Check if we really need to do a migration since it will load all modules + -- --We also create a helper table here which store IDs that need to search for + -- local idsToSearch = {}; + -- for i = 1, table.getn(AtlasLootCharDB["WishList"]) do + -- if (type(AtlasLootCharDB["WishList"][i][1]) == "number") then + -- if (AtlasLootCharDB["WishList"][i][1] > 0 and not AtlasLootCharDB["WishList"][i][5]) then + -- tinsert(idsToSearch, i, AtlasLootCharDB["WishList"][i][1]); + -- end + -- end + -- end + -- if table.getn(idsToSearch) > 0 then + -- --Let's do this + -- for _, dataSource in ipairs(AtlasLoot_SearchTables) do + -- if AtlasLoot_Data[dataSource] then + -- for dataID, lootTable in pairs(AtlasLoot_Data[dataSource]) do + -- for _, entry in ipairs(lootTable) do + -- for k, v in pairs(idsToSearch) do + -- if(entry[1] == v)then + -- AtlasLootCharDB["WishList"][k][5] = dataID.."|"..dataSource; + -- break; + -- end + -- end + -- end + -- end + -- end + -- end + -- end + -- AtlasLootCharDB.AutoQuery = false; + -- AtlasLootOptions_Init(); + -- end --Adds an AtlasLoot button to the Feature Frame in Cosmos if(EarthFeature_AddButton) then EarthFeature_AddButton( @@ -360,14 +360,14 @@ function AtlasLootOptions_Fresh() AtlasLootCharDB.Opaque = false; AtlasLootCharDB.ItemIDs = false; AtlasLootCharDB.FirstTime = true; - AtlasLootCharDB.ItemSpam = true; + AtlasLootCharDB.ItemSpam = false; AtlasLootCharDB.MinimapButton = true; AtlasLootCharDB.MinimapButtonPosition = 315; AtlasLootCharDB.MinimapButtonRadius = 78; AtlasLootCharDB.HidePanel = false; AtlasLootCharDB.LastBoss = "DUNGEONSMENU1"; AtlasLootCharDB.LastBossText = AL["Dungeons & Raids"]; - AtlasLootCharDB.AutoQuery = false; + -- AtlasLootCharDB.AutoQuery = false; AtlasLootCharDB.PartialMatching = true; end @@ -2070,8 +2070,8 @@ function AtlasLootOptions_ResetPosition() end function AtlasLootOptions_DefaultSettings() - AtlasLootCharDB.SafeLinks = true; - AtlasLootCharDB.AllLinks = false; + AtlasLootCharDB.SafeLinks = false; + AtlasLootCharDB.AllLinks = true; AtlasLootCharDB.DefaultTT = true; AtlasLootCharDB.LootlinkTT = false; AtlasLootCharDB.ItemSyncTT = false; @@ -2082,7 +2082,7 @@ function AtlasLootOptions_DefaultSettings() AtlasLootCharDB.ItemSpam = true; AtlasLootCharDB.MinimapButton = true; AtlasLootCharDB.HidePanel = false; - AtlasLootCharDB.AutoQuery = false; + -- AtlasLootCharDB.AutoQuery = false; AtlasLootCharDB.PartialMatching = true; AtlasLootCharDB.LastBoss = "DUNGEONSMENU1"; AtlasLootCharDB.LastBossText = AL["Dungeons & Raids"]; @@ -3148,7 +3148,7 @@ function AtlasLootItem_OnEnter() getglobal("AtlasLootTooltipTextRight"..i):SetText(""); end end - if (this.itemID ~= 0) then + if (this.itemID and this.itemID ~= 0) then if string.sub(this.itemID, 1, 1) == "s" then isItem = false; isEnchant = false; diff --git a/Instances/instances.en.lua b/Instances/instances.en.lua index b8fb924..949e24e 100644 --- a/Instances/instances.en.lua +++ b/Instances/instances.en.lua @@ -8125,7 +8125,6 @@ AtlasLoot_Data["AtlasLootItems"] = { { 20381, "INV_Misc_MonsterScales_11", "=q2=Dreamscale", "", "5%" }, { 61197, "INV_Stone_05", "=q3=Fading Dream Fragment", "", "0.35%" }, { 0, "", "", "" }, - { 54001, "INV_Crate_02", "=q2=Dream Frog", "=ds=#e15#", "0.08%" }, - + { 54001, "INV_Crate_02", "=q3=Dream Frog", "=ds=#e15#", "0.08%" }, }; }; diff --git a/Libs/AceLocale/AceLocale-2.2.lua b/Libs/AceLocale/AceLocale-2.2.lua index 127bf00..da95cdb 100644 --- a/Libs/AceLocale/AceLocale-2.2.lua +++ b/Libs/AceLocale/AceLocale-2.2.lua @@ -1,28 +1,29 @@ --[[ Name: AceLocale-2.2 -Revision: $Rev: 13951 $ +Revision: $Rev: 17638 $ Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team) Inspired By: Ace 1.x by Turan (turan@gryphon.com) Website: http://www.wowace.com/ Documentation: http://www.wowace.com/index.php/AceLocale-2.2 SVN: http://svn.wowace.com/root/trunk/Ace2/AceLocale-2.2 Description: Localization library for addons to use to handle proper - localization and internationalization. + localization and internationalization. Dependencies: AceLibrary ]] local MAJOR_VERSION = "AceLocale-2.2" -local MINOR_VERSION = "$Revision: 13951 $" +local MINOR_VERSION = "$Revision: 17638 $" if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end +if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check local AceLocale = {} local DEFAULT_LOCALE = "enUS" local _G = getfenv(0) -local BASE_TRANSLATIONS, DEBUGGING, TRANSLATIONS, BASE_LOCALE, TRANSLATION_TABLES, REVERSE_TRANSLATIONS, STRICTNESS, DYNAMIC_LOCALES, CURRENT_LOCALE +local BASE_TRANSLATIONS, DEBUGGING, TRANSLATIONS, BASE_LOCALE, TRANSLATION_TABLES, REVERSE_TRANSLATIONS, STRICTNESS, DYNAMIC_LOCALES, CURRENT_LOCALE, NAME local rawget = rawget local rawset = rawset @@ -63,7 +64,7 @@ local function clearCache(self) rawset(self, REVERSE_TRANSLATIONS, nil) for k in pairs(self) do - if cache[k] ~= nil then + if rawget(cache, k) ~= nil then self[k] = nil end end @@ -141,16 +142,26 @@ AceLocale.prototype = { class = AceLocale } function AceLocale.prototype:EnableDebugging() if rawget(self, BASE_TRANSLATIONS) then - AceLocale:error("Cannot enable debugging after a translation has been registered.") + AceLocale.error(self, "Cannot enable debugging after a translation has been registered.") end rawset(self, DEBUGGING, true) end -function AceLocale.prototype:EnableDynamicLocales() - if rawget(self, BASE_TRANSLATIONS) then - AceLocale:error("Cannot enable dynamic locales after a translation has been registered.") +function AceLocale.prototype:EnableDynamicLocales(override) + AceLocale.argCheck(self, override, 2, "boolean", "nil") + if not override and rawget(self, BASE_TRANSLATIONS) then + AceLocale.error(self, "Cannot enable dynamic locales after a translation has been registered.") + end + if not rawget(self, DYNAMIC_LOCALES) then + rawset(self, DYNAMIC_LOCALES, true) + if rawget(self, BASE_LOCALE) then + if not rawget(self, TRANSLATION_TABLES) then + rawset(self, TRANSLATION_TABLES, {}) + end + self[TRANSLATION_TABLES][self[BASE_LOCALE]] = self[BASE_TRANSLATIONS] + self[TRANSLATION_TABLES][self[CURRENT_LOCALE]] = self[TRANSLATIONS] + end end - rawset(self, DYNAMIC_LOCALES, true) end function AceLocale.prototype:RegisterTranslations(locale, func) @@ -163,6 +174,12 @@ function AceLocale.prototype:RegisterTranslations(locale, func) if rawget(self, BASE_TRANSLATIONS) and GetLocale() ~= locale then if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) then + if not rawget(self, TRANSLATION_TABLES) then + rawset(self, TRANSLATION_TABLES, {}) + end + if self[TRANSLATION_TABLES][locale] then + AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale) + end local t = func() func = nil if type(t) ~= "table" then @@ -240,11 +257,33 @@ end function AceLocale.prototype:GetLocale() if not rawget(self, TRANSLATION_TABLES) then - AceLocale.error(self, "Cannot call `SetLocale' without first calling `RegisterTranslations'.") + AceLocale.error(self, "Cannot call `GetLocale' without first calling `RegisterTranslations'.") end return self[CURRENT_LOCALE] end +local function iter(t, position) + return (next(t, position)) +end + +function AceLocale.prototype:IterateAvailableLocales() + if not rawget(self, DYNAMIC_LOCALES) then + AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `EnableDynamicLocales'.") + end + if not rawget(self, TRANSLATION_TABLES) then + AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `RegisterTranslations'.") + end + return iter, self[TRANSLATION_TABLES], nil +end + +function AceLocale.prototype:HasLocale(locale) + if not rawget(self, DYNAMIC_LOCALES) then + AceLocale.error(self, "Cannot call `HasLocale' without first calling `EnableDynamicLocales'.") + end + AceLocale.argCheck(self, locale, 2, "string") + return rawget(self, TRANSLATION_TABLES) and self[TRANSLATION_TABLES][locale] ~= nil +end + function AceLocale.prototype:SetStrictness(strict) AceLocale.argCheck(self, strict, 2, "boolean") local mt = getmetatable(self) @@ -350,7 +389,7 @@ function AceLocale.prototype:Debug() return end local words = {} - local locales = {"enUS", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"} + local locales = {"enUS", "ruRU", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"} local localizations = {} DEFAULT_CHAT_FRAME:AddMessage("--- AceLocale Debug ---") for _,locale in ipairs(locales) do @@ -401,7 +440,7 @@ function AceLocale.prototype:Debug() else DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q missing:", locale)) for word in pairs(t) do - DEFAULT_CHAT_FRAME:AddMessage(string.format(" %q", word)) + DEFAULT_CHAT_FRAME:AddMessage(string.format(" %q", word)) end end end @@ -444,6 +483,16 @@ local function activate(self, oldLib, oldDeactivate) DYNAMIC_LOCALES = self.DYNAMIC_LOCALES CURRENT_LOCALE = self.CURRENT_LOCALE + + local GetTime = GetTime + local timeUntilClear = GetTime() + 5 + scheduleClear = function() + if next(newRegistries) then + self.frame:Show() + timeUntilClear = GetTime() + 5 + end + end + if not self.registry then self.registry = {} else @@ -465,14 +514,6 @@ local function activate(self, oldLib, oldDeactivate) end end - local GetTime = GetTime - local timeUntilClear = GetTime() + 5 - scheduleClear = function() - if next(newRegistries) then - self.frame:Show() - timeUntilClear = GetTime() + 5 - end - end self.frame:SetScript("OnEvent", scheduleClear) self.frame:SetScript("OnUpdate", function() -- (this, elapsed) if timeUntilClear - GetTime() <= 0 then diff --git a/TableRegister/loottables.en.lua b/TableRegister/loottables.en.lua index 3ba5d94..b96ffad 100644 --- a/TableRegister/loottables.en.lua +++ b/TableRegister/loottables.en.lua @@ -1050,6 +1050,7 @@ AtlasLoot_TableNames = { ["WORLDBOSSMENU"] = { "dummy", "dummy" }, ["JEWELCRAFTMENU"] = { "dummy", "dummy" }, ["WishList"] = { AL["WishList"], "AtlasLootCharDB" }, + ["SearchResult"] = { AL["Search"], "AtlasLootCharDB" }, --If all else fails! ["EmptyInstance"] = { "AtlasLoot", "AtlasLootFallback" }, };