Java Code Examples for com.watabou.utils.Bundle#put()

The following examples show how to use com.watabou.utils.Bundle#put() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Bones.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public static void leave() {

		depth = Dungeon.depth;

		//heroes which have won the game, who die far above their farthest depth, or who are challenged drop no bones.
		if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth || Dungeon.challenges > 0) {
			depth = -1;
			return;
		}

		item = pickItem(Dungeon.hero);

		Bundle bundle = new Bundle();
		bundle.put( LEVEL, depth );
		bundle.put( ITEM, item );

		try {
			FileUtils.bundleToFile( BONES_FILE, bundle );
		} catch (IOException e) {
			ShatteredPixelDungeon.reportException(e);
		}
	}
 
Example 2
Source File: Statistics.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static void storeInBundle( Bundle bundle ) {
	bundle.put( GOLD,		goldCollected );
	bundle.put( DEEPEST,	deepestFloor );
	bundle.put( SLAIN,		enemiesSlain );
	bundle.put( FOOD,		foodEaten );
	bundle.put( ALCHEMY,	potionsCooked );
	bundle.put( PIRANHAS,	piranhasKilled );
	bundle.put( ANKHS,		ankhsUsed );
	
	bundle.put( UPGRADES,   upgradesUsed );
	bundle.put( SNEAKS,		sneakAttacks );
	bundle.put( THROWN,		thrownAssists );

	bundle.put( SPAWNERS,	spawnersAlive );
	
	bundle.put( DURATION,	duration );
	
	bundle.put( AMULET,		amuletObtained );
}
 
Example 3
Source File: WeaponTest.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void SaveRestore() {
    Weapon item = new ShortSword();
    item.upgrade(10);
    item.upgrade(true);

    Bundle bundle = new Bundle();

    bundle.put("a", item);

    Item restoredItem = (Item) bundle.get("a");

    Assert.assertEquals(item,restoredItem);
}
 
Example 4
Source File: Level.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	bundle.put( MAP, map );
	bundle.put( VISITED, visited );
	bundle.put( MAPPED, mapped );
	bundle.put( ENTRANCE, entrance );
	bundle.put( EXIT, exit );
	bundle.put( HEAPS, heaps.values() );
	bundle.put( PLANTS, plants.values() );
	bundle.put( MOBS, mobs );
	bundle.put( BLOBS, blobs.values() );
}
 
Example 5
Source File: OilLantern.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
       bundle.put( ACTIVE, active );
       bundle.put( CHARGE, charge );
       bundle.put( FLASKS, flasks );
}
 
Example 6
Source File: WandOfRegrowth.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle(Bundle bundle) {
	super.storeInBundle(bundle);
	bundle.put( TOTAL, totChrgUsed );
}
 
Example 7
Source File: Thief.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	bundle.put( ITEM, item );
}
 
Example 8
Source File: Plant.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	bundle.put( POS, pos );
}
 
Example 9
Source File: SnipersMark.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	bundle.put( OBJECT, object );

}
 
Example 10
Source File: Pickaxe.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	
	bundle.put( BLOODSTAINED, bloodStained );
}
 
Example 11
Source File: Burning.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	bundle.put( LEFT, left );
}
 
Example 12
Source File: Notes.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle(Bundle bundle) {
	super.storeInBundle(bundle);
	bundle.put( LANDMARK, landmark.toString() );
}
 
Example 13
Source File: BuffReactive.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
    super.storeInBundle( bundle );
    bundle.put( DURATION, duration );
}
 
Example 14
Source File: CorpseDust.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle(Bundle bundle) {
	super.storeInBundle(bundle);
	bundle.put( SPAWNPOWER, spawnPower );
}
 
Example 15
Source File: Dungeon.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
public static void saveGame( String fileName ) throws IOException {
	try {
		Bundle bundle = new Bundle();
		
		bundle.put( VERSION, Game.version );
		bundle.put( DIFFICULTY, difficulty );
		bundle.put( CHALLENGES, challenges );
		bundle.put( HERO, hero );
		bundle.put( GOLD, gold );
		bundle.put( DEPTH, depth );
		
		for (int d : droppedItems.keyArray()) {
			bundle.put( String.format( DROPPED, d ), droppedItems.get( d ) );
		}
		
		bundle.put( POS, potionOfStrength );
		bundle.put( POE, potionOfExperience );
		bundle.put( SOU, scrollsOfUpgrade );
		bundle.put( SOE, scrollsOfEnchantment );

		bundle.put( ANKHS, ankhs );
		bundle.put( WANDS, wands );
		bundle.put( RINGS, rings );
		bundle.put( AMMOS, ammos );

		bundle.put( BOTTLES, bottles );
		bundle.put( SCROLLS, scrolls );
		bundle.put( TORCHES, torches );

		int count = 0;
		int ids[] = new int[chapters.size()];
		for (Integer id : chapters) {
			ids[count++] = id;
		}
		bundle.put( CHAPTERS, ids );
		
		Bundle quests = new Bundle();
		Ghost		.Quest.storeInBundle( quests );
		Wandmaker	.Quest.storeInBundle( quests );
		Blacksmith	.Quest.storeInBundle( quests );
		AmbitiousImp.Quest.storeInBundle( quests );
		bundle.put( QUESTS, quests );
		
		Room.storeRoomsInBundle( bundle );

           ShopPainter.saveAssortment( bundle );
		
		Statistics.storeInBundle( bundle );
		Journal.storeInBundle( bundle );
		
		QuickSlot.save( bundle );
		
		Scroll.save( bundle );
		Potion.save( bundle );
		Wand.save( bundle );
		Ring.save( bundle );
		
		Bundle badges = new Bundle();
		Badges.saveLocal( badges );
		bundle.put( BADGES, badges );
		
		OutputStream output = Game.instance.openFileOutput( fileName, Game.MODE_PRIVATE );
		Bundle.write( bundle, output );
		output.close();
		
	} catch (Exception e) {

		GamesInProgress.setUnknown( hero.heroClass );
	}
}
 
Example 16
Source File: Bee.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	bundle.put( LEVEL, level );
}
 
Example 17
Source File: Spinner.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle(Bundle bundle) {
	super.storeInBundle(bundle);
	bundle.put(WEB_COOLDOWN, webCoolDown);
	bundle.put(LAST_ENEMY_POS, lastEnemyPos);
}
 
Example 18
Source File: SewerBossLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	bundle.put( STAIRS, stairs );
}
 
Example 19
Source File: PinCushion.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle(Bundle bundle) {
	bundle.put( ITEMS , items );
	super.storeInBundle(bundle);
}
 
Example 20
Source File: PrismaticImage.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void storeInBundle( Bundle bundle ) {
	super.storeInBundle( bundle );
	bundle.put( HEROID, heroID );
	bundle.put( TIMER, deathTimer );
}