source
Source for my MapleSolaxiaV2 (v83 MapleStory).
This commit is contained in:
41
src/net/server/handlers/CustomPacketHandler.java
Normal file
41
src/net/server/handlers/CustomPacketHandler.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
import client.MapleClient;
|
||||
import net.MaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public class CustomPacketHandler implements MaplePacketHandler {
|
||||
@Override
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if (slea.available() > 0 && c.getGMLevel() == 4) {//w/e
|
||||
c.announce(MaplePacketCreator.customPacket(slea.read((int) slea.available())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateState(MapleClient c) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
36
src/net/server/handlers/KeepAliveHandler.java
Normal file
36
src/net/server/handlers/KeepAliveHandler.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
import client.MapleClient;
|
||||
import net.MaplePacketHandler;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public class KeepAliveHandler implements MaplePacketHandler {
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
c.pongReceived();
|
||||
}
|
||||
|
||||
public boolean validateState(MapleClient c) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
41
src/net/server/handlers/LoginRequiringNoOpHandler.java
Normal file
41
src/net/server/handlers/LoginRequiringNoOpHandler.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
import client.MapleClient;
|
||||
import net.MaplePacketHandler;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class LoginRequiringNoOpHandler implements MaplePacketHandler {
|
||||
private static LoginRequiringNoOpHandler instance = new LoginRequiringNoOpHandler();
|
||||
|
||||
public static LoginRequiringNoOpHandler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
}
|
||||
|
||||
public boolean validateState(MapleClient c) {
|
||||
return c.isLoggedIn();
|
||||
}
|
||||
}
|
||||
31
src/net/server/handlers/login/AcceptToSHandler.java
Normal file
31
src/net/server/handlers/login/AcceptToSHandler.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import client.MapleClient;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public final class AcceptToSHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public boolean validateState(MapleClient c) {
|
||||
return !c.isLoggedIn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if (slea.available() == 0 || slea.readByte() != 1 || c.acceptToS()) {
|
||||
c.disconnect(false, false);//Client dc's but just because I am cool I do this (:
|
||||
return;
|
||||
}
|
||||
if (c.finishLogin() == 0) {
|
||||
c.announce(MaplePacketCreator.getAuthSuccess(c));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.getLoginFailed(9));//shouldn't happen XD
|
||||
}
|
||||
}
|
||||
}
|
||||
62
src/net/server/handlers/login/AfterLoginHandler.java
Normal file
62
src/net/server/handlers/login/AfterLoginHandler.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class AfterLoginHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
byte c2 = slea.readByte();
|
||||
byte c3 = 5;
|
||||
if (slea.available() > 0) {
|
||||
c3 = slea.readByte();
|
||||
}
|
||||
if (c2 == 1 && c3 == 1) {
|
||||
if (c.getPin() == null) {
|
||||
c.announce(MaplePacketCreator.registerPin());
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.requestPin());
|
||||
}
|
||||
} else if (c2 == 1 && c3 == 0) {
|
||||
String pin = slea.readMapleAsciiString();
|
||||
if (c.checkPin(pin)) {
|
||||
c.announce(MaplePacketCreator.pinAccepted());
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.requestPinAfterFailure());
|
||||
}
|
||||
} else if (c2 == 2 && c3 == 0) {
|
||||
String pin = slea.readMapleAsciiString();
|
||||
if (c.checkPin(pin)) {
|
||||
c.announce(MaplePacketCreator.registerPin());
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.requestPinAfterFailure());
|
||||
}
|
||||
} else if (c2 == 0 && c3 == 5) {
|
||||
c.updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
54
src/net/server/handlers/login/CharSelectedHandler.java
Normal file
54
src/net/server/handlers/login/CharSelectedHandler.java
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
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 java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class CharSelectedHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
int charId = slea.readInt();
|
||||
String macs = slea.readMapleAsciiString();
|
||||
c.updateMacs(macs);
|
||||
if (c.hasBannedMac()) {
|
||||
c.getSession().close(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c.getIdleTask() != null) {
|
||||
c.getIdleTask().cancel(true);
|
||||
}
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
String[] socket = Server.getInstance().getIP(c.getWorld(), c.getChannel()).split(":");
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
} catch (UnknownHostException | NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import client.MapleClient;
|
||||
|
||||
public class CharSelectedWithPicHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
|
||||
String pic = slea.readMapleAsciiString();
|
||||
int charId = slea.readInt();
|
||||
String macs = slea.readMapleAsciiString();
|
||||
String hwid = slea.readMapleAsciiString();
|
||||
c.updateMacs(macs);
|
||||
c.updateHWID(hwid);
|
||||
|
||||
if (c.hasBannedMac() || c.hasBannedHWID()) {
|
||||
c.getSession().close(true);
|
||||
return;
|
||||
}
|
||||
if (c.checkPic(pic)) {
|
||||
if (c.getIdleTask() != null) {
|
||||
c.getIdleTask().cancel(true);
|
||||
}
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
|
||||
String[] socket = Server.getInstance().getIP(c.getWorld(), c.getChannel()).split(":");
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
} catch (UnknownHostException | NumberFormatException e) {
|
||||
}
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.wrongPic());
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/net/server/handlers/login/CharlistRequestHandler.java
Normal file
38
src/net/server/handlers/login/CharlistRequestHandler.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class CharlistRequestHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
slea.readByte();
|
||||
int world = slea.readByte();
|
||||
c.setWorld(world);
|
||||
c.setChannel(slea.readByte() + 1);
|
||||
c.sendCharList(world);
|
||||
}
|
||||
}
|
||||
37
src/net/server/handlers/login/CheckCharNameHandler.java
Normal file
37
src/net/server/handlers/login/CheckCharNameHandler.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
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.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class CheckCharNameHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
String name = slea.readMapleAsciiString();
|
||||
c.announce(MaplePacketCreator.charNameResponse(name, !MapleCharacter.canCreateChar(name)));
|
||||
}
|
||||
}
|
||||
136
src/net/server/handlers/login/CreateCharHandler.java
Normal file
136
src/net/server/handlers/login/CreateCharHandler.java
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import server.MapleItemInformationProvider;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.MapleSkinColor;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
|
||||
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();
|
||||
if (!MapleCharacter.canCreateChar(name)) {
|
||||
return;
|
||||
}
|
||||
MapleCharacter newchar = MapleCharacter.getDefault(c);
|
||||
newchar.setWorld(c.getWorld());
|
||||
|
||||
int job = slea.readInt();
|
||||
int face = slea.readInt();
|
||||
|
||||
int hair = slea.readInt();
|
||||
int hairColor = slea.readInt();
|
||||
int skincolor = slea.readInt();
|
||||
|
||||
newchar.setSkinColor(MapleSkinColor.getById(skincolor));
|
||||
int top = slea.readInt();
|
||||
int bottom = slea.readInt();
|
||||
int shoes = slea.readInt();
|
||||
int weapon = slea.readInt();
|
||||
newchar.setGender(slea.readByte());
|
||||
newchar.setName(name);
|
||||
newchar.setHair(hair + hairColor);
|
||||
newchar.setFace(face);
|
||||
|
||||
int [] items = new int [] {weapon, top, bottom, shoes, hair, face};
|
||||
for (int i = 0; i < items.length; i++){
|
||||
if (!isLegal(items[i])) {
|
||||
AutobanFactory.PACKET_EDIT.alert(newchar, name + " tried to packet edit in character creation.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + newchar + ".txt", "Tried to packet edit in char creation.");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (job == 0) { // Knights of Cygnus
|
||||
newchar.setJob(MapleJob.NOBLESSE);
|
||||
newchar.setMapId(130030000);
|
||||
newchar.getInventory(MapleInventoryType.ETC).addItem(new Item(4161047, (short) 0, (short) 1));
|
||||
} else if (job == 1) { // Adventurer
|
||||
newchar.setJob(MapleJob.BEGINNER);
|
||||
newchar.setMapId(/*specialJobType == 2 ? 3000600 : */10000);
|
||||
newchar.getInventory(MapleInventoryType.ETC).addItem(new Item(4161001, (short) 0, (short) 1));
|
||||
} else if (job == 2) { // Aran
|
||||
newchar.setJob(MapleJob.LEGEND);
|
||||
newchar.setMapId(914000000);
|
||||
newchar.getInventory(MapleInventoryType.ETC).addItem(new Item(4161048, (short) 0, (short) 1));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.deleteCharResponse(0, 9));
|
||||
return;
|
||||
}
|
||||
|
||||
MapleInventory equipped = newchar.getInventory(MapleInventoryType.EQUIPPED);
|
||||
|
||||
Item eq_top = MapleItemInformationProvider.getInstance().getEquipById(top);
|
||||
eq_top.setPosition((byte) -5);
|
||||
equipped.addFromDB(eq_top);
|
||||
Item eq_bottom = MapleItemInformationProvider.getInstance().getEquipById(bottom);
|
||||
eq_bottom.setPosition((byte) -6);
|
||||
equipped.addFromDB(eq_bottom);
|
||||
Item eq_shoes = MapleItemInformationProvider.getInstance().getEquipById(shoes);
|
||||
eq_shoes.setPosition((byte) -7);
|
||||
equipped.addFromDB(eq_shoes);
|
||||
Item eq_weapon = MapleItemInformationProvider.getInstance().getEquipById(weapon);
|
||||
eq_weapon.setPosition((byte) -11);
|
||||
equipped.addFromDB(eq_weapon.copy());
|
||||
|
||||
if (!newchar.insertNewChar()) {
|
||||
c.announce(MaplePacketCreator.deleteCharResponse(0, 9));
|
||||
return;
|
||||
}
|
||||
c.announce(MaplePacketCreator.addNewCharEntry(newchar));
|
||||
Server.getInstance().broadcastGMMessage(MaplePacketCreator.sendYellowTip("[NEW CHAR]: " + c.getAccountName() + " has created a new character with IGN " + name));
|
||||
}
|
||||
}
|
||||
44
src/net/server/handlers/login/DeleteCharHandler.java
Normal file
44
src/net/server/handlers/login/DeleteCharHandler.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class DeleteCharHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
String pic = slea.readMapleAsciiString();
|
||||
int cid = slea.readInt();
|
||||
if (c.checkPic(pic)) {
|
||||
FilePrinter.printError(FilePrinter.DELETED_CHARACTERS + c.getAccountName() + ".txt", c.getAccountName() + " deleted CID: " + cid + "\r\n");
|
||||
c.announce(MaplePacketCreator.deleteCharResponse(cid, 0));
|
||||
c.deleteCharacter(cid);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.deleteCharResponse(cid, 0x14));
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/net/server/handlers/login/GuestLoginHandler.java
Normal file
40
src/net/server/handlers/login/GuestLoginHandler.java
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/*
|
||||
* @author David
|
||||
*/
|
||||
public final class GuestLoginHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
c.announce(MaplePacketCreator.sendGuestTOS());
|
||||
//System.out.println(slea.toString());
|
||||
new LoginPasswordHandler().handlePacket(slea, c);
|
||||
}
|
||||
}
|
||||
84
src/net/server/handlers/login/LoginPasswordHandler.java
Normal file
84
src/net/server/handlers/login/LoginPasswordHandler.java
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
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 java.util.Calendar;
|
||||
|
||||
import net.MaplePacketHandler;
|
||||
import server.TimerManager;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import client.MapleClient;
|
||||
|
||||
public final class LoginPasswordHandler implements MaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public boolean validateState(MapleClient c) {
|
||||
return !c.isLoggedIn();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
|
||||
String login = slea.readMapleAsciiString();
|
||||
String pwd = slea.readMapleAsciiString();
|
||||
c.setAccountName(login);
|
||||
|
||||
int loginok = c.login(login, pwd);
|
||||
|
||||
if (c.hasBannedIP() || c.hasBannedMac()) {
|
||||
c.announce(MaplePacketCreator.getLoginFailed(3));
|
||||
return;
|
||||
}
|
||||
Calendar tempban = c.getTempBanCalendar();
|
||||
if (tempban != null) {
|
||||
if (tempban.getTimeInMillis() > System.currentTimeMillis()) {
|
||||
c.announce(MaplePacketCreator.getTempBan(tempban.getTimeInMillis(), c.getGReason()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (loginok == 3) {
|
||||
c.announce(MaplePacketCreator.getPermBan(c.getGReason()));//crashes but idc :D
|
||||
return;
|
||||
} else if (loginok != 0) {
|
||||
c.announce(MaplePacketCreator.getLoginFailed(loginok));
|
||||
return;
|
||||
}
|
||||
if (c.finishLogin() == 0) {
|
||||
login(c);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.getLoginFailed(7));
|
||||
}
|
||||
}
|
||||
|
||||
private static void login(MapleClient c){
|
||||
c.announce(MaplePacketCreator.getAuthSuccess(c));//why the fk did I do c.getAccountName()?
|
||||
final MapleClient client = c;
|
||||
c.setIdleTask(TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
client.disconnect(false, false);
|
||||
}
|
||||
}, 600000));
|
||||
}
|
||||
}
|
||||
61
src/net/server/handlers/login/PickCharHandler.java
Normal file
61
src/net/server/handlers/login/PickCharHandler.java
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
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 java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Randomizer;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class PickCharHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
int charId = slea.readInt();
|
||||
int world = slea.readInt();//Wuuu? ):
|
||||
c.setWorld(world);
|
||||
String macs = slea.readMapleAsciiString();
|
||||
c.updateMacs(macs);
|
||||
if (c.hasBannedMac()) {
|
||||
c.getSession().close(true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
c.setChannel(Randomizer.nextInt(Server.getInstance().getWorld(world).getChannels().size()));
|
||||
} catch (Exception e) {
|
||||
c.setChannel(1);
|
||||
}
|
||||
if (c.getIdleTask() != null) {
|
||||
c.getIdleTask().cancel(true);
|
||||
}
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
String[] socket = Server.getInstance().getIP(c.getWorld(), c.getChannel()).split(":");
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
45
src/net/server/handlers/login/RegisterPicHandler.java
Normal file
45
src/net/server/handlers/login/RegisterPicHandler.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import client.MapleClient;
|
||||
|
||||
public final class RegisterPicHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
slea.readByte();
|
||||
int charId = slea.readInt();
|
||||
String macs = slea.readMapleAsciiString();
|
||||
String hwid = slea.readMapleAsciiString();
|
||||
|
||||
c.updateMacs(macs);
|
||||
c.updateHWID(hwid);
|
||||
|
||||
if (c.hasBannedMac() || c.hasBannedHWID()) {
|
||||
c.getSession().close(true);
|
||||
return;
|
||||
}
|
||||
|
||||
String pic = slea.readMapleAsciiString();
|
||||
if (c.getPic() == null || c.getPic().equals("")) {
|
||||
c.setPic(pic);
|
||||
if (c.getIdleTask() != null) {
|
||||
c.getIdleTask().cancel(true);
|
||||
}
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
String[] socket = Server.getInstance().getIP(c.getWorld(), c.getChannel()).split(":");
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
} else {
|
||||
c.getSession().close(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/net/server/handlers/login/RegisterPinHandler.java
Normal file
47
src/net/server/handlers/login/RegisterPinHandler.java
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/*
|
||||
* @author Rob
|
||||
*/
|
||||
public final class RegisterPinHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
byte c2 = slea.readByte();
|
||||
if (c2 == 0) {
|
||||
c.updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN);
|
||||
} else {
|
||||
String pin = slea.readMapleAsciiString();
|
||||
if (pin != null) {
|
||||
c.setPin(pin);
|
||||
c.announce(MaplePacketCreator.pinRegistered());
|
||||
c.updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
src/net/server/handlers/login/RelogRequestHandler.java
Normal file
39
src/net/server/handlers/login/RelogRequestHandler.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class RelogRequestHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public boolean validateState(MapleClient c) {
|
||||
return !c.isLoggedIn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
c.announce(MaplePacketCreator.getRelogResponse());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
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 constants.ServerConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class ServerStatusRequestHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
byte world = (byte) slea.readShort();//Wuuu? ):
|
||||
int status;
|
||||
int num = 0;
|
||||
for (Channel ch : Server.getInstance().getWorld(world).getChannels()) {
|
||||
num += ch.getConnectedClients();
|
||||
}
|
||||
if (num >= ServerConstants.CHANNEL_LOAD) {
|
||||
status = 2;
|
||||
} else if (num >= ServerConstants.CHANNEL_LOAD * .8) { // More than 80 percent o___o
|
||||
status = 1;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
c.announce(MaplePacketCreator.getServerStatus(status));
|
||||
}
|
||||
}
|
||||
44
src/net/server/handlers/login/ServerlistRequestHandler.java
Normal file
44
src/net/server/handlers/login/ServerlistRequestHandler.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
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 constants.ServerConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import net.server.world.World;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class ServerlistRequestHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
Server server = Server.getInstance();
|
||||
for (World world : server.getWorlds()) {
|
||||
c.announce(MaplePacketCreator.getServerList(world.getId(), ServerConstants.WORLD_NAMES[world.getId()], world.getFlag(), world.getEventMessage(), world.getChannels()));
|
||||
}
|
||||
c.announce(MaplePacketCreator.getEndOfServerList());
|
||||
c.announce(MaplePacketCreator.selectWorld(0));//too lazy to make a check lol
|
||||
c.announce(MaplePacketCreator.sendRecommended(server.worldRecommendedList()));
|
||||
}
|
||||
}
|
||||
52
src/net/server/handlers/login/SetGenderHandler.java
Normal file
52
src/net/server/handlers/login/SetGenderHandler.java
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
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 net.AbstractMaplePacketHandler;
|
||||
import server.TimerManager;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public class SetGenderHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
byte type = slea.readByte(); //?
|
||||
if (type == 0x01 && c.getGender() == 10) { //Packet shouldn't come if Gender isn't 10.
|
||||
c.setGender(slea.readByte());
|
||||
c.announce(MaplePacketCreator.getAuthSuccess(c));
|
||||
final MapleClient client = c;
|
||||
c.setIdleTask(TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
client.getSession().close(true);
|
||||
}
|
||||
}, 600000));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Randomizer;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import client.MapleClient;
|
||||
|
||||
public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
|
||||
String pic = slea.readMapleAsciiString();
|
||||
int charId = slea.readInt();
|
||||
int world = slea.readInt();//world
|
||||
c.setWorld(world);
|
||||
int channel = Randomizer.rand(0, Server.getInstance().getWorld(world).getChannels().size());
|
||||
c.setChannel(channel);
|
||||
String macs = slea.readMapleAsciiString();
|
||||
c.updateMacs(macs);
|
||||
|
||||
if (c.hasBannedMac()) {
|
||||
c.getSession().close(true);
|
||||
return;
|
||||
}
|
||||
if (c.checkPic(pic)) {
|
||||
if (c.getIdleTask() != null) {
|
||||
c.getIdleTask().cancel(true);
|
||||
}
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
|
||||
String[] socket = Server.getInstance().getIP(c.getWorld(), c.getChannel()).split(":");
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.wrongPic());
|
||||
}
|
||||
}
|
||||
}
|
||||
41
src/net/server/handlers/login/ViewAllPicRegisterHandler.java
Normal file
41
src/net/server/handlers/login/ViewAllPicRegisterHandler.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import client.MapleClient;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Randomizer;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class ViewAllPicRegisterHandler extends AbstractMaplePacketHandler { //Gey class name lol
|
||||
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
slea.readByte();
|
||||
int charId = slea.readInt();
|
||||
c.setWorld(slea.readInt()); //world
|
||||
int channel = Randomizer.rand(0, Server.getInstance().getWorld(c.getWorld()).getChannels().size());
|
||||
c.setChannel(channel);
|
||||
String mac = slea.readMapleAsciiString();
|
||||
c.updateMacs(mac);
|
||||
if (c.hasBannedMac()) {
|
||||
c.getSession().close(true);
|
||||
return;
|
||||
}
|
||||
slea.readMapleAsciiString();
|
||||
String pic = slea.readMapleAsciiString();
|
||||
c.setPic(pic);
|
||||
if (c.getIdleTask() != null) {
|
||||
c.getIdleTask().cancel(true);
|
||||
}
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
String[] socket = Server.getInstance().getIP(c.getWorld(), channel).split(":");
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
81
src/net/server/handlers/login/ViewCharHandler.java
Normal file
81
src/net/server/handlers/login/ViewCharHandler.java
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
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.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public final class ViewCharHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
try {
|
||||
short charsNum;
|
||||
List<Integer> worlds;
|
||||
List<MapleCharacter> chars;
|
||||
try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT world, id FROM characters WHERE accountid = ?")) {
|
||||
ps.setInt(1, c.getAccID());
|
||||
charsNum = 0;
|
||||
worlds = new ArrayList<>();
|
||||
chars = new ArrayList<>();
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
int cworld = rs.getByte("world");
|
||||
boolean inside = false;
|
||||
for (int w : worlds) {
|
||||
if (w == cworld) {
|
||||
inside = true;
|
||||
}
|
||||
}
|
||||
if (!inside) {
|
||||
worlds.add(cworld);
|
||||
}
|
||||
MapleCharacter chr = MapleCharacter.loadCharFromDB(rs.getInt("id"), c, false);
|
||||
chars.add(chr);
|
||||
charsNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
int unk = charsNum + 3 - charsNum % 3;
|
||||
c.announce(MaplePacketCreator.showAllCharacter(charsNum, unk));
|
||||
for (Iterator<Integer> it = worlds.iterator(); it.hasNext();) {
|
||||
int w = it.next();
|
||||
List<MapleCharacter> chrsinworld = new ArrayList<>();
|
||||
for (MapleCharacter chr : chars) {
|
||||
if (chr.getWorld() == w) {
|
||||
chrsinworld.add(chr);
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.showAllCharacterInfo(w, chrsinworld));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user