Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Source] [v83] MoopleDEV | Multi Worlds | Rev 120 | Rev121 Snapshot

Status
Not open for further replies.
Newbie Spellweaver
Joined
Jun 14, 2014
Messages
6
Reaction score
0
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Hi Kevin I wanted to know how is moopledev rev 121 coming along?
 
Last edited:
Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

where can i find features for this repack? what are some of your suggestions?
 
Custom Title Activated
Loyal Member
Joined
Jun 30, 2008
Messages
3,451
Reaction score
1,616
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Idunno if you did or not, but you should redo the whole minigame/ interaction stuff
Doing part by part. Minigames/interactions doesn't have a high priority for me. There is parts that are way more important for the gameplay.

Update: Fixed UserHit, changed commands (no switch list, classes and a map now.)
 
Supreme Arcanarch
Joined
Apr 1, 2012
Messages
946
Reaction score
329
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Doing part by part. Minigames/interactions doesn't have a high priority for me. There is parts that are way more important for the gameplay.

Update: Fixed UserHit, changed commands (no switch list, classes and a map now.)

means we register commands or?
 
Supreme Arcanarch
Loyal Member
Joined
Oct 18, 2009
Messages
914
Reaction score
335
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

By official server files do you mean the BMS v53 leak? Also what was wrong with the drops?
 
Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Where can i find some player commands / more gm commands for v120? maybe some fixes..
 
Junior Spellweaver
Joined
Mar 16, 2013
Messages
167
Reaction score
20
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

I 'm going to post here a small release. It is the commands using reflection, and level-controlled by rights:

First of all in MYSQL run this code:
Code:
DROP TABLE IF EXISTS `moopledev`.`character_rights`;
CREATE TABLE  `moopledev`.`character_rights` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `characterid` int(11) NOT NULL,
  `command` varchar(45) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

then go to MapleCharacter.java and add this after a ps.close in loadCharFromDB method

Code:
//Load Char rights (for commands)
            ps = con.prepareStatement("SELECT * FROM character_rights WHERE characterid = ?");
            ps.setInt(1, charid);
            rs = ps.executeQuery();
            
            while (rs.next()) {
                ret.charRights.add(rs.getString("command"));
            }
            
            rs.close();
            ps.close();

before "private MapleCharaceter() {" add:
Code:
private List<String> charRights = new ArrayList<String>();

somewhere in MapleCharacter.java:
Code:
public boolean canExecuteCommand(String command) {
        if(charRights.contains(command)) {
            return true;
        } else {
            this.message("You can not use this command");
        }
        return false;
    }

Create a new class in client.command called CommandHandler.java
Code:
package client.command;


import client.MapleClient;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author BMS2
 */
public class CommandHandler {
   public static Object executeCommand(String[] arrayCommand, MapleClient c) {
        try {
            String command = arrayCommand[0].toLowerCase();
            String command2 = command.substring(0,1).toUpperCase() + command.substring(1);
            Class<?> commandClass = Class.forName("client.command.handlers."+command2);
            Object ins = commandClass.newInstance();
            Method method = ins.getClass().getDeclaredMethod("executeCommand",String[].class,MapleClient.class);
            method.invoke(ins,arrayCommand,c);
        } catch (ClassNotFoundException | InstantiationException |SecurityException | InvocationTargetException | IllegalAccessException | NoSuchMethodException | IllegalArgumentException t) {
            c.getPlayer().message("Unable to find this command");
        }
        return null;
    }
}

Now create a new package called client.command.handlers and here you'll create all your classes corresponding to the command name (Starting with first letter uppercase)
example: Spawn.java
Code:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


package client.command.handlers;


import client.MapleCharacter;
import client.MapleClient;
import net.server.Server;
import net.server.channel.Channel;
import server.life.MapleLifeFactory;
import server.life.MapleMonster;


/**
 *
 * @author BMS2
 */
public final class Spawn {
    private boolean isPlayerCommand = false; //Useless. Just to know if it is a player command;
    
    public final boolean executeCommand(String[] sub, MapleClient c) {
        /*System.out.println("executado");
        return true;*/
        MapleCharacter player = c.getPlayer();
        Channel cserv = c.getChannelServer();
        Server srv = Server.getInstance();
        
        if(!player.canExecuteCommand(sub[0])) {
            return false;
        }
        
        MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(sub[1]));
        if (monster == null) {
            return true;
        }
        if (sub.length > 2) {
            for (int i = 0; i < Integer.parseInt(sub[2]); i++) {
                player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
            }
        } else {
            player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
        }
        return true;
    }
}

Just a few changes in GeneralchatHandler.java
Replace:
Code:
if (heading == '/' || heading == '!' || heading == '@') {
            String[] sp = s.split(" ");
            sp[0] = sp[0].toLowerCase().substring(1);
            if (!Commands.executePlayerCommand(c, sp, heading)) {
                if (chr.isGM()) {
                    if (!Commands.executeGMCommand(c, sp, heading)) {
                        Commands.executeAdminCommand(c, sp, heading);
                    }
                }
            }

with:
Code:
if (((heading == '/' || heading == '!') && chr.isGM()) || heading == '@') {
            String[] sp = s.split(" ");
            sp[0] = sp[0].toLowerCase().substring(1);
            CommandHandler.executeCommand(sp, c);

If you want to give a GM rights to execute a command, you'll need to add the command to the database.
id |characterid |command
1 |30000 |spawn
2 |30000 |online

this is very simple to implement, and I think will be very helpful to set what each GM can do
 
Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Thank you soooo much!! i'm gonna set those right now.. do you have skype i may need a little help if anyone's willing to volunteer? :)



I 'm going to post here a small release. It is the commands using reflection, and level-controlled by rights:

First of all in MYSQL run this code:
Code:
DROP TABLE IF EXISTS `moopledev`.`character_rights`;
CREATE TABLE  `moopledev`.`character_rights` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `characterid` int(11) NOT NULL,
  `command` varchar(45) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

then go to MapleCharacter.java and add this after a ps.close in loadCharFromDB method

Code:
//Load Char rights (for commands)
            ps = con.prepareStatement("SELECT * FROM character_rights WHERE characterid = ?");
            ps.setInt(1, charid);
            rs = ps.executeQuery();
            
            while (rs.next()) {
                ret.charRights.add(rs.getString("command"));
            }
            
            rs.close();
            ps.close();

before "private MapleCharaceter() {" add:
Code:
private List<String> charRights = new ArrayList<String>();

somewhere in MapleCharacter.java:
Code:
public boolean canExecuteCommand(String command) {
        if(charRights.contains(command)) {
            return true;
        } else {
            this.message("You can not use this command");
        }
        return false;
    }

Create a new class in client.command called CommandHandler.java
Code:
package client.command;


import client.MapleClient;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author BMS2
 */
public class CommandHandler {
   public static Object executeCommand(String[] arrayCommand, MapleClient c) {
        try {
            String command = arrayCommand[0].toLowerCase();
            String command2 = command.substring(0,1).toUpperCase() + command.substring(1);
            Class<?> commandClass = Class.forName("client.command.handlers."+command2);
            Object ins = commandClass.newInstance();
            Method method = ins.getClass().getDeclaredMethod("executeCommand",String[].class,MapleClient.class);
            method.invoke(ins,arrayCommand,c);
        } catch (ClassNotFoundException | InstantiationException |SecurityException | InvocationTargetException | IllegalAccessException | NoSuchMethodException | IllegalArgumentException t) {
            c.getPlayer().message("Unable to find this command");
        }
        return null;
    }
}

Now create a new package called client.command.handlers and here you'll create all your classes corresponding to the command name (Starting with first letter uppercase)
example: Spawn.java
Code:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


package client.command.handlers;


import client.MapleCharacter;
import client.MapleClient;
import net.server.Server;
import net.server.channel.Channel;
import server.life.MapleLifeFactory;
import server.life.MapleMonster;


/**
 *
 * @author BMS2
 */
public final class Spawn {
    private boolean isPlayerCommand = false; //Useless. Just to know if it is a player command;
    
    public final boolean executeCommand(String[] sub, MapleClient c) {
        /*System.out.println("executado");
        return true;*/
        MapleCharacter player = c.getPlayer();
        Channel cserv = c.getChannelServer();
        Server srv = Server.getInstance();
        
        if(!player.canExecuteCommand(sub[0])) {
            return false;
        }
        
        MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(sub[1]));
        if (monster == null) {
            return true;
        }
        if (sub.length > 2) {
            for (int i = 0; i < Integer.parseInt(sub[2]); i++) {
                player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
            }
        } else {
            player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
        }
        return true;
    }
}

Just a few changes in GeneralchatHandler.java
Replace:
Code:
if (heading == '/' || heading == '!' || heading == '@') {
            String[] sp = s.split(" ");
            sp[0] = sp[0].toLowerCase().substring(1);
            if (!Commands.executePlayerCommand(c, sp, heading)) {
                if (chr.isGM()) {
                    if (!Commands.executeGMCommand(c, sp, heading)) {
                        Commands.executeAdminCommand(c, sp, heading);
                    }
                }
            }

with:
Code:
if (((heading == '/' || heading == '!') && chr.isGM()) || heading == '@') {
            String[] sp = s.split(" ");
            sp[0] = sp[0].toLowerCase().substring(1);
            CommandHandler.executeCommand(sp, c);

If you want to give a GM rights to execute a command, you'll need to add the command to the database.
id |characterid |command
1 |30000 |spawn
2 |30000 |online

this is very simple to implement, and I think will be very helpful to set what each GM can do



How can i fix my SP and skills setting to 0 after 3rd job advancement?
 
Last edited:
Junior Spellweaver
Joined
Feb 11, 2013
Messages
137
Reaction score
0
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Is family working or you will add it?
 
Custom Title Activated
Loyal Member
Joined
Jun 30, 2008
Messages
3,451
Reaction score
1,616
Re: [Source] [v83] MoopleDEV | Multi Worlds | Rev 120

Update: Revamping MapleCharacter (User now). Changing a lot of methods like exp gaining and stuff.

If you are interested in testing the current version with me, you can either contact me via PM or skype. I will sent you the client and make an account for you.
Credits to DstroyerMS, DeadNetwork, Kurt and Revan for making this possible.
 
Status
Not open for further replies.
Back
Top