Merge ilithyia-addons fork (v0.8.8e)
- Russian localization (by Maus) - FishingSchools: track fishing pools, Gatherer integration - FishingOutfitter: Outfitter addon integration - Interface 11200 (patch 1.12 support) - Improved options system with dependencies - Better watcher frame positioning - Various bugfixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+72
-81
@@ -2,91 +2,45 @@
|
||||
--
|
||||
-- Load out translation strings and such
|
||||
|
||||
FishingBuddy = {};
|
||||
|
||||
FishingBuddy.VERSION = "0.8.6h";
|
||||
FishingBuddy.CURRENTVERSION = 8600;
|
||||
FishingBuddy.VERSION = GetAddOnMetadata("FishingBuddy", "Version");
|
||||
FishingBuddy.CURRENTVERSION = 8800;
|
||||
|
||||
FishingBuddy.Colors = {};
|
||||
FishingBuddy.Colors.RED = "ffff0000";
|
||||
FishingBuddy.Colors.GREEN = "ff00ff00";
|
||||
FishingBuddy.Colors.BLUE = "ff0000ff";
|
||||
FishingBuddy.Colors.YELLOW = "ff00ffff";
|
||||
FishingBuddy.Colors.PURPLE = "ffff00ff";
|
||||
FishingBuddy.Colors.WHITE = "ffffffff";
|
||||
|
||||
-- debugging
|
||||
FishingBuddy.DEFAULT_MINIMAP_POSITION = 256;
|
||||
|
||||
FishingBuddy.printable = function(foo)
|
||||
if ( foo ) then
|
||||
if ( type(foo) == "table" ) then
|
||||
return "table";
|
||||
elseif ( type(foo) == "boolean" ) then
|
||||
if ( foo ) then
|
||||
return "true";
|
||||
else
|
||||
return "false";
|
||||
end
|
||||
else
|
||||
return foo;
|
||||
end
|
||||
else
|
||||
return "nil";
|
||||
end
|
||||
end
|
||||
local Setup = {};
|
||||
|
||||
FishingBuddy.Output = function(msg, r, g, b)
|
||||
if ( DEFAULT_CHAT_FRAME ) then
|
||||
if ( not r ) then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(msg);
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local FishingBuddy_Debugging = 1;
|
||||
FishingBuddy.Debug = function(msg, fixlinks)
|
||||
if ( FishingBuddy_Debugging == 1 ) then
|
||||
if ( fixlinks ) then
|
||||
msg = string.gsub(msg, "|", ";");
|
||||
end
|
||||
local name = FishingBuddy.Name or "Fishing Buddy";
|
||||
FishingBuddy.Output("|c"..FishingBuddy.Colors.RED..name.." DEBUG|r "..msg);
|
||||
end
|
||||
end
|
||||
|
||||
FishingBuddy.Dump = function(thing)
|
||||
if ( FishingBuddy_Debugging == 1 ) then
|
||||
if ( DevTools_Dump ) then
|
||||
DevTools_Dump(thing);
|
||||
else
|
||||
FishingBuddy.Debug("Tried to dump a '"..FishingBuddy.printable(thing).."'.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function LoadTranslation(lang)
|
||||
local translation = FishingTranslations[lang];
|
||||
for tag,value in translation do
|
||||
if ( not FishingBuddy[tag] ) then
|
||||
FishingBuddy[tag] = value;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function FixupThis(tag, what)
|
||||
Setup.FixupThis = function(tag, what)
|
||||
if ( type(what) == "table" ) then
|
||||
for idx,str in what do
|
||||
what[idx] = FixupThis(tag, str);
|
||||
what[idx] = Setup.FixupThis(tag, str);
|
||||
end
|
||||
return what;
|
||||
elseif ( type(what) == "string" ) then
|
||||
local pattern = "#([A-Z0-9]+)#";
|
||||
local pattern = "#([A-Z0-9_]+)#";
|
||||
local s,e,w = string.find(what, pattern);
|
||||
while ( w ) do
|
||||
local s1 = strsub(what, 1, s-1);
|
||||
local s2 = strsub(what, e+1);
|
||||
what = s1..FishingBuddy[w]..s2;
|
||||
s,e,w = string.find(what, pattern);
|
||||
if ( type(FishingBuddy[w]) == "string" ) then
|
||||
local s1 = strsub(what, 1, s-1);
|
||||
local s2 = strsub(what, e+1);
|
||||
what = s1..FishingBuddy[w]..s2;
|
||||
s,e,w = string.find(what, pattern);
|
||||
elseif ( FishingBuddy.Colors[w] ) then
|
||||
local s1 = strsub(what, 1, s-1);
|
||||
local s2 = strsub(what, e+1);
|
||||
what = s1..FishingBuddy.Colors[w]..s2;
|
||||
s,e,w = string.find(what, pattern);
|
||||
else
|
||||
-- stop if we can't find something to replace it with
|
||||
w = nil;
|
||||
end
|
||||
end
|
||||
return what;
|
||||
else
|
||||
@@ -95,15 +49,15 @@ local function FixupThis(tag, what)
|
||||
end
|
||||
end
|
||||
|
||||
local function FixupStrings()
|
||||
Setup.FixupStrings = function(locale)
|
||||
local translation = FishingTranslations["enUS"];
|
||||
for tag,str in translation do
|
||||
FishingBuddy[tag] = FixupThis(tag, str);
|
||||
for tag,_ in translation do
|
||||
FishingBuddy[tag] = Setup.FixupThis(tag, FishingBuddy[tag]);
|
||||
end
|
||||
end
|
||||
|
||||
local function FixupBindings(lang)
|
||||
local translation = FishingTranslations[lang];
|
||||
Setup.FixupBindings = function()
|
||||
local translation = FishingTranslations["enUS"];
|
||||
for tag,str in translation do
|
||||
if ( string.find(tag, "^BINDING") ) then
|
||||
setglobal(tag, FishingBuddy[tag]);
|
||||
@@ -112,18 +66,48 @@ local function FixupBindings(lang)
|
||||
end
|
||||
end
|
||||
|
||||
local locale = GetLocale();
|
||||
LoadTranslation(locale);
|
||||
if ( locale ~= "enUS" ) then
|
||||
LoadTranslation("enUS");
|
||||
local missing = {};
|
||||
Setup.LoadTranslation = function(lang, record)
|
||||
local translation = FishingTranslations[lang];
|
||||
for tag,value in translation do
|
||||
if ( not FishingBuddy[tag] ) then
|
||||
FishingBuddy[tag] = value;
|
||||
if ( record ) then
|
||||
missing[tag] = 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
FixupStrings();
|
||||
FixupBindings(locale);
|
||||
|
||||
Setup.Translate = function()
|
||||
local locale = GetLocale();
|
||||
if ( FBEnEspagnolFlag ) then
|
||||
locale = "esES";
|
||||
end
|
||||
--locale = "deDE";
|
||||
Setup.LoadTranslation(locale);
|
||||
if ( locale ~= "enUS" ) then
|
||||
Setup.LoadTranslation("enUS");
|
||||
end
|
||||
Setup.FixupStrings(locale);
|
||||
Setup.FixupBindings();
|
||||
end
|
||||
|
||||
Setup.Translate();
|
||||
|
||||
-- throw all this away now that we're done with it
|
||||
Setup = nil;
|
||||
-- dump the memory we've allocated for all the translations
|
||||
FishingTranslations = nil;
|
||||
|
||||
FishingBuddy.BYWEEKS_TABLE = {["Jan"] = 0, ["Apr"] = 13, ["Jul"] = 26, ["Oct"] = 39, ["Dec"] = 52};
|
||||
local byweeks = {};
|
||||
byweeks[FishingBuddy.ABBREV_JANUARY] = 0;
|
||||
byweeks[FishingBuddy.ABBREV_APRIL] = 13;
|
||||
byweeks[FishingBuddy.ABBREV_JULY] = 26;
|
||||
byweeks[FishingBuddy.ABBREV_OCTOBER] = 39;
|
||||
byweeks[FishingBuddy.ABBREV_DECEMBER] = 52;
|
||||
|
||||
FishingBuddy.BYWEEKS_TABLE = byweeks;
|
||||
|
||||
FishingBuddy.KEYS_NONE = 0;
|
||||
FishingBuddy.KEYS_SHIFT = 1;
|
||||
@@ -134,3 +118,10 @@ FishingBuddy.Keys[FishingBuddy.KEYS_NONE] = FishingBuddy.KEYS_NONE_TEXT;
|
||||
FishingBuddy.Keys[FishingBuddy.KEYS_SHIFT] = FishingBuddy.KEYS_SHIFT_TEXT;
|
||||
FishingBuddy.Keys[FishingBuddy.KEYS_CTRL] = FishingBuddy.KEYS_CTRL_TEXT;
|
||||
FishingBuddy.Keys[FishingBuddy.KEYS_ALT] = FishingBuddy.KEYS_ALT_TEXT;
|
||||
|
||||
FishingBuddy.SCHOOL_FISH = 0;
|
||||
FishingBuddy.SCHOOL_WRECKAGE = 1;
|
||||
FishingBuddy.SCHOOL_DEBRIS = 2;
|
||||
FishingBuddy.SCHOOL_WATER = 3;
|
||||
FishingBuddy.SCHOOL_TASTY = 4;
|
||||
FishingBuddy.SCHOOL_OIL = 5;
|
||||
|
||||
Reference in New Issue
Block a user