[Release] Event System

Experienced Elementalist
Joined
Sep 7, 2006
Messages
245
Reaction score
0
Keep this off Valhalla.
Thanks. (:

ChannelServer.java
Code:
        private int eventMap = 0;
        private boolean eventActive = false;
        private int maxPlayers = 0;

and

Code:
        public int getMaxPlayers() {
            return maxPlayers;
        }

        public int getEventMap() {
            return eventMap;
        }
        
        public boolean getEventActive() {
            return eventActive;
        }
        
        
        public void setEventActive(boolean eventActive) {
            this.eventActive = eventActive;
        }
        
        public void setEventMap(int eventMap) {
            this.eventMap = eventMap;
        }
        
        public void setMaxPlayers(int maxPlayers) {
            this.maxPlayers = maxPlayers;
        }

*Commands.java
Code:
             } else if(splitted[0].equalsIgnoreCase("!event")) {
                 String choice = splitted[1];
                 int mapid = 0;
                 int maxplayers = 0;
                 if(splitted[2] != null) { mapid = Integer.parseInt(splitted[2]); }
                 if(splitted[3] != null) { maxplayers = Integer.parseInt(splitted[3]); }
                 boolean offon = false; // False = They selected off
                 if(choice.equalsIgnoreCase("on")) {
                     c.getChannelServer().setEventActive(true);
                     mc.dropMessage("Event has been Activated");
                     offon = true;
                 } else if (choice.equalsIgnoreCase("off")) {
                     c.getChannelServer().setEventActive(false);
                     mc.dropMessage("Event has been disactivated");
                     offon = false;
                 }
                 if(offon) {
                    if(mapid != 0 && maxplayers != 0) {
                        c.getChannelServer().setEventMap(mapid);
                        c.getChannelServer().setMaxPlayers(maxplayers);
                    } else {
                        mc.dropMessage("Either you never set a Map ID, or never set a max amount of players.");
                    }
                 }
             }

NPCConversationManager.java
Add
Code:
import net.sf.odinms.server.maps.MapleMapFactory;
With the rest of the imports

Add
Code:
        private MapleMapFactory mmf;
Under
Code:
    private String getText;

Add

Code:
    public void eventWarp(int mapid, int max) {
        MapleMap eventmap = mmf.getMap(mapid);
        int players = eventmap.getAllPlayer().size();
       
        if(players >= max) {
            c.getPlayer().dropMessage("The event map is full.");
        } else {
            c.getPlayer().dropMessage("You have been warped to the event map.");
            c.getPlayer().changeMap(eventmap, eventmap.getPortal(0));
        }
    }
    
    public boolean eventEnabled() {
        return c.getChannelServer().getEventActive();
    }
    
    public int getMaxPlayers() {
        return c.getChannelServer().getMaxPlayers();
    }

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

Then finally, inside an NPC of your choice.

Code:
function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0 && status == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
            
        if(status == 0) {
            cm.sendOk("Would you like to participate inside the event?");
        }
        else if(status == 1) {
            if(cm.eventEnabled() && cm.getMaxPlayers() > 0 && cm.getEventMap() > 0) {
                cm.eventWarp(cm.getEventMap(), cm.getMaxPlayers());
                cm.dispose();
            } else {
                cm.sendOk("The event system is currently not active.");
                cm.dispose();
            }
        }
    }
}

Remember.
Keep this off Valhalla.

Tell me if there is any errors, I'll fix it as soon as possible. (:
 
so this is
!event
and you need to set max players / id every time you are going to make an event?

and i got surprised when it said
Keep it off Valhalla o.o
 
Only got this error

Code:
C:\Users\user\Server\src\net\sf\odinms\scripting\npc\NPCConversationManager.java:107: cannot find symbol
symbol  : method getEventMap()
location: class net.sf.odinms.net.channel.ChannelServer
        return c.getChannelServer().getEventMap();
 
Only got this error

Code:
C:\Users\user\Server\src\net\sf\odinms\scripting\npc\NPCConversationManager.java:107: cannot find symbol
symbol  : method getEventMap()
location: class net.sf.odinms.net.channel.ChannelServer
        return c.getChannelServer().getEventMap();

In ChannelServer
Code:
        public int getEventMap() {
            return eventmap;
        }
Added to first post, thanks.
 
Shouldn't it be
Code:
        public int getEventMap() {
            return event[COLOR=Red]M[/COLOR]ap; 
        }
With a capitalized M?
My bad. ;)

You sir, are a moron, the purest kind of them too, you put that there, when you CLEARLY know that Valhalla doesn't tolerate anything being released on there from RaGEZONE that wasn't specifically put there by the Author, or the Release has the Authors Consent.

I don't know what you problem is, first you kiss our ass, then you post this? That's real cool of you, and your "rebellion", I don't know what you plan to achieve with this. (Refer to my first paragraph). You know for a fact we don't.


You should go talk to Krishan. It will end up on Valhalla after I finish it, and calm down. thx.

Also, it doesn't say that anywhere on Valhalla. It just says if you do give credits. I'm making it specific and you get mad. I didn't mean to offend you. so qq moar. You should have atleast read your own rules before you quote them.



Weaxer said:
- If you took a release from another forum, give proper credits

You should be "handling personal matters" anyway.
 
Oh!
Command Usage :
Turning On:
!event on <MapId> <Max amount of Players for this Event>

Turning Off:
!event off
 
the npc works not not the command i tried !event it says !event dont exist and i put the script in Super command.js
 
Back