Merge branch 'fix-blastcoal-saves' into 'master'

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

See merge request 2009scape/2009scape!380
This commit is contained in:
Ryan 2022-01-06 00:02:54 +00:00
commit fb4296debd
2 changed files with 11 additions and 2 deletions

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.

View file

@ -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))
}
}
}