PlayerNPC patch + Wedding ring effects + Bypassable PIN/PIC + SP cap

Fixed an issue with delayed item pickups.
Fixed ClearSlot command not removing rechargeables from inventory.
Fixed Resurrection and Hyper Body animation effect not working for other players.
Implemented bypassable PIN/PIC, applied on accounts after a successful authentication, remaining active while activity is detected for that account.
Fixed anti-multiclient system not properly registering players logged in via all-chars-view.
Fixed cases where players still could gain EXP from much higher-leveled mobs if they were on an event instance.
Optimized scroll result method performance.
Added a server flag for SP cap limit on the player's current job (missing amount are reobtained after changing jobs).
PlayerNPCs now have overridable scripts.
Fixed some mapobject issues with PlayerNPCs, potencially leading to disappearing from maps in certain circumstances.
Fixed SpawnAllPnpcs command not properly spawning all PlayersNPCs.
Added extra info on Abdula, now stating whether a book can be obtained from questline or not.
Fixed marriage ring effects.
Fixed some cases where marriage rings were being able to be sent out from the character owner.
Fixed Duey allowing send untradeable items.
New tool: MapleWorldmapChecker. It reads Map.wz XMLs, fetching mapids not properly referenced on the worldmap nodes.
This commit is contained in:
ronancpl
2018-10-25 07:09:35 -03:00
parent 17d3ffe1c3
commit 8f8cd815aa
87 changed files with 2040 additions and 271 deletions

View File

@@ -86,6 +86,7 @@ import constants.ItemConstants;
import constants.GameConstants;
import constants.ServerConstants;
import server.CashShop.CashItemFactory;
import server.MapleSkillbookInformationProvider;
import server.TimerManager;
import server.life.MaplePlayerNPCFactory;
import server.quest.MapleQuest;
@@ -329,7 +330,7 @@ public class Server {
if(p == null) {
return -1;
}
channelid++;
World world = this.getWorld(worldid);
Channel channel = new Channel(worldid, channelid, getCurrentTime());
@@ -923,6 +924,8 @@ public class Server {
System.out.println("HeavenMS is now online.\r\n");
online = true;
MapleSkillbookInformationProvider.getInstance();
}
public static void main(String args[]) {
@@ -1485,23 +1488,44 @@ public class Server {
return new Pair<>(characterCount, wchars);
}
public void loadAccountCharacters(MapleClient c) {
Integer accId = c.getAccID();
boolean firstAccountLogin;
public void loadAllAccountsCharactersView() {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id FROM accounts");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int accountId = rs.getInt("id");
if (isFirstAccountLogin(accountId)) {
loadAccountCharactersView(accountId, 0, 0);
}
}
rs.close();
ps.close();
con.close();
} catch (SQLException se) {
se.printStackTrace();
}
}
private boolean isFirstAccountLogin(Integer accId) {
lgnRLock.lock();
try {
firstAccountLogin = !accountChars.containsKey(accId);
return !accountChars.containsKey(accId);
} finally {
lgnRLock.unlock();
}
if(!firstAccountLogin) {
}
public void loadAccountCharacters(MapleClient c) {
Integer accId = c.getAccID();
if (!isFirstAccountLogin(accId)) {
Set<Integer> accWorlds = new HashSet<>();
lgnRLock.lock();
try {
for(Integer chrid : getAccountCharacterEntries(accId)) {
for (Integer chrid : getAccountCharacterEntries(accId)) {
accWorlds.add(worldChars.get(chrid));
}
} finally {
@@ -1509,12 +1533,12 @@ public class Server {
}
int gmLevel = 0;
for(Integer aw : accWorlds) {
for (Integer aw : accWorlds) {
World wserv = this.getWorld(aw);
if (wserv != null) {
for(MapleCharacter chr : wserv.getAllCharactersView()) {
if(gmLevel < chr.gmLevel()) gmLevel = chr.gmLevel();
for (MapleCharacter chr : wserv.getAllCharactersView()) {
if (gmLevel < chr.gmLevel()) gmLevel = chr.gmLevel();
}
}
}
@@ -1541,14 +1565,14 @@ public class Server {
chars = new HashSet<>(5);
}
for(int wid = fromWorldid; wid < wlist.size(); wid++) {
for (int wid = fromWorldid; wid < wlist.size(); wid++) {
World w = wlist.get(wid);
List<MapleCharacter> wchars = accChars.get(wid);
w.loadAccountCharactersView(accId, wchars);
for(MapleCharacter chr : wchars) {
for (MapleCharacter chr : wchars) {
int cid = chr.getId();
if(gmLevel < chr.gmLevel()) gmLevel = chr.gmLevel();
if (gmLevel < chr.gmLevel()) gmLevel = chr.gmLevel();
chars.add(cid);
worldChars.put(cid, wid);

View File

@@ -243,10 +243,14 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
if (item == null) {
c.enableCSActions();
return;
} else if(c.getPlayer().getPetIndex(item.getPetId()) > -1) {
} else if (c.getPlayer().getPetIndex(item.getPetId()) > -1) {
chr.getClient().announce(MaplePacketCreator.serverNotice(1, "You cannot put the pet you currently equip into the Cash Shop inventory."));
c.enableCSActions();
return;
} else if (ItemConstants.isWeddingRing(item.getItemId()) || ItemConstants.isWeddingToken(item.getItemId())) {
chr.getClient().announce(MaplePacketCreator.serverNotice(1, "You cannot put relationship items into the Cash Shop inventory."));
c.enableCSActions();
return;
}
cs.addToInventory(item);
mi.removeSlot(item.getPosition());

View File

@@ -47,9 +47,8 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
return true;
}
private void respawnPlayer(MapleCharacter mc) {
mc.getMap().broadcastMessage(mc, MaplePacketCreator.removePlayerFromMap(mc.getId()), false);
mc.getMap().broadcastMessage(mc, MaplePacketCreator.spawnPlayerMapObject(mc), false);
private void restancePlayer(MapleCharacter mc) {
mc.broadcastStance();
}
private class Invited {
@@ -132,7 +131,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.showGuildInfo(mc));
c.getPlayer().dropMessage(1, "You have successfully created a Guild.");
respawnPlayer(mc);
restancePlayer(mc);
break;
case 0x05:
if (mc.getGuildId() <= 0 || mc.getGuildRank() > 2) {
@@ -192,7 +191,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
if(allianceId > 0) Server.getInstance().getAlliance(allianceId).updateAlliancePackets(mc);
mc.saveGuildStatus(); // update database
respawnPlayer(mc);
restancePlayer(mc);
break;
case 0x07:
allianceId = mc.getGuild().getAllianceId();
@@ -211,7 +210,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
mc.getMGC().setGuildId(0);
mc.saveGuildStatus();
respawnPlayer(mc);
restancePlayer(mc);
break;
case 0x08:
allianceId = mc.getGuild().getAllianceId();
@@ -271,7 +270,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
}
mc.gainMeso(-ServerConstants.CHANGE_EMBLEM_COST, true, false, true);
respawnPlayer(mc);
restancePlayer(mc);
break;
case 0x10:
if (mc.getGuildId() <= 0 || mc.getGuildRank() > 2) {

View File

@@ -80,11 +80,12 @@ public final class NPCTalkHandler extends AbstractMaplePacketHandler {
}
} else if (obj instanceof MaplePlayerNPC) {
MaplePlayerNPC pnpc = (MaplePlayerNPC) obj;
NPCScriptManager nsm = NPCScriptManager.getInstance();
if(pnpc.getScriptId() < 9977777) {
NPCScriptManager.getInstance().start(c, pnpc.getScriptId(), "rank_user", null);
if (pnpc.getScriptId() < 9977777 && !nsm.isNpcScriptAvailable(c, "" + pnpc.getScriptId())) {
nsm.start(c, pnpc.getScriptId(), "rank_user", null);
} else {
NPCScriptManager.getInstance().start(c, pnpc.getScriptId(), null);
nsm.start(c, pnpc.getScriptId(), null);
}
}
}

View File

@@ -29,6 +29,8 @@ import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor;
public final class PetChatHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
int petId = slea.readInt();
slea.readInt();

View File

@@ -83,22 +83,19 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
final Server server = Server.getInstance();
MapleCharacter player = c.getWorldServer().getPlayerStorage().getCharacterById(cid);
boolean newcomer = false;
IoSession session = c.getSession();
String remoteHwid;
if (player == null) {
IoSession session = c.getSession();
if (!server.validateCharacteridInTransition((InetSocketAddress) session.getRemoteAddress(), cid)) {
c.disconnect(true, false);
return;
}
if (ServerConstants.DETERRED_MULTICLIENT) {
String remoteHwid = MapleSessionCoordinator.getInstance().getGameSessionHwid(session);
if (remoteHwid == null) {
c.disconnect(true, false);
return;
}
session.setAttribute(MapleClient.CLIENT_HWID, remoteHwid);
remoteHwid = MapleSessionCoordinator.getInstance().getGameSessionHwid(session);
if (remoteHwid == null) {
c.disconnect(true, false);
return;
}
try {
@@ -108,6 +105,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
e.printStackTrace();
}
} else {
remoteHwid = player.getClient().getHWID();
c.setCharacterSlots((byte) player.getClient().getCharacterSlots());
player.newClient(c);
}
@@ -116,6 +114,11 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
return;
}
int hwidLen = remoteHwid.length();
session.setAttribute(MapleClient.CLIENT_HWID, remoteHwid);
session.setAttribute(MapleClient.CLIENT_NIBBLEHWID, remoteHwid.substring(hwidLen - 8, hwidLen));
c.setHWID(remoteHwid);
c.setPlayer(player);
c.setAccID(player.getAccountID());

View File

@@ -36,7 +36,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
*/
public final class QuestActionHandler extends AbstractMaplePacketHandler {
// credits to gabriel.sin
// isNpcNearby credits to gabriel.sin
private static boolean isNpcNearby(SeekableLittleEndianAccessor slea, MapleCharacter player, MapleQuest quest, int npcId) {
Point playerP = null;

View File

@@ -107,8 +107,16 @@ public final class RingActionHandler extends AbstractMaplePacketHandler {
source.dropMessage(1, "The player is already engaged!");
source.announce(Wedding.OnMarriageResult((byte) 0));
return;
} else if (target.getGender() != 1) {
source.dropMessage(1, "You may only propose to a girl!");
} else if (target.haveWeddingRing()) {
source.dropMessage(1, "The player already holds a marriage ring...");
source.announce(Wedding.OnMarriageResult((byte) 0));
return;
} else if (source.haveWeddingRing()) {
source.dropMessage(1, "You can't propose while holding a marriage ring!");
source.announce(Wedding.OnMarriageResult((byte) 0));
return;
} else if (target.getGender() == source.getGender()) {
source.dropMessage(1, "You may only propose to a " + (source.getGender() == 1 ? "male" : "female") + "!");
source.announce(Wedding.OnMarriageResult((byte) 0));
return;
} else if (!MapleInventoryManipulator.checkSpace(c, newBoxId, 1, "")) {

View File

@@ -0,0 +1,114 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2018 RonanLana
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.coordinator;
import constants.ServerConstants;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import client.MapleCharacter;
import client.MapleClient;
import net.server.world.World;
import net.server.Server;
import tools.Pair;
/**
*
* @author Ronan
*/
public class MapleLoginBypassCoordinator {
private final static MapleLoginBypassCoordinator instance = new MapleLoginBypassCoordinator();
public static MapleLoginBypassCoordinator getInstance() {
return instance;
}
private final ConcurrentHashMap<Pair<String, Integer>, Pair<Boolean, Long>> loginBypass = new ConcurrentHashMap<>(); // optimized PIN & PIC check
public boolean canLoginBypass(String nibbleHwid, int accId, boolean pic) {
try {
Pair<String, Integer> entry = new Pair<>(nibbleHwid, accId);
Boolean p = loginBypass.get(entry).getLeft();
return !pic || p;
} catch (NullPointerException npe) {
return false;
}
}
public void registerLoginBypassEntry(String nibbleHwid, int accId, boolean pic) {
long expireTime = (pic ? ServerConstants.BYPASS_PIC_EXPIRATION : ServerConstants.BYPASS_PIN_EXPIRATION);
if (expireTime > 0) {
Pair<String, Integer> entry = new Pair<>(nibbleHwid, accId);
expireTime = Server.getInstance().getCurrentTime() + expireTime * 60 * 1000;
try {
pic |= loginBypass.get(entry).getLeft();
expireTime = Math.max(loginBypass.get(entry).getRight(), expireTime);
} catch (NullPointerException npe) {}
loginBypass.put(entry, new Pair<>(pic, expireTime));
}
}
public void unregisterLoginBypassEntry(String nibbleHwid, int accId) {
Pair<String, Integer> entry = new Pair<>(nibbleHwid, accId);
loginBypass.remove(entry);
}
public void runUpdateLoginBypass() {
if (!loginBypass.isEmpty()) {
List<Pair<String, Integer>> toRemove = new LinkedList<>();
Set<Integer> onlineAccounts = new HashSet<>();
long timeNow = Server.getInstance().getCurrentTime();
for (World w : Server.getInstance().getWorlds()) {
for (MapleCharacter chr : w.getPlayerStorage().getAllCharacters()) {
MapleClient c = chr.getClient();
if (c != null) {
onlineAccounts.add(c.getAccID());
}
}
}
for (Entry<Pair<String, Integer>, Pair<Boolean, Long>> e : loginBypass.entrySet()) {
if (onlineAccounts.contains(e.getKey().getRight())) {
long expireTime = timeNow + 2 * 60 * 1000;
if (expireTime > e.getValue().getRight()) {
loginBypass.replace(e.getKey(), new Pair<>(e.getValue().getLeft(), expireTime));
}
} else if (e.getValue().getRight() < timeNow) {
toRemove.add(e.getKey());
}
}
if (!toRemove.isEmpty()) {
for (Pair<String, Integer> p : toRemove) {
loginBypass.remove(p);
}
}
}
}
}

View File

@@ -290,17 +290,20 @@ public class MapleSessionCoordinator {
lrh.remove(session);
if (lrh.isEmpty()) {
loginRemoteHosts.remove(remoteIp);
String nibbleHwid = (String) session.removeAttribute(MapleClient.CLIENT_NIBBLEHWID);
if (nibbleHwid != null) {
onlineRemoteHwids.remove(nibbleHwid);
}
}
}
String nibbleHwid = (String) session.removeAttribute(MapleClient.CLIENT_NIBBLEHWID);
if (nibbleHwid != null) {
onlineRemoteHwids.remove(nibbleHwid);
}
}
public AntiMulticlientResult attemptLoginSession(IoSession session, String nibbleHwid, int accountId, boolean routineCheck) {
if (!ServerConstants.DETERRED_MULTICLIENT) return AntiMulticlientResult.SUCCESS;
if (!ServerConstants.DETERRED_MULTICLIENT) {
session.setAttribute(MapleClient.CLIENT_NIBBLEHWID, nibbleHwid);
return AntiMulticlientResult.SUCCESS;
}
String remoteHost = getRemoteIp(session);
Lock lock = getCoodinatorLock(remoteHost);
@@ -368,11 +371,13 @@ public class MapleSessionCoordinator {
}
public AntiMulticlientResult attemptGameSession(IoSession session, int accountId, String remoteHwid) {
if (!ServerConstants.DETERRED_MULTICLIENT) return AntiMulticlientResult.SUCCESS;
String remoteHost = getRemoteIp(session);
Lock lock = getCoodinatorLock(remoteHost);
if (!ServerConstants.DETERRED_MULTICLIENT) {
associateRemoteHostHwid(remoteHost, remoteHwid);
return AntiMulticlientResult.SUCCESS;
}
Lock lock = getCoodinatorLock(remoteHost);
try {
int tries = 0;
while (true) {
@@ -413,10 +418,7 @@ public class MapleSessionCoordinator {
// updated session CLIENT_HWID attribute will be set when the player log in the game
onlineRemoteHwids.add(remoteHwid);
cachedHostHwids.put(remoteHost, remoteHwid);
cachedHostTimeout.put(remoteHost, Server.getInstance().getCurrentTime() + 604800000); // 1 week-time entry
associateRemoteHostHwid(remoteHost, remoteHwid);
associateHwidAccountIfAbsent(remoteHwid, accountId);
return AntiMulticlientResult.SUCCESS;
@@ -456,6 +458,11 @@ public class MapleSessionCoordinator {
return cachedHostHwids.get(remoteHost);
}
private void associateRemoteHostHwid(String remoteHost, String remoteHwid) {
cachedHostHwids.put(remoteHost, remoteHwid);
cachedHostTimeout.put(remoteHost, Server.getInstance().getCurrentTime() + 604800000); // 1 week-time entry
}
public void runUpdateHwidHistory() {
try {
Connection con = DatabaseConnection.getConnection();

View File

@@ -64,7 +64,7 @@ public final class ViewAllCharHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.showAllCharacter(charsSize, unk));
for (Pair<Integer, List<MapleCharacter>> wchars : worldChars) {
c.announce(MaplePacketCreator.showAllCharacterInfo(wchars.getLeft(), wchars.getRight(), ServerConstants.ENABLE_PIC));
c.announce(MaplePacketCreator.showAllCharacterInfo(wchars.getLeft(), wchars.getRight(), ServerConstants.ENABLE_PIC && !c.canBypassPic()));
}
} catch (Exception e) {
e.printStackTrace();

View File

@@ -6,19 +6,63 @@ import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import net.AbstractMaplePacketHandler;
import net.server.Server;
import net.server.coordinator.MapleSessionCoordinator;
import net.server.world.World;
import org.apache.mina.core.session.IoSession;
import tools.MaplePacketCreator;
import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor;
public final class ViewAllCharRegisterPicHandler extends AbstractMaplePacketHandler {
private static int parseAntiMulticlientError(MapleSessionCoordinator.AntiMulticlientResult res) {
switch (res) {
case REMOTE_PROCESSING:
return 10;
case REMOTE_LOGGEDIN:
return 7;
case REMOTE_NO_MATCH:
return 17;
case COORDINATOR_ERROR:
return 8;
default:
return 9;
}
}
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
slea.readByte();
int charId = slea.readInt();
slea.readInt(); // please don't let the client choose which world they should login
String mac = slea.readMapleAsciiString();
String hwid = slea.readMapleAsciiString();
if (!hwid.matches("[0-9A-F]{12}_[0-9A-F]{8}")) {
c.announce(MaplePacketCreator.getAfterLoginError(17));
return;
}
c.updateMacs(mac);
c.updateHWID(hwid);
if (c.hasBannedMac() || c.hasBannedHWID()) {
c.getSession().close(true);
return;
}
IoSession session = c.getSession();
MapleSessionCoordinator.AntiMulticlientResult res = MapleSessionCoordinator.getInstance().attemptGameSession(session, c.getAccID(), hwid);
if (res != MapleSessionCoordinator.AntiMulticlientResult.SUCCESS) {
c.announce(MaplePacketCreator.getAfterLoginError(parseAntiMulticlientError(res)));
return;
}
Server server = Server.getInstance();
if(!server.haveCharacterEntry(c.getAccID(), charId)) {
c.getSession().close(true);
@@ -35,14 +79,6 @@ public final class ViewAllCharRegisterPicHandler extends AbstractMaplePacketHand
int channel = Randomizer.rand(1, server.getWorld(c.getWorld()).getChannelsSize());
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);

View File

@@ -27,18 +27,62 @@ import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import net.AbstractMaplePacketHandler;
import net.server.Server;
import net.server.coordinator.MapleSessionCoordinator;
import net.server.world.World;
import org.apache.mina.core.session.IoSession;
import tools.MaplePacketCreator;
import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor;
public final class ViewAllCharSelectedHandler extends AbstractMaplePacketHandler {
private static int parseAntiMulticlientError(MapleSessionCoordinator.AntiMulticlientResult res) {
switch (res) {
case REMOTE_PROCESSING:
return 10;
case REMOTE_LOGGEDIN:
return 7;
case REMOTE_NO_MATCH:
return 17;
case COORDINATOR_ERROR:
return 8;
default:
return 9;
}
}
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
int charId = slea.readInt();
slea.readInt(); // please don't let the client choose which world they should login
String macs = slea.readMapleAsciiString();
String hwid = slea.readMapleAsciiString();
if (!hwid.matches("[0-9A-F]{12}_[0-9A-F]{8}")) {
c.announce(MaplePacketCreator.getAfterLoginError(17));
return;
}
c.updateMacs(macs);
c.updateHWID(hwid);
if (c.hasBannedMac() || c.hasBannedHWID()) {
c.getSession().close(true);
return;
}
IoSession session = c.getSession();
MapleSessionCoordinator.AntiMulticlientResult res = MapleSessionCoordinator.getInstance().attemptGameSession(session, c.getAccID(), hwid);
if (res != MapleSessionCoordinator.AntiMulticlientResult.SUCCESS) {
c.announce(MaplePacketCreator.getAfterLoginError(parseAntiMulticlientError(res)));
return;
}
Server server = Server.getInstance();
if(!server.haveCharacterEntry(c.getAccID(), charId)) {
c.getSession().close(true);
@@ -53,13 +97,6 @@ public final class ViewAllCharSelectedHandler extends AbstractMaplePacketHandler
return;
}
String macs = slea.readMapleAsciiString();
c.updateMacs(macs);
if (c.hasBannedMac()) {
c.getSession().close(true);
return;
}
try {
int channel = Randomizer.rand(1, wserv.getChannelsSize());
c.setChannel(channel);

View File

@@ -11,9 +11,30 @@ import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor;
import client.MapleClient;
import java.net.InetSocketAddress;
import net.server.coordinator.MapleSessionCoordinator;
import org.apache.mina.core.session.IoSession;
public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandler {
private static int parseAntiMulticlientError(MapleSessionCoordinator.AntiMulticlientResult res) {
switch (res) {
case REMOTE_PROCESSING:
return 10;
case REMOTE_LOGGEDIN:
return 7;
case REMOTE_NO_MATCH:
return 17;
case COORDINATOR_ERROR:
return 8;
default:
return 9;
}
}
@Override
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
@@ -21,6 +42,29 @@ public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandle
int charId = slea.readInt();
slea.readInt(); // please don't let the client choose which world they should login
String macs = slea.readMapleAsciiString();
String hwid = slea.readMapleAsciiString();
if (!hwid.matches("[0-9A-F]{12}_[0-9A-F]{8}")) {
c.announce(MaplePacketCreator.getAfterLoginError(17));
return;
}
c.updateMacs(macs);
c.updateHWID(hwid);
if (c.hasBannedMac() || c.hasBannedHWID()) {
c.getSession().close(true);
return;
}
IoSession session = c.getSession();
MapleSessionCoordinator.AntiMulticlientResult res = MapleSessionCoordinator.getInstance().attemptGameSession(session, c.getAccID(), hwid);
if (res != MapleSessionCoordinator.AntiMulticlientResult.SUCCESS) {
c.announce(MaplePacketCreator.getAfterLoginError(parseAntiMulticlientError(res)));
return;
}
Server server = Server.getInstance();
if(!server.haveCharacterEntry(c.getAccID(), charId)) {
c.getSession().close(true);
@@ -37,13 +81,6 @@ public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandle
int channel = Randomizer.rand(1, wserv.getChannelsSize());
c.setChannel(channel);
String macs = slea.readMapleAsciiString();
c.updateMacs(macs);
if (c.hasBannedMac()) {
c.getSession().close(true);
return;
}
if (c.checkPic(pic)) {
String[] socket = server.getInetSocket(c.getWorld(), c.getChannel());
if(socket == null) {

View File

@@ -20,6 +20,7 @@
package net.server.worker;
import net.server.coordinator.MapleSessionCoordinator;
import net.server.coordinator.MapleLoginBypassCoordinator;
/**
*
@@ -30,5 +31,6 @@ public class LoginStorageWorker implements Runnable {
@Override
public void run() {
MapleSessionCoordinator.getInstance().runUpdateLoginHistory();
MapleLoginBypassCoordinator.getInstance().runUpdateLoginBypass();
}
}

View File

@@ -409,6 +409,11 @@ public class World {
return list;
}
public List<MapleCharacter> loadAndGetAllCharactersView() {
Server.getInstance().loadAllAccountsCharactersView();
return getAllCharactersView();
}
public List<MapleCharacter> getAllCharactersView() { // sorted by accountid, charid
List<MapleCharacter> chrList = new LinkedList<>();
Map<Integer, SortedMap<Integer, MapleCharacter>> accChars;
@@ -598,8 +603,7 @@ public class World {
mc.saveGuildStatus();
}
if (bDifferentGuild) {
mc.getMap().broadcastMessage(mc, MaplePacketCreator.removePlayerFromMap(cid), false);
mc.getMap().broadcastMessage(mc, MaplePacketCreator.spawnPlayerMapObject(mc), false);
mc.broadcastStance();
}
}