Package games.stendhal.server.entity.npc.behaviour.impl

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


              player.notifyWorldAboutChanges();
            }
          }
        }
       
        final ProducerBehaviour behaviour = new SpecialProducerBehaviour("make", "bobbin",
                requiredResources, 10 * 60);

        // we are not using producer adder at all here because that uses Conversations states IDLE and saying 'hi' heavily.
        // we can't do that here because Pequod uses that all the time in his fishing quest. so player is going to have to #remind
        // him if he wants his oil back!

        add(
        ConversationStates.ATTENDING,
        "make",
        new QuestNotActiveCondition(behaviour.getQuestSlot()),
        ConversationStates.ATTENDING, null,
        new ProducerBehaviourAction(behaviour) {
          @Override
          public void fireRequestOK(final ItemParserResult res, final Player player, final Sentence sentence, final EventRaiser npc) {
            // Find out how much items we shall produce.
            if (res.getAmount() > 1000) {
              logger.warn("Decreasing very large amount of "
                  + res.getAmount()
                  + " " + res.getChosenItemName()
                  + " to 1 for player "
                  + player.getName() + " talking to "
                  + npc.getName() + " saying " + sentence);
              res.setAmount(1);
            }

            if (behaviour.askForResources(res, npc, player)) {
              currentBehavRes = res;
              npc.setCurrentState(ConversationStates.PRODUCTION_OFFERED);
            }
          }
        });

        add(ConversationStates.PRODUCTION_OFFERED,
            ConversationPhrases.YES_MESSAGES, null,
            ConversationStates.ATTENDING, null,
            new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
              final EventRaiser npc) {
            behaviour.transactAgreedDeal(currentBehavRes, npc, player);

            currentBehavRes = null;
          }
        });

        add(ConversationStates.PRODUCTION_OFFERED,
            ConversationPhrases.NO_MESSAGES, null,
            ConversationStates.ATTENDING, "OK, no problem.", null);

        add(ConversationStates.ATTENDING,
            Arrays.asList(behaviour.getProductionActivity(), "remind"),
            new QuestActiveCondition(behaviour.getQuestSlot()),
            ConversationStates.ATTENDING, null,
            new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            behaviour.giveProduct(npc, player);
          }
        });
     
      }

View Full Code Here


        final Map<String, Integer> requiredResources = new TreeMap<String, Integer>();
        requiredResources.put("arandula", 1);
        requiredResources.put("kokuda", 1);
        requiredResources.put("minor potion", 1);

        final ProducerBehaviour mixerBehaviour = new ProducerBehaviour("pamela_mix_cream",
            "mix", "suntan cream", requiredResources, 10 * 60);

        new ProducerAdder().addProducer(this, mixerBehaviour, "Hallo!");

        addReply(
View Full Code Here

        // Joshua makes gold if you bring him gold nugget and wood
        final Map<String, Integer> requiredResources = new TreeMap<String, Integer>()
        requiredResources.put("wood", 2);
        requiredResources.put("gold nugget", 1);

        final ProducerBehaviour behaviour = new ProducerBehaviour("joshua_cast_gold",
            "cast", "gold bar", requiredResources, 15 * 60);

        new ProducerAdder().addProducer(this, behaviour,
                "Hi! I'm the local goldsmith. If you require me to #cast you a #'gold bar' just tell me!");
        addReply("wood",
View Full Code Here

        // Erna bakes bread if you bring her flour.
        final Map<String, Integer> requiredResources = new TreeMap<String, Integer>();
        requiredResources.put("flour", 2);

        final ProducerBehaviour behaviour = new ProducerBehaviour("erna_bake_bread",
            "bake", "bread", requiredResources, 10 * 60);

        new ProducerAdder().addProducer(this, behaviour,
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.");
       
View Full Code Here

        final Map<String, Integer> requiredResources = new TreeMap<String, Integer>();
        requiredResources.put("bread", 1);
        requiredResources.put("cheese", 2);
        requiredResources.put("ham", 1);

        final ProducerBehaviour behaviour = new ProducerBehaviour(
            "leander_make_sandwiches", "make", "sandwich",
            requiredResources, 3 * 60);

        new ProducerAdder().addProducer(this, behaviour,
        "Hallo! Glad to see you in my kitchen where I make #pizza and #sandwiches.");
View Full Code Here

    };
    // Jenny mills flour if you bring her grain.
    final Map<String, Integer> requiredResources = new TreeMap<String, Integer>();
    requiredResources.put("grain", 5);

    final ProducerBehaviour behaviour = new ProducerBehaviour("jenny_mill_flour",
        "mill", "flour", requiredResources, 2 * 60);
    new SellerAdder().addSeller(npc, new SeedSellerBehaviour());
    new ProducerAdder().addProducer(npc, behaviour,"Greetings! I am Jenny, the local miller. If you bring me some #grain, I can #mill it into flour for you.");
    npc.setPosition(19, 39);
    npc.setDescription("You see Jenny. She is the local miller.");
View Full Code Here

        // Valo makes mega potions if you bring giant heart and money
        // (uses sorted TreeMap instead of HashMap)
        final Map<String, Integer> requiredResources = new TreeMap<String, Integer>();
        requiredResources.put("money", 20);
        requiredResources.put("giant heart", 1);
        final ProducerBehaviour behaviour = new ProducerBehaviour("valo_concoct_potion",
            "concoct", "mega potion", requiredResources, 2 * 60);

        new ProducerAdder().addProducer(this, behaviour,
        "Greetings, young one. I #heal and I #help.");
        // charge (1*the player level + 1) to heal
View Full Code Here

      requiredResources.put("vampirette entrails", Integer.valueOf(1));
      requiredResources.put("bat entrails", Integer.valueOf(1));
      requiredResources.put("meat", Integer.valueOf(1));
      requiredResources.put("wine", Integer.valueOf(2));
     
      final ProducerBehaviour behaviour = new ProducerBehaviour("blacksheepbob_make_sausage", "make", "sausage",
              requiredResources, 2 * 60);

      new ProducerAdder().addProducer(this, behaviour,
              "Hey there. Welcome to Blacksheep Meat Market. Can I #make you some sausage?");
    }
View Full Code Here

      requiredResources.put("bat entrails", Integer.valueOf(1));
      requiredResources.put("chicken", Integer.valueOf(1));
      requiredResources.put("black pearl", Integer.valueOf(1));
      requiredResources.put("cheese", Integer.valueOf(1));

      final ProducerBehaviour behaviour = new ProducerBehaviour("blacksheepjoe_make_cheese_sausage", "make", "cheese sausage",
              requiredResources, 2 * 60);

      new ProducerAdder().addProducer(this, behaviour,
              "Hi there. Welcome to Blacksheep Meat Market. Can I #make you some cheese sausages?");
    }
View Full Code Here

      final Map<String, Integer> requiredResources = new TreeMap<String, Integer>();
      requiredResources.put("mackerel", Integer.valueOf(1));
      requiredResources.put("perch", Integer.valueOf(1));
      requiredResources.put("marbles", Integer.valueOf(2));

      final ProducerBehaviour behaviour = new ProducerBehaviour("blacksheepharry_make_tuna", "make", "canned tuna",
              requiredResources, 2 * 60);

      new ProducerAdder().addProducer(this, behaviour,
              "Welcome to Blacksheep Meat Market. Can I #make you some canned tuna?");
    }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.npc.behaviour.impl.ProducerBehaviour

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.