Package games.stendhal.server.entity.npc

Examples of games.stendhal.server.entity.npc.SpeakerNPC.say()


    npc.add(ConversationStates.QUEST_OFFERED, "ingredients", null,
      ConversationStates.QUEST_OFFERED, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final List<String> needed = missingFood(player, true);
          npc.say("I need "
              + Grammar.quantityplnoun(needed.size(),
                  "ingredient", "one")
              + " before I make the soup: "
              + Grammar.enumerateCollection(needed)
              + ". Will you collect them?");
View Full Code Here


          }
          try {
            final int interval = Integer.parseInt(starr[1].trim());
            final int limit = Integer.parseInt(starr[2].trim());
            if(limit < interval){
              npc.say("I can count to "+Integer.toString(interval)+
                  ", and "+Integer.toString(limit)+" is less then " + Integer.toString(interval)+
                  ". Repeat please.");
              return;
            }
            try {
View Full Code Here

              text = text.substring(starr[0].length()).trim().
                    substring(starr[1].length()).trim().
                        substring(starr[2].length()).trim();
              final String out="Interval: "+Integer.toString(interval)+", limit: "+
              Integer.toString(limit)+", text: \""+text+"\"";
              npc.say("Ok, I have recorded it. "+out);
              logger.info("Admin "+player.getName()+
                    " added announcement: " +out);
              final HeraldListener tnl = new HeraldListener(heraldNews.size());
              heraldNews.add(new HeraldNews(text, interval, limit, 0, tnl, heraldNews.size()));
              turnNotifier.notifyInSeconds(interval,tnl);
View Full Code Here

                    " added announcement: " +out);
              final HeraldListener tnl = new HeraldListener(heraldNews.size());
              heraldNews.add(new HeraldNews(text, interval, limit, 0, tnl, heraldNews.size()));
              turnNotifier.notifyInSeconds(interval,tnl);
            } catch (IndexOutOfBoundsException ioobe) {
                  npc.say(FeelBad);
                  logger.error("WriteNewsAction: Error while parsing sentence "+sentence.toString(), ioobe);
            }
          } catch (NumberFormatException nfe) {
             npc.say(DontUnderstand);
             logger.info("Error while parsing numbers. Interval and limit is: "+"("+starr[0]+"), ("+starr[1]+")");
View Full Code Here

            } catch (IndexOutOfBoundsException ioobe) {
                  npc.say(FeelBad);
                  logger.error("WriteNewsAction: Error while parsing sentence "+sentence.toString(), ioobe);
            }
          } catch (NumberFormatException nfe) {
             npc.say(DontUnderstand);
             logger.info("Error while parsing numbers. Interval and limit is: "+"("+starr[0]+"), ("+starr[1]+")");
          }
        }
      }
 
View Full Code Here

      class RemoveNewsAction implements ChatAction {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc){
          String text = sentence.getOriginalText();         
          final String[] starr = text.split(" ")
          if(starr.length < 2){
            npc.say("Tell me the number of sentence to remove.");
            return;
          }
          final String number = starr[1];
          try {
            final int i = Integer.parseInt(number)-1;
View Full Code Here

          }
          final String number = starr[1];
          try {
            final int i = Integer.parseInt(number)-1;
            if (i < 0){
              npc.say(BadJoke);
              return;
            }
            if (heraldNews.size()==0) {
              npc.say("I dont have announcements now.");
              return;
View Full Code Here

            if (i < 0){
              npc.say(BadJoke);
              return;
            }
            if (heraldNews.size()==0) {
              npc.say("I dont have announcements now.");
              return;
            }
            if(i>=(heraldNews.size())){
              npc.say("I have only "+ Integer.toString(heraldNews.size())+
                  " announcements at the moment.");
View Full Code Here

            if (heraldNews.size()==0) {
              npc.say("I dont have announcements now.");
              return;
            }
            if(i>=(heraldNews.size())){
              npc.say("I have only "+ Integer.toString(heraldNews.size())+
                  " announcements at the moment.");
              return;
            }
            logger.warn("Admin "+player.getName()+" removing announcement #"+
                  Integer.toString(i)+": interval "+
View Full Code Here

      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.QUESTION_1, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final List<String> needed = missingFood(player, true);
          npc.say("I still need "
              + Grammar.quantityplnoun(needed.size(),
                  "ingredient", "one") + ": "
              + Grammar.enumerateCollection(needed)
              + ". Did you bring anything I need?");
        }
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.