Exemplo n.º 1
0
 @Override
 public void restoreFromBundle(Bundle bundle) {
   super.restoreFromBundle(bundle);
   if ((hitsToKnow = bundle.getInt(UNFAMILIRIARITY)) == 0) {
     hitsToKnow = HITS_TO_KNOW;
   }
   inscribe((Glyph) bundle.get(GLYPH));
 }
Exemplo n.º 2
0
	@Override
	public void restoreFromBundle( Bundle bundle ) {
		super.restoreFromBundle(bundle);
		if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
			hitsToKnow = HITS_TO_KNOW;
		}
		enchantment = (Enchantment)bundle.get( ENCHANTMENT );
		imbue = bundle.getEnum( IMBUE, Imbue.class );
	}
Exemplo n.º 3
0
  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");
  }
Exemplo n.º 4
0
  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);

    misc1 = (KindofMisc) bundle.get(MISC1);
    if (misc1 != null) {
      misc1.activate(owner);
    }

    misc2 = (KindofMisc) bundle.get(MISC2);
    if (misc2 != null) {
      misc2.activate(owner);
    }
  }
Exemplo n.º 5
0
 public static void preview(GamesInProgress.Info info, Bundle bundle) {
   // Refactoring needed!
   Armor armor = (Armor) bundle.get("armor");
   info.armor = armor == null ? 0 : armor.tier;
   info.level = bundle.getInt(LEVEL);
 }
Exemplo n.º 6
0
 @Override
 public void restoreFromBundle(Bundle bundle) {
   super.restoreFromBundle(bundle);
   weapon = (Weapon) bundle.get(WEAPON);
 }
Exemplo n.º 7
0
  public static void loadGame(String fileName, boolean fullLoad) throws IOException {

    Bundle bundle = gameBundle(fileName);

    Dungeon.challenges = bundle.getInt(CHALLENGES);

    Dungeon.level = null;
    Dungeon.depth = -1;

    if (fullLoad) {
      PathFinder.setMapSize(Level.WIDTH, Level.HEIGHT);
    }

    Scroll.restore(bundle);
    Potion.restore(bundle);
    Wand.restore(bundle);
    Ring.restore(bundle);

    potionOfStrength = bundle.getInt(POS);
    scrollsOfUpgrade = bundle.getInt(SOU);
    arcaneStyli = bundle.getInt(AS);
    dewVial = bundle.getBoolean(DV);
    transmutation = bundle.getInt(WT);

    if (fullLoad) {
      chapters = new HashSet<Integer>();
      int ids[] = bundle.getIntArray(CHAPTERS);
      if (ids != null) {
        for (int id : ids) {
          chapters.add(id);
        }
      }

      Bundle quests = bundle.getBundle(QUESTS);
      if (!quests.isNull()) {
        Ghost.Quest.restoreFromBundle(quests);
        WandMaker.Quest.restoreFromBundle(quests);
        Blacksmith.Quest.restoreFromBundle(quests);
        Imp.Quest.restoreFromBundle(quests);
      } else {
        Ghost.Quest.reset();
        WandMaker.Quest.reset();
        Blacksmith.Quest.reset();
        Imp.Quest.reset();
      }

      Room.restoreRoomsFromBundle(bundle);
    }

    Bundle badges = bundle.getBundle(BADGES);
    if (!badges.isNull()) {
      Badges.loadLocal(badges);
    } else {
      Badges.reset();
    }

    String qsClass = bundle.getString(QUICKSLOT);
    if (qsClass != null) {
      try {
        quickslot = Class.forName(qsClass);
      } catch (ClassNotFoundException e) {
      }
    } else {
      quickslot = null;
    }

    @SuppressWarnings("unused")
    String version = bundle.getString(VERSION);

    hero = null;
    hero = (Hero) bundle.get(HERO);

    gold = bundle.getInt(GOLD);
    depth = bundle.getInt(DEPTH);

    Statistics.restoreFromBundle(bundle);
    Journal.restoreFromBundle(bundle);
  }
Exemplo n.º 8
0
 @Override
 public void restoreFromBundle(Bundle bundle) {
   super.restoreFromBundle(bundle);
   enchantment = (Enchantment) bundle.get(ENCHANTMENT);
 }