add(ConversationStates.ATTENDING, "",
new AndCondition(getRentMatchCond(), new LevelGreaterThanCondition(5), new TextHasParameterCondition()),
ConversationStates.BUY_PRICE_OFFERED,
null,
new ChatAction() {
public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
text = sentence.getOriginalText().substring(5).trim();
String reply = "A sign costs " + MONEY + " money for 24 hours. Do you want to rent one?";
if (rentedSignList.getByName(player.getName()) != null) {
reply = reply + " Please note that I will replace the sign you already rented.";
}
npc.say(reply);
}
@Override
public String toString() {
return "remember text";
}
});
add(ConversationStates.BUY_PRICE_OFFERED,
ConversationPhrases.YES_MESSAGES,
new NotCondition(new PlayerHasItemWithHimCondition("money", MONEY)),
ConversationStates.ATTENDING,
"Sorry, you do not have enough money", null);
add(ConversationStates.BUY_PRICE_OFFERED,
ConversationPhrases.YES_MESSAGES,
new PlayerHasItemWithHimCondition("money", MONEY),
ConversationStates.IDLE, null,
new RentSignChatAction());
add(ConversationStates.BUY_PRICE_OFFERED,
ConversationPhrases.NO_MESSAGES, null,
ConversationStates.ATTENDING,
"If you change your mind, just talk to me again.", null);
add(ConversationStates.ATTENDING, "remove",
new PlayerHasStorableEntityCondition(rentedSignList),
ConversationStates.ATTENDING,
"Ok, I am going to remove your sign.",
new RemoveStorableEntityAction(rentedSignList));
add(ConversationStates.ATTENDING, "remove",
new NotCondition(new PlayerHasStorableEntityCondition(rentedSignList)),
ConversationStates.ATTENDING,
"You did not rent any sign, so I cannot remove one.", null);
// admins may remove signs (even low level admins)
add(ConversationStates.ATTENDING, "delete",
new AdminCondition(100),
ConversationStates.ATTENDING, null,
new ChatAction() {
public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
if (sentence.getExpressions().size() < 2) {
npc.say("Syntax: delete <nameofplayer>");
return;
}