diff --git a/Fishbringer-BCC.toc b/Fishbringer-BCC.toc new file mode 100644 index 0000000..3ab49b5 --- /dev/null +++ b/Fishbringer-BCC.toc @@ -0,0 +1,24 @@ +## Interface: 20504 +## Title: Fishbringer +## Title-deDE: Fishbringer +## Title-ruRU: Fishbringer +## Notes: The legendary Fishbringer, Guide of the Scarlet Highlord! Nat Pagle would be proud of you! +## Notes-deDE: Das legendäre Fishbringer, Leitfaden des Scharlachroten Hochlords! Nat Pagle wäre stolz auf dich! +## Notes-ruRU: Легендарный Рыболов, проводник Повелителя Алого ордена! Нат Пэгл гордился бы тобой! +## Notes-esES: ¡El legendario Fishbringer, guía del Scarlet Highlord! ¡Nat Pagle estaría orgulloso de ti! +## Notes-frFR: Le légendaire Fishbringer, guide du seigneur écarlate ! Nat Pagle serait fier de vous ! +## Notes-ptBR: O lendário Fishbringer, Guia do Highlord Escarlate! Nat Pagle ficaria orgulhoso de você! +## Author: Kalerath, Fye (Localization Code & Bugfixes), Zilom (Bugfixes & Localization Redesigned + Added), leafoe (Russian Localization) +## SavedVariables: FishbringerDB +## Version: 3.0.3 + +# main: +localization.core.lua +fishy.lua + +# localizations: +Localization.deDE.lua +Localization.ruRU.lua +Localization.esES.lua +Localization.frFR.lua +Localization.ptBR.lua diff --git a/Fishbringer-Classic.toc b/Fishbringer-Classic.toc new file mode 100644 index 0000000..8d850ed --- /dev/null +++ b/Fishbringer-Classic.toc @@ -0,0 +1,24 @@ +## Interface: 11403 +## Title: Fishbringer +## Title-deDE: Fishbringer +## Title-ruRU: Fishbringer +## Notes: The legendary Fishbringer, Guide of the Scarlet Highlord! Nat Pagle would be proud of you! +## Notes-deDE: Das legendäre Fishbringer, Leitfaden des Scharlachroten Hochlords! Nat Pagle wäre stolz auf dich! +## Notes-ruRU: Легендарный Рыболов, проводник Повелителя Алого ордена! Нат Пэгл гордился бы тобой! +## Notes-esES: ¡El legendario Fishbringer, guía del Scarlet Highlord! ¡Nat Pagle estaría orgulloso de ti! +## Notes-frFR: Le légendaire Fishbringer, guide du seigneur écarlate ! Nat Pagle serait fier de vous ! +## Notes-ptBR: O lendário Fishbringer, Guia do Highlord Escarlate! Nat Pagle ficaria orgulhoso de você! +## Author: Kalerath, Fye (Localization Code & Bugfixes), Zilom (Bugfixes & Localization Redesigned + Added), leafoe (Russian Localization) +## SavedVariables: FishbringerDB +## Version: 3.0.3 + +# main: +localization.core.lua +fishy.lua + +# localizations: +Localization.deDE.lua +Localization.ruRU.lua +Localization.esES.lua +Localization.frFR.lua +Localization.ptBR.lua diff --git a/Fishbringer-Wrath.toc b/Fishbringer-Wrath.toc new file mode 100644 index 0000000..6cd7e09 --- /dev/null +++ b/Fishbringer-Wrath.toc @@ -0,0 +1,24 @@ +## Interface: 30400 +## Title: Fishbringer +## Title-deDE: Fishbringer +## Title-ruRU: Fishbringer +## Notes: The legendary Fishbringer, Guide of the Scarlet Highlord! Nat Pagle would be proud of you! +## Notes-deDE: Das legendäre Fishbringer, Leitfaden des Scharlachroten Hochlords! Nat Pagle wäre stolz auf dich! +## Notes-ruRU: Легендарный Рыболов, проводник Повелителя Алого ордена! Нат Пэгл гордился бы тобой! +## Notes-esES: ¡El legendario Fishbringer, guía del Scarlet Highlord! ¡Nat Pagle estaría orgulloso de ti! +## Notes-frFR: Le légendaire Fishbringer, guide du seigneur écarlate ! Nat Pagle serait fier de vous ! +## Notes-ptBR: O lendário Fishbringer, Guia do Highlord Escarlate! Nat Pagle ficaria orgulhoso de você! +## Author: Kalerath, Fye (Localization Code & Bugfixes), Zilom (Bugfixes & Localization Redesigned + Added), leafoe (Russian Localization) +## SavedVariables: FishbringerDB +## Version: 3.0.3 + +# main: +localization.core.lua +fishy.lua + +# localizations: +Localization.deDE.lua +Localization.ruRU.lua +Localization.esES.lua +Localization.frFR.lua +Localization.ptBR.lua diff --git a/Fishbringer.toc b/Fishbringer.toc old mode 100755 new mode 100644 index 6f62619..4967ac9 --- a/Fishbringer.toc +++ b/Fishbringer.toc @@ -1,8 +1,10 @@ -## Interface: 11302 +## Interface: 20503 ## Title: Fishbringer ## Notes: The legendary Fishbringer, Guide of the Scarlet Highlord! Nat Pagle would be proud of you! -## Author: Kalerath -## SavedVariables: FishbringerDB -## Version: 1.13-3 +## Author: Kalerath, Fye (Localization Code & Bugfixes), Zilom (Bugfixes & Localization Redesigned + Added), leafoe (Russian Localization) +## Version: 2.5.4 -fishy.lua +# main: +localization.core.lua + +# This file is here for compatibility with CurseForge only. it has no function whatsoever \ No newline at end of file diff --git a/Localization.deDE.lua b/Localization.deDE.lua new file mode 100644 index 0000000..cbba643 --- /dev/null +++ b/Localization.deDE.lua @@ -0,0 +1,27 @@ +local ADDON_NAME, namespace = ... +local L = namespace.L + +if namespace.locale == "deDE" then + + --ShowHelp Funktion + L["Nat Pagle would be proud of you."] = "Nat Pagle wäre stolz auf dich!" + L["- /fishbringer show - Toggles visibility."] = "- /fishbringer show - Fishbringer Bildschirmanzeige an/aus." + L["- /fishbringer align - Cycles through text alignment."] = "- /fishbringer align - Textausrichtung ändern." + L["- /fishbringer count - Toggles fish count visibility."] = "- /fishbringer count - Gefangene Fische auf dem Level anzeigen an/aus." + L["- /fishbringer reset - Resets the fish database."] = "- /fishbringer reset - Fishbringer Datenbank zurücksetzen." + + --Anzeige auf Bildschirm + L["\124c%s%s\124r\nNo fish in this zone"] = "\124c%s%s\124r\nKein fisch in dieser zone" + L["\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)"] = "\124c%s%s\124r\n%d Angelskill benötigt zum Angeln\n(%d benötigt für 100%% Fangchance)" + L["%d%% catch rate"] = "%d%% Fangchance" + L["%s%s fishing skill%s"] = "%s%s Angelskill%s" + L["\n%d fish needed to skill up"] = "\n%d Fische benötigt für Skillpunkt" + L["%d fish caught at this level"] = "%d Fische auf diesem Level gefangen" + + -- Name des Angelperks / Name of the Fishingperk + L["Fishing"] = "Angeln" + + -- Login Message + L["Pack yer bags, we be leavin' fer fishin'!"] = "Pack deine Taschen, wir gehen angeln!" + +return end \ No newline at end of file diff --git a/Localization.esES.lua b/Localization.esES.lua new file mode 100644 index 0000000..31ddbca --- /dev/null +++ b/Localization.esES.lua @@ -0,0 +1,27 @@ +local ADDON_NAME, namespace = ... +local L = namespace.L + +if namespace.locale == "esES" then + + --ShowHelp Function + L["Nat Pagle would be proud of you."] = "Nat Pagle estaría orgulloso de ti." + L["- /fishbringer show - Toggles visibility."] = "- /fishbringer show - Alterna la visibilidad." + L["- /fishbringer align - Cycles through text alignment."] = "- /fishbringer align - Recorre la alineación del texto." + L["- /fishbringer count - Toggles fish count visibility."] = "- /fishbringer count - Alterna la visibilidad del recuento de peces." + L["- /fishbringer reset - Resets the fish database."] = "- /fishbringer reset - Restablece la base de datos de peces." + + --Fishbringer Overlay/Display Widget + L["\124c%s%s\124r\nNo fish in this zone"] = "\124c%s%s\124r\nNo hay peces en esta zona" + L["\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)"] = "\124c%s%s\124r\n%d habilidad necesaria para pescar\n(%d necesario para una tasa de captura del 100%%)" + L["%d%% catch rate"] = "%d%% tasa de captura" + L["%s%s fishing skill%s"] = "%s%s habilidad de pesca" + L["\n%d fish needed to skill up"] = "\n%d peces necesarios para mejorar" + L["%d fish caught at this level"] = "%d pescado capturado a este nivel" + + -- Angeln/Fishing - Name of the Fishing Perk + L["Fishing"] = "Pescar" + + -- Welcome Message on Login + L["Pack yer bags, we be leavin' fer fishin'!"] = "¡Prepara tus maletas, nos vamos 'a pescar'!" + +return end diff --git a/Localization.frFR.lua b/Localization.frFR.lua new file mode 100644 index 0000000..58eb134 --- /dev/null +++ b/Localization.frFR.lua @@ -0,0 +1,27 @@ +local ADDON_NAME, namespace = ... +local L = namespace.L + +if namespace.locale == "frFR" then + + --ShowHelp Function + L["Nat Pagle would be proud of you."] = "Nat Pagle serait fier de vous." + L["- /fishbringer show - Toggles visibility."] = "- /fishbringer show - Bascule la visibilité." + L["- /fishbringer align - Cycles through text alignment."] = "- /fishbringer align - Fait défiler l'alignement du texte." + L["- /fishbringer count - Toggles fish count visibility."] = "- /fishbringer count - Bascule la visibilité du nombre de poissons." + L["- /fishbringer reset - Resets the fish database."] = "- /fishbringer reset - Réinitialise la base de données des poissons." + + --Fishbringer Overlay/Display Widget + L["\124c%s%s\124r\nNo fish in this zone"] = "\124c%s%s\124r\nPas de poisson dans cette zone" + L["\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)"] = "\124c%s%s\124r\n%d compétence nécessaire pour pêcher\n(%d nécessaire pour un taux de capture de 100%%)" + L["%d%% catch rate"] = "%d%% taux de capture" + L["%s%s fishing skill%s"] = "%s%s compétence de pêche" + L["\n%d fish needed to skill up"] = "\n%d рыб poisson nécessaire pour se perfectionner" + L["%d fish caught at this level"] = "%d poisson pêché à ce niveau" + + -- Angeln/Fishing - Name of the Fishing Perk + L["Fishing"] = "Pêche" + + -- Welcome Message on Login + L["Pack yer bags, we be leavin' fer fishin'!"] = "Faites vos valises, nous partons « à la pêche » !" + +return end diff --git a/Localization.ptBR.lua b/Localization.ptBR.lua new file mode 100644 index 0000000..f43d92d --- /dev/null +++ b/Localization.ptBR.lua @@ -0,0 +1,27 @@ +local ADDON_NAME, namespace = ... +local L = namespace.L + +if namespace.locale == "ptBR" then + + --ShowHelp Function + L["Nat Pagle would be proud of you."] = "Nat Pagle ficaria orgulhoso de você." + L["- /fishbringer show - Toggles visibility."] = "- /fishbringer show - Alterna a visibilidade." + L["- /fishbringer align - Cycles through text alignment."] = "- /fishbringer align - Percorre o alinhamento do texto." + L["- /fishbringer count - Toggles fish count visibility."] = "- /fishbringer count - Alterna a visibilidade da contagem de peixes." + L["- /fishbringer reset - Resets the fish database."] = "- /fishbringer reset - Reinicia o banco de dados de peixes." + + --Fishbringer Overlay/Display Widget + L["\124c%s%s\124r\nNo fish in this zone"] = "\124c%s%s\124r\nNenhum peixe nesta zona" + L["\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)"] = "\124c%s%s\124r\n%d habilidade necessária para pescar\n(%d necessário para 100%% de taxa de captura)" + L["%d%% catch rate"] = "%d%% taxa de captura" + L["%s%s fishing skill%s"] = "%s%s habilidade de pesca" + L["\n%d fish needed to skill up"] = "\n%d peixes precisavam de habilidade" + L["%d fish caught at this level"] = "%d peixes capturados neste nível" + + -- Angeln/Fishing - Name of the Fishing Perk + L["Fishing"] = "pescaria" + + -- Welcome Message on Login + L["Pack yer bags, we be leavin' fer fishin'!"] = "Faça as malas, vamos partir 'para pescar'!" + +return end diff --git a/Localization.ruRU.lua b/Localization.ruRU.lua new file mode 100644 index 0000000..96e3a73 --- /dev/null +++ b/Localization.ruRU.lua @@ -0,0 +1,27 @@ +local ADDON_NAME, namespace = ... +local L = namespace.L + +if namespace.locale == "ruRU" then + + --ShowHelp Function + L["Nat Pagle would be proud of you."] = "Нат Пэгл будет гордиться тобой." + L["- /fishbringer show - Toggles visibility."] = "- /fishbringer show - Переключает видимость." + L["- /fishbringer align - Cycles through text alignment."] = "- /fishbringer align - Выравнивание текста." + L["- /fishbringer count - Toggles fish count visibility."] = "- /fishbringer count - Переключает видимость счетчика пойманной рыбы." + L["- /fishbringer reset - Resets the fish database."] = "- /fishbringer reset - Сбросить данные." + + --Fishbringer Overlay/Display Widget + L["\124c%s%s\124r\nNo fish in this zone"] = "\124c%s%s\124r\nВ этой зоне нет рыбы" + L["\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)"] = "\124c%s%s\124r\n%d навыка требуется для рыбалки\n(%d требуется для 100%% успеха)" + L["%d%% catch rate"] = "%d%% шанс поймать" + L["%s%s fishing skill%s"] = "%s%s навык рыбной ловли" + L["\n%d fish needed to skill up"] = "\n%d рыб осталось до повышения навыка" + L["%d fish caught at this level"] = "%d рыб поймано на этом уровне" + + -- Angeln/Fishing - Name of the Fishing Perk + L["Fishing"] = "Рыбная ловля" + + -- Welcome Message on Login + L["Pack yer bags, we be leavin' fer fishin'!"] = "Пакуй снасти, валим рыбачить!" + +return end diff --git a/fishy.lua b/fishy.lua index 4ea9c24..735e86b 100755 --- a/fishy.lua +++ b/fishy.lua @@ -1,14 +1,24 @@ -FishbringerDB = {} local FONT = select(1, GameFontNormalSmall:GetFont()) local fb = CreateFrame"Frame" local db local char = string.format("%s - %s", UnitName"player", GetRealmName()) +local ADDON_NAME, namespace = ... --localization +local L = namespace.L --localization +local version = GetAddOnMetadata(ADDON_NAME, "Version") +local addoninfo = 'v'..version +local _,_,_,interface = GetBuildInfo() +local classicEra = (interface>10000 and interface<12000) +local classicTBC = (interface>20000 and interface<30000) +local classicWrath = (interface>30000 and interface<40000) +local areaTable = {} + fb:RegisterEvent"PLAYER_ENTERING_WORLD" fb:RegisterEvent"ADDON_LOADED" fb:RegisterEvent"COMBAT_LOG_EVENT" fb:RegisterEvent"SKILL_LINES_CHANGED" -fb:RegisterEvent"LOOT_OPENED" +fb:RegisterEvent"LOOT_READY" +fb:RegisterEvent"LOOT_CLOSED" fb:RegisterEvent"ZONE_CHANGED_NEW_AREA" fb:RegisterEvent"ZONE_CHANGED" fb:RegisterEvent"UNIT_INVENTORY_CHANGED" @@ -18,93 +28,112 @@ local function Print(text) end local zones = { - ["Dun Morogh"] = -70, - ["Durotar"] = -70, - ["Elwynn Forest"] = -70, - ["Mulgore"] = -70, - ["Eversong Forest"] = -70, - ["Azuremyst Isle"] = -70, - ["Teldrassil"] = -70, - ["Tirisfal Glades"] = -70, - ["Orgrimmar"] = -20, - ["Ironforge"] = -20, - ["Stormwind City"] = -20, - ["Thunder Bluff"] = -20, - ["Silvermoon City"] = -20, - ["The Exodar"] = -20, - ["Darnassus"] = -20, - ["Undercity"] = -20, - ["The Barrens"] = -20, - ["Blackfathom Deeps"] = -20, - ["Bloodmyst Isle"] = -20, - ["Darkshore"] = -20, - ["The Deadmines"] = -20, - ["Ghostlands"] = -20, - ["Loch Modan"] = -20, - ["Silverpine Forest"] = -20, - ["The Wailing Caverns"] = -20, - ["Westfall"] = -20, - ["Ashenvale"] = 55, - ["Duskwood"] = 55, - ["Hillsbrad Foothills"] = 55, - ["Redridge Mountains"] = 55, - ["Stonetalon Mountains"] = 55, - ["Wetlands"] = 55, - ["Alterac Mountains"] = 130, - ["Arathi Highlands"] = 130, - ["Desolace"] = 130, - ["Dustwallow Marsh"] = 130, - ["Scarlet Monastery"] = 130, - ["Stranglethorn Vale"] = 130, - ["Swamp of Sorrows"] = 130, - ["Thousand Needles"] = 130, - ["Azshara"] = 205, - ["Felwood"] = 205, - ["Feralas"] = 205, - ["The Hinterlands"] = 205, - ["Maraudon"] = 205, - ["Moonglade"] = 205, - ["Tanaris"] = 205, - ["The Temple of Atal'Hakkar"] = 205, - ["Un'Goro Crater"] = 205, - ["Western Plaguelands"] = 205, - ["Shadowmoon Valley"] = 280, - ["Zangarmarsh"] = 305, - ["Burning Steppes"] = 330, - ["Deadwind Pass"] = 330, - ["Eastern Plaguelands"] = 330, - ["Scholomance"] = 330, - ["Silithus"] = 330, - ["Stratholme"] = 330, - ["Winterspring"] = 330, - ["Zul'Gurub"] = 330, - ["Terokkar Forest"] = 355, - ["Nagrand"] = 380, - ["Netherstorm"] = 380, - ["Borean Tundra"] = 380, - ["Dragonblight"] = 380, - ["Howling Fjord"] = 380, - ["Crystalsong Forest"] = 405, - ["Dalaran"] = 430, - ["Sholazar Basin"] = 430, - ["The Frozen Sea"] = 480, + [114] = 380, + [115] = 380, + [116] = 380, + [117] = 380, + [118] = 480, + [119] = 430, + [123] = 430, + [125] = 430, + [126] = 430, + [127] = 405, + [170] = 480, + [1411] = -70, + [1412] = -70, + [1413] = -20, + [1416] = 130, + [1417] = 130, + [1420] = -70, + [1421] = -20, + [1422] = 205, + [1423] = 330, + [1424] = 55, + [1425] = 205, + [1426] = -70, + [1428] = 330, + [1429] = -70, + [1430] = 330, + [1431] = 55, + [1432] = -20, + [1433] = 55, + [1434] = 130, + [1435] = 130, + [1436] = -20, + [1437] = 55, + [1438] = -70, + [1439] = -20, + [1440] = 55, + [1441] = 130, + [1442] = 55, + [1443] = 130, + [1444] = 205, + [1445] = 130, + [1446] = 205, + [1447] = 205, + [1448] = 205, + [1449] = 205, + [1450] = 205, + [1451] = 330, + [1452] = 330, + [1453] = -20, + [1454] = -20, + [1455] = -20, + [1456] = -20, + [1457] = -20, + [1458] = -20, + [1941] = -70, + [1942] = -20, + [1943] = -70, + [1944] = 280, + [1946] = 305, + [1947] = -20, + [1948] = 280, + [1950] = -20, + [1951] = 380, + [1952] = 355, + [1953] = 380, + [1954] = -20, } local subzones = { - ["Jaguero Isle"] = 205, - ["Bay of Storms"] = 330, - ["Hetaera's Clutch"] = 330, - ["Scalebeard's Cave"] = 330, - ["Jademir Lake"] = 330, - ["Marshlight Lake"] = 355, - ["Sporewind Lake"] = 355, - ["Serpent Lake"] = 355, - ["Lake Sunspring"] = 395, - ["Skysong Lake"] = 395, - ["Blackwind Lake"] = 405, - ["Lake Ere'Noru"] = 405, - ["Lake Jorune"] = 405, + [297] = 205, + [718] = -20, --Wailing Caverns Entrance + [719] = -20, --BFD Entrance + [1112] = 330, + [1222] = 330, + [1227] = 330, + [1477] = 205, -- ST Entrance + [1977] = 330, -- ZG Entrance + [2100] = 205, --Maraudon Entrance + [3140] = 330, + [3614] = 395, + [3621] = 395, + [3653] = 355, + [3656] = 355, + [3658] = 355, + [3679] = 405, + [3690] = 405, + [3691] = 405, + [3692] = 405, + [3979] = 480, + [3859] = 405, + [3974] = 405, + [3975] = 405, + [3976] = 405, +} +local instances = { + [36] = -20, + [43] = -20, + [48] = -20, + [109] = 205, + [309] = 309, + [329] = 330, + [349] = 205, + [548] = 130, + [1001] = 130, + [1004] = 130, + [1007] = 330, } - local fishingpoles = { [6256] = true, [6365] = true, @@ -115,14 +144,26 @@ local fishingpoles = { [19970] = true, [25978] = true, [44050] = true, + [45120] = true, + [45858] = true, + [45991] = true, + [45992] = true, } local function GetNumFishToLevel(skillRank) - if skillRank <= 75 then - return 1 + local classicScale=25 + local expScale=75 + local numFishToLevel + if skillRank <= 300 then + numFishToLevel=math.ceil(skillRank / classicScale)-2 + if numFishToLevel < 1 then + numFishToLevel = 1 + end else - return math.ceil((skillRank - 75) / 25) + numFishToLevel=math.ceil((skillRank-315)/expScale)+10 end + + return numFishToLevel end local function UpdateFishCount(shouldIncrement) @@ -131,13 +172,21 @@ local function UpdateFishCount(shouldIncrement) end Fishbringer.fishCount:SetFormattedText( - "%d fish caught at this level", + L["%d fish caught at this level"], db[char].fishCaught ) end +local finishedLooting = true +local function LootClosed() + finishedLooting = true +end + local function IncrementFishCount() - UpdateFishCount(true) + if finishedLooting then + finishedLooting = false + UpdateFishCount(true) + end end local function ResetFishCounter(numFish) @@ -146,15 +195,55 @@ local function ResetFishCounter(numFish) UpdateFishCount(false) end -local function UpdateCatchInfo() - local zoneText = GetSubZoneText() - local zoneSkill = subzones[zoneText] +local function populateAreaTable() + local areaName + for areaId=1,10500 do + areaName=C_Map.GetAreaInfo(areaId) + if areaName then + areaTable[areaName]=areaId + end + end +end - if not zoneSkill then - zoneText = GetRealZoneText() - zoneSkill = zones[zoneText] +--[[ GetExploredAreaIDsAtPosition doesn't always work for many locations - UNRELIABLE +local function getPlayerAreaId() + local areaId + local unit = "Player" + local mapId = C_Map.GetBestMapForUnit(unit) + local mapPos = C_Map.GetPlayerMapPosition(mapId, unit) + areaIds = C_MapExplorationInfo.GetExploredAreaIDsAtPosition(mapId,mapPos) + if areaIds and areaIds[1] then + areaId = areaIds[1] end + return areaId +end +--]] +local function UpdateCatchInfo() + local zoneText + local zoneSkill + + if IsInInstance() then + local _,_,_,_,_,_,_,instanceId = GetInstanceInfo() + zoneSkill = instances[instanceId] + zoneText = GetRealZoneText() + else + zoneText = GetSubZoneText() + if zoneText == "" then + zoneText = GetRealZoneText() + end + local areaId = areaTable[zoneText] + if areaId then + zoneSkill = subzones[areaId] + end + if not zoneSkill then + local mapId = C_Map.GetBestMapForUnit("Player") + if mapId then + zoneText = C_Map.GetMapInfo(mapId).name + zoneSkill = zones[mapId] + end + end + end -- Sometimes we can trigger this before the player is in any zone if not zoneText then return @@ -168,43 +257,49 @@ local function UpdateCatchInfo() maxZoneSkill = zoneSkill + 95 end - local chance = ( - ( - db[char].fishingSkill + db[char].fishingBuff - ) - zoneSkill + FishbringerDB.chance = ( + db[char].fishingSkill + db[char].fishingBuff - zoneSkill ) * 0.01 + 0.05 if zoneSkill < 0 then zoneSkill = 1 end - if chance > 1 then - chance = 1 - elseif chance < 0 then - chance = 0 + if FishbringerDB.chance > 1 then + FishbringerDB.chance = 1 + elseif FishbringerDB.chance < 0 then + FishbringerDB.chance = 0 end local color - if chance == 0 then + if FishbringerDB.chance == 0 then color = "ffff2020" - elseif chance <= 0.5 then + elseif FishbringerDB.chance <= 0.5 then color = "ffff8040" - elseif chance < 1 then + elseif FishbringerDB.chance < 1 then color = "ffffff00" else color = "ff40bf40" end - Fishbringer.zoneInfo:SetFormattedText( - "\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)", - color, zoneText, zoneSkill, maxZoneSkill, chance * 100 - ) - Fishbringer.catchRate:SetFormattedText("%d%% catch rate", chance * 100) + if zoneSkill == 0 then + Fishbringer.zoneInfo:SetFormattedText( + L["\124c%s%s\124r\nNo fish in this zone"], + color, zoneText, zoneSkill, maxZoneSkill, FishbringerDB.chance * 100 + ) + Fishbringer.catchRate:SetText("") + else + Fishbringer.zoneInfo:SetFormattedText( + L["\124c%s%s\124r\n%d skill needed to fish\n(%d needed for 100%% catch rate)"], + color, zoneText, zoneSkill, maxZoneSkill, FishbringerDB.chance * 100 + ) + Fishbringer.catchRate:SetFormattedText(L["%d%% catch rate"], FishbringerDB.chance * 100) + end end local function GetFishingSkill() for i = 1, GetNumSkillLines() do local skillName, _, _, skillRank, _, skillModifier, skillMaxRank, _, _, _, _, _, _= GetSkillLineInfo(i) - if skillName == "Fishing" then + if skillName == L["Fishing"] then return skillRank, skillModifier, skillMaxRank end end @@ -227,18 +322,28 @@ local function UpdateSkill(forceResetFishCounter) local skillRankText = skillRank local fishNeeded = GetNumFishToLevel(skillRank) - if skillRank ~= skillMaxRank then - skillRankText = string.format("%d/%d", skillRank, skillMaxRank) - fishNeededText = string.format("\n%d fish needed to skill up", fishNeeded) + local strFishNeeded + if skillRank ~= skillMaxRank then + skillRankText = string.format("%d(%d)", skillRank, skillMaxRank) + if fishNeeded>1 then + if fishNeeded<10 then + strFishNeeded = string.format("%d-%d",fishNeeded-1, fishNeeded) + else + strFishNeeded = string.format("%d-%d",fishNeeded-1, fishNeeded+1) + end + else + strFishNeeded = string.format("%d", fishNeeded) + end + fishNeededText = string.format(L["\n%s fish needed to skill up"], strFishNeeded) end local skillModifierText = "" if skillModifier > 0 then - skillModifierText = string.format(" (+%d)", skillModifier) + skillModifierText = string.format("+%d = %d", skillModifier, skillRank+skillModifier) end Fishbringer.content:SetFormattedText( - "%s%s fishing skill%s", + L["%s%s fishing skill%s"], skillRankText, skillModifierText, fishNeededText @@ -247,6 +352,7 @@ local function UpdateSkill(forceResetFishCounter) if forceResetFishCounter or db[char].fishingSkill ~= skillRank then db[char].fishingSkill = skillRank ResetFishCounter(fishNeeded) + UpdateCatchInfo() end if db[char].fishingBuff ~= skillModifier then @@ -300,7 +406,7 @@ end local function CheckForFishingPole() local _, _, itemid = string.find(GetInventoryItemLink("player", GetInventorySlotInfo("MainHandSlot")) or "", "item:(%d+):(.+)") - if db[char].isShown or fishingpoles[tonumber(itemid)] then + if fishingpoles[tonumber(itemid)] then Update() Fishbringer:Show() db[char].isShown = true @@ -316,7 +422,7 @@ local function InitializeDB(resetDatabase) db = {} FishbringerDB = db end - + populateAreaTable() if resetDatabase or not db[char] then db[char] = { fishingSkill = 0, @@ -326,22 +432,45 @@ local function InitializeDB(resetDatabase) maxFishingSkill = 0, isShown = false, isFishCountShown = true, - alignment = "RIGHT" + alignment = "RIGHT", + isGradiant = true, } end end +local function setTitleText() + + local name + if db[char].isGradiant == nil then + db[char].isGradiant = true + end + if db[char].isGradiant then + name = "|cff0000ffF|cff0049ffi|cff0069ffs|cff0083ffh|cff0099ffb|cff00acffr|cff00bfffi|cff00d0ffn|cff00e1ffg|cff00f0ffe|cff00ffffr" + else + name = "Fishbringer" + end + Fishbringer.title:SetText(name) + +end + +local function toggleColor() + db[char].isGradiant=not db[char].isGradiant + setTitleText() +end + local function InitializeFrame() -- Frame madness if Fishbringer then return end - Fishbringer = CreateFrame("Frame", "Fishbringer", UIParent) + + local Fishbringer = CreateFrame("Frame", "Fishbringer", UIParent, "BackdropTemplate") + Fishbringer:EnableMouse(true) Fishbringer:SetMovable(true) Fishbringer:SetUserPlaced(true) Fishbringer:SetHeight(150) - Fishbringer:SetWidth(185) + Fishbringer:SetWidth(250) Fishbringer:SetBackdrop({ bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, @@ -377,14 +506,9 @@ local function InitializeFrame() title:SetJustifyH(db[char].alignment) title:SetFont(FONT, 16) title:SetShadowOffset(1, -1) - local name - if random(100) < 5 then - name = "Corrupted Fishbringer" - else - name = "Fishbringer" - end - title:SetText(name) + Fishbringer.title = title + setTitleText() local zoneInfo = Fishbringer:CreateFontString(nil, "OVERLAY") zoneInfo:SetHeight(50) @@ -427,7 +551,7 @@ local function InitializeFrame() end end -function UpdateFishingSkill() +local function UpdateFishingSkill() return UpdateSkill(false) end @@ -448,19 +572,21 @@ fb.ADDON_LOADED = function(self, event, addon) InitializeFrame() end -fb.COMBAT_LOG_EVENT = UpdateSkill -fb.SKILL_LINES_CHANGED = UpdateSkill -fb.LOOT_OPENED = IncrementFishCount +fb.COMBAT_LOG_EVENT = UpdateFishingSkill +fb.SKILL_LINES_CHANGED = UpdateFishingSkill +fb.LOOT_READY = IncrementFishCount +fb.LOOT_CLOSED = LootClosed fb.ZONE_CHANGED_NEW_AREA = UpdateCatchInfo fb.ZONE_CHANGED = UpdateCatchInfo fb.UNIT_INVENTORY_CHANGED = CheckForFishingPole local function ShowHelp() - Print("Nat Pagle would be proud of you.") - Print("- /fishbringer show - Toggles visibility.") - Print("- /fishbringer align - Cycles through text alignment.") - Print("- /fishbringer count - Toggles fish count visibility.") - Print("- /fishbringer reset - Resets the fish database.") + Print(L["Nat Pagle would be proud of you."]) + Print(L["- /fishbringer show - Toggles visibility."]) + Print(L["- /fishbringer align - Cycles through text alignment."]) + Print(L["- /fishbringer count - Toggles fish count visibility."]) + Print(L["- /fishbringer reset - Resets the fish database."]) + Print(L["- /fishbringer color - Enables/disables gradient color."]) end SlashCmdList["FISHBRINGER"] = function(arg) @@ -475,12 +601,17 @@ SlashCmdList["FISHBRINGER"] = function(arg) UpdateSkill(true) UpdateCatchInfo() return + elseif arg == "color" then + toggleColor() + return end return ShowHelp() end + SLASH_FISHBRINGER1 = "/fishbringer" -- Hail to Fishing Buddy! -if not select(4, GetAddOnInfo"Fishing Buddy") then +if not select(4, GetAddOnInfo"FishingBuddy") then SLASH_FISHBRINGER2 = "/fb" end -Print("Pack yer bags, we be leavin' fer fishin'!") + +Print(L["Pack yer bags, we be leavin' fer fishin'!"]) diff --git a/localization.core.lua b/localization.core.lua new file mode 100644 index 0000000..1e207a7 --- /dev/null +++ b/localization.core.lua @@ -0,0 +1,10 @@ +local _, namespace = ... +namespace.locale = GetLocale() +--print("at core",namespace.locale) +local L = setmetatable({}, { __index = function(t, k) + local v = tostring(k) + rawset(t, k, v) + return v +end }) + +namespace.L = L