From 015d9180fb6e9024229dfeded26cf9c3553e36d8 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Thu, 9 Aug 2007 17:52:59 +0000 Subject: Converted NPC class to scripting engine. --- src/game-server/testing.cpp | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/game-server/testing.cpp') diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp index 7b875eaf..19156203 100644 --- a/src/game-server/testing.cpp +++ b/src/game-server/testing.cpp @@ -13,43 +13,13 @@ #include "game-server/npc.hpp" #include "game-server/state.hpp" #include "net/messageout.hpp" +#include "scripting/script.hpp" // For testing purpose only, the NPC class is not meant to be inherited!! struct DummyNPC: NPC { - DummyNPC(): NPC(110) {} - - void prompt(Character *q, bool restart) - { - if (restart) - { - MessageOut msg(GPMSG_NPC_MESSAGE); - msg.writeShort(getPublicID()); - std::string text = "What do you want?"; - msg.writeString(text, text.length()); - gameHandler->sendTo(q, msg); - } - else - { - MessageOut msg(GPMSG_NPC_CHOICE); - msg.writeShort(getPublicID()); - std::string text = "Guns! Lots of guns!:Nothing"; - msg.writeString(text, text.length()); - gameHandler->sendTo(q, msg); - } - } - - void select(Character *q, int c) - { - if (c == 1) - { - MessageOut msg(GPMSG_NPC_MESSAGE); - msg.writeShort(getPublicID()); - std::string text = "Sorry, this is a heroic-fantasy game, I do not have any gun."; - msg.writeString(text, text.length()); - gameHandler->sendTo(q, msg); - } - } + DummyNPC(): NPC(110, Script::create("lua", "test.lua")) + {} }; static void dropItem(MapComposite *map, int x, int y, int type) -- cgit v1.2.3-70-g09d2