summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/atcommand.cpp2
-rw-r--r--src/map/script.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 342f6ef..0d70b36 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -4552,6 +4552,8 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>,
static
void set_skill(dumb_ptr<map_session_data> sd, SkillID i, int level)
{
+ level = std::min(level, MAX_SKILL_LEVEL);
+ level = std::max(level, 0);
sd->status.skill[i].lv = level;
}
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 4aeb7d9..40dfc0e 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -2414,6 +2414,8 @@ void builtin_setskill(ScriptState *st)
level = conv_num(st, &AARGO2(3));
sd = script_rid2sd(st);
+ level = std::min(level, MAX_SKILL_LEVEL);
+ level = std::max(level, 0);
sd->status.skill[id].lv = level;
clif_skillinfoblock(sd);
}