Add mapflag specialpopup (#8365)

* Add packet ZC_SPECIALPOPUP.
* Add mapflag and script command specialpopup.
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Co-authored-by: Atemo <Atemo@users.noreply.github.com>
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
eppc0330 2024-08-01 22:05:54 +09:00 committed by GitHub
parent 612bf702ba
commit 54dc915661
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 125 additions and 0 deletions

View File

@ -474,3 +474,9 @@ Hides monster's HP bar on a map.
Ignores config value of 'monster_hp_bars_info'.
---------------------------------------
*specialpopup <popup ID>
Displays a special popup when a player enters the map. See script command "specialpopup" for details on different popup types.
---------------------------------------

View File

@ -8508,6 +8508,15 @@ Opens the tip box UI for the attached player or the given character ID.
This command requires packet version 2017-11-22 or newer.
---------------------------------------
*specialpopup(<popup ID>);
Open popup and/or show text by ID from list defined in the client spopup.lub file.
Popup and text is only visible if the player warped from one map to another map.
This command requires packet version 2022-10-05 or newer.
---------------------------------------
\\
6,1.- Unit-related commands

View File

@ -0,0 +1,50 @@
//===== rAthena Script =======================================
//= Mapflag: special popup map setting.
//===== Description: =========================================
//= Displays a special popup when a player enters the map.
//===== Additional Comments: =================================
//= 1.0 Initial script. [eppc0330]
//============================================================
herosria mapflag specialpopup 1
hero_in1 mapflag specialpopup 1
hero_in2 mapflag specialpopup 1
hero_in3 mapflag specialpopup 1
hero_in4 mapflag specialpopup 1
hero_out1 mapflag specialpopup 1
hero_out2 mapflag specialpopup 1
hero_out3 mapflag specialpopup 1
hero_out4 mapflag specialpopup 1
hero_ent1 mapflag specialpopup 1
hero_ent2 mapflag specialpopup 1
hero_ent3 mapflag specialpopup 1
hero_tra mapflag specialpopup 2
hero_dun1 mapflag specialpopup 2
bl_ice mapflag specialpopup 3
bl_lava mapflag specialpopup 3
bl_grass mapflag specialpopup 3
bl_death mapflag specialpopup 3
bl_soul mapflag specialpopup 3
bl_venom mapflag specialpopup 3
bl_temple mapflag specialpopup 3
thana_step mapflag specialpopup 4
tha_t07 mapflag specialpopup 4
tha_t08 mapflag specialpopup 4
tha_t09 mapflag specialpopup 4
tha_t10 mapflag specialpopup 4
tha_t11 mapflag specialpopup 4
tha_t12 mapflag specialpopup 4
ama_dun01 mapflag specialpopup 5
lhz_dun_n mapflag specialpopup 6
bl_depth1 mapflag specialpopup 7
for_dun01 mapflag specialpopup 8
for_dun02 mapflag specialpopup 8
bl_depth2 mapflag specialpopup 9

View File

@ -22,3 +22,4 @@ npc: npc/re/mapflag/town.txt
npc: npc/re/mapflag/reset.txt
npc: npc/re/mapflag/skill_duration.txt
npc: npc/re/mapflag/nodynamicnpc.txt
npc: npc/re/mapflag/specialpopup.txt

View File

@ -19713,6 +19713,12 @@ static void clif_loadConfirm( map_session_data *sd ){
/// 0447
void clif_parse_blocking_playcancel( int fd, map_session_data *sd ){
clif_loadConfirm( sd );
int32 mf = map_getmapflag(sd->bl.m, MF_SPECIALPOPUP);
if (mf > 0) {
clif_specialpopup(*sd, mf);
}
}
/// req world info (CZ_CLIENT_VERSION)
@ -25119,6 +25125,20 @@ void clif_set_npc_window_pos_percent(map_session_data& sd, int x, int y)
#endif // PACKETVER_MAIN_NUM >= 20220504
}
/// Displays a special popup.
/// Works only if player moved from one map to another.
/// 0bbe <popup id>.L (ZC_SPECIALPOPUP)
void clif_specialpopup(map_session_data& sd, int32 id ){
#if PACKETVER >= 20221005
PACKET_ZC_SPECIALPOPUP p = {};
p.PacketType = HEADER_ZC_SPECIALPOPUP;
p.ppId = id;
clif_send( &p, sizeof( p ), &sd.bl, SELF);
#endif
}
/*==========================================
* Main client packet processing function
*------------------------------------------*/

View File

@ -1456,4 +1456,6 @@ void clif_set_npc_window_pos_percent(map_session_data& sd, int x, int y);
void clif_noask_sub( map_session_data& sd, map_session_data& tsd, int type );
void clif_specialpopup(map_session_data& sd, int32 id);
#endif /* CLIF_HPP */

View File

@ -4785,6 +4785,14 @@ bool map_setmapflag_sub(int16 m, enum e_mapflag mapflag, bool status, union u_ma
mapdata->setMapFlag(MF_NOBASEEXP, false);
ShowWarning("map_setmapflag: Unable to set No Base EXP and BEXP flags for the same map! Removing No Base EXP flag from %s.\n", mapdata->name);
}
mapdata->setMapFlag(mapflag, args->flag_val);
} else
mapdata->setMapFlag(mapflag, false);
break;
case MF_SPECIALPOPUP:
if (status) {
nullpo_retr(false, args);
mapdata->setMapFlag(mapflag, args->flag_val);
} else
mapdata->setMapFlag(mapflag, false);

View File

@ -676,6 +676,7 @@ enum e_mapflag : int16 {
MF_NOBUYINGSTORE,
MF_NODYNAMICNPC,
MF_NOBANK,
MF_SPECIALPOPUP,
MF_MAX
};

View File

@ -5507,6 +5507,16 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
map_setmapflag_sub(m, mapflag, state, &args);
}
break;
case MF_SPECIALPOPUP: {
union u_mapflag_args args = {};
if (sscanf(w4, "%11d", &args.flag_val) < 1)
args.flag_val = 0;
map_setmapflag_sub(m, mapflag, state, &args);
}
break;
case MF_SKILL_DAMAGE: {
char skill_name[SKILL_NAME_LENGTH];

View File

@ -27234,6 +27234,22 @@ BUILDIN_FUNC(opentips){
#endif
}
/**
* Displays a special popup.
* specialpopup(<popup id>);
*/
BUILDIN_FUNC(specialpopup) {
map_session_data* sd;
if( !script_rid2sd(sd) )
return SCRIPT_CMD_FAILURE;
int32 id = script_getnum(st,2);
clif_specialpopup(*sd, id);
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC(setdialogalign){
map_session_data *sd;
@ -28143,6 +28159,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(has_autoloot,"?"),
BUILDIN_DEF(autoloot,"??"),
BUILDIN_DEF(opentips, "i?"),
BUILDIN_DEF(specialpopup,"i"),
BUILDIN_DEF(setdialogalign, "i"),
BUILDIN_DEF(setdialogsize, "ii"),

View File

@ -538,6 +538,7 @@
export_constant(MF_NOBUYINGSTORE);
export_constant(MF_NODYNAMICNPC);
export_constant(MF_NOBANK);
export_constant(MF_SPECIALPOPUP);
/* setcell types */
export_constant(CELL_WALKABLE);