Package games.stendhal.common.parser

Examples of games.stendhal.common.parser.JokerExprMatcher


        null);

    // responding to question of how many they want, with a number
    npc.addMatching(ConversationStates.QUEST_ITEM_QUESTION,
        // match for all numbers as trigger expression
        ExpressionType.NUMERAL, new JokerExprMatcher(),
        new TextHasNumberCondition(1, 5000),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
View Full Code Here


        null);

    // respond to question of how many eggshells are desired. terry expects a number or some kind
    npc.addMatching(ConversationStates.QUEST_ITEM_QUESTION,
        // match for all numbers as trigger expression
        ExpressionType.NUMERAL, new JokerExprMatcher(),
        new TextHasNumberCondition(1, 5000),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
View Full Code Here

    ExpressionMatcher selectedMatcher = null;
    boolean mergeExpressions = false;

    if (sel.equals("joker matching")) {
      selectedMatcher = new JokerExprMatcher();
    } else if (sel.equals("exact matching")) {
      selectedMatcher = new ExactExprMatcher();
    } else if (sel.equals("case insensitive")) {
      selectedMatcher = new CaseInsensitiveExprMatcher();
    } else if (sel.equals("similarity matching")) {
View Full Code Here

         null);
   
    // handle house numbers 26 to 49
    addMatching(ConversationStates.QUEST_OFFERED,
        // match for all numbers as trigger expression
        ExpressionType.NUMERAL, new JokerExprMatcher(),
        new TextHasNumberCondition(getLowestHouseNumber(), getHighestHouseNumber()),
        ConversationStates.ATTENDING,
        null,
        new BuyHouseChatAction(getCost(), QUEST_SLOT));
View Full Code Here

         null);
   
    // handle house numbers 101 to 108
    addMatching(ConversationStates.QUEST_OFFERED,
         // match for all numbers as trigger expression
        ExpressionType.NUMERAL, new JokerExprMatcher(),
        new TextHasNumberCondition(getLowestHouseNumber(), getHighestHouseNumber()),
        ConversationStates.ATTENDING,
        null,
        new BuyHouseChatAction(getCost(), QUEST_SLOT));
   
View Full Code Here

            startQuiz();
            player.setQuest(QUEST_SLOT, "" + System.currentTimeMillis());
          }
        });

    fisherman.addMatching(ConversationStates.QUESTION_1, Expression.JOKER, new JokerExprMatcher(),
        new NotCondition(new TriggerInListCondition(ConversationPhrases.GOODBYE_MESSAGES)),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            String species = getCurrentSpecies();
View Full Code Here

    null);

// handle house numbers 1 to 25
addMatching(ConversationStates.QUEST_OFFERED,
    // match for all numbers as trigger expression
    ExpressionType.NUMERAL, new JokerExprMatcher(),
    new TextHasNumberCondition(getLowestHouseNumber(), getHighestHouseNumber()),
    ConversationStates.ATTENDING,
    null,
    new BuyHouseChatAction(getCost(), QUEST_SLOT));
View Full Code Here

         null);
   
    // handle house numbers getLowestHouseNumber() - getHighestHouseNumber()
    addMatching(ConversationStates.QUEST_OFFERED,
         // match for all numbers as trigger expression
        ExpressionType.NUMERAL, new JokerExprMatcher(),
        new TextHasNumberCondition(getLowestHouseNumber(), getHighestHouseNumber()),
        ConversationStates.ATTENDING,
        null,
        new BuyHouseChatAction(getCost(), QUEST_SLOT));
   
View Full Code Here

*/
public class JokerExprMatcherTest {

  @Test
  public final void testJokerMatching() {
    final ExpressionMatcher matcher = new JokerExprMatcher();

    final Expression e1 = new Expression("abc", "VER");
    final Expression e2 = new Expression("a*c", "VER");
    final Expression e3 = new Expression("ab", "VER");
    final Expression e4 = new Expression("ab*", "SUB");
    final Expression e5 = new Expression("X", "SUB");

    assertTrue(matcher.match(e1, e2));
    assertFalse(matcher.match(e1, e3));
    assertTrue(matcher.match(e1, e4));
    assertFalse(matcher.match(e1, e5));
    assertFalse(matcher.match(e4, e5));
  }
View Full Code Here

    fisherman.add(ConversationStates.QUESTION_1,
      ConversationPhrases.NO_MESSAGES, null,
      ConversationStates.ATTENDING,
      "Too bad. I would have had a nice reward for you.", null);

    fisherman.addMatching(ConversationStates.QUESTION_2, Expression.JOKER, new JokerExprMatcher(), null,
      ConversationStates.ATTENDING, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final String name = player.getQuest(QUEST_SLOT);
          final String quote = quotes.get(name);
View Full Code Here

TOP

Related Classes of games.stendhal.common.parser.JokerExprMatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.