Server/09HDscape-server/src/plugin/dialogue/GruborDialogue.java
2019-05-28 22:15:17 -08:00

99 lines
2.2 KiB
Java

package plugin.dialogue;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.content.dialogue.FacialExpression;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.game.node.entity.player.Player;
/**
* Represents the grubor dialogue plugin.
* @author 'Vexia
* @version 1.0
*/
@InitializablePlugin
public final class GruborDialogue extends DialoguePlugin {
/**
* Constructs a new {@code GruborDialogue} {@code Object}.
*/
public GruborDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code GruborDialogue} {@code Object}.
* @param player the player.
*/
public GruborDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new GruborDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Yes? What do you want?");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendOptions("Select an Option", "Would you like your hedges trimming?", "I want to come in.", "Do you want to trade?");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Would you like your hedges trimming?");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.NORMAL, "I want to come in.");
stage = 20;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Do you want to trade?");
stage = 30;
break;
}
break;
case 10:
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Eh? Don't be daft! We don't even HAVE any hehdges!");
stage = 11;
break;
case 11:
end();
break;
case 20:
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "No, go away.");
stage = 21;
break;
case 21:
end();
break;
case 30:
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "No, I'm busy.");
stage = 31;
break;
case 31:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 789 };
}
}