Code:
public class MatthiasDialog extends NPCDialog {
public MatthiasDialog(Player player, boolean instantly) {
super(player, 5092);
Item weapon = player.getEquipment().get(3);
Item shield = player.getEquipment().get(WieldType.SHIELD.getSlot());
if (instantly) {
if (weapon != null && (weapon.getId() == 10024 || weapon.getId() == 10023)) {
npc(HAPPY, "Are you done with my falcon?");
options("Yes", () -> {
npc(HAPPY, "Okay, thank you");
player.getEquipment().set(3, null);
}, "No", () -> this.finish());
} else {
options("Okay. Pay the 500 coins", () -> {
if (weapon != null || shield != null) {
npc(CONFUSED, "You must have both hands free to use the falcon.");
} else {
if (player.getInventory().remove(new Item(995, 500))) {
npc(HAPPY, "Alright, here you go.");
player.getEquipment().set(3, new Item(10024));
} else {
npc(CONFUSED, "You don't have enough to pay for my falcon.");
}
}
}, "No, I'll keep my money", () -> finish());
}
} else {
if (weapon != null && (weapon.getId() == 10024 || weapon.getId() == 10023)) {
npc(HAPPY, "Are you done with my falcon?");
options("Yes", () -> {
npc(HAPPY, "Okay, thank you");
player.getEquipment().set(3, null);
}, "No", () -> this.finish());
} else {
npc(HAPPY, "Hello, " + player.getName() + ". I can allow you to use my falcon to catch these kebbits at a good price. What do you say?");
options("Okay", () -> {
npc(HAPPY, "It will cost you 500 coins to use my falcon.");
options("Pay the 500 coins", () -> {
if (weapon != null || shield != null) {
npc(CONFUSED, "You must have both hands free to use the falcon.");
} else {
if (player.getInventory().remove(new Item(995, 500))) {
npc(HAPPY, "Alright, here you go.");
player.getEquipment().set(3, new Item(10024));
} else {
npc(CONFUSED, "You don't have enough to pay for my falcon.");
}
}
}, "No, I'll keep my money", () -> finish());
}, "No", () -> this.finish());
}
}
}
}