Realmmap loaded from config to assist with custom maps.
This commit is contained in:
@@ -57,6 +57,8 @@ public enum ConfigManager {
|
|||||||
|
|
||||||
MB_WORLD_NAME,
|
MB_WORLD_NAME,
|
||||||
MB_WORLD_MAPID,
|
MB_WORLD_MAPID,
|
||||||
|
MB_WORLD_REALMMAP,
|
||||||
|
|
||||||
MB_WORLD_PORT,
|
MB_WORLD_PORT,
|
||||||
MB_WORLD_ACCESS_LVL,
|
MB_WORLD_ACCESS_LVL,
|
||||||
MB_WORLD_WAREHOUSE_PUSH,
|
MB_WORLD_WAREHOUSE_PUSH,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import engine.net.ByteBufferReader;
|
|||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.objects.Realm;
|
import engine.objects.Realm;
|
||||||
|
import engine.server.world.WorldServer;
|
||||||
|
|
||||||
|
|
||||||
public class WorldRealmMsg extends ClientNetMsg {
|
public class WorldRealmMsg extends ClientNetMsg {
|
||||||
@@ -74,7 +75,7 @@ public class WorldRealmMsg extends ClientNetMsg {
|
|||||||
realm.serializeForClientMsg(writer);
|
realm.serializeForClientMsg(writer);
|
||||||
|
|
||||||
writer.putInt(0x0);
|
writer.putInt(0x0);
|
||||||
writer.putInt(3000000);
|
writer.putInt(WorldServer.worldRealmMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.server.world;
|
package engine.server.world;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
@@ -69,6 +68,8 @@ import static java.lang.System.exit;
|
|||||||
public class WorldServer {
|
public class WorldServer {
|
||||||
|
|
||||||
public static int worldMapID = Integer.parseInt(ConfigManager.MB_WORLD_MAPID.getValue());
|
public static int worldMapID = Integer.parseInt(ConfigManager.MB_WORLD_MAPID.getValue());
|
||||||
|
public static int worldRealmMap = Integer.parseInt(ConfigManager.MB_WORLD_REALMMAP.getValue());
|
||||||
|
|
||||||
public static int worldUUID = 1; // Root object in database
|
public static int worldUUID = 1; // Root object in database
|
||||||
public static Enum.AccountStatus worldAccessLevel = Enum.AccountStatus.valueOf(ConfigManager.MB_WORLD_ACCESS_LVL.getValue());
|
public static Enum.AccountStatus worldAccessLevel = Enum.AccountStatus.valueOf(ConfigManager.MB_WORLD_ACCESS_LVL.getValue());
|
||||||
private static LocalDateTime bootTime = LocalDateTime.now();
|
private static LocalDateTime bootTime = LocalDateTime.now();
|
||||||
@@ -98,7 +99,7 @@ public class WorldServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
worldServer = new WorldServer();
|
worldServer = new WorldServer();
|
||||||
|
|
||||||
ConfigManager.serverType = Enum.ServerType.WORLDSERVER;
|
ConfigManager.serverType = Enum.ServerType.WORLDSERVER;
|
||||||
@@ -106,7 +107,7 @@ public class WorldServer {
|
|||||||
ConfigManager.handler = new ClientMessagePump(worldServer);
|
ConfigManager.handler = new ClientMessagePump(worldServer);
|
||||||
|
|
||||||
worldServer.init();
|
worldServer.init();
|
||||||
|
|
||||||
int retVal = worldServer.exec();
|
int retVal = worldServer.exec();
|
||||||
|
|
||||||
if (retVal != 0)
|
if (retVal != 0)
|
||||||
@@ -125,13 +126,13 @@ public class WorldServer {
|
|||||||
NPC npc = NPC.getFromCache(msg.getObjectID());
|
NPC npc = NPC.getFromCache(msg.getObjectID());
|
||||||
float sellPercent = 1;
|
float sellPercent = 1;
|
||||||
|
|
||||||
if (npc != null){
|
if (npc != null) {
|
||||||
|
|
||||||
if (origin.getPlayerCharacter() != null)
|
if (origin.getPlayerCharacter() != null)
|
||||||
sellPercent = npc.getSellPercent(origin.getPlayerCharacter());
|
sellPercent = npc.getSellPercent(origin.getPlayerCharacter());
|
||||||
else
|
else
|
||||||
sellPercent = npc.getSellPercent();
|
sellPercent = npc.getSellPercent();
|
||||||
|
|
||||||
msg.setTrainPercent(sellPercent); //TrainMsg.getTrainPercent(npc));
|
msg.setTrainPercent(sellPercent); //TrainMsg.getTrainPercent(npc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,11 +153,8 @@ public class WorldServer {
|
|||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void shutdown() {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getUptimeString() {
|
public static String getUptimeString() {
|
||||||
|
|
||||||
String outString = null;
|
String outString = null;
|
||||||
java.time.Duration uptimeDuration;
|
java.time.Duration uptimeDuration;
|
||||||
String newLine = System.getProperty("line.separator");
|
String newLine = System.getProperty("line.separator");
|
||||||
@@ -165,7 +163,7 @@ public class WorldServer {
|
|||||||
outString = "[LUA_UPTIME()]" + newLine;
|
outString = "[LUA_UPTIME()]" + newLine;
|
||||||
uptimeDuration = java.time.Duration.between(LocalDateTime.now(), WorldServer.bootTime);
|
uptimeDuration = java.time.Duration.between(LocalDateTime.now(), WorldServer.bootTime);
|
||||||
long uptimeSeconds = Math.abs(uptimeDuration.getSeconds());
|
long uptimeSeconds = Math.abs(uptimeDuration.getSeconds());
|
||||||
String uptime = String.format("%d hours %02d minutes %02d seconds", uptimeSeconds / 3600, (uptimeSeconds % 3600) / 60, (uptimeSeconds % 60));
|
String uptime = String.format("%d hours %02d minutes %02d seconds", uptimeSeconds / 3600, (uptimeSeconds % 3600) / 60, (uptimeSeconds % 60));
|
||||||
outString += "uptime: " + uptime;
|
outString += "uptime: " + uptime;
|
||||||
outString += " pop: " + SessionManager.getActivePlayerCharacterCount() + " max pop: " + SessionManager._maxPopulation;
|
outString += " pop: " + SessionManager.getActivePlayerCharacterCount() + " max pop: " + SessionManager._maxPopulation;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -174,13 +172,35 @@ public class WorldServer {
|
|||||||
return outString;
|
return outString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void writePopulationFile() {
|
||||||
|
|
||||||
|
int population = SessionManager.getActivePlayerCharacterCount();
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
File populationFile = new File(MBServerStatics.DEFAULT_DATA_DIR + ConfigManager.MB_WORLD_NAME.getValue().replaceAll("'", "") + ".pop");
|
||||||
|
FileWriter fileWriter;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileWriter = new FileWriter(populationFile, false);
|
||||||
|
fileWriter.write(Integer.toString(population));
|
||||||
|
fileWriter.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int exec() {
|
private int exec() {
|
||||||
|
|
||||||
LocalDateTime nextHeartbeatTime = LocalDateTime.now();
|
LocalDateTime nextHeartbeatTime = LocalDateTime.now();
|
||||||
LocalDateTime nextPopulationFileTime = LocalDateTime.now();
|
LocalDateTime nextPopulationFileTime = LocalDateTime.now();
|
||||||
LocalDateTime nextFlashTrashCheckTime = LocalDateTime.now();
|
LocalDateTime nextFlashTrashCheckTime = LocalDateTime.now();
|
||||||
LocalDateTime nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
|
LocalDateTime nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
|
||||||
LocalDateTime nextWareHousePushTime = LocalDateTime.now();;
|
LocalDateTime nextWareHousePushTime = LocalDateTime.now();
|
||||||
|
|
||||||
// Begin execution of main game loop
|
// Begin execution of main game loop
|
||||||
|
|
||||||
@@ -233,7 +253,7 @@ public class WorldServer {
|
|||||||
InetAddress addy = InetAddress.getByName(ConfigManager.MB_BIND_ADDR.getValue());
|
InetAddress addy = InetAddress.getByName(ConfigManager.MB_BIND_ADDR.getValue());
|
||||||
int port = Integer.parseInt(ConfigManager.MB_WORLD_PORT.getValue());
|
int port = Integer.parseInt(ConfigManager.MB_WORLD_PORT.getValue());
|
||||||
|
|
||||||
ClientConnectionManager connectionManager = new ClientConnectionManager(name + ".ClientConnMan", addy,
|
ClientConnectionManager connectionManager = new ClientConnectionManager(name + ".ClientConnMan", addy,
|
||||||
port);
|
port);
|
||||||
connectionManager.startup();
|
connectionManager.startup();
|
||||||
|
|
||||||
@@ -263,25 +283,23 @@ public class WorldServer {
|
|||||||
Guild.getErrantGuild();
|
Guild.getErrantGuild();
|
||||||
|
|
||||||
Logger.info("Initializing PowersManager.");
|
Logger.info("Initializing PowersManager.");
|
||||||
// activate powers manager
|
|
||||||
PowersManager.initPowersManager(true);
|
PowersManager.initPowersManager(true);
|
||||||
|
|
||||||
Logger.info("Initializing granted Skills for Runes");
|
Logger.info("Initializing granted Skills for Runes");
|
||||||
DbManager.SkillsBaseQueries.LOAD_ALL_RUNE_SKILLS();
|
DbManager.SkillsBaseQueries.LOAD_ALL_RUNE_SKILLS();
|
||||||
|
|
||||||
Logger.info("Initializing Player Friends");
|
Logger.info("Initializing Player Friends");
|
||||||
DbManager.PlayerCharacterQueries.LOAD_PLAYER_FRIENDS();
|
DbManager.PlayerCharacterQueries.LOAD_PLAYER_FRIENDS();
|
||||||
|
|
||||||
Logger.info("Initializing NPC Profits");
|
Logger.info("Initializing NPC Profits");
|
||||||
DbManager.NPCQueries.LOAD_NPC_PROFITS();
|
DbManager.NPCQueries.LOAD_NPC_PROFITS();
|
||||||
|
|
||||||
Logger.info("Initializing MeshBounds");
|
Logger.info("Initializing MeshBounds");
|
||||||
MeshBounds.InitializeBuildingBounds();
|
MeshBounds.InitializeBuildingBounds();
|
||||||
|
|
||||||
// Load ItemBases
|
|
||||||
Logger.info("Loading ItemBases");
|
Logger.info("Loading ItemBases");
|
||||||
ItemBase.loadAllItemBases();
|
ItemBase.loadAllItemBases();
|
||||||
|
|
||||||
Logger.info("Loading PromotionClasses");
|
Logger.info("Loading PromotionClasses");
|
||||||
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
||||||
|
|
||||||
@@ -294,6 +312,7 @@ public class WorldServer {
|
|||||||
// Load new loot system
|
// Load new loot system
|
||||||
Logger.info("Loading New Loot Tables");
|
Logger.info("Loading New Loot Tables");
|
||||||
LootManager.loadLootData();
|
LootManager.loadLootData();
|
||||||
|
|
||||||
//load old loot system (still needed for rolling for now)
|
//load old loot system (still needed for rolling for now)
|
||||||
LootTable.populateLootTables();
|
LootTable.populateLootTables();
|
||||||
RuneBaseAttribute.LoadAllAttributes();
|
RuneBaseAttribute.LoadAllAttributes();
|
||||||
@@ -307,7 +326,6 @@ public class WorldServer {
|
|||||||
Logger.info("Loading Mob Powers for MobBases");
|
Logger.info("Loading Mob Powers for MobBases");
|
||||||
PowersManager.LoadAllMobPowers();
|
PowersManager.LoadAllMobPowers();
|
||||||
|
|
||||||
//load item enchantment values
|
|
||||||
Logger.info("Loading item enchants");
|
Logger.info("Loading item enchants");
|
||||||
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
|
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
|
||||||
|
|
||||||
@@ -322,10 +340,10 @@ public class WorldServer {
|
|||||||
|
|
||||||
Logger.info("Loading Kits");
|
Logger.info("Loading Kits");
|
||||||
DbManager.KitQueries.GET_ALL_KITS();
|
DbManager.KitQueries.GET_ALL_KITS();
|
||||||
|
|
||||||
Logger.info("Loading World Grid");
|
Logger.info("Loading World Grid");
|
||||||
WorldGrid.InitializeGridObjects();
|
WorldGrid.InitializeGridObjects();
|
||||||
|
|
||||||
Logger.info("Starting InterestManager.");
|
Logger.info("Starting InterestManager.");
|
||||||
WorldGrid.startLoadJob();
|
WorldGrid.startLoadJob();
|
||||||
|
|
||||||
@@ -364,18 +382,14 @@ public class WorldServer {
|
|||||||
SupportMsgType.InitializeSupportMsgType();
|
SupportMsgType.InitializeSupportMsgType();
|
||||||
|
|
||||||
//Load Buildings, Mobs and NPCs for server
|
//Load Buildings, Mobs and NPCs for server
|
||||||
|
|
||||||
getWorldBuildingsMobsNPCs();
|
getWorldBuildingsMobsNPCs();
|
||||||
|
|
||||||
// Configure realms for serialization
|
// Configure realms for serialization
|
||||||
// Doing this after the world is loaded
|
// Doing this after the world is loaded
|
||||||
|
|
||||||
Logger.info("Configuring realm serialization data");
|
Logger.info("Configuring realm serialization data");
|
||||||
|
Realm.configureAllRealms();
|
||||||
try{
|
|
||||||
Realm.configureAllRealms();
|
|
||||||
}catch(Exception e){
|
|
||||||
Logger.error( e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("Loading Mine data.");
|
Logger.info("Loading Mine data.");
|
||||||
Mine.loadAllMines();
|
Mine.loadAllMines();
|
||||||
@@ -397,23 +411,25 @@ public class WorldServer {
|
|||||||
|
|
||||||
//pick a startup Hotzone
|
//pick a startup Hotzone
|
||||||
ZoneManager.generateAndSetRandomHotzone();
|
ZoneManager.generateAndSetRandomHotzone();
|
||||||
|
|
||||||
Logger.info("Loading All Players from database to Server Cache");
|
Logger.info("Loading All Players from database to Server Cache");
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
try{
|
|
||||||
|
try {
|
||||||
DbManager.PlayerCharacterQueries.GET_ALL_CHARACTERS();
|
DbManager.PlayerCharacterQueries.GET_ALL_CHARACTERS();
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
Logger.info("Loading All Players took " + (end - start) + " ms.");
|
|
||||||
|
Logger.info("Loading All Players took " + (end - start) + " ms.");
|
||||||
|
|
||||||
ItemProductionManager.ITEMPRODUCTIONMANAGER.initialize();
|
ItemProductionManager.ITEMPRODUCTIONMANAGER.initialize();
|
||||||
|
|
||||||
Logger.info("Loading Player Heraldries");
|
Logger.info("Loading Player Heraldries");
|
||||||
DbManager.PlayerCharacterQueries.LOAD_HERALDY();
|
DbManager.PlayerCharacterQueries.LOAD_HERALDY();
|
||||||
|
|
||||||
Logger.info("Running Heraldry Audit for Deleted Players");
|
Logger.info("Running Heraldry Audit for Deleted Players");
|
||||||
Heraldry.AuditHeraldry();
|
Heraldry.AuditHeraldry();
|
||||||
|
|
||||||
@@ -444,17 +460,19 @@ public class WorldServer {
|
|||||||
DispatchMessage.startMessagePump();
|
DispatchMessage.startMessagePump();
|
||||||
|
|
||||||
// Run maintenance
|
// Run maintenance
|
||||||
|
|
||||||
MaintenanceManager.dailyMaintenance();
|
MaintenanceManager.dailyMaintenance();
|
||||||
|
|
||||||
// Disabled but kept in case of emergency
|
|
||||||
Logger.info("Starting Orphan Item Purge");
|
Logger.info("Starting Orphan Item Purge");
|
||||||
PurgeOprhans.startPurgeThread();
|
PurgeOprhans.startPurgeThread();
|
||||||
|
|
||||||
// Open/Close mines for the current window
|
// Open/Close mines for the current window
|
||||||
|
|
||||||
Logger.info("Processing mine window.");
|
Logger.info("Processing mine window.");
|
||||||
HourlyJobThread.processMineWindow();
|
HourlyJobThread.processMineWindow();
|
||||||
|
|
||||||
// Calculate bootstrap time and rest boot time to current time.
|
// Calculate bootstrap time and rest boot time to current time.
|
||||||
|
|
||||||
java.time.Duration bootDuration = java.time.Duration.between(LocalDateTime.now(), bootTime);
|
java.time.Duration bootDuration = java.time.Duration.between(LocalDateTime.now(), bootTime);
|
||||||
long bootSeconds = Math.abs(bootDuration.getSeconds());
|
long bootSeconds = Math.abs(bootDuration.getSeconds());
|
||||||
String boottime = String.format("%d hours %02d minutes %02d seconds", bootSeconds / 3600, (bootSeconds % 3600) / 60, (bootSeconds % 60));
|
String boottime = String.format("%d hours %02d minutes %02d seconds", bootSeconds / 3600, (bootSeconds % 3600) / 60, (bootSeconds % 60));
|
||||||
@@ -467,15 +485,16 @@ public class WorldServer {
|
|||||||
System.gc();
|
System.gc();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean initDatabaselayer() {
|
protected boolean initDatabaselayer() {
|
||||||
|
|
||||||
// Try starting a GOM <-> DB connection.
|
// Try starting a GOM <-> DB connection.
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Logger.info("Configuring GameObjectManager to use Database: '"
|
Logger.info("Configuring GameObjectManager to use Database: '"
|
||||||
+ ConfigManager.MB_DATABASE_NAME.getValue() + "' on "
|
+ ConfigManager.MB_DATABASE_NAME.getValue() + "' on "
|
||||||
+ ConfigManager.MB_DATABASE_ADDRESS.getValue() + ':'
|
+ ConfigManager.MB_DATABASE_ADDRESS.getValue() + ':'
|
||||||
+ ConfigManager.MB_DATABASE_PORT.getValue());
|
+ ConfigManager.MB_DATABASE_PORT.getValue());
|
||||||
|
|
||||||
DbManager.configureConnectionPool();
|
DbManager.configureConnectionPool();
|
||||||
|
|
||||||
@@ -493,7 +512,6 @@ public class WorldServer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void getWorldBuildingsMobsNPCs() {
|
private void getWorldBuildingsMobsNPCs() {
|
||||||
|
|
||||||
ArrayList<Zone> rootParent;
|
ArrayList<Zone> rootParent;
|
||||||
@@ -521,10 +539,10 @@ public class WorldServer {
|
|||||||
try {
|
try {
|
||||||
ZoneManager.addZone(zone.getLoadNum(), zone);
|
ZoneManager.addZone(zone.getLoadNum(), zone);
|
||||||
|
|
||||||
try{
|
try {
|
||||||
zone.generateWorldAltitude();
|
zone.generateWorldAltitude();
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
Logger.error( e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +557,7 @@ public class WorldServer {
|
|||||||
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
b.setLoc(b.getLoc());
|
b.setLoc(b.getLoc());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error( b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
Logger.error(b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,9 +569,9 @@ public class WorldServer {
|
|||||||
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
|
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
|
||||||
m.setLoc(m.getLoc());
|
m.setLoc(m.getLoc());
|
||||||
|
|
||||||
//ADD GUARDS HERE.
|
//ADD GUARDS HERE.
|
||||||
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
||||||
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
|
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle npc's
|
//Handle npc's
|
||||||
@@ -572,7 +590,7 @@ public class WorldServer {
|
|||||||
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
||||||
n.setLoc(n.getLoc());
|
n.setLoc(n.getLoc());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error( n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,10 +663,10 @@ public class WorldServer {
|
|||||||
System.currentTimeMillis() + delta);
|
System.currentTimeMillis() + delta);
|
||||||
playerCharacter.getTimers().put("Logout", jc);
|
playerCharacter.getTimers().put("Logout", jc);
|
||||||
playerCharacter.getTimestamps().put("logout", System.currentTimeMillis());
|
playerCharacter.getTimestamps().put("logout", System.currentTimeMillis());
|
||||||
|
|
||||||
//send update to friends that you are logged off.
|
//send update to friends that you are logged off.
|
||||||
|
|
||||||
PlayerFriends.SendFriendsStatus(playerCharacter,false);
|
PlayerFriends.SendFriendsStatus(playerCharacter, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,7 +691,7 @@ public class WorldServer {
|
|||||||
|
|
||||||
if (player.getPet() != null)
|
if (player.getPet() != null)
|
||||||
player.getPet().dismiss();
|
player.getPet().dismiss();
|
||||||
|
|
||||||
NPCManager.dismissNecroPets(player);
|
NPCManager.dismissNecroPets(player);
|
||||||
|
|
||||||
// Set player inactive so they quit loading for other players
|
// Set player inactive so they quit loading for other players
|
||||||
@@ -688,43 +706,20 @@ public class WorldServer {
|
|||||||
if (group != null)
|
if (group != null)
|
||||||
GroupManager.LeaveGroup(player);
|
GroupManager.LeaveGroup(player);
|
||||||
} catch (MsgSendException e) {
|
} catch (MsgSendException e) {
|
||||||
Logger.error( e.toString());
|
Logger.error(e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
player.respawnLock.writeLock().lock();
|
player.respawnLock.writeLock().lock();
|
||||||
try{
|
try {
|
||||||
if (!player.isAlive())
|
if (!player.isAlive())
|
||||||
player.respawn(false, false, true);
|
player.respawn(false, false, true);
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}finally{
|
} finally {
|
||||||
player.respawnLock.writeLock().unlock();
|
player.respawnLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void writePopulationFile() {
|
|
||||||
|
|
||||||
int population = SessionManager.getActivePlayerCharacterCount();
|
|
||||||
try {
|
|
||||||
|
|
||||||
|
|
||||||
File populationFile = new File(MBServerStatics.DEFAULT_DATA_DIR + ConfigManager.MB_WORLD_NAME.getValue().replaceAll("'","") + ".pop");
|
|
||||||
FileWriter fileWriter;
|
|
||||||
|
|
||||||
try {
|
|
||||||
fileWriter = new FileWriter(populationFile, false);
|
|
||||||
fileWriter.write(Integer.toString(population));
|
|
||||||
fileWriter.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch(Exception e){
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processTrashFile() {
|
private void processTrashFile() {
|
||||||
|
|
||||||
ArrayList<String> machineList;
|
ArrayList<String> machineList;
|
||||||
@@ -742,7 +737,7 @@ try {
|
|||||||
|
|
||||||
// Build list of trash characters associated with that machineID
|
// Build list of trash characters associated with that machineID
|
||||||
|
|
||||||
for (String machineID:machineList) {
|
for (String machineID : machineList) {
|
||||||
trashList = DbManager.AccountQueries.GET_ALL_CHARS_FOR_MACHINE(machineID);
|
trashList = DbManager.AccountQueries.GET_ALL_CHARS_FOR_MACHINE(machineID);
|
||||||
|
|
||||||
|
|
||||||
@@ -784,7 +779,7 @@ try {
|
|||||||
// server cache file by now.
|
// server cache file by now.
|
||||||
|
|
||||||
Timer timer = new Timer("Disconnect Trash");
|
Timer timer = new Timer("Disconnect Trash");
|
||||||
timer.schedule(new DisconnectTrashTask( trashList ), 3000L);
|
timer.schedule(new DisconnectTrashTask(trashList), 3000L);
|
||||||
|
|
||||||
// Clean up after ourselves
|
// Clean up after ourselves
|
||||||
|
|
||||||
@@ -795,7 +790,7 @@ try {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processFlashFile() {
|
private void processFlashFile() {
|
||||||
|
|
||||||
@@ -823,8 +818,8 @@ try {
|
|||||||
if (flashString == "")
|
if (flashString == "")
|
||||||
flashString = "Rebooting for to fix bug.";
|
flashString = "Rebooting for to fix bug.";
|
||||||
|
|
||||||
Logger.info( "Sending flash from external interface");
|
Logger.info("Sending flash from external interface");
|
||||||
Logger.info( "Msg: " + flashString);
|
Logger.info("Msg: " + flashString);
|
||||||
|
|
||||||
ChatSystemMsg msg = new ChatSystemMsg(null, flashString);
|
ChatSystemMsg msg = new ChatSystemMsg(null, flashString);
|
||||||
msg.setChannel(engine.Enum.ChatChannelType.FLASH.getChannelID());
|
msg.setChannel(engine.Enum.ChatChannelType.FLASH.getChannelID());
|
||||||
|
|||||||
Reference in New Issue
Block a user