Examples of ChatAction


Examples of games.stendhal.server.entity.npc.ChatAction

    final SpeakerNPC leander = npcs.get("Leander");

    leander.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES, null,
      ConversationStates.QUEST_OFFERED, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          if (player.hasQuest(QUEST_SLOT) && !player.isQuestCompleted(QUEST_SLOT)) {
            final String[] questData = player.getQuest(QUEST_SLOT)
                .split(";");
            final String customerName = questData[0];
            if (isDeliveryTooLate(player)) {
              // If the player still carries any pizza due for an NPC,
              // take it away because the baker is angry,
              // and because the player probably won't
              // deliver it anymore anyway.
              for (final Item pizza : player.getAllEquipped("pizza")) {
                if (pizza.getInfoString()!=null) {
                  player.drop(pizza);
                }
              }
              npc.say("I see you failed to deliver the pizza to "
                + customerName
                + " in time. Are you sure you will be more reliable this time?");
            } else {
              npc.say("You still have to deliver a pizza to "
                  + customerName + ", and hurry!");
              npc.setCurrentState(ConversationStates.ATTENDING);
            }
          } else {
            npc.say("I need you to quickly deliver a hot pizza. If you're fast enough, you might get quite a nice tip. So, will you do it?");
          }
        }
      });

    leander.add(ConversationStates.QUEST_OFFERED,
      ConversationPhrases.YES_MESSAGES, null,
      ConversationStates.ATTENDING, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          startDelivery(player, npc);
        }
      });

    leander.add(
      ConversationStates.QUEST_OFFERED,
      ConversationPhrases.NO_MESSAGES,
      null,
      ConversationStates.ATTENDING,
      "Too bad. I hope my daughter #Sally will soon come back from her camp to help me with the deliveries.",
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          putOffUniform(player);
        }
      });
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

        continue;
      }

      npc.add(ConversationStates.ATTENDING, "pizza", null,
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            handOverPizza(player, npc);
          }
        });
    }
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

        ConversationStates.ATTENDING,
        Arrays.asList("rats", "rats!"),
        new TPPQuestInPhaseCondition(INVASION),
        ConversationStates.ATTENDING,
        null,
        new ChatAction() {
          public void fire(Player player, Sentence sentence, EventRaiser npc) {
            npc.say("There " + Grammar.isare(getRats().size()) +
                " still about "+Integer.toString(getRats().size())+
                " rats alive.");
         
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("coal",25)),
        ConversationStates.ATTENDING,
        null,
        new MultipleActions(
            new DropItemAction("coal",25),
            new ChatAction() {
              public void fire(final Player player,
                  final Sentence sentence,
                  final EventRaiser npc) {
                int grilledsteakAmount = Rand.rand(4) + 1;
                new EquipItemAction("grilled steak", grilledsteakAmount, true).fire(player, sentence, npc);
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

      "If you found any #spirits, please tell me their name.", null);

    for(final String spiritName : NEEDED_SPIRITS) {
      npc.add(ConversationStates.QUESTION_1, spiritName, null,
        ConversationStates.QUESTION_1, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            final String name = spiritName;

            // although all names are stored as lower case from now on,
            // older versions did not,
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

    actions.add(new SetQuestToTimeStampAction(QUEST_SLOT, 1));
    actions.add(new IncrementQuestAction(QUEST_SLOT,2,1));
    actions.add(new SetQuestAction(QUEST_SLOT, 0, "done"));
    actions.add(new IncreaseXPDependentOnLevelAction(5.0/3.0, 290.0));
    actions.add(new IncreaseKarmaAction(10.0));
    actions.add(new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
        int goldamount;
        final StackableItem money = (StackableItem) SingletonRepository.getEntityManager()
                .getItem("money");
        goldamount = 100 * Rand.roll1D6();
 
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

    // time has passed
    final ChatCondition condition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStateStartsWithCondition(QUEST_SLOT,"decorating"),
            new TimePassedCondition(QUEST_SLOT, 1, 5)
          );
    final ChatAction action = new MultipleActions(
                      new SetQuestAction(QUEST_SLOT,"done"),
                      new IncreaseKarmaAction(20),
                      new IncreaseXPAction(10000),
                      // here, true = bind them to player
                      new EquipItemAction("black legs", 1, true)
                    );
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        condition,
        ConversationStates.IDLE,
        "Here are the black legs. Now I beg you to wear them. The symbol of my pain is done. Fare thee well.",
        action);
   
    // time has not yet passed
    final ChatCondition notCondition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
        new QuestStateStartsWithCondition(QUEST_SLOT,"decorating"),
        new NotCondition( new TimePassedCondition(QUEST_SLOT, 1, 5))
      );
    ChatAction reply = new SayTimeRemainingAction(QUEST_SLOT, 1, 5, "I did not finish decorating the legs. " +
            "Please check back in");
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        notCondition,
        ConversationStates.IDLE,
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "kill_scientist"),
        new KilledForQuestCondition(QUEST_SLOT, 1),
        new PlayerHasItemWithHimCondition("goblet")
      );
    ChatAction action = new MultipleActions(
                    new SetQuestAction(QUEST_SLOT, "decorating;"),
                    new SetQuestToTimeStampAction(QUEST_SLOT, 1),
                    new DropItemAction("goblet",1)
                    );
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "find_vera"),
        new PlayerHasItemWithHimCondition("note")
      );
   
    final ChatAction action = new MultipleActions(
          new SetQuestAction(QUEST_SLOT, 0, "kill_scientist"),
          new StartRecordingKillsAction(QUEST_SLOT, 1, "Sergej Elos", 0, 1),
          new DropItemAction("note")
        );
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
View Full Code Here

Examples of games.stendhal.server.entity.npc.ChatAction

        "Please ask Mayor Sakhs about my wife Vera.",
        null);
  }

  private void playerVisitsMayorSakhs(final SpeakerNPC npc) {
    final ChatAction action = new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
        final Item item = SingletonRepository.getEntityManager().getItem("note");
        item.setInfoString(player.getName());
        item.setDescription(LETTER_DESCRIPTION);
        item.setBoundTo(player.getName());
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.