v2.0.1: removed support for v1.0 and v1.1 save data
This commit is contained in:
@@ -229,14 +229,7 @@ public class Badges {
|
||||
|
||||
private static final HashMap<String, String> renamedBadges = new HashMap<>();
|
||||
static{
|
||||
//v1.1.0 (some names were from before 1.1.0, but conversion was added then)
|
||||
renamedBadges.put("BAG_BOUGHT_SEED_POUCH", "BAG_BOUGHT_VELVET_POUCH");
|
||||
renamedBadges.put("BAG_BOUGHT_WAND_HOLSTER", "BAG_BOUGHT_MAGICAL_HOLSTER");
|
||||
|
||||
renamedBadges.put("POTIONS_COOKED_1", "ITEMS_CRAFTED_1");
|
||||
renamedBadges.put("POTIONS_COOKED_2", "ITEMS_CRAFTED_2");
|
||||
renamedBadges.put("POTIONS_COOKED_3", "ITEMS_CRAFTED_3");
|
||||
renamedBadges.put("POTIONS_COOKED_4", "ITEMS_CRAFTED_4");
|
||||
//no renamed badges currently
|
||||
}
|
||||
|
||||
public static HashSet<Badge> restore( Bundle bundle ) {
|
||||
|
||||
@@ -188,7 +188,6 @@ public class Dungeon {
|
||||
public static HashSet<Integer> chapters;
|
||||
|
||||
public static SparseArray<ArrayList<Item>> droppedItems;
|
||||
public static SparseArray<ArrayList<Item>> portedItems;
|
||||
|
||||
//first variable is only assigned when game is started, second is updated every time game is saved
|
||||
public static int initialVersion;
|
||||
@@ -250,7 +249,6 @@ public class Dungeon {
|
||||
energy = 0;
|
||||
|
||||
droppedItems = new SparseArray<>();
|
||||
portedItems = new SparseArray<>();
|
||||
|
||||
LimitedDrops.reset();
|
||||
|
||||
@@ -558,10 +556,6 @@ public class Dungeon {
|
||||
for (int d : droppedItems.keyArray()) {
|
||||
bundle.put(Messages.format(DROPPED, d), droppedItems.get(d));
|
||||
}
|
||||
|
||||
for (int p : portedItems.keyArray()){
|
||||
bundle.put(Messages.format(PORTED, p), portedItems.get(p));
|
||||
}
|
||||
|
||||
quickslot.storePlaceholders( bundle );
|
||||
|
||||
@@ -720,7 +714,6 @@ public class Dungeon {
|
||||
Generator.restoreFromBundle( bundle );
|
||||
|
||||
droppedItems = new SparseArray<>();
|
||||
portedItems = new SparseArray<>();
|
||||
for (int i=1; i <= 26; i++) {
|
||||
|
||||
//dropped items
|
||||
@@ -732,16 +725,7 @@ public class Dungeon {
|
||||
if (!items.isEmpty()) {
|
||||
droppedItems.put( i, items );
|
||||
}
|
||||
|
||||
//ported items
|
||||
items = new ArrayList<>();
|
||||
if (bundle.contains(Messages.format( PORTED, i )))
|
||||
for (Bundlable b : bundle.getCollection( Messages.format( PORTED, i ) ) ) {
|
||||
items.add( (Item)b );
|
||||
}
|
||||
if (!items.isEmpty()) {
|
||||
portedItems.put( i, items );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ public class GamesInProgress {
|
||||
info.slot = slot;
|
||||
Dungeon.preview(info, bundle);
|
||||
|
||||
//saves from before v1.0.3 are not supported
|
||||
if (info.version < ShatteredPixelDungeon.v1_0_3) {
|
||||
//saves from before v1.2.3 are not supported
|
||||
if (info.version < ShatteredPixelDungeon.v1_2_3) {
|
||||
info = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,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 v1.0.3 are no longer supported, and data from them is ignored
|
||||
public static final int v1_0_3 = 574;
|
||||
public static final int v1_1_2 = 588;
|
||||
//versions older than v1.2.3 are no longer supported, and data from them is ignored
|
||||
public static final int v1_2_3 = 628;
|
||||
public static final int v1_3_2 = 648;
|
||||
public static final int v1_4_3 = 668;
|
||||
@@ -64,36 +62,6 @@ public class ShatteredPixelDungeon extends Game {
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Explosive.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile" );
|
||||
|
||||
//pre-v1.2.0
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.CleansingDart.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.SleepDart" );
|
||||
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.CrystalVaultRoom.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.VaultRoom" );
|
||||
|
||||
//pre-v1.1.0
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfDread.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPetrification" );
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfSirensSong.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfAffection" );
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfChallenge.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfConfusion" );
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfDivineInspiration.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfHolyFuror" );
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfMastery.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfAdrenalineSurge" );
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
ScrollOfMetamorphosis.class,
|
||||
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPolymorph" );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,16 +42,6 @@ public class Alchemy extends Blob {
|
||||
if (Dungeon.level.insideMap(cell)) {
|
||||
off[cell] = cur[cell];
|
||||
|
||||
//for pre-v1.1.0 saves, drops 1/4 the pot's old energy contents in crystals
|
||||
if (off[cell] >= 4){
|
||||
int n;
|
||||
do {
|
||||
n = cell + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
|
||||
} while (!Dungeon.level.passable[n] && !Dungeon.level.avoid[n]);
|
||||
Dungeon.level.drop( new EnergyCrystal((int)Math.ceil(off[cell]/4f)), n ).sprite.drop( cell );
|
||||
off[cell] = 1;
|
||||
}
|
||||
|
||||
volume += off[cell];
|
||||
if (off[cell] > 0 && Dungeon.level.visited[cell]){
|
||||
Notes.add( Notes.Landmark.ALCHEMY );
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2023 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
//removed from drops, here for pre-1.1.0 saves
|
||||
public class MerchantsBeacon extends Item {
|
||||
|
||||
private static final String AC_USE = "USE";
|
||||
|
||||
{
|
||||
image = ItemSpriteSheet.BEACON;
|
||||
|
||||
stackable = true;
|
||||
|
||||
defaultAction = AC_USE;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions(Hero hero) {
|
||||
ArrayList<String> actions = super.actions(hero);
|
||||
actions.add(AC_USE);
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Hero hero, String action) {
|
||||
|
||||
super.execute(hero, action);
|
||||
|
||||
if (action.equals(AC_USE)) {
|
||||
detach( hero.belongings.backpack );
|
||||
Shopkeeper.sell();
|
||||
Sample.INSTANCE.play( Assets.Sounds.BEACON );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int value() {
|
||||
return 5 * quantity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MeatPie;
|
||||
@@ -50,7 +49,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.spells.BeaconOfReturning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.CurseInfusion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.FeatherFall;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalInfusion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalPorter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.PhaseShift;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.ReclaimTrap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.Recycle;
|
||||
@@ -201,7 +199,6 @@ public abstract class Recipe {
|
||||
new CurseInfusion.Recipe(),
|
||||
new FeatherFall.Recipe(),
|
||||
new MagicalInfusion.Recipe(),
|
||||
new MagicalPorter.Recipe(),
|
||||
new PhaseShift.Recipe(),
|
||||
new ReclaimTrap.Recipe(),
|
||||
new Recycle.Recipe(),
|
||||
|
||||
@@ -252,15 +252,6 @@ public class MasterThievesArmband extends Artifact {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
//conversion for old armband on pre-1.2.0 saves
|
||||
if (exp > Math.round(10 + level()*3.33f)){
|
||||
exp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class Thievery extends ArtifactBuff {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2023 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.MerchantsBeacon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
//beacon was removed from drops, here for pre-1.1.0 saves
|
||||
public class MagicalPorter extends InventorySpell {
|
||||
|
||||
{
|
||||
image = ItemSpriteSheet.MAGIC_PORTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCast(Hero hero) {
|
||||
if (Dungeon.depth >= 25){
|
||||
GLog.w(Messages.get(this, "nowhere"));
|
||||
} else {
|
||||
super.onCast(hero);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean usableOnItem(Item item) {
|
||||
return !item.isEquipped(Dungeon.hero);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected(Item item) {
|
||||
|
||||
Item result = item.detachAll(curUser.belongings.backpack);
|
||||
int portDepth = 5 * (1 + Dungeon.depth/5);
|
||||
ArrayList<Item> ported = Dungeon.portedItems.get(portDepth);
|
||||
if (ported == null) {
|
||||
Dungeon.portedItems.put(portDepth, ported = new ArrayList<>());
|
||||
}
|
||||
ported.add(result);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int value() {
|
||||
//prices of ingredients, divided by output quantity
|
||||
return Math.round(quantity * ((5 + 40) / 8f));
|
||||
}
|
||||
|
||||
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
|
||||
|
||||
{
|
||||
inputs = new Class[]{MerchantsBeacon.class, ArcaneCatalyst.class};
|
||||
inQuantity = new int[]{1, 1};
|
||||
|
||||
cost = 4;
|
||||
|
||||
output = MagicalPorter.class;
|
||||
outQuantity = 8;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -325,8 +325,8 @@ public abstract class Level implements Bundlable {
|
||||
|
||||
version = bundle.getInt( VERSION );
|
||||
|
||||
//saves from before v1.0.3 are not supported
|
||||
if (version < ShatteredPixelDungeon.v1_0_3){
|
||||
//saves from before v1.2.3 are not supported
|
||||
if (version < ShatteredPixelDungeon.v1_2_3){
|
||||
throw new RuntimeException("old save");
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.MerchantsBeacon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Torch;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor;
|
||||
|
||||
@@ -451,25 +451,6 @@ public class GameScene extends PixelScene {
|
||||
Dungeon.droppedItems.remove( Dungeon.depth );
|
||||
}
|
||||
|
||||
//pre-1.1.0 saves, including all logic surrounding Dungeon.portedItems
|
||||
ArrayList<Item> ported = Dungeon.portedItems.get( Dungeon.depth );
|
||||
if (ported != null){
|
||||
//might want to have a 'near entrance' function if items can be ported elsewhere
|
||||
int pos;
|
||||
//try to find a tile with no heap, otherwise just stick items onto a heap.
|
||||
int tries = 100;
|
||||
do {
|
||||
pos = Dungeon.level.randomRespawnCell( null );
|
||||
tries--;
|
||||
} while (tries > 0 && Dungeon.level.heaps.get(pos) != null);
|
||||
for (Item item : ported) {
|
||||
Dungeon.level.drop( item, pos ).type = Heap.Type.CHEST;
|
||||
}
|
||||
Dungeon.level.heaps.get(pos).type = Heap.Type.CHEST;
|
||||
Dungeon.level.heaps.get(pos).sprite.link(); //sprite reset to show chest
|
||||
Dungeon.portedItems.remove( Dungeon.depth );
|
||||
}
|
||||
|
||||
Dungeon.hero.next();
|
||||
|
||||
switch (InterlevelScene.mode){
|
||||
|
||||
@@ -240,17 +240,10 @@ public class WelcomeScene extends PixelScene {
|
||||
//update rankings, to update any data which may be outdated
|
||||
if (previousVersion < LATEST_UPDATE){
|
||||
try {
|
||||
Badges.loadGlobal(); //fixing a bug with v1.3.2 saves
|
||||
Rankings.INSTANCE.load();
|
||||
for (Rankings.Record rec : Rankings.INSTANCE.records.toArray(new Rankings.Record[0])){
|
||||
try {
|
||||
Rankings.INSTANCE.loadGameData(rec);
|
||||
if (Statistics.gameWon) {
|
||||
Badges.unlock(Badges.Badge.VICTORY);
|
||||
if (Challenges.activeChallenges() >= 1) Badges.unlock(Badges.Badge.CHAMPION_1);
|
||||
if (Challenges.activeChallenges() >= 3) Badges.unlock(Badges.Badge.CHAMPION_2);
|
||||
if (Challenges.activeChallenges() >= 6) Badges.unlock(Badges.Badge.CHAMPION_3);
|
||||
}
|
||||
Rankings.INSTANCE.saveGameData(rec);
|
||||
} catch (Exception e) {
|
||||
//if we encounter a fatal per-record error, then clear that record
|
||||
@@ -270,7 +263,6 @@ public class WelcomeScene extends PixelScene {
|
||||
}
|
||||
Collections.sort(Rankings.INSTANCE.records, Rankings.scoreComparator);
|
||||
Rankings.INSTANCE.save();
|
||||
Badges.saveGlobal();
|
||||
} catch (Exception e) {
|
||||
//if we encounter a fatal error, then just clear the rankings
|
||||
FileUtils.deleteFile( Rankings.RANKINGS_FILE );
|
||||
|
||||
@@ -58,7 +58,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.spells.BeaconOfReturning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.CurseInfusion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.FeatherFall;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalInfusion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalPorter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.PhaseShift;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.ReclaimTrap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.Recycle;
|
||||
|
||||
@@ -161,16 +161,6 @@ public class DesktopLauncher {
|
||||
String titleLinux = title.toLowerCase(Locale.ROOT).replace(" ", "-");
|
||||
basePath = XDGHome + "/." + vendor + "/" + titleLinux + "/";
|
||||
|
||||
//copy over files from old linux save DIR, pre-1.2.0
|
||||
FileHandle oldBase = new Lwjgl3FileHandle("." + vendor + "/" + titleLinux + "/", Files.FileType.External);
|
||||
FileHandle newBase = new Lwjgl3FileHandle(basePath, Files.FileType.Absolute);
|
||||
if (oldBase.exists()){
|
||||
if (!newBase.exists()) {
|
||||
oldBase.copyTo(newBase.parent());
|
||||
}
|
||||
oldBase.deleteDirectory();
|
||||
oldBase.parent().delete(); //only regular delete, in case of saves from other PD versions
|
||||
}
|
||||
baseFileType = Files.FileType.Absolute;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user