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.yeticave; 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.StendhalRPZone; 21 import games.stendhal.server.core.pathfinder.FixedPath; 22 import games.stendhal.server.core.pathfinder.Node; 23 import games.stendhal.server.entity.CollisionAction; 24 import games.stendhal.server.entity.npc.SpeakerNPC; 25 26 public class MrYetiNPC implements ZoneConfigurator { 27 /** 28 * Configure a zone. 29 * 30 * @param zone The zone to be configured. 31 * @param attributes Configuration attributes. 32 */ 33 @Override configureZone(final StendhalRPZone zone, final Map<String, String> attributes)34 public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) { 35 buildYeti(zone); 36 } 37 buildYeti(final StendhalRPZone zone)38 private void buildYeti(final StendhalRPZone zone) { 39 final SpeakerNPC yetimale = new SpeakerNPC("Mr. Yeti") { 40 41 @Override 42 protected void createPath() { 43 final List<Node> nodes = new LinkedList<Node>(); 44 nodes.add(new Node(29, 29)); 45 nodes.add(new Node(17, 29)); 46 nodes.add(new Node(17, 32)); 47 nodes.add(new Node(14, 32)); 48 nodes.add(new Node(14, 38)); 49 nodes.add(new Node(13, 38)); 50 nodes.add(new Node(13, 46)); 51 nodes.add(new Node(19, 46)); 52 nodes.add(new Node(19, 54)); 53 nodes.add(new Node(23, 54)); 54 nodes.add(new Node(21, 54)); 55 nodes.add(new Node(21, 45)); 56 nodes.add(new Node(26, 45)); 57 nodes.add(new Node(26, 37)); 58 nodes.add(new Node(29, 37)); 59 setPath(new FixedPath(nodes, true)); 60 } 61 62 @Override 63 protected void createDialog() { 64 addGreeting("Greetings, strange foreigner!"); 65 addJob("My job is to clean up all this around you!"); 66 addHelp("I am not able to help you!"); 67 addGoodbye(); 68 } 69 }; 70 71 yetimale.setEntityClass("yetimalenpc"); 72 yetimale.setDescription("You see Mr. Yeti, a white hairy man with huge feet!"); 73 yetimale.setPosition(29, 29); 74 yetimale.setCollisionAction(CollisionAction.STOP); 75 yetimale.initHP(100); 76 zone.add(yetimale); 77 } 78 } 79