com.watabou.utils.Bundle Java Examples
The following examples show how to use
com.watabou.utils.Bundle.
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: Wandmaker.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.DUST : Type.BERRY; } given = node.getBoolean( GIVEN ); wand1 = (Wand)node.get( WAND1 ); wand2 = (Wand)node.get( WAND2 ); } else { reset(); } }
Example #2
Source File: NewPrisonBossLevel.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.TRAP_MAZES || state == State.FIGHT_PAUSE) { tengu = (NewTengu)bundle.get( TENGU ); } else { for (Mob mob : mobs){ if (mob instanceof NewTengu) { tengu = (NewTengu) mob; break; } } } for (Bundlable item : bundle.getCollection(STORED_ITEMS)){ storedItems.add( (Item)item ); } triggered = bundle.getBooleanArray(TRIGGERED); }
Example #3
Source File: NewCavesBossLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); for (CustomTilemap c : customTiles){ if (c instanceof ArenaVisuals){ customArenaVisuals = (ArenaVisuals) c; } } //pre-0.8.1 saves that may not have had pylons added int gatePos = pointToCell(new Point(gate.left, gate.top)); if (!locked && solid[gatePos]){ for (int i : pylonPositions) { if (findMob(i) == null) { Pylon pylon = new Pylon(); pylon.pos = i; mobs.add(pylon); } } } }
Example #4
Source File: Item.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void restoreFromBundle(Bundle bundle) { if(id==EntityIdSource.INVALID_ID) { id = EntityIdSource.getNextId(); } quantity(bundle.getInt(QUANTITY)); int level = bundle.getInt(LEVEL); if (level > 0) { upgrade(level); } else if (level < 0) { degrade(-level); } //We still need this because upgrade erase cursed flag setCursed(bundle.optBoolean("cursed",false)); if(quickSlotIndex >= 0 ) { QuickSlot.selectItem(this, quickSlotIndex); } }
Example #5
Source File: Level.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void storeInBundle( Bundle bundle ) { bundle.put( VERSION, Game.versionCode ); bundle.put( WIDTH, width ); bundle.put( HEIGHT, height ); bundle.put( MAP, map ); bundle.put( VISITED, visited ); bundle.put( MAPPED, mapped ); bundle.put( ENTRANCE, entrance ); bundle.put( EXIT, exit ); bundle.put( LOCKED, locked ); bundle.put( HEAPS, heaps.valueList() ); bundle.put( PLANTS, plants.valueList() ); bundle.put( TRAPS, traps.valueList() ); bundle.put( CUSTOM_TILES, customTiles ); bundle.put( CUSTOM_WALLS, customWalls ); bundle.put( MOBS, mobs ); bundle.put( BLOBS, blobs.values() ); bundle.put( FEELING, feeling ); bundle.put( "mobs_to_spawn", mobsToSpawn.toArray(new Class[0])); }
Example #6
Source File: Bones.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static void leave() { item = null; switch (Random.Int( 4 )) { case 0: item = Dungeon.hero.belongings.weapon; break; case 1: item = Dungeon.hero.belongings.armor; break; case 2: item = Dungeon.hero.belongings.ring1; break; case 3: item = Dungeon.hero.belongings.ring2; break; } if (item == null) { if (Dungeon.gold > 0) { item = new Gold( Random.IntRange( 1, Dungeon.gold ) ); } else { item = new Gold( 1 ); } } depth = Dungeon.depth; Bundle bundle = new Bundle(); bundle.put( LEVEL, depth ); bundle.put( ITEM, item ); try { OutputStream output = Game.instance.openFileOutput( BONES_FILE, Game.MODE_PRIVATE ); Bundle.write( bundle, output ); output.close(); } catch (IOException e) { } }
Example #7
Source File: AzuterronNPC.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
public static void storeInBundle( Bundle bundle ) { Bundle node = new Bundle(); node.put(GIVEN, given); node.put(DEPTH, depth); node.put(PROCESSED, processed); node.put(COMPLETED, completed); bundle.put( NODE, node ); }
Example #8
Source File: RipperDemon.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); lastEnemyPos = bundle.getInt(LAST_ENEMY_POS); leapPos = bundle.getInt(LEAP_POS); leapCooldown = bundle.getFloat(LEAP_CD); }
Example #9
Source File: Weapon.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void storeInBundle( Bundle bundle ) { super.storeInBundle( bundle ); bundle.put( UNFAMILIRIARITY, hitsToKnow ); bundle.put( ENCHANTMENT, enchantment ); bundle.put( IMBUE, imbue ); }
Example #10
Source File: Statistics.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
public static void storeInBundle( Bundle bundle ) { bundle.put( GOLD, goldCollected ); bundle.put( UPGRADES, itemsUpgraded ); bundle.put( DEEPEST, deepestFloor ); bundle.put( SLAIN, enemiesSlain ); bundle.put( FOOD, foodEaten ); bundle.put( ALCHEMY, potionsCooked ); bundle.put( PIRANHAS, piranhasKilled ); bundle.put( NIGHT, nightHunt ); bundle.put( ANKHS, ankhsUsed ); bundle.put( DURATION, duration ); bundle.put( AMULET, amuletObtained ); }
Example #11
Source File: DriedRose.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public void storeInBundle( Bundle bundle ) { super.storeInBundle(bundle); bundle.put( TALKEDTO, talkedTo ); bundle.put( FIRSTSUMMON, firstSummon ); bundle.put( GHOSTID, ghostID ); bundle.put( PETALS, droppedPetals ); if (weapon != null) bundle.put( WEAPON, weapon ); if (armor != null) bundle.put( ARMOR, armor ); }
Example #12
Source File: Mimic.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void restoreFromBundle( Bundle bundle ) { if (bundle.contains( ITEMS )) { items = new ArrayList<>((Collection<Item>) ((Collection<?>) bundle.getCollection(ITEMS))); } adjustStats( bundle.getInt( LEVEL ) ); super.restoreFromBundle(bundle); }
Example #13
Source File: Ring.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override 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; } }
Example #14
Source File: Blacksmith.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static void storeInBundle( Bundle bundle ) { Bundle node = new Bundle(); node.put( SPAWNED, spawned ); if (spawned) { node.put( ALTERNATIVE, alternative ); node.put( GIVEN, given ); node.put( COMPLETED, completed ); node.put( REFORGED, reforged ); } bundle.put( NODE, node ); }
Example #15
Source File: Badges.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
private static void store( Bundle bundle, HashSet<Badge> badges ) { int count = 0; String names[] = new String[badges.size()]; for (Badge badge:badges) { names[count++] = badge.toString(); } bundle.put( BADGES, names ); }
Example #16
Source File: Bag.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); for (Bundlable item : bundle.getCollection( ITEMS )) { if( item != null) ((Item)item).collect( this ); }; }
Example #17
Source File: WandOfWarding.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); bundle.put(TIER, tier); bundle.put(WAND_LEVEL, wandLevel); bundle.put(TOTAL_ZAPS, totalZaps); }
Example #18
Source File: SandalsOfNature.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); name = bundle.getString( NAME ); if (bundle.contains(SEEDS)) Collections.addAll(seeds , bundle.getStringArray(SEEDS)); }
Example #19
Source File: RegularLevel.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) ); for (Room r : rooms) { r.onLevelLoad( this ); if (r instanceof EntranceRoom ){ roomEntrance = r; } else if (r instanceof ExitRoom ){ roomExit = r; } } }
Example #20
Source File: Blob.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); int[] data = bundle.getIntArray(CUR); int start = bundle.getInt(START); for (int i = 0; i < data.length; i++) { cur[i + start] = data[i]; volume += data[i]; } }
Example #21
Source File: Char.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); pos = bundle.getInt( POS ); HP = bundle.getInt( TAG_HP ); HT = bundle.getInt( TAG_HT ); for (Bundlable b : bundle.getCollection( BUFFS )) { if (b != null) { ((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); } } }
Example #22
Source File: Rankings.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { info = bundle.getString ( REASON ); win = bundle.getBoolean ( WIN ); score = bundle.getInt ( SCORE ); heroClass = HeroClass.restoreFromBundle(bundle); gameFile = bundle.getString( GAME ); mod = bundle.optString(MOD, ModdingMode.REMIXED); }
Example #23
Source File: Generator.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
public static void storeInBundle(Bundle bundle) { Float[] genProbs = categoryProbs.values().toArray(new Float[0]); float[] storeProbs = new float[genProbs.length]; for (int i = 0; i < storeProbs.length; i++){ storeProbs[i] = genProbs[i]; } bundle.put( GENERAL_PROBS, storeProbs); bundle.put( SPAWNED_ARTIFACTS, spawnedArtifacts.toArray(new Class[0])); }
Example #24
Source File: Char.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); bundle.put(TAG_HP, hp()); bundle.put(TAG_HT, ht()); bundle.put(BUFFS, buffs); bundle.put(SPELLS_USAGE, spellsUsage); belongings.storeInBundle(bundle); }
Example #25
Source File: Eye.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); if (bundle.contains(BEAM_TARGET)) beamTarget = bundle.getInt(BEAM_TARGET); beamCooldown = bundle.getInt(BEAM_COOLDOWN); beamCharged = bundle.getBoolean(BEAM_CHARGED); }
Example #26
Source File: RipperDemon.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); bundle.put(LAST_ENEMY_POS, lastEnemyPos); bundle.put(LEAP_POS, leapPos); bundle.put(LEAP_CD, leapCooldown); }
Example #27
Source File: MirrorImage.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void storeInBundle( Bundle bundle ) { super.storeInBundle( bundle ); bundle.put( TIER, tier ); bundle.put( ATTACK, attack ); bundle.put( DAMAGE, damage ); }
Example #28
Source File: SpecialRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
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); } } } else { initForRun(); ShatteredPixelDungeon.reportException(new Exception("specials array didn't exist!")); } pitNeededDepth = bundle.getInt(PIT); }
Example #29
Source File: Alchemy.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); for (int i=0; i < LENGTH; i++) { if (cur[i] > 0) { pos = i; break; } } }
Example #30
Source File: MirrorImage.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); gear = bundle.getInt( GEAR ); attack = bundle.getInt( ATTACK ); damage = bundle.getInt( DAMAGE ); }