Browse Source

More granular error reporting.

combat-2
MagicBot 1 year ago
parent
commit
400dd6aa5e
  1. 73
      src/engine/server/world/WorldServer.java

73
src/engine/server/world/WorldServer.java

@ -17,6 +17,7 @@ import engine.InterestManagement.HeightMap;
import engine.InterestManagement.RealmMap; import engine.InterestManagement.RealmMap;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.db.archive.DataWarehouse; import engine.db.archive.DataWarehouse;
import engine.db.handlers.dbPowerHandler;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.*; import engine.gameManager.*;
import engine.job.JobContainer; import engine.job.JobContainer;
@ -351,7 +352,7 @@ public class WorldServer {
DbManager.MobBaseQueries.GET_ALL_MOBBASES(); DbManager.MobBaseQueries.GET_ALL_MOBBASES();
Logger.info("Loading Mob Powers"); Logger.info("Loading Mob Powers");
PowersManager.AllMobPowers = DbManager.PowerQueries.LOAD_MOB_POWERS(); PowersManager.AllMobPowers = dbPowerHandler.LOAD_MOB_POWERS();
Logger.info("Loading item enchants"); Logger.info("Loading item enchants");
DbManager.LootQueries.LOAD_ENCHANT_VALUES(); DbManager.LootQueries.LOAD_ENCHANT_VALUES();
@ -481,7 +482,7 @@ public class WorldServer {
Logger.info("Initializing Client Connection Manager"); Logger.info("Initializing Client Connection Manager");
initClientConnectionManager(); initClientConnectionManager();
//intiate mob respawn thread //intiate mob respawn thread
Logger.info("Starting Mob Respawn Thread"); Logger.info("Starting Mob Respawn Thread");
MobRespawnThread.startRespawnThread(); MobRespawnThread.startRespawnThread();
@ -550,44 +551,40 @@ public class WorldServer {
} }
//Set sea floor object for server //Set sea floor object for server
Zone seaFloor = rootParent.get(0); Zone seaFloor = rootParent.get(0);
seaFloor.setParent(null); seaFloor.setParent(null);
ZoneManager.setSeaFloor(seaFloor); ZoneManager.setSeaFloor(seaFloor);
// zoneManager.addZone(seaFloor.getLoadNum(), seaFloor); <- DIE IN A FUCKING CAR FIRE BONUS CODE LIKE THIS SUCKS FUCKING DICK
rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor)); rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor));
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
for (Zone zone : rootParent) { for (Zone zone : rootParent) {
try { ZoneManager.addZone(zone.getLoadNum(), zone);
ZoneManager.addZone(zone.getLoadNum(), zone); zone.generateWorldAltitude();
try {
zone.generateWorldAltitude();
} catch (Exception e) {
Logger.error(e.getMessage());
e.printStackTrace();
}
//Handle Buildings //Handle Buildings
try {
ArrayList<Building> bList; ArrayList<Building> bList;
bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone); bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone);
for (Building b : bList) { for (Building b : bList) {
try { b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING); b.setLoc(b.getLoc());
b.setLoc(b.getLoc());
} catch (Exception e) {
Logger.error(b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
}
} }
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle Mobs //Handle Mobs
try {
ArrayList<Mob> mobs; ArrayList<Mob> mobs;
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone); mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
@ -600,11 +597,17 @@ public class WorldServer {
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK) if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK)
DbManager.MobQueries.LOAD_GUARD_MINIONS(m); DbManager.MobQueries.LOAD_GUARD_MINIONS(m);
} }
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle npc's //Handle NPCs
try {
ArrayList<NPC> npcs; ArrayList<NPC> npcs;
// Ignore npc's on the seafloor (npc guild leaders, etc) // Ignore NPCs on the seafloor (npc guild leaders, etc)
if (zone.equals(seaFloor)) if (zone.equals(seaFloor))
continue; continue;
@ -612,26 +615,22 @@ public class WorldServer {
npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone); npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone);
for (NPC n : npcs) { for (NPC n : npcs) {
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
try { n.setLoc(n.getLoc());
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
n.setLoc(n.getLoc());
} catch (Exception e) {
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
}
} }
//Handle cities
ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone);
} catch (Exception e) { } catch (Exception e) {
Logger.info(e.getMessage() + zone.getName() + ' ' + zone.getObjectUUID()); Logger.error(e);
e.printStackTrace();
} }
//Handle cities
ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone);
} }
Logger.info("time to load: " + (System.currentTimeMillis() - start) + " ms"); Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
} }
/** /**
@ -704,7 +703,7 @@ public class WorldServer {
return; return;
} }
//remove player from loaded mobs agro maps //remove player from loaded mobs agro maps
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(),MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_MOB)) { for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_MOB)) {
Mob loadedMob = (Mob) awo; Mob loadedMob = (Mob) awo;
loadedMob.playerAgroMap.remove(player.getObjectUUID()); loadedMob.playerAgroMap.remove(player.getObjectUUID());
} }

Loading…
Cancel
Save