Examples of RepairerBehaviour


Examples of games.stendhal.server.entity.npc.behaviour.impl.RepairerBehaviour

   * Add the model fragments to the given NPC
   *
   * @param npc the NPC to enrich
   */
  public void addRepairer(final SpeakerNPC npc) {
    final RepairerBehaviour repairerBehaviour = new RepairerBehaviour(
            new RepairingPriceCalculationStrategy(new HashSet<String>()),
            new HashSet<String>(Arrays.asList("buckler")));
    final Engine engine = npc.getEngine();
   
    //sentence was not recognized     
    ChatCondition errorCondition = new SentenceHasErrorCondition();
    engine.add(ConversationStates.ATTENDING, "repair", errorCondition,
        false, ConversationStates.ATTENDING,
        null, new ComplainAboutSentenceErrorAction());
   
    //sentence recognized but not able to repair
    ChatCondition cannotRepair = new AndCondition(
        new NotCondition(new SentenceHasErrorCondition()),
        new NotCondition(repairerBehaviour.getTransactionCondition()));
   
    engine.add(ConversationStates.ATTENDING, "repair", cannotRepair,
        false, ConversationStates.ATTENDING,
        null, repairerBehaviour.getRejectedTransactionAction());
   
    //recognized and able to repair
    ChatCondition recognizedCondition = new AndCondition(
        new NotCondition(new SentenceHasErrorCondition()),
        repairerBehaviour.getTransactionCondition());
   
    engine.add(ConversationStates.ATTENDING, "repair",
        recognizedCondition, false, ConversationStates.REPAIR_OFFERED,
        null, new RepairingBehaviourAction(repairerBehaviour));

    engine.add(ConversationStates.ATTENDING,
        ConversationPhrases.OFFER_MESSAGES, null,
        false, ConversationStates.ATTENDING, "I can #repair items for you.", null);

    ChatAction behaviourAcceptedAction =new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
        repairerBehaviour.transactAgreedDeal(repairerBehaviour.parse(sentence), raiser, player);
      }
    };
   
    engine.add(ConversationStates.REPAIR_OFFERED,
        ConversationPhrases.YES_MESSAGES, null,
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.