diff --git a/scripts/commands/server.py b/scripts/commands/server.py index 0514fa98..0a77dcfc 100644 --- a/scripts/commands/server.py +++ b/scripts/commands/server.py @@ -1,5 +1,6 @@ import sys from engine.resources.scene import Point3D +from resources.datatables import ServerStatus def setup(): return @@ -26,9 +27,9 @@ def run(core, actor, target, commandString): return if command == 'lockServer': - core.setGalaxyStatus(3) + core.setGalaxyStatus(ServerStatus.Locked) if command == 'unlockServer': - core.setGalaxyStatus(2) + core.setGalaxyStatus(ServerStatus.Online) if command == 'info': actor.sendSystemMessage(str(core.getActiveZoneClients()) + ' online characters.', 0) if command == 'shutdown': diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 533d1a7f..07194a52 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -52,6 +52,7 @@ import net.engio.mbassy.bus.config.BusConfiguration; import resources.common.BountyListItem; import resources.common.RadialOptions; import resources.common.ThreadMonitor; +import resources.datatables.ServerStatus; import resources.objects.creature.CreatureObject; import resources.objects.guild.GuildObject; import resources.objects.resource.GalacticResource; @@ -113,6 +114,7 @@ import services.trade.TradeService; import services.travel.TravelService; import tools.CharonPacketLogger; import tools.DevLogQueuer; +import services.BattlefieldService; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.CrcStringTableVisitor; import engine.clientdata.visitors.DatatableVisitor; @@ -208,6 +210,7 @@ public class NGECore { public ReverseEngineeringService reverseEngineeringService; public PetService petService; public BrowserService browserService; + public BattlefieldService battlefieldService; // Login Server public NetworkDispatch loginDispatch; @@ -302,7 +305,7 @@ public class NGECore { databaseConnection2.connect(config.getString("DB2.URL"), config.getString("DB2.NAME"), config.getString("DB2.USER"), config.getString("DB2.PASS"), "mysql"); } - setGalaxyStatus(1); + setGalaxyStatus(ServerStatus.Loading); swgObjectODB = new ObjectDatabase("swgobjects", true, true, true, SWGObject.class); mailODB = new ObjectDatabase("mails", true, true, true, Mail.class); guildODB = new ObjectDatabase("guild", true, true, true, GuildObject.class); @@ -557,6 +560,7 @@ public class NGECore { retroService.run(); browserService = new BrowserService(this); + battlefieldService = new BattlefieldService(this); DevLogQueuer devLogQueuer = new DevLogQueuer(); @@ -567,7 +571,7 @@ public class NGECore { didServerCrash = false; System.out.println("Started Server."); cleanupCreatureODB(); - setGalaxyStatus(2); + setGalaxyStatus(ServerStatus.Online); } @@ -788,7 +792,7 @@ public class NGECore { chatService.broadcastGalaxy("The server will be shutting down soon. Please find a safe place to logout. (" + minutes + " minutes left)"); Thread.sleep(60000); } - setGalaxyStatus(3); + setGalaxyStatus(ServerStatus.Locked); chatService.broadcastGalaxy("The server will be shutting down soon. Please find a safe place to logout. (" + 1 + " minutes left)"); Thread.sleep(30000); chatService.broadcastGalaxy("You will be disconnected in 30 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now."); diff --git a/src/resources/datatables/ServerStatus.java b/src/resources/datatables/ServerStatus.java new file mode 100644 index 00000000..a825d2e8 --- /dev/null +++ b/src/resources/datatables/ServerStatus.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class ServerStatus { + + public static final int Offline = 0; + public static final int Loading = 1; + public static final int Online = 2; + public static final int Locked = 3; + +}