Fix player saves for players who used coal on the conveyer belt before bf-fixes.

This commit is contained in:
Avi Weinstock
2022-01-05 14:48:21 -05:00
parent eca439b99e
commit 1b0bdf4de5
2 changed files with 11 additions and 2 deletions
+1
View File
@@ -98,3 +98,4 @@
- Can now travel on free charter boats without having money in inventory
- Emerald and diamond bracelet enchants no longer produce noted items
- Prevent furnace temperature from going negative and deduplicate bar handling.
- Fix player saves for players who used coal on the conveyer belt before bf-fixes.
@@ -20,6 +20,8 @@ import rs09.game.system.SystemLogger
import rs09.game.world.World
import java.io.FileReader
import java.util.*
import core.game.node.item.Item;
import org.rs09.consts.Items;
/**
* Class used for parsing JSON player saves.
@@ -379,6 +381,7 @@ class PlayerSaveParser(val player: Player) {
bBars?.let{player.blastBars.parse(it)}
bOre?.let{player.blastOre.parse(bOre)}
bCoal?.let{player.blastCoal.parse(bCoal)}
migrateBlastCoal()
player.location = rs09.JSONUtils.parseLocation(location)
}
@@ -409,5 +412,10 @@ class PlayerSaveParser(val player: Player) {
player.settings.parse(settingsData)
}
}
fun migrateBlastCoal() {
val amount = player.blastOre.getAmount(Items.COAL_453)
if(amount > 0 && player.blastOre.remove(Item(Items.COAL_453, amount))) {
player.blastCoal.add(Item(Items.COAL_453, amount))
}
}
}