updated AceLocale lib
This commit is contained in:
Spit
2025-03-14 18:15:30 +03:00
parent a4adec0ab3
commit 8568efa2ca
5 changed files with 102 additions and 63 deletions
+1 -3
View File
@@ -3,8 +3,7 @@
## Notes: Shows possible loot from dungeon bosses and other sources. ## 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) ## 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) ## 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 ## Version: 3.1.0
## SavedVariables: AtlasLoot_updateavailable
## SavedVariablesPerCharacter: AtlasLootCharDB ## SavedVariablesPerCharacter: AtlasLootCharDB
## OptionalDeps: Alphamap, AtlasLoader, LootLink, ItemSync, HewdropLib, Ace2, EquipCompare, EQCompare ## 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 Libs\Hewdrop\Hewdrop-2.0.lua
Locale\Locale.xml Locale\Locale.xml
# Bossnames\BossNames.xml
Sets\Sets.xml Sets\Sets.xml
Crafting\Crafting.xml Crafting\Crafting.xml
PvP\PvP.xml PvP\PvP.xml
+37 -37
View File
@@ -214,37 +214,37 @@ function AtlasLoot_OnVariablesLoaded()
AtlasLootItemsFrame:Hide(); AtlasLootItemsFrame:Hide();
end end
--Check and migrate old WishList entry format to the newer one --Check and migrate old WishList entry format to the newer one
if version < 40301 then -- if version < 40301 then
--Check if we really need to do a migration since it will load all modules -- --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 -- --We also create a helper table here which store IDs that need to search for
local idsToSearch = {}; -- local idsToSearch = {};
for i = 1, table.getn(AtlasLootCharDB["WishList"]) do -- for i = 1, table.getn(AtlasLootCharDB["WishList"]) do
if (type(AtlasLootCharDB["WishList"][i][1]) == "number") then -- if (type(AtlasLootCharDB["WishList"][i][1]) == "number") then
if (AtlasLootCharDB["WishList"][i][1] > 0 and not AtlasLootCharDB["WishList"][i][5]) then -- if (AtlasLootCharDB["WishList"][i][1] > 0 and not AtlasLootCharDB["WishList"][i][5]) then
tinsert(idsToSearch, i, AtlasLootCharDB["WishList"][i][1]); -- tinsert(idsToSearch, i, AtlasLootCharDB["WishList"][i][1]);
end -- end
end -- end
end -- end
if table.getn(idsToSearch) > 0 then -- if table.getn(idsToSearch) > 0 then
--Let's do this -- --Let's do this
for _, dataSource in ipairs(AtlasLoot_SearchTables) do -- for _, dataSource in ipairs(AtlasLoot_SearchTables) do
if AtlasLoot_Data[dataSource] then -- if AtlasLoot_Data[dataSource] then
for dataID, lootTable in pairs(AtlasLoot_Data[dataSource]) do -- for dataID, lootTable in pairs(AtlasLoot_Data[dataSource]) do
for _, entry in ipairs(lootTable) do -- for _, entry in ipairs(lootTable) do
for k, v in pairs(idsToSearch) do -- for k, v in pairs(idsToSearch) do
if(entry[1] == v)then -- if(entry[1] == v)then
AtlasLootCharDB["WishList"][k][5] = dataID.."|"..dataSource; -- AtlasLootCharDB["WishList"][k][5] = dataID.."|"..dataSource;
break; -- break;
end -- end
end -- end
end -- end
end -- end
end -- end
end -- end
end -- end
AtlasLootCharDB.AutoQuery = false; -- AtlasLootCharDB.AutoQuery = false;
AtlasLootOptions_Init(); -- AtlasLootOptions_Init();
end -- end
--Adds an AtlasLoot button to the Feature Frame in Cosmos --Adds an AtlasLoot button to the Feature Frame in Cosmos
if(EarthFeature_AddButton) then if(EarthFeature_AddButton) then
EarthFeature_AddButton( EarthFeature_AddButton(
@@ -360,14 +360,14 @@ function AtlasLootOptions_Fresh()
AtlasLootCharDB.Opaque = false; AtlasLootCharDB.Opaque = false;
AtlasLootCharDB.ItemIDs = false; AtlasLootCharDB.ItemIDs = false;
AtlasLootCharDB.FirstTime = true; AtlasLootCharDB.FirstTime = true;
AtlasLootCharDB.ItemSpam = true; AtlasLootCharDB.ItemSpam = false;
AtlasLootCharDB.MinimapButton = true; AtlasLootCharDB.MinimapButton = true;
AtlasLootCharDB.MinimapButtonPosition = 315; AtlasLootCharDB.MinimapButtonPosition = 315;
AtlasLootCharDB.MinimapButtonRadius = 78; AtlasLootCharDB.MinimapButtonRadius = 78;
AtlasLootCharDB.HidePanel = false; AtlasLootCharDB.HidePanel = false;
AtlasLootCharDB.LastBoss = "DUNGEONSMENU1"; AtlasLootCharDB.LastBoss = "DUNGEONSMENU1";
AtlasLootCharDB.LastBossText = AL["Dungeons & Raids"]; AtlasLootCharDB.LastBossText = AL["Dungeons & Raids"];
AtlasLootCharDB.AutoQuery = false; -- AtlasLootCharDB.AutoQuery = false;
AtlasLootCharDB.PartialMatching = true; AtlasLootCharDB.PartialMatching = true;
end end
@@ -2070,8 +2070,8 @@ function AtlasLootOptions_ResetPosition()
end end
function AtlasLootOptions_DefaultSettings() function AtlasLootOptions_DefaultSettings()
AtlasLootCharDB.SafeLinks = true; AtlasLootCharDB.SafeLinks = false;
AtlasLootCharDB.AllLinks = false; AtlasLootCharDB.AllLinks = true;
AtlasLootCharDB.DefaultTT = true; AtlasLootCharDB.DefaultTT = true;
AtlasLootCharDB.LootlinkTT = false; AtlasLootCharDB.LootlinkTT = false;
AtlasLootCharDB.ItemSyncTT = false; AtlasLootCharDB.ItemSyncTT = false;
@@ -2082,7 +2082,7 @@ function AtlasLootOptions_DefaultSettings()
AtlasLootCharDB.ItemSpam = true; AtlasLootCharDB.ItemSpam = true;
AtlasLootCharDB.MinimapButton = true; AtlasLootCharDB.MinimapButton = true;
AtlasLootCharDB.HidePanel = false; AtlasLootCharDB.HidePanel = false;
AtlasLootCharDB.AutoQuery = false; -- AtlasLootCharDB.AutoQuery = false;
AtlasLootCharDB.PartialMatching = true; AtlasLootCharDB.PartialMatching = true;
AtlasLootCharDB.LastBoss = "DUNGEONSMENU1"; AtlasLootCharDB.LastBoss = "DUNGEONSMENU1";
AtlasLootCharDB.LastBossText = AL["Dungeons & Raids"]; AtlasLootCharDB.LastBossText = AL["Dungeons & Raids"];
@@ -3148,7 +3148,7 @@ function AtlasLootItem_OnEnter()
getglobal("AtlasLootTooltipTextRight"..i):SetText(""); getglobal("AtlasLootTooltipTextRight"..i):SetText("");
end end
end end
if (this.itemID ~= 0) then if (this.itemID and this.itemID ~= 0) then
if string.sub(this.itemID, 1, 1) == "s" then if string.sub(this.itemID, 1, 1) == "s" then
isItem = false; isItem = false;
isEnchant = false; isEnchant = false;
+1 -2
View File
@@ -8125,7 +8125,6 @@ AtlasLoot_Data["AtlasLootItems"] = {
{ 20381, "INV_Misc_MonsterScales_11", "=q2=Dreamscale", "", "5%" }, { 20381, "INV_Misc_MonsterScales_11", "=q2=Dreamscale", "", "5%" },
{ 61197, "INV_Stone_05", "=q3=Fading Dream Fragment", "", "0.35%" }, { 61197, "INV_Stone_05", "=q3=Fading Dream Fragment", "", "0.35%" },
{ 0, "", "", "" }, { 0, "", "", "" },
{ 54001, "INV_Crate_02", "=q2=Dream Frog", "=ds=#e15#", "0.08%" }, { 54001, "INV_Crate_02", "=q3=Dream Frog", "=ds=#e15#", "0.08%" },
}; };
}; };
+59 -18
View File
@@ -1,6 +1,6 @@
--[[ --[[
Name: AceLocale-2.2 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) 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) Inspired By: Ace 1.x by Turan (turan@gryphon.com)
Website: http://www.wowace.com/ Website: http://www.wowace.com/
@@ -12,17 +12,18 @@ Dependencies: AceLibrary
]] ]]
local MAJOR_VERSION = "AceLocale-2.2" 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 then error(MAJOR_VERSION .. " requires AceLibrary.") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return 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 AceLocale = {}
local DEFAULT_LOCALE = "enUS" local DEFAULT_LOCALE = "enUS"
local _G = getfenv(0) 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 rawget = rawget
local rawset = rawset local rawset = rawset
@@ -63,7 +64,7 @@ local function clearCache(self)
rawset(self, REVERSE_TRANSLATIONS, nil) rawset(self, REVERSE_TRANSLATIONS, nil)
for k in pairs(self) do for k in pairs(self) do
if cache[k] ~= nil then if rawget(cache, k) ~= nil then
self[k] = nil self[k] = nil
end end
end end
@@ -141,16 +142,26 @@ AceLocale.prototype = { class = AceLocale }
function AceLocale.prototype:EnableDebugging() function AceLocale.prototype:EnableDebugging()
if rawget(self, BASE_TRANSLATIONS) then 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 end
rawset(self, DEBUGGING, true) rawset(self, DEBUGGING, true)
end end
function AceLocale.prototype:EnableDynamicLocales() function AceLocale.prototype:EnableDynamicLocales(override)
if rawget(self, BASE_TRANSLATIONS) then AceLocale.argCheck(self, override, 2, "boolean", "nil")
AceLocale:error("Cannot enable dynamic locales after a translation has been registered.") if not override and rawget(self, BASE_TRANSLATIONS) then
AceLocale.error(self, "Cannot enable dynamic locales after a translation has been registered.")
end end
if not rawget(self, DYNAMIC_LOCALES) then
rawset(self, DYNAMIC_LOCALES, true) 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
end end
function AceLocale.prototype:RegisterTranslations(locale, func) 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, BASE_TRANSLATIONS) and GetLocale() ~= locale then
if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) 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() local t = func()
func = nil func = nil
if type(t) ~= "table" then if type(t) ~= "table" then
@@ -240,11 +257,33 @@ end
function AceLocale.prototype:GetLocale() function AceLocale.prototype:GetLocale()
if not rawget(self, TRANSLATION_TABLES) then 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 end
return self[CURRENT_LOCALE] return self[CURRENT_LOCALE]
end 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) function AceLocale.prototype:SetStrictness(strict)
AceLocale.argCheck(self, strict, 2, "boolean") AceLocale.argCheck(self, strict, 2, "boolean")
local mt = getmetatable(self) local mt = getmetatable(self)
@@ -350,7 +389,7 @@ function AceLocale.prototype:Debug()
return return
end end
local words = {} local words = {}
local locales = {"enUS", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"} local locales = {"enUS", "ruRU", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"}
local localizations = {} local localizations = {}
DEFAULT_CHAT_FRAME:AddMessage("--- AceLocale Debug ---") DEFAULT_CHAT_FRAME:AddMessage("--- AceLocale Debug ---")
for _,locale in ipairs(locales) do for _,locale in ipairs(locales) do
@@ -444,6 +483,16 @@ local function activate(self, oldLib, oldDeactivate)
DYNAMIC_LOCALES = self.DYNAMIC_LOCALES DYNAMIC_LOCALES = self.DYNAMIC_LOCALES
CURRENT_LOCALE = self.CURRENT_LOCALE 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 if not self.registry then
self.registry = {} self.registry = {}
else else
@@ -465,14 +514,6 @@ local function activate(self, oldLib, oldDeactivate)
end end
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("OnEvent", scheduleClear)
self.frame:SetScript("OnUpdate", function() -- (this, elapsed) self.frame:SetScript("OnUpdate", function() -- (this, elapsed)
if timeUntilClear - GetTime() <= 0 then if timeUntilClear - GetTime() <= 0 then
+1
View File
@@ -1050,6 +1050,7 @@ AtlasLoot_TableNames = {
["WORLDBOSSMENU"] = { "dummy", "dummy" }, ["WORLDBOSSMENU"] = { "dummy", "dummy" },
["JEWELCRAFTMENU"] = { "dummy", "dummy" }, ["JEWELCRAFTMENU"] = { "dummy", "dummy" },
["WishList"] = { AL["WishList"], "AtlasLootCharDB" }, ["WishList"] = { AL["WishList"], "AtlasLootCharDB" },
["SearchResult"] = { AL["Search"], "AtlasLootCharDB" },
--If all else fails! --If all else fails!
["EmptyInstance"] = { "AtlasLoot", "AtlasLootFallback" }, ["EmptyInstance"] = { "AtlasLoot", "AtlasLootFallback" },
}; };