Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

[Help]Change command from GMS v0.83 to Lithium Version

Junior Spellweaver
Joined
Apr 29, 2011
Messages
126
Reaction score
2
Change command from this thread to lithium version
http://forum.ragezone.com/f427/adding-removing-item-command-839704/

It's command that help you to send item to people

This it my edited code.
Code:
} else if (splitted[0].equalsIgnoreCase("playeritem")) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerGain(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3]));
            player.dropMessage("You have given " + victim.getName() + " the item " + splitted[2] + "");
            victim.dropMessage("You have gained an " + splitted[2] + " from " + player.getName() + "");
            } else if (splitted[0].equalsIgnoreCase("playerequip")) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerEquip(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3])); 
           victim.dropMessage("" + player.getName() + " has taken " + splitted[3] + " of " + splitted[2] + " from you.");
            } else if (splitted[0].equalsIgnoreCase("playeruse")) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerUse(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3])); 
            victim.dropMessage("" + player.getName() + " has taken " + splitted[3] + " of " + splitted[2] + " from you.");
            } else if (splitted[0].equalsIgnoreCase("playercash")) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerCash(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3])); 
            victim.dropMessage("" + player.getName() + " has taken " + splitted[3] + " of " + splitted[2] + " from you.");
            } else if (splitted[0].equalsIgnoreCase("playeretc")) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerEtc(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3])); 
            victim.dropMessage("" + player.getName() + " has taken " + splitted[3] + " of " + splitted[2] + " from you.");
            } else if (splitted[0].equalsIgnoreCase("playersetup")) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerSetup(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3])); 
            victim.dropMessage("" + player.getName() + " has taken " + splitted[3] + " of " + splitted[2] + " from you.");
Add this in MapleCharacter
Code:
PHP Code:
        public void playerGain(int item, int amount) {
        if (MapleInventoryManipulator.addById(client, item, (short) amount, null, -1)) {            
        } else {
            try {                [COLOR="#FF0000"]client.getPlayer().getClient().getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(1, " " + client.getPlayer().getName() + " has not recieved their item " + item + "").getBytes());
            } catch (RemoteException ex) {[/COLOR]
            }
        }
        }
        public void playerEquip(int item, int amount) {
        MapleInventoryManipulator.removeById(client, MapleInventoryType.EQUIP, item, amount, true, true);    
        }
        public void playerCash(int item, int amount) {
        MapleInventoryManipulator.removeById(client, MapleInventoryType.CASH, item, amount, true, true);    
        }   
        public void playerUse(int item, int amount) {
        MapleInventoryManipulator.removeById(client, MapleInventoryType.USE, item, amount, true, true);    
        }
        public void playerEtc(int item, int amount) {
        MapleInventoryManipulator.removeById(client, MapleInventoryType.ETC, item, amount, true, true);    
        }    
        public void playerSetup(int item, int amount) {
        MapleInventoryManipulator.removeById(client, MapleInventoryType.SETUP, item, amount, true, true);    
        }

so It have many errors I can't fixed it myself.
please help to do this support lithium version.

Red text is error I receive(they not support to lithium version)

EDIT : so at least I can edit them but It still has one issue

Here is a code I try to edit

MapleCharacter.java(Still need help)
Code:
public void playerGain(int item, int amount) {
        if (MapleInventoryManipulator.addById(client, item, (short) amount, null)) {            
        } else {
            try {
               client.getSession().write(CWvsContext.serverNotice(1, " " + client.getPlayer().getName() + " has not recieved their item " + item + ""));
            [COLOR="#FF0000"]} catch (RemoteException ex) {[/COLOR]
            }
        }
        }

GMCommand.java(Fixed to support lithium)
Code:
public static class playerItem extends CommandExecute {

        @Override
        public int execute(MapleClient c, String[] splitted) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerGain(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3]));
            c.getPlayer().dropMessage(6, "You have given " + victim.getName() + " the item " + splitted[2] + "");
            victim.dropMessage(6, "You have gained an " + splitted[2] + " from " + c.getPlayer().getName() + "");
            return 0;
        }
    }

} catch (RemoteException ex) {
exception RemoteException is neverthrown in body of corresponding try statement

I don't know how to change this to support lithium version.

Thanks for support
 
Last edited:
I will make a start for you, all other things are CopyPaste


Code:
       public static class PlayerItem extends CommandExecute {
         @Override
        public int execute(MapleClient c, String[] splitted) {
          MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            COPYPASTE
             }

          }
 
Upvote 0
I will make a start for you, all other things are CopyPaste


Code:
       public static class PlayerItem extends CommandExecute {
         @Override
        public int execute(MapleClient c, String[] splitted) {
          MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            COPYPASTE
             }

          }
Did you read top of topic?
That pattern I already know
but I don't know how to make it support at maplecharacter.java part

Here is a code I try to edit

MapleCharacter.java(Still need help)
Code:
public void playerGain(int item, int amount) {
        if (MapleInventoryManipulator.addById(client, item, (short) amount, null)) {            
        } else {
            try {
               client.getSession().write(CWvsContext.serverNotice(1, " " + client.getPlayer().getName() + " has not recieved their item " + item + ""));
            [COLOR="#FF0000"]} catch (RemoteException ex) {[/COLOR]
            }
        }
        }

GMCommand.java(Fixed to support lithium)
Code:
public static class playerItem extends CommandExecute {

        @Override
        public int execute(MapleClient c, String[] splitted) {
            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
            victim.playerGain(Integer.parseInt(splitted[2]),Integer.parseInt(splitted[3]));
            c.getPlayer().dropMessage(6, "You have given " + victim.getName() + " the item " + splitted[2] + "");
            victim.dropMessage(6, "You have gained an " + splitted[2] + " from " + c.getPlayer().getName() + "");
            return 0;
        }
    }

} catch (RemoteException ex) {
exception RemoteException is neverthrown in body of corresponding try statement

I don't know how to change this to support lithium version.
 
Last edited:
Upvote 0
Just change it to Exception..... lol?

Code:
public void playerGain(int item, int amount){
        if (MapleInventoryManipulator.addById(client, item, (short) amount, null)) {            
        } else {
            try {
               client.getSession().write(CWvsContext.serverNotice(1, " " + client.getPlayer().getName() + " has not recieved their item " + item + ""));
            } catch (Exception ex) {
            }
        }
 
Upvote 0
Just change it to Exception..... lol?

Code:
public void playerGain(int item, int amount){
        if (MapleInventoryManipulator.addById(client, item, (short) amount, null)) {            
        } else {
            try {
               client.getSession().write(CWvsContext.serverNotice(1, " " + client.getPlayer().getName() + " has not recieved their item " + item + ""));
            } catch (Exception ex) {
            }
        }
lol. Thanks anyway:lol:.
 
Upvote 0
Back