Package games.stendhal.server.maps.ados.wall

Source Code of games.stendhal.server.maps.ados.wall.HolidayingManNPC

/* $Id: HolidayingManNPC.java,v 1.4 2010/09/19 02:28:11 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.ados.wall;

import games.stendhal.server.core.config.ZoneConfigurator;
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 java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
* Creates a man NPC to help populate Ados
*
*/
public class HolidayingManNPC implements ZoneConfigurator {
  /**
   * Configure a zone.
   *
   * @param  zone    The zone to be configured.
   * @param  attributes  Configuration attributes.
   */
  public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
    buildNPC(zone);
  }

  private void buildNPC(final StendhalRPZone zone) {
    final SpeakerNPC npc = new SpeakerNPC("Martin Farmer") {

      @Override
      protected void createPath() {
        final List<Node> nodes = new LinkedList<Node>();
        nodes.add(new Node(70, 52));
        nodes.add(new Node(76, 52));
        nodes.add(new Node(76, 17));
        nodes.add(new Node(70, 17));
        nodes.add(new Node(70, 14));
        nodes.add(new Node(79, 14));
        nodes.add(new Node(79, 52));
        setPath(new FixedPath(nodes, true));
      }

      @Override
      protected void createDialog() {
        addGreeting("Hi hi.");
        addHelp("The mayor of this town is really nice. I visited him with my wife to get some help.");
        addOffer("What? I'm on holidays!");
        addQuest("Ehm... I don't need help at the moment, but thanks.");
        addJob("No no, I'm on holiday here with my wife Alice.");
        addGoodbye("See you, and take care because of the lions beyond the wall.");

        }
    };

    npc.setEntityClass("man_008_npc");
    npc.setPosition(70, 52);
    npc.initHP(100);
    npc.setDescription("You see Martin Farmer. He is on holidays with his wife Alice.");
    zone.add(npc);
  }
}
TOP

Related Classes of games.stendhal.server.maps.ados.wall.HolidayingManNPC

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.