|
|
@ -30,6 +30,7 @@ import engine.server.MBServerStatics; |
|
|
|
import engine.session.CSSession; |
|
|
|
import engine.session.CSSession; |
|
|
|
import engine.session.Session; |
|
|
|
import engine.session.Session; |
|
|
|
import engine.util.ByteUtils; |
|
|
|
import engine.util.ByteUtils; |
|
|
|
|
|
|
|
import engine.util.MiscUtils; |
|
|
|
import engine.util.StringUtils; |
|
|
|
import engine.util.StringUtils; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
@ -343,12 +344,40 @@ public class LoginServerMsgHandler implements NetMsgHandler { |
|
|
|
this.sendCharacterSelectScreen(session); |
|
|
|
this.sendCharacterSelectScreen(session); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String firstName = commitNewCharacterMessage.getFirstName().trim(); |
|
|
|
|
|
|
|
String lastName = commitNewCharacterMessage.getLastName().trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (firstName.length() < 3) { |
|
|
|
|
|
|
|
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_FIRSTNAME_MUST_BE_LONGER, |
|
|
|
|
|
|
|
clientConnection); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure names are below required length
|
|
|
|
|
|
|
|
if (firstName.length() > 15 || lastName.length() > 15) { |
|
|
|
|
|
|
|
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_FIRSTANDLAST_MUST_BE_SHORTER, |
|
|
|
|
|
|
|
clientConnection); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if firstname is valid
|
|
|
|
|
|
|
|
if (MiscUtils.checkIfFirstNameInvalid(firstName)) { |
|
|
|
|
|
|
|
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_PLEASE_CHOOSE_ANOTHER_FIRSTNAME, |
|
|
|
|
|
|
|
clientConnection); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if last name is valid
|
|
|
|
|
|
|
|
if (MiscUtils.checkIfLastNameInvalid(lastName)) { |
|
|
|
|
|
|
|
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_LASTNAME_UNAVAILABLE, |
|
|
|
|
|
|
|
clientConnection); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
PlayerCharacter pc = PlayerCharacter.generatePCFromCommitNewCharacterMsg(session.getAccount(), commitNewCharacterMessage, clientConnection); |
|
|
|
PlayerCharacter pc = PlayerCharacter.generatePCFromCommitNewCharacterMsg(session.getAccount(), commitNewCharacterMessage, clientConnection); |
|
|
|
|
|
|
|
|
|
|
|
if (pc == null) { |
|
|
|
if (pc == null) { |
|
|
|
Logger.info("Player returned null while creating character."); |
|
|
|
Logger.info("Player returned null while creating character."); |
|
|
|
//this.sendCharacterSelectScreen(session, true);
|
|
|
|
this.sendCharacterSelectScreen(session, true); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
PlayerCharacter.initializePlayer(pc); |
|
|
|
PlayerCharacter.initializePlayer(pc); |
|
|
|