summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-02-17 12:24:45 +0100
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-08-26 22:56:47 +0200
commit44ee071d7ece5a2023f79307f36e8a244c9e7b3a (patch)
tree06b7fcea59bbbf1963b460ca9b678d0ea6fa90e4 /src/scripting
parente3a1e9c89e102dbf961c624435c495c759776312 (diff)
downloadmanaserv-44ee071d7ece5a2023f79307f36e8a244c9e7b3a.tar.gz
manaserv-44ee071d7ece5a2023f79307f36e8a244c9e7b3a.tar.bz2
manaserv-44ee071d7ece5a2023f79307f36e8a244c9e7b3a.tar.xz
manaserv-44ee071d7ece5a2023f79307f36e8a244c9e7b3a.zip
Removed skills
This removes support for skills. The plan is to allow to implement the skills as they were implemented before via attributes. This adds a lot more flexibility to the server creators while also removing the confusion about skills and attributes. So this change does: - Remove the skillmanager with all its calls, the skill xml file, etc - Move exp giving to the script engine: --> Allows to implement the old behaviour (and more) in the scripts - Remove the exp tag from the monster definition: + Since the server itself does not require it anymore it feels wrong to require it for EVERY monster. TODO: Add a system to add properties to the monsters/items.xml which allow defining things like the exp and allows to read the value from the script engine. + Small drawback, but it should not be hard to implement this property system. - Drop the level networking and calculation. + level calculation will happen via the attribute system later but i would prefer to do this in a seperate patch since this patch already got longer than expected especially since this requires to make setting correction points and available status points scriptable. + The level would be simply set as a attribute, the int number of it will be the level, the remaining digits will be the % number till the next levelup. - NOT remove any existing skill tables in the database update scripts. + There is no way to move them into the attribute table in a unified way (there are too many different way they could have been used). So server admins have to care about moving theirs skills to attributes themselves. + Keeping the old tables does not hurt for existing databases. So removing does not give any advantage/is required anyway. The now obsolote info about the EXP transaction is not removed for updated databases either. (The update script basically only bumps the version number without doing anything else. - bump the network protocol version --> old clients won't be able to connect. - bump the database version --> serveradmins need to update their db.
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp93
-rw-r--r--src/scripting/luautil.cpp11
-rw-r--r--src/scripting/luautil.h1
3 files changed, 0 insertions, 105 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index a76c9399..624fbda1 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1878,95 +1878,6 @@ static int entity_set_gender(lua_State *s)
return 0;
}
-/** LUA entity:level (being)
- * entity:level()
- * entity:level(int skill_id)
- * entity:level(string skill_name)
- **
- * Valid only for character entities.
- *
- * **Return value:** Returns the level of the character. If a skill is passed
- * (either by name or id) the level of this skill is returned.
- *
- * **Note:** If the skill is provided as string (`skill_name`) you have to
- * use this format: &lt;setname&gt;_&lt;skillname&gt;. So for example: "Weapons_Unarmed".
- */
-static int entity_get_level(lua_State *s)
-{
- Entity *ch = checkCharacter(s, 1);
- auto *characterComponent = ch->getComponent<CharacterComponent>();
- if (lua_gettop(s) > 1)
- {
- int skillId = checkSkill(s, 2);
- lua_pushinteger(s, characterComponent->levelForExp(
- characterComponent->getExperience(skillId)));
- }
- else
- {
- lua_pushinteger(s, characterComponent->getLevel());
- }
- return 1;
-}
-
-/** LUA entity:xp (being)
- * entity:xp(int skill_id)
- * entity:xp(string skill_name)
- **
- * Valid only for character entities.
- *
- * **Return value:** The total experience collected by the character in
- * `skill`.
- *
- * If the skill is provided as string (`skillname`) you have to use this
- * format: &lt;setname&gt;_&lt;skillname&gt;. So for example: "Weapons_Unarmed".
- */
-static int entity_get_xp(lua_State *s)
-{
- Entity *c = checkCharacter(s, 1);
- int skill = checkSkill(s, 2);
- const int exp = c->getComponent<CharacterComponent>()->getExperience(skill);
-
- lua_pushinteger(s, exp);
- return 1;
-}
-
-/** LUA entity:give_xp (being)
- * entity:give_xp(int skill, int amount [, int optimalLevel])
- * entity:give_xp(string skillname, int amount [, int optimalLevel])
- **
- * Valid only for character entities.
- *
- * Gives the character `amount` experience in skill `skill`. When an
- * optimal level is set (over 0), the experience is reduced when the characters
- * skill level is beyond this. If the skill is provided as string
- * (`skillname`) you have to use this format: &lt;setname&gt;_&lt;skillname&gt;.
- * So for example: "Weapons_Unarmed".
- */
-static int entity_give_xp(lua_State *s)
-{
- Entity *c = checkCharacter(s, 1);
- int skill = checkSkill(s, 2);
- const int exp = luaL_checkint(s, 3);
- const int optimalLevel = luaL_optint(s, 4, 0);
-
- c->getComponent<CharacterComponent>()->receiveExperience(skill, exp,
- optimalLevel);
- return 0;
-}
-
-/** LUA xp_for_level (being)
- * xp_for_level(int level)
- **
- * **Return value:** Returns the total experience necessary (counted from
- * level 0) for reaching `level` in any skill.
- */
-static int xp_for_level(lua_State *s)
-{
- const int level = luaL_checkint(s, 1);
- lua_pushinteger(s, CharacterComponent::expForLevel(level));
- return 1;
-}
-
/** LUA entity:add_hit_taken (being)
* add_hit_taken(int damage)
**
@@ -3374,7 +3285,6 @@ LuaScript::LuaScript():
{ "getvar_world", getvar_world },
{ "setvar_world", setvar_world },
{ "chr_get_post", chr_get_post },
- { "xp_for_level", xp_for_level },
{ "monster_create", monster_create },
{ "trigger_create", trigger_create },
{ "get_beings_in_circle", get_beings_in_circle },
@@ -3442,9 +3352,6 @@ LuaScript::LuaScript():
{ "remove_attribute_modifier", entity_remove_attribute_modifier },
{ "gender", entity_get_gender },
{ "set_gender", entity_set_gender },
- { "level", entity_get_level },
- { "xp", entity_get_xp },
- { "give_xp", entity_give_xp },
{ "hair_color", entity_get_hair_color },
{ "set_hair_color", entity_set_hair_color },
{ "hair_style", entity_get_hair_style },
diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp
index 8d166469..c9738694 100644
--- a/src/scripting/luautil.cpp
+++ b/src/scripting/luautil.cpp
@@ -28,7 +28,6 @@
#include "game-server/monster.h"
#include "game-server/monstermanager.h"
#include "game-server/npc.h"
-#include "game-server/skillmanager.h"
#include "utils/logger.h"
@@ -215,16 +214,6 @@ Entity *checkNpc(lua_State *s, int p)
return entity;
}
-int checkSkill(lua_State *s, int p)
-{
- if (lua_isnumber(s, p))
- return luaL_checkint(s, p);
-
- int id = skillManager->getId(luaL_checkstring(s, p));
- luaL_argcheck(s, id != 0, p, "invalid skill name");
- return id;
-}
-
AbilityManager::AbilityInfo *checkAbility(lua_State *s, int p)
{
AbilityManager::AbilityInfo *abilityInfo;
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h
index fc198310..220d4c2f 100644
--- a/src/scripting/luautil.h
+++ b/src/scripting/luautil.h
@@ -178,7 +178,6 @@ ItemClass * checkItemClass(lua_State *s, int p);
Entity * checkMonster(lua_State *s, int p);
MonsterClass * checkMonsterClass(lua_State *s, int p);
Entity * checkNpc(lua_State *s, int p);
-int checkSkill(lua_State *s, int p);
AbilityManager::AbilityInfo * checkAbility(lua_State *s, int p);
const AttributeManager::AttributeInfo *checkAttribute(lua_State *s, int p);
unsigned char checkWalkMask(lua_State *s, int p);