diff options
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r-- | src/map/script-fun.cpp | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index a7f9fcc..010b095 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -677,6 +677,24 @@ void builtin_getelementofarray(ScriptState *st) } } +static +void builtin_wgm(ScriptState *st) +{ + ZString message = ZString(conv_str(st, &AARG(0))); + + intif_wis_message_to_gm(WISP_SERVER_NAME, + battle_config.hack_info_GM_level, + STRPRINTF("[GM] %s"_fmt, message)); +} + +static +void builtin_gmlog(ScriptState *st) +{ + dumb_ptr<map_session_data> sd = script_rid2sd(st); + ZString message = ZString(conv_str(st, &AARG(0))); + log_atcommand(sd, STRPRINTF("{SCRIPT} %s"_fmt, message)); +} + /*========================================== * *------------------------------------------ @@ -1948,20 +1966,6 @@ void builtin_resetstatus(ScriptState *st) } /*========================================== - * 性別変換 - *------------------------------------------ - */ -static -void builtin_changesex(ScriptState *st) -{ - dumb_ptr<map_session_data> sd = nullptr; - sd = script_rid2sd(st); - - chrif_char_ask_name(AccountId(), sd->status_key.name, 5, HumanTimeDiff()); // type: 5 - changesex - chrif_save(sd); -} - -/*========================================== * RIDのアタッチ *------------------------------------------ */ @@ -2140,11 +2144,22 @@ void builtin_getpvpflag(ScriptState *st) static void builtin_emotion(ScriptState *st) { - int type; - type = conv_num(st, &AARG(0)); + ZString str; + dumb_ptr<map_session_data> pl_sd = nullptr; + int type = conv_num(st, &AARG(0)); + if (HARG(1)) { + str = ZString(conv_str(st, &AARG(1))); + CharName player = stringish<CharName>(str); + pl_sd = map_nick2sd(player); + } if (type < 0 || type > 200) return; - clif_emotion(map_id2bl(st->oid), type); + if (pl_sd != nullptr) + clif_emotion_towards(map_id2bl(st->oid), pl_sd, type); + else if (st->rid && str == "self"_s) + clif_emotion(map_id2sd(st->rid), type); + else + clif_emotion(map_id2bl(st->oid), type); } static @@ -2272,11 +2287,11 @@ void builtin_getitemlink(ScriptState *st) { OMATCH_CASE_SOME (item_data) { - buf = STRPRINTF("[@@%d|%s@@]"_fmt, item_data->nameid, item_data->jname); + buf = STRPRINTF("@@%d|@@"_fmt, item_data->nameid); } OMATCH_CASE_NONE () { - buf = STRPRINTF("Unknown Item: %s"_fmt, name); + buf = "Unknown Item"_s; } } OMATCH_END (); @@ -2553,25 +2568,6 @@ void builtin_unequipbyid(ScriptState *st) } /*========================================== - * gmcommand [MouseJstr] - * - * suggested on the forums... - *------------------------------------------ - */ - -static -void builtin_gmcommand(ScriptState *st) -{ - dumb_ptr<map_session_data> sd; - - sd = script_rid2sd(st); - RString cmd = conv_str(st, &AARG(0)); - - is_atcommand(sd->sess, sd, cmd, GmLevel::from(-1U)); - -} - -/*========================================== * npcwarp [remoitnane] * Move NPC to a new position on the same map. *------------------------------------------ @@ -3125,8 +3121,9 @@ BuiltinFunction builtin_functions[] = BUILTIN(sc_end, "i"_s, '\0'), BUILTIN(sc_check, "i"_s, 'i'), BUILTIN(debugmes, "s"_s, '\0'), + BUILTIN(wgm, "s"_s, '\0'), + BUILTIN(gmlog, "s"_s, '\0'), BUILTIN(resetstatus, ""_s, '\0'), - BUILTIN(changesex, ""_s, '\0'), BUILTIN(attachrid, "i"_s, 'i'), BUILTIN(detachrid, ""_s, '\0'), BUILTIN(isloggedin, "i"_s, 'i'), @@ -3137,7 +3134,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(pvpoff, "M"_s, '\0'), BUILTIN(setpvpchannel, "i"_s, '\0'), BUILTIN(getpvpflag, "i"_s, 'i'), - BUILTIN(emotion, "i"_s, '\0'), + BUILTIN(emotion, "i?"_s, '\0'), BUILTIN(mapwarp, "MMxy"_s, '\0'), BUILTIN(mobcount, "ME"_s, 'i'), BUILTIN(marriage, "P"_s, 'i'), @@ -3156,7 +3153,6 @@ BuiltinFunction builtin_functions[] = BUILTIN(specialeffect2, "i"_s, '\0'), BUILTIN(nude, ""_s, '\0'), BUILTIN(unequipbyid, "i"_s, '\0'), - BUILTIN(gmcommand, "s"_s, '\0'), BUILTIN(npcwarp, "xys"_s, '\0'), BUILTIN(npcareawarp, "xyxyis"_s, '\0'), BUILTIN(message, "Ps"_s, '\0'), |