[Release] improved !goto command

Page 1 of 2 12 LastLast
Results 1 to 25 of 41
  1. #1
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    [Release] improved !goto command

    since i had nothing to do at work i decided to make a new !goto command. an easier editable command.

    so this is the command. it should also fix the "ArrayIndexOutOfBounds" error since im not using any normal arrays

    first you need this import
    PHP Code:
    import java.util.HashMap
    then replace the old !goto command with this one
    PHP Code:
    // if syntax is not right 
    // give error message
    if (splitted.length 2){
        
    mc.dropMessage("Syntax: !goto <mapname>");
    }else{
        
    // init gotomaps hashmap
        
    HashMap<StringIntegergotomaps = new HashMap<StringInteger>();

        
    // add maps to gotomaps hashmap
        
    gotomaps.put("gmmap"180000000);
        
    gotomaps.put("southperry"60000);
        
    gotomaps.put("amherst"1010000);
        
    gotomaps.put("henesys"100000000);
        
    gotomaps.put("ellinia"101000000);
        
    gotomaps.put("perion"102000000);
        
    gotomaps.put("kerning"103000000);
        
    gotomaps.put("lith"104000000);
        
    gotomaps.put("sleepywood"105040300);
        
    gotomaps.put("florina"110000000);
        
    gotomaps.put("orbis"200000000);
        
    gotomaps.put("happy"209000000);
        
    gotomaps.put("elnath"211000000);
        
    gotomaps.put("ludi"220000000);
        
    gotomaps.put("aqua"230000000);
        
    gotomaps.put("leafre"240000000);
        
    gotomaps.put("mulung"250000000);
        
    gotomaps.put("herb"251000000);
        
    gotomaps.put("omega"221000000);
        
    gotomaps.put("korean"222000000);
        
    gotomaps.put("nlc"600000000);
        
    gotomaps.put("excavation"990000000);
        
    gotomaps.put("pianus"230040420);
        
    gotomaps.put("horntail"240060200);
        
    gotomaps.put("mushmom"100000005);
        
    gotomaps.put("griffey"240020101);
        
    gotomaps.put("manon"240020401);
        
    gotomaps.put("horseman"682000001);
        
    gotomaps.put("balrog"105090900);
        
    gotomaps.put("zakum"280030000);
        
    gotomaps.put("papu"220080001);
        
    gotomaps.put("showa"801000000);
        
    gotomaps.put("guild"200000301);
        
    gotomaps.put("shrine"800000000);
        
    gotomaps.put("fm"910000000);
        
    gotomaps.put("skelegon"240040511);

        
    // if place is in hashmap
        
    if (gotomaps.containsKey(splitted[1])){

            
    // prepare for changemap
            
    MapleMap target cserv.getMapFactory().getMap(gotomaps.get(splitted[1]));
            
    MaplePortal targetPortal target.getPortal(0);
            
    MapleCharacter player c.getPlayer();

            
    // changemap
            
    player.changeMap(targettargetPortal);

        }else{
            
    // else give error message
            
    mc.dropMessage("There is no such place !!!");
        }


    the good thing about this new command is that it is way more easier to add / edit places.

    when you want to add a new place to the command you just have to add this
    PHP Code:
    gotomaps.put("mapname"MapID); 
    Note: tested this on v60 server but it should work on any other server version too.
    Note2: please make sure that the var "cserv" is available in your script. else just add it xD
    PHP Code:
    ChannelServer cserv c.getChannelServer(); 
    hope this helps a little bit

    Credits: to me
    btw this is my first release

    [EDIT]
    Note3:
    PHP Code:
    HashMap<StringIntegergotomaps = new HashMap<StringInteger>(); 
    that's correct. so don't change it >.<
    Last edited by Shinji-Ikari; 30-12-08 at 08:34 AM.


  2. #2
    Visit my hompage Vi3tb0i2ty is offline
    MemberRank
    May 2008 Join Date
    1,788Posts

    Re: [Release] improved !goto command

    ww good job :p

  3. #3
    The almighty chicken kippieeej is offline
    MemberRank
    Apr 2008 Join Date
    1,038Posts

    Re: [Release] improved !goto command

    I must admit that this is a nice one

  4. #4
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    Re: [Release] improved !goto command

    only made this one because its really annoying to add / edit / delete maps in the old command. >.<

  5. #5
    Account Upgraded | Title Enabled! xbLazE is offline
    MemberRank
    Jul 2008 Join Date
    SingaporeLocation
    1,278Posts

    Re: [Release] improved !goto command

    Good job son !
    Nice improvements

  6. #6
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: [Release] improved !goto command

    YEAH HASH MAPS
    nice!

  7. #7
    Account Upgraded | Title Enabled! Supiangel is offline
    MemberRank
    Feb 2008 Join Date
    436Posts

    Re: [Release] improved !goto command

    Wow, nice one...
    Rep++ :P

  8. #8
    Alpha Member blyddlyl is offline
    MemberRank
    Jul 2008 Join Date
    Sing A Pore <33Location
    1,831Posts

    Re: [Release] improved !goto command

    Nice release ^^

  9. #9
    Interesting... SharpAceX is offline
    MemberRank
    Oct 2008 Join Date
    2,011Posts

    Re: [Release] improved !goto command

    Nice release. Much easier to add/edit.

  10. #10
    Account Upgraded | Title Enabled! Shady1 is offline
    MemberRank
    Jun 2008 Join Date
    In The computerLocation
    1,098Posts

    Re: [Release] improved !goto command

    awesome job dude

  11. #11
    Novice CreesPye is offline
    MemberRank
    Dec 2008 Join Date
    1Posts

    Re: [Release] improved !goto command

    Thanks man, sshould I replace it with th !goto command in the CommandProccesor right?

  12. #12
    Mother effin' clouds SaintsIan is offline
    MemberRank
    Apr 2008 Join Date
    fyrechat.netLocation
    2,809Posts

    Re: [Release] improved !goto command

    Thanks man, sshould I replace it with th !goto command in the CommandProccesor right?
    wherever your !goto command was o.o
    And real great release ;) i just changed mine, bahaha :)

  13. #13
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    Re: [Release] improved !goto command

    i actually got that command ready a few days now. but i couldnt test it for some reason xD

    anyways have fun with that command :D

  14. #14
    Novice ftlz is offline
    MemberRank
    May 2008 Join Date
    3Posts

    Re: [Release] improved !goto command

    In SineMS Revision 18 where do I add this?
    Cause there is no 'goto' command normally.

  15. #15
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    Re: [Release] improved !goto command

    hmm just add it where you think it fits the best. I dont know SineMS and i i personally would just put it into the GMCommand.java. dont know. its your choice. (and dont know about the gm level (i hate them >.<) )

  16. #16
    Apprentice wakimomo is offline
    MemberRank
    Dec 2008 Join Date
    9Posts

    Re: [Release] improved !goto command

    does it really matter where u add the command in the commands?

  17. #17
    Novice xalucardx is offline
    MemberRank
    Dec 2008 Join Date
    2Posts

    Re: [Release] improved !goto command

    Working great thanks!

  18. #18
    Burn the land, HydroBenZ is offline
    MemberRank
    Aug 2008 Join Date
    2,710Posts

    Re: [Release] improved !goto command

    Holy cow, GREAT job!
    Thanks

  19. #19
    Apprentice Sadiq is offline
    MemberRank
    Oct 2008 Join Date
    15Posts

    Re: [Release] improved !goto command

    it looks cool

    btw it gave me this error :

    D:\Sadeq\New Folder (6)\trunk\src\net\sf\odinms\client\messages\commands\gotoCommands.java:70: cannot find symbol
    symbol : method getMap(java.lang.Object)
    location: class net.sf.odinms.server.maps.MapleMapFactory
    MapleMap target = cserv.getMapFactory().getMap(gotomaps.get(splitted[1]));
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    BUILD FAILED (total time: 8 seconds)


    thanks

  20. #20
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    Re: [Release] improved !goto command

    is the var "cserv" available in your script? i said that in the note2 that that var has to be there. else it wont work

  21. #21
    Apprentice Sadiq is offline
    MemberRank
    Oct 2008 Join Date
    15Posts

    Re: [Release] improved !goto command

    Yes it is ..

  22. #22
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    Re: [Release] improved !goto command

    do you have the import "import net.sf.odinms.server.maps.MapleMap;" in that script ?

  23. #23
    Apprentice Sadiq is offline
    MemberRank
    Oct 2008 Join Date
    15Posts

    Re: [Release] improved !goto command

    YES ...

    import java.util.HashMap;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.messages.CommandDefinition;
    import net.sf.odinms.client.messages.Command;
    import net.sf.odinms.client.messages.IllegalCommandSyntaxException;
    import net.sf.odinms.client.messages.MessageCallback;
    import net.sf.odinms.server.MaplePortal;
    import net.sf.odinms.server.maps.MapleMap;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.net.channel.ChannelServer;

    :D

  24. #24
    Account Upgraded | Title Enabled! Shinji-Ikari is offline
    MemberRank
    Jul 2008 Join Date
    592Posts

    Re: [Release] improved !goto command

    could you post your whole gotocommands.java ? >.<

  25. #25
    Apprentice Sadiq is offline
    MemberRank
    Oct 2008 Join Date
    15Posts

    Re: [Release] improved !goto command

    Code:
    package net.sf.odinms.client.messages.commands;
    import java.util.HashMap;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.messages.CommandDefinition;
    import net.sf.odinms.client.messages.Command;
    import net.sf.odinms.client.messages.IllegalCommandSyntaxException;
    import net.sf.odinms.client.messages.MessageCallback;
    import net.sf.odinms.server.MaplePortal;
    import net.sf.odinms.server.maps.MapleMap;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.net.channel.ChannelServer;
    
    public class gotoCommands implements Command {
    @Override
    public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception,
    IllegalCommandSyntaxException {
    ChannelServer cserv = c.getChannelServer();
    // if syntax is not right 
    // give error message
    if (splitted.length < 2){
    mc.dropMessage("Syntax: !goto");
    
    }else{
    // init gotomaps hashmap
    HashMap gotomaps = new HashMap();
    // add maps to gotomaps hashmap
    gotomaps.put("gmmap", 180000000);
    gotomaps.put("southperry", 60000);
    gotomaps.put("amherst", 1010000);
    gotomaps.put("henesys", 100000000);
    gotomaps.put("ellinia", 101000000);
    gotomaps.put("perion", 102000000);
    gotomaps.put("kerning", 103000000);
    gotomaps.put("lith", 104000000);
    gotomaps.put("sleepywood", 105040300);
    gotomaps.put("florina", 110000000);
    gotomaps.put("orbis", 200000000);
    gotomaps.put("happy", 209000000);
    gotomaps.put("elnath", 211000000);
    gotomaps.put("ludi", 220000000);
    gotomaps.put("aqua", 230000000);
    gotomaps.put("leafre", 240000000);
    gotomaps.put("mulung", 250000000);
    gotomaps.put("herb", 251000000);
    gotomaps.put("omega", 221000000);
    gotomaps.put("korean", 222000000);
    gotomaps.put("nlc", 600000000);
    gotomaps.put("excavation", 990000000);
    gotomaps.put("pianus", 230040420);
    gotomaps.put("horntail", 240060200);
    gotomaps.put("mushmom", 100000005);
    gotomaps.put("griffey", 240020101);
    gotomaps.put("manon", 240020401);
    gotomaps.put("horseman", 682000001);
    gotomaps.put("balrog", 105090900);
    gotomaps.put("zakum", 280030000);
    gotomaps.put("papu", 220080001);
    gotomaps.put("showa", 801000000);
    gotomaps.put("guild", 200000301);
    gotomaps.put("shrine", 800000000);
    gotomaps.put("fm", 910000000);
    gotomaps.put("ariant", 240040511);
    gotomaps.put("cbd", 540000000);
    gotomaps.put("ariant", 260000100);
    // if place is in hashmap
            if (gotomaps.containsKey(splitted[1])){
    // prepare for changemap
            MapleMap target = cserv.getMapFactory().getMap(gotomaps.get(splitted[1]));
            MaplePortal targetPortal = target.getPortal(0);
            MapleCharacter player = c.getPlayer();
    
    
            // changemap
            player.changeMap(target, targetPortal);
    
        }else{
            // else give error message
            mc.dropMessage("There is no such place !!!");
        }
    
    }
            }
    	@Override
    	public CommandDefinition[] getDefinition() {
    		return new CommandDefinition[] {
    			new CommandDefinition("goto", "?", "go <town/map name>", 100),
    			
    		};
    	}
    
            }



Page 1 of 2 12 LastLast

Advertisement