This one warps everyone in your map to another map.
Usage : !warpthismap <map>
Usage : !warpmap <from> <to>Code:} else if (splitted[0].equalsIgnoreCase("!warpthismap")) { for (MapleCharacter ipwn : cserv.getPlayerStorage().getAllCharacters()) { if (ipwn.getMapId() == player.getMapId()) { ipwn.changeMap(Integer.parseInt(splitted[1])); } else { return; } }
That will make everyone from a certain map warped to a you choose.
Usage : !message <player> <message>Code:} else if (splitted[0].equalsIgnoreCase("!warpmap")) { for (MapleCharacter ipwn : cserv.getPlayerStorage().getAllCharacters()) { if (ipwn.getMapId() == Integer.parseInt(splitted[1])) { ipwn.changeMap(Integer.parseInt(splitted[2])); } else { return; } }
This one is just to send a message to people for fun <3
Usage : !killplayers //I've got a feeling its released thoughCode:} else if (splitted[0].equals("!message")) { MapleCharacter target = cserv.getPlayerStorage().getCharacterByName(splitted[1]); if (target != null) { target.dropMessage(StringUtil.joinStringFrom(splitted, 2)); } else { mc.dropMessage("Player isn't online."); }
Kills everyone on teh server
Usage : !killmapCode:} else if (splitted[0].equalsIgnoreCase("!killplayers")) { for (MapleCharacter ipwn : cserv.getPlayerStorage().getAllCharacters()) {{ ipwn.setHp(0); ipwn.updateSingleStat(MapleStat.HP, ipwn.getHp()); } }
Kills everyone except GM's on the map
Usage : !dcmapCode:} else if (splitted[0].equalsIgnoreCase("!killmap")) { for (MapleCharacter ipwn : player.getMap().getCharacters()) { if (ipwn != null && ipwn.isGM() == false) { ipwn.setHp(0); ipwn.updateSingleStat(MapleStat.HP, ipwn.getHp()); } }
Disconnects everyone who isnt a gm.
Usage : !pnpc <npcid> Add the functions belowCode:} else if (splitted[0].equalsIgnoreCase("!dcmap")) { for (MapleCharacter ipwn : cserv.getPlayerStorage().getAllCharacters()) { if (ipwn.getMapId() == player.getMapId()) { if (!ipwn.isGM()) { ipwn.getClient().disconnect(true); } } }
Spawns a permanent NPC
For !pnpcCode:} else if (splitted[0].equals("!pnpc")) { int npcId = Integer.parseInt(splitted[1]); MapleNPC npc = MapleLifeFactory.getNPC(npcId); int xpos = player.getPosition().x; int ypos = player.getPosition().y; int fh = player.getMap().getFootholds().findBelow(player.getPosition()).getId(); if (npc != null && !npc.getName().equals("MISSINGNO")) { npc.setPosition(player.getPosition()); npc.setCy(ypos); npc.setRx0(xpos + 50); npc.setRx1(xpos - 50); npc.setFh(fh); npc.setCustom(true); try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO spawns ( idd, f, fh, cy, rx0, rx1, type, x, y, mid ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"); ps.setInt(1, npcId); ps.setInt(2, 0); ps.setInt(3, fh); ps.setInt(4, ypos); ps.setInt(4, ypos); ps.setInt(5, xpos + 50); ps.setInt(6, xpos - 50); ps.setString(7, "n"); ps.setInt(8, xpos); ps.setInt(9, ypos); ps.setInt(10, player.getMapId()); ps.executeUpdate(); ps.close(); } catch (SQLException e) { mc.dropMessage("Failed to save NPC to the database"); } player.getMap().addMapObject(npc); player.getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc)); } else { mc.dropMessage("You have entered an invalid Npc-Id"); }
MaplePacketCreator.java
Usage : !pmob <mob> <respawn time> Add the things below.Code:public static MaplePacket spawnNPC(MapleNPC life) { MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.writeShort(SendPacketOpcode.SPAWN_NPC.getValue()); mplew.writeInt(life.getObjectId()); mplew.writeInt(life.getId()); mplew.writeShort(life.getPosition().x); mplew.writeShort(life.getCy()); if (life.getF() == 1) { mplew.write(0); } else { mplew.write(1); } mplew.writeShort(life.getFh()); mplew.writeShort(life.getRx0()); mplew.writeShort(life.getRx1()); mplew.write(1); return mplew.getPacket(); }
Spawns a permanent mob
For !pmob,Code:} else if (splitted[0].equals("!pmob")) { int npcId = Integer.parseInt(splitted[1]); int mobTime = Integer.parseInt(splitted[2]); MapleMonster mob = MapleLifeFactory.getMonster(npcId); if (mob != null && !mob.getName().equals("MISSINGNO")) { mob.setPosition(c.getPlayer().getPosition()); mob.setCy(c.getPlayer().getPosition().y); mob.setRx0(c.getPlayer().getPosition().x + 50); mob.setRx1(c.getPlayer().getPosition().x - 50); mob.setFh(c.getPlayer().getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId()); Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO spawns ( idd, f, fh, cy, rx0, rx1, type, x, y, mid, mobtime ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"); ps.setInt(1, npcId); ps.setInt(2, 0); ps.setInt(3, c.getPlayer().getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId()); ps.setInt(4, c.getPlayer().getPosition().y); ps.setInt(5, c.getPlayer().getPosition().x + 50); ps.setInt(6, c.getPlayer().getPosition().x - 50); ps.setString(7, "m"); ps.setInt(8, c.getPlayer().getPosition().x); ps.setInt(9, c.getPlayer().getPosition().y); ps.setInt(10, c.getPlayer().getMapId()); ps.setInt(11, mobTime); ps.executeUpdate(); ps.close(); c.getPlayer().getMap().addMonsterSpawn(mob, mobTime); } else { mc.dropMessage("You have entered an invalid Npc-Id"); }
AbstractMapleMapObject.java. Replace it with
For !pmob.Code:/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> 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/>. */ package net.sf.odinms.server.maps; import java.awt.Point; public abstract class AbstractMapleMapObject implements MapleMapObject { private Point position = new Point(); private int objectId; public abstract MapleMapObjectType getType(); @Override public Point getPosition() { return new Point(position); } @Override public void setPosition(Point position) { this.position.x = position.x; this.position.y = position.y; } @Override public int getObjectId() { return objectId; } @Override public void setObjectId(int id) { this.objectId = id; } }
In MapleMap.java
For !pmobCode:public void addMonsterSpawn(MapleMonster monster, int mobTime) { Point newpos = calcPointBelow(monster.getPosition()); newpos.y -= 1; SpawnPoint sp = new SpawnPoint(monster, newpos, mobTime); monsterSpawn.add(sp); if (sp.shouldSpawn() || mobTime == -1) { // -1 does not respawn and should not either but force ONE spawn sp.spawnMonster(this); } }
MapleMapFactory.java
Add,
below map.setFootholds(fTree);Code:try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM spawns WHERE mid = ?"); ps.setInt(1, omapid); ResultSet rs = ps.executeQuery(); while (rs.next()) { int id = rs.getInt("idd"); int f = rs.getInt("f"); boolean hide = false; String type = rs.getString("type"); int fh = rs.getInt("fh"); int cy = rs.getInt("cy"); int rx0 = rs.getInt("rx0"); int rx1 = rs.getInt("rx1"); int x = rs.getInt("x"); int y = rs.getInt("y"); int mobTime = rs.getInt("mobtime"); AbstractLoadedMapleLife myLife = loadLife(id, f, hide, fh, cy, rx0, rx1, x, y, type); if(type.equals("n")) { map.addMapObject(myLife); } else if (type.equals("m")) { MapleMonster monster = (MapleMonster) myLife; map.addMonsterSpawn(monster, mobTime); } } } catch(SQLException e) { log.info(e.toString()); }
Spawn Monster for NPCConversationManager.java
Usage : cm.summonMob(monsterid, hp, exp, amount);
Code:import net.sf.odinms.server.life.MapleLifeFactory; import net.sf.odinms.server.life.MapleMonster; import net.sf.odinms.server.life.MapleMonsterStats;Another one :Code:public void summonMob(int id,int hp,int exp,int amount){ MapleMonsterStats newStats = new MapleMonsterStats(); if(hp > 0) newStats.setHp(hp); if(exp >= 0) newStats.setExp(exp); if(amount <= 1){ MapleMonster npcmob = MapleLifeFactory.getMonster(id); npcmob.setOverrideStats(newStats); npcmob.setHp(npcmob.getMaxHp()); getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, getPlayer().getPosition()); } else{ for (int i = 0; i < amount; i++) { MapleMonster npcmob = MapleLifeFactory.getMonster(id); npcmob.setOverrideStats(newStats); npcmob.setHp(npcmob.getMaxHp()); getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, getPlayer().getPosition()); } } }
Usage : cm.spawnMob(map, mobid, x, y); Requires import from above.
Random stat items for NPC'sCode:public void spawnMob(int mapid, int id, int xpos, int ypos) { ChannelServer cserv = getClient().getChannelServer(); MapleMap map = cserv.getMapFactory().getMap(mapid); MapleMonster mob = MapleLifeFactory.getMonster(id); Point spawnpoint = new Point(xpos, ypos); map.spawnMonsterOnGroudBelow(mob, spawnpoint); }
MapleItemInformationProvider.jav Only if you dont have it.
Code:public Equip randomizeStats(MapleClient c, Equip equip) { short x = 1; equip.setStr(getRandStat(equip.getStr(), 5, x)); equip.setDex(getRandStat(equip.getDex(), 5, x)); equip.setInt(getRandStat(equip.getInt(), 5, x)); equip.setLuk(getRandStat(equip.getLuk(), 5, x)); equip.setMatk(getRandStat(equip.getMatk(), 5, x)); equip.setWatk(getRandStat(equip.getWatk(), 5, x)); equip.setAcc(getRandStat(equip.getAcc(), 5, x)); equip.setAvoid(getRandStat(equip.getAvoid(), 5, x)); equip.setJump(getRandStat(equip.getJump(), 5, x)); equip.setSpeed(getRandStat(equip.getSpeed(), 5, x)); equip.setWdef(getRandStat(equip.getWdef(), 10, x)); equip.setMdef(getRandStat(equip.getMdef(), 10, x)); equip.setHp(getRandStat(equip.getHp(), 10, x)); equip.setMp(getRandStat(equip.getMp(), 10, x)); return equip; }NOTE : Already in Xotic. Credits -> Xotic teamCode:private short getRandStat(short defaultValue, int maxRange, short additionalStats) { if (defaultValue == 0) { return 0; } int lMaxRange = (int) Math.min(Math.ceil(defaultValue * 0.1), maxRange); return (short) ((defaultValue - lMaxRange) + Math.floor(rand.nextDouble() * (lMaxRange * 2 + 1 * additionalStats))); }
AbstractPlayerInteraction.java
Usage : cm.gainItem(itemid, quantity, boolean random, boolean show);
To make the stats random and show that you gained it use this
cm.gainItem(id, quantity, true, true);
Usage : !spawnmob <mobid> <hp> <exp> <amount (optional)>Code:public boolean gainItem(int id, short quantity, boolean randomStats, boolean show) { if (quantity >= 0) { MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); IItem item = ii.getEquipById(id); MapleInventoryType type = ii.getInventoryType(id); if (type.equals(MapleInventoryType.EQUIP) && !ii.isThrowingStar(item.getItemId()) && !ii.isBullet(item.getItemId())) { if (!getPlayer().getInventory(type).isFull()) { if (randomStats) { MapleInventoryManipulator.addFromDrop(c, ii.randomizeStats(getClient(), (Equip) item), false); } else { MapleInventoryManipulator.addFromDrop(c, (Equip) item, false); } } else { c.getPlayer().dropMessage(1, "Your inventory is full. Please remove an item from your " + type.name().toLowerCase() + " inventory."); return false; } } else if (MapleInventoryManipulator.checkSpace(c, id, quantity, "")) { if (id >= 5000000 && id <= 5000100) { if (quantity > 1) { quantity = 1; } int petId = MaplePet.createPet(id); MapleInventoryManipulator.addById(c, id, (short) 1, null, petId); if (show) { c.getSession().write(MaplePacketCreator.getShowItemGain(id, quantity)); } } else { MapleInventoryManipulator.addById(c, id, quantity); } } else { c.getPlayer().dropMessage(1, "Your inventory is full. Please remove an item from your " + type.name().toLowerCase() + " inventory."); return false; } if (show) { c.getSession().write(MaplePacketCreator.getShowItemGain(id, quantity, true)); } } else { MapleInventoryManipulator.removeById(c, MapleItemInformationProvider.getInstance().getInventoryType(id), id, -quantity, true, false); } return true; }
Spawns a monster with the specified hp and exp
Usage : !rstripCode:} else if (splitted[0].equalsIgnoreCase("!spawnmob")) { MapleMonsterStats newStats = new MapleMonsterStats(); int mobid = Integer.parseInt(splitted[1]); int HP = Integer.parseInt(splitted[2]); int EXP = Integer.parseInt(splitted[3]); int amount = Math.min(getOptionalIntArg(splitted, 4, 1), 100); if (HP != 0) { newStats.setHp(HP); } if (EXP != 0) { newStats.setExp(EXP); } if (amount == 1){ MapleMonster npcmob = MapleLifeFactory.getMonster(mobid); npcmob.setOverrideStats(newStats); npcmob.setHp(HP); npcmob.setMp(npcmob.getMaxMp()); player.getMap().spawnMonsterOnGroundBelow(npcmob, player.getPosition()); } else { for (int i = 0; i < amount; i++) { MapleMonster npcmob = MapleLifeFactory.getMonster(mobid); npcmob.setOverrideStats(newStats); npcmob.setHp(HP); npcmob.setMp(npcmob.getMaxMp()); player.getMap().spawnMonsterOnGroundBelow(npcmob, player.getPosition()); } }
Randomly strips a player.
Note : Remove the inBoss part or either addd it in.Code:} else if (splitted[0].equals("!rstrip")) { int randNoob = (int) Math.floor(Math.random() * c.getChannelServer().getConnectedClients()); MapleCharacter nub = player.getPlayers().get(randNoob); if (!nub.inBoss()) { nub.unequipEverything(); nub.dropMessage("A swift change in the wind made your clothes fly away!"); mc.dropMessage(nub.getName() + " got stripped!"); } else { nub = player.getPlayers().get(randNoob); if (!nub.inBoss()) { nub.dropMessage("A swift change in the wind made your clothes fly away!"); mc.dropMessage(nub.getName() + " got stripped!"); } }
I think you need this too. If it isn't there. Cause i made this longgg ago :(
[b]MapleCharacter.java[b]
If anyone has any requests just post here =)Code:public List<MapleCharacter> getPlayers() { return new ArrayList<MapleCharacter>(getClient().getChannelServer().getPlayerStorage().getAllCharacters()); }
For people who say its useless. Maybe it is. But for some people it isnt =)
For people who's gonna flame. Why'd you flame if it doesnt even affect you.
It's not a must for you to add.



Reply With Quote![Couple of Commands[Updates : 6]](http://ragezone.com/hyper728.png)

