Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Dream: Pro Coder :) standeman is offline
    True MemberRank
    Mar 2010 Join Date
    The NetherlandsLocation
    418Posts

    thumbs up Fix PIC DC to login screen :unable to logon gameserver -- Xephyr


    RaGEZONE Recommends

    RaGEZONE Recommends

    I finally know how to fix this...
    For the pros: Flame on me, I dont care the noobs can use v114 now.
    For the noobs: Have fun.

    MapleServerHandler.java
    PHP Code:
    /*
     This file is part of the OdinMS Maple Story Server
     Copyright (C) 2008 ~ 2012 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 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 handling;

    import constants.ServerConstants;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.Map;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.concurrent.ConcurrentHashMap;

    import client.MapleClient;
    import client.inventory.Item;
    import client.inventory.MaplePet;
    import client.inventory.PetDataFactory;
    import constants.GameConstants;
    import handling.cashshop.CashShopServer;
    import handling.channel.ChannelServer;
    import handling.cashshop.handler.*;
    import handling.channel.handler.*;
    import handling.login.LoginServer;
    import handling.login.handler.*;
    import handling.mina.MaplePacketDecoder;
    import java.io.File;
    import java.io.FileWriter;
    import java.lang.management.ManagementFactory;
    import java.util.EnumSet;
    import java.util.HashMap;
    import java.util.Scanner;
    import java.util.concurrent.locks.ReentrantReadWriteLock;
    import javax.management.MBeanServer;
    import javax.management.ObjectName;
    import server.Randomizer;
    import tools.MapleAESOFB;
    import tools.packet.LoginPacket;
    import tools.data.ByteArrayByteStream;
    import tools.data.LittleEndianAccessor;
    import tools.Pair;

    import org.apache.mina.common.IoHandlerAdapter;
    import org.apache.mina.common.IdleStatus;
    import org.apache.mina.common.IoSession;
    import scripting.NPCScriptManager;
    import server.CashItemFactory;
    import server.CashItemInfo;
    import server.MTSStorage;
    import tools.FileoutputUtil;
    import tools.HexTool;
    import tools.packet.MTSCSPacket;

    public class 
    MapleServerHandler extends IoHandlerAdapter implements MapleServerHandlerMBean {

        public static 
    boolean Log_Packets false;
        private static 
    int numDC 0;
         private 
    int channel = -1;

        private 
    boolean cs;
        private static 
    long lastDC System.currentTimeMillis();
        private final List<
    StringBlockedIP = new ArrayList<String>();
        private final 
    Map<StringPair<LongByte>> tracker = new ConcurrentHashMap<StringPair<LongByte>>();
        
    //Screw locking. Doesn't matter.
    //    private static final ReentrantReadWriteLock IPLoggingLock = new ReentrantReadWriteLock();
        
    private static final String nl System.getProperty("line.separator");
        private static final 
    File loggedIPs = new File("LogIPs.txt");
        private static final 
    HashMap<StringFileWriterlogIPMap = new HashMap<StringFileWriter>();
        
    //Note to Zero: Use an enumset. Don't iterate through an array.
        
    private static final EnumSet<RecvPacketOpcodeblocked EnumSet.noneOf(RecvPacketOpcode.class), sBlocked EnumSet.noneOf(RecvPacketOpcode.class);

        public static 
    void reloadLoggedIPs() {
    //        IPLoggingLock.writeLock().lock();
    //        try {
            
    for (FileWriter fw logIPMap.values()) {
                if (
    fw != null) {
                    try {
                        
    fw.write("=== Closing Log ===");
                        
    fw.write(nl);
                        
    fw.flush(); //Just in case.
                        
    fw.close();
                    } catch (
    IOException ex) {
                        
    System.out.println("Error closing Packet Log.");
                        
    System.out.println(ex);
                    }
                }
            }
            
    logIPMap.clear();
            try {
                
    Scanner sc = new Scanner(loggedIPs);
                while (
    sc.hasNextLine()) {
                    
    String line sc.nextLine().trim();
                    if (
    line.length() > 0) {
                        
    addIP(line);
                    }
                }
            } catch (
    Exception e) {
                
    System.out.println("Could not reload packet logged IPs.");
                
    System.out.println(e);
            }
    //        } finally {
    //            IPLoggingLock.writeLock().unlock();
    //        }
        
    }
        
    //Return the Filewriter if the IP is logged. Null otherwise.

        
    private static FileWriter isLoggedIP(IoSession sess) {
            
    String a sess.getRemoteAddress().toString();
            
    String realIP a.substring(a.indexOf('/') + 1a.indexOf(':'));
            return 
    logIPMap.get(realIP);
        }

        public static 
    void addIP(String theIP) {
            try {
                
    FileWriter fw = new FileWriter(new File("PacketLog_" theIP ".txt"), true);
                
    fw.write("=== Creating Log ===");
                
    fw.write(nl);
                
    fw.flush();
                
    logIPMap.put(theIPfw);
            } catch (
    IOException e) {
                
    FileoutputUtil.outputFileError(FileoutputUtil.PacketEx_Loge);
            }

        }
    // <editor-fold defaultstate="collapsed" desc="Packet Log Implementation">
        
    private static final int Log_Size 10000Packet_Log_Size 25;
        private static final 
    ArrayList<LoggedPacketPacket_Log = new ArrayList<LoggedPacket>(Log_Size);
        private static final 
    ReentrantReadWriteLock Packet_Log_Lock = new ReentrantReadWriteLock();
        private static 
    String Packet_Log_Output "Packet/PacketLog";
        private static 
    int Packet_Log_Index 0;

        public static 
    void log(String packetString opMapleClient cIoSession io) {
            try {
                
    Packet_Log_Lock.writeLock().lock();
                
    LoggedPacket logged null;
                if (
    Packet_Log.size() == Log_Size) {
                    
    logged Packet_Log.remove(0);
                }
                
    //This way, we don't create new LoggedPacket objects, we reuse them =]
                
    if (logged == null) {
                    
    logged = new LoggedPacket(packetopio.getRemoteAddress().toString(),
                            
    == null ? -c.getAccID(), FileoutputUtil.CurrentReadable_Time(),
                            
    == null || c.getAccountName() == null "[Null]" c.getAccountName(),
                            
    == null || c.getPlayer() == null || c.getPlayer().getName() == null "[Null]" c.getPlayer().getName(),
                            
    == null || c.getPlayer() == null || c.getPlayer().getMap() == null "[Null]" String.valueOf(c.getPlayer().getMapId()),
                            
    == null || NPCScriptManager.getInstance().getCM(c) == null "[Null]" String.valueOf(NPCScriptManager.getInstance().getCM(c).getNpc()));
                } else {
                    
    logged.setInfo(packetopio.getRemoteAddress().toString(),
                            
    == null ? -c.getAccID(), FileoutputUtil.CurrentReadable_Time(),
                            
    == null || c.getAccountName() == null "[Null]" c.getAccountName(),
                            
    == null || c.getPlayer() == null || c.getPlayer().getName() == null "[Null]" c.getPlayer().getName(),
                            
    == null || c.getPlayer() == null || c.getPlayer().getMap() == null "[Null]" String.valueOf(c.getPlayer().getMapId()),
                            
    == null || NPCScriptManager.getInstance().getCM(c) == null "[Null]" String.valueOf(NPCScriptManager.getInstance().getCM(c).getNpc()));
                }
                
    Packet_Log.add(logged);
            } finally {
                
    Packet_Log_Lock.writeLock().unlock();
            }
        }

        private static class 
    LoggedPacket {

            private static final 
    String nl System.getProperty("line.separator");
            private 
    String ipaccNameaccIdchrNamepacketmapIdnpcIdoptime;
            private 
    long timestamp;

            public 
    LoggedPacket(String pString opString ipint idString timeString accNameString chrNameString mapIdString npcId) {
                
    setInfo(popipidtimeaccNamechrNamemapIdnpcId);
            }

            public final 
    void setInfo(String pString opString ipint idString timeString accNameString chrNameString mapIdString npcId) {
                
    this.ip ip;
                
    this.op op;
                
    this.time time;
                
    this.packet p;
                
    this.accName accName;
                
    this.chrName chrName;
                
    this.mapId mapId;
                
    this.npcId npcId;
                
    timestamp System.currentTimeMillis();
                
    this.accId String.valueOf(id);
            }

            @
    Override
            
    public String toString() {
                
    StringBuilder sb = new StringBuilder();
                
    sb.append("[IP: ").append(ip).append("] [").append(accId).append('|').append(accName).append('|').append(chrName).append("] [").append(npcId).append('|').append(mapId).append("] [Time: ").append(timestamp).append("] [").append(time).append(']');
                
    sb.append(nl);
                
    sb.append("[Op: ").append(op).append("] [").append(packet).append(']');
                return 
    sb.toString();
            }
        }

        public static 
    void registerMBean() {
            
    MBeanServer mBeanServer ManagementFactory.getPlatformMBeanServer();
            try {
                
    MapleServerHandler mbean = new MapleServerHandler();
                
    //The log is a static object, so we can just use this hacky method.
                
    mBeanServer.registerMBean(mbean, new ObjectName("handling:type=MapleServerHandler"));
            } catch (
    Exception e) {
                
    System.out.println("Error registering PacketLog MBean");
                
    e.printStackTrace();
            }
        }

        public 
    void writeLog() {
            
    writeLog(false);
        }

        public 
    void writeLog(boolean crash) {
            
    Packet_Log_Lock.readLock().lock();
            try {
                
    FileWriter fw = new FileWriter(new File(Packet_Log_Output Packet_Log_Index + (crash "_DC.txt" ".txt")), true);
                
    String nl System.getProperty("line.separator");
                for (
    LoggedPacket loggedPacket Packet_Log) {
                    
    fw.write(loggedPacket.toString());
                    
    fw.write(nl);
                }
                final 
    String logString "Log has been written at " lastDC " [" FileoutputUtil.CurrentReadable_Time() + "] - " numDC " have disconnected, within " + (System.currentTimeMillis() - lastDC) + " milliseconds. (" System.currentTimeMillis() + ")";
                
    System.out.println(logString);
                
    fw.write(logString);
                
    fw.write(nl);
                
    fw.flush();
                
    fw.close();
                
    Packet_Log.clear();
                
    Packet_Log_Index++;
                if (
    Packet_Log_Index Packet_Log_Size) {
                    
    Packet_Log_Index 0;
                    
    Log_Packets false;
                }
            } catch (
    IOException ex) {
                
    System.out.println("Error writing log to file.");
            } finally {
                
    Packet_Log_Lock.readLock().unlock();
            }

        }

        public static final 
    void initiate() {
            
    reloadLoggedIPs();
            
    RecvPacketOpcode[] block = new RecvPacketOpcode[]{RecvPacketOpcode.NPC_ACTIONRecvPacketOpcode.MOVE_PLAYERRecvPacketOpcode.PONGRecvPacketOpcode.MOVE_PETRecvPacketOpcode.MOVE_SUMMONRecvPacketOpcode.MOVE_DRAGONRecvPacketOpcode.MOVE_LIFERecvPacketOpcode.MOVE_ANDROIDRecvPacketOpcode.HEAL_OVER_TIMERecvPacketOpcode.STRANGE_DATARecvPacketOpcode.AUTO_AGGRORecvPacketOpcode.CANCEL_DEBUFFRecvPacketOpcode.MOVE_FAMILIAR};
            
    RecvPacketOpcode[] serverBlock = new RecvPacketOpcode[]{RecvPacketOpcode.CHANGE_KEYMAPRecvPacketOpcode.ITEM_PICKUPRecvPacketOpcode.PET_LOOTRecvPacketOpcode.TAKE_DAMAGERecvPacketOpcode.FACE_EXPRESSIONRecvPacketOpcode.USE_ITEMRecvPacketOpcode.CLOSE_RANGE_ATTACKRecvPacketOpcode.MAGIC_ATTACKRecvPacketOpcode.RANGED_ATTACKRecvPacketOpcode.ARAN_COMBORecvPacketOpcode.SPECIAL_MOVERecvPacketOpcode.GENERAL_CHATRecvPacketOpcode.MONSTER_BOMBRecvPacketOpcode.PASSIVE_ENERGYRecvPacketOpcode.PET_AUTO_POTRecvPacketOpcode.USE_CASH_ITEMRecvPacketOpcode.PARTYCHATRecvPacketOpcode.CANCEL_BUFFRecvPacketOpcode.SKILL_EFFECTRecvPacketOpcode.CHAR_INFO_REQUESTRecvPacketOpcode.ALLIANCE_OPERATIONRecvPacketOpcode.AUTO_ASSIGN_APRecvPacketOpcode.DISTRIBUTE_APRecvPacketOpcode.USE_MAGNIFY_GLASSRecvPacketOpcode.SPAWN_PETRecvPacketOpcode.SUMMON_ATTACKRecvPacketOpcode.ITEM_MOVERecvPacketOpcode.PARTY_SEARCH_STOP};
            
    blocked.addAll(Arrays.asList(block));
            
    sBlocked.addAll(Arrays.asList(serverBlock));
            if (
    Log_Packets) {
                for (
    int i 1<= Packet_Log_Sizei++) {
                    if (!(new 
    File(Packet_Log_Output ".txt")).exists() && !(new File(Packet_Log_Output "_DC.txt")).exists()) {
                        
    Packet_Log_Index i;
                        break;
                    }
                }
                if (
    Packet_Log_Index <= 0) { //25+ files, do not log
                    
    Log_Packets false;
                }
            }

            
    registerMBean();
        }

        public 
    MapleServerHandler() {
            
    //ONLY FOR THE MBEAN
        
    }
        
    // </editor-fold>

        
    @Override
        
    public void exceptionCaught(final IoSession session, final Throwable causethrows Exception {
            
    /*
             * MapleClient client = (MapleClient)
             * session.getAttribute(MapleClient.CLIENT_KEY);
             * log.error(MapleClient.getLogMessage(client, cause.getMessage()),
             * cause);
             */
            // cause.printStackTrace();
        
    }

        @
    Override
        
    public void sessionOpened(final IoSession sessionthrows Exception {
            
    // Start of IP checking
            
    final String address session.getRemoteAddress().toString().split(":")[0];

            if (
    BlockedIP.contains(address)) {
                
    session.close();
                return;
            }
            final 
    Pair<LongBytetrack tracker.get(address);

            
    byte count;
            if (
    track == null) {
                
    count 1;
            } else {
                
    count track.right;

                final 
    long difference System.currentTimeMillis() - track.left;
                if (
    difference 2000) { // Less than 2 sec
                    
    count++;
                } else if (
    difference 20000) { // Over 20 sec
                    
    count 1;
                }
                if (
    count >= 10) {
                    
    BlockedIP.add(address);
                    
    tracker.remove(address); // Cleanup
                    
    session.close();
                    return;
                }
            }
            
    tracker.put(address, new Pair<LongByte>(System.currentTimeMillis(), count));
            
    // End of IP checking.
            
    String IP address.substring(address.indexOf('/') + 1address.length());
                if (
    LoginServer.isShutdown()) {
                    
    session.close();
                    return;
                }
            
    LoginServer.removeIPAuth(IP);
            final 
    byte ivRecv[] = new byte[]{(byteRandomizer.nextInt(255), (byteRandomizer.nextInt(255), (byteRandomizer.nextInt(255), (byteRandomizer.nextInt(255)};
            final 
    byte ivSend[] = new byte[]{(byteRandomizer.nextInt(255), (byteRandomizer.nextInt(255), (byteRandomizer.nextInt(255), (byteRandomizer.nextInt(255)};

            final 
    MapleClient client = new MapleClient(
                    new 
    MapleAESOFB(ivSend, (short) (0xFFFF ServerConstants.MAPLE_VERSION)), // Sent Cypher
                    
    new MapleAESOFB(ivRecvServerConstants.MAPLE_VERSION), // Recv Cypher
                    
    session);
            
    client.setChannel(-1);

            
    MaplePacketDecoder.DecoderState decoderState = new MaplePacketDecoder.DecoderState();
            
    session.setAttribute(MaplePacketDecoder.DECODER_STATE_KEYdecoderState);


            
    session.write(LoginPacket.getHello(ServerConstants.MAPLE_VERSIONivSendivRecv));
            
    //System.out.println("GETHELLO SENT TO " + address);
            
    session.setAttribute(MapleClient.CLIENT_KEYclient);
            
    session.setIdleTime(IdleStatus.READER_IDLE60);
            
    session.setIdleTime(IdleStatus.WRITER_IDLE60);

            if (
    ServerConstants.Use_Localhost) {
                
    RecvPacketOpcode.reloadValues();
                
    SendPacketOpcode.reloadValues();
            }

            if (
    LoginServer.isAdminOnly()) {
                
    StringBuilder sb = new StringBuilder();
                
    sb.append("IoSession opened ").append(address);
                
    System.out.println(sb.toString());
            }

            
    FileWriter fw isLoggedIP(session);
            if (
    fw != null) {
                
    client.setMonitored(true);
            }
        }

        @
    Override
        
    public void sessionClosed(final IoSession sessionthrows Exception {
            final 
    MapleClient client = (MapleClientsession.getAttribute(MapleClient.CLIENT_KEY);

            if (
    client != null) {
                
    byte state MapleClient.CHANGE_CHANNEL;
                if (
    Log_Packets && !LoginServer.isShutdown() && client.getPlayer() != null) {
                    
    state client.getLoginState();
                }
                if (
    state != MapleClient.CHANGE_CHANNEL) {
                    
    log("Data: " numDC"CLOSED"clientsession);
                    if (
    System.currentTimeMillis() - lastDC 60000) { //within the minute
                        
    numDC++;
                        if (
    numDC 100) { //100+ people have dc'd in minute in channelserver
                            
    System.out.println("Writing log...");
                            
    writeLog();
                            
    numDC 0;
                            
    lastDC System.currentTimeMillis(); //intentionally place here
                        
    }
                    } else {
                        
    numDC 0;
                        
    lastDC System.currentTimeMillis(); //intentionally place here
                    
    }
                }
                try {
                    
    FileWriter fw isLoggedIP(session);
                    if (
    fw != null) {
                        
    fw.write("=== Session Closed ===");
                        
    fw.write(nl);
                        
    fw.flush();
                    }

                    
    client.disconnect(truetrue);
                } finally {
                    
    session.close();
                    
    session.removeAttribute(MapleClient.CLIENT_KEY);
                }
            }
            
    super.sessionClosed(session);
        }

        @
    Override
        
    public void sessionIdle(final IoSession session, final IdleStatus statusthrows Exception {
            final 
    MapleClient client = (MapleClientsession.getAttribute(MapleClient.CLIENT_KEY);

            
    /*
             * if (client != null && client.getPlayer() != null) {
             * System.out.println("Player "+ client.getPlayer().getName() +" went
             * idle"); }
             */
            
    if (client != null) {
                
    //client.sendPing();
            
    }
            
    super.sessionIdle(sessionstatus);
        }

        public 
    MapleServerHandler(final int channel, final boolean cs) {
            
    this.channel channel;
            
    this.cs cs;
        }
        @
    Override
        
    public void messageReceived(final IoSession session, final Object message) {
            if (
    message == null || session == null) {
                return;
            }
            final 
    LittleEndianAccessor slea = new LittleEndianAccessor(new ByteArrayByteStream((byte[]) message));
            if (
    slea.available() < 2) {
                return;
            }
            final 
    MapleClient c = (MapleClientsession.getAttribute(MapleClient.CLIENT_KEY);
            if (
    == null || !c.isReceiving()) {
                return;
            }
            final 
    short header_num slea.readShort();

           
    // final StringBuilder sb = new StringBuilder("Received data :\n");
           // sb.append(HexTool.toString((byte[]) message)).append("\n").append(HexTool.toStringFromAscii((byte[]) message));
            //System.out.println(sb.toString());

            
    for (final RecvPacketOpcode recv RecvPacketOpcode.values()) {
                if (
    recv.getValue() == header_num) {
                    if (
    recv.NeedsChecking()) {
                        if (!
    c.isLoggedIn()) {
                            return;
                        }
                    }
                    try {
                        if (
    c.getPlayer() != null && c.isMonitored() && !blocked.contains(recv)) {
                            
    FileWriter fw = new FileWriter(new File("MonitorLogs/" c.getPlayer().getName() + "_log.txt"), true);
                            
    fw.write(String.valueOf(recv) + " (" Integer.toHexString(header_num) + ") Handled: \r\n" slea.toString() + "\r\n");
                            
    fw.flush();
                            
    fw.close();
                        }
                        
    //no login packets
                        
    if (Log_Packets && !blocked.contains(recv) && !sBlocked.contains(recv) && c.getPlayer() != null) {
                            
    log(slea.toString(), recv.toString(), csession);
                        }
                        
    handlePacket(recvsleac);
                        
    //Log after the packet is handle. You'll see why =]
                        
    FileWriter fw isLoggedIP(session);
                        if (
    fw != null && !blocked.contains(recv)) {
                            if (
    recv == RecvPacketOpcode.PLAYER_LOGGEDIN && != null) { // << This is why. Win.
                                
    fw.write(">> [AccountName: "
                                        
    + (c.getAccountName() == null "null" c.getAccountName()) + "] | [IGN: "
                                        
    + (c.getPlayer() == null || c.getPlayer().getName() == null "null" c.getPlayer().getName()) + "] | [Time: "
                                        
    FileoutputUtil.CurrentReadable_Time() + "]");
                                
    fw.write(nl);
                            }
                            
    fw.write("[" recv.toString() + "]" slea.toString(true));
                            
    fw.write(nl);
                            
    fw.flush();
                        }
                    } catch (
    NegativeArraySizeException e) {
                        
    //swallow, no one cares
                        
    if (ServerConstants.Use_Localhost) {
                            
    FileoutputUtil.outputFileError(FileoutputUtil.PacketEx_Loge);
                            
    FileoutputUtil.log(FileoutputUtil.PacketEx_Log"Packet: " header_num "\n" slea.toString(true));
                        }
                    } catch (
    ArrayIndexOutOfBoundsException e) {
                        
    //swallow, no one cares
                        
    if (ServerConstants.Use_Localhost) {
                            
    FileoutputUtil.outputFileError(FileoutputUtil.PacketEx_Loge);
                            
    FileoutputUtil.log(FileoutputUtil.PacketEx_Log"Packet: " header_num "\n" slea.toString(true));
                        }
                    } catch (
    Exception e) {
                        
    FileoutputUtil.outputFileError(FileoutputUtil.PacketEx_Loge);
                        
    FileoutputUtil.log(FileoutputUtil.PacketEx_Log"Packet: " header_num "\n" slea.toString(true));
                    }

                    return;
                }
            }
            
    //final StringBuilder sb = new StringBuilder("Received data : (Unhandled)\n");
            //sb.append(HexTool.toString((byte[]) message)).append("\n").append(HexTool.toStringFromAscii((byte[]) message));
            //System.out.println(sb.toString());
        
    }

        public static final 
    void handlePacket(final RecvPacketOpcode header, final LittleEndianAccessor slea, final MapleClient cthrows Exception {
            switch (
    header) {
                case 
    PONG:
                    
    c.pongReceived();
                    break;
                case 
    STRANGE_DATA:
                    
    // Does nothing for now, HackShield's heartbeat
                    
    break;
                case 
    LOGIN_PASSWORD:
                    
    CharLoginHandler.login(sleac);
                    break;
                case 
    SEND_ENCRYPTED:
                    
    //if (c.isLocalhost()) {
                    //    CharLoginHandler.login(slea, c);
                    //} else {
                    //    c.getSession().write(LoginPacket.getCustomEncryption());
                    //}
                    
    break;
                case 
    CLIENT_START:
                    if (
    c.isLocalhost()) {
                        
    CharLoginHandler.login(sleac);
                    }
                    break;
                case 
    CLIENT_FAILED:
                    
    c.getSession().write(LoginPacket.getCustomEncryption());
                    break;
                case 
    VIEW_SERVERLIST:
                    if (
    slea.readByte() == 0) {
                        
    CharLoginHandler.ServerListRequest(c);
                    }
                    break;
                case 
    REDISPLAY_SERVERLIST:
                case 
    SERVERLIST_REQUEST:
                    
    CharLoginHandler.ServerListRequest(c);
                    break;
                case 
    CLIENT_HELLO:
                    if (
    slea.readByte() != || slea.readShort() != ServerConstants.MAPLE_VERSION || !String.valueOf(slea.readShort()).equals(ServerConstants.MAPLE_PATCH)) {
                        
    c.getSession().close();
                    }
                    break;
                case 
    CHARLIST_REQUEST:
                    
    CharLoginHandler.CharlistRequest(sleac);
                    break;
                case 
    SERVERSTATUS_REQUEST:
                    
    CharLoginHandler.ServerStatusRequest(c);
                    break;
                case 
    CHECK_CHAR_NAME:
                    
    CharLoginHandler.CheckCharName(slea.readMapleAsciiString(), c);
                    break;
                case 
    CREATE_CHAR:
                case 
    CREATE_SPECIAL_CHAR:
                    
    CharLoginHandler.CreateChar(sleac);
                    break;
                case 
    CREATE_ULTIMATE:
                    
    CharLoginHandler.CreateUltimate(sleac);
                    break;
                case 
    DELETE_CHAR:
                    
    CharLoginHandler.DeleteChar(sleac);
                    break;
                case 
    VIEW_ALL_CHAR:
                    
    CharLoginHandler.ViewChar(sleac);
                    break;
                case 
    PICK_ALL_CHAR:
                    
    CharLoginHandler.Character_WithoutSecondPassword(sleacfalsetrue);
                    break;
                case 
    CHAR_SELECT_NO_PIC:
                    
    CharLoginHandler.Character_WithoutSecondPassword(sleacfalsefalse);
                    break;
                case 
    VIEW_REGISTER_PIC:
                    
    CharLoginHandler.Character_WithoutSecondPassword(sleactruetrue);
                    break;
                case 
    CHAR_SELECT:
                    
    CharLoginHandler.Character_WithoutSecondPassword(sleactruefalse);
                    break;
                case 
    VIEW_SELECT_PIC:
                    
    CharLoginHandler.Character_WithSecondPassword(sleactrue);
                    break;
                case 
    AUTH_SECOND_PASSWORD:
                    
    CharLoginHandler.Character_WithSecondPassword(sleacfalse);
                    break;
                case 
    CHARACTER_CARDS:
                    
    CharLoginHandler.updateCCards(sleac);
                    break;
                case 
    CLIENT_ERROR:
                 
    //   System.out.println("Client error: " + slea.toString());
                    
    if (slea.available() < 8) {
                        return;
                    }
                    
    short type slea.readShort();
                    
    String type_str "Unknown?!";
                    if (
    type == 0x01) {
                        
    type_str "SendBackupPacket";
                    } else if (
    type == 0x02) {
                        
    type_str "Crash Report";
                    } else if (
    type == 0x03) {
                        
    type_str "Exception";
                    }
                    
    int errortype slea.readInt(); // example error 38
                    
    if (errortype == 0) { // i don't wanna log error code 0 stuffs, (usually some bounceback to login)
                        
    return;
                    }
                    
    short data_length slea.readShort();
                    
    slea.skip(4); // ?B3 86 01 00 00 00 FF 00 00 00 00 00 9E 05 C8 FF 02 00 CD 05 C9 FF 7D 00 00 00 3F 00 00 00 00 00 02 77 01 00 25 06 C9 FF 7D 00 00 00 40 00 00 00 00 00 02 C1 02
                    
    short opcodeheader slea.readShort();
                    
    FileoutputUtil.log("ErrorCodes.txt","Error Type: " errortype "\r\n" "Data Length: " data_length "\r\n" "Error for player ; " c.getPlayer() + " - account ; " c.getAccountName() + "\r\n" SendPacketOpcode.getOpcodeName(opcodeheader) + "Opcode: " opcodeheader "\r\n" HexTool.toString(slea.read((int) slea.available())) + "\r\n\r\n");
                    break;
                case 
    ENABLE_SPECIAL_CREATION:
                    
    c.getSession().write(LoginPacket.enableSpecialCreation(c.getAccID(), true));
                    break;
                case 
    RSA_KEY// Fix this somehow
                    //c.getSession().write(LoginPacket.getLoginAUTH());
                    // c.getSession().write(LoginPacket.StrangeDATA());
                    
    break;
                
    // END OF LOGIN SERVER
                
    case CHANGE_CHANNEL:
                case 
    CHANGE_ROOM_CHANNEL:
                    
    InterServerHandler.ChangeChannel(sleacc.getPlayer(), header == RecvPacketOpcode.CHANGE_ROOM_CHANNEL);
                    break;
                case 
    PLAYER_LOGGEDIN:
                    final 
    int playerid slea.readInt();
                    
    InterServerHandler.Loggedin(playeridc);
                    break;
                case 
    ENTER_PVP:
                case 
    ENTER_PVP_PARTY:
                    
    PlayersHandler.EnterPVP(sleac);
                    break;
                case 
    PVP_RESPAWN:
                    
    PlayersHandler.RespawnPVP(sleac);
                    break;
                case 
    LEAVE_PVP:
                    
    PlayersHandler.LeavePVP(sleac);
                    break;
                case 
    PVP_ATTACK:
                    
    PlayersHandler.AttackPVP(sleac);
                    break;
                case 
    PVP_SUMMON:
                    
    SummonHandler.SummonPVP(sleac);
                    break;
                case 
    ENTER_CASH_SHOP:
                    
    InterServerHandler.EnterCS(cc.getPlayer(), false);
                    break;
                case 
    ENTER_MTS:
                    
    InterServerHandler.EnterMTS(cc.getPlayer());
                    
    //InterServerHandler.EnterCS(c, c.getPlayer(), true);
                    
    break;
                case 
    MOVE_PLAYER:
                    
    PlayerHandler.MovePlayer(sleacc.getPlayer());
                    break;
                case 
    CHAR_INFO_REQUEST:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    PlayerHandler.CharInfoRequest(slea.readInt(), cc.getPlayer());
                    break;
                case 
    CLOSE_RANGE_ATTACK:
                    
    PlayerHandler.closeRangeAttack(sleacc.getPlayer(), false);
                    break;
                case 
    RANGED_ATTACK:
                    
    PlayerHandler.rangedAttack(sleacc.getPlayer());
                    break;
                case 
    MAGIC_ATTACK:
                    
    PlayerHandler.MagicDamage(sleacc.getPlayer());
                    break;
                case 
    SPECIAL_MOVE:
                    
    PlayerHandler.SpecialMove(sleacc.getPlayer());
                    break;
                case 
    PASSIVE_ENERGY:
                    
    PlayerHandler.closeRangeAttack(sleacc.getPlayer(), true);
                    break;
                case 
    GET_BOOK_INFO:
                    
    PlayersHandler.MonsterBookInfoRequest(sleacc.getPlayer());
                    break;
                case 
    MONSTER_BOOK_DROPS:
                    
    PlayersHandler.MonsterBookDropsRequest(sleacc.getPlayer());
                    break;
                case 
    CHANGE_SET:
                    
    PlayersHandler.ChangeSet(sleacc.getPlayer());
                    break;
                case 
    PROFESSION_INFO:
                    
    ItemMakerHandler.ProfessionInfo(sleac);
                    break;
                case 
    CRAFT_DONE:
                    
    ItemMakerHandler.CraftComplete(sleacc.getPlayer());
                    break;
                case 
    CRAFT_MAKE:
                    
    ItemMakerHandler.CraftMake(sleacc.getPlayer());
                    break;
                case 
    CRAFT_EFFECT:
                    
    ItemMakerHandler.CraftEffect(sleacc.getPlayer());
                    break;
                case 
    START_HARVEST:
                    
    ItemMakerHandler.StartHarvest(sleacc.getPlayer());
                    break;
                case 
    STOP_HARVEST:
                    
    ItemMakerHandler.StopHarvest(sleacc.getPlayer());
                    break;
                case 
    MAKE_EXTRACTOR:
                    
    ItemMakerHandler.MakeExtractor(sleacc.getPlayer());
                    break;
                case 
    USE_BAG:
                    
    ItemMakerHandler.UseBag(sleacc.getPlayer());
                    break;
                case 
    USE_FAMILIAR:
                    
    MobHandler.UseFamiliar(sleacc.getPlayer());
                    break;
                case 
    SPAWN_FAMILIAR:
                    
    MobHandler.SpawnFamiliar(sleacc.getPlayer());
                    break;
                case 
    RENAME_FAMILIAR:
                    
    MobHandler.RenameFamiliar(sleacc.getPlayer());
                    break;
                case 
    MOVE_FAMILIAR:
                    
    MobHandler.MoveFamiliar(sleacc.getPlayer());
                    break;
                case 
    ATTACK_FAMILIAR:
                    
    MobHandler.AttackFamiliar(sleacc.getPlayer());
                    break;
                case 
    TOUCH_FAMILIAR:
                    
    MobHandler.TouchFamiliar(sleacc.getPlayer());
                    break;
                case 
    USE_RECIPE:
                    
    ItemMakerHandler.UseRecipe(sleacc.getPlayer());
                    break;
                case 
    MOVE_ANDROID:
                    
    PlayerHandler.MoveAndroid(sleacc.getPlayer());
                    break;
                case 
    FACE_EXPRESSION:
                    
    PlayerHandler.ChangeEmotion(slea.readInt(), c.getPlayer());
                    break;
                case 
    FACE_ANDROID:
                    
    PlayerHandler.ChangeAndroidEmotion(slea.readInt(), c.getPlayer());
                    break;
                case 
    TAKE_DAMAGE:
                    
    PlayerHandler.TakeDamage(sleacc.getPlayer());
                    break;
                case 
    HEAL_OVER_TIME:
                    
    PlayerHandler.Heal(sleac.getPlayer());
                    break;
                case 
    CANCEL_BUFF:
                    
    PlayerHandler.CancelBuffHandler(slea.readInt(), c.getPlayer());
                    break;
                case 
    MECH_CANCEL:
                    
    PlayerHandler.CancelMech(sleac.getPlayer());
                    break;
                case 
    CANCEL_ITEM_EFFECT:
                    
    PlayerHandler.CancelItemEffect(slea.readInt(), c.getPlayer());
                    break;
                case 
    USE_TITLE:
                    
    PlayerHandler.UseTitle(slea.readInt(), cc.getPlayer());
                    break;
                case 
    USE_CHAIR:
                    
    PlayerHandler.UseChair(slea.readInt(), cc.getPlayer());
                    break;
                case 
    CANCEL_CHAIR:
                    
    PlayerHandler.CancelChair(slea.readShort(), cc.getPlayer());
                    break;
                case 
    WHEEL_OF_FORTUNE:
                    break; 
    //whatever
                
    case USE_ITEMEFFECT:
                    
    PlayerHandler.UseItemEffect(slea.readInt(), cc.getPlayer());
                    break;
                case 
    SKILL_EFFECT:
                    
    PlayerHandler.SkillEffect(sleac.getPlayer());
                    break;
                case 
    QUICK_SLOT:
                    
    PlayerHandler.QuickSlot(sleac.getPlayer());
                    break;
                case 
    MESO_DROP:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    PlayerHandler.DropMeso(slea.readInt(), c.getPlayer());
                    break;
                case 
    CHANGE_KEYMAP:
                    
    PlayerHandler.ChangeKeymap(sleac.getPlayer());
                    break;
                case 
    UPDATE_ENV:
                    
    // We handle this in MapleMap
                    
    break;
                case 
    CHANGE_MAP:
                    if (
    c.getPlayer().getMap() == null) {
                        
    CashShopOperation.LeaveCS(sleacc.getPlayer());
                    } else {
                        
    PlayerHandler.ChangeMap(sleacc.getPlayer());
                    }
                    break;
                case 
    CHANGE_MAP_SPECIAL:
                    
    slea.skip(1);
                    
    PlayerHandler.ChangeMapSpecial(slea.readMapleAsciiString(), cc.getPlayer());
                    break;
                case 
    USE_INNER_PORTAL:
                    
    slea.skip(1);
                    
    PlayerHandler.InnerPortal(sleacc.getPlayer());
                    break;
                case 
    TROCK_ADD_MAP:
                    
    PlayerHandler.TrockAddMap(sleacc.getPlayer());
                    break;
                case 
    ARAN_COMBO:
                    
    PlayerHandler.AranCombo(cc.getPlayer(), 1);
                    break;
                case 
    SKILL_MACRO:
                    
    PlayerHandler.ChangeSkillMacro(sleac.getPlayer());
                    break;
                case 
    GIVE_FAME:
                    
    PlayersHandler.GiveFame(sleacc.getPlayer());
                    break;
                case 
    TRANSFORM_PLAYER:
                    
    PlayersHandler.TransformPlayer(sleacc.getPlayer());
                    break;
                case 
    NOTE_ACTION:
                    
    PlayersHandler.Note(sleac.getPlayer());
                    break;
                case 
    USE_DOOR:
                    
    PlayersHandler.UseDoor(sleac.getPlayer());
                    break;
                case 
    USE_MECH_DOOR:
                    
    PlayersHandler.UseMechDoor(sleac.getPlayer());
                    break;
                case 
    DAMAGE_REACTOR:
                    
    PlayersHandler.HitReactor(sleac);
                    break;
                case 
    CLICK_REACTOR:
                case 
    TOUCH_REACTOR:
                    
    PlayersHandler.TouchReactor(sleac);
                    break;
                case 
    CLOSE_CHALKBOARD:
                    
    c.getPlayer().setChalkboard(null);
                    break;
                case 
    ITEM_SORT:
                    
    InventoryHandler.ItemSort(sleac);
                    break;
                case 
    ITEM_GATHER:
                    
    InventoryHandler.ItemGather(sleac);
                    break;
                case 
    ITEM_MOVE:
                    
    InventoryHandler.ItemMove(sleac);
                    break;
                case 
    MOVE_BAG:
                    
    InventoryHandler.MoveBag(sleac);
                    break;
                case 
    SWITCH_BAG:
                    
    InventoryHandler.SwitchBag(sleac);
                    break;
                case 
    ITEM_MAKER:
                    
    ItemMakerHandler.ItemMaker(sleac);
                    break;
                case 
    ITEM_PICKUP:
                    
    InventoryHandler.Pickup_Player(sleacc.getPlayer());
                    break;
                case 
    USE_CASH_ITEM:
                    
    InventoryHandler.UseCashItem(sleac);
                    break;
                case 
    USE_ITEM:
                    
    InventoryHandler.UseItem(sleacc.getPlayer());
                    break;
                case 
    USE_COSMETIC:
                    
    InventoryHandler.UseCosmetic(sleacc.getPlayer());
                    break;
                case 
    USE_MAGNIFY_GLASS:
                    
    InventoryHandler.UseMagnify(sleac);
                    break;
                case 
    USE_SCRIPTED_NPC_ITEM:
                    
    InventoryHandler.UseScriptedNPCItem(sleacc.getPlayer());
                    break;
                case 
    USE_RETURN_SCROLL:
                    
    InventoryHandler.UseReturnScroll(sleacc.getPlayer());
                    break;
                case 
    USE_NEBULITE:
                    
    InventoryHandler.UseNebulite(sleac);
                    break;
                case 
    USE_ALIEN_SOCKET:
                    
    InventoryHandler.UseAlienSocket(sleac);
                    break;
                case 
    USE_ALIEN_SOCKET_RESPONSE:
                    
    slea.skip(4); // all 0
                    
    c.getSession().write(MTSCSPacket.useAlienSocket(false));
                    break;
                case 
    VICIOUS_HAMMER:
                    
    slea.skip(4); // 3F 00 00 00
                    
    slea.skip(4); // all 0
                    
    c.getSession().write(MTSCSPacket.ViciousHammer(false0));
                    break;
                case 
    USE_NEBULITE_FUSION:
                    
    InventoryHandler.UseNebuliteFusion(sleac);
                    break;
                case 
    USE_UPGRADE_SCROLL:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    InventoryHandler.UseUpgradeScroll(slea.readShort(), slea.readShort(), slea.readShort(), cc.getPlayer(), slea.readByte() > 0);
                    break;
                case 
    USE_FLAG_SCROLL:
                case 
    USE_POTENTIAL_SCROLL:
                case 
    USE_EQUIP_SCROLL:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    InventoryHandler.UseUpgradeScroll(slea.readShort(), slea.readShort(), (short0cc.getPlayer(), slea.readByte() > 0);
                    break;
                case 
    USE_SUMMON_BAG:
                    
    InventoryHandler.UseSummonBag(sleacc.getPlayer());
                    break;
                case 
    USE_TREASURE_CHEST:
                    
    InventoryHandler.UseTreasureChest(sleacc.getPlayer());
                    break;
                case 
    USE_SKILL_BOOK:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    InventoryHandler.UseSkillBook((byteslea.readShort(), slea.readInt(), cc.getPlayer());
                    break;
                case 
    USE_CATCH_ITEM:
                    
    InventoryHandler.UseCatchItem(sleacc.getPlayer());
                    break;
                case 
    USE_MOUNT_FOOD:
                    
    InventoryHandler.UseMountFood(sleacc.getPlayer());
                    break;
                case 
    REWARD_ITEM:
                    
    InventoryHandler.UseRewardItem((byteslea.readShort(), slea.readInt(), cc.getPlayer());
                    break;
                case 
    HYPNOTIZE_DMG:
                    
    MobHandler.HypnotizeDmg(sleac.getPlayer());
                    break;
                case 
    MOB_NODE:
                    
    MobHandler.MobNode(sleac.getPlayer());
                    break;
                case 
    DISPLAY_NODE:
                    
    MobHandler.DisplayNode(sleac.getPlayer());
                    break;
                case 
    MOVE_LIFE:
                    
    MobHandler.MoveMonster(sleacc.getPlayer());
                    break;
                case 
    AUTO_AGGRO:
                    
    MobHandler.AutoAggro(slea.readInt(), c.getPlayer());
                    break;
                case 
    FRIENDLY_DAMAGE:
                    
    MobHandler.FriendlyDamage(sleac.getPlayer());
                    break;
                case 
    REISSUE_MEDAL:
                    
    PlayerHandler.ReIssueMedal(sleacc.getPlayer());
                    break;
                case 
    MONSTER_BOMB:
                    
    MobHandler.MonsterBomb(slea.readInt(), c.getPlayer());
                    break;
                case 
    MOB_BOMB:
                    
    MobHandler.MobBomb(sleac.getPlayer());
                    break;
                case 
    NPC_SHOP:
                    
    NPCHandler.NPCShop(sleacc.getPlayer());
                    break;
                case 
    NPC_TALK:
                    
    NPCHandler.NPCTalk(sleacc.getPlayer());
                    break;
                case 
    NPC_TALK_MORE:
                    
    NPCHandler.NPCMoreTalk(sleac);
                    break;
                case 
    NPC_ACTION:
                    
    NPCHandler.NPCAnimation(sleac);
                    break;
                case 
    QUEST_ACTION:
                    
    NPCHandler.QuestAction(sleacc.getPlayer());
                    break;
                case 
    STORAGE:
                    
    NPCHandler.Storage(sleacc.getPlayer());
                    break;
                case 
    GENERAL_CHAT:
                    if (
    c.getPlayer() != null && c.getPlayer().getMap() != null) {
                        
    c.getPlayer().updateTick(slea.readInt());
                        
    ChatHandler.GeneralChat(slea.readMapleAsciiString(), slea.readByte(), cc.getPlayer());
                    }
                    break;
                case 
    PARTYCHAT:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    ChatHandler.Others(sleacc.getPlayer());
                    break;
                case 
    WHISPER:
                    
    ChatHandler.Whisper_Find(sleac);
                    break;
                case 
    MESSENGER:
                    
    ChatHandler.Messenger(sleac);
                    break;
                case 
    AUTO_ASSIGN_AP:
                    
    StatsHandling.AutoAssignAP(sleacc.getPlayer());
                    break;
                case 
    DISTRIBUTE_AP:
                    
    StatsHandling.DistributeAP(sleacc.getPlayer());
                    break;
                case 
    DISTRIBUTE_SP:
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    StatsHandling.DistributeSP(slea.readInt(), cc.getPlayer());
                    break;
                case 
    PLAYER_INTERACTION:
                    
    PlayerInteractionHandler.PlayerInteraction(sleacc.getPlayer());
                    break;
                case 
    GUILD_OPERATION:
                    
    GuildHandler.Guild(sleac);
                    break;
                case 
    DENY_GUILD_REQUEST:
                    
    slea.skip(1);
                    
    GuildHandler.DenyGuildRequest(slea.readMapleAsciiString(), c);
                    break;
                case 
    ALLIANCE_OPERATION:
                    
    AllianceHandler.HandleAlliance(sleacfalse);
                    break;
                case 
    DENY_ALLIANCE_REQUEST:
                    
    AllianceHandler.HandleAlliance(sleactrue);
                    break;
                case 
    PUBLIC_NPC:
                    
    NPCHandler.OpenPublicNpc(sleac);
                    break;
                case 
    BBS_OPERATION:
                    
    BBSHandler.BBSOperation(sleac);
                    break;
                case 
    PARTY_OPERATION:
                    
    PartyHandler.PartyOperation(sleac);
                    break;
                case 
    DENY_PARTY_REQUEST:
                    
    PartyHandler.DenyPartyRequest(sleac);
                    break;
                case 
    ALLOW_PARTY_INVITE:
                    
    PartyHandler.AllowPartyInvite(sleac);
                    break;
                case 
    BUDDYLIST_MODIFY:
                    
    BuddyListHandler.BuddyOperation(sleac);
                    break;
                case 
    CYGNUS_SUMMON:
                    
    UserInterfaceHandler.CygnusSummon_NPCRequest(c);
                    break;
                case 
    SHIP_OBJECT:
                    
    UserInterfaceHandler.ShipObjectRequest(slea.readInt(), c);
                    break;
                case 
    BUY_CS_ITEM:
                    
    CashShopOperation.BuyCashItem(sleacc.getPlayer());
                    break;
                case 
    COUPON_CODE:
                    
    //FileoutputUtil.log(FileoutputUtil.PacketEx_Log, "Coupon : \n" + slea.toString(true));
                    //System.out.println(slea.toString());
                    //CashShopOperation.CouponCode(slea.readMapleAsciiString(), c);
                    
    c.getSession().write(MTSCSPacket.showOneADayInfo(true10003055));
                    
    CashShopOperation.doCSPackets(c);
                    break;
                case 
    TWIN_DRAGON_EGG:
                    
    System.out.println("TWIN_DRAGON_EGG: " slea.toString());
                    final 
    CashItemInfo item CashItemFactory.getInstance().getItem(10003055);
                    
    Item itemz c.getPlayer().getCashInventory().toItem(item);
                    
    c.getSession().write(MTSCSPacket.sendTwinDragonEgg(truetrue38itemz1));
                    break;
                case 
    XMAS_SURPRISE:
                    
    System.out.println("XMAS_SURPRISE: " slea.toString());
                    break;
                case 
    CS_UPDATE:
                    
    CashShopOperation.CSUpdate(c);
                    break;
                case 
    TOUCHING_MTS:
                    
    MTSOperation.MTSUpdate(MTSStorage.getInstance().getCart(c.getPlayer().getId()), c);
                    break;
                case 
    MTS_TAB:
                    
    MTSOperation.MTSOperation(sleac);
                    break;
                case 
    USE_POT:
                    
    ItemMakerHandler.UsePot(sleac);
                    break;
                case 
    CLEAR_POT:
                    
    ItemMakerHandler.ClearPot(sleac);
                    break;
                case 
    FEED_POT:
                    
    ItemMakerHandler.FeedPot(sleac);
                    break;
                case 
    CURE_POT:
                    
    ItemMakerHandler.CurePot(sleac);
                    break;
                case 
    REWARD_POT:
                    
    ItemMakerHandler.RewardPot(sleac);
                    break;
                case 
    DAMAGE_SUMMON:
                    
    slea.skip(4);
                    
    SummonHandler.DamageSummon(sleac.getPlayer());
                    break;
                case 
    MOVE_SUMMON:
                    
    SummonHandler.MoveSummon(sleac.getPlayer());
                    break;
                case 
    SUMMON_ATTACK:
                    
    SummonHandler.SummonAttack(sleacc.getPlayer());
                    break;
                case 
    MOVE_DRAGON:
                    
    SummonHandler.MoveDragon(sleac.getPlayer());
                    break;
                case 
    SUB_SUMMON:
                    
    SummonHandler.SubSummon(sleac.getPlayer());
                    break;
                case 
    REMOVE_SUMMON:
                    
    SummonHandler.RemoveSummon(sleac);
                    break;
                case 
    SPAWN_PET:
                    
    PetHandler.SpawnPet(sleacc.getPlayer());
                    break;
                case 
    MOVE_PET:
                    
    PetHandler.MovePet(sleac.getPlayer());
                    break;
                case 
    PET_CHAT:
                    
    //System.out.println("Pet chat: " + slea.toString());
                    
    if (slea.available() < 12) {
                        break;
                    }
                    final 
    int petid GameConstants.GMS c.getPlayer().getPetIndex((int) slea.readLong()) : slea.readInt();
                    
    c.getPlayer().updateTick(slea.readInt());
                    
    PetHandler.PetChat(petidslea.readShort(), slea.readMapleAsciiString(), c.getPlayer());
                    break;
                case 
    PET_COMMAND:
                    
    MaplePet pet null;
                    if (
    GameConstants.GMS) {
                        
    pet c.getPlayer().getPet(c.getPlayer().getPetIndex((int) slea.readLong()));
                    } else {
                        
    pet c.getPlayer().getPet((byteslea.readInt());
                    }
                    
    slea.readByte(); //always 0?
                    
    if (pet == null) {
                        return;
                    }
                    
    PetHandler.PetCommand(petPetDataFactory.getPetCommand(pet.getPetItemId(), slea.readByte()), cc.getPlayer());
                    break;
                case 
    PET_FOOD:
                    
    PetHandler.PetFood(sleacc.getPlayer());
                    break;
                case 
    PET_LOOT:
                    
    InventoryHandler.Pickup_Pet(sleacc.getPlayer());
                    break;
                case 
    PET_AUTO_POT:
                    
    PetHandler.Pet_AutoPotion(sleacc.getPlayer());
                    break;
                case 
    MONSTER_CARNIVAL:
                    
    MonsterCarnivalHandler.MonsterCarnival(sleac);
                    break;
                case 
    DUEY_ACTION:
                    
    DueyHandler.DueyOperation(sleac);
                    break;
                case 
    USE_HIRED_MERCHANT:
                    
    HiredMerchantHandler.UseHiredMerchant(ctrue);
                    break;
                case 
    MERCH_ITEM_STORE:
                    
    HiredMerchantHandler.MerchantItemStore(sleac);
                    break;
                case 
    CANCEL_DEBUFF:
                    
    // Ignore for now
                    
    break;
                case 
    MAPLETV:
                    break;
                case 
    LEFT_KNOCK_BACK:
                    
    PlayerHandler.leftKnockBack(sleac);
                    break;
                case 
    SNOWBALL:
                    
    PlayerHandler.snowBall(sleac);
                    break;
                case 
    COCONUT:
                    
    PlayersHandler.hitCoconut(sleac);
                    break;
                case 
    REPAIR:
                    
    NPCHandler.repair(sleac);
                    break;
                case 
    REPAIR_ALL:
                    
    NPCHandler.repairAll(c);
                    break;
                case 
    GAME_POLL:
                    
    UserInterfaceHandler.InGame_Poll(sleac);
                    break;
                case 
    OWL:
                    
    InventoryHandler.Owl(sleac);
                    break;
                case 
    OWL_WARP:
                    
    InventoryHandler.OwlWarp(sleac);
                    break;
                case 
    USE_OWL_MINERVA:
                    
    InventoryHandler.OwlMinerva(sleac);
                    break;
                case 
    RPS_GAME:
                    
    NPCHandler.RPSGame(sleac);
                    break;
                case 
    UPDATE_QUEST:
                    
    NPCHandler.UpdateQuest(sleac);
                    break;
                case 
    USE_ITEM_QUEST:
                    
    NPCHandler.UseItemQuest(sleac);
                    break;
                case 
    FOLLOW_REQUEST:
                    
    PlayersHandler.FollowRequest(sleac);
                    break;
                case 
    AUTO_FOLLOW_REPLY:
                case 
    FOLLOW_REPLY:
                    
    PlayersHandler.FollowReply(sleac);
                    break;
                case 
    RING_ACTION:
                    
    PlayersHandler.RingAction(sleac);
                    break;
                case 
    REQUEST_FAMILY:
                    
    FamilyHandler.RequestFamily(sleac);
                    break;
                case 
    OPEN_FAMILY:
                    
    FamilyHandler.OpenFamily(sleac);
                    break;
                case 
    FAMILY_OPERATION:
                    
    FamilyHandler.FamilyOperation(sleac);
                    break;
                case 
    DELETE_JUNIOR:
                    
    FamilyHandler.DeleteJunior(sleac);
                    break;
                case 
    DELETE_SENIOR:
                    
    FamilyHandler.DeleteSenior(sleac);
                    break;
                case 
    USE_FAMILY:
                    
    FamilyHandler.UseFamily(sleac);
                    break;
                case 
    FAMILY_PRECEPT:
                    
    FamilyHandler.FamilyPrecept(sleac);
                    break;
                case 
    FAMILY_SUMMON:
                    
    FamilyHandler.FamilySummon(sleac);
                    break;
                case 
    ACCEPT_FAMILY:
                    
    FamilyHandler.AcceptFamily(sleac);
                    break;
                case 
    SOLOMON:
                    
    PlayersHandler.Solomon(sleac);
                    break;
                case 
    GACH_EXP:
                    
    PlayersHandler.GachExp(sleac);
                    break;
                case 
    PARTY_SEARCH_START:
                    
    PartyHandler.MemberSearch(sleac);
                    break;
                case 
    PARTY_SEARCH_STOP:
                    
    PartyHandler.PartySearch(sleac);
                    break;
                case 
    EXPEDITION_LISTING:
                    
    PartyHandler.PartyListing(sleac);
                    break;
                case 
    EXPEDITION_OPERATION:
                    
    PartyHandler.Expedition(sleac);
                    break;
                case 
    USE_TELE_ROCK:
                    
    InventoryHandler.TeleRock(sleac);
                    break;
                case 
    PAM_SONG:
                    
    InventoryHandler.PamSong(sleac);
                    break;
                case 
    REPORT:
                    
    PlayersHandler.Report(sleac);
                    break;
                case 
    CANCEL_OUT_SWIPE:
                    
    slea.readInt();
                    break;
                case 
    VIEW_SKILLS:
                    
    PlayersHandler.viewSkills(sleac);
                    break;
                case 
    SKILL_SWIPE:
                    
    PlayersHandler.updateStolenSkill(sleac);
                    break;
                case 
    MAGIC_WHEEL:
                    
    System.out.println("[MAGIC_WHEEL] [" slea.toString() + "]");
                    final 
    byte mode slea.readByte(); // 0 = open, 2 = start.
                    
    if (mode == 2) {
                        final 
    int idk slea.readInt(); // 4? o.o
                        
    final short toUseSlot = (shortslea.readInt();
                        final 
    int tokenId slea.readInt();
                    }
                    break;
                default:
                    
    System.out.println("[UNHANDLED] Recv [" header.toString() + "] found");
                    break;
            }
        }

    Channelserver.java
    PHP Code:
    /*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 ~ 2010 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 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 handling.channel;

    import client.MapleCharacter;
    import constants.GameConstants;
    import constants.ServerConstants;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.util.Collection;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.Map.Entry;

    import handling.MapleServerHandler;
    import handling.login.LoginServer;
    import handling.mina.MapleCodecFactory;
    import handling.world.CheaterData;
    import java.util.concurrent.locks.ReentrantReadWriteLock;
    import scripting.EventScriptManager;
    import server.MapleSquad;
    import server.MapleSquad.MapleSquadType;
    import server.maps.MapleMapFactory;
    import server.shops.HiredMerchant;
    import server.life.PlayerNPC;

    import org.apache.mina.common.ByteBuffer;
    import org.apache.mina.common.SimpleByteBufferAllocator;
    import org.apache.mina.common.IoAcceptor;
    import org.apache.mina.filter.codec.ProtocolCodecFilter;
    import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
    import org.apache.mina.transport.socket.nio.SocketAcceptor;
    import java.util.ArrayList;
    import java.util.EnumMap;
    import java.util.HashSet;
    import java.util.Set;
    import server.ServerProperties;
    import server.events.*;
    import server.maps.AramiaFireWorks;
    import server.maps.MapleMapObject;
    import tools.ConcurrentEnumMap;
    import tools.packet.CWvsContext;

    public class 
    ChannelServer {

        public static 
    long serverStartTime;
        public 
    int eventMap 0;
        private 
    int expRatemesoRatedropRate 2dropRate2 3cashRate 3traitRate 3;
        private 
    short port 8585;
        private static final 
    short DEFAULT_PORT 8585;
        private 
    int channelrunning_MerchantID 0flags 0;
        private 
    String serverMessageipserverName;
        private 
    boolean shutdown falsefinishedShutdown falseMegaphoneMuteState falseadminOnly false;
        private 
    PlayerStorage players;
        private 
    IoAcceptor acceptor;
        private final 
    MapleMapFactory mapFactory;
        private 
    EventScriptManager eventSM;
        private 
    AramiaFireWorks works = new AramiaFireWorks();
        private static final 
    Map<IntegerChannelServerinstances = new HashMap<IntegerChannelServer>();
        private final 
    Map<MapleSquadTypeMapleSquadmapleSquads = new ConcurrentEnumMap<MapleSquadTypeMapleSquad>(MapleSquadType.class);
        private final 
    Map<IntegerHiredMerchantmerchants = new HashMap<IntegerHiredMerchant>();
        private final List<
    PlayerNPCplayerNPCs = new LinkedList<PlayerNPC>();
        private final 
    ReentrantReadWriteLock merchLock = new ReentrantReadWriteLock(); //merchant
       
    public boolean eventOn false;
     
       private 
    int eventmap = -1;
        private final 
    Map<MapleEventTypeMapleEventevents = new EnumMap<MapleEventTypeMapleEvent>(MapleEventType.class);

        private 
    ChannelServer(final int channel) {
            
    this.channel channel;
            
    mapFactory = new MapleMapFactory(channel);
        }

        public static 
    Set<IntegergetAllInstance() {
            return new 
    HashSet<Integer>(instances.keySet());
        }

        public final 
    void loadEvents() {
            if (
    events.size() != 0) {
                return;
            }
            
    events.put(MapleEventType.CokePlay, new MapleCoconut(channelMapleEventType.CokePlay)); //yep, coconut. same shit
            
    events.put(MapleEventType.Coconut, new MapleCoconut(channelMapleEventType.Coconut));
            
    events.put(MapleEventType.Fitness, new MapleFitness(channelMapleEventType.Fitness));
            
    events.put(MapleEventType.OlaOla, new MapleOla(channelMapleEventType.OlaOla));
            
    events.put(MapleEventType.OxQuiz, new MapleOxQuiz(channelMapleEventType.OxQuiz));
            
    events.put(MapleEventType.Snowball, new MapleSnowball(channelMapleEventType.Snowball));
            
    events.put(MapleEventType.Survival, new MapleSurvival(channelMapleEventType.Survival));
        }

        public final 
    void run_startup_configurations() {
            
    setChannel(channel); //instances.put
            
    try {
               
            
            
                    
    expRate Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.exp"));
            
             
                
    mesoRate Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.meso"));
                
    serverMessage ServerProperties.getProperty("net.sf.odinms.world.serverMessage");
                
    serverName ServerProperties.getProperty("net.sf.odinms.login.serverName");
                
    flags Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.flags""0"));
                
    adminOnly Boolean.parseBoolean(ServerProperties.getProperty("net.sf.odinms.world.admin""false"));
                
    eventSM = new EventScriptManager(thisServerProperties.getProperty("net.sf.odinms.channel.events").split(","));
                
    port Short.parseShort(ServerProperties.getProperty("net.sf.odinms.channel.net.port" channelString.valueOf(DEFAULT_PORT channel)));
            } catch (
    Exception e) {
                throw new 
    RuntimeException(e);
            }
            
    ip ServerProperties.getProperty("net.sf.odinms.channel.net.interface") + ":" port;

            
    ByteBuffer.setUseDirectBuffers(false);
            
    ByteBuffer.setAllocator(new SimpleByteBufferAllocator());

            
    acceptor = new SocketAcceptor();
            final 
    SocketAcceptorConfig acceptor_config = new SocketAcceptorConfig();
            
    acceptor_config.getSessionConfig().setTcpNoDelay(true);
            
    acceptor_config.setDisconnectOnUnbind(true);
            
    acceptor_config.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
            
    players = new PlayerStorage(channel);
            
    loadEvents();

            try {
                
    acceptor.bind(new InetSocketAddress(port), new MapleServerHandler(channelfalse), acceptor_config);
                
    System.out.println("Channel " channel ": Listening on port " port "");
                
    eventSM.init();
            } catch (
    IOException e) {
                
    System.out.println("Binding to port " port " failed (ch: " getChannel() + ")" e);
            }
        }

        public final 
    void shutdown() {
            if (
    finishedShutdown) {
                return;
            }
            
    broadcastPacket(CWvsContext.serverNotice(0"This channel will now shut down."));
            
    // dc all clients by hand so we get sessionClosed...
            
    shutdown true;

            
    System.out.println("Channel " channel ", Saving characters...");

            
    getPlayerStorage().disconnectAll();

            
    System.out.println("Channel " channel ", Unbinding...");

            
    acceptor.unbindAll();
            
    acceptor null;

            
    //temporary while we dont have !addchannel
            
    instances.remove(channel);
            
    setFinishShutdown();
        }

        public final 
    void unbind() {
            
    acceptor.unbindAll();
        }

        public final 
    boolean hasFinishedShutdown() {
            return 
    finishedShutdown;
        }

        public final 
    MapleMapFactory getMapFactory() {
            return 
    mapFactory;
        }

        public static final 
    ChannelServer newInstance(final int channel) {
            return new 
    ChannelServer(channel);
        }

        public static final 
    ChannelServer getInstance(final int channel) {
            return 
    instances.get(channel);
        }

        public final 
    void addPlayer(final MapleCharacter chr) {
            
    getPlayerStorage().registerPlayer(chr);
        }

        public final 
    PlayerStorage getPlayerStorage() {
            if (
    players == null) { //wth
                
    players = new PlayerStorage(channel); //wthhhh
            
    }
            return 
    players;
        }
     public 
    void setEventMap(int id){
            
    this.eventMap id;
        }
        public 
    int getEventMap(){
            return 
    this.eventMap;
        }
        public final 
    void removePlayer(final MapleCharacter chr) {
            
    getPlayerStorage().deregisterPlayer(chr);

        }

        public final 
    void removePlayer(final int idz, final String namez) {
            
    getPlayerStorage().deregisterPlayer(idznamez);

        }

        public final 
    String getServerMessage() {
            return 
    serverMessage;
        }

        public final 
    void setServerMessage(final String newMessage) {
            
    serverMessage newMessage;
            
    broadcastPacket(CWvsContext.serverMessage(serverMessage));
        }

        public final 
    void broadcastPacket(final byte[] data) {
            
    getPlayerStorage().broadcastPacket(data);
        }

        public final 
    void broadcastSmegaPacket(final byte[] data) {
            
    getPlayerStorage().broadcastSmegaPacket(data);
        }

        public final 
    void broadcastGMPacket(final byte[] data) {
            
    getPlayerStorage().broadcastGMPacket(data);
        }

        public final 
    int getExpRate() {
            return 
    expRate;
        }

        public final 
    void setExpRate(final int expRate) {
            
    this.expRate expRate;
        }

        public final 
    int getCashRate() {
            return 
    cashRate;
        }

        public final 
    int getChannel() {
            return 
    channel;
        }

        public final 
    void setChannel(final int channel) {
            
    instances.put(channelthis);
            
    LoginServer.addChannel(channel);
        }

        public static final 
    ArrayList<ChannelServergetAllInstances() {
            return new 
    ArrayList<ChannelServer>(instances.values());
        }

        public final 
    String getIP() {
            return 
    ip;
        }

        public final 
    boolean isShutdown() {
            return 
    shutdown;
        }

        public final 
    int getLoadedMaps() {
            return 
    mapFactory.getLoadedMaps();
        }

        public final 
    EventScriptManager getEventSM() {
            return 
    eventSM;
        }

        public final 
    void reloadEvents() {
            
    eventSM.cancel();
            
    eventSM = new EventScriptManager(thisServerProperties.getProperty("net.sf.odinms.channel.events").split(","));
            
    eventSM.init();
        }

        public final 
    int getMesoRate() {
            return 
    mesoRate;
        }

        public final 
    void setMesoRate(final int mesoRate) {
            
    this.mesoRate mesoRate;
        }

        public final 
    int getDropRate() {
         
            return 
    dropRate;
          
        
        }
        public final 
    int getDropRate2() {
         
            return 
    dropRate2;
          
        
        }
       
        

        public static final 
    void startChannel_Main() {
            
    serverStartTime System.currentTimeMillis();

            for (
    int i 0Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.channel.count""0")); i++) {
                
    newInstance(1).run_startup_configurations();
            }
        }

        public 
    Map<MapleSquadTypeMapleSquadgetAllSquads() {
            return 
    Collections.unmodifiableMap(mapleSquads);
        }

        public final 
    MapleSquad getMapleSquad(final String type) {
            return 
    getMapleSquad(MapleSquadType.valueOf(type.toLowerCase()));
        }

        public final 
    MapleSquad getMapleSquad(final MapleSquadType type) {
            return 
    mapleSquads.get(type);
        }

        public final 
    boolean addMapleSquad(final MapleSquad squad, final String type) {
            final 
    MapleSquadType types MapleSquadType.valueOf(type.toLowerCase());
            if (
    types != null && !mapleSquads.containsKey(types)) {
                
    mapleSquads.put(typessquad);
                
    squad.scheduleRemoval();
                return 
    true;
            }
            return 
    false;
        }

        public final 
    boolean removeMapleSquad(final MapleSquadType types) {
            if (
    types != null && mapleSquads.containsKey(types)) {
                
    mapleSquads.remove(types);
                return 
    true;
            }
            return 
    false;
        }

        public final 
    int closeAllMerchant() {
            
    int ret 0;
            
    merchLock.writeLock().lock();
            try {
                final 
    Iterator<Entry<IntegerHiredMerchant>> merchants_ merchants.entrySet().iterator();
                while (
    merchants_.hasNext()) {
                    
    HiredMerchant hm merchants_.next().getValue();
                    
    hm.closeShop(truefalse);
                    
    //HiredMerchantSave.QueueShopForSave(hm);
                    
    hm.getMap().removeMapObject(hm);
                    
    merchants_.remove();
                    
    ret++;
                }
            } finally {
                
    merchLock.writeLock().unlock();
            }
            
    //hacky
            
    for (int i 910000001<= 910000022i++) {
                for (
    MapleMapObject mmo mapFactory.getMap(i).getAllHiredMerchantsThreadsafe()) {
                    ((
    HiredMerchantmmo).closeShop(truefalse);
                    
    //HiredMerchantSave.QueueShopForSave((HiredMerchant) mmo);
                    
    ret++;
                }
            }
            return 
    ret;
        }

        public final 
    int addMerchant(final HiredMerchant hMerchant) {
            
    merchLock.writeLock().lock();
            try {
                
    running_MerchantID++;
                
    merchants.put(running_MerchantIDhMerchant);
                return 
    running_MerchantID;
            } finally {
                
    merchLock.writeLock().unlock();
            }
        }

        public final 
    void removeMerchant(final HiredMerchant hMerchant) {
            
    merchLock.writeLock().lock();

            try {
                
    merchants.remove(hMerchant.getStoreId());
            } finally {
                
    merchLock.writeLock().unlock();
            }
        }

        public final 
    boolean containsMerchant(final int accidint cid) {
            
    boolean contains false;

            
    merchLock.readLock().lock();
            try {
                final 
    Iterator itr merchants.values().iterator();

                while (
    itr.hasNext()) {
                    
    HiredMerchant hm = (HiredMerchantitr.next();
                    if (
    hm.getOwnerAccId() == accid || hm.getOwnerId() == cid) {
                        
    contains true;
                        break;
                    }
                }
            } finally {
                
    merchLock.readLock().unlock();
            }
            return 
    contains;
        }

        public final List<
    HiredMerchantsearchMerchant(final int itemSearch) {
            final List<
    HiredMerchant> list = new LinkedList<HiredMerchant>();
            
    merchLock.readLock().lock();
            try {
                final 
    Iterator itr merchants.values().iterator();

                while (
    itr.hasNext()) {
                    
    HiredMerchant hm = (HiredMerchantitr.next();
                    if (
    hm.searchItem(itemSearch).size() > 0) {
                        list.
    add(hm);
                    }
                }
            } finally {
                
    merchLock.readLock().unlock();
            }
            return list;
        }

        public final 
    void toggleMegaphoneMuteState() {
            
    this.MegaphoneMuteState = !this.MegaphoneMuteState;
        }

        public final 
    boolean getMegaphoneMuteState() {
            return 
    MegaphoneMuteState;
        }

        public 
    int getEvent() {
            return 
    eventmap;
        }

        public final 
    void setEvent(final int ze) {
            
    this.eventmap ze;
        }

        public 
    MapleEvent getEvent(final MapleEventType t) {
            return 
    events.get(t);
        }

        public final 
    Collection<PlayerNPCgetAllPlayerNPC() {
            return 
    playerNPCs;
        }

        public final 
    void addPlayerNPC(final PlayerNPC npc) {
            if (
    playerNPCs.contains(npc)) {
                return;
            }
            
    playerNPCs.add(npc);
            
    getMapFactory().getMap(npc.getMapId()).addMapObject(npc);
        }

        public final 
    void removePlayerNPC(final PlayerNPC npc) {
            if (
    playerNPCs.contains(npc)) {
                
    playerNPCs.remove(npc);
                
    getMapFactory().getMap(npc.getMapId()).removeMapObject(npc);
            }
        }

        public final 
    String getServerName() {
            return 
    serverName;
        }

        public final 
    void setServerName(final String sn) {
            
    this.serverName sn;
        }

        public final 
    String getTrueServerName() {
            return 
    serverName.substring(0serverName.length() - (GameConstants.GMS 3));
        }

        public final 
    int getPort() {
            return 
    port;
        }

        public static final 
    Set<IntegergetChannelServer() {
            return new 
    HashSet<Integer>(instances.keySet());
        }

        public final 
    void setShutdown() {
            
    this.shutdown true;
            
    System.out.println("Channel " channel " has set to shutdown and is closing Hired Merchants...");
        }

        public final 
    void setFinishShutdown() {
            
    this.finishedShutdown true;
            
    System.out.println("Channel " channel " has finished shutdown.");
        }

        public final 
    boolean isAdminOnly() {
            return 
    adminOnly;
        }

        public final static 
    int getChannelCount() {
            return 
    instances.size();
        }

        public final 
    int getTempFlag() {
            return 
    flags;
        }

        public static 
    Map<IntegerIntegergetChannelLoad() {
            
    Map<IntegerIntegerret = new HashMap<IntegerInteger>();
            for (
    ChannelServer cs instances.values()) {
                
    ret.put(cs.getChannel(), cs.getConnectedClients());
            }
            return 
    ret;
        }

        public 
    int getConnectedClients() {
            return 
    getPlayerStorage().getConnectedClients();
        }

        public List<
    CheaterDatagetCheaters() {
            List<
    CheaterDatacheaters getPlayerStorage().getCheaters();

            
    Collections.sort(cheaters);
            return 
    cheaters;
        }

        public List<
    CheaterDatagetReports() {
            List<
    CheaterDatacheaters getPlayerStorage().getReports();

            
    Collections.sort(cheaters);
            return 
    cheaters;
        }

        public 
    void broadcastMessage(byte[] message) {
            
    broadcastPacket(message);
        }

        public 
    void broadcastSmega(byte[] message) {
            
    broadcastSmegaPacket(message);
        }

        public 
    void broadcastGMMessage(byte[] message) {
            
    broadcastGMPacket(message);
        }

        public 
    AramiaFireWorks getFireWorks() {
            return 
    works;
        }

        public 
    int getTraitRate() {
            return 
    traitRate;
        }

    Cashshopserver.java
    PHP Code:
    /*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 ~ 2010 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 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 handling.cashshop;

    import java.net.InetSocketAddress;

    import handling.MapleServerHandler;
    import handling.channel.PlayerStorage;
    import handling.mina.MapleCodecFactory;
    import org.apache.mina.common.ByteBuffer;
    import org.apache.mina.common.SimpleByteBufferAllocator;
    import org.apache.mina.common.IoAcceptor;

    import org.apache.mina.filter.codec.ProtocolCodecFilter;
    import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
    import org.apache.mina.transport.socket.nio.SocketAcceptor;
    import server.MTSStorage;
    import server.ServerProperties;

    public class 
    CashShopServer {

        private static 
    String ip;
        private static 
    InetSocketAddress InetSocketadd;
        private final static 
    int PORT 8600;
        private static 
    IoAcceptor acceptor;
        private static 
    PlayerStorage playersplayersMTS;
        private static 
    boolean finishedShutdown false;

        public static final 
    void run_startup_configurations() {
            
    ip ServerProperties.getProperty("net.sf.odinms.world.host") + ":" PORT;

            
    ByteBuffer.setUseDirectBuffers(false);
            
    ByteBuffer.setAllocator(new SimpleByteBufferAllocator());

            
    acceptor = new SocketAcceptor();
            final 
    SocketAcceptorConfig cfg = new SocketAcceptorConfig();
            
    cfg.getSessionConfig().setTcpNoDelay(true);
            
    cfg.setDisconnectOnUnbind(true);
            
    cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
            
    players = new PlayerStorage(-10);
            
    playersMTS = new PlayerStorage(-20);

            try {
                
    InetSocketadd = new InetSocketAddress(PORT);
                
    acceptor.bind(InetSocketadd, new MapleServerHandler(-1true), cfg);
                
    System.out.println("Listening on port " PORT ".");
            } catch (final 
    Exception e) {
                
    System.err.println("Binding to port " PORT " failed");
                
    e.printStackTrace();
                throw new 
    RuntimeException("Binding failed."e);
            }
        }

        public static final 
    String getIP() {
            return 
    ip;
        }

        public static final 
    PlayerStorage getPlayerStorage() {
            return 
    players;
        }

        public static final 
    PlayerStorage getPlayerStorageMTS() {
            return 
    playersMTS;
        }

        public static final 
    void shutdown() {
            if (
    finishedShutdown) {
                return;
            }
            
    System.out.println("Saving all connected clients (CS)...");
            
    players.disconnectAll();
        
    playersMTS.disconnectAll();
            
    MTSStorage.getInstance().saveBuyNow(true);
            
    System.out.println("Shutting down CS...");
        
    acceptor.unbindAll();
            
    finishedShutdown true;
        }

        public static 
    boolean isShutdown() {
        return 
    finishedShutdown;
        }

    And use the LIB files from Lithium source.
    Have fun bye
    Last edited by standeman; 20-08-12 at 04:30 PM. Reason: Thanks olly


  2. #2
    Account Inactive kkndqazwsx is offline
    InactiveRank
    Jun 2010 Join Date
    9Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Thank you teacher.

  3. #3
    Chaos is a ladder. AristoCat is offline
    True MemberRank
    Apr 2012 Join Date
    945Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    I was so happy when Riven1 deleted his post and now that thread came.....
    DIE LEECHERS

  4. #4
    Member ollydbg007 is offline
    MemberRank
    Jan 2012 Join Date
    32Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Quote Originally Posted by kkndqazwsx View Post
    Thank you teacher.
    Teacher LOL don't make me laugh.

    @standeman Dutch: Goed dat het je gelukt is om het op te lossen. Beetje jammer dat je het released, Al de noob leechers leren hier alleen niks van.

    Ow btw,
    And use the DIST files from Lithium source
    i'm causing you mean the lib files? If you would use the file in your dist folder you would have Lithium running xD
    Last edited by ollydbg007; 20-08-12 at 04:28 PM.

  5. #5
    Dream: Pro Coder :) standeman is offline
    True MemberRank
    Mar 2010 Join Date
    The NetherlandsLocation
    418Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Quote Originally Posted by ollydbg007 View Post
    Teacher LOL don't make me laugh.

    @standeman Dutch: Goed dat het je gelukt is om het op te lossen. Beetje jammer dat je het released, Al de noob leechers leren hier alleen niks van.

    Ow btw, i'm causing you mean the lib files? If you would use the file in your dist folder you would have Lithium running xD
    @ollydbg007 DUTCH: Bedankt :) Ja ik weet dat ze nu allemala gaan leechen. Mr vroeg of laat komt er toch altijd een release hoe je dit moet fixen. En bednakt voor de verbetering in mn topic heb t aangepast

  6. #6
    Member Loca is offline
    MemberRank
    Jul 2012 Join Date
    61Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    thanks bro !!

  7. #7
    Account Inactive Riven1 is offline
    InactiveRank
    Aug 2012 Join Date
    NetbeansLocation
    309Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Get ready for the v114 noob help requests!1!111!!1!1

  8. #8
    Account Upgraded | Title Enabled! Christmas is offline
    True MemberRank
    Feb 2009 Join Date
    338Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Quote Originally Posted by Riven1 View Post
    Get ready for the v114 noob help requests!1!111!!1!1
    It already started the day Xephyr came out.

  9. #9
    Dream: Pro Coder :) standeman is offline
    True MemberRank
    Mar 2010 Join Date
    The NetherlandsLocation
    418Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Thank you = like?

  10. #10
    Account Inactive xParkctical is offline
    InactiveRank
    Aug 2012 Join Date
    34Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Thank you

  11. #11
    Account Inactive CEO is offline
    InactiveRank
    Feb 2012 Join Date
    94Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Cash Shop still dc to desktop

  12. #12
    Intelligent DoucheBag jur13n is offline
    Alpha MaleRank
    Jan 2008 Join Date
    Zwolle, NetherlLocation
    1,955Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    omg i done this one hour before you posted it
    Hi I am Jurien Hamaker and I am an awesome web developer.

    Web service thread - Portfolio

  13. #13
    Dream: Pro Coder :) standeman is offline
    True MemberRank
    Mar 2010 Join Date
    The NetherlandsLocation
    418Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Quote Originally Posted by CEO View Post
    Cash Shop still dc to desktop
    Noob #1

  14. #14
    Registered Aandrew is offline
    MemberRank
    Aug 2012 Join Date
    11Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Lithium source.v111?

  15. #15
    jk. Burblish is offline
    True MemberRank
    Jul 2011 Join Date
    805Posts

    Re: Fix PIC DC to login screen :unable to logon gameserver -- Xephyr

    Well, what is Xephyr Based on? Lithium. Also, more than most of the servers are based on Lithium. So, what do you think? -.-




Page 1 of 3 123 LastLast

Advertisement