Skip to content

Commit

Permalink
Updated to Ulidians Fork :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Godot-Fye authored Dec 5, 2022
1 parent 1544d0f commit 097563a
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 86 deletions.
48 changes: 24 additions & 24 deletions Fishbringer-BCC.toc
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## Interface: 20501
## 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: 2.5.1-4

# main:
localization.core.lua
fishy.lua

# localizations:
Localization.deDE.lua
Localization.ruRU.lua
Localization.esES.lua
Localization.frFR.lua
Localization.ptBR.lua
## 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.2

# main:
localization.core.lua
fishy.lua

# localizations:
Localization.deDE.lua
Localization.ruRU.lua
Localization.esES.lua
Localization.frFR.lua
Localization.ptBR.lua
48 changes: 24 additions & 24 deletions Fishbringer-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## Interface: 11307
## 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: 2.5.1-4

# main:
localization.core.lua
fishy.lua

# localizations:
Localization.deDE.lua
Localization.ruRU.lua
Localization.esES.lua
Localization.frFR.lua
Localization.ptBR.lua
## 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.2

# main:
localization.core.lua
fishy.lua

# localizations:
Localization.deDE.lua
Localization.ruRU.lua
Localization.esES.lua
Localization.frFR.lua
Localization.ptBR.lua
24 changes: 24 additions & 0 deletions Fishbringer-Wrath.toc
Original file line number Diff line number Diff line change
@@ -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.2

# main:
localization.core.lua
fishy.lua

# localizations:
Localization.deDE.lua
Localization.ruRU.lua
Localization.esES.lua
Localization.frFR.lua
Localization.ptBR.lua
10 changes: 10 additions & 0 deletions Fishbringer.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Interface: 20503
## Title: Fishbringer
## Notes: The legendary Fishbringer, Guide of the Scarlet Highlord! Nat Pagle would be proud of you!
## Author: Kalerath, Fye (Localization Code & Bugfixes), Zilom (Bugfixes & Localization Redesigned + Added), leafoe (Russian Localization)
## Version: 2.5.4

# main:
localization.core.lua

# This file is here for compatibility with CurseForge only. it has no function whatsoever
104 changes: 66 additions & 38 deletions fishy.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FishbringerDB = {}
local FONT = select(1, GameFontNormalSmall:GetFont())
local fb = CreateFrame"Frame"
local db
Expand All @@ -8,8 +7,9 @@ local L = namespace.L --localization
local version = GetAddOnMetadata(ADDON_NAME, "Version")
local addoninfo = 'v'..version
local _,_,_,interface = GetBuildInfo()
local classicEra = (interface==11307)
local classicTBC = (interface==20501)
local classicEra = (interface>10000 and interface<12000)
local classicTBC = (interface>20000 and interface<30000)
local classicWrath = (interface>30000 and interface<40000)
local areaTable = {}


Expand All @@ -18,6 +18,7 @@ fb:RegisterEvent"ADDON_LOADED"
fb:RegisterEvent"COMBAT_LOG_EVENT"
fb:RegisterEvent"SKILL_LINES_CHANGED"
fb:RegisterEvent"LOOT_READY"
fb:RegisterEvent"LOOT_CLOSED"
fb:RegisterEvent"ZONE_CHANGED_NEW_AREA"
fb:RegisterEvent"ZONE_CHANGED"
fb:RegisterEvent"UNIT_INVENTORY_CHANGED"
Expand All @@ -27,6 +28,17 @@ local function Print(text)
end

local zones = {
[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,
Expand Down Expand Up @@ -103,6 +115,7 @@ local subzones = {
[3690] = 405,
[3691] = 405,
[3692] = 405,
[3979] = 480,
[3859] = 405,
[3974] = 405,
[3975] = 405,
Expand All @@ -116,7 +129,7 @@ local instances = {
[309] = 309,
[329] = 330,
[349] = 205,
[548] = 405,
[548] = 130,
[1001] = 130,
[1004] = 130,
[1007] = 330,
Expand All @@ -131,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/expScale)+5
end

return numFishToLevel
end

local function UpdateFishCount(shouldIncrement)
Expand All @@ -152,8 +177,16 @@ local function UpdateFishCount(shouldIncrement)
)
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)
Expand Down Expand Up @@ -204,12 +237,11 @@ local function UpdateCatchInfo()
zoneSkill = subzones[areaId]
end
if not zoneSkill then
zoneText = GetRealZoneText()
local mapId = C_Map.GetBestMapForUnit("Player")
zoneText = C_Map.GetMapInfo(mapId).name
zoneSkill = zones[mapId]
end
end

-- Sometimes we can trigger this before the player is in any zone
if not zoneText then
return
Expand All @@ -223,42 +255,42 @@ local function UpdateCatchInfo()
maxZoneSkill = zoneSkill + 95
end

local chance = (
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
if zoneSkill == 0 then
Fishbringer.zoneInfo:SetFormattedText(
L["\124c%s%s\124r\nNo fish in this zone"],
color, zoneText, zoneSkill, maxZoneSkill, chance * 100
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, chance * 100
color, zoneText, zoneSkill, maxZoneSkill, FishbringerDB.chance * 100
)
Fishbringer.catchRate:SetFormattedText(L["%d%% catch rate"], chance * 100)
Fishbringer.catchRate:SetFormattedText(L["%d%% catch rate"], FishbringerDB.chance * 100)
end
end

Expand Down Expand Up @@ -288,9 +320,15 @@ local function UpdateSkill(forceResetFishCounter)
local skillRankText = skillRank

local fishNeeded = GetNumFishToLevel(skillRank)
if skillRank ~= skillMaxRank then
local strFishNeeded
if skillRank ~= skillMaxRank then
skillRankText = string.format("%d(%d)", skillRank, skillMaxRank)
fishNeededText = string.format(L["\n%d fish needed to skill up"], fishNeeded)
if fishNeeded>1 then
strFishNeeded = string.format("%d-%d",fishNeeded-1, fishNeeded)
else
strFishNeeded = string.format("%d", fishNeeded)
end
fishNeededText = string.format(L["\n%s fish needed to skill up"], strFishNeeded)
end

local skillModifierText = ""
Expand Down Expand Up @@ -393,25 +431,14 @@ local function InitializeDB(resetDatabase)
end
end

local function classicEraCreateFrame()
return CreateFrame("Frame", "Fishbringer", UIParent)
end
local function classicTBCCreateFrame()
return CreateFrame("Frame", "Fishbringer", UIParent, "BackdropTemplate")
end

local function InitializeFrame()
-- Frame madness
if Fishbringer then
return
end
if classicEra then
local Fishbringer = classicEraCreateFrame()
elseif classicTBC then
local Fishbringer = classicTBCCreateFrame()
else
return
end

local Fishbringer = CreateFrame("Frame", "Fishbringer", UIParent, "BackdropTemplate")

Fishbringer:EnableMouse(true)
Fishbringer:SetMovable(true)
Fishbringer:SetUserPlaced(true)
Expand Down Expand Up @@ -502,7 +529,7 @@ local function InitializeFrame()
end
end

function UpdateFishingSkill()
local function UpdateFishingSkill()
return UpdateSkill(false)
end

Expand All @@ -526,6 +553,7 @@ end
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
Expand Down

0 comments on commit 097563a

Please sign in to comment.