Dimensional mirror NPC

Lulz.

Code:
/*
	This file is part of the ZeroFusion MapleStory Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>
    ZeroFusion organized by "RMZero213" <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//wtf is #7#?
var maps = Array(980010000, 925020000, 980000000, 980030000, 923020000, 926010000, 910320000, 0, 950100000);
var mapnames = Array("Ariant Coliseum", "Mu Lung Training Center", "Monster Carnival", "Monster Carnival 2", "Dual Raid", "Nett's Pyramid", "Abandoned Subway", "???", "Golden Temple");
var maxLevel = Array(30, 200, 50, 70, 80, 200, 30, 0, 200);
var minLevel = Array(21, 25, 30, 51, 60, 40, 25, 0, 15);

function start() {
	var selStr = "";
	for (var i = 0; i < maps.length; i++) {
		if (cm.getPlayer().getLevel() >= minLevel[i] && cm.getPlayer().getLevel() <= maxLevel[i]) {
			selStr += "#" + i + "# " + mapnames[i];
		}
	}
	if (selStr.length <= 0) {
		cm.dispose(); //or should we send -1?
		return;
	}
	cm.sendMirror(selStr);
}

function action(mode, type, selection) {
	if (mode == 1 && selection >= 0 && cm.getPlayer().getLevel() >= minLevel[selection] && cm.getPlayer().getLevel() <= maxLevel[selection]) {
		cm.saveLocation("DIMENSIONAL");
		cm.warp(maps[selection]);
	}
	cm.dispose();
}
 
Last edited:
Lulz.

Code:
/*
	This file is part of the ZeroFusion MapleStory Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>
    ZeroFusion organized by "RMZero213" <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//wtf is #7#?
var maps = Array(980010000, 925020000, 980000000, 980030000, 923020000, 926010000, 910320000, 0, 950100000);
var mapnames = Array("Ariant Coliseum", "Mu Lung Training Center", "Monster Carnival", "Monster Carnival 2", "Dual Raid", "Nett's Pyramid", "Abandoned Subway", "???", "Golden Temple");
var maxLevel = Array(30, 200, 50, 70, 80, 200, 30, 0, 200);
var minLevel = Array(21, 25, 30, 51, 60, 40, 25, 0, 15);

function start() {
	var selStr = "";
	for (var i = 0; i < maps.length; i++) {
		if (cm.getPlayer().getLevel() >= minLevel[i] && cm.getPlayer().getLevel() <= maxLevel[i]) {
			selStr += "#" + i + "# " + mapnames[i];
		}
	}
	if (selStr.length <= 0) {
		cm.dispose(); //or should we send -1?
		return;
	}
	cm.sendMirror(selStr);
}

function action(mode, type, selection) {
	if (mode == 1 && selection >= 0 && cm.getPlayer().getLevel() >= minLevel[selection] && cm.getPlayer().getLevel() <= maxLevel[selection]) {
		cm.saveLocation("DIMENSIONAL");
		cm.warp(maps[selection]);
	}
	cm.dispose();
}

If I remember correctly, you can completely eliminate the mapnames array and change this...

PHP:
selStr += "#" + i + "# " + mapnames[i];

to this...

PHP:
selStr += "#"+i+"##m"+maps[i]+"#";

It would do the same exact thing, except it's removing the pointless array. I also don't see the point in including this

selection >= 0

into the final condition. The only way the selection wouldn't be greater than or equal to 0 is if they hit end chat, which would set the mode to 0 anyways and make the rest of the script null. When they make a selection, it sets the mode to 1, so your opening condition already verifies that they made a selection. Having selection >= 0 is basically stating "I know you made a selection but I want to see if you made a selection".
 
If I remember correctly, you can completely eliminate the mapnames array and change this...

PHP:
selStr += "#" + i + "# " + mapnames[i];

to this...

PHP:
selStr += "#"+i+"##m"+maps[i]+"#";
:thumbup:
It would do the same exact thing, except it's removing the pointless array. I also don't see the point in including this

selection >= 0

into the final condition. The only way the selection wouldn't be greater than or equal to 0 is if they hit end chat, which would set the mode to 0 anyways and make the rest of the script null. When they make a selection, it sets the mode to 1, so your opening condition already verifies that they made a selection. Having selection >= 0 is basically stating "I know you made a selection but I want to see if you made a selection".

But I think OfficialMS not displaying the real map names.
 
If I remember correctly, you can completely eliminate the mapnames array and change this...

PHP:
selStr += "#" + i + "# " + mapnames[i];

to this...

PHP:
selStr += "#"+i+"##m"+maps[i]+"#";

It would do the same exact thing, except it's removing the pointless array. I also don't see the point in including this

selection >= 0

into the final condition. The only way the selection wouldn't be greater than or equal to 0 is if they hit end chat, which would set the mode to 0 anyways and make the rest of the script null. When they make a selection, it sets the mode to 1, so your opening condition already verifies that they made a selection. Having selection >= 0 is basically stating "I know you made a selection but I want to see if you made a selection".

If you sniffed the packet yourself, you'd know that GMS actually uses their own defined map names, they dont use #m[mapname]#. The icon of the map in the packet displayed is dependent on the selection itself, not the map name passed to it. You can change mapname to anything you like and the icons will still remain the same. I don't even know if #m[mapname]# works in this situation (selections themselves are very different here), but it might.

And selection >= 0 is just a check if they PE'd for a negative selection, but it doesn't really matter here as it would still just dispose, so you are partly right. I already check for it in other files :P:
 
Last edited:
If you sniffed the packet yourself, you'd know that GMS actually uses their own defined map names, they dont use #m[mapname]#. The icon of the map in the packet displayed is dependent on the selection itself, not the map name passed to it. You can change mapname to anything you like and the icons will still remain the same. I don't even know if #m[mapname]# works in this situation (selections themselves are very different here), but it might.

And selection >= 0 is just a check if they PE'd for a negative selection, but it doesn't really matter here as it would still just dispose, so you are partly right. I already check for it in other files :P:

Regardless of GMS having map names defined or not, in the case you are doing, it will simplify it. Odin based sources/repacks use #mMAPID# to show the entire map name. So, if you did what I said, it would remove the pointless mapnames array because it really isn't needed at all, and serves no other purpose than to display the name like my picture showed. #mMAPID# would do the same exact thing. I know this because the selStr variable you are using is in place of the text. You don't absolutely have to do it, I'm just stating it would simplify it a bit. It wouldn't change the performance of it in any way.
 
Regardless of GMS having map names defined or not, in the case you are doing, it will simplify it. Odin based sources/repacks use #mMAPID# to show the entire map name. So, if you did what I said, it would remove the pointless mapnames array because it really isn't needed at all, and serves no other purpose than to display the name like my picture showed. #mMAPID# would do the same exact thing. I know this because the selStr variable you are using is in place of the text. You don't absolutely have to do it, I'm just stating it would simplify it a bit. It wouldn't change the performance of it in any way.

#mMAPID# is not based on Odin, but rather based on the information the client gets. The client is the one that replaces #mMAPID# with the mapname, #L0##l with selection and so on. However selections here work different, so #mMAPID# may not. I haven't tested, so I don't know. But if it does, then yes, it'll simplify. I only used mapnames Array because I didn't think it would work (GMS uses #mMAPID# a lot, especially in quests, yet they didnt use it here) =/
 
Actually, RMZero script is fine, it even got a check for min level that make it more secure.

EDIT:

Reading better, RMZero script will d/c anyone with level between 1~9. Simply because, this NPC_CHAT style doesn't allow to be empty.

Read even more better, because I just dispose and return; if the NPC_CHAT is empty.
 
Back