Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Add-On]Auto-JQ.Event

JavaScript Is Best Script
Joined
Dec 13, 2010
Messages
631
Reaction score
131
Function:
An addon that starts event automatically in intervals of a predefined period of time.

Credits:
MoopleDEV for the wonderful source
Lee Yiyuan

INSTALLATION

NPC to warp players to Event Map :
Code:
/*

Edited Event NPC
NakedStory83

*/

function start() {
    if (!(cm.getEventMap() == 0)){
	cm.sendYesNo("Do you want to go to the event map?");
    }

    else{
        cm.sendOk("The Event Map Is Currently Closed");
	cm.dispose();
    }
}

function action(mode, type, selection) {
    if (mode < 1) {
        cm.sendOk("All right, come back next time.");
        cm.dispose();
        return;
    } else {
        cm.warp(cm.getEventMap());
	cm.dispose();
    }
}

NPC at end of JQ map script :
Code:
function start() {
    if (!(cm.getEventMap() == 0)){
        cm.gainItem(4000313, 500);
        cm.warpMap(910000000);
        cm.setEventMap(0);
        cm.serverNotice("Congratulations to " + cm.getName() + " for winning the event and gaining 500 Golden Maple Leaves!");
        cm.serverMessage("The event has now ended. Thank you for those who have participated in the event.");
        cm.dispose();
    }else{
        cm.sendOk("What the heck are you doing here? There are currently no events going on!");
        cm.dispose();
    }
}

Event Script:
Create a file named AutoJQ.js with the following code below into scripts\events
Code:
var setupTask;
var maps = new Array(101000100,101000101,101000102,101000103,101000104,105040310,105040311,105040312,105040313,105040314,105040315,105040316);

function init() {
    scheduleNew();
}

function scheduleNew() {
    var cal = java.util.Calendar.getInstance();
    cal.set(java.util.Calendar.HOUR, 0);
    cal.set(java.util.Calendar.MINUTE, 0);
    cal.set(java.util.Calendar.SECOND, 0);
    var nextTime = cal.getTimeInMillis();
    while (nextTime <= java.lang.System.currentTimeMillis()) {
        nextTime += 1000 * 3600;
    }
    setupTask = em.scheduleAtTimestamp("start", nextTime);
}

function cancelSchedule() {
    setupTask.cancel(true);
}

function start() {
    scheduleNew(); 
    	em.setEventMap( maps[Math.floor(Math.random()*12)] );
    var iter = em.getInstances().iterator();
    while (iter.hasNext()) {
        var eim = iter.next();
    }
}

1)
In EventManager.java, add
Code:
    public void setEventMap(int id){
        for (int i = 1; i <= ChannelServer.getAllInstances().size(); i++) {
            ChannelServer.getInstance(i).setEventMap(id);
            ChannelServer.getInstance(i).setServerMessage("An event has started! Click on Vicious to participate!");
            try {
                cserv.getWorldInterface().broadcastMessage("EVENT", MaplePacketCreator.serverNotice(6, "[EVENT] An event has started! Click on Vicious to participate!").getBytes());
            } catch (Exception e) {
                cserv.reconnectWorld();
            }
            java.util.Date time = new java.util.Date();
            System.out.println("Event Started " + time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() + " on " + id);
        }
    }
UNDER
Code:
    public String getName() {
        return name;
    }

2)
In ChannelServer.java, add
Code:
    public void setEventMap(int id){
        this.eventMap = id;
    }
    public int getEventMap(){
        return this.eventMap;
    }
UNDER
Code:
    public void broadcastGMPacket(MaplePacket data) {
        for (MapleCharacter chr : players.getAllCharacters()) {
            if (chr.isGM()) {
                chr.announce(data);
            }
        }
    }

3)
In ChannelServer.java, add
Code:
private int eventMap = 0;
UNDER
Code:
private int channel;

3)
In NPCConversaionmanager.java, add
Code:
    public void warpMap(int id){
        for (MapleCharacter chr : getPlayer().getMap().getCharacters()){
            chr.changeMap(id);
        }
    }

    public void serverNotice(String msg){
        ChannelServer cserv = c.getChannelServer();
        try {
            cserv.getWorldInterface().broadcastMessage("Announcement", MaplePacketCreator.serverNotice(6, "[Notice] " + msg).getBytes());
        } catch (Exception e) {
            cserv.reconnectWorld();
        }
    }

    public void serverMessage(String msg){
        for (int i = 1; i <= ChannelServer.getAllInstances().size(); i++) {
            ChannelServer.getInstance(i).setServerMessage(msg);
        }
    }

    public int getEventMap(){
        return c.getChannelServer().getEventMap();
    }

    public void setEventMap(int id){
        c.getChannelServer().setEventMap(id);
    }

    public void warp(int mapid){
        c.getPlayer().changeMap(mapid);
    }
UNDER
Code:
    public MapleEvent getEvent() {
        return c.getChannelServer().getEvent();
    }
 
Last edited by a moderator:
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
Re: Auto-JQ.Event

Only one problem with this, which I don't think is possible to fix... some of the JQs can be exploited by simply CC'n or dying. Might want to make a note of that :)
 
JavaScript Is Best Script
Joined
Dec 13, 2010
Messages
631
Reaction score
131
Re: Auto-JQ.Event

Only one problem with this, which I don't think is possible to fix... some of the JQs can be exploited by simply CC'n or dying. Might want to make a note of that :)

Exploit as in warp themselves to the top of the map?
 
Custom Title Activated
Loyal Member
Joined
Jun 30, 2008
Messages
3,451
Reaction score
1,616
Re: Auto-JQ.Event

Shawn isn't the return map the nearest town?

And a check to the npc, if the character is within it's range.
 
Master Summoner
Loyal Member
Joined
Mar 10, 2009
Messages
597
Reaction score
132
Re: Auto-JQ.Event

Shawn isn't the return map the nearest town?

And a check to the npc, if the character is within it's range.
Not all but that can be edited in the xmls fairly easily.
 
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
Re: Auto-JQ.Event

Exploit as in warp themselves to the top of the map?

Warp to top of map or if you are doing the Maple Fitness JQs, it warps you to the end with the clown when you die, iirc.
 
Custom Title Activated
Loyal Member
Joined
Jun 30, 2008
Messages
3,451
Reaction score
1,616
Re: Auto-JQ.Event

Just do the same as zakum pq. You have to be in the map for 2 minutes or so, before you can leave.

And for the fitness stuff, would be dumb during a gm event. And btw I once saw someone hacking in there, and didn't get banned in GMS lol
 
Experienced Elementalist
Joined
Aug 1, 2010
Messages
255
Reaction score
30
Re: Auto-JQ.Event

Just do the same as zakum pq. You have to be in the map for 2 minutes or so, before you can leave.

And for the fitness stuff, would be dumb during a gm event. And btw I once saw someone hacking in there, and didn't get banned in GMS lol

Goes to show how PRO the GMs are in GMS.
 
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
Re: Auto-JQ.Event

Just do the same as zakum pq. You have to be in the map for 2 minutes or so, before you can leave.

And for the fitness stuff, would be dumb during a gm event. And btw I once saw someone hacking in there, and didn't get banned in GMS lol

It's impossible to limit someone to remaining in a map for 2 minutes, unless you meant that if they don't stay in for 2 minutes, they get warped somewhere else. Otherwise, it's impossible because people can easily dc themselves, which typically acts as a death anyways.
 
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
I suppose this is fairly well done, but I personally don't like the idea of making this too automated.
 
Skilled Illusionist
Joined
Dec 16, 2010
Messages
304
Reaction score
164
Nice to see an event script being released. Although iirc, Moogra posted that the event script system was very leaky, perhaps hardcoded would be better?
 
Custom Title Activated
Loyal Member
Joined
Mar 17, 2009
Messages
1,911
Reaction score
538
Re: Auto-JQ.Event

Goes to show how PRO the GMs are in GMS.

They can't simply respond to one report. We have 6 GMs monitoring 100 players, where they have like a company worth monitoring millions.
 
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
Re: Auto-JQ.Event

They can't simply respond to one report. We have 6 GMs monitoring 100 players, where they have like a company worth monitoring millions.

lmfao Nice exaggeration. There are roughly 45k people on at a given time in Scania. There are GMs for each world. I'm not saying they're job is easier because of less people, but it's no where close to a million. When Nexon says that million number, they mean accounts created, not actual players :)
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
That's cool. Not many people make use of event scripts. I have a similar system to this in my server, but instead of being player vs player it's individual and vs time.
 
Newbie Spellweaver
Joined
Nov 26, 2015
Messages
61
Reaction score
0
can anyone help me? this is not working for me.. the AutoJQ wont start after 30min i dont have any error
 
Junior Spellweaver
Joined
Dec 21, 2013
Messages
140
Reaction score
3
Did you put 'AutoJQ' in the EVENTS list under ServerConstants.java?
 
Newbie Spellweaver
Joined
Nov 26, 2015
Messages
61
Reaction score
0
Did you put 'AutoJQ' in the EVENTS list under ServerConstants.java?
Thanks for replying, im appreciate that haha. what do u mean AutoJQ in the EVENTS list under Serverconstant.java? in serverconstant.java there is a
public static final String EVENTS = "automsg";
u mean i need to put Autojq under this? how to do so
 
Junior Spellweaver
Joined
Dec 21, 2013
Messages
140
Reaction score
3
Thanks for replying, im appreciate that haha. what do u mean AutoJQ in the EVENTS list under Serverconstant.java? in serverconstant.java there is a
public static final String EVENTS = "automsg";
u mean i need to put Autojq under this? how to do so

That is correct! You would do the following:

public static final String EVENTS = "automsg AutoJQ";
 
Back
Top