summaryrefslogtreecommitdiff
path: root/src/scripting/luascript.h
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2011-04-27 15:24:36 +0200
committerPhilipp Sehmisch <mana@crushnet.org>2011-04-27 15:24:36 +0200
commitc1a6e9947231cc511016378bd326a5d64b0aa18c (patch)
tree03c9b42ae97d61b5568f27ddc3f1be7a8b6648c3 /src/scripting/luascript.h
parentca1dd6fcaf1dfaef0f18df0b6c114f1baa25d2ce (diff)
downloadmanaserv-c1a6e9947231cc511016378bd326a5d64b0aa18c.tar.gz
manaserv-c1a6e9947231cc511016378bd326a5d64b0aa18c.tar.bz2
manaserv-c1a6e9947231cc511016378bd326a5d64b0aa18c.tar.xz
manaserv-c1a6e9947231cc511016378bd326a5d64b0aa18c.zip
Added a simple crafting system
A client can craft something using the @craft command. The command needs a list of item names and amounts. The gameserver checks if the character has these items in the inventory and then passes the list together with the character handle to the lua script function on_craft in the script file scripts/crafting.lua. This function can then be used to evaluate if the list is a valid crafting combination and when this is the case take or give items. Implemented two example crafting scripts there, one which enforces exact item order and amount and one which doesn't. Both are disabled per default and one needs to be enabled by uncommenting a line. Also gave the player group permission to use the @craft command in permissions.xml and added two new items (wood and iron) required for the example crafting combination. Resolves: #333 Reviewed-by: bcs86, Bertram
Diffstat (limited to 'src/scripting/luascript.h')
-rw-r--r--src/scripting/luascript.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/scripting/luascript.h b/src/scripting/luascript.h
index af13aa22..b9bde2d8 100644
--- a/src/scripting/luascript.h
+++ b/src/scripting/luascript.h
@@ -52,6 +52,8 @@ class LuaScript: public Script
void push(Thing *);
+ void push(const std::list<InventoryItem> &itemList);
+
int execute();
static void getQuestCallback(Character *, const std::string &,
@@ -69,6 +71,7 @@ class LuaScript: public Script
*/
static bool loadGlobalEventScript(const std::string &file);
static bool loadSpecialActionsScript(const std::string &file);
+ static bool loadCraftScript(const std::string &file);
private:
lua_State *mState;