v0.8.2c: dropped compatibility from saves prior to v0.7.3b

This commit is contained in:
Evan Debenham 2020-08-21 22:54:36 -04:00
parent 4f1829af63
commit 72147a297c
19 changed files with 21 additions and 231 deletions

View File

@ -36,7 +36,6 @@ import com.watabou.utils.FileUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -176,15 +175,12 @@ public class Badges {
private static final HashSet<String> removedBadges = new HashSet<>();
static{
//removed in 0.6.5
removedBadges.addAll(Arrays.asList("RARE_ALBINO", "RARE_BANDIT", "RARE_SHIELDED",
"RARE_SENIOR", "RARE_ACIDIC", "RARE", "TUTORIAL_WARRIOR", "TUTORIAL_MAGE"));
//no recently removed badges
}
private static final HashMap<String, String> renamedBadges = new HashMap<>();
static{
//0.6.5
renamedBadges.put("CHAMPION", "CHAMPION_1");
//no recently renamed badges
}
public static HashSet<Badge> restore( Bundle bundle ) {

View File

@ -41,19 +41,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesi
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewHallsBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.HallsLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.LastLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewCavesBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewCityBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewHallsBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewPrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel;
@ -388,35 +386,6 @@ public class Dungeon {
hero.curAction = hero.lastAction = null;
//pre-0.7.1 saves. Adjusting for spirit bows in weapon slot or with upgrades.
SpiritBow bow;
if (hero.belongings.weapon instanceof SpiritBow){
bow = (SpiritBow)hero.belongings.weapon;
hero.belongings.weapon = null;
if (!bow.collect()){
level.drop(bow, hero.pos);
}
} else {
bow = hero.belongings.getItem(SpiritBow.class);
}
//pre-0.7.1 saves. refunding upgrades previously spend on a boomerang
if (bow != null && bow.spentUpgrades() > 0){
ScrollOfUpgrade refund = new ScrollOfUpgrade();
refund.quantity(bow.spentUpgrades());
bow.level(0);
//to prevent exploits, some SoU are lost in the conversion of a boomerang higher than +1
if (refund.quantity() > 1){
refund.quantity(1 + (int)Math.floor((refund.quantity()-1)*0.8f));
}
if (!refund.collect()){
level.drop(refund, hero.pos);
}
}
observe();
try {
saveAll();
@ -644,17 +613,6 @@ public class Dungeon {
hero = null;
hero = (Hero)bundle.get( HERO );
//pre-0.7.0 saves, back when alchemy had a window which could store items
if (bundle.contains("alchemy_inputs")){
for (Bundlable item : bundle.getCollection("alchemy_inputs")){
//try to add normally, force-add otherwise.
if (!((Item)item).collect(hero.belongings.backpack)){
hero.belongings.backpack.items.add((Item)item);
}
}
}
gold = bundle.getInt( GOLD );
depth = bundle.getInt( DEPTH );

View File

@ -102,8 +102,8 @@ public class GamesInProgress {
info.slot = slot;
Dungeon.preview(info, bundle);
//saves from before 0.6.5c are not supported
if (info.version < ShatteredPixelDungeon.v0_6_5c) {
//saves from before v0.7.3b are not supported
if (info.version < ShatteredPixelDungeon.v0_7_3b) {
info = null;
}

View File

@ -32,12 +32,7 @@ import com.watabou.utils.PlatformSupport;
public class ShatteredPixelDungeon extends Game {
//variable constants for specific older versions of shattered, used for data conversion
//versions older than v0.6.5c are no longer supported, and data from them is ignored
public static final int v0_6_5c = 264;
public static final int v0_7_0c = 311;
public static final int v0_7_1d = 323;
public static final int v0_7_2d = 340;
//versions older than v0.7.3b are no longer supported, and data from them is ignored
public static final int v0_7_3b = 349;
public static final int v0_7_4c = 362;
public static final int v0_7_5e = 382;
@ -49,61 +44,6 @@ public class ShatteredPixelDungeon extends Game {
public ShatteredPixelDungeon( PlatformSupport platform ) {
super( sceneClass == null ? WelcomeScene.class : sceneClass, platform );
//v0.7.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb.class,
"com.shatteredpixel.shatteredpixeldungeon.items.Bomb" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution.class,
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.ElixirOfMight.class,
"com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalInfusion.class,
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion" );
//v0.7.1
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Gloves.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles" );
//v0.7.2
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming.class,
"com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectCurse" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Elastic" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Dazzling" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Eldritch" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Stunning" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Venomous" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vorpal" );
//v0.7.3
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift" );
//v0.7.5
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.SewerBossEntranceRoom.class,

View File

@ -62,10 +62,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Elemental;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
@ -240,18 +238,6 @@ public abstract class Char extends Actor {
((Buff)b).attachTo( this );
}
}
//pre-0.7.0
if (bundle.contains( "SHLD" )){
int legacySHLD = bundle.getInt( "SHLD" );
//attempt to find the buff that may have given the shield
ShieldBuff buff = buff(Brimstone.BrimstoneShield.class);
if (buff != null) legacySHLD -= buff.shielding();
if (legacySHLD > 0){
BrokenSeal.WarriorShield buff2 = buff(BrokenSeal.WarriorShield.class);
if (buff != null) buff2.supercharge(legacySHLD);
}
}
}
public boolean attack( Char enemy ) {

View File

@ -91,11 +91,6 @@ public class AdrenalineSurge extends Buff {
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
boost = bundle.getInt( BOOST );
//pre-0.7.1
if (bundle.contains(INTERVAL)) {
interval = bundle.getFloat(INTERVAL);
} else {
interval = 800f;
}
}
}

View File

@ -60,17 +60,9 @@ public class Berserk extends Buff {
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
//pre-0.6.5 saves
if (bundle.contains("exhaustion")){
state = State.RECOVERING;
} else {
state = bundle.getEnum(STATE, State.class);
}
if (bundle.contains(POWER)){
power = bundle.getFloat(POWER);
} else {
power = 1f;
}
if (state == State.RECOVERING) levelRecovery = bundle.getFloat(LEVEL_RECOVERY);
}

View File

@ -49,12 +49,7 @@ public class Ooze extends Buff {
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
//pre-0.7.0
if (bundle.contains( LEFT )) {
left = bundle.getFloat(LEFT);
} else {
left = 20;
}
}
@Override

View File

@ -175,11 +175,6 @@ public class MirrorImage extends NPC {
public CharSprite sprite() {
CharSprite s = super.sprite();
//pre-0.7.0 saves
if (heroID == 0){
heroID = Dungeon.hero.id();
}
hero = (Hero)Actor.findById(heroID);
if (hero != null) {
armTier = hero.tier();

View File

@ -140,12 +140,6 @@ public class Armor extends EquipableItem {
curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS );
seal = (BrokenSeal)bundle.get(SEAL);
//pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){
usesLeftToID = bundle.getInt( "unfamiliarity" );
availableUsesToID = USES_TO_ID/2f;
}
augment = bundle.getEnum(AUGMENT, Augment.class);
}

View File

@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ShieldBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Bundle;
public class Brimstone extends Armor.Glyph {
@ -71,14 +70,6 @@ public class Brimstone extends Armor.Glyph {
return true;
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
//pre-0.7.0
if (bundle.contains("added")){
setShield(bundle.getInt("added"));
}
}
}
}

View File

@ -284,11 +284,6 @@ public class Ring extends KindofMisc {
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
levelsToID = bundle.getFloat( LEVELS_TO_ID );
//pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){
levelsToID = bundle.getInt( "unfamiliarity" ) / 200f;
}
}
public void onHeroGainExp( float levelPercent, Hero hero ){

View File

@ -196,9 +196,7 @@ public class SpiritBow extends Weapon {
@Override
public int level() {
//need to check if hero is null for loading an upgraded bow from pre-0.7.0
return (Dungeon.hero == null ? 0 : Dungeon.hero.lvl/5)
+ (curseInfusionBonus ? 1 : 0);
return (Dungeon.hero == null ? 0 : Dungeon.hero.lvl/5) + (curseInfusionBonus ? 1 : 0);
}
@Override
@ -207,11 +205,6 @@ public class SpiritBow extends Weapon {
return level();
}
//for fetching upgrades from a boomerang from pre-0.7.1
public int spentUpgrades() {
return super.level() - (curseInfusionBonus ? 1 : 0);
}
@Override
public boolean isUpgradable() {
return false;

View File

@ -41,10 +41,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazin
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blooming;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Corrupting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
@ -149,12 +149,6 @@ abstract public class Weapon extends KindOfWeapon {
enchantment = (Enchantment)bundle.get( ENCHANTMENT );
curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS );
//pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){
usesLeftToID = bundle.getInt( "unfamiliarity" );
availableUsesToID = USES_TO_ID/2f;
}
augment = bundle.getEnum(AUGMENT, Augment.class);
}

View File

@ -167,11 +167,6 @@ public enum Document {
if (doc.pages.containsKey(page)) {
doc.pages.put(page, true);
}
//pre-0.7.2 saves
else if (page.equals("Brews")){
doc.pages.put("Catalysts", true);
doc.pages.put("Brews_Elixirs", true);
}
}
}
}

View File

@ -299,8 +299,8 @@ public abstract class Level implements Bundlable {
version = bundle.getInt( VERSION );
//saves from before 0.6.5c are not supported
if (version < ShatteredPixelDungeon.v0_6_5c){
//saves from before v0.7.3b are not supported
if (version < ShatteredPixelDungeon.v0_7_3b){
throw new RuntimeException("old save");
}

View File

@ -30,6 +30,7 @@ import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public abstract class SpecialRoom extends Room {
@ -167,12 +168,7 @@ public abstract class SpecialRoom extends Room {
public static void restoreRoomsFromBundle( Bundle bundle ) {
runSpecials.clear();
if (bundle.contains( ROOMS )) {
for (Class<? extends Room> type : bundle.getClassArray(ROOMS)) {
//pre-0.7.0 saves
if (type != null && type != LaboratoryRoom.class) {
runSpecials.add(type);
}
}
Collections.addAll(runSpecials, bundle.getClassArray(ROOMS));
} else {
initForRun();
ShatteredPixelDungeon.reportException(new Exception("specials array didn't exist!"));

View File

@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class BlandfruitBush extends Plant {
@ -37,11 +36,9 @@ public class BlandfruitBush extends Plant {
Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop();
}
//This seed no longer drops, but has a sprite as it did drop prior to 0.7.0
//seed is never dropped
public static class Seed extends Plant.Seed {
{
image = ItemSpriteSheet.SEED_FADELEAF;
plantClass = BlandfruitBush.class;
}

View File

@ -21,15 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.BannerSprites;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
@ -183,25 +180,6 @@ public class WelcomeScene extends PixelScene {
}
}
//give classes to people with saves that have previously unlocked them
if (previousVersion <= ShatteredPixelDungeon.v0_7_0c){
Badges.loadGlobal();
Badges.addGlobal(Badges.Badge.UNLOCK_MAGE);
Badges.addGlobal(Badges.Badge.UNLOCK_ROGUE);
if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_3)){
Badges.addGlobal(Badges.Badge.UNLOCK_HUNTRESS);
}
Badges.saveGlobal();
}
if (previousVersion <= ShatteredPixelDungeon.v0_6_5c){
Journal.loadGlobal();
Document.ALCHEMY_GUIDE.addPage("Potions");
Document.ALCHEMY_GUIDE.addPage("Stones");
Document.ALCHEMY_GUIDE.addPage("Energy_Food");
Journal.saveGlobal();
}
SPDSettings.version(ShatteredPixelDungeon.versionCode);
}