Couple of Commands[Updates : 6]

Page 1 of 5 12345 LastLast
Results 1 to 15 of 72
  1. #1
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Xerixe's CommandsThread[Updates : 7]

    This one warps everyone in your map to another map.
    Usage : !warpthismap <map>
    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;
                    }
                }
    Usage : !warpmap <from> <to>
    That will make everyone from a certain map warped to a you choose.
    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;
                    }
                }
    Usage : !message <player> <message>
    This one is just to send a message to people for fun <3
    Code:
    } 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.");
                    }
    Usage : !killplayers //I've got a feeling its released though
    Kills everyone on teh server
    Code:
    } else if (splitted[0].equalsIgnoreCase("!killplayers")) {
                for (MapleCharacter ipwn : cserv.getPlayerStorage().getAllCharacters()) {{
                            ipwn.setHp(0);
                            ipwn.updateSingleStat(MapleStat.HP, ipwn.getHp());
                    }
                }
    Usage : !killmap
    Kills everyone except GM's on the map
    Code:
    } 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());
                    }
                }
    Usage : !dcmap
    Disconnects everyone who isnt a gm.
    Code:
    } else if (splitted[0].equalsIgnoreCase("!dcmap")) {
                for (MapleCharacter ipwn : cserv.getPlayerStorage().getAllCharacters()) {
                    if (ipwn.getMapId() == player.getMapId()) {
                        if (!ipwn.isGM()) {
                            ipwn.getClient().disconnect(true);
                        }
                    }
                }
    Usage : !pnpc <npcid> Add the functions below
    Spawns a permanent NPC
    Code:
    } 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");
                }
    For !pnpc
    MaplePacketCreator.java
    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();
    	}
    Usage : !pmob <mob> <respawn time> Add the things below.
    Spawns a permanent mob
    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");
                }
    For !pmob,
    AbstractMapleMapObject.java. Replace it with
    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;
    	}
    }
    For !pmob.
    In MapleMap.java
    Code:
    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);
    		}
    	}
    For !pmob
    MapleMapFactory.java
    Add,
    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());
    				}
    below map.setFootholds(fTree);

    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;
    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());
                        }
                    }        
            }
    Another one :
    Usage : cm.spawnMob(map, mobid, x, y); Requires import from above.
    Code:
    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);
    	}
    Random stat items for NPC's
    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;
        }
    Code:
    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)));
        }
    NOTE : Already in Xotic. Credits -> Xotic team
    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);
    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;
        }
    Usage : !spawnmob <mobid> <hp> <exp> <amount (optional)>
    Spawns a monster with the specified hp and exp
    Code:
    } 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());
                            } 
                    }
    Usage : !rstrip
    Randomly strips a player.
    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!");
                        }
               }
    Note : Remove the inBoss part or either addd it in.
    I think you need this too. If it isn't there. Cause i made this longgg ago :(

    [b]MapleCharacter.java[b]
    Code:
    public List<MapleCharacter> getPlayers() {
    	return new ArrayList<MapleCharacter>(getClient().getChannelServer().getPlayerStorage().getAllCharacters());
        }
    If anyone has any requests just post here =)
    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.
    Last edited by Xerixe; 23-09-09 at 06:07 PM.


  2. #2
    warp(california, "home"); LameJacob is offline
    MemberRank
    Sep 2008 Join Date
    CaliforniaLocation
    537Posts

    Re: Couple of Commands

    Add !pmob and !pnpc, I know it's in the ThePack, but I need the commands!

  3. #3
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: Couple of Commands

    Commands added =)

  4. #4
    Account Upgraded | Title Enabled! mcskills is offline
    MemberRank
    Apr 2008 Join Date
    379Posts

    Re: Couple of Commands

    You added the commands but not the methods on how to get them to work, such as pmob so it would be rather useless to the normal user looking around for some sweet commands to add to their server :(

  5. #5
    Valued Member Quаlitys is offline
    MemberRank
    Apr 2009 Join Date
    103Posts

    Re: Couple of Commands

    You need maplemap functions for the !pmob and !pnpc, and other ones too. And nice release dude.

  6. #6
    Account Upgraded | Title Enabled! Gibberish is offline
    MemberRank
    Apr 2009 Join Date
    312Posts

    Re: Couple of Commands

    add the cm.spawnmonster ;D

  7. #7
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: Couple of Commands

    Fixed !pmob.
    I'll fix !pnpc lata =P

  8. #8
    warp(california, "home"); LameJacob is offline
    MemberRank
    Sep 2008 Join Date
    CaliforniaLocation
    537Posts

    Re: Couple of Commands

    Thank you Xerixe.

  9. #9
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: Couple of Commands

    Added spawn mob for NPCConversationManager like what Gibberish requested <3

  10. #10
    warp(california, "home"); LameJacob is offline
    MemberRank
    Sep 2008 Join Date
    CaliforniaLocation
    537Posts

    Re: Couple of Commands[Updates : 1]

    For the !pmob, what is the time calculated in? Milliseconds?

  11. #11
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: Couple of Commands[Updates : 1]

    Suppose to be.

  12. #12
    Valued Member slayer991133 is offline
    MemberRank
    Nov 2008 Join Date
    Under your BedLocation
    123Posts

    Re: Couple of Commands[Updates : 1]

    lmao thxs for release

  13. #13
    Account Upgraded | Title Enabled! jayypee is offline
    MemberRank
    Mar 2009 Join Date
    AustraliaLocation
    225Posts

    Re: Couple of Commands[Updates : 2]

    Wow nice bro can u add gainrandequip?

  14. #14
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: Couple of Commands[Updates : 2]

    Watcha mean by gainrandequip
    From a list or all the items

  15. #15
    Account Upgraded | Title Enabled! jayypee is offline
    MemberRank
    Mar 2009 Join Date
    AustraliaLocation
    225Posts

    Re: Couple of Commands[Updates : 2]

    Cm.gainrandequip like a item but diff stats i think



Page 1 of 5 12345 LastLast

Advertisement