Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 public void loadWorld(World world) {
   try {
     tileArchive = new ZipFile(new File(Config.CONF_DIR, "data/Landscape.rscd"));
     // out = new ZipOutputStream(new FileOutputStream(new
     // File(Config.CONF_DIR, "data/new_Landscape.rscd")));
     // out.setLevel(9);
   } catch (Exception e) {
     Logger.error(e);
   }
   long now = System.currentTimeMillis();
   for (int lvl = 0; lvl < 4; lvl++) {
     int wildX = 2304;
     int wildY = 1776 - (lvl * 944);
     for (int sx = 0; sx < 1000; sx += 48) {
       for (int sy = 0; sy < 1000; sy += 48) {
         int x = (sx + wildX) / 48;
         int y = (sy + (lvl * 944) + wildY) / 48;
         loadSection(x, y, lvl, world, sx, sy + (944 * lvl));
       }
     }
   }
   System.out.println((System.currentTimeMillis() - now) / 1000 + "s to parse");
   // try { out.close(); } catch(Exception e) { Logger.error(e); }
   for (Shop shop : (List<Shop>) PersistenceManager.load("locs/Shops.xml.gz")) {
     world.registerShop(shop);
   }
   System.gc();
 }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public void loadObjects() {
    World world = Instance.getWorld();
    for (GameObjectLoc gameObject :
        (List<GameObjectLoc>) PersistenceManager.load("locs/GameObjectLoc.xml.gz")) {
      if (Constants.GameServer.F2P_WILDY && Formulae.isP2P(true, gameObject)) continue;
      if (Formulae.isP2P(gameObject) && !World.isMembers()) continue;
      world.registerGameObject(new GameObject(gameObject));
    }
    for (ItemLoc item : (List<ItemLoc>) PersistenceManager.load("locs/ItemLoc.xml.gz")) {
      if (Constants.GameServer.F2P_WILDY && Formulae.isP2P(true, item)) continue;
      if (Formulae.isP2P(item) && !World.isMembers()) continue;
      world.registerItem(new Item(item));
    } // ember

    for (NPCLoc npc : (List<NPCLoc>) PersistenceManager.load("locs/NpcLoc.xml.gz")) {
      if (Constants.GameServer.F2P_WILDY && Formulae.isP2P(true, npc)) continue;
      if (Formulae.isP2P(npc) && !World.isMembers()) continue;
      world.registerNpc(new Npc(npc));
    }
  }