Files
sweetgum-server/src/net/server/handlers/login/CreateCharHandler.java
ronancpl f439c158e2 Login Purification + Optimized currenttime calls + Standardized WZ
Repelled ultimately the game-breaking issue that was introduced recently on the revamp of the login phase.
Optimized the getcurrenttime calls to the OS. Made most of the handler calls fetch directly from the Server object instead, the Server itself delegated with periodically updating the current time value. The result is an slightly delayed currenttime, backed with realtime value update within minutes.
Protected concurrently inventory sort handlers. Expected no more NullPointers from the sorting feature.
Added a server flag to limit cash items being sold on player shops/hired merchants.
Stabilized the MapleTV mechanics, and activities properly split by world.
Normalized Character.wz: equipments supposed to have the "cash" property now implements it.
Normalized String.wz: every item that doesn't have a "name" property now implements it.
Normalized the XMLs that lost indentation on the last source update.
New tool: MapleInvalidItemWithNoNameFetcher. Fetches and reports itemids throughout the XMLs that doesn't contain the "name" property and equipments that lacks "cash" property.

Frolic Omniknight references aside, if you have run into any more issues regarding the new login system, please open an issue and show the steps you've done to reach the problem.
2018-07-18 13:00:53 -03:00

94 lines
3.5 KiB
Java

/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.handlers.login;
import client.MapleClient;
import client.creator.novice.*;
import net.AbstractMaplePacketHandler;
import tools.FilePrinter;
import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor;
public final class CreateCharHandler extends AbstractMaplePacketHandler {
private static int[] IDs = {
1302000, 1312004, 1322005, 1442079,// weapons
1040002, 1040006, 1040010, 1041002, 1041006, 1041010, 1041011, 1042167,// bottom
1060002, 1060006, 1061002, 1061008, 1062115, // top
1072001, 1072005, 1072037, 1072038, 1072383,// shoes
30000, 30010,30020, 30030, 31000, 31040, 31050,// hair
20000, 20001, 20002, 21000, 21001, 21002, 21201, 20401, 20402, 21700, 20100 //face
//#NeverTrustStevenCode
};
private static boolean isLegal(int toCompare) {
for (int i = 0; i < IDs.length; i++) {
if (IDs[i] == toCompare) {
return true;
}
}
return false;
}
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
String name = slea.readMapleAsciiString();
int job = slea.readInt();
int face = slea.readInt();
int hair = slea.readInt();
int haircolor = slea.readInt();
int skincolor = slea.readInt();
int top = slea.readInt();
int bottom = slea.readInt();
int shoes = slea.readInt();
int weapon = slea.readInt();
int gender = slea.readByte();
int [] items = new int [] {weapon, top, bottom, shoes, hair, face};
for (int i = 0; i < items.length; i++){
if (!isLegal(items[i])) {
FilePrinter.printError(FilePrinter.EXPLOITS + name + ".txt", "Owner from account '" + c.getAccountName() + "' tried to packet edit in char creation.");
c.disconnect(true, false);
return;
}
}
int status;
if (job == 0) { // Knights of Cygnus
status = NoblesseCreator.createCharacter(c, name, face, hair + haircolor, skincolor, top, bottom, shoes, weapon, gender);
} else if (job == 1) { // Adventurer
status = BeginnerCreator.createCharacter(c, name, face, hair + haircolor, skincolor, top, bottom, shoes, weapon, gender);
} else if (job == 2) { // Aran
status = LegendCreator.createCharacter(c, name, face, hair + haircolor, skincolor, top, bottom, shoes, weapon, gender);
} else {
c.announce(MaplePacketCreator.deleteCharResponse(0, 9));
return;
}
if (status == -2) {
c.announce(MaplePacketCreator.deleteCharResponse(0, 9));
}
}
}