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!

[Add-On]Staff Tools 1.0]

Status
Not open for further replies.
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
This is my first release. It's going to consist of three different staff tools I've coded. These features are made to make your life easier when you have to investigate suspicious players or when you're curious about an item id. All of these should work for any version.




1st. Inventory Spy:

Description:
This npc checks any player's inventory that is in the same channel as you. It also allows you to see the quantity of any item in any inventory, and it also gives you the option to delete all of the item.


Screenshots:

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums



Source:
You need to add these functions if don't have them already:

In NPCConversationManager.java:
PHP:
    public MapleCharacter getPlayer() {
        return c.getPlayer();
    }
PHP:
    public MapleCharacter getCharByName(String name) {
        try {
            return c.getChannelServer().getPlayerStorage().getCharacterByName(name);
        } catch (Exception e) {
            return null;
        }
    }
PHP:
   public String EquipList(MapleClient c) {
        StringBuilder str = new StringBuilder();
        MapleInventory equip = c.getPlayer().getInventory(MapleInventoryType.EQUIP);
        List<String> stra = new LinkedList<String>();
        for (IItem item : equip.list()) {
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");
        }
        for (String strb : stra) {
            str.append(strb);
        }
        return str.toString();
    }

    public String UseList(MapleClient c) {
        StringBuilder str = new StringBuilder();
        MapleInventory use = c.getPlayer().getInventory(MapleInventoryType.USE);
        List<String> stra = new LinkedList<String>();
        for (IItem item : use.list()) {
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");
        }
        for (String strb : stra) {
            str.append(strb);
        }
        return str.toString();
    }

    public String CashList(MapleClient c) {
        StringBuilder str = new StringBuilder();
        MapleInventory cash = c.getPlayer().getInventory(MapleInventoryType.CASH);
        List<String> stra = new LinkedList<String>();
        for (IItem item : cash.list()) {
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");
        }
        for (String strb : stra) {
            str.append(strb);
        }
        return str.toString();
    }

    public String ETCList(MapleClient c) {
        StringBuilder str = new StringBuilder();
        MapleInventory etc = c.getPlayer().getInventory(MapleInventoryType.ETC);
        List<String> stra = new LinkedList<String>();
        for (IItem item : etc.list()) {
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");
        }
        for (String strb : stra) {
            str.append(strb);
        }
        return str.toString();
    }

    public String SetupList(MapleClient c) {
        StringBuilder str = new StringBuilder();
        MapleInventory setup = c.getPlayer().getInventory(MapleInventoryType.SETUP);
        List<String> stra = new LinkedList<String>();
        for (IItem item : setup.list()) {
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");
        }
        for (String strb : stra) {
            str.append(strb);
        }
        return str.toString();
    }

In MapleCharacter.java:
PHP:
    public int getEquipId(byte slot) {
        MapleInventory equip = getInventory(MapleInventoryType.EQUIP);
        Equip eu = (Equip) equip.getItem(slot);
        return equip.getItem(slot).getItemId();
    }

    public int getUseId(byte slot) {
        MapleInventory use = getInventory(MapleInventoryType.USE);
        return use.getItem(slot).getItemId();
    }

    public int getSetupId(byte slot) {
        MapleInventory setup = getInventory(MapleInventoryType.SETUP);
        return setup.getItem(slot).getItemId();
    }

    public int getCashId(byte slot) {
        MapleInventory cash = getInventory(MapleInventoryType.CASH);
        return cash.getItem(slot).getItemId();
    }

    public int getETCId(byte slot) {
        MapleInventory etc = getInventory(MapleInventoryType.ETC);
        return etc.getItem(slot).getItemId();
    }

PHP:
        public void deleteAll(int id) {
        MapleInventoryManipulator.removeAllById(getClient(), id, true);
    }
PHP:
    public int getItemQuantity(int itemid, boolean checkEquipped) {
        MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(itemid);
        MapleInventory iv = inventory[type.ordinal()];
        int possesed = iv.countById(itemid);
        if (checkEquipped) {
            possesed += inventory[MapleInventoryType.EQUIPPED.ordinal()].countById(itemid);
        }
        return possesed;
    }


Script:

Add this script into any npc:

PHP:
/* * * * * * * * * * * * * * * \
*         Inventory Spy        *
*  By Hugo of MadStory/VoidMS  *
*      gugubro1@gmail.com      *
*         madstory.org         *
*          voidms.com          *
\ * * * * * * * * * * * * * * */

var name;
var status = 0;
var thing = 0;
var slot;
var p = null;

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 2 && status == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            if (cm.getPlayer().getGMLevel() > 2) {
                cm.sendGetText("#eHey #h #! I can check a player's inventory for you. \r\n\r\n#rPlease type in a players' name");
            } else {
                cm.sendOk("#e GTFO NON-GM");
                cm.dispose();
            }
        } else if (status == 1) {
            name = cm.getText(); 
            p = cm.getCharByName(name);
            if (p != null) {
                cm.sendSimple("#eChoose an inventory#b\r\n#L0#Equip#l\r\n#L1#Use#l\r\n#L2#Set-up#l\r\n#L3#ETC#l\r\n#L4#Cash#l");
            } else {
                cm.sendOk("#e#rThe player you are trying to choose either is offline or not in your channel.");
            }
        } else if (status == 2) {
            string = "#eClick on an item to remove #rall#k of it.\r\n#n";
            thing = selection;
            if (selection == 0) {                
                cm.sendSimple(string+cm.EquipList(p.getClient()));
            } else if (selection == 1) {
                cm.sendSimple(string+cm.UseList(p.getClient()));
            } else if (selection == 2) {
                cm.sendSimple(string+cm.SetupList(p.getClient()));
            } else if (selection == 3) {
                cm.sendSimple(string+cm.ETCList(p.getClient()));
            } else if (selection == 4) {
                cm.sendSimple(string+cm.CashList(p.getClient()));
            }
        } else if (status == 3) {
            slot = selection;
            send = "#eThe user has#r ";
            send2 = "#k of the item #i";
            if (thing == 0) {
                send += p.getItemQuantity(p.getEquipId(selection), true);
                send2 += p.getEquipId(selection);
            } else if (thing  == 1) {
                send += p.getItemQuantity(p.getUseId(selection), true);
                send2 += p.getUseId(selection);
            } else if (thing == 2) {
                send += p.getItemQuantity(p.getSetupId(selection), true);
                send2 += p.getSetupId(selection);
            } else if (thing == 3) {
                send += p.getItemQuantity(p.getETCId(selection), true);
                send2 += p.getETCId(selection);
            } else if (thing == 4) {
                send += p.getItemQuantity(p.getCashId(selection), true);
                send2 += p.getCashId(selection);
            }
            var send3 = send + send2 + "# are you sure you want to delete #rall#k of that item?";
            cm.sendYesNo(send3);
        } else if (status == 4) {
            if (thing == 0) { 
                p.deleteAll(p.getEquipId(slot));
            } else if (thing == 1) {
                p.deleteAll(p.getUseId(slot));
            } else if (thing == 2) {
                p.deleteAll(p.getSetupId(slot));
            } else if (thing == 3) {
                p.deleteAll(p.getETCId(slot));
            } else if (thing == 4) {
                p.deleteAll(p.getCashId(slot));
            }
            cm.sendOk("#eSuccessfully deleted " +  name + "'s item");
            cm.dispose();
        }
    }
}




2nd. ItemId Checker:

Description:
This is a simple npc that allows you to view the itemid of any item in any of your inventory. Great if you have wz edits.


Screenshots:

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums

AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums



Source:
I'm assuming you have the functions from the 1st release. If not, make sure you put these in:
  • EquipList
  • UseList
  • SetupList
  • ETCList
  • CashList
  • getEquipId
  • getUseId
  • getSetupId
  • getETCId
  • getCashId


Script:
Add this script to any npc:

PHP:
/* * * * * * * * * * * * * * * \
*        ItemID Checker        *
*   By Hugo of MadStory/VoidMS *
*      gugubro1@gmail.com      *
*         madstory.org         *
*          voidms.com          *
\ * * * * * * * * * * * * * * */

var thing = 0;
var status = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 2 && status == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            cm.sendSimple("#eWhich inventory is your item in?#n#b\r\n#L0#Equip#l\r\n#L1#Use#l\r\n#L2#Set-up#l\r\n#L3#ETC#l\r\n#L4#Cash#l");
        } else if (status == 1) {
            string = "#ePick the item:\r\n#n";
            if (selection == 0) {                
                thing = 0;
                cm.sendSimple(string+cm.EquipList(cm.getC()));
            } else if (selection == 1) {
                thing = 1;
                cm.sendSimple(string+cm.UseList(cm.getC()));
            } else if (selection == 2) {
                thing = 2;
                cm.sendSimple(string+cm.SetupList(cm.getC()));
            } else if (selection == 3) {
                thing = 3;
                cm.sendSimple(string+cm.ETCList(cm.getC()));
            } else if (selection == 4) {
                thing = 4;
                cm.sendSimple(string+cm.CashList(cm.getC()));
            }
        } else if (status == 2) {
            var say = "#eThe item id for #i";
            var say2 = "# is #n#r";
            switch (thing) {
                case 0:
                    cm.sendOk(say + cm.getPlayer().getEquipId(selection) + say2 + cm.getPlayer().getEquipId(selection));
                    break;
                case 1:
                    cm.sendOk(say + cm.getPlayer().getUseId(selection) + say2 + cm.getPlayer().getUseId(selection));
                    break;
                case 2:
                    cm.sendOk(say + cm.getPlayer().getSetupId(selection) + say2 + cm.getPlayer().getSetupId(selection));
                    break;
                case 3:
                    cm.sendOk(say + cm.getPlayer().getETCId(selection) + say2 + cm.getPlayer().getETCId(selection));
                    break;
                case 4:
                    cm.sendOk(say + cm.getPlayer().getCashId(selection) + say2 + cm.getPlayer().getCashId(selection));
                    break;
            }
            cm.dispose();
        }
    }
}




3rd. Chat Watcher:

Description:
This is a command that allows you to see what the victim says in any chat. Syntax: !watch <ign> / !watch <ign> stop / !watch all / !watch clear


Screenshots:
AskHugo - [Add-On]Staff Tools 1.0] - RaGEZONE Forums



Source:
Near the top of MapleCharacter.java:
PHP:
    private MapleCharacter watcher = null;

Somewhere where your other functions are defined, still in MapleCharacter.java:
PHP:
    public void setWatcher(MapleCharacter spy) {
        watcher = spy;
    }

    public void clearWatcher() {
        watcher = null;
    }

    public MapleCharacter getWatcher() {
        return watcher;
    }

Before the third last bracket in GeneralchatHandler.java:
PHP:
            if (c.getPlayer().getWatcher() != null) {
                c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " All] : " + text);
            }


Here's my GeneralchatHandler.java as an example: DO NOT ADD THIS IN

PHP:
package net.sf.odinms.net.channel.handler;

import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.messages.CommandProcessor;
import net.sf.odinms.net.AbstractMaplePacketHandler;

import net.sf.odinms.server.PublicChatHandler;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.StringUtil;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;

public class GeneralchatHandler extends AbstractMaplePacketHandler {

    @Override
    public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
        c.getPlayer().resetAfkTime();
        String text = slea.readMapleAsciiString();
        int show = slea.readByte();
        if (!CommandProcessor.getInstance().processCommand(c, text) && !PublicChatHandler.doChat(c, text)) {
            if (text.charAt(0) != '!') {
                if (text.charAt(0) != '@') {
                    if (c.getPlayer().getCanTalk()) {
                        if ((StringUtil.countCharacters(text, '@') > 4 && c.getPlayer().getGMLevel() < 3 || StringUtil.countCharacters(text, '#') > 4 && c.getPlayer().getGMLevel() < 3 || StringUtil.countCharacters(text, '&') > 4 && c.getPlayer().getGMLevel() < 3 || StringUtil.countCharacters(text, '%') > 4 && c.getPlayer().getGMLevel() < 3 || StringUtil.countCharacters(text, '$') > 4 && c.getPlayer().getGMLevel() < 3)) {
                            text = "I tried to spam, please rape my face.";
                        }
                        if (!c.getPlayer().isHidden()) {
                            if (c.getPlayer().getGMText() == 0) {
                                c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), text, false, show));
                            } else if (c.getPlayer().getGMText() == 7) {
                                c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), text, true, show));
                            } else {
                                switch (c.getPlayer().getGMText()) {
                                    case 1:
                                    case 2:
                                    case 3:
                                    case 4:
                                        //MultiChat
                                        c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.multiChat(c.getPlayer().getName(), text, c.getPlayer().getGMText() - 1));
                                        break;
                                    case 5:
                                    case 6:
                                        //Server Notice
                                        c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.serverNotice(c.getPlayer().getGMText(), c.getPlayer().getName() + " : " + text));
                                        break;
                                    case 8:
                                        //Whisper
                                        c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getWhisper(c.getPlayer().getName(), c.getChannel(), text));
                                        break;
                                    case 9:
                                        //MapleTip
                                        c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.sendYellowTip(c.getPlayer().getName() + " : " + text));
                                        break;
                                }
                                c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), text, false, 1));
                            }
                        } else {
                            c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.serverNotice(5, c.getPlayer().getName() + " : " + text));
                        }
                    } else {
                        c.getPlayer().dropMessage("You cannot talk since you are muted.");
                    }
                } else {
                    c.getPlayer().dropMessage("Player command " + text + " does not exist");
                }
            } else {
                if (c.getPlayer().getGMLevel() < 1) {
                    c.getPlayer().dropMessage("You cannot use staff commands like " + text + ". Feel free to apply for a staff position on the forums");
                } else {
                    c.getPlayer().dropMessage("Staff command " + text + " does not exist");

                }
            }
            if (c.getPlayer().getWatcher() != null) {
                c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " All] : " + text);
            }
        }
    }
}


Before the third last bracket in PartychatHandler.java:
PHP:
            if (c.getPlayer().getWatcher() != null) {
                switch (type) {
                    case 0:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Buddy] : " + chattext);
                        break;
                    case 1:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Party] : " + chattext);
                        break;
                    case 2:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Guild] : " + chattext);
                        break;
                    case 3:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Alliance] : " + chattext);
                        break;
                }
            }


Again, here's my PartychatHandler.java as an example: DO NOT ADD THIS IN

PHP:
package net.sf.odinms.net.channel.handler;

import java.rmi.RemoteException;
import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.messages.CommandProcessor;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;

public class PartychatHandler extends AbstractMaplePacketHandler {
    // private static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(PartychatHandler.class);

    @Override
    public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
        c.getPlayer().resetAfkTime();
        int type = slea.readByte(); // 0 for buddys, 1 for partys
        int numRecipients = slea.readByte();
        int recipients[] = new int[numRecipients];
        for (int i = 0; i < numRecipients; i++) {
            recipients[i] = slea.readInt();
        }
        String chattext = slea.readMapleAsciiString();
        if (!CommandProcessor.getInstance().processCommand(c, chattext)) {
            MapleCharacter player = c.getPlayer();
            if (chattext.charAt(0) != '!') {
                if (chattext.charAt(0) != '@') {
                    if (c.getPlayer().getCanTalk()) {
                        try {
                            if (type == 0) {
                                c.getChannelServer().getWorldInterface().buddyChat(recipients, player.getId(), player.getName(), chattext);
                            } else if (type == 1 && player.getParty() != null) {
                                c.getChannelServer().getWorldInterface().partyChat(player.getParty().getId(), chattext, player.getName());
                            } else if (type == 2 && player.getGuildId() > 0) {
                                c.getChannelServer().getWorldInterface().guildChat(c.getPlayer().getGuildId(), c.getPlayer().getName(), c.getPlayer().getId(), chattext);
                            } else if (type == 3 && player.getGuild() != null) {
                                int allianceId = player.getGuild().getAllianceId();
                                if (allianceId > 0) {
                                    c.getChannelServer().getWorldInterface().allianceMessage(allianceId, MaplePacketCreator.multiChat(player.getName(), chattext, 3), player.getId(), -1);
                                }
                            }
                        } catch (RemoteException e) {
                            c.getChannelServer().reconnectWorld();
                        }
                    } else {
                        c.getPlayer().dropMessage("You cannot talk since you are muted.");
                    }
                } else {
                    c.getPlayer().dropMessage("Player command " + chattext + " does not exist");
                }
            } else {
                if (c.getPlayer().getGMLevel() < 1) {
                    c.getPlayer().dropMessage("You cannot use staff commands like " + chattext + ". Feel free to apply for a staff position on the forums");
                } else {
                    c.getPlayer().dropMessage("Staff command " + chattext + " does not exist");

                }
            }
            if (c.getPlayer().getWatcher() != null) {
                switch (type) {
                    case 0:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Buddy] : " + chattext);
                        break;
                    case 1:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Party] : " + chattext);
                        break;
                    case 2:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Guild] : " + chattext);
                        break;
                    case 3:
                        c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " Alliance] : " + chattext);
                        break;
                }
            }
        }
    }
}


In WhisperHandler.java:

Find:
PHP:
            } else if (mode == 5) { // Find
Before it add:
PHP:
                if (c.getPlayer().getWatcher() != null) {
                    c.getPlayer().getWatcher().dropMessage("[" + c.getPlayer().getName() + " to " + recipient + " Whisper] : " + text);
                }


In your chosen command java file, under any command. Mine is Admin.java:

PHP:
                } else if (splitted[0].equals("!watch")) {
                    MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
                    if (splitted.length == 3) {
                        if (victim != null) {
                            victim.clearWatcher();
                            mc.dropMessage("You stopped watching " + victim.getName());
                        } else {
                            mc.dropMessage("This player isn't in the same channel as you or logged off");
                        }
                    } else if (splitted.length == 2) {
                        if (splitted[1].equalsIgnoreCase("clear")) {
                            for (MapleCharacter chars : cserv.getPlayerStorage().getAllCharacters()) {
                                if (chars.getWatcher() == player) {
                                    chars.clearWatcher();
                                }
                            }
                            mc.dropMessage("You stopped watching everyone in your channel.");
                        } else if (splitted[1].equalsIgnoreCase("all")) {
                            for (MapleCharacter chars : cserv.getPlayerStorage().getAllCharacters()) {
                                if (chars.getWatcher() == null && chars != player) {
                                    chars.setWatcher(player);
                                }
                            }
                            mc.dropMessage("You started watching everyone in your channel. Use '!watch clear' to stop.");
                        } else {
                            if (victim != null) {
                                if (victim.getWatcher() == null) {
                                    victim.setWatcher(player);
                                    mc.dropMessage("You started watching " + victim.getName());
                                } else {
                                    if (victim.getWatcher().getName() != null) {
                                        mc.dropMessage(victim.getWatcher().getName() + " is already watching this player. Use !watch " + victim.getName() + " clear so you can watch this player instead");
                                    } else {
                                        mc.dropMessage("Someone is already watching this player. Use !watch " + victim.getName() + " clear so you can watch this player instead");
                                    }
                                }
                            } else {
                                mc.dropMessage("This player isn't in the same channel as you or logged off");
                            }
                        }
                    } else {
                        mc.dropMessage("Syntax: !watch <ign> / !watch <ign> stop / !watch all / !watch clear");
                    }



That's pretty much all I want to release right now. I might add to this thread at a later date. In the meantime, please post any issues you've encountered or any general difficulties/questions and I'll gladly help. Note that this might need a bit of tweaking for different sources, so be sure to let me know if any don't work. That way I can edit this thread to suit every Java source.

Constructive criticism is greatly appreciated.

UPDATES:
  • There was an error, a function that should be in MapleCharacter not in NPCConversationManager for the Inventory Spy. To fix this: update the first and second script and delete the get[Inventory]Id functions from NPCConversationManager.java and add in the new ones in MapleCharacter.java. If you followed this release sometime after 10:30 PM 3/02/2011 (forum time) you don't have to worry about that.
  • Changed the !watch command. It now drops messages when you start watching. You can stop watching by using '!watch <ign> stop' or anything with three words as long as the first is !watch and the second is the ign.
  • Big update to the !watch command. You can now watch all the players in your channel with a single command and clear all the players on your channel that you're watching.
 
Last edited:
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
Re: Staff Tools 1.0

Good job, I would just recommend one thing. Make 2 more commands that open the NPCs said above (the second one) unless you plan to add a "isGM" check to them because then anyone could find an use them. In fact a command that opens both would be even better. Just a thought though, good job.
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
Re: Staff Tools 1.0

Good job, I would just recommend one thing. Make 2 more commands that open the NPCs said above (the second one) unless you plan to add a "isGM" check to them because then anyone could find an use them. In fact a command that opens both would be even better. Just a thought though, good job.
PHP:
        if (status == 0) {
            if (cm.getPlayer().getGMLevel() > 2) {
                cm.sendGetText("#eHey #h #! I can check a player's inventory for you. \r\n\r\n#rPlease type in a players' name");
            } else {
                cm.sendOk("#e GTFO NON-GM");
                cm.dispose();
            }
There is a gm level check for the first one. The second npc would not cause any damage if used by a player. The command is only usable by GMs. I coded the npcs with the intention of having them in the GM map.

I do, however, have a command for the Inventory Spy in my source. It's just the simple open npc command:
PHP:
                } else if (splitted[0].equalsIgnoreCase("!check")) {
                    NPCScriptManager npc = NPCScriptManager.getInstance();
                    npc.start(c, ITEMIDHERE);
I assumed anyone would be able to do this.
 
Last edited:
Master Summoner
Loyal Member
Joined
Mar 10, 2009
Messages
597
Reaction score
132
Re: Staff Tools 1.0

Very nice release. You clearly put alot of time in to this so props for that.
Theres already search commands so the 2nd one isnt as useful as the first but a ui for it is still fairly cool.
If your goin along the lines of staff tools (for gms who dont have database access and this could even be used for those with it) Try making something that records average damage and allows staff to check it. Just a thought :) keep up the good work though.
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
Re: Staff Tools 1.0

Very nice release. You clearly put alot of time in to this so props for that.
Theres already search commands so the 2nd one isnt as useful as the first but a ui for it is still fairly cool.
If your goin along the lines of staff tools (for gms who dont have database access and this could even be used for those with it) Try making something that records average damage and allows staff to check it. Just a thought :) keep up the good work though.

Search commands take a string and give out the itemid. This is a completely different thing. This should be used if you have an item and you don't know the itemid and !search or !id aren't helping much. I found that it has been useful, specially for servers with those wz editors that don't bother with the string.wz.

The average damage thing seems pretty cool. But how do you think of handling that? Off the top of my head I'd have an integer in MapleCharacter that loads from the db with the current average damage and one with the amount of total hits given. With every hit it recalculates the damage.
PHP:
 average = (average + currdmg) / hits;
Then have that save to the database normally (saveToDB).

But it all seems like a really unnecessary thing for so much work and sql space.

 
Last edited:
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
Re: Staff Tools 1.0

Yeah, while I was waiting for your post I made the commands myself :)
 
Custom Title Activated
Loyal Member
Joined
Mar 17, 2009
Messages
1,911
Reaction score
538
Re: Staff Tools 1.0

I won't have a lot of use for this but, good job! Looks pretty awesome.
 
Master Summoner
Loyal Member
Joined
Mar 10, 2009
Messages
597
Reaction score
132
Re: Staff Tools 1.0

Search commands take a string and give out the itemid. This is a completely different thing. This should be used if you have an item and you don't know the itemid and !search or !id aren't helping much. I found that it has been useful, specially for servers with those wz editors that don't bother with the string.wz.

The average damage thing seems pretty cool. But how do you think of handling that? Off the top of my head I'd have an integer in MapleCharacter that loads from the db with the current average damage and one with the amount of total hits given. With every hit it recalculates the damage.
PHP:
 average = (average + currdmg) / hits;
Then have that save to the database normally (saveToDB).

But it all seems like a really unnecessary thing for so much work and sql space.

Similar concepts in my eyes but thats me

It would be helpful for a minimally staffed server.
Basic algorithm there. If you were going to use it for a more advanced ab you would want it more along the lines of
PHP:
 if get.job = WARRIOR then avgdmg = (curravg + currdmg) / 2 
} else if { get.job = PIRATE then avgdmg = (curravg + currdmg) / 4(or insert random number here)

and so on based on classes because a level 12x pirate can run around hitting a shitload more then lets say a mage
The only issue is that this would more then likely be a very ram/processor intensive feature because of how often the db would be altered in any given second.
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
Re: Staff Tools 1.0

Similar concepts in my eyes but thats me

It would be helpful for a minimally staffed server.
Basic algorithm there. If you were going to use it for a more advanced ab you would want it more along the lines of
PHP:
 if get.job = WARRIOR then avgdmg = (curravg + currdmg) / 2 
} else if { get.job = PIRATE then avgdmg = (curravg + currdmg) / 4(or insert random number here)

and so on based on classes because a level 12x pirate can run around hitting a shitload more then lets say a mage
The only issue is that this would more then likely be a very ram/processor intensive feature because of how often the db would be altered in any given second.

It wouldn't need to be altered every second. You could just make it save on the saveToDB.

And I don't really think we should cripple the average damage by job. I mean, you can take that into consideration later. Better to have the un-edited version. (You forgot to divide by total amount of hits in your algorithm).

But yeah, this is a pretty much unrelated topic. Either open a development/help thread about it, or we can talk in PMs about it.
 
Last edited:
Master Summoner
Loyal Member
Joined
Mar 10, 2009
Messages
597
Reaction score
132
Re: Staff Tools 1.0

It wouldn't need to be altered every second. You could just make it save on the saveToDB.

And I don't really think we should cripple the average damage by job. I mean, you can take that into consideration later. Better to have the un-edited version. (You forgot to divide by total amount of hits in your algorithm).

But yeah, this is a pretty much unrelated topic. Either open a development/help thread about it, or we can talk in PMs about it.

It was just a thought and yes we have gotten far off topic.

Nice release though. I do like it alot.

(in future try a slightly smaller font. just to avoid page stretching.)
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
Re: Staff Tools 1.0

Testing it out, whats with the big font?
Good luck on later releases


I think it's better with formatting. Specially if I'm making a thread with multiple releases/sections. For my posts, it's so they can be identified easily within this thread. Not to mention I'm a huge perfectionist.

Anyways, thanks.


It was just a thought and yes we have gotten far off topic.

Nice release though. I do like it alot.

(in future try a slightly smaller font. just to avoid page stretching.)


Ok. Since you're all complaining I edited the thread with smaller font.
 
Last edited:
Custom Title Activated
Loyal Member
Joined
Aug 21, 2009
Messages
1,149
Reaction score
598
Re: Staff Tools 1.0

I see a lot of useless stuff, but it's really the best thing I have seen in a while released in RaGEZONE have to say (Best as, working and that effort is shown). However, removeAll is not a method everyone does have I believe, but I will assume it's just a loop using removeFromSlot, if you do are directly altering the inventory list, you're probably really into risking at getting ConcurrentModificationException if user drop the item, or if you're looping trough the collection and then remove it.

I haven't check the whole thing, but, those were my 72 cents. Good job, I guess...
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
Re: Staff Tools 1.0

I see a lot of useless stuff, but it's really the best thing I have seen in a while released in RaGEZONE have to say (Best as, working and that effort is shown). However, removeAll is not a method everyone does have I believe, but I will assume it's just a loop using removeFromSlot, if you do are directly altering the inventory list, you're probably really into risking at getting ConcurrentModificationException if user drop the item, or if you're looping trough the collection and then remove it.

I haven't check the whole thing, but, those were my 72 cents. Good job, I guess...


You're right, it does loop removeFromSlot.
PHP:
    public static void removeAllById(MapleClient c, int itemId, boolean checkEquipped) {
        MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(itemId);
        for (IItem item : c.getPlayer().getInventory(type).listById(itemId)) {
            if (item != null) {
                removeFromSlot(c, type, item.getPosition(), item.getQuantity(), true, false);
            }
        }
        if (checkEquipped) {
            IItem ii = c.getPlayer().getInventory(type).findById(itemId);
            if (ii != null) {
                c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).removeItem(ii.getPosition());
                c.getPlayer().equipChanged();
            }
        }
    }

But I think most sources do have that. At least the two I've tested: ThePack and XiuzSource. I'm sure it's been used many times before, shouldn't be too much of a risk.

Now that I look at it, since I'm using removeAll anyways I should just make a function that takes an id as a parameter and wipes all. I originally had it only delete the amount in the certain slot and it was too much of a task to delete each one individually. Specially if the player notices their items getting deleted and decides to log off. I might recode that bit.

EDIT: Changed that. And thanks to you I found out a pretty embarrassing error I made. I actually re-coded this npc prior to releasing it to make it neater, and thanks to Murphy's law; I messed up on a section. Read the bottom of the original post for instructions on how to fix it.
 
Last edited:
:)
Joined
Sep 21, 2007
Messages
282
Reaction score
10
Re: Staff Tools 1.0

Great job, epic stuff o.o
 
Status
Not open for further replies.
Back
Top