Skip to content

Commit b13c0e1

Browse files
authored
Merge pull request #476 from besteon/dev
8.6.1 Patch Release
2 parents b945e7d + 7639c86 commit b13c0e1

21 files changed

+603
-98
lines changed

ironmon_tracker/Languages/English.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ ScreenResources{
534534
HeaderTabMisc = "Misc.",
535535
LabelBaseStats = "Base Stats",
536536
LabelBSTTotal = "Total", -- Usage: "Total: 505"
537+
LabelYourIVs = "Your IVs",
538+
LabelYourEVs = "Your EVs",
539+
LabelShowIVs = "Show IVs",
540+
LabelShowEVs = "Show EVs",
541+
LabelShowBST = "Show BST",
537542
ButtonLevelupMoves = "Levelup Moves",
538543
ButtonTMMoves = "TM Moves",
539544
LabelGymTMs = "Gym TMs",
@@ -613,8 +618,10 @@ ScreenResources{
613618
CMD_Route_Help = "name > Displays trainer and wild encounter info for a route or area.",
614619
CMD_Dungeon_Name = "Dungeon Info",
615620
CMD_Dungeon_Help = "name > Displays info about which trainers have been defeated for an area.",
621+
CMD_Unfought_Name = "Unfought Trainers",
622+
CMD_Unfought_Help = "[dungeon] [sevii]> Displays a list of areas ordered by lowest-level, undefeated trainers. (Add param 'dungeon' to include partially completed dungeons.)",
616623
CMD_Pivots_Name = "Pivots Seen",
617-
CMD_Pivots_Help = "name > Displays known early game wild encounters for an area.",
624+
CMD_Pivots_Help = "> Displays known early game wild encounters for an area.",
618625
CMD_Revo_Name = "Pokémon Random Evolutions",
619626
CMD_Revo_Help = "name [target-evo] > Displays randomized evolution possibilities for a Pokémon, and it's [target-evo] if more than one available.",
620627
CMD_Coverage_Name = "Move Coverage Effectiveness",
@@ -832,6 +839,7 @@ ScreenResources{
832839
CommandsUsageSyntax = "Usage Syntax",
833840
CommandsExampleUsage = "Example Usage",
834841
PokemonInfoBST = "BST",
842+
PokemonInfoEXP = "EXP",
835843
PokemonInfoWeight = "Weight",
836844
PokemonInfoEvolution = "Evolution",
837845
PokemonInfoKg = "kg",

ironmon_tracker/Languages/French.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ ScreenResources{
534534
HeaderTabMisc = "Misc.", -- NEEDS TRANSLATION
535535
LabelBaseStats = "Base Stats", -- NEEDS TRANSLATION
536536
LabelBSTTotal = "Total", -- NEEDS TRANSLATION
537+
LabelYourIVs = "Your IVs", -- NEEDS TRANSLATION
538+
LabelYourEVs = "Your EVs", -- NEEDS TRANSLATION
539+
LabelShowIVs = "Show IVs", -- NEEDS TRANSLATION
540+
LabelShowEVs = "Show EVs", -- NEEDS TRANSLATION
541+
LabelShowBST = "Show BST", -- NEEDS TRANSLATION
537542
ButtonLevelupMoves = "Levelup Moves", -- NEEDS TRANSLATION
538543
ButtonTMMoves = "TM Moves", -- NEEDS TRANSLATION
539544
LabelGymTMs = "Gym TMs", -- NEEDS TRANSLATION
@@ -614,8 +619,10 @@ ScreenResources{
614619
CMD_Route_Help = "name > Displays trainer and wild encounter info for a route or area.",
615620
CMD_Dungeon_Name = "Dungeon Info",
616621
CMD_Dungeon_Help = "name > Displays info about which trainers have been defeated for an area.",
622+
CMD_Unfought_Name = "Unfought Trainers",
623+
CMD_Unfought_Help = "[dungeon] [sevii]> Displays a list of areas ordered by lowest-level, undefeated trainers. (Add param 'dungeon' to include partially completed dungeons.)",
617624
CMD_Pivots_Name = "Pivots Seen",
618-
CMD_Pivots_Help = "name > Displays known early game wild encounters for an area.",
625+
CMD_Pivots_Help = "> Displays known early game wild encounters for an area.",
619626
CMD_Revo_Name = "Pokémon Random Evolutions",
620627
CMD_Revo_Help = "name [target-evo] > Displays randomized evolution possibilities for a Pokémon, and it's [target-evo] if more than one available.",
621628
CMD_Coverage_Name = "Move Coverage Effectiveness",
@@ -833,6 +840,7 @@ ScreenResources{
833840
CommandsUsageSyntax = "Usage Syntax", -- NEEDS TRANSLATION
834841
CommandsExampleUsage = "Example Usage", -- NEEDS TRANSLATION
835842
PokemonInfoBST = "BST", -- NEEDS TRANSLATION
843+
PokemonInfoEXP = "EXP", -- NEEDS TRANSLATION
836844
PokemonInfoWeight = "Weight", -- NEEDS TRANSLATION
837845
PokemonInfoEvolution = "Evolution", -- NEEDS TRANSLATION
838846
PokemonInfoKg = "kg", -- NEEDS TRANSLATION

ironmon_tracker/Languages/German.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ ScreenResources{
534534
HeaderTabMisc = "Misc.", -- NEEDS TRANSLATION
535535
LabelBaseStats = "Base Stats", -- NEEDS TRANSLATION
536536
LabelBSTTotal = "Total", -- NEEDS TRANSLATION
537+
LabelYourIVs = "Your IVs", -- NEEDS TRANSLATION
538+
LabelYourEVs = "Your EVs", -- NEEDS TRANSLATION
539+
LabelShowIVs = "Show IVs", -- NEEDS TRANSLATION
540+
LabelShowEVs = "Show EVs", -- NEEDS TRANSLATION
541+
LabelShowBST = "Show BST", -- NEEDS TRANSLATION
537542
ButtonLevelupMoves = "Levelup Moves", -- NEEDS TRANSLATION
538543
ButtonTMMoves = "TM Moves", -- NEEDS TRANSLATION
539544
LabelGymTMs = "Gym TMs", -- NEEDS TRANSLATION
@@ -614,8 +619,10 @@ ScreenResources{
614619
CMD_Route_Help = "name > Displays trainer and wild encounter info for a route or area.",
615620
CMD_Dungeon_Name = "Dungeon Info",
616621
CMD_Dungeon_Help = "name > Displays info about which trainers have been defeated for an area.",
622+
CMD_Unfought_Name = "Unfought Trainers",
623+
CMD_Unfought_Help = "[dungeon] [sevii]> Displays a list of areas ordered by lowest-level, undefeated trainers. (Add param 'dungeon' to include partially completed dungeons.)",
617624
CMD_Pivots_Name = "Pivots Seen",
618-
CMD_Pivots_Help = "name > Displays known early game wild encounters for an area.",
625+
CMD_Pivots_Help = "> Displays known early game wild encounters for an area.",
619626
CMD_Revo_Name = "Pokémon Random Evolutions",
620627
CMD_Revo_Help = "name [target-evo] > Displays randomized evolution possibilities for a Pokémon, and it's [target-evo] if more than one available.",
621628
CMD_Coverage_Name = "Move Coverage Effectiveness",
@@ -833,6 +840,7 @@ ScreenResources{
833840
CommandsUsageSyntax = "Usage Syntax", -- NEEDS TRANSLATION
834841
CommandsExampleUsage = "Example Usage", -- NEEDS TRANSLATION
835842
PokemonInfoBST = "BST", -- NEEDS TRANSLATION
843+
PokemonInfoEXP = "EXP", -- NEEDS TRANSLATION
836844
PokemonInfoWeight = "Weight", -- NEEDS TRANSLATION
837845
PokemonInfoEvolution = "Evolution", -- NEEDS TRANSLATION
838846
PokemonInfoKg = "kg", -- NEEDS TRANSLATION

ironmon_tracker/Languages/Italian.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ ScreenResources{
534534
HeaderTabMisc = "Misc.", -- NEEDS TRANSLATION
535535
LabelBaseStats = "Base Stats", -- NEEDS TRANSLATION
536536
LabelBSTTotal = "Total", -- NEEDS TRANSLATION
537+
LabelYourIVs = "Your IVs", -- NEEDS TRANSLATION
538+
LabelYourEVs = "Your EVs", -- NEEDS TRANSLATION
539+
LabelShowIVs = "Show IVs", -- NEEDS TRANSLATION
540+
LabelShowEVs = "Show EVs", -- NEEDS TRANSLATION
541+
LabelShowBST = "Show BST", -- NEEDS TRANSLATION
537542
ButtonLevelupMoves = "Levelup Moves", -- NEEDS TRANSLATION
538543
ButtonTMMoves = "TM Moves", -- NEEDS TRANSLATION
539544
LabelGymTMs = "Gym TMs", -- NEEDS TRANSLATION
@@ -614,8 +619,10 @@ ScreenResources{
614619
CMD_Route_Help = "name > Displays trainer and wild encounter info for a route or area.",
615620
CMD_Dungeon_Name = "Dungeon Info",
616621
CMD_Dungeon_Help = "name > Displays info about which trainers have been defeated for an area.",
622+
CMD_Unfought_Name = "Unfought Trainers",
623+
CMD_Unfought_Help = "[dungeon] [sevii]> Displays a list of areas ordered by lowest-level, undefeated trainers. (Add param 'dungeon' to include partially completed dungeons.)",
617624
CMD_Pivots_Name = "Pivots Seen",
618-
CMD_Pivots_Help = "name > Displays known early game wild encounters for an area.",
625+
CMD_Pivots_Help = "> Displays known early game wild encounters for an area.",
619626
CMD_Revo_Name = "Pokémon Random Evolutions",
620627
CMD_Revo_Help = "name [target-evo] > Displays randomized evolution possibilities for a Pokémon, and it's [target-evo] if more than one available.",
621628
CMD_Coverage_Name = "Move Coverage Effectiveness",
@@ -833,6 +840,7 @@ ScreenResources{
833840
CommandsUsageSyntax = "Usage Syntax", -- NEEDS TRANSLATION
834841
CommandsExampleUsage = "Example Usage", -- NEEDS TRANSLATION
835842
PokemonInfoBST = "BST", -- NEEDS TRANSLATION
843+
PokemonInfoEXP = "EXP", -- NEEDS TRANSLATION
836844
PokemonInfoWeight = "Weight", -- NEEDS TRANSLATION
837845
PokemonInfoEvolution = "Evolution", -- NEEDS TRANSLATION
838846
PokemonInfoKg = "kg", -- NEEDS TRANSLATION

ironmon_tracker/Languages/Japanese.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,11 @@ ScreenResources{
536536
HeaderTabMisc = "Misc.", -- NEEDS TRANSLATION
537537
LabelBaseStats = "Base Stats", -- NEEDS TRANSLATION
538538
LabelBSTTotal = "Total", -- NEEDS TRANSLATION
539+
LabelYourIVs = "Your IVs", -- NEEDS TRANSLATION
540+
LabelYourEVs = "Your EVs", -- NEEDS TRANSLATION
541+
LabelShowIVs = "Show IVs", -- NEEDS TRANSLATION
542+
LabelShowEVs = "Show EVs", -- NEEDS TRANSLATION
543+
LabelShowBST = "Show BST", -- NEEDS TRANSLATION
539544
ButtonLevelupMoves = "Levelup Moves", -- NEEDS TRANSLATION
540545
ButtonTMMoves = "TM Moves", -- NEEDS TRANSLATION
541546
LabelGymTMs = "Gym TMs", -- NEEDS TRANSLATION
@@ -616,8 +621,10 @@ ScreenResources{
616621
CMD_Route_Help = "name > Displays trainer and wild encounter info for a route or area.",
617622
CMD_Dungeon_Name = "Dungeon Info",
618623
CMD_Dungeon_Help = "name > Displays info about which trainers have been defeated for an area.",
624+
CMD_Unfought_Name = "Unfought Trainers",
625+
CMD_Unfought_Help = "[dungeon] [sevii]> Displays a list of areas ordered by lowest-level, undefeated trainers. (Add param 'dungeon' to include partially completed dungeons.)",
619626
CMD_Pivots_Name = "Pivots Seen",
620-
CMD_Pivots_Help = "name > Displays known early game wild encounters for an area.",
627+
CMD_Pivots_Help = "> Displays known early game wild encounters for an area.",
621628
CMD_Revo_Name = "Pokémon Random Evolutions",
622629
CMD_Revo_Help = "name [target-evo] > Displays randomized evolution possibilities for a Pokémon, and it's [target-evo] if more than one available.",
623630
CMD_Coverage_Name = "Move Coverage Effectiveness",
@@ -835,6 +842,7 @@ ScreenResources{
835842
CommandsUsageSyntax = "Usage Syntax", -- NEEDS TRANSLATION
836843
CommandsExampleUsage = "Example Usage", -- NEEDS TRANSLATION
837844
PokemonInfoBST = "BST", -- NEEDS TRANSLATION
845+
PokemonInfoEXP = "EXP", -- NEEDS TRANSLATION
838846
PokemonInfoWeight = "Weight", -- NEEDS TRANSLATION
839847
PokemonInfoEvolution = "Evolution", -- NEEDS TRANSLATION
840848
PokemonInfoKg = "kg", -- NEEDS TRANSLATION

ironmon_tracker/Languages/Spanish.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ ScreenResources{
534534
HeaderTabMisc = "Misc.", -- NEEDS TRANSLATION
535535
LabelBaseStats = "Base Stats", -- NEEDS TRANSLATION
536536
LabelBSTTotal = "Total", -- NEEDS TRANSLATION
537+
LabelYourIVs = "Your IVs", -- NEEDS TRANSLATION
538+
LabelYourEVs = "Your EVs", -- NEEDS TRANSLATION
539+
LabelShowIVs = "Show IVs", -- NEEDS TRANSLATION
540+
LabelShowEVs = "Show EVs", -- NEEDS TRANSLATION
541+
LabelShowBST = "Show BST", -- NEEDS TRANSLATION
537542
ButtonLevelupMoves = "Levelup Moves", -- NEEDS TRANSLATION
538543
ButtonTMMoves = "TM Moves", -- NEEDS TRANSLATION
539544
LabelGymTMs = "Gym TMs", -- NEEDS TRANSLATION
@@ -614,8 +619,10 @@ ScreenResources{
614619
CMD_Route_Help = "name > Displays trainer and wild encounter info for a route or area.",
615620
CMD_Dungeon_Name = "Dungeon Info",
616621
CMD_Dungeon_Help = "name > Displays info about which trainers have been defeated for an area.",
622+
CMD_Unfought_Name = "Unfought Trainers",
623+
CMD_Unfought_Help = "[dungeon] [sevii]> Displays a list of areas ordered by lowest-level, undefeated trainers. (Add param 'dungeon' to include partially completed dungeons.)",
617624
CMD_Pivots_Name = "Pivots Seen",
618-
CMD_Pivots_Help = "name > Displays known early game wild encounters for an area.",
625+
CMD_Pivots_Help = "> Displays known early game wild encounters for an area.",
619626
CMD_Revo_Name = "Pokémon Random Evolutions",
620627
CMD_Revo_Help = "name [target-evo] > Displays randomized evolution possibilities for a Pokémon, and it's [target-evo] if more than one available.",
621628
CMD_Coverage_Name = "Move Coverage Effectiveness",
@@ -833,6 +840,7 @@ ScreenResources{
833840
CommandsUsageSyntax = "Usage Syntax", -- NEEDS TRANSLATION
834841
CommandsExampleUsage = "Example Usage", -- NEEDS TRANSLATION
835842
PokemonInfoBST = "BST", -- NEEDS TRANSLATION
843+
PokemonInfoEXP = "EXP", -- NEEDS TRANSLATION
836844
PokemonInfoWeight = "Weight", -- NEEDS TRANSLATION
837845
PokemonInfoEvolution = "Evolution", -- NEEDS TRANSLATION
838846
PokemonInfoKg = "kg", -- NEEDS TRANSLATION

ironmon_tracker/MGBADisplay.lua

+4
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,13 @@ MGBADisplay.LineBuilder = {
610610

611611
MGBADisplay.DataFormatter.formatPokemonInfo(data)
612612

613+
-- If viewing the mon, note that exp gained is calculated based on the viewed mon's level
614+
local markExpAsBoosted = data.x.viewedPokemonLevel ~= 0 and "*" or ""
615+
613616
local labelBar = "%-12s %s"
614617
table.insert(lines, Utils.formatUTF8("%-13s%s", data.p.name, Utils.formatUTF8("[%s]", data.p.typeline)))
615618
table.insert(lines, Utils.formatUTF8(labelBar, Resources.MGBAScreens.PokemonInfoBST .. ":", data.p.bst))
619+
table.insert(lines, Utils.formatUTF8(labelBar, Resources.MGBAScreens.PokemonInfoEXP .. ":", data.p.expYield .. markExpAsBoosted))
616620
table.insert(lines, Utils.formatUTF8(labelBar, Resources.MGBAScreens.PokemonInfoWeight .. ":", data.p.weight))
617621
table.insert(lines, Utils.formatUTF8(labelBar, Resources.MGBAScreens.PokemonInfoEvolution .. ":", data.p.evodetails))
618622

ironmon_tracker/Main.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Main = {}
22

33
-- The latest version of the tracker. Should be updated with each PR.
4-
Main.Version = { major = "8", minor = "6", patch = "0" }
4+
Main.Version = { major = "8", minor = "6", patch = "1" }
55

66
Main.CreditsList = { -- based on the PokemonBizhawkLua project by MKDasher
77
CreatedBy = "Besteon",

ironmon_tracker/Program.lua

+34-22
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ Program = {
4545
offsetBattleResultsLastAttackerMove = 0x22,
4646
offsetBattleCommConfirmedCount = 0x4,
4747
offsetBattleCommLevitate = 0x6,
48+
offsetPokemonSubstruct = 0x20,
49+
offsetPokemonStatus = 0x50,
50+
offsetPokemonStatsLvCurHp = 0x54,
51+
offsetPokemonStatsMaxHpAtk = 0x58,
52+
offsetPokemonStatsDefSpe = 0x5C,
53+
offsetPokemonStatsSpaSpd = 0x60,
4854

4955
sizeofBaseStatsPokemon = 0x1C,
5056
sizeofExpTablePokemon = 0x194,
@@ -55,7 +61,12 @@ Program = {
5561
sizeofTMHMMoveId = 0x2,
5662
sizeofGameStat = 0x4,
5763
sizeofLastAttackerMove = 0x2,
64+
sizeofPokemonStruct = 0x64,
65+
sizeofPokemonNickname = 0xA,
5866
},
67+
Values = {
68+
ShinyOdds = 8, -- n/65536
69+
}
5970
}
6071

6172
Program.GameData = {
@@ -629,7 +640,7 @@ function Program.updatePokemonTeams()
629640
end
630641

631642
-- Next Pokemon - Each is offset by 100 bytes
632-
addressOffset = addressOffset + 100
643+
addressOffset = addressOffset + Program.Addresses.sizeofPokemonStruct
633644
end
634645
end
635646

@@ -645,27 +656,27 @@ function Program.readNewPokemon(startAddress, personality)
645656
local miscoffset = (MiscData.TableData.misc[aux] - 1) * 12
646657

647658
-- Pokemon Data substructure: https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_substructures_(Generation_III)
648-
local growth1 = Utils.bit_xor(Memory.readdword(startAddress + 32 + growthoffset), magicword)
649-
local growth2 = Utils.bit_xor(Memory.readdword(startAddress + 32 + growthoffset + 4), magicword) -- Experience
650-
local growth3 = Utils.bit_xor(Memory.readdword(startAddress + 32 + growthoffset + 8), magicword)
651-
local attack1 = Utils.bit_xor(Memory.readdword(startAddress + 32 + attackoffset), magicword)
652-
local attack2 = Utils.bit_xor(Memory.readdword(startAddress + 32 + attackoffset + 4), magicword)
653-
local attack3 = Utils.bit_xor(Memory.readdword(startAddress + 32 + attackoffset + 8), magicword)
654-
local effort1 = Utils.bit_xor(Memory.readdword(startAddress + 32 + effortoffset), magicword)
655-
local effort2 = Utils.bit_xor(Memory.readdword(startAddress + 32 + effortoffset + 4), magicword)
656-
local misc2 = Utils.bit_xor(Memory.readdword(startAddress + 32 + miscoffset + 4), magicword)
659+
local growth1 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + growthoffset), magicword)
660+
local growth2 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + growthoffset + 4), magicword) -- Experience
661+
local growth3 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + growthoffset + 8), magicword)
662+
local attack1 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + attackoffset), magicword)
663+
local attack2 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + attackoffset + 4), magicword)
664+
local attack3 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + attackoffset + 8), magicword)
665+
local effort1 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + effortoffset), magicword)
666+
local effort2 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + effortoffset + 4), magicword)
667+
local misc2 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + miscoffset + 4), magicword)
657668

658669
local nickname = ""
659-
for i=0, 9, 1 do
670+
for i=0, Program.Addresses.sizeofPokemonNickname - 1, 1 do
660671
local charByte = Memory.readbyte(startAddress + 8 + i)
661672
if charByte == Program.Addresses.nicknameCharEnd then break end -- end of sequence
662673
nickname = nickname .. (GameSettings.GameCharMap[charByte] or Constants.HIDDEN_INFO)
663674
end
664675
nickname = Utils.formatSpecialCharacters(nickname)
665676

666677
-- Unused data memory reads
667-
-- local effort3 = Utils.bit_xor(Memory.readdword(startAddress + 32 + effortoffset + 8), magicword)
668-
-- local misc3 = Utils.bit_xor(Memory.readdword(startAddress + 32 + miscoffset + 8), magicword)
678+
-- local effort3 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + effortoffset + 8), magicword)
679+
-- local misc3 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + miscoffset + 8), magicword)
669680

670681
-- Checksum, currently unused
671682
-- local cs = Utils.addhalves(growth1) + Utils.addhalves(growth2) + Utils.addhalves(growth3)
@@ -682,16 +693,16 @@ function Program.readNewPokemon(startAddress, personality)
682693
local secretID = Utils.getbits(otid, 16, 16)
683694
local p1 = math.floor(personality / 65536)
684695
local p2 = personality % 65536
685-
local isShiny = Utils.bit_xor(Utils.bit_xor(Utils.bit_xor(trainerID, secretID), p1), p2) < 8
696+
local isShiny = Utils.bit_xor(Utils.bit_xor(Utils.bit_xor(trainerID, secretID), p1), p2) < Program.Values.ShinyOdds
686697
local hasPokerus
687698
if GameSettings.game ~= 3 then -- PokeRus doesn't exist in FRLG due to lack of passing time
688-
local misc1 = Utils.bit_xor(Memory.readdword(startAddress + 32 + miscoffset), magicword)
699+
local misc1 = Utils.bit_xor(Memory.readdword(startAddress + Program.Addresses.offsetPokemonSubstruct + miscoffset), magicword)
689700
-- First 4 bits are number of days until Pokerus is cured, Second 4 bits are the strain variation
690701
hasPokerus = Utils.getbits(misc1, 0, 8) > 0
691702
end
692703

693704
-- Determine status condition
694-
local status_aux = Memory.readdword(startAddress + 80)
705+
local status_aux = Memory.readdword(startAddress + Program.Addresses.offsetPokemonStatus)
695706
local sleep_turns_result = 0
696707
local status_result = 0
697708
if status_aux == 0 then --None
@@ -712,10 +723,10 @@ function Program.readNewPokemon(startAddress, personality)
712723
end
713724

714725
-- Can likely improve this further using memory.read_bytes_as_array but would require testing to verify
715-
local level_and_currenthp = Memory.readdword(startAddress + 84)
716-
local maxhp_and_atk = Memory.readdword(startAddress + 88)
717-
local def_and_speed = Memory.readdword(startAddress + 92)
718-
local spatk_and_spdef = Memory.readdword(startAddress + 96)
726+
local level_and_currenthp = Memory.readdword(startAddress + Program.Addresses.offsetPokemonStatsLvCurHp)
727+
local maxhp_and_atk = Memory.readdword(startAddress + Program.Addresses.offsetPokemonStatsMaxHpAtk)
728+
local def_and_speed = Memory.readdword(startAddress + Program.Addresses.offsetPokemonStatsDefSpe)
729+
local spatk_and_spdef = Memory.readdword(startAddress + Program.Addresses.offsetPokemonStatsSpaSpd)
719730

720731
return Program.DefaultPokemon:new({
721732
personality = personality,
@@ -1147,10 +1158,11 @@ end
11471158

11481159
--- Returns a list of trainerIds of trainers defeated in the combined area (Use RouteData.CombinedAreas), as well as the total number of trainers in those areas
11491160
--- @param mapIdList table
1161+
--- @param saveBlock1Addr number? (Optional) Include the SaveBlock 1 address if known to avoid extra memory reads
11501162
--- @return table defeatedTrainers, number totalTrainers
1151-
function Program.getDefeatedTrainersByCombinedArea(mapIdList)
1163+
function Program.getDefeatedTrainersByCombinedArea(mapIdList, saveBlock1Addr)
11521164
if type(mapIdList) ~= "table" then return {}, 0 end
1153-
local saveBlock1Addr = Utils.getSaveBlock1Addr()
1165+
saveBlock1Addr = saveBlock1Addr or Utils.getSaveBlock1Addr()
11541166
local totalTrainers = 0
11551167
local defeatedTrainers = {}
11561168
for _, mapId in ipairs(mapIdList) do

0 commit comments

Comments
 (0)