summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/atcommand.c29
-rw-r--r--src/map/atcommand.h4
-rw-r--r--src/map/init.c2
3 files changed, 35 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 7f4c779..cd972ad 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -12,7 +12,10 @@
#include "../../../common/strlib.h"
#include "../../../common/timer.h"
#include "../../../map/atcommand.h"
+#include "../../../map/clif.h"
#include "../../../map/map.h"
+#include "../../../map/pc.h"
+#include "../../../map/skill.h"
#include "map/atcommand.h"
#include "map/lang.h"
@@ -53,3 +56,29 @@ const char* eatcommand_msgfd(int *fdPtr, int *msgPtr)
hookStop();
return lang_pctrans(atcommand->msg_table[0][msg_number], sd);
}
+
+ACMD2(setSkill)
+{
+ int skill_id = 0;
+ int skill_level = 0;
+
+ if (!message || !*message || sscanf(message, "%5d %2d", &skill_id, &skill_level) < 2)
+ {
+ const char* text = info->help;
+
+ if (text)
+ clif->messageln (fd, text);
+
+ return false;
+ }
+ if (!skill->get_index(skill_id))
+ {
+ clif->message(fd, msg_fd(fd,198)); // This skill number doesn't exist.
+ return false;
+ }
+
+ pc->skill(sd, skill_id, skill_level, 0);
+ clif->message(fd, msg_fd(fd,70)); // You have learned the skill.
+
+ return true;
+}
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index bc3243a..ab970c6 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -7,4 +7,8 @@
const char* eatcommand_msgsd(struct map_session_data *sd, int *msgPtr);
const char* eatcommand_msgfd(int *fdPtr, int *msgPtr);
+#define ACMD2(x) bool atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command __attribute__ ((unused)), const char* message, struct AtCommandInfo *info)
+
+ACMD2(setSkill);
+
#endif // EVOL_MAP_ATCOMMAND
diff --git a/src/map/init.c b/src/map/init.c
index e2834ca..a9cc312 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -68,6 +68,8 @@ HPExport void plugin_init (void)
{
// HPM_map_add_group_permission = GET_SYMBOL("addGroupPermission");
+ addAtcommand("setskill", setSkill);
+
addScriptCommand("setcamnpc", "*", setCamNpc);
addScriptCommand("setcam", "ii", setCam);
addScriptCommand("movecam", "ii", moveCam);