Package games.stendhal.server.core.scripting

Examples of games.stendhal.server.core.scripting.ScriptingNPC


  @Override
  public void load(final Player admin, final List<String> args, final ScriptingSandbox sandbox) {
    super.load(admin, args, sandbox);

    // Create NPC
    final ScriptingNPC npc = new ScriptingNPC("Debuggera");
    npc.setEntityClass("girlnpc");

    // Place NPC in int_admin_playground on server start
    final String myZone = "int_admin_playground";
    sandbox.setZone(myZone);
    int x = 4;
    int y = 11;

    // If this script is executed by an admin, Debuggera will be placed next
    // to him/her.
    if (admin != null) {
      sandbox.setZone(sandbox.getZone(admin));
      x = admin.getX() + 1;
      y = admin.getY();
    }

    // Set zone and position
    npc.setPosition(x, y);
    npc.setDirection(Direction.DOWN);
    sandbox.add(npc);

    //
    npc.add(ConversationStates.IDLE, Arrays.asList("hi", "hello",
        "greetings", "hola"), null, ConversationStates.IDLE,
        "My mom said, i am not allowed to talk to strangers.", null);
    npc.behave("bye", "Bye.");

    // Greating and admins may enable or disable her
    npc.add(ConversationStates.IDLE, Arrays.asList("hi", "hello",
        "greetings", "hola"), new AdminCondition(),
        ConversationStates.ATTENDING,
        "Hi, game master. Do you think i am #crazy?", null);

//    npc.add(ConversationStates.IDLE, [ "hi","hello","greetings","hola" ],
//        new AdminCondition(), ConversationStates.QUESTION_1,
//        "May I talk to strangers?", null);
//    npc.add(ConversationStates.QUESTION_1, SpeakerNPC.YES_MESSAGES, new AdminCondition(),
//        ConversationStates.ATTENDING, null, new DebuggeraEnablerAction(true));
//    npc.add(ConversationStates.QUESTION_1, ConversationPhrases.NO_MESSAGES, new AdminCondition(),
//        ConversationStates.ATTENDING, null, new DebuggeraEnablerAction(false));

    npc.behave(Arrays.asList("insane", "crazy", "mad"),
        "Why are you so mean? I AM NOT INSANE. My mummy says, I am a #special child.");
    npc.behave(
        Arrays.asList("special", "special child"),
        "I can see another world in my dreams. That are more thans dreams. There the people are sitting in front of machines called computers. This are realy strange people. They cannot use telepathy without something they call inter-network. But these people and machines are somehow connected to our world. If I concentrate, I can #change thinks in our world.");
    // npc.behave("verschmelzung", "\r\nYou have one hand,\r\nI have the
    // other.\r\nPut them together,\r\nWe have each other.");
    npc.add(
        ConversationStates.ATTENDING,
        Arrays.asList("susi"),
        null,
        ConversationStates.ATTENDING,
        "Yes, she is my twin sister. People consider her normal because she hides her special abilities.",
        null);

    // change
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("change", "change"), new QuestInStateCondition(
            "debuggera", "friends"), ConversationStates.ATTENDING,
        "I can teleport you.", null);
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("change", "change"),
        new QuestNotInStateCondition("debuggera", "friends"),
        ConversationStates.ATTENDING,
        "Do you want to become my #friend?", null);

    // friends
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("friend", "friends"), new QuestInStateCondition(
            "debuggera", "friends"), ConversationStates.ATTENDING,
        "We are friends.", null);
    npc.add(
        ConversationStates.ATTENDING,
        Arrays.asList("friend", "friends"),
        new QuestNotInStateCondition("debuggera", "friends"),
        ConversationStates.INFORMATION_1,
        "Please repeat:\r\n                        \"A circle is round,\"",
        null);
    npc.add(ConversationStates.INFORMATION_1, Arrays.asList(
        "A circle is round,", "A circle is round"), null,
        ConversationStates.INFORMATION_2, "\"it has no end.\"", null);
    npc.add(ConversationStates.INFORMATION_2, Arrays.asList(
        "it has no end.", "it has no end"), null,
        ConversationStates.INFORMATION_3, "\"That's how long,\"", null);
    npc.add(ConversationStates.INFORMATION_3, Arrays.asList(
        "That's how long,", "That's how long", "Thats how long,",
        "Thats how long"), null, ConversationStates.INFORMATION_4,
        "\"I will be your friend.\"", null);
    npc.add(ConversationStates.INFORMATION_4, Arrays.asList(
        "I will be your friend.", "I will be your friend"), null,
        ConversationStates.ATTENDING, "Cool. We are friends now.",
        new SetQuestAction("debuggera", "friends"));

    // quests
    npc.add(ConversationStates.ATTENDING, "quest", new AdminCondition(),
        ConversationStates.ATTENDING, null, new QuestsAction(sandbox));

    // teleport
    npc.add(ConversationStates.ATTENDING, Arrays.asList("teleport",
        "teleportme"), new AdminCondition(), ConversationStates.IDLE,
        null, new TeleportNPCAction(sandbox));

    final StendhalRPWorld world = SingletonRepository.getRPWorld();
    npc.add(ConversationStates.ATTENDING, Arrays.asList("sightseeing",
        "memory", "memoryhole"), new AdminCondition(),
        ConversationStates.IDLE, null, new SightseeingAction(sandbox,
            world));
  }
View Full Code Here


    if (admin == null) {
      return;
    }

    // create npc
    npc = new ScriptingNPC("Bob the Bookie");
    npc.setEntityClass("naughtyteen2npc");

    // place NPC next to admin
    sandbox.setZone(sandbox.getZone(admin));
    final int x = admin.getX() + 1;
View Full Code Here

  @Override
  public void load(final Player admin, final List<String> args, final ScriptingSandbox sandbox) {

    // Create NPC
    final ScriptingNPC npc = new ScriptingNPC("Maria");
    npc.setEntityClass("tavernbarmaidnpc");

    // Place NPC in int_admin_playground on server start
    final String myZone = "int_admin_playground";
    sandbox.setZone(myZone);
    int x = 11;
    int y = 4;
    String shop = "food&drinks";
    final ShopList shops = SingletonRepository.getShopList();
    if (args.size() > 0 ) {
      if (shops.get(args.get(0))!= null) {
        shop = args.get(0);   
      } else {
        admin.sendPrivateText(args.get(0)
            + " not recognised as a shop name. Using default food&drinks");
      }
    }
    // If this script is executed by an admin, Maria will be placed next to him.
    if (admin != null) {
      sandbox.setZone(sandbox.getZone(admin));
      x = admin.getX() + 1;
      y = admin.getY();
    }

    // Set zone and position
    npc.setPosition(x, y);
    sandbox.add(npc);

    // Create Dialog
    npc.behave("greet", "Hi, how can I help you?");
    npc.behave(
        "job",
        "I am one of the bar maids at Semos' #tavern and doing outside services. We sell fine beers and food.");
    npc.behave("tavern",
//      "I have a #coupon for a free beer in Semos' tavern. "+
      "It is on the left side of the temple.");
    npc.behave("help",
        "You can see what I #offer and take a break to meet new people!");
    npc.behave("bye", "Bye bye!");
    try {
      npc.behave("sell", SingletonRepository.getShopList().get(shop));
    } catch (final NoSuchMethodException e) {
      logger.error(e, e);
    }

    // TODO Modify Margaret
View Full Code Here

    }

   
   
    // create npc
    ScriptingNPC npc;
    npc = new ScriptingNPC("Admin Maker");
    npc.setEntityClass("tavernbarmaidnpc");
   
    // Place NPC in int_admin_playground on server start
    final String myZone = "0_semos_city";
    sandbox.setZone(myZone);
    int x = 32;
    int y = 16;

    // if this script is executed by an admin, Admin Maker will be placed
    // next to
    // him/her.
    if (admin != null) {
      sandbox.setZone(sandbox.getZone(admin));
      x = admin.getX() + 1;
      y = admin.getY();
    }

    // Set zone and position
    npc.setPosition(x, y);
    sandbox.add(npc);

    // Create Dialog
    npc.behave("greet", "Hi, how can i #help you?");
    npc.behave("help",
        "Perhaps you would like a free power #upgrade and maybe a #random destination?");
    npc.addGoodbye();
    npc.add(ConversationStates.ATTENDING, "upgrade", null,
        ConversationStates.ATTENDING, null, new UpgradeAction());
    npc.add(ConversationStates.ATTENDING, "random", null,
        ConversationStates.ATTENDING, null, new TeleportAction());

  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.scripting.ScriptingNPC

Copyright © 2018 www.massapicom. 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.