summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-09-21 11:17:12 -0400
committergumi <mekolat@users.noreply.github.com>2017-09-21 18:53:26 -0400
commit0e738e87bb60700a41c21c817adf14b5a4da2639 (patch)
tree2d0ad4dc8a52a101548044ff2f66cee15b6bce08
parent7cbd35644b73f254fc976070cd1e993aa43a7cfc (diff)
downloadhercules-0e738e87bb60700a41c21c817adf14b5a4da2639.tar.gz
hercules-0e738e87bb60700a41c21c817adf14b5a4da2639.tar.bz2
hercules-0e738e87bb60700a41c21c817adf14b5a4da2639.tar.xz
hercules-0e738e87bb60700a41c21c817adf14b5a4da2639.zip
allow buildin_logmes to log to the atcommand table
-rw-r--r--src/map/script.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 533e421d8..91fa237de 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15785,19 +15785,37 @@ BUILDIN(getmapxy)
return true;
}
+enum logmes_type {
+ LOGMES_NPC,
+ LOGMES_ATCOMMAND
+};
+
/*==========================================
- * Allows player to write NPC logs (i.e. Bank NPC, etc) [Lupus]
+ * Allows player to write logs (i.e. Bank NPC, etc) [Lupus]
*------------------------------------------*/
-BUILDIN(logmes)
-{
- const char *str;
+BUILDIN(logmes) {
+ const char *str = script_getstr(st, 2);
struct map_session_data *sd = script->rid2sd(st);
+ enum logmes_type type = LOGMES_NPC;
+ nullpo_retr(sd, false);
- if (sd == NULL)
- return true;
+ if (script_hasdata(st, 3)) {
+ type = script_getnum(st, 3);
+ }
+
+ switch (type) {
+ case LOGMES_ATCOMMAND:
+ logs->atcommand(sd, str);
+ break;
+ case LOGMES_NPC:
+ logs->npc(sd, str);
+ break;
+ default:
+ ShowError("script:logmes: Unknown log type!\n");
+ st->state = END;
+ return false;
+ }
- str = script_getstr(st,2);
- logs->npc(sd,str);
return true;
}
@@ -24026,7 +24044,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(checkoption2,"i?"),
BUILDIN_DEF(guildgetexp,"i"),
BUILDIN_DEF(guildchangegm,"is"),
- BUILDIN_DEF(logmes,"s"), //this command actls as MES but rints info into LOG file either SQL/TXT [Lupus]
+ BUILDIN_DEF(logmes,"s?"), //this command actls as MES but rints info into LOG file either SQL/TXT [Lupus]
BUILDIN_DEF(summon,"si??"), // summons a slave monster [Celest]
BUILDIN_DEF(isnight,""), // check whether it is night time [Celest]
BUILDIN_DEF(isequipped,"i*"), // check whether another item/card has been equipped [Celest]
@@ -24552,6 +24570,10 @@ void script_hardcoded_constants(void)
script->set_constant("DATATYPE_VAR", DATATYPE_VAR, false, false);
script->set_constant("DATATYPE_LABEL", DATATYPE_LABEL, false, false);
+ script->constdb_comment("Logmes types");
+ script->set_constant("LOGMES_NPC", LOGMES_NPC, false, false);
+ script->set_constant("LOGMES_ATCOMMAND", LOGMES_ATCOMMAND, false, false);
+
script->constdb_comment("Item Subtypes (Weapon types)");
script->set_constant("W_FIST", W_FIST, false, false);
script->set_constant("W_DAGGER", W_DAGGER, false, false);