Added removespecialeffect/removespecialeffect2 script commands (#6322)
* Added removespecialeffect/removespecialeffect2 script commands, follow-up #5272 thanks to @attackjom Credit to @4144 for the original work in https://github.com/HerculesWS/Hercules/pull/2226/files Thanks to @Lemongrass3110 !
This commit is contained in:
parent
acac89eeca
commit
33be829d9e
@ -5987,6 +5987,22 @@ behavior of the command.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*removespecialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
|
||||
|
||||
Work for 2018-10-02+
|
||||
This command behaves parameter same as 'specialeffect', but use for remove effect with <effect number>
|
||||
from invoking NPC.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*removespecialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
|
||||
|
||||
Work for 2018-10-02+
|
||||
This command behaves parameter same as 'specialeffect2', but use for remove effect with <effect number>
|
||||
from invoking character.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*statusup <stat>{,<char_id>};
|
||||
|
||||
This command will change a specified stat of the invoking character up by one
|
||||
|
@ -9601,6 +9601,28 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen
|
||||
}
|
||||
}
|
||||
|
||||
void clif_specialeffect_remove(struct block_list* bl_src, int effect, enum send_target e_target, struct block_list* bl_target)
|
||||
{
|
||||
#if PACKETVER >= 20181002
|
||||
nullpo_retv( bl_src );
|
||||
nullpo_retv( bl_target );
|
||||
|
||||
struct PACKET_ZC_REMOVE_EFFECT p = {};
|
||||
|
||||
p.packetType = HEADER_ZC_REMOVE_EFFECT;
|
||||
p.aid = bl_src->id;
|
||||
p.effectId = effect;
|
||||
|
||||
clif_send( &p, sizeof( struct PACKET_ZC_REMOVE_EFFECT ), bl_target, e_target );
|
||||
|
||||
if( disguised(bl_src) )
|
||||
{
|
||||
p.aid = disguised_bl_id( bl_src->id );
|
||||
clif_send( &p, sizeof( struct PACKET_ZC_REMOVE_EFFECT ), bl_src, SELF );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Monster/NPC color chat [SnakeDrak] (ZC_NPC_CHAT).
|
||||
/// 02c1 <packet len>.W <id>.L <color>.L <message>.?B
|
||||
void clif_messagecolor_target(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type, struct map_session_data *sd) {
|
||||
|
@ -886,6 +886,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat
|
||||
void clif_weather(int16 m); // [Valaris]
|
||||
void clif_specialeffect(struct block_list* bl, int type, enum send_target target); // special effects [Valaris]
|
||||
void clif_specialeffect_single(struct block_list* bl, int type, int fd);
|
||||
void clif_specialeffect_remove(struct block_list* bl_src, int effect, enum send_target e_target, struct block_list* bl_target);
|
||||
void clif_messagecolor_target(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type, struct map_session_data *sd);
|
||||
#define clif_messagecolor(bl, color, msg, rgb2bgr, type) clif_messagecolor_target(bl, color, msg, rgb2bgr, type, NULL) // Mob/Npc color talk [SnakeDrak]
|
||||
void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target);
|
||||
|
@ -264,6 +264,7 @@ DEFINE_PACKET_HEADER(ZC_ACK_COUNT_BARGAIN_SALE_ITEM, 0x9c4)
|
||||
DEFINE_PACKET_HEADER(ZC_ACK_GUILDSTORAGE_LOG, 0x9da)
|
||||
DEFINE_PACKET_HEADER(CZ_NPC_MARKET_PURCHASE, 0x9d6)
|
||||
DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM2, 0xa3d)
|
||||
DEFINE_PACKET_HEADER(ZC_REMOVE_EFFECT, 0x0b0d)
|
||||
DEFINE_PACKET_HEADER(CZ_GUILD_EMBLEM_CHANGE2, 0x0b46)
|
||||
DEFINE_PACKET_HEADER(ZC_UNCONFIRMED_SPIRITS3, 0xb73)
|
||||
|
||||
|
@ -14970,6 +14970,65 @@ BUILDIN_FUNC(specialeffect2)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
BUILDIN_FUNC(removespecialeffect)
|
||||
{
|
||||
const char* command = script_getfuncname(st);
|
||||
|
||||
#if PACKETVER < 20181002
|
||||
ShowError("buildin_%s: This command is not supported for PACKETVER older than 2018-10-02.\n", command);
|
||||
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
#endif
|
||||
|
||||
int effect = script_getnum(st, 2);
|
||||
|
||||
if (effect <= EF_NONE || effect >= EF_MAX) {
|
||||
ShowError("buildin_%s: unsupported effect id %d.\n", command, effect);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
send_target e_target = script_hasdata(st, 3) ? static_cast<send_target>(script_getnum(st, 3)) : AREA;
|
||||
|
||||
struct block_list *bl_src;
|
||||
struct block_list *bl_target;
|
||||
struct map_session_data *sd;
|
||||
|
||||
if( strcmp(command, "removespecialeffect") == 0 ) {
|
||||
if (!script_hasdata(st, 4)) {
|
||||
bl_src = map_id2bl(st->oid);
|
||||
|
||||
if (bl_src == nullptr) {
|
||||
ShowError("buildin_%s: npc not attached.\n", command);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
struct npc_data *nd = npc_name2id(script_getstr(st, 4));
|
||||
if (nd == nullptr) {
|
||||
ShowError("buildin_%s: unknown npc %s.\n", command, script_getstr(st, 4));
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
bl_src = &nd->bl;
|
||||
}
|
||||
|
||||
if (e_target != SELF)
|
||||
bl_target = bl_src;
|
||||
else {
|
||||
if (!script_rid2sd(sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
bl_target = &sd->bl;
|
||||
}
|
||||
}else{
|
||||
if (!script_nick2sd(4, sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
|
||||
bl_src = bl_target = &sd->bl;
|
||||
}
|
||||
|
||||
clif_specialeffect_remove(bl_src, effect, e_target, bl_target);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* nude({<char_id>});
|
||||
* @author [Valaris]
|
||||
@ -25695,6 +25754,8 @@ struct script_function buildin_func[] = {
|
||||
BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris]
|
||||
BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris]
|
||||
BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris]
|
||||
BUILDIN_DEF(removespecialeffect,"i??"),
|
||||
BUILDIN_DEF2(removespecialeffect,"removespecialeffect2","i??"),
|
||||
BUILDIN_DEF(nude,"?"), // nude command [Valaris]
|
||||
BUILDIN_DEF(mapwarp,"ssii??"), // Added by RoVeRT
|
||||
BUILDIN_DEF(atcommand,"s"), // [MouseJstr]
|
||||
|
Loading…
x
Reference in New Issue
Block a user