Examples of MultipleActions


Examples of games.stendhal.server.entity.npc.action.MultipleActions

               new QuestInStateCondition(QUEST_SLOT, 0, "start"),
               new PlayerCanEquipItemCondition("rhosyd"),
                             new TimePassedCondition(QUEST_SLOT, 1, DELAY)),
      ConversationStates.IDLE,
      "Hello dearie. My far sight tells me you need a pretty flower for some fair maiden. Here ye arr, bye now.",
      new MultipleActions(new EquipItemAction("rhosyd", 1, true),
                                new SetQuestAction(QUEST_SLOT, 0, "got_flower"),
                                new SetQuestToTimeStampAction(QUEST_SLOT, 1)));

    // don't put the flower on the ground - if player has no space, tell them
    rose.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(rose.getName()),
                 new QuestInStateCondition(QUEST_SLOT, 0, "start"),
                                 new TimePassedCondition(QUEST_SLOT, 1, DELAY),
                 new NotCondition(new PlayerCanEquipItemCondition("rhosyd"))),
        ConversationStates.IDLE,
        "Shame you don't have space to take a pretty flower from me. Come back when you can carry my precious blooms without damaging a petal.",
        null);
   
        // don't give the flower if one was given within the last 5 minutes
        rose.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(rose.getName()),
                 new QuestInStateCondition(QUEST_SLOT, 0, "start"),
                                 new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, DELAY))),
        ConversationStates.IDLE,
        "I gave you a flower not five minutes past! Her Royal Highness can enjoy that one for a while.",
        null);
     
      final ChatCondition lostFlowerCondition = new AndCondition(new GreetingMatchesNameCondition(rose.getName()),
         // had got the flower before and was supposed to take it to the princess next
           new QuestInStateCondition(QUEST_SLOT, 0, "got_flower"),
         // check chest and so on first - maybe the player does still have it (though we can't check house chests or the floor)
         new ChatCondition() {
             public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
               return player.getTotalNumberOf("rhosyd") == 0;
             }
         },
        // just to check there is space
        new PlayerCanEquipItemCondition("rhosyd"),
        // note: older quest slots will pass this automatically, but they are old now.
                new TimePassedCondition(QUEST_SLOT, 1, 12*MathHelper.MINUTES_IN_ONE_WEEK));
          
      // if the player never had a timestamp stored (older quest) we have now added timestamp 1.
      // but that was a while ago that we changed it (November 2010?)
    rose.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      lostFlowerCondition,
      ConversationStates.QUESTION_1,
      "Hello dearie. Did you lose the flower I gave you last? If you need another say #yes but it's bad luck for me to have to give you it again, so you better be sure!",
      null);
   
    rose.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        lostFlowerCondition,
        ConversationStates.IDLE,
        "Heres a new flower to take the pretty lady, but mind you don't lose that one.",
        new MultipleActions(new EquipItemAction("rhosyd", 1, true),
                        new SetQuestAction(QUEST_SLOT, 0, "got_flower"),
                        // dock some karma for losing the flower
                        new IncreaseKarmaAction(-20.0),
                        new SetQuestToTimeStampAction(QUEST_SLOT, 1)));
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.