Whenever you get any Chart, the Game will reset all the flags for that Chart. This code should only impact Salvageable Charts.
Currently there isn't a handler on this, meaning players can double-salvage certain items, this is the easiest way to duplicate items.
Here are the situations that can come up, and their resolutions. (Assume Charts are not Randomized)
Player A receives Treasure Chart 1 from Player B, and has not found that Chart in their own world.
- Treasure Chart 1's flags are reset. (Mirrors Vanilla Behavior for finding a Chart)
Player A receives Treasure Chart 1 from Player B, and found Player B's Chart in their own world.
- Treasure Chart 1's flags are reset. (The flags should have been handled when sending original chart as well)
Player A sends Treasure Chart 1 to Player B, and has not Salvaged the Chart.
- No flags are changed.
Player A sends Treasure Chart 1 to Player B, and has already Salvaged this Chart.
- Flags are set to the "Salvaged" State.
The easiest way to handle this (Unfortunately) is to run a scan over the memory locations found here whenever a new Item is found. Then when sending a Chart, we verify the status of the Memory. (Reference the Player's Inventory to see if they own the chart -> Verify Memory State -> Adjust if needed)
Note
It might be possible to disable the Game's flag resetting mechanism using ASM patches, meaning we can leave the flag handling entirely to the game. And have no code Changes for the Client. This would also provide a solution to the Randomized Chart Problem.
Before working on this, please DM me on Discord directly asking about it.