OX Map Command

Thanks man! This is really, really cool and creative! Nothing like giving noobs the taste of professionalism in their events ;)

Thought; instead of entering in a new question each time (and then having to change the t/f parameter), could you read in a .txt file and read the questions in from there (provided the formatting stays consistent)? That way the event runs faster and smoother.

You could read it in line by line, for example this could be how your .txt file is formatted:
Code:
Is water made out of H2O? [COLOR=#333333]f
Snail's are level 1. t
etc...[/COLOR]

Then all the command would require is two parameters:
Code:
[COLOR=#333333]!AskOX <time> <questionLine[/COLOR][COLOR=#333333]Number[/COLOR][COLOR=#333333]>[/COLOR]

So obviously providing the questionLineNumber with 1 (or 0 if you treat these as an array!) would read in the question
Is water made out of H2O? f, and it would read in the answer as well (denoted the by space in between the question and next character, in this case, f).

I suppose it makes it a bit easier, all the GM would have to do would be to change the questionLineNumber parameter each time and the command does the rest! After all the previous command is stored in the maple clipboard thinge so it's easy to modify the last command. Also, since the players are most likely muted, when you warp them out, you could unmute them as well. Just an idea! I guess it's pretty similar to what Nexon have done with their WZ files.
 
Last edited:
It is possible to randomize from a text file, code warp in and out, automate the events, etc. But I'll keep this simple so it's easier to add.

But about the text file method, only the server admin (or people who have access to the source) can make custom questions. Otherwise, normal GMs can't really do much.
 
It is possible to randomize from a text file, code warp in and out, automate the events, etc. But I'll keep this simple so it's easier to add.

But about the text file method, only the server admin (or people who have access to the source) can make custom questions. Otherwise, normal GMs can't really do much.

Oh you're right; completely forgot about that. I guess you'd have to have an online file or something, but that's something each owner can sort out.

I had a couple of questions:

PHP:
final int timeLimit = Math.min(Math.max(Integer.parseInt(splitted[2]), 1), 60);

I had to read this line a few times to work of what was going on. Are you essentially creating a range of valid time inputs to be integers between 1-60?

PHP:
victim.getPosition().y <= -206

What exactly is this range? Everything to the left (extreme) of the plat? What about the extreme right?

Thanks again! :D
 
Oh you're right; completely forgot about that. I guess you'd have to have an online file or something, but that's something each owner can sort out.

I had a couple of questions:

PHP:
final int timeLimit = Math.min(Math.max(Integer.parseInt(splitted[2]), 1), 60);

I had to read this line a few times to work of what was going on. Are you essentially creating a range of valid time inputs to be integers between 1-60?

PHP:
victim.getPosition().y <= -206

What exactly is this range? Everything to the left (extreme) of the plat? What about the extreme right?

Thanks again! :D

Code:
Math.min(Math.max(Integer.parseInt(splitted[2]), 1), 60)
Can me simplified to:
Code:
timeLimit = number you keyed in
timeLimit = the bigger number of timeLimit and 1 (prevents you from setting the value to 0 and below)
timeLimit = the smaller number of timeLimit and 60 (prevents you from setting the value to 61 and above)

As for the x and y values, I'll admit I tried my best to make the code as compact as possible, so it *may* be a tad hard to understand at first glance. But I assure you it's still pretty clean.

Regarding the x values:
Anything on the left of -308: The entire "TRUE" box
Anything between -308 to -142: The middle ground between both sides
Anything on the right of -142: The entire "FALSE" box

Regarding the y values:
Anything above -206: The top platforms (basically outside the playing zone)
 
It shows this error when i put it in the SuperGMCommands.java

Code:
C:\Users\xxx\src\client\messages\commands\SuperGMCommand.java:1572: error: no suitable method found for changeMap(int,int)
                c.getPlayer().changeMap(109020001, 0);
    method MapleCharacter.changeMap(MapleMap,MaplePortal) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
    method MapleCharacter.changeMap(MapleMap) is not applicable
      (actual and formal argument lists differ in length)
    method MapleCharacter.changeMap(MapleMap,Point) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
C:\Users\xxx\src\client\messages\commands\SuperGMCommand.java:1630: error: no suitable method found for changeMap(int,int)
                                                victim.changeMap(100000000,0);
    method MapleCharacter.changeMap(MapleMap,MaplePortal) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
    method MapleCharacter.changeMap(MapleMap) is not applicable
      (actual and formal argument lists differ in length)
    method MapleCharacter.changeMap(MapleMap,Point) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

My changemap function in maplecharacter
public void changeMapBanish(final int mapid, final String portal, final String msg) {
dropMessage(5, msg);
final MapleMap map = client.getChannelServer().getMapFactory().getMap(mapid);
changeMap(map, map.getPortal(portal));
}

public void changeMap(final MapleMap to, final Point pos) {
changeMapInternal(to, pos, CField.getWarpToMap(to, 0x80, this), null);
}

public void changeMap(final MapleMap to) {
changeMapInternal(to, to.getPortal(0).getPosition(), CField.getWarpToMap(to, 0, this), to.getPortal(0));
}

public void changeMap(final MapleMap to, final MaplePortal pto) {
changeMapInternal(to, pto.getPosition(), CField.getWarpToMap(to, pto.getId(), this), null);
}

public void changeMapPortal(final MapleMap to, final MaplePortal pto) {
changeMapInternal(to, pto.getPosition(), CField.getWarpToMap(to, pto.getId(), this), pto);
}

private void changeMapInternal(final MapleMap to, final Point pos, byte[] warpPacket, final MaplePortal pto) {
if (to.mapLocked() && gmLevel < 1) {
dropMessage(6, "There's a strong force holding you back. It seems that there's a battle going on!");
client.getSession().write(CWvsContext.enableActions());
return;
}
if (to == null) {
return;
}
final int nowmapid = map.getId();
if (eventInstance != null) {
eventInstance.changedMap(this, to.getId());
}
final boolean pyramid = pyramidSubway != null;
if (map.getId() == nowmapid) {
client.getSession().write(warpPacket);
final boolean shouldChange = !isClone() && client.getChannelServer().getPlayerStorage().getCharacterById(getId()) != null;
final boolean shouldState = map.getId() == to.getId();
if (shouldChange && shouldState) {
to.setCheckStates(false);
}
map.removePlayer(this);
if (shouldChange) {
map = to;
setPosition(pos);
to.addPlayer(this);
stats.relocHeal(this);
if (shouldState) {
to.setCheckStates(true);
}
}
}
if (pyramid && pyramidSubway != null) { //checks if they had pyramid before AND after changing
pyramidSubway.onChangeMap(this, to.getId());
}
}

any help is much appreciated. thanks
 
It shows this error when i put it in the SuperGMCommands.java

My changemap function in maplecharacter


any help is much appreciated. thanks

Try replacing wif:

public void changeMapBanish(final int mapid, final int portal, final String msg) { //WOT DE FQ
dropMessage(5, msg);
final MapleMap map = client.getChannelServer().getMapFactory().getMap(mapid);
changeMap(map, map.getPortal(portal));
}

public void changeMap(final MapleMap to, final Point pos) {
changeMapInternal(to, pos, CField.getWarpToMap(to, 0x80, this), null);
}

public void changeMap(final MapleMap to) {
changeMapInternal(to, to.getPortal(0).getPosition(), CField.getWarpToMap(to, 0, this), to.getPortal(0));
}

public void changeMap(final MapleMap to, final MaplePortal pto) {
changeMapInternal(to, pto.getPosition(), CField.getWarpToMap(to, pto.getId(), this), null);
}

public void changeMapPortal(final MapleMap to, final MaplePortal pto) {
changeMapInternal(to, pto.getPosition(), CField.getWarpToMap(to, pto.getId(), this), pto);
}

private void changeMapInternal(final MapleMap to, final Point pos, byte[] warpPacket, final MaplePortal pto) {
if (to.mapLocked() && gmLevel < 1) {
dropMessage(6, "There's a strong force holding you back. It seems that there's a battle going on!");
client.getSession().write(CWvsContext.enableActions());
return;
}
if (to == null) {
return;
}
final int nowmapid = map.getId();
if (eventInstance != null) {
eventInstance.changedMap(this, to.getId());
}
final boolean pyramid = pyramidSubway != null;
if (map.getId() == nowmapid) {
client.getSession().write(warpPacket);
final boolean shouldChange = !isClone() && client.getChannelServer().getPlayerStorage().getCharacterById(getId()) != null;
final boolean shouldState = map.getId() == to.getId();
if (shouldChange && shouldState) {
to.setCheckStates(false);
}
map.removePlayer(this);
if (shouldChange) {
map = to;
setPosition(pos);
to.addPlayer(this);
stats.relocHeal(this);
if (shouldState) {
to.setCheckStates(true);
}
}
}
if (pyramid && pyramidSubway != null) { //checks if they had pyramid before AND after changing
pyramidSubway.onChangeMap(this, to.getId());
}
}

or simply change that function with another sources/repacks.
 
It shows this error when i put it in the SuperGMCommands.java

Code:
C:\Users\xxx\src\client\messages\commands\SuperGMCommand.java:1572: error: no suitable method found for changeMap(int,int)
                c.getPlayer().changeMap(109020001, 0);
    method MapleCharacter.changeMap(MapleMap,MaplePortal) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
    method MapleCharacter.changeMap(MapleMap) is not applicable
      (actual and formal argument lists differ in length)
    method MapleCharacter.changeMap(MapleMap,Point) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
C:\Users\xxx\src\client\messages\commands\SuperGMCommand.java:1630: error: no suitable method found for changeMap(int,int)
                                                victim.changeMap(100000000,0);
    method MapleCharacter.changeMap(MapleMap,MaplePortal) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
    method MapleCharacter.changeMap(MapleMap) is not applicable
      (actual and formal argument lists differ in length)
    method MapleCharacter.changeMap(MapleMap,Point) is not applicable
      (actual argument int cannot be converted to MapleMap by method invocation conversion)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

My changemap function in maplecharacter


any help is much appreciated. thanks

Search for your !warp function. In almost (if not all) servers, the commands work by !warp <Map ID>. See how they get MapleMap from the map ID, and replicate it in the command.
 
Back