Package games.stendhal.server.maps.semos.city

Source Code of games.stendhal.server.maps.semos.city.HealerNPC

/* $Id: HealerNPC.java,v 1.19 2010/09/19 02:35:36 nhnb Exp $ */
/***************************************************************************
*                   (C) Copyright 2003-2010 - Stendhal                    *
***************************************************************************
***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
***************************************************************************/
package games.stendhal.server.maps.semos.city;

import games.stendhal.server.core.config.ZoneConfigurator;
import games.stendhal.server.core.engine.SingletonRepository;
import games.stendhal.server.core.engine.StendhalRPZone;
import games.stendhal.server.core.pathfinder.FixedPath;
import games.stendhal.server.core.pathfinder.Node;
import games.stendhal.server.entity.npc.SpeakerNPC;
import games.stendhal.server.entity.npc.behaviour.adder.HealerAdder;
import games.stendhal.server.entity.npc.behaviour.adder.SellerAdder;
import games.stendhal.server.entity.npc.behaviour.impl.SellerBehaviour;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
* A young lady (original name: Carmen) who heals players without charge.
*/
public class HealerNPC implements ZoneConfigurator {
 
  public void configureZone(final StendhalRPZone zone,
      final Map<String, String> attributes) {
    buildNPC(zone);
  }

  private void buildNPC(final StendhalRPZone zone) {
    final SpeakerNPC npc = new SpeakerNPC("Carmen") {
      @Override
      public void createDialog() {
        addGreeting("Hi, if I can #help, just say.");
        addJob("My special powers help me to heal wounded people. I also sell potions and antidotes.");
        addHelp("I can #heal you here for free, or you can take one of my prepared medicines with you on your travels; just ask for an #offer.");
        addEmotionReply("hugs", "hugs");
        addGoodbye();
      }

      @Override
      protected void createPath() {
        final List<Node> nodes = new LinkedList<Node>();
        nodes.add(new Node(5, 46));
        nodes.add(new Node(18, 46));
        setPath(new FixedPath(nodes, true));
      }
    };
    new SellerAdder().addSeller(npc, new SellerBehaviour(SingletonRepository.getShopList().get("healing")));
    new HealerAdder().addHealer(npc, 0);
    npc.setPosition(5, 46);
    npc.setDescription("You see kind Carmen. She looks like someone you could ask for help.");
    npc.setEntityClass("welcomernpc");
    zone.add(npc);
  }

}
TOP

Related Classes of games.stendhal.server.maps.semos.city.HealerNPC

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.