Code:
package com.rs.game.player.content;
import com.rs.cache.loaders.NPCDefinitions;
import com.rs.game.Hit;
import com.rs.game.Hit.HitLook;
import com.rs.game.World;
import com.rs.game.item.Item;
import com.rs.game.player.Player;
import com.rs.game.player.actions.ClearBank;
public class RottenPotato {
public static final int EAT = 14, HEAL = 67, CM_TOOL = 5, USE = -1, COMMANDS = 90,
DROP = 6, EXAMINE = 32;
public static void handlePotato(Player player, Item item, int packetId) {
System.out.println("Item: " + item.getId() + " Packet: " + packetId);
switch (packetId) {
case EAT:
player.getDialogueManager().startDialogue("Potato_Op1", item);
System.out.println("Dialogue sent.");
break;
case HEAL:
heal(player);
break;
case CM_TOOL: //Configurations Management
CM_Tool(player);
break;
case USE:
//something here
break;
case COMMANDS:
//
break;
case DROP:
player.getInventory().deleteItem(item);
player.getPackets().sendGameMessage("Too late! It's already gone.", true);
break;
case EXAMINE:
player.getPackets().sendGameMessage("Yuk!", true);
break;
}
}
public static void eat(Player player, int option) {
player.sm("Option: " + option);
if (option == 11) {
player.getPackets().sendGameMessage("You have set the AFK timer to false.", false);
} else if (option == 13) {
player.forceLogout();
} else if (option == 14) {
ClearBank.clearBank(player);
player.getPackets().sendGameMessage("Your bank has been emptied.", true);
} else if (option == 15) {
player.applyHit(new Hit(player, player.getHitpoints(), HitLook.POISON_DAMAGE));
} else if (option == 16) {
int id = 1471;
String name = NPCDefinitions.getNPCDefinitions(id).getName();
World.spawnNPC(id, player, -1, true, true);
player.getPackets().sendGameMessage("Spawned aggressive NPC: " + name + ".", true);
}
}
public static void heal(Player player) {
player.getPrayer().calcRestorePrayer();
if (player.getPoison().isPoisoned()) {
player.getPoison().makePoisoned(0);
player.getPackets().sendGameMessage("Your poison has been cured.", true);
}
player.setRunEnergy(100);
player.getCombatDefinitions().resetSpecialAttack();
player.getAppearence().generateAppearenceData();
player.heal(player.getMaxHitpoints());
player.getPackets().sendGameMessage("You have been healed.", true);
}
public static void CM_Tool(Player player) {
//display configs of different stuff..
}
public static void Commands(Player player) {
//nothing yet
}
public static void useOnPlayer(Player player, Player target) {
}
}
Code:
package com.rs.game.player.dialogues;
import com.rs.game.player.content.RottenPotato;
public class Potato_Op1 extends Dialogue {
@Override
public void start() {
sendOptionsDialogue("Option 1", "Keep me logged in.", "Kick me out.", "Wipe my bank.", "Kill me.", "Spawn agressive NPC.");
}
@Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
RottenPotato.eat(player, componentId);
end();
}
}
@Override
public void finish() {
}
}