diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-09 17:52:59 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-09 17:52:59 +0000 |
commit | 015d9180fb6e9024229dfeded26cf9c3553e36d8 (patch) | |
tree | d2cbe3b0414f16f55b43cc48ee11670af61f1459 /src/game-server/testing.cpp | |
parent | ac89d3ab1425f973c6d29cbe9856873489eec69b (diff) | |
download | manaserv-015d9180fb6e9024229dfeded26cf9c3553e36d8.tar.gz manaserv-015d9180fb6e9024229dfeded26cf9c3553e36d8.tar.bz2 manaserv-015d9180fb6e9024229dfeded26cf9c3553e36d8.tar.xz manaserv-015d9180fb6e9024229dfeded26cf9c3553e36d8.zip |
Converted NPC class to scripting engine.
Diffstat (limited to 'src/game-server/testing.cpp')
-rw-r--r-- | src/game-server/testing.cpp | 36 |
1 files changed, 3 insertions, 33 deletions
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) |