- 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:
Source:
You need to add these functions if don't have them already:
In NPCConversationManager.java:
In MapleCharacter.java:
Script:
Add this script into any npc:
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:
Source:
I'm assuming you have the functions from the 1st release. If not, make sure you put these in:
Script:
Add this script to any npc:
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:
Source:
Near the top of MapleCharacter.java:
Somewhere where your other functions are defined, still in MapleCharacter.java:
Before the third last bracket in GeneralchatHandler.java:
Here's my GeneralchatHandler.java as an example: DO NOT ADD THIS IN
Before the third last bracket in PartychatHandler.java:
Again, here's my PartychatHandler.java as an example: DO NOT ADD THIS IN
In WhisperHandler.java:
Find:
Before it add:
In your chosen command java file, under any command. Mine is Admin.java:
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:
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:
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:
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:
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
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: