Change World Names

Results 1 to 15 of 15
  1. #1
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Change World Names

    Is it possible to change the world names order? For example, instead of Scania being the first server listed, Windia would be.

    In net.login.handler I have ServerlistRequestHandler.java

    Code:
    public final class ServerlistRequestHandler extends AbstractMaplePacketHandler {
        private static final String[] names = {"Scania", "Bera", "Broa", "Windia", "Khaini", "Bellocan", "Mardia", "Kradia", "Yellonde", "Demethos", "Elnido", "Kastia", "Judis", "Arkenia", "Plana", "Galicia", "Kalluna", "Stius", "Croa", "Zenith", "Medere"};
    I'm wondering if/where OdinMS has the number of worlds to be read and assigns an ID to each one, which would have the server image/icon. I don't think swapping "Scania" with "Winida" would do the trick. Or could you just not have Scania as the first server that's listed, changing the serverlist order?


  2. #2
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Change World Names

    That's the world name. Like when you /find it says 'NAME-1' e.g Bera-1.

    I never tried it because i've been working on more than one, but my start of it was at the serverlist. Upon getServerList packet is a serverId. You can try changing that id to 4 (Windia) and see if it'd work or not. Considering you could back on TitanMS dayz, I bet you could here too.

  3. #3
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    Quote Originally Posted by chunkarama View Post
    That's the world name. Like when you /find it says 'NAME-1' e.g Bera-1.

    I never tried it because i've been working on more than one, but my start of it was at the serverlist. Upon getServerList packet is a serverId. You can try changing that id to 4 (Windia) and see if it'd work or not. Considering you could back on TitanMS dayz, I bet you could here too.
    Ahh ok, I'm familiar with how /find showed the world name and channel number from MoopleDev. I'm using BubblesDev, and multi-world is not supported yet. So, getServerList in MaplePacketCreator:


    PHP Code:
        /**
         * Gets a packet detailing a server and its channels.
         *
         * [MENTION=1333357818]param[/MENTION] serverIndex The index of the server to create information about.
         * [MENTION=1333357818]param[/MENTION] serverName The name of the server.
         * [MENTION=1333357818]param[/MENTION] channelLoad Load of the channel - 1200 seems to be max.
         * [MENTION=850422]return[/MENTION] The server info packet.
         */
        
    public static MaplePacket getServerList(int serverIdString serverNameMap<IntegerIntegerchannelLoad) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.SERVERLIST);
            
    mplew.write(serverId);
            
    mplew.writeMapleAsciiString(serverName);
            
    mplew.write(ServerConstants.FLAG);
            
    mplew.writeMapleAsciiString(ServerConstants.EVENT_MESSAGE);
            
    mplew.write(0x64); // rate modifier, don't ask O.O!
            
    mplew.write(0x0); // event xp * 2.6 O.O!
            
    mplew.write(0x64); // rate modifier, don't ask O.O!
            
    mplew.write(0x0); // drop rate * 2.6
            
    mplew.write(0x0);
            
    int lastChannel 1;
            
    Set<Integerchannels channelLoad.keySet();
            for (
    int i 300i--) {
                if (
    channels.contains(i)) {
                    
    lastChannel i;
                    break;
                }
            }
            
    mplew.write(lastChannel);
            
    int load;
            for (
    int i 1<= lastChanneli++) {
                if (
    channels.contains(i)) {
                    
    load channelLoad.get(i) * 1200 ServerConstants.CHANNEL_LOAD;
                } else {
                    
    load ServerConstants.CHANNEL_LOAD// full
                
    }
                
    mplew.writeMapleAsciiString(serverName "-" i);
                
    mplew.writeInt(load);
                
    mplew.write(1);
                
    mplew.writeShort(1);
            }
            
    mplew.writeShort(0);
            return 
    mplew.getPacket();
        } 
    The full ServerlistRequestHandler:

    PHP Code:
    package net.login.handler;

    import client.MapleClient;
    import constants.ServerConstants;
    import java.rmi.RemoteException;
    import net.AbstractMaplePacketHandler;
    import net.MaplePacket;
    import net.SendPacketOpcode;
    import net.login.LoginServer;
    import tools.HexTool;
    import tools.MaplePacketCreator;
    import tools.data.input.SeekableLittleEndianAccessor;
    import tools.data.output.MaplePacketLittleEndianWriter;

    public final class 
    ServerlistRequestHandler extends AbstractMaplePacketHandler {
        private static final 
    String[] names = {"Scania""Bera""Broa""Windia""Khaini""Bellocan""Mardia""Kradia""Yellonde""Demethos""Elnido""Kastia""Judis""Arkenia""Plana""Galicia""Kalluna""Stius""Croa""Zenith""Medere"};
        
        public final 
    void handlePacket(SeekableLittleEndianAccessor sleaMapleClient c) {
            for (
    int i 0ServerConstants.NUM_WORLDSi++) {//input world numbers here change 1 to number of worlds
                
    try {
                    
    c.getSession().write(MaplePacketCreator.getServerList(inames[i], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
                } catch (
    RemoteException e) {
                    
    c.getChannelServer().reconnectWorld();
                }
            }
            
    c.getSession().write(MaplePacketCreator.getEndOfServerList());
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(6);
            
    mplew.writeShort(SendPacketOpcode.ENABLE_RECOMMENDED);
            
    mplew.writeInt(3);
            
    c.getSession().write(mplew.getPacket());
            
    c.getSession().write(sendRecommendedServers());
        }
        
        private static 
    MaplePacket sendRecommendedServers() {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.SEND_RECOMMENDED);
            
    mplew.write(HexTool.getByteArrayFromHexString("01 00 00 00 00")); // first byte is number, second byte is server
            
    mplew.writeMapleAsciiString("The newest of the Maple Worlds, Galicia is best suited for players just starting out in MapleStory or those that want a fresh beginning.");
            return 
    mplew.getPacket();
        }

    The full ServerStatusRequestHandler:

    PHP Code:
    package net.login.handler;

    import client.MapleClient;
    import constants.ServerConstants;
    import java.rmi.RemoteException;
    import net.AbstractMaplePacketHandler;
    import net.login.LoginServer;
    import tools.MaplePacketCreator;
    import tools.data.input.SeekableLittleEndianAccessor;

    public final class 
    ServerStatusRequestHandler extends AbstractMaplePacketHandler {
        public final 
    void handlePacket(SeekableLittleEndianAccessor sleaMapleClient c) {
            
    int worldIndex slea.readShort(); // we dont support multiple worlds..
            
    int status;
            
    int num 0;
            try {
                for (
    int load LoginServer.getInstance().getWorldInterface().getChannelLoad(worldIndex).keySet()) {
                    
    num += load;
                }
            } catch (
    RemoteException re) {
                
    System.out.println("Failed to get channel load.");
            }
            if (
    num >= ServerConstants.CHANNEL_LOAD) {
                
    status 2;
            } else if (
    num >= ServerConstants.CHANNEL_LOAD .8) { // More than 80 percent o___o
                
    status 1;
            } else {
                
    status 0;
            }
            
    c.getSession().write(MaplePacketCreator.getServerStatus(status));
        }

    And the variables from ServerConstants:

    PHP Code:
        // Login Configuration
        
    public static final int LOGIN_PORT 8484;
        public static final 
    byte NUM_WORLDS 1;
        public static final 
    byte FLAG 3;
        public static final 
    int CHANNEL_NUMBER 8;
        public static final 
    int CHANNEL_LOAD 100;
        public static final 
    String EVENT_MESSAGE "Welcome to DstroyerMS v83!";
        public static final 
    long RANKING_INTERVAL 3600000;
        public static final 
    boolean REMOTE_DETECT_ENABLED false
    I thought the ServerlistRequestHandler was assigning the serverID based on number of worlds, but I'll admit I'm a bit lost.

  4. #4
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Change World Names

    @revanoner
    I'd like to point out that ServerStatusRequest is when channels are full and it gives you a popup saying you'll experience lag or can't access the channel ;p

    Anyways,

    Code:
    try {
                    c.getSession().write(MaplePacketCreator.getServerList(i, names[i], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
                } catch (RemoteException e) {
                    c.getChannelServer().reconnectWorld();
                }
    change i in getServerList(i , that's the world id. Here's 3, which in v117 is Windia:

    Code:
    try {
                    c.getSession().write(MaplePacketCreator.getServerList(3, names[i], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
                } catch (RemoteException e) {
                    c.getChannelServer().reconnectWorld();
                }

  5. #5
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    Quote Originally Posted by chunkarama View Post
    @revanoner
    I'd like to point out that ServerStatusRequest is when channels are full and it gives you a popup saying you'll experience lag or can't access the channel ;p

    Anyways,

    Code:
    try {
                    c.getSession().write(MaplePacketCreator.getServerList(i, names[i], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
                } catch (RemoteException e) {
                    c.getChannelServer().reconnectWorld();
                }
    change i in getServerList(i , that's the world id. Here's 3, which in v117 is Windia:

    Code:
    try {
                    c.getSession().write(MaplePacketCreator.getServerList(3, names[i], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
                } catch (RemoteException e) {
                    c.getChannelServer().reconnectWorld();
                }
    I just included everything lol! Good to know though.

    I was reading over that part, because i is the int defined in getServerList, and i =

    (
    int i = 0; i < ServerConstants.NUM_WORLDS; i++)


    So we are setting the int as a serverid of 4 (for v83) so it manually defaults to Windia instead of assigning a serverID based on NUM_WORDS.

    I'll compile and test later on tonight (about 12 hours). If it works I'll post a SS. Thanks!

    EDIT:

    Don't we also need to change the names[i] to names [4]?

    PHP Code:
        public final void handlePacket(SeekableLittleEndianAccessor sleaMapleClient c) {
            for (
    int i 0ServerConstants.NUM_WORLDSi++) {//input world numbers here change 1 to number of worlds
                
    try {
                    
    c.getSession().write(MaplePacketCreator.getServerList(4names[4], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
                } catch (
    RemoteException e) {
                    
    c.getChannelServer().reconnectWorld();
                }
            } 

  6. #6
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Change World Names

    @revanoner Yep, that's what we're testing, and yeah I almost forgot.. you needa change that too. I may test it myself in a few!

    Oh, and a heads up.. you are forlooping. I suggest considering your forloop's i =-0 that you remove the forloop and just use 4, names[4], LoginServer.getInstance().getWorldInterface().getChannelLoad(0). While forlooping, if you have 3 worlds then it'd glitch and add 3 Windia's :(

    Code:
     public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
                try {
                    c.getSession().write(MaplePacketCreator.getServerList(4, names[4], LoginServer.getInstance().getWorldInterface().getChannelLoad(0)));
                } catch (RemoteException e) {
                    c.getChannelServer().reconnectWorld();
                }
    EDIT: Looks like it works. :)


  7. #7
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    Thankfully I'm only using 1 world, and according to Moogra's comments "// we dont support multiple worlds.."

    I'd have to rewrite a part of server constants and the serverlist so we aren't forlooping, so I guess what we did here is bypassing the code.

  8. #8
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Change World Names

    Quote Originally Posted by revanoner View Post
    Thankfully I'm only using 1 world, and according to Moogra's comments "// we dont support multiple worlds.."

    I'd have to rewrite a part of server constants and the serverlist so we aren't forlooping, so I guess what we did here is bypassing the code.
    Removing the forloop from serverlist itself is all you need to do, and then just keep the serverid as that

  9. #9
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    Quote Originally Posted by chunkarama View Post
    Removing the forloop from serverlist itself is all you need to do, and then just keep the serverid as that
    Thanks for all your help!

  10. #10
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    - - - Updated - - -

    So, trying:

    Code:
    c.getSession().write(MaplePacketCreator.getServerList(4, names[4], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
    ...got me as far as seeing the world name. (I tested up to Zenith too) However, I cannot see open the channels now after clicking on the world. I tried changing the getChannelLoad(i) to each corresponding worldid, but that prevents passing the login screen. I would think that i should be the id of the word as it is loading that worlds channel display?

  11. #11
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Change World Names

    Quote Originally Posted by revanoner View Post
    - - - Updated - - -

    So, trying:

    Code:
    c.getSession().write(MaplePacketCreator.getServerList(4, names[4], LoginServer.getInstance().getWorldInterface().getChannelLoad(i)));
    ...got me as far as seeing the world name. (I tested up to Zenith too) However, I cannot see open the channels now after clicking on the world. I tried changing the getChannelLoad(i) to each corresponding worldid, but that prevents passing the login screen. I would think that i should be the id of the word as it is loading that worlds channel display?
    What do you mean you can't see the open channels? Like it displays no channels or it doesn't display the activity properly? getchannelload(1) or 0 should be what you use because you dont support multiworlds. you're just changing the packet to display another world while using scania. You may have checks that disable you logging on the world if it isn't 0, I know I had them in lithium

  12. #12
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    Quote Originally Posted by chunkarama View Post
    What do you mean you can't see the open channels? Like it displays no channels or it doesn't display the activity properly? getchannelload(1) or 0 should be what you use because you dont support multiworlds. you're just changing the packet to display another world while using scania. You may have checks that disable you logging on the world if it isn't 0, I know I had them in lithium
    What I mean is when you click on Windia, it does not show the channels. You cannot go past the World Selection. Where in Lithium were those checks located? I'll try looking around, because something being disabled is plausible in my scenario.

  13. #13
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: Change World Names

    Quote Originally Posted by revanoner View Post
    What I mean is when you click on Windia, it does not show the channels. You cannot go past the World Selection. Where in Lithium were those checks located? I'll try looking around, because something being disabled is plausible in my scenario.
    Just start with the world request handler. From there you can figure your way out.

  14. #14
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Change World Names

    Quote Originally Posted by revanoner View Post
    What I mean is when you click on Windia, it does not show the channels. You cannot go past the World Selection. Where in Lithium were those checks located? I'll try looking around, because something being disabled is plausible in my scenario.
    Well, your handlers are going to be in login/handler. Lithium handles every handler with login within handling/login/handler/CharLoginHandler.

    As for the channel load, the world's properties load from the serverlist. getServerList gets the world id, the world name, the world flag, the event message, and the channels with their size (how full).

    If the original world had worked using i, i starts from 0 and increments. This is why I suggested using 0 in the getChannelLoad.

  15. #15
    The fallen one. RevanOn3r is offline
    MemberRank
    Jul 2014 Join Date
    NetherlandsLocation
    263Posts

    Re: Change World Names

    Quote Originally Posted by chunkarama View Post
    Well, your handlers are going to be in login/handler. Lithium handles every handler with login within handling/login/handler/CharLoginHandler.

    As for the channel load, the world's properties load from the serverlist. getServerList gets the world id, the world name, the world flag, the event message, and the channels with their size (how full).

    If the original world had worked using i, i starts from 0 and increments. This is why I suggested using 0 in the getChannelLoad.
    I know this late reply, but I solved this issue and hope my discovery will help anyone attempting this. I changed my worldid value in the SQL database to match the world I was trying to use, as the source I use has multiworlds. Change the account creating on the website to default the worldid column to whatever number you use, good to go!



Advertisement