Code:
package com.vencillio.rs2.content.dialogue.impl;
import com.vencillio.rs2.content.dialogue.Dialogue;
import com.vencillio.rs2.content.dialogue.DialogueConstants;
import com.vencillio.rs2.content.dialogue.DialogueManager;
import com.vencillio.rs2.content.dialogue.Emotion;
import com.vencillio.rs2.entity.item.Item;
import com.vencillio.rs2.entity.player.Player;
import com.vencillio.rs2.entity.player.net.out.impl.SendMessage;
/**
* Dialogue for Mac
* @author TA TA
*
*/
public class MacDialogue extends Dialogue {
public MacDialogue(Player player) {
this.player = player;
}
@Override
public boolean clickButton(int id) {
switch(id) {
case DialogueConstants.OPTIONS_4_1:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Who are you?");
next = 3;
break;
case DialogueConstants.OPTIONS_3_1:
if (!player.getInventory().hasItemAmount(new Item(995, 2277000))) {
DialogueManager.sendItem1(player, "You don't have 2277000 coins!", 995);
return false;
}
int requirements = 99;
for (int i = 0; i < 22; i++) {
if (player.getSkill().getLevels()[i] < requirements) {
DialogueManager.sendNpcChat(player, 6481, Emotion.DEFAULT, "You don't have the requirements to buy this item!");
end();
return false;
}
}
player.getInventory().remove(new Item(995, 2277000));
player.getInventory().add(new Item(13281, 1));
player.getInventory().add(new Item(13280, 1));
DialogueManager.sendItem2(player, "Mac grunts and hands over his cape, pocketing your", "money swiftly.", 13281, 13280);
next = 22;
break;
case DialogueConstants.OPTIONS_3_2:
DialogueManager.sendPlayerChat(player, Emotion.LONGER_LAUGHING, "No.");
break;
case DialogueConstants.OPTIONS_3_3:
DialogueManager.sendNpcChat(player, 6481, Emotion.ANNOYED, "Are you crazy! HaHaHA! NEVER!");
break;
case DialogueConstants.OPTIONS_4_2:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "What do you have in your sack?");
next = 7;
break;
case DialogueConstants.OPTIONS_4_3:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Why are you so dirty?");
next = 28;
break;
case DialogueConstants.OPTIONS_2_1:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Can i have it?");
next = 15;
break;
case DialogueConstants.OPTIONS_2_2:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Why do you keep it in a sack?");
next = 11;
break;
case DialogueConstants.OPTIONS_4_4:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Bye.");
next = -1;
break;
}
return false;
}
@Override
public void execute() {
switch(next) {
case 0:
DialogueManager.sendPlayerChat(player, Emotion.HAPPY, "Hello.");
next ++;
break;
case 1:
DialogueManager.sendStatement(player, "The man glances at you and grunts something unintelligible.");
next ++;
break;
case 2:
DialogueManager.sendOption(player, "Who are you?", "What do you have in your sack?", "Why are you so dirty?", "Bye.");
break;
case 3:
DialogueManager.sendNpcChat(player, 6481, Emotion.CALM, "Mac. What's it to you?");
next ++;
break;
case 4:
DialogueManager.sendPlayerChat(player, Emotion.CALM, "Only trying to be friendly.");
next = 2;
break;
case 7:
DialogueManager.sendNpcChat(player, 6481, Emotion.CALM, "S'me cape.");
next ++;
break;
case 8:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Your cape?");
next ++;
break;
case 9:
DialogueManager.sendOption(player, "Can I have it?", "Why do you keep it in a sack?");
break;
case 10:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Why do you keep it in a sack?");
next ++;
break;
case 11:
DialogueManager.sendNpcChat(player, 6481, Emotion.DEFAULT, "Get it dirty.");
next = 9;
break;
case 15:
DialogueManager.sendNpcChat(player, 6481, Emotion.DEFAULT, "Mebe.");
next ++;
break;
case 16:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "I'm sure I could make it worth your while.");
next ++;
break;
case 17:
DialogueManager.sendNpcChat(player, 6481, Emotion.DEFAULT, "How much?");
next ++;
break;
case 18:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "How about 2277000 gold?");
next ++;
break;
case 19:
DialogueManager.sendOption(player, "Yes, pay the man.", "No.", "Can i borrow the cape?");
break;
case 20:
DialogueManager.sendNpcChat(player, 4306, Emotion.DEFAULT, "Hello?");
next ++;
break;
case 21:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "Huh, who's there?");
next ++;
break;
case 22:
DialogueManager.sendNpcChat(player, 4306, Emotion.DEFAULT, "It's Dionysius here. I'm using my magic to", "communicate to you. Don't worry.");
next ++;
break;
case 23:
DialogueManager.sendPlayerChat(player, Emotion.DEFAULT, "What are you doing in my head?");
next ++;
break;
case 24:
DialogueManager.sendNpcChat(player, 4306, Emotion.DEFAULT, "I just wanted to say congratulations "+player.getUsername()+". I've been", "watching you in your adventures ~ very well done.");
next ++;
break;
case 25:
DialogueManager.sendNpcChat(player, 3077, Emotion.DEFAULT, "Oh very well done "+player.getUsername()+". Taken you a while, but I", "knew you could do it.");
next ++;
break;
case 26:
DialogueManager.sendNpcChat(player, 3308, Emotion.DEFAULT, "Ahhh "+player.getUsername()+", I knew you had potential when I first", "met you. My compliment on reaching the pinnacle of", "your achievements.");
next ++;
break;
case 27:
DialogueManager.sendNpcChat(player, 2635, Emotion.DEFAULT, "Meow!");
next = -1;
break;
case 28:
DialogueManager.sendNpcChat(player, 6481, Emotion.DEFAULT, "Bath XP waste.");
next = 2;
break;
}
}
private static final int[][] MAXCAPE_ITEM_IDS = { { 13280, 13281, 6570, 13329, 13330 }, { 13280, 13281, 2412, 13331, 13332 }, { 13280, 13281, 2414, 13333, 13334 }, { 13280, 13281, 2413, 13335, 13336 }, { 13280, 13281, 10499, 13337, 13338 } };
public static void maxCapeCombining(Player client, int itemUsed, int useWith) {
for (int m = 0; m < MAXCAPE_ITEM_IDS.length; m++) {
if (itemUsed == MAXCAPE_ITEM_IDS[m][0] && useWith == MAXCAPE_ITEM_IDS[m][2] || itemUsed == MAXCAPE_ITEM_IDS[m][1] && useWith == MAXCAPE_ITEM_IDS[m][2] || itemUsed == MAXCAPE_ITEM_IDS[m][2] && useWith == MAXCAPE_ITEM_IDS[m][0] || itemUsed == MAXCAPE_ITEM_IDS[m][2] && useWith == MAXCAPE_ITEM_IDS[m][1]) {
if (!client.getInventory().hasItemAmount(MAXCAPE_ITEM_IDS[m][0], 1) || !client.getInventory().hasItemAmount(MAXCAPE_ITEM_IDS[m][1], 1) || !client.getInventory().hasItemAmount(MAXCAPE_ITEM_IDS[m][2], 1)) {
client.getClient().queueOutgoingPacket(new SendMessage("Make sure you have both 'Max cape' and 'Max hood' in your inventory."));
return;
}
int item3 = MAXCAPE_ITEM_IDS[m][0];
int item4 = MAXCAPE_ITEM_IDS[m][1];
int item5 = MAXCAPE_ITEM_IDS[m][2];
client.getInventory().remove(item3, client.getInventory().getItemSlot(item3));
client.getInventory().remove(item4, client.getInventory().getItemSlot(item4));
client.getInventory().remove(item5, client.getInventory().getItemSlot(item5));
int item6 = MAXCAPE_ITEM_IDS[m][3];
int item7 = MAXCAPE_ITEM_IDS[m][4];
client.getInventory().add(item6, 1);
client.getInventory().add(item7, 1);
return;
}
}
}
}