- Joined
- Apr 12, 2008
- Messages
- 729
- Reaction score
- 28
This is mainly for when your making a GM, if u want to test if the person can handle it or not first. This gives the person certain GM commands, but not ones that could greatly effect a lot of stuff (i.e. Ban).
I know this was partially started by someone else, but it didnt get very far, and it had almost nothing in it, so i decided to restart the GM Interns.
Everything you see in my post (except for the sql script) was written by me, i took nothing from the old thread (partially bcuz i couldnt find it lol). So please dont flame me saying this was sum1 elses work.
Credits:
Idea - Some other guy...lol i just continued it.
Java scripts - Me
MySQL Script - CandyMan3435
Fixes - Moorgra, Oblivionz
Script is NEWLY edited and fixed. Commands moved to CommandProccessor.java, for anyone who couldnt get commands working, they will now.
Now, for the scripts:
First, execute this MySQL script, credits to CandyMan3435 for giving it to me.
MapleCharacter.java
Under
Add
Under:
Add:
Under:
Add:
Under:
Add:
In MapleClient.java:
Under:
Add:
Under:
Add:
In CommandProccessor.java:
Change it to:
Find:
Change to:
Add:
under
Find:
Change to:
Under
Add
Save and compile. You should now be able to add GM interns. Just change the value in the 'Intern' Column in your DB. Basically the same as making sum1 a GM
Intern commands:
For interns, you use # instead of !. So just put a # in from of ea command.
say
job
spawn
warp
warphere
map
search
item
cleardrops
online
heal
goto
dc
fakerelog
killall
Adding/Removing Intern commands:
Removing:
Find the command in your commandproccessor.java, and delete it, save, compile.
Adding:
Copy a command from your commandproccessor.java, put # in place of !, save, compile.
Questions/Comments? Post em here!
[/size]
I know this was partially started by someone else, but it didnt get very far, and it had almost nothing in it, so i decided to restart the GM Interns.
Everything you see in my post (except for the sql script) was written by me, i took nothing from the old thread (partially bcuz i couldnt find it lol). So please dont flame me saying this was sum1 elses work.
Credits:
Idea - Some other guy...lol i just continued it.
Java scripts - Me
MySQL Script - CandyMan3435
Fixes - Moorgra, Oblivionz
Script is NEWLY edited and fixed. Commands moved to CommandProccessor.java, for anyone who couldnt get commands working, they will now.
Now, for the scripts:
First, execute this MySQL script, credits to CandyMan3435 for giving it to me.
Code:
ALTER TABLE `characters` ADD COLUMN `Intern` tinyint(1) NOT NULL default '0'
MapleCharacter.java
Under
Code:
Private Boolean GM;
Add
Code:
Private Boolean Intern;
Under:
Code:
public boolean isGM() {
return gm;
}
Code:
public boolean isIntern() {
return Intern;
}
Under:
Code:
ret.gm = rs.getInt("gm") == 0 ? false : true;
Code:
ret.Intern = rs.getInt("Intern") == 0 ? false : true;
Under:
Code:
ret.gm = false;
Code:
ret.Intern = false;
In MapleClient.java:
Under:
Code:
private boolean gm;
Code:
private boolean Intern;
Code:
public boolean isGm() {
return gm;
}
Code:
public boolean isIntern() {
return Intern;
}
In CommandProccessor.java:
PHP:
try {
processCommandInternal(c, mc, true, true, command);
}
Change it to:
PHP:
try {
processCommandInternal(c, mc, true, true, command);
}
Find:
PHP:
private static boolean processCommandInternal(MapleClient c, MessageCallback mc, boolean isGM, String line) {
Change to:
PHP:
private static boolean processCommandInternal(MapleClient c, MessageCallback mc, boolean isGM, boolean Intern, String line) {
Add:
PHP:
Intern = c.getPlayer().isIntern();
under
PHP:
ChannelServer cserv = c.getChannelServer();
Find:
PHP:
if (line.charAt(0) == '!' && isGM || line.charAt(0) =='@')
Change to:
PHP:
if (line.charAt(0) == '!' && isGM || line.charAt(0) =='@' || line.charAt(0) == '#' && Intern)
Under
Code:
else if (splitted[0].equals("!pill")) {
MapleInventoryManipulator.addById(c, 2002009, (short) 5, c.getPlayer().getName() + " used !pill", player.getName());
}
Add
Code:
else if (splitted[0].equals("#map")) {
int mapid = Integer.parseInt(splitted[1]);
MapleMap target = cserv.getMapFactory().getMap(mapid);
MaplePortal targetPortal = null;
if (splitted.length > 2) {
try {
targetPortal = target.getPortal(Integer.parseInt(splitted[2]));
} catch (IndexOutOfBoundsException ioobe) {
// noop, assume the gm didn't know how many portals there are
} catch (NumberFormatException nfe) {
// noop, assume that the gm is drunk
}
}
if (targetPortal == null) {
targetPortal = target.getPortal(0);
}
player.changeMap(target, targetPortal);
} else if (splitted[0].equals("#jail")) {
MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
int mapid = 922020000;
if (splitted.length > 2) {
int jailnum = Integer.parseInt(splitted[1]);
if (jailnum == 2) mapid = 922020000;
else if (jailnum == 3) mapid = 923010000;
else if (jailnum == 4) mapid = 980000404;
else if (jailnum == 5) mapid = 680000401;
else if (jailnum == 6) mapid = 670010300;
else if (jailnum == 7) mapid = 809050000;
else if (jailnum == 8) mapid = 109060000;
else if (jailnum == 9) mapid = 980000000;
else if (jailnum == 10) mapid = 109040001;
else if (jailnum == 11) mapid = 925100700;
}
if (victim != null) {
MapleMap target = cserv.getMapFactory().getMap(mapid);
MaplePortal targetPortal = target.getPortal(0);
victim.changeMap(target, targetPortal);
mc.dropMessage(victim.getName() + " was jailed!");
} else {
mc.dropMessage(splitted[1] + " not found!");
}
if (victim != null) {
MapleMap target = cserv.getMapFactory().getMap(mapid);
MaplePortal targetPortal = target.getPortal(0);
victim.changeMap(target, targetPortal);
mc.dropMessage(victim.getName() + " was jailed!");
} else if (splitted[0].equals("#warp")) {
MapleCharacter victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
if (victim1 != null) {
if (splitted.length == 2) {
MapleMap target = victim1.getMap();
c.getPlayer().changeMap(target, target.findClosestSpawnpoint(victim1.getPosition()));
} else {
int mapid1 = Integer.parseInt(splitted[2]);
MapleMap target = ChannelServer.getInstance(c.getChannel()).getMapFactory().getMap(mapid1);
victim1.changeMap(target, target.getPortal(0));
}
} else {
try {
victim1 = c.getPlayer();
WorldLocation loc = c.getChannelServer().getWorldInterface().getLocation(splitted[1]);
if (loc != null) {
mc.dropMessage("You will be cross-channel warped. This may take a few seconds.");
//WorldLocation loc = new WorldLocation(40000, 2);
MapleMap target = c.getChannelServer().getMapFactory().getMap(loc.map);
c.getPlayer().cancelAllBuffs();
String ip = c.getChannelServer().getIP(loc.channel);
c.getPlayer().getMap().removePlayer(c.getPlayer());
victim1.setMap(target);
String[] socket = ip.split(":");
if (c.getPlayer().getTrade() != null) {
MapleTrade.cancelTrade(c.getPlayer());
}
c.getPlayer().saveToDB(true);
if (c.getPlayer().getCheatTracker() != null)
c.getPlayer().getCheatTracker().dispose();
ChannelServer.getInstance(c.getChannel()).removePlayer(c.getPlayer());
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
try {
MaplePacket packet = MaplePacketCreator.getChannelChange(
InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]));
c.getSession().write(packet);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
int map = Integer.parseInt(splitted[1]);
MapleMap target = cserv.getMapFactory().getMap(map);
player.changeMap(target, target.getPortal(0));
}
} catch (/*Remote*/Exception e) {
mc.dropMessage("Something went wrong " + e.getMessage());
}
}
} else if (splitted[0].equals("#warphere")) {
MapleCharacter victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
victim1.changeMap(c.getPlayer().getMap(), c.getPlayer().getMap().findClosestSpawnpoint(
c.getPlayer().getPosition()));
} else if (splitted[0].equals("#search")) {
try {
URL url;
URLConnection urlConn;
BufferedReader dis;
String replaced = "";
if (splitted.length > 1) {
replaced = StringUtil.joinStringFrom(splitted, 1).replace(' ', '%');
} else {
mc.dropMessage("Syntax: !search item name/map name/monster name");
}
url = new URL("http://www.mapletip.com/search_java.php?search_value=" + replaced + "&check=true");
urlConn = url.openConnection();
urlConn.setDoInput(true);
urlConn.setUseCaches(false);
dis = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
String s;
while ((s = dis.readLine()) != null) {
mc.dropMessage(s);
}
mc.dropMessage("Search for " + '"' + replaced.replace('%', ' ') + '"' + " was completed.");
dis.close();
}
catch (MalformedURLException mue) {}
catch (IOException ioe) {}
} else if (splitted[0].equals("#spawn")) {
int mid = Integer.parseInt(splitted[1]);
int num = Math.min(getOptionalIntArg(splitted, 2, 1), 500);
if (mid == 9400203) {
log.info(MapleClient.getLogMessage(player, "Trying to spawn a silver slime"));
return true;
}
Integer hp = getNamedIntArg(splitted, 1, "hp");
Integer exp = getNamedIntArg(splitted, 1, "exp");
Double php = getNamedDoubleArg(splitted, 1, "php");
Double pexp = getNamedDoubleArg(splitted, 1, "pexp");
MapleMonster onemob = MapleLifeFactory.getMonster(mid);
int newhp = 0;
int newexp = 0;
double oldExpRatio = ((double) onemob.getHp() / onemob.getExp());
if (hp != null) {
newhp = hp.intValue();
} else if (php != null) {
newhp = (int) (onemob.getMaxHp() * (php.doubleValue() / 100));
} else {
newhp = onemob.getMaxHp();
}
if (exp != null) {
newexp = exp.intValue();
} else if (pexp != null) {
newexp = (int) (onemob.getExp() * (pexp.doubleValue() / 100));
} else {
newexp = onemob.getExp();
}
if (newhp < 1) {
newhp = 1;
}
double newExpRatio = ((double) newhp / newexp);
if (newExpRatio < oldExpRatio && newexp > 0) {
mc.dropMessage("The new hp/exp ratio is better than the old one. (" + newExpRatio + " < " +
oldExpRatio + ") Please don't do this");
return true;
}
MapleMonsterStats overrideStats = new MapleMonsterStats();
overrideStats.setHp(newhp);
overrideStats.setExp(newexp);
overrideStats.setMp(onemob.getMaxMp());
for (int i = 0; i < num; i++) {
MapleMonster mob = MapleLifeFactory.getMonster(mid);
mob.setHp(newhp);
mob.setOverrideStats(overrideStats);
c.getPlayer().getMap().spawnMonsterOnGroudBelow(mob, c.getPlayer().getPosition());
}
} else if (splitted[0].equals("#say")) {
if (splitted.length > 1) {
MaplePacket packet = MaplePacketCreator.serverNotice(6, "[" + c.getPlayer().getName() + "] " + StringUtil.joinStringFrom(splitted, 1));
try {
ChannelServer.getInstance(c.getChannel()).getWorldInterface().broadcastMessage(
c.getPlayer().getName(), packet.getBytes());
} catch (RemoteException e) {
c.getChannelServer().reconnectWorld();
}
} else {
mc.dropMessage("Syntax: !say <message>");
}
} else if (splitted[0].equals("#job")) {
c.getPlayer().changeJob(MapleJob.getById(Integer.parseInt(splitted[1])));
}else if (splitted[0].equals("#item")) {
short quantity = (short) getOptionalIntArg(splitted, 2, 1);
MapleInventoryManipulator.addById(c, Integer.parseInt(splitted[1]), quantity, c.getPlayer().getName() +
"used !item with quantity " + quantity, player.getName());
} else if (splitted[0].equals("#cleardrops")){
MapleMap map = c.getPlayer().getMap();
double range = Double.POSITIVE_INFINITY;
List<MapleMapObject> items = map.getMapObjectsInRange(c.getPlayer().getPosition(), range, Arrays.asList(MapleMapObjectType.ITEM));
for (MapleMapObject itemmo : items) {
map.removeMapObject(itemmo);
map.broadcastMessage(MaplePacketCreator.removeItemFromMap(itemmo.getObjectId(), 0, c.getPlayer().getId()));
}
mc.dropMessage("You have destroyed " + items.size() + " items on the ground.");
}else if (splitted[0].equals("#online")) { // testing
MessageCallback callback = new ServernoticeMapleClientMessageCallback(c);
StringBuilder builder = new StringBuilder("Characters online: ");
for (MapleCharacter chr : cserv.getPlayerStorage().getAllCharacters()) {
if (builder.length() > 150) {
builder.setLength(builder.length() - 2);
callback.dropMessage(builder.toString());
builder = new StringBuilder();
}
builder.append(MapleCharacterUtil.makeMapleReadable(chr.getName()));
builder.append(", ");
}
builder.setLength(builder.length() - 2);
c.getSession().write(MaplePacketCreator.serverNotice(6, builder.toString()));
} else if (splitted[0].equals("#fakerelog")) {
c.getSession().write(MaplePacketCreator.getCharInfo(player));
player.getMap().removePlayer(player);
player.getMap().addPlayer(player);
} else if (splitted[0].equals("#dc")) {
int level = 0;
MapleCharacter victim1;
if (splitted[1].charAt(0) == '-') {
level = StringUtil.countCharacters(splitted[1], 'f');
victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[2]);
} else {
victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
}
victim1.getClient().getSession().close();
if (level >= 1) {
victim1.getClient().disconnect();
}
if (level >= 2) {
victim1.saveToDB(true);
cserv.removePlayer(victim1);
}
}
else if (splitted[0].equals("#goto")) {
//Map name array
int[] gotomapid = {
180000000, //GmMap
60000, //Southperry
1010000, //Amherst
100000000, //henesys
101000000, //ellinia
102000000, //perion
103000000, //kerning
104000000, //lith
105040300, //sleepywood
110000000, //florina
200000000, //orbis
209000000, //happy
211000000, //elnath
220000000, //ludi
230000000, //aqua
240000000, //leafre
250000000, //mulung
251000000, //herb
221000000, //omega
222000000, //korean (Folk Town)
600000000, //nlc (New Leaf City)
990000000, //excavation (Sharenian/Excavation Site)
230040420, //Pianus cave
240060200, //Horned Tail's cave
100000005, //Mushmom
240020101, //Griffey
240020401, //Manon
682000001, //Headless Horseman
105090900, //Jr.Balrog
280030000, //Zakum's Altar
220080001, //Papulatus map
801000000, //showa Town
200000301, //Guild HeadQuarters
800000000, //Shrine (Mushroom Shrine)
910000000, //Free Market Entrance
240040511, //Skelegon map (Leafre)
109020001, //PVP map (Quiz X and O)
};
String[] gotomapname = {
"gmmap",
"southperry",
"amherst",
"henesys",
"ellinia",
"perion",
"kerning",
"lith",
"sleepywood",
"florina",
"orbis",
"happy",
"elnath",
"ludi",
"aqua",
"leafre",
"mulung",
"herb",
"omega",
"korean",
"nlc",
"excavation",
"pianus",
"horntail",
"mushmom",
"griffey",
"manon",
"horseman",
"balrog",
"zakum",
"papu",
"showa",
"guild",
"shrine",
"fm",
"skelegon",
"pvp"
};
//Function
if (splitted.length < 2) { //If no arguments, list options.
mc.dropMessage("Syntax: !goto <mapname> <optional_target>, where target is char name and mapname is one of:");
mc.dropMessage("gmmap, southperry, amherst, henesys, ellinia, perion, kerning, lith, sleepywood, florina,");
mc.dropMessage("orbis, happy, elnath, ludi, aqua, leafre, mulung, herb, omega, korean, nlc, excavation, pianus");
mc.dropMessage("horntail, mushmom, griffey, manon, horseman, balrog, zakum, papu, showa, guild, shrine, fm, skelegon, pvp");
} else {
for (int i = 0; gotomapid[i] != 0 && gotomapname[i] != null; ++i) { //for every array which isn't empty
if (splitted[1].equals(gotomapname[i])) { //If argument equals name
MapleMap target = cserv.getMapFactory().getMap(gotomapid[i]);
MaplePortal targetPortal = target.getPortal(0);
if (splitted.length < 3) { //If no target name, continue
player.changeMap(target, targetPortal);
} else if (splitted.length > 2) { //If target name, new target
MapleCharacter victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[2]);
victim1.changeMap(target, targetPortal);
}
}
}
}
} else if (splitted[0].equals("#heal")) {
player.setHp(player.getMaxHp());
player.updateSingleStat(MapleStat.HP, player.getMaxHp());
player.setMp(player.getMaxMp());
player.updateSingleStat(MapleStat.MP, player.getMaxMp());
} else if (splitted[0].equals("!killall") || splitted[0].equals("!monsterdebug")) {
MapleMap map = c.getPlayer().getMap();
double range = Double.POSITIVE_INFINITY;
if (splitted.length > 1) {
int irange = Integer.parseInt(splitted[1]);
range = irange * irange;
}
List<MapleMapObject> monsters = map.getMapObjectsInRange(c.getPlayer().getPosition(), range, Arrays
.asList(MapleMapObjectType.MONSTER));
boolean kill = splitted[0].equals("#killall");
for (MapleMapObject monstermo : monsters) {
MapleMonster monster = (MapleMonster) monstermo;
if (kill) {
map.killMonster(monster, c.getPlayer(), false);
} else {
mc.dropMessage("Monster " + monster.toString());
}
}
if (kill) {
mc.dropMessage("You have killed " + monsters.size() + " monsters in your map");
}
}
Save and compile. You should now be able to add GM interns. Just change the value in the 'Intern' Column in your DB. Basically the same as making sum1 a GM
Intern commands:
For interns, you use # instead of !. So just put a # in from of ea command.
say
job
spawn
warp
warphere
map
search
item
cleardrops
online
heal
goto
dc
fakerelog
killall
Adding/Removing Intern commands:
Removing:
Find the command in your commandproccessor.java, and delete it, save, compile.
Adding:
Copy a command from your commandproccessor.java, put # in place of !, save, compile.
Questions/Comments? Post em here!
[/size]
Last edited:

