summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2012-07-16 17:45:52 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2012-07-17 21:58:40 +0200
commitf126afd524133f207c07d5eb52e3e774ab41604e (patch)
tree110023acb6bdf453a02d40b92714cf14134d9156 /src
parentfc8e16e33bc34bda74559d021f5c1855a789a2b2 (diff)
downloadmanaserv-f126afd524133f207c07d5eb52e3e774ab41604e.tar.gz
manaserv-f126afd524133f207c07d5eb52e3e774ab41604e.tar.bz2
manaserv-f126afd524133f207c07d5eb52e3e774ab41604e.tar.xz
manaserv-f126afd524133f207c07d5eb52e3e774ab41604e.zip
Added script binds to get full monster anger list + drop anger of monsters
Reviewed-by: bjorn.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/monster.h3
-rw-r--r--src/scripting/lua.cpp17
2 files changed, 20 insertions, 0 deletions
diff --git a/src/game-server/monster.h b/src/game-server/monster.h
index 75ea1e83..5da975e9 100644
--- a/src/game-server/monster.h
+++ b/src/game-server/monster.h
@@ -325,6 +325,9 @@ class Monster : public Being
*/
void changeAnger(Actor *target, int amount);
+ const std::map<Being *, int> &getAngerList() const
+ { return mAnger; }
+
/**
* Calls the damage function in Being and updates the aggro list
*/
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 05845a36..b7e61065 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1347,6 +1347,21 @@ static int monster_change_anger(lua_State *s)
return 0;
}
+static int monster_drop_anger(lua_State *s)
+{
+ Monster *monster = checkMonster(s, 1);
+ Being *being = checkBeing(s, 2);
+ monster->forgetTarget(being);
+ return 0;
+}
+
+static int monster_get_angerlist(lua_State *s)
+{
+ Monster *monster = checkMonster(s, 1);
+ pushSTLContainer(s, monster->getAngerList());
+ return 1;
+}
+
/**
* monster_remove(Monster*): bool success
* Remove a monster object without kill event.
@@ -2454,6 +2469,8 @@ LuaScript::LuaScript():
{ "monster_get_name", &monster_get_name },
{ "monster_get_id", &monster_get_id },
{ "monster_change_anger", &monster_change_anger },
+ { "monster_drop_anger", &monster_drop_anger },
+ { "monster_get_angerlist", &monster_get_angerlist },
{ "monster_remove", &monster_remove },
{ "being_apply_status", &being_apply_status },
{ "being_remove_status", &being_remove_status },