Java Code Examples for com.watabou.utils.Bundle#get()
The following examples show how to use
com.watabou.utils.Bundle#get() .
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: Armor.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); usesLeftToID = bundle.getInt( USES_LEFT_TO_ID ); availableUsesToID = bundle.getInt( AVAILABLE_USES ); inscribe((Glyph) bundle.get(GLYPH)); 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); }
Example 2
Source File: Belongings.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public void restoreFromBundle( Bundle bundle ) { backpack.clear(); backpack.restoreFromBundle( bundle ); weapon = (KindOfWeapon) bundle.get(WEAPON); if (weapon != null) { weapon.activate(owner); } armor = (Armor)bundle.get( ARMOR ); if (armor != null){ armor.activate( owner ); } misc1 = (KindofMisc)bundle.get(MISC1); if (misc1 != null) { misc1.activate( owner ); } misc2 = (KindofMisc)bundle.get(MISC2); if (misc2 != null) { misc2.activate( owner ); } }
Example 3
Source File: Belongings.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
public void restoreFromBundle( Bundle bundle ) { backpack.clear(); backpack.restoreFromBundle( bundle ); weapon = (KindOfWeapon) bundle.get(WEAPON); if (weapon != null) { weapon.activate(owner); } armor = (Armor)bundle.get( ARMOR ); if (armor != null){ armor.activate( owner ); } misc1 = (KindofMisc)bundle.get(MISC1); if (misc1 != null) { misc1.activate( owner ); } misc2 = (KindofMisc)bundle.get(MISC2); if (misc2 != null) { misc2.activate( owner ); } }
Example 4
Source File: Ghost.java From pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public static void restoreFromBundle( Bundle bundle ) { Bundle node = bundle.getBundle( NODE ); if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) { type = node.getEnum( TYPE, Type.class ); if (type == Type.ILLEGAL) { type = node.getBoolean( ALTERNATIVE ) ? Type.RAT : Type.ROSE; } if (type == Type.ROSE) { left2kill = node.getInt( LEFT2KILL ); } given = node.getBoolean( GIVEN ); depth = node.getInt( DEPTH ); processed = node.getBoolean( PROCESSED ); weapon = (Weapon)node.get( WEAPON ); armor = (Armor)node.get( ARMOR ); } else { reset(); } }
Example 5
Source File: Armor.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); usesLeftToID = bundle.getInt( USES_LEFT_TO_ID ); availableUsesToID = bundle.getInt( AVAILABLE_USES ); inscribe((Glyph) bundle.get(GLYPH)); 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); }
Example 6
Source File: OldPrisonBossLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); state = bundle.getEnum( STATE, State.class ); //in some states tengu won't be in the world, in others he will be. if (state == State.START || state == State.MAZE) { tengu = (OldTengu)bundle.get( TENGU ); } else { for (Mob mob : mobs){ if (mob instanceof OldTengu) { tengu = (OldTengu) mob; break; } } } for (Bundlable item : bundle.getCollection(STORED_ITEMS)){ storedItems.add( (Item)item ); } }
Example 7
Source File: Imp.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static void restoreFromBundle( Bundle bundle ) { Bundle node = bundle.getBundle( NODE ); if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) { alternative = node.getBoolean( ALTERNATIVE ); given = node.getBoolean( GIVEN ); completed = node.getBoolean( COMPLETED ); reward = (Ring)node.get( REWARD ); } }
Example 8
Source File: Imp.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static void restoreFromBundle( Bundle bundle ) { Bundle node = bundle.getBundle( NODE ); if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) { alternative = node.getBoolean( ALTERNATIVE ); given = node.getBoolean( GIVEN ); completed = node.getBoolean( COMPLETED ); reward = (Ring)node.get( REWARD ); } }
Example 9
Source File: Dungeon.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static Level loadLevel( HeroClass cl ) throws IOException { Dungeon.level = null; Actor.clear(); InputStream input = Game.instance.openFileInput( Utils.format( depthFile( cl ), depth ) ) ; Bundle bundle = Bundle.read( input ); input.close(); return (Level)bundle.get( "level" ); }
Example 10
Source File: WeaponTest.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@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 11
Source File: DriedRose.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); talkedTo = bundle.getBoolean( TALKEDTO ); firstSummon = bundle.getBoolean( FIRSTSUMMON ); ghostID = bundle.getInt( GHOSTID ); droppedPetals = bundle.getInt( PETALS ); if (ghostID != 0) defaultAction = AC_DIRECT; if (bundle.contains(WEAPON)) weapon = (MeleeWeapon)bundle.get( WEAPON ); if (bundle.contains(ARMOR)) armor = (Armor)bundle.get( ARMOR ); }
Example 12
Source File: MagesStaff.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); wand = (Wand) bundle.get(WAND); if (wand != null) { wand.maxCharges = Math.min(wand.maxCharges + 1, 10); name = Messages.get(wand, "staff_name"); } }
Example 13
Source File: Belongings.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
public static void preview( GamesInProgress.Info info, Bundle bundle ) { if (bundle.contains( ARMOR )){ info.armorTier = ((Armor)bundle.get( ARMOR )).tier; } else { info.armorTier = 0; } }
Example 14
Source File: SpecialRoom.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); if (bundle.contains(ENTRANCE)){ entrance = (Door)bundle.get(ENTRANCE); } }
Example 15
Source File: Thief.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); item = (Item)bundle.get( ITEM ); }
Example 16
Source File: Bones.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
public static Item get() { if (depth == -1) { try { InputStream input = Game.instance().openFileInput(BONES_FILE); Bundle bundle = Bundle.read(input); input.close(); if (bundle.contains(LEVEL) && bundle.contains(ITEM)) { depth = bundle.getInt(LEVEL); item = (Item) bundle.get(ITEM); return get(); } } catch (Exception ignored) { } return CharsList.DUMMY_ITEM; } else { if (depth == Dungeon.depth) { Game.instance().deleteFile( BONES_FILE ); depth = 0; if (!item.stackable) { item.setCursed(true); item.setCursedKnown(true); if (item.isUpgradable()) { int lvl = (Dungeon.depth - 1) * 3 / 5 + 1; if (lvl < item.level()) { item.degrade( item.level() - lvl ); } item.setLevelKnown(false); } } if (item instanceof Ring) { ((Ring)item).syncGem(); } return item; } else { return CharsList.DUMMY_ITEM; } } }
Example 17
Source File: Thief.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); item = (Item)bundle.get( ITEM ); }
Example 18
Source File: Notes.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); key = (Key) bundle.get(KEY); }
Example 19
Source File: ArmoredStatue.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); armor = (Armor)bundle.get( ARMOR ); }
Example 20
Source File: Wandmaker.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public static void restoreFromBundle( Bundle bundle ) { Bundle node = bundle.getBundle( NODE ); if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) { type = node.getInt(TYPE); given = node.getBoolean( GIVEN ); wand1 = (Wand)node.get( WAND1 ); wand2 = (Wand)node.get( WAND2 ); if (type == 2){ CeremonialCandle.ritualPos = node.getInt( RITUALPOS ); } } else { reset(); } }