summaryrefslogtreecommitdiff
path: root/src/scripting/script.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2010-07-09 15:21:50 +0200
committerPhilipp Sehmisch <mana@crushnet.org>2010-07-09 15:22:11 +0200
commit26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2 (patch)
tree6d7ea0ebe8be228a61315f72122eed3f2f995a0b /src/scripting/script.cpp
parent2627acefebc688d9d9733abe23ba5aae79f66ea0 (diff)
downloadmanaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.gz
manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.bz2
manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.xz
manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.zip
Added LUA script bindings for manipulating the specials available to a character.
Added script call for getting the cost of a special (recharge only for now) Deleting specials works server-sided but the client isn't informed about it properly. Specials without recharge cost don't appear for the player. Both of these features require an additional netcode message. Reviewed-by: Freeyorp
Diffstat (limited to 'src/scripting/script.cpp')
-rw-r--r--src/scripting/script.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp
index fe3c5d8d..359e94bd 100644
--- a/src/scripting/script.cpp
+++ b/src/scripting/script.cpp
@@ -33,6 +33,7 @@ typedef std::map< std::string, Script::Factory > Engines;
static Engines *engines = NULL;
Script *Script::global_event_script = NULL;
+Script *Script::special_actions_script = NULL;
Script::Script():
mMap(NULL),
@@ -122,3 +123,32 @@ bool Script::execute_global_event_function(const std::string &function, Being* o
}
return isScriptHandled;
}
+
+
+void Script::addDataToSpecial(int id, Special* special)
+{
+ /* currently only gets the recharge cost.
+ TODO: get any other info in a similar way, but
+ first we have to agree on what other
+ info we actually want to provide.
+ */
+ Script *script = Script::special_actions_script;
+ script->prepare("get_special_recharge_cost");
+ script->push(id);
+ int scriptReturn = script->execute();
+ special->neededMana = scriptReturn;
+
+}
+
+bool Script::perform_special_action(int specialId, Being* caster)
+{
+ Script *script = Script::special_actions_script;
+ if (script)
+ {
+ script->prepare("use_special");
+ script->push(caster);
+ script->push(specialId);
+ script->execute();
+ }
+ return true;
+}