Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.game.entities.player.skills;
- import server.game.dialogues.Dialogue;
- import server.game.dialogues.impl.NPCChat;
- import server.game.dialogues.impl.Option;
- import server.game.dialogues.impl.PlayerChat;
- import server.model.mobile.npcs.NPCDefinitions;
- import server.model.mobile.players.Player;
- /**
- * Ivandis
- *
- * @author Naqash Tanzeel
- * @version 1.0
- */
- public class Slayer extends Skill {
- private static final int[][] easyTasks = {{18, 1}, {52, 1}, {78, 1}, {92, 1}, {101, 1}, {103, 1}, {117, 1}, {119, 1}, {181, 1}, {1265, 1}, {1612, 15}, {1648, 5}};
- private static final int[][] mediumTasks = {{83, 1}, {110, 1}, {112, 1}, {125, 1}, {941, 1}, {1153, 1}, {1154, 1}, {1341, 1}, {1600, 10}, {1612, 15}, {1616, 40}, {1618, 50}, {1637, 52}, {1622, 20}, {1633, 30}, {1643, 45}};
- private static final int[][] hardTasks = {{49, 1}, {53, 1}, {55, 1}, {84, 1}, {110, 1}, {941, 1}, {1157, 1}, {1341, 1}, {1590, 1}, {1591, 1}, {1608, 70}, {1610, 75}, {1613, 80}, {1615, 55}, {1616, 40}, {1618, 50}, {1624, 65}, {1632, 55}, {2783, 90}, {3590, 1}};
- private static final int[][][] tasks = {easyTasks, mediumTasks, hardTasks};
- private Task task;
- public Slayer(Player player) {
- super("Slayer", 12122, 12123, 12124, player);
- }
- private Task getSlayerTask() {
- return task;
- }
- public void setSlayerTask(Task task) {
- this.task = task;
- }
- public void getSlayerGem() {
- String[] text;
- if (task.getAmount() > 0)
- text = new String[] {"You're currently assigned to kill " + task.getNPC().getNpcName().replaceAll("_", " ") + ";",
- "Only " + task.getAmount() + " more to go."};
- else text = new String[] {"You're currently not assigned a task.", "Head over to Vannaka in Edgevile for a task."};
- player.getDialogues().sendDialogue(new NPCChat(player, 1597, "Vannaka", 591, text));
- }
- public void talkToSlayerMaster() {
- final Dialogue conversation = new NPCChat(player, 1597, "Vannaka", 591, new String[] {"'Ello, and what are you after then?"});
- conversation.setNext(new Option(player, new String[] {"I need another assignment.", "Do you have anything for trade?", "Er.. Nothing.."}) {
- @Override
- public void onContinue() {
- switch (option) {
- case 0: getNewTask(); break;
- case 1: setNext(new NPCChat(player, 1597, "Vannaka", 591,
- new String[] {"I have a wide selection of Slayer equipment, take a look."}));
- break;
- }
- }
- });
- player.getDialogues().sendDialogue(conversation);
- }
- private void getNewTask() {
- Dialogue conversation = new PlayerChat(player, new String[] {"I need another assignment"}) {
- @Override
- public void onContinue() {
- if (task == null) assignTask();
- else if (task.getLevel() > 1) lowerTask();
- else setNext(new NPCChat(player, 1597, "Vannaka", 591, new String[] {"You're still hunting something, come back when you've",
- "finished your task."}));
- }
- };
- player.getDialogues().sendDialogue(conversation);
- }
- private void lowerTask() {
- final Dialogue conversation = new NPCChat(player, 1597, "Vannaka", 591, new String[] {"I see you already have an assignment.",
- "Would you like me to give you an easier one?"});
- conversation.setNext(new Option(player, new String[] {"Yes please, I'd like to start off easy.", "No thanks, I'll stick with the current one."}) {
- @Override
- public void onContinue() {
- switch (option) {
- case 0:
- conversation.setNext(new PlayerChat(player, new String[]{"Yes please, I'd like to start off easy."}) {
- @Override
- public void onContinue() { assignTask(getTask(1)); }
- });
- }
- }
- });
- }
- private void assignTask() {
- assignTask(getTask());
- }
- private void assignTask(Task task) {
- this.task = task;
- player.getDialogues().sendDialogue(new NPCChat(player, 1597, "Vannaka", 591, new String[] {
- "Right, let me have have a look...",
- "Your new tasks is to kill " + task.getAmount() + " " + task.getNPC().getNpcName().replaceAll("_", " ")
- }));
- }
- private Task getTask() {
- int taskLevel = player.nonSummonCombatLevel % 46;
- return getTask(taskLevel);
- }
- private Task getTask(int taskLevel) {
- int[] taskInfo = tasks[taskLevel][(int) (Math.random() * tasks[taskLevel].length)];
- while (taskInfo[1] > player.playerLevel[player.playerSlayer])
- taskInfo = tasks[taskLevel][(int) (Math.random() * tasks[taskLevel].length)];
- return new Task(taskInfo[0], taskLevel);
- }
- public class Task {
- private NPCDefinitions npc;
- private int level;
- private int amount;
- public Task(int npcId, int level) {
- this.npc = NPCDefinitions.forId(npcId);
- this.level = level;
- this.amount = 15 + (level * 5) + (level * (int) (16 * Math.random()));
- }
- private NPCDefinitions getNPC() {
- return npc;
- }
- private int getAmount() {
- return amount;
- }
- private int getLevel() {
- return level;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement