Browse Source

Handler created for deletecharmsg

combat-2
MagicBot 8 months ago
parent
commit
7911a17f0c
  1. 59
      src/engine/server/login/LoginServerMsgHandler.java

59
src/engine/server/login/LoginServerMsgHandler.java

@ -23,7 +23,6 @@ import engine.net.client.Protocol; @@ -23,7 +23,6 @@ import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.login.*;
import engine.objects.Account;
import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
import engine.session.CSSession;
@ -72,9 +71,6 @@ public class LoginServerMsgHandler implements NetMsgHandler { @@ -72,9 +71,6 @@ public class LoginServerMsgHandler implements NetMsgHandler {
try {
switch (protocolMsg) {
case REMOVECHAR:
this.DeleteCharacter((DeleteCharacterMsg) clientNetMsg, origin);
break;
case SELECTCHAR:
this.RequestGameServer((GameServerIPRequestMsg) clientNetMsg, origin);
@ -133,61 +129,6 @@ public class LoginServerMsgHandler implements NetMsgHandler { @@ -133,61 +129,6 @@ public class LoginServerMsgHandler implements NetMsgHandler {
}
}
private void DeleteCharacter(DeleteCharacterMsg msg, ClientConnection origin) {
try {
PlayerCharacter playerCharacter;
Session session;
session = SessionManager.getSession(origin);
playerCharacter = PlayerCharacter.getPlayerCharacter(msg.getCharacterUUID());
if (playerCharacter == null) {
Logger.error("Delete Error: PlayerID=" + msg.getCharacterUUID() + " not found.");
this.sendCharacterSelectScreen(session);
return;
}
if (session.getAccount() == null) {
Logger.error("Delete Error: Account not found.");
this.sendCharacterSelectScreen(session);
return;
}
if (playerCharacter.getAccount().equals(session.getAccount()) == false) {
Logger.error("Delete Error: Character " + playerCharacter.getName() + " does not belong to account " + origin.getAccount().getUname());
this.sendCharacterSelectScreen(session);
return;
}
//Can't delete as Guild Leader
//TODO either find an error or just gdisband.
if (GuildStatusController.isGuildLeader(playerCharacter.getGuildStatus())) {
this.KickToLogin(MBServerStatics.LOGINERROR_UNABLE_TO_LOGIN, "Cannot delete a guild leader.", origin);
return;
}
// check for active banes
if (LoginServer.getActiveBaneQuery(playerCharacter)) {
Logger.info("Character " + playerCharacter.getName() + " has unresolved bane");
this.KickToLogin(MBServerStatics.LOGINERROR_UNABLE_TO_LOGIN, "Player has unresolved bane.", origin);
return;
}
playerCharacter.getAccount().characterMap.remove(playerCharacter.getObjectUUID());
playerCharacter.deactivateCharacter();
// TODO Delete Equipment
// Resend Character Select Screen.
this.sendCharacterSelectScreen(session);
} catch (Exception e) {
Logger.error(e);
}
}
private void RequestGameServer(GameServerIPRequestMsg gameServerIPRequestMessage, ClientConnection conn) {
Session session;

Loading…
Cancel
Save