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.temple; 14 15 import java.util.LinkedList; 16 import java.util.List; 17 import java.util.Map; 18 19 import games.stendhal.server.core.config.ZoneConfigurator; 20 import games.stendhal.server.core.engine.SingletonRepository; 21 import games.stendhal.server.core.engine.StendhalRPZone; 22 import games.stendhal.server.core.pathfinder.FixedPath; 23 import games.stendhal.server.core.pathfinder.Node; 24 import games.stendhal.server.entity.CollisionAction; 25 import games.stendhal.server.entity.npc.ShopList; 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 public class HealerNPC implements ZoneConfigurator { 32 private final ShopList shops = SingletonRepository.getShopList(); 33 34 /** 35 * Configure a zone. 36 * 37 * @param zone The zone to be configured. 38 * @param attributes Configuration attributes. 39 */ 40 @Override configureZone(final StendhalRPZone zone, final Map<String, String> attributes)41 public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) { 42 buildSemosTempleArea(zone); 43 } 44 buildSemosTempleArea(final StendhalRPZone zone)45 private void buildSemosTempleArea(final StendhalRPZone zone) { 46 final SpeakerNPC npc = new SpeakerNPC("Ilisa") { 47 48 @Override 49 protected void createPath() { 50 final List<Node> nodes = new LinkedList<Node>(); 51 nodes.add(new Node(9, 6)); 52 nodes.add(new Node(14, 6)); 53 setPath(new FixedPath(nodes, true)); 54 } 55 56 @Override 57 protected void createDialog() { 58 addGreeting(); 59 addJob("My special powers help me to heal wounded people. I also sell potions and antidotes."); 60 addHelp("I can #heal you here for a cost, or you can take one of my prepared medicines with you on your travels; just ask for an #offer."); 61 new SellerAdder().addSeller(this, new SellerBehaviour(shops.get("healing"))); 62 // charge (2*the player level + 1) to heal 63 new HealerAdder().addHealer(this, -2); 64 addGoodbye(); 65 } 66 }; 67 68 npc.setEntityClass("welcomernpc"); 69 npc.setDescription("You see Ilisa. She is young, pretty and her magical aura is enclosing her."); 70 npc.setPosition(9, 6); 71 npc.setCollisionAction(CollisionAction.STOP); 72 npc.initHP(100); 73 zone.add(npc); 74 } 75 } 76