Browse Source

Members moved to WorldServer.

Root object no longer read from config.
master
MagicBot 1 year ago
parent
commit
b9db6e8dc6
  1. 4
      src/engine/db/handlers/dbGuildHandler.java
  2. 6
      src/engine/gameManager/ChatManager.java
  3. 1
      src/engine/gameManager/ConfigManager.java
  4. 8
      src/engine/net/client/handlers/BreakFealtyHandler.java
  5. 8
      src/engine/net/client/handlers/DismissGuildHandler.java
  6. 9
      src/engine/net/client/handlers/RequestEnterWorldHandler.java
  7. 7
      src/engine/net/client/msg/ServerInfoMsg.java
  8. 4
      src/engine/net/client/msg/WorldDataMsg.java
  9. 6
      src/engine/net/client/msg/chat/ChatCSRMsg.java
  10. 6
      src/engine/net/client/msg/chat/ChatCityMsg.java
  11. 6
      src/engine/net/client/msg/chat/ChatGlobalMsg.java
  12. 6
      src/engine/net/client/msg/chat/ChatSayMsg.java
  13. 6
      src/engine/net/client/msg/chat/ChatShoutMsg.java
  14. 28
      src/engine/net/client/msg/chat/ChatTellMsg.java
  15. 8
      src/engine/net/client/msg/login/InvalidNameMsg.java
  16. 3
      src/engine/objects/City.java
  17. 8
      src/engine/objects/Guild.java
  18. 9
      src/engine/objects/PlayerCharacter.java
  19. 4
      src/engine/server/MBServerStatics.java
  20. 5
      src/engine/server/login/LoginServer.java
  21. 9
      src/engine/server/world/WorldServer.java

4
src/engine/db/handlers/dbGuildHandler.java

@ -13,7 +13,7 @@ import engine.Enum;
import engine.Enum.GuildHistoryType; import engine.Enum.GuildHistoryType;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -419,7 +419,7 @@ public class dbGuildHandler extends dbHandlerBase {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `guild_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { PreparedStatement preparedStatement = connection.prepareStatement("CALL `guild_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
preparedStatement.setLong(1, MBServerStatics.worldUUID); preparedStatement.setLong(1, WorldServer.worldUUID);
preparedStatement.setLong(2, g.getGuildLeaderUUID()); preparedStatement.setLong(2, g.getGuildLeaderUUID());
preparedStatement.setString(3, g.getName()); preparedStatement.setString(3, g.getName());
preparedStatement.setInt(4, guildTag.backgroundColor01); preparedStatement.setInt(4, guildTag.backgroundColor01);

6
src/engine/gameManager/ChatManager.java

@ -407,7 +407,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
chatGuildMsg.setSourceType(sender.getObjectType().ordinal()); chatGuildMsg.setSourceType(sender.getObjectType().ordinal());
chatGuildMsg.setSourceID(sender.getObjectUUID()); chatGuildMsg.setSourceID(sender.getObjectUUID());
chatGuildMsg.setSourceName(sender.getFirstName()); chatGuildMsg.setSourceName(sender.getFirstName());
chatGuildMsg.setUnknown03(MBServerStatics.worldMapID); // Server ID chatGuildMsg.setUnknown03(WorldServer.worldMapID); // Server ID
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild() chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
.getCharter() : 0); // Charter? .getCharter() : 0); // Charter?
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title? chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
@ -462,7 +462,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
chatICMsg.setSourceType(sender.getObjectType().ordinal()); chatICMsg.setSourceType(sender.getObjectType().ordinal());
chatICMsg.setSourceID(sender.getObjectUUID()); chatICMsg.setSourceID(sender.getObjectUUID());
chatICMsg.setSourceName(sender.getFirstName()); chatICMsg.setSourceName(sender.getFirstName());
chatICMsg.setUnknown02(MBServerStatics.worldMapID); // Server ID chatICMsg.setUnknown02(WorldServer.worldMapID); // Server ID
chatICMsg.setUnknown03(GuildStatusController.getRank(sender.getGuildStatus())); // correct? chatICMsg.setUnknown03(GuildStatusController.getRank(sender.getGuildStatus())); // correct?
chatICMsg.setUnknown04(GuildStatusController.getTitle(sender.getGuildStatus())); // correct? chatICMsg.setUnknown04(GuildStatusController.getTitle(sender.getGuildStatus())); // correct?
chatICMsg.setUnknown05(2); // unknown, seen 1 and 2 chatICMsg.setUnknown05(2); // unknown, seen 1 and 2
@ -524,7 +524,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
chatGroupMsg.setSourceType(sender.getObjectType().ordinal()); chatGroupMsg.setSourceType(sender.getObjectType().ordinal());
chatGroupMsg.setSourceID(sender.getObjectUUID()); chatGroupMsg.setSourceID(sender.getObjectUUID());
chatGroupMsg.setSourceName(sender.getFirstName()); chatGroupMsg.setSourceName(sender.getFirstName());
chatGroupMsg.setUnknown02(MBServerStatics.worldMapID); // Server ID chatGroupMsg.setUnknown02(WorldServer.worldMapID); // Server ID
// Send dispatch to each player // Send dispatch to each player

1
src/engine/gameManager/ConfigManager.java

@ -59,7 +59,6 @@ public enum ConfigManager {
MB_WORLD_MAPID, MB_WORLD_MAPID,
MB_WORLD_PORT, MB_WORLD_PORT,
MB_WORLD_ACCESS_LVL, MB_WORLD_ACCESS_LVL,
MB_WORLD_UUID,
MB_WORLD_WAREHOUSE_PUSH, MB_WORLD_WAREHOUSE_PUSH,
MB_WORLD_MAINTENANCE, MB_WORLD_MAINTENANCE,
MB_WORLD_GREETING, MB_WORLD_GREETING,

8
src/engine/net/client/handlers/BreakFealtyHandler.java

@ -24,7 +24,7 @@ import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.guild.BreakFealtyMsg; import engine.net.client.msg.guild.BreakFealtyMsg;
import engine.net.client.msg.guild.SendGuildEntryMsg; import engine.net.client.msg.guild.SendGuildEntryMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
import engine.session.Session; import engine.session.Session;
import java.util.ArrayList; import java.util.ArrayList;
@ -75,9 +75,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
} }
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(), WorldServer.worldUUID)) {
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(),MBServerStatics.worldUUID)) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return true; return true;
} }
@ -141,7 +139,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
return true; return true;
} }
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(),MBServerStatics.worldUUID)) { if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(), WorldServer.worldUUID)) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return true; return true;
} }

8
src/engine/net/client/handlers/DismissGuildHandler.java

@ -24,7 +24,7 @@ import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.guild.DismissGuildMsg; import engine.net.client.msg.guild.DismissGuildMsg;
import engine.net.client.msg.guild.SendGuildEntryMsg; import engine.net.client.msg.guild.SendGuildEntryMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
import engine.session.Session; import engine.session.Session;
import java.util.ArrayList; import java.util.ArrayList;
@ -86,8 +86,8 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
switch (toDismiss.getGuildState()) { switch (toDismiss.getGuildState()) {
case Sworn: case Sworn:
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), MBServerStatics.worldUUID)) { if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
return true; return true;
} }
nation.getSubGuildList().remove(toDismiss); nation.getSubGuildList().remove(toDismiss);
@ -97,7 +97,7 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
break; break;
case Province: case Province:
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(),MBServerStatics.worldUUID)) { if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
return true; return true;
} }

9
src/engine/net/client/handlers/RequestEnterWorldHandler.java

@ -18,6 +18,7 @@ import engine.objects.AbstractWorldObject;
import engine.objects.Account; import engine.objects.Account;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.server.world.WorldServer;
import engine.session.Session; import engine.session.Session;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -60,10 +61,10 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
Account acc = SessionManager.getAccount(origin); Account acc = SessionManager.getAccount(origin);
if (acc.status.ordinal() < MBServerStatics.worldAccessLevel.ordinal() || MBServerStatics.blockLogin) { if (acc.status.ordinal() < WorldServer.worldAccessLevel.ordinal() || MBServerStatics.blockLogin) {
origin.disconnect(); origin.disconnect();
return true; return true;
} }
// Brand new character. Send the city select screen // Brand new character. Send the city select screen

7
src/engine/net/client/msg/ServerInfoMsg.java

@ -17,6 +17,7 @@ import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.server.login.LoginServer; import engine.server.login.LoginServer;
import engine.server.world.WorldServer;
public class ServerInfoMsg extends ClientNetMsg { public class ServerInfoMsg extends ClientNetMsg {
@ -49,9 +50,9 @@ public class ServerInfoMsg extends ClientNetMsg {
// wsis.serializeForClientMsg(writer); // wsis.serializeForClientMsg(writer);
// } // }
writer.putInt(1); writer.putInt(1);
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
writer.putString(ConfigManager.MB_WORLD_NAME.getValue()); writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
if (LoginServer.population < MBServerStatics.LOW_POPULATION) if (LoginServer.population < MBServerStatics.LOW_POPULATION)
writer.putInt(0); //Land Rush writer.putInt(0); //Land Rush
else if (LoginServer.population < MBServerStatics.NORMAL_POPULATION) else if (LoginServer.population < MBServerStatics.NORMAL_POPULATION)

4
src/engine/net/client/msg/WorldDataMsg.java

@ -19,7 +19,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.Zone; import engine.objects.Zone;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
public class WorldDataMsg extends ClientNetMsg { public class WorldDataMsg extends ClientNetMsg {
@ -74,7 +74,7 @@ public class WorldDataMsg extends ClientNetMsg {
writer.putInt(512); writer.putInt(512);
writer.putInt(384); writer.putInt(384);
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
writer.putInt(0x00000000); writer.putInt(0x00000000);
writer.putInt(getTotalMapSize(root) + 1); writer.putInt(getTotalMapSize(root) + 1);

6
src/engine/net/client/msg/chat/ChatCSRMsg.java

@ -17,7 +17,7 @@ import engine.net.ByteBufferWriter;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
import engine.session.Session; import engine.session.Session;
public class ChatCSRMsg extends AbstractChatMsg { public class ChatCSRMsg extends AbstractChatMsg {
@ -71,8 +71,8 @@ public class ChatCSRMsg extends AbstractChatMsg {
writer.putInt(this.source.getObjectUUID()); writer.putInt(this.source.getObjectUUID());
writer.putInt(this.unknown01); writer.putInt(this.unknown01);
writer.putString(this.message); writer.putString(this.message);
writer.putString(this.source.getName()); writer.putString(this.source.getName());
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
} }
} }

6
src/engine/net/client/msg/chat/ChatCityMsg.java

@ -18,7 +18,7 @@ import engine.net.client.Protocol;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
public class ChatCityMsg extends AbstractChatMsg { public class ChatCityMsg extends AbstractChatMsg {
@ -80,8 +80,8 @@ public class ChatCityMsg extends AbstractChatMsg {
writer.putString(""); writer.putString("");
writer.putInt(0); writer.putInt(0);
} else { } else {
writer.putString(((AbstractCharacter) this.source).getFirstName()); writer.putString(((AbstractCharacter) this.source).getFirstName());
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
} }
} }

6
src/engine/net/client/msg/chat/ChatGlobalMsg.java

@ -16,7 +16,7 @@ import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
public class ChatGlobalMsg extends AbstractChatMsg { public class ChatGlobalMsg extends AbstractChatMsg {
@ -79,8 +79,8 @@ public class ChatGlobalMsg extends AbstractChatMsg {
writer.putString(""); writer.putString("");
writer.putInt(0); writer.putInt(0);
} else { } else {
writer.putString(((AbstractCharacter) this.source).getFirstName()); writer.putString(((AbstractCharacter) this.source).getFirstName());
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
} }
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);

6
src/engine/net/client/msg/chat/ChatSayMsg.java

@ -18,7 +18,7 @@ import engine.net.client.Protocol;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
public class ChatSayMsg extends AbstractChatMsg { public class ChatSayMsg extends AbstractChatMsg {
@ -84,8 +84,8 @@ public class ChatSayMsg extends AbstractChatMsg {
writer.putString(""); writer.putString("");
writer.putInt(0); writer.putInt(0);
} else { } else {
writer.putString(((AbstractCharacter) this.source).getFirstName()); writer.putString(((AbstractCharacter) this.source).getFirstName());
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
} }
} }
} }

6
src/engine/net/client/msg/chat/ChatShoutMsg.java

@ -16,7 +16,7 @@ import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
public class ChatShoutMsg extends AbstractChatMsg { public class ChatShoutMsg extends AbstractChatMsg {
@ -73,8 +73,8 @@ public class ChatShoutMsg extends AbstractChatMsg {
writer.putString(""); writer.putString("");
writer.putInt(0); writer.putInt(0);
} else { } else {
writer.putString(((AbstractCharacter) this.source).getFirstName()); writer.putString(((AbstractCharacter) this.source).getFirstName());
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
} }
} }
} }

28
src/engine/net/client/msg/chat/ChatTellMsg.java

@ -16,7 +16,7 @@ import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
public class ChatTellMsg extends AbstractChatMsg { public class ChatTellMsg extends AbstractChatMsg {
@ -106,19 +106,19 @@ public class ChatTellMsg extends AbstractChatMsg {
if (this.target != null) { if (this.target != null) {
writer.putInt(this.target.getObjectType().ordinal()); writer.putInt(this.target.getObjectType().ordinal());
writer.putInt(this.target.getObjectUUID()); writer.putInt(this.target.getObjectUUID());
if (AbstractWorldObject.IsAbstractCharacter(target)) { if (AbstractWorldObject.IsAbstractCharacter(target)) {
writer.putString(((AbstractCharacter) this.target).getFirstName()); writer.putString(((AbstractCharacter) this.target).getFirstName());
} else { } else {
writer.putString(this.target.getName()); writer.putString(this.target.getName());
} }
} else { } else {
writer.putInt(this.targetType); writer.putInt(this.targetType);
writer.putInt(this.targetID); writer.putInt(this.targetID);
writer.putString(this.targetName); writer.putString(this.targetName);
} }
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
} }
/** /**
* @return the target * @return the target

8
src/engine/net/client/msg/login/InvalidNameMsg.java

@ -15,7 +15,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.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
public class InvalidNameMsg extends ClientNetMsg { public class InvalidNameMsg extends ClientNetMsg {
@ -48,9 +48,9 @@ public class InvalidNameMsg extends ClientNetMsg {
@Override @Override
protected void _serialize(ByteBufferWriter writer) { protected void _serialize(ByteBufferWriter writer) {
writer.putString(this.FirstName); writer.putString(this.FirstName);
writer.putString(this.LastName); writer.putString(this.LastName);
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
writer.putInt(errorCode); writer.putInt(errorCode);
} }
/** /**

3
src/engine/objects/City.java

@ -30,6 +30,7 @@ import engine.net.client.msg.TaxResourcesMsg;
import engine.net.client.msg.ViewResourcesMessage; import engine.net.client.msg.ViewResourcesMessage;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.server.world.WorldServer;
import engine.workthreads.DestroyCityThread; import engine.workthreads.DestroyCityThread;
import engine.workthreads.TransferCityThread; import engine.workthreads.TransferCityThread;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -1125,7 +1126,7 @@ public class City extends AbstractWorldObject {
// claiming your new tree and set as Landed // claiming your new tree and set as Landed
if (!sourceNation.isEmptyGuild() && sourceNation != sourceGuild) { if (!sourceNation.isEmptyGuild() && sourceNation != sourceGuild) {
if (!DbManager.GuildQueries.UPDATE_PARENT(sourceGuild.getObjectUUID(), MBServerStatics.worldUUID)) { if (!DbManager.GuildQueries.UPDATE_PARENT(sourceGuild.getObjectUUID(), WorldServer.worldUUID)) {
ChatManager.chatGuildError((PlayerCharacter) sourcePlayer, "A Serious error has occurred. Please post details for to ensure transaction integrity"); ChatManager.chatGuildError((PlayerCharacter) sourcePlayer, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return; return;
} }

8
src/engine/objects/Guild.java

@ -31,7 +31,7 @@ import engine.net.client.msg.AllianceChangeMsg;
import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.UpdateClientAlliancesMsg; import engine.net.client.msg.UpdateClientAlliancesMsg;
import engine.net.client.msg.guild.GuildInfoMsg; import engine.net.client.msg.guild.GuildInfoMsg;
import engine.server.MBServerStatics; import engine.server.world.WorldServer;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -805,9 +805,9 @@ public class Guild extends AbstractWorldObject {
} }
if (MBServerStatics.worldUUID == nationUUID && this.cityUUID != 0) if (WorldServer.worldUUID == nationUUID && this.cityUUID != 0)
this.nation = this; this.nation = this;
else if (nationUUID == 0 || (MBServerStatics.worldUUID == nationUUID && this.cityUUID == 0)) { else if (nationUUID == 0 || (WorldServer.worldUUID == nationUUID && this.cityUUID == 0)) {
this.nation = Guild.getErrantGuild(); this.nation = Guild.getErrantGuild();
this.nmotd = ""; this.nmotd = "";
} else } else
@ -919,7 +919,7 @@ public class Guild extends AbstractWorldObject {
// Update database // Update database
if (!DbManager.GuildQueries.UPDATE_PARENT(subGuild.getObjectUUID(), MBServerStatics.worldUUID)) if (!DbManager.GuildQueries.UPDATE_PARENT(subGuild.getObjectUUID(), WorldServer.worldUUID))
Logger.debug("Failed to set Nation Guild for Guild with UID " + subGuild.getObjectUUID()); Logger.debug("Failed to set Nation Guild for Guild with UID " + subGuild.getObjectUUID());
// Guild without any subs is no longer a nation // Guild without any subs is no longer a nation

9
src/engine/objects/PlayerCharacter.java

@ -39,6 +39,7 @@ import engine.powers.EffectsBase;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.server.login.LoginServer; import engine.server.login.LoginServer;
import engine.server.login.LoginServerMsgHandler; import engine.server.login.LoginServerMsgHandler;
import engine.server.world.WorldServer;
import engine.util.MiscUtils; import engine.util.MiscUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -1995,7 +1996,7 @@ public class PlayerCharacter extends AbstractCharacter {
writer.putInt(0); writer.putInt(0);
writer.putString(ConfigManager.MB_WORLD_NAME.getValue()); writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
writer.putInt(MBServerStatics.worldMapID); writer.putInt(WorldServer.worldMapID);
writer.put((byte) 1); // End Datablock byte writer.put((byte) 1); // End Datablock byte
writer.putInt(0); // Unsure, Pad? writer.putInt(0); // Unsure, Pad?
@ -2315,9 +2316,9 @@ public class PlayerCharacter extends AbstractCharacter {
if (playerCharacter.account == null) if (playerCharacter.account == null)
serverUp = 0; serverUp = 0;
if ((playerCharacter.account.status.equals(AccountStatus.ADMIN) == false) && if ((playerCharacter.account.status.equals(AccountStatus.ADMIN) == false) &&
(playerCharacter.account.status.equals(MBServerStatics.worldAccessLevel) == false)) (playerCharacter.account.status.equals(WorldServer.worldAccessLevel) == false))
serverUp = 0; serverUp = 0;
writer.putInt(serverUp); writer.putInt(serverUp);
writer.putInt(0); // effects, not sure used by players writer.putInt(0); // effects, not sure used by players

4
src/engine/server/MBServerStatics.java

@ -10,7 +10,6 @@
package engine.server; package engine.server;
import engine.Enum; import engine.Enum;
import engine.gameManager.ConfigManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
public class MBServerStatics { public class MBServerStatics {
@ -794,7 +793,4 @@ public class MBServerStatics {
public static String VETERAN = "Veteran"; public static String VETERAN = "Veteran";
public static String ELITE = "Elite"; public static String ELITE = "Elite";
public static int worldMapID = Integer.parseInt(ConfigManager.MB_WORLD_MAPID.getValue());
public static int worldUUID = Integer.parseInt(ConfigManager.MB_WORLD_UUID.getValue());
public static Enum.AccountStatus worldAccessLevel = Enum.AccountStatus.valueOf(ConfigManager.MB_WORLD_ACCESS_LVL.getValue());
} }

5
src/engine/server/login/LoginServer.java

@ -21,6 +21,7 @@ import engine.net.client.msg.login.ServerStatusMsg;
import engine.net.client.msg.login.VersionInfoMsg; import engine.net.client.msg.login.VersionInfoMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.server.world.WorldServer;
import engine.util.ByteUtils; import engine.util.ByteUtils;
import engine.util.ThreadUtils; import engine.util.ThreadUtils;
import org.pmw.tinylog.Configurator; import org.pmw.tinylog.Configurator;
@ -326,10 +327,10 @@ public class LoginServer {
boolean isUp = isRunning; boolean isUp = isRunning;
if (MBServerStatics.worldAccessLevel.ordinal() > ac.status.ordinal()) if (WorldServer.worldAccessLevel.ordinal() > ac.status.ordinal())
isUp = false; isUp = false;
LoginServer.serverStatusMsg.setServerID(MBServerStatics.worldMapID); LoginServer.serverStatusMsg.setServerID(WorldServer.worldMapID);
LoginServer.serverStatusMsg.setIsUp(isUp ? (byte) 1 : (byte) 0); LoginServer.serverStatusMsg.setIsUp(isUp ? (byte) 1 : (byte) 0);
clientConnection.sendMsg(LoginServer.serverStatusMsg); clientConnection.sendMsg(LoginServer.serverStatusMsg);
} }

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

@ -68,6 +68,9 @@ 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 worldUUID = 1; // Root object in database
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();
public boolean isRunning = false; public boolean isRunning = false;
@ -428,7 +431,7 @@ public class WorldServer {
Logger.info("World data loaded."); Logger.info("World data loaded.");
//set default accesslevel for server *** Refactor who two separate variables? //set default accesslevel for server *** Refactor who two separate variables?
MBServerStatics.accessLevel = MBServerStatics.worldAccessLevel; MBServerStatics.accessLevel = worldAccessLevel;
Logger.info("Default access level set to " + MBServerStatics.accessLevel); Logger.info("Default access level set to " + MBServerStatics.accessLevel);
Logger.info("Initializing Network"); Logger.info("Initializing Network");
@ -495,10 +498,10 @@ public class WorldServer {
ArrayList<Zone> rootParent; ArrayList<Zone> rootParent;
rootParent = DbManager.ZoneQueries.GET_MAP_NODES(MBServerStatics.worldUUID); rootParent = DbManager.ZoneQueries.GET_MAP_NODES(worldUUID);
if (rootParent.isEmpty()) { if (rootParent.isEmpty()) {
Logger.error("populateWorldBuildings: No entries found in worldMap for parent " + MBServerStatics.worldUUID); Logger.error("populateWorldBuildings: No entries found in worldMap for parent " + worldUUID);
return; return;
} }

Loading…
Cancel
Save