diff --git a/Server/src/plugin/command/PlayerCommandPlugin.java b/Server/src/plugin/command/PlayerCommandPlugin.java
index 8550db010..51719ec44 100644
--- a/Server/src/plugin/command/PlayerCommandPlugin.java
+++ b/Server/src/plugin/command/PlayerCommandPlugin.java
@@ -1,8 +1,11 @@
package plugin.command;
import org.crandor.ServerConstants;
+import org.crandor.cache.def.impl.ItemDefinition;
+import org.crandor.cache.def.impl.NPCDefinition;
import org.crandor.game.component.Component;
import org.crandor.game.content.skill.Skills;
+import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.info.PlayerDetails;
import org.crandor.game.node.entity.player.info.Rights;
@@ -12,19 +15,26 @@ import org.crandor.game.node.entity.player.link.RunScript;
import org.crandor.game.node.entity.player.link.music.MusicEntry;
import org.crandor.game.node.entity.player.link.quest.Quest;
import org.crandor.game.node.entity.player.link.quest.QuestRepository;
+import org.crandor.game.node.item.ChanceItem;
import org.crandor.game.system.command.CommandPlugin;
import org.crandor.game.system.command.CommandSet;
import org.crandor.game.system.communication.ClanRepository;
import org.crandor.game.system.communication.CommunicationInfo;
import org.crandor.game.world.GameWorld;
+import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.repository.Repository;
+import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.net.amsc.WorldCommunicator;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
+import org.crandor.tools.RandomFunction;
import org.crandor.tools.StringUtils;
import plugin.zone.GrandExchangeZone.CreditStore;
+import java.util.List;
+import java.util.ListIterator;
+
/**
* Handles a player command.
* @author Vexia
@@ -219,7 +229,20 @@ public final class PlayerCommandPlugin extends CommandPlugin {
case "donate":
sendDonationInfo(player);
return true;
-
+ case "roll":
+ rollSkill(player);
+ return true;
+ case "drops":
+ if(arguments.length > 0) {
+ int npcid = toInteger(arguments[1]);
+ getDrops(player, npcid);
+ } else {
+ player.getPacketDispatch().sendMessage("Syntax: ::getdrops id");
+ }
+ return true;
+ case "npcs":
+ getNPCs(player);
+ return true;
case "reply":
if(player.getInterfaceManager().isOpened()){
player.sendMessage("
Please finish what you're doing first.");
@@ -245,6 +268,93 @@ public final class PlayerCommandPlugin extends CommandPlugin {
return false;
}
+ /**
+ * Sends commands.
+ * @param player the player.
+ */
+ /**
+ * ::npcs lists NPCs in the area and their IDs
+ * @author ceik
+ */
+ public final void getNPCs(Player player){
+ player.getInterfaceManager().close();
+ final List npcs = RegionManager.getLocalNpcs(player);
+ for (int i = 0; i < 311; i++) {
+ player.getPacketDispatch().sendString("", 275, i);
+ }
+ player.getPacketDispatch().sendString("Nearby NPCs", 275, 2);
+ int lineid = 11;
+ for(NPC n : npcs){
+ player.getPacketDispatch().sendString("[" + n.getId() + "] " + "" + n.getName() + "",275,lineid++);
+ }
+ player.getInterfaceManager().open(new Component(275));
+ }
+
+ /**
+ * ::drops lists the drops for a specific NPC ID
+ * @author ceik
+ */
+ public final void getDrops(Player player, int npc){
+ player.getInterfaceManager().close();
+ for (int i = 0; i < 311; i++) {
+ player.getPacketDispatch().sendString("", 275, i);
+ }
+ int lineid = 11;
+ List drops = NPCDefinition.forId(npc).getDropTables().getMainTable();
+ ListIterator drop = drops.listIterator();
+ player.getPacketDispatch().sendString("" + NPCDefinition.forId(npc).getName() + " (Level " + NPCDefinition.forId(npc).getCombatLevel() + ")", 275, 2);
+ while(drop.hasNext()){
+ ChanceItem current = (ChanceItem) drop.next();
+ String rarity = "";
+ switch(current.getDropFrequency()){
+ case UNCOMMON:
+ rarity = "UNCOMMON";
+ break;
+ case RARE:
+ rarity = "RARE";
+ break;
+ case VERY_RARE:
+ rarity = "VERY RARE";
+ break;
+ case COMMON:
+ rarity = "COMMON";
+ break;
+
+ }
+ player.getPacketDispatch().sendString("(" + rarity + ") " + ((current.getMinimumAmount() - current.getMaximumAmount() != 0) ? (current.getMinimumAmount() + "-" + current.getMaximumAmount()) : "") + " " + ItemDefinition.forId(current.getId()).getName() + "", 275, lineid++);
+ }
+ player.getInterfaceManager().open(new Component(275));
+ }
+
+ /**
+ * ::roll command
+ * @author ceik
+ */
+ public final void rollSkill(Player player){
+ boolean rareEventChance = RandomFunction.random(100) == 54;
+ if(rareEventChance){
+ int rareChoice = RandomFunction.random(2,5);
+ if(rareChoice % 5 == 0){
+ player.sendChat("Oh god! Somebody help me!");
+ player.getAnimator().reset();
+ player.getAnimator().forceAnimation(new Animation(3123));
+ return;
+ }
+ if(rareChoice % 2 == 0){
+ player.sendChat("Yibbly jibbly dibbly nibbly doo dah");
+ return;
+ }
+ if(rareChoice % 3 == 0){
+ player.sendChat("Oh god! Somebody help me!");
+ player.getAnimator().reset();
+ player.getAnimator().forceAnimation(new Animation(92));
+ return;
+ }
+ }
+ int skill = RandomFunction.random(0,23);
+ player.sendChat("I think I should train " + Skills.SKILL_NAME[skill]);
+ }
+
/**
* Sends commands.
* @param player the player.
@@ -268,6 +378,10 @@ public final class PlayerCommandPlugin extends CommandPlugin {
player.getPacketDispatch().sendString("Shows this list.", 275, lineId++);
player.getPacketDispatch().sendString("::players", 275, lineId++);
player.getPacketDispatch().sendString("Get online player count.", 275, lineId++);
+ player.getPacketDispatch().sendString("::npcs", 275, lineId++);
+ player.getPacketDispatch().sendString("Lists all NPCs in your areas and their IDs", 275, lineId++);
+ player.getPacketDispatch().sendString("::drops id", 275, lineId++);
+ player.getPacketDispatch().sendString("Lists drops for a given NPC id", 275, lineId++);
player.getPacketDispatch().sendString("::quests", 275, lineId++);
player.getPacketDispatch().sendString("Shows a list of all available quests.", 275, lineId++);
player.getPacketDispatch().sendString("::togglenews", 275, lineId++);
@@ -278,8 +392,14 @@ public final class PlayerCommandPlugin extends CommandPlugin {
player.getPacketDispatch().sendString("Remove your bank pin.", 275, lineId++);
player.getPacketDispatch().sendString("::bankresettabs", 275, lineId++);
player.getPacketDispatch().sendString("Reset all of your bank tabs.", 275, lineId++);
+ player.getPacketDispatch().sendString("::stats", 275, lineId++);
+ player.getPacketDispatch().sendString("View a player's stats.", 275, lineId++);
+ player.getPacketDispatch().sendString("::roll", 275, lineId++);
+ player.getPacketDispatch().sendString("Picks a skill to train for you, and perhaps more?", 275, lineId++);
+
}
-
+
+
private void sendHiscore(Player player, Player target) {
if (player.getInterfaceManager().isOpened()) {
player.sendMessage("Finish what you're currently doing.");