v3.0.0: added code to track which item types have been found in a run
This commit is contained in:
@@ -24,6 +24,9 @@ package com.shatteredpixel.shatteredpixeldungeon;
|
|||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.SparseArray;
|
import com.watabou.utils.SparseArray;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class Statistics {
|
public class Statistics {
|
||||||
|
|
||||||
public static int goldCollected;
|
public static int goldCollected;
|
||||||
@@ -34,6 +37,8 @@ public class Statistics {
|
|||||||
public static int itemsCrafted;
|
public static int itemsCrafted;
|
||||||
public static int piranhasKilled;
|
public static int piranhasKilled;
|
||||||
public static int ankhsUsed;
|
public static int ankhsUsed;
|
||||||
|
//tracks every item type 'seen' this run (i.e. would be added to catalogs)
|
||||||
|
public static HashSet<Class> itemTypesDiscovered = new HashSet<>();
|
||||||
|
|
||||||
//These are used for score calculation
|
//These are used for score calculation
|
||||||
// some are built incrementally, most are assigned when full score is calculated
|
// some are built incrementally, most are assigned when full score is calculated
|
||||||
@@ -78,6 +83,7 @@ public class Statistics {
|
|||||||
itemsCrafted = 0;
|
itemsCrafted = 0;
|
||||||
piranhasKilled = 0;
|
piranhasKilled = 0;
|
||||||
ankhsUsed = 0;
|
ankhsUsed = 0;
|
||||||
|
itemTypesDiscovered.clear();
|
||||||
|
|
||||||
progressScore = 0;
|
progressScore = 0;
|
||||||
heldItemValue = 0;
|
heldItemValue = 0;
|
||||||
@@ -136,6 +142,8 @@ public class Statistics {
|
|||||||
private static final String SNEAKS = "sneakAttacks";
|
private static final String SNEAKS = "sneakAttacks";
|
||||||
private static final String THROWN = "thrownAssists";
|
private static final String THROWN = "thrownAssists";
|
||||||
|
|
||||||
|
private static final String ITEM_DISCOVERIES = "item_discoveries";
|
||||||
|
|
||||||
private static final String SPAWNERS = "spawnersAlive";
|
private static final String SPAWNERS = "spawnersAlive";
|
||||||
|
|
||||||
private static final String DURATION = "duration";
|
private static final String DURATION = "duration";
|
||||||
@@ -157,6 +165,7 @@ public class Statistics {
|
|||||||
bundle.put( ALCHEMY, itemsCrafted );
|
bundle.put( ALCHEMY, itemsCrafted );
|
||||||
bundle.put( PIRANHAS, piranhasKilled );
|
bundle.put( PIRANHAS, piranhasKilled );
|
||||||
bundle.put( ANKHS, ankhsUsed );
|
bundle.put( ANKHS, ankhsUsed );
|
||||||
|
bundle.put( ITEM_DISCOVERIES, itemTypesDiscovered.toArray(new Class<?>[0]) );
|
||||||
|
|
||||||
bundle.put( PROG_SCORE, progressScore );
|
bundle.put( PROG_SCORE, progressScore );
|
||||||
bundle.put( ITEM_VAL, heldItemValue );
|
bundle.put( ITEM_VAL, heldItemValue );
|
||||||
@@ -202,6 +211,12 @@ public class Statistics {
|
|||||||
piranhasKilled = bundle.getInt( PIRANHAS );
|
piranhasKilled = bundle.getInt( PIRANHAS );
|
||||||
ankhsUsed = bundle.getInt( ANKHS );
|
ankhsUsed = bundle.getInt( ANKHS );
|
||||||
|
|
||||||
|
if (bundle.contains( ITEM_DISCOVERIES )) {
|
||||||
|
itemTypesDiscovered = new HashSet<>(Arrays.asList(bundle.getClassArray(ITEM_DISCOVERIES)));
|
||||||
|
} else {
|
||||||
|
itemTypesDiscovered.clear();
|
||||||
|
}
|
||||||
|
|
||||||
progressScore = bundle.getInt( PROG_SCORE );
|
progressScore = bundle.getInt( PROG_SCORE );
|
||||||
heldItemValue = bundle.getInt( ITEM_VAL );
|
heldItemValue = bundle.getInt( ITEM_VAL );
|
||||||
treasureScore = bundle.getInt( TRES_SCORE );
|
treasureScore = bundle.getInt( TRES_SCORE );
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.journal;
|
package com.shatteredpixel.shatteredpixeldungeon.journal;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.ArcaneResin;
|
import com.shatteredpixel.shatteredpixeldungeon.items.ArcaneResin;
|
||||||
@@ -320,6 +321,7 @@ public enum Catalog {
|
|||||||
Journal.saveNeeded = true;
|
Journal.saveNeeded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Statistics.itemTypesDiscovered.add(cls);
|
||||||
Badges.validateCatalogBadges();
|
Badges.validateCatalogBadges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user