1 /* $Id$ */ 2 /*************************************************************************** 3 * (C) Copyright 2003-2010 - Stendhal * 4 *************************************************************************** 5 *************************************************************************** 6 * * 7 * This program is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation; either version 2 of the License, or * 10 * (at your option) any later version. * 11 * * 12 ***************************************************************************/ 13 package games.stendhal.server.maps.semos.city; 14 15 import java.util.Arrays; 16 import java.util.LinkedList; 17 import java.util.List; 18 import java.util.Map; 19 20 import games.stendhal.server.core.config.ZoneConfigurator; 21 import games.stendhal.server.core.engine.SingletonRepository; 22 import games.stendhal.server.core.engine.StendhalRPZone; 23 import games.stendhal.server.core.pathfinder.FixedPath; 24 import games.stendhal.server.core.pathfinder.Node; 25 import games.stendhal.server.entity.CollisionAction; 26 import games.stendhal.server.entity.npc.SpeakerNPC; 27 import games.stendhal.server.entity.npc.behaviour.adder.HealerAdder; 28 import games.stendhal.server.entity.npc.behaviour.adder.SellerAdder; 29 import games.stendhal.server.entity.npc.behaviour.impl.SellerBehaviour; 30 31 /** 32 * A young lady (original name: Carmen) who heals players without charge. 33 */ 34 public class HealerNPC implements ZoneConfigurator { 35 36 @Override configureZone(final StendhalRPZone zone, final Map<String, String> attributes)37 public void configureZone(final StendhalRPZone zone, 38 final Map<String, String> attributes) { 39 buildNPC(zone); 40 } 41 buildNPC(final StendhalRPZone zone)42 private void buildNPC(final StendhalRPZone zone) { 43 final SpeakerNPC npc = new SpeakerNPC("Carmen") { 44 @Override 45 public void createDialog() { 46 addGreeting("Hi, if I can #help, just say."); 47 addJob("My special powers help me to heal wounded people. I also sell potions and antidotes."); 48 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."); 49 addEmotionReply("hugs", "hugs"); 50 addGoodbye(); 51 } 52 53 @Override 54 protected void createPath() { 55 final List<Node> nodes = new LinkedList<Node>(); 56 nodes.add(new Node(5, 46)); 57 nodes.add(new Node(18, 46)); 58 setPath(new FixedPath(nodes, true)); 59 } 60 }; 61 new SellerAdder().addSeller(npc, new SellerBehaviour(SingletonRepository.getShopList().get("healing"))); 62 new HealerAdder().addHealer(npc, 0); 63 npc.setPosition(5, 46); 64 npc.setCollisionAction(CollisionAction.STOP); 65 npc.setDescription("You see kind Carmen. She looks like someone you could ask for help."); 66 npc.setEntityClass("welcomernpc"); 67 npc.setSounds(Arrays.asList("giggle-female-01", "giggle-female-02")); 68 zone.add(npc); 69 } 70 } 71