Welcome to the RaGEZONE - MMORPG development forums.

[Add-On]Timed Jail

This is a discussion on [Add-On]Timed Jail within the Releases forums, part of the Java Based (Odin) category; Surprised no one has done this yet, it's actually pretty easy. I'm only releasing this because I'm bored . Might ...

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Account Upgraded | Title Enabled!
    Rank
    Member +
    Join Date
    Jun 2011
    Location
    idk
    Posts
    550
    Liked
    392

    [Add-On]Timed Jail

    Click
    Surprised no one has done this yet, it's actually pretty easy. I'm only releasing this because I'm bored . Might release something that's actually useful if I stay bored(implying to myself this isn't useful to me, but it is for you guys).

    MapleCharacter:
    Code:
    private long jailTime = 0;
    
    public long getJailTime() {
    	return jailTime;
    }
    
    public void setJailTime(long time) {
    	this.jailTime = time;
    }
    
    jailTime = ?,
    jailTime,
    ?,
    ps.setLong(xx, jailTime);
    
    public void hammerTime(int mins) {
    		setJailTime(System.currentTimeMillis() / 1000 * mins);
            client.getSession().write(MaplePacketCreator.getClock(mins * 60));
            TimerManager.getInstance().schedule(new Runnable() {
                @Override
                public void run() {
    				setJailTime(0); // idk if this is even needed, but w/e
                }
            }, 1000 * 60 * mins);
        }
    MapleClient.disconnect:
    Code:
    	if (c.getPlayer().getJailTime() > 0) { // i think this is needed, so time stops?
    		player.setJailTime(System.currentTimeMillis() / 1000 - player.getJailTime());
    	}
    ChangeMapHandler:
    Code:
    	 if (c.getPlayer().getJailTime() > 0) { // just in case, exploit
            c.getPlayer().warpToMap(jailmapid);
    		c.getPlayer().hammerTime(c.getPlayer().getJailTime());
        }
    PlayerLoggedinHandler:
    Code:
    	 if (c.getPlayer().getJailTime() > 0) { // just in case, exploit
            c.getPlayer().warpToMap(jailmapid);
    		c.getPlayer().hammerTime(c.getPlayer().getJailTime());
        }
    ChangeChannelHandler:
    Code:
    	 if (c.getPlayer().getJailTime() > 0) { // just in case, exploit
            c.getPlayer().warpToMap(jailmapid);
    		c.getPlayer().hammerTime(c.getPlayer().getJailTime());
        }
    Command:
    Code:
    	} else if (splitted[0].equals("jail")) {
            MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    		 if (victim != null) {
                if (splitted.length > 3 && splitted[2].equals("timed")) {
    victim.warpToMap(jailmapid);
                    victim.hammerTime(splitted[3]);
    				player.dropMessage(victim.getName() + " was jailed for " + splitted[3] + " minutes!");
    				victim.dropMessage("You've been jailed for " + splitted[3] + " minutes.");
    			} else {
                    victim.warpToMap(jailmapid);
                    player.dropMessage(victim.getName() + " was jailed!");
    			}
            } else {
                player.dropMessage(splitted[1] + " not found!");
    	}
    Last edited by StripedCow; 18-02-12 at 03:36 PM.
    Bringing the hype to a section near you.

  2. #2
    Account Upgraded | Title Enabled!
    Rank
    Member +
    Join Date
    Nov 2009
    Posts
    850
    Liked
    378

    Re: [Add-On]Timed Jail

    why use a timer mang. add a check in QuestActionHandler if jail time is > 0 and then check how much time has passed. :)

  3. #3
    Account Upgraded | Title Enabled!
    Rank
    Member +
    Join Date
    Jun 2011
    Location
    idk
    Posts
    550
    Liked
    392

    Re: [Add-On]Timed Jail

    Quote Originally Posted by Expedia View Post
    why use a timer mang. add a check in QuestActionHandler if jail time is > 0 and then check how much time has passed. :)
    That's lame.
    Bringing the hype to a section near you.

  4. #4
    Verisimilitude.
    Rank
    Alpha Member
    Join Date
    Dec 2010
    Location
    Hawaii
    Posts
    1,855
    Liked
    278

    Re: [Add-On]Timed Jail

    Quote Originally Posted by Expedia View Post
    why use a timer mang. add a check in QuestActionHandler if jail time is > 0 and then check how much time has passed. :)
    QuestAction? Why... And the timer (if you meant the clock) is for the player's sake more than anything.

  5. #5
    Account Upgraded | Title Enabled!
    Rank
    Member +
    Join Date
    Mar 2011
    Posts
    780
    Liked
    263

    Re: [Add-On]Timed Jail

    I remember when I tried to make this years ago and failed since I was trying to save a long to the database and didn't know how, lol. Brings back memories.

    Good release Bloo. (:
    Last edited by Veda; 16-02-12 at 04:57 AM.

    You won't find faith or hope down a telescope
    You won't find heart and soul in the stars
    You can break everything down to chemicals
    But you can't explain a love like ours

  6. #6
    return null;
    Rank
    Member +
    Join Date
    Dec 2008
    Location
    The Netherlands
    Posts
    1,286
    Liked
    239

    Re: [Add-On]Timed Jail

    Is it necessary to add a long to every Maplecharacter?
    Why don't you create a separate class and gather the players who got jailed?

  7. #7
    Verisimilitude.
    Rank
    Alpha Member
    Join Date
    Dec 2010
    Location
    Hawaii
    Posts
    1,855
    Liked
    278
    Quote Originally Posted by mertjuh View Post
    Is it necessary to add a long to every Maplecharacter?
    Why don't you create a separate class and gather the players who got jailed?
    I really hope you're kidding. Just, really.
    Posted via Mobile Device

  8. #8
    return null;
    Rank
    Member +
    Join Date
    Dec 2008
    Location
    The Netherlands
    Posts
    1,286
    Liked
    239

    Re: [Add-On]Timed Jail

    Quote Originally Posted by Soulfist View Post
    I really hope you're kidding. Just, really.
    Posted via Mobile Device
    No, explain.

  9. #9
    Verisimilitude.
    Rank
    Alpha Member
    Join Date
    Dec 2010
    Location
    Hawaii
    Posts
    1,855
    Liked
    278
    Quote Originally Posted by mertjuh View Post
    No, explain.
    Ok, well, first of all, what you said about "why store a long" is just stupid; do you understand the difference between objects and primitives? Probably not, why cache the players when you could just stamp their object's state with a time value by which to track them. Why the hell would you write a class just to store jailed people, its impractical performance wise, logic wise, visually and its a pain to do.

    Why build a sea sailing ship to cross the lake when you can build a canoe for less money that does the same job BETTER...
    Posted via Mobile Device

  10. #10
    Banned
    Rank
    Banned
    Join Date
    Dec 2010
    Location
    On your shoulde
    Posts
    1,223
    Liked
    637

    Re: [Add-On]Timed Jail

    This is c00l but ricky is baddie

  11. #11
    Ultimate Member
    Rank
    Member
    Join Date
    Nov 2009
    Posts
    185
    Liked
    19

    Re: [Add-On]Timed Jail

    In case your server crash player is stuck, so you need database for Jail things.

  12. #12
    return null;
    Rank
    Member +
    Join Date
    Dec 2008
    Location
    The Netherlands
    Posts
    1,286
    Liked
    239

    Re: [Add-On]Timed Jail

    Quote Originally Posted by Soulfist View Post
    Ok, well, first of all, what you said about "why store a long" is just stupid; do you understand the difference between objects and primitives? Probably not, why cache the players when you could just stamp their object's state with a time value by which to track them. Why the hell would you write a class just to store jailed people, its impractical performance wise, logic wise, visually and its a pain to do.

    Why build a sea sailing ship to cross the lake when you can build a canoe for less money that does the same job BETTER...
    Posted via Mobile Device
    My question was :
    "Is it necessary to add a long to every Maplecharacter?"
    not
    "why store a long"
    There's a huge difference and you know that.


    My idea was to create a seperate single instanced class named Jail (or w.e) and actually put a long and the character's ID in it. I'm pretty sure that it will not impact the performance at all, you're just talking out of your ass. This class could contain methods that help you maintaining people in jail and would only save and load the timestamp when a player is actually jailed instead of doing it everytime you login, change map, CC etc. Oh about how the code looks is just a matter of personal taste, I'd like to have my stuff sorted instead of trashing every fucking thing inside maplecharacter.

    Oh and I'd rather have a sea sailing ship that has the ability to extend itself when people need it, instead of creating a canoe for every individual person even when it's not going to be used at all.

  13. #13
    Account Upgraded | Title Enabled!
    Rank
    Member +
    Join Date
    Nov 2009
    Posts
    850
    Liked
    378

    Re: [Add-On]Timed Jail

    Quote Originally Posted by Soulfist View Post
    QuestAction? Why... And the timer (if you meant the clock) is for the player's sake more than anything.
    The Quest Action packet is constantly being received from the server so it's easy to check there. You can also use ping and pong if you want.

  14. #14
    Verisimilitude.
    Rank
    Alpha Member
    Join Date
    Dec 2010
    Location
    Hawaii
    Posts
    1,855
    Liked
    278
    Quote Originally Posted by mertjuh View Post
    My question was :
    "Is it necessary to add a long to every Maplecharacter?"
    not
    "why store a long"
    There's a huge difference and you know that.


    My idea was to create a seperate single instanced class named Jail (or w.e) and actually put a long and the character's ID in it. I'm pretty sure that it will not impact the performance at all, you're just talking out of your ass. This class could contain methods that help you maintaining people in jail and would only save and load the timestamp when a player is actually jailed instead of doing it everytime you login, change map, CC etc. Oh about how the code looks is just a matter of personal taste, I'd like to have my stuff sorted instead of trashing every fucking thing inside maplecharacter.

    Oh and I'd rather have a sea sailing ship that has the ability to extend itself when people need it, instead of creating a canoe for every individual person even when it's not going to be used at all.
    You sir are the one talking out of your ass, because this is total bullshit, do you even know how stupid you sound now? What methods? What management? Wtf are you talking about, it has to do with each characters state. And how blue chose to update the jailtime is irrelevant (even though I told him to change it) it doesn't matter. You have no logic mertjuh, I think you should just go home.

    And, lol really? Trashing everything in maple character? Lolololololololol.
    Posted via Mobile Device

    Edit: @expedia, I see, makes sense but still unnecessary kind of lame :s .
    Posted via Mobile Device

  15. #15
    Interesting...
    Rank
    Alpha Member
    Join Date
    Oct 2008
    Posts
    1,542
    Liked
    398
    Gamertag: SharpAceX

    Re: [Add-On]Timed Jail

    For the check @ ChangeMapHandler:
    Why not just disable all map changing instead of warping them back in jail if they somehow manage to change maps?

    For the check @ ChangeChannelHandler:
    Again, I think disabling the ability to change channels is better than allowing them to CC, and then warping them to the map again.

    Oh and maybe add "c.getPlayer().warpToMap(jailmapid);" to the hammerTime method itself since you call it every time hammerTime is called, you might as well make it happen at at once.

    Code:
    	} else if (splitted[0].equals("jail")) {
            MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    		 if (victim != null) {
                if (splitted.length > 3 && splitted[2].equals("timed")) {
                    victim.hammerTime(splitted[3]);
    				player.dropMessage(victim.getName() + " was jailed for " + splitted[3] + " minutes!");
    				victim.dropMessage("You've been jailed for " + splitted[3] + " minutes.");
    			} else {
                    victim.warpToMap(jailmapid);
                    player.dropMessage(victim.getName() + " was jailed!");
    			}
            } else {
                player.dropMessage(splitted[1] + " not found!");
    	}
    I think you forgot to warp them since all you did was give them jail time and alert them about it. They'd need to CC, change maps or relog to actually get sent to jail. I think.

    Sorry for typing so much. GMS is down.
    Nice release though, some servers really need this. I've seen servers manually have to unjail people after X minutes which is really bad.

    1) Balloon Frenzy! v1.9 available on Google Play
    For those who want a nice, casual game to play.

    2) BasilDroid v1.0 available on Google Play
    For the fastest way to access BasilMarket on the go!

    3) Danger Zone v1.0 available on Google Play
    The epic game of survival!

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •