Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/pandas_script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3378,4 +3378,13 @@ NPC名称:
否则由于动态生成魔物的影响, 必须在 BOSS 所在地图有玩家前往一次之后,
才能看到查询到那张地图的 BOSS 魔物信息.

--------------------------------------------------------------

*getmobmapinfo <gid>{,<time>};

在小地图上显示gid的BOSS雷达图标

返回值:
该指令无论成功与否, 都不会有返回值

--------------------------------------------------------------
4 changes: 4 additions & 0 deletions src/config/pandas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2187,6 +2187,10 @@
//
// 更多详细用法请移步 doc/pandas_script_commands.txt 文件
#define Pandas_ScriptCommand_GetInventoryList

// 是否启用 getmobmapinfo 脚本指令 [维护者昵称]
// TODO: 请在此填写此脚本指令的说明
#define Pandas_ScriptCommand_getmobmapinfo
// PYHELP - SCRIPTCMD - INSERT POINT - <Section 1>
#endif // Pandas_ScriptCommands

Expand Down
42 changes: 42 additions & 0 deletions src/map/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32581,6 +32581,45 @@ BUILDIN_FUNC(whodropitem) {
}
#endif // Pandas_ScriptCommand_WhoDropItem

#ifdef Pandas_ScriptCommand_getmobmapinfo
/* ===========================================================
* 指令: getmobmapinfo
* 描述: 在小地图上显示gid的BOSS雷达图标
* 用法: getmobmapinfo <gid>{,<time>};
* 返回: 无
* 作者: 聽風
* -----------------------------------------------------------*/
BUILDIN_FUNC(getmobmapinfo) {
int gid = script_getnum(st, 2);
block_list* bl = map_id2bl(gid);
block_list* tbl = map_id2bl(st->rid);
struct map_session_data* sd;
int tick, val1 = 0;

if (!script_rid2sd(sd))
return SCRIPT_CMD_SUCCESS;

if (bl == nullptr) {
ShowWarning("buildin_getmobmapinfo: Unable to find object with given game ID %d!\n", gid);
return SCRIPT_CMD_FAILURE;
}

if (script_hasdata(st, 3))
tick = script_getnum(st, 3);
else
tick = 600000;

struct mob_data* md = (struct mob_data*)bl;
if (md == nullptr)
return SCRIPT_CMD_FAILURE;

val1 = md->bl.id;
status_change_start(tbl, tbl, (sc_type)SC_BOSSMAPINFO, 10000, val1, 0, 2, 0, tick, SCSTART_NOAVOID);

return SCRIPT_CMD_SUCCESS;
}
#endif // Pandas_ScriptCommand_getmobmapinfo

// PYHELP - SCRIPTCMD - INSERT POINT - <Section 2>

/// script command definitions
Expand Down Expand Up @@ -33556,6 +33595,9 @@ struct script_function buildin_func[] = {
#ifdef Pandas_ScriptCommand_WhoDropItem
BUILDIN_DEF(whodropitem,"v??"), // 查询指定道具会从哪些魔物身上掉落以及掉落的机率信息 [Sola丶小克]
#endif // Pandas_ScriptCommand_WhoDropItem
#ifdef Pandas_ScriptCommand_getmobmapinfo
BUILDIN_DEF(getmobmapinfo,"i?"), // 在小地图上显示gid的BOSS雷达图标 [聽風]
#endif // Pandas_ScriptCommand_getmobmapinfo
// PYHELP - SCRIPTCMD - INSERT POINT - <Section 3>

#include "../custom/script_def.inc"
Expand Down
27 changes: 27 additions & 0 deletions src/map/status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11307,6 +11307,17 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
break;
case SC_BOSSMAPINFO:
if( sd != NULL ) {
#ifdef Pandas_ScriptCommand_getmobmapinfo
if (val3 == 2) {
block_list* mdbl = map_id2bl(val1);
struct mob_data* mob_md = (struct mob_data*)mdbl;
clif_bossmapinfo(sd, mob_md, BOSS_INFO_ALIVE);
val1 = mob_md->bl.id;
tick_time = 1000; // [GodLesZ] tick time
val4 = tick / tick_time;
break;
}
#endif // Pandas_ScriptCommand_getmobmapinfo
struct mob_data *boss_md = map_getmob_boss(bl->m); // Search for Boss on this Map

if( boss_md == NULL ) { // No MVP on this map
Expand Down Expand Up @@ -13293,6 +13304,10 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
}
break;
case SC_BOSSMAPINFO:
#ifdef Pandas_ScriptCommand_getmobmapinfo
if (sce->val3 == 2)
break;
#endif // Pandas_ScriptCommand_getmobmapinfo
if (sd)
clif_bossmapinfo(sd, map_id2boss(sce->val1), BOSS_INFO_ALIVE_WITHMSG); // First Message
break;
Expand Down Expand Up @@ -14448,6 +14463,18 @@ TIMER_FUNC(status_change_timer){
break;

case SC_BOSSMAPINFO:
#ifdef Pandas_ScriptCommand_getmobmapinfo
if (sd && --(sce->val4) >= 0 && sce->val3 == 2) {
struct mob_data* mob_md = map_id2md(sce->val1);
if (mob_md != nullptr)
clif_bossmapinfo(sd, mob_md, BOSS_INFO_ALIVE);
else {
sce->val4 = 0;
clif_bossmapinfo_clear(sd);
status_change_end(bl, SC_BOSSMAPINFO);
}
}
#endif // Pandas_ScriptCommand_getmobmapinfo
if( sd && --(sce->val4) >= 0 ) {
struct mob_data *boss_md = map_id2boss(sce->val1);

Expand Down