Adds pk_mode_mes displayed on joining a pk zone. (#2400)
* When pk_mode and pk_mode_mes is enabled, the player gets notified joining a pk-zone map. * It's now possible to specify the target in showscript. Default is still AREA. * pk_mode_mes is now using showscript to SELF. * Thanks to @Atemo, @RadianFord, @Lemongrass3110, @aleos89
This commit is contained in:
parent
ee552d67d4
commit
0e4ffdacdb
@ -18,6 +18,10 @@
|
||||
// config to adjust how this will affect players)
|
||||
pk_mode: 0
|
||||
|
||||
// Displays a message when the player enters a pk zone.
|
||||
// Only during pk_mode (Note 1)
|
||||
pk_mode_mes: yes
|
||||
|
||||
// Manner/karma system configuration. Specifies how does negative manner
|
||||
// (red no chat bubble) affects players (add as needed):
|
||||
// 0: No penalties.
|
||||
|
@ -423,7 +423,7 @@
|
||||
404: War of Emperium SE is currently in progress.
|
||||
405: War of Emperium SE has been ended.
|
||||
406: War of Emperium SE is currently not in progress.
|
||||
//407 free
|
||||
//407: free
|
||||
//chrif related
|
||||
408: Need disconnection to perform change-sex request...
|
||||
409: Your sex has been changed (need disconnection by the server)...
|
||||
@ -1662,5 +1662,9 @@
|
||||
1501: Spying on the %s clan.
|
||||
1502: Incorrect clan name/ID.
|
||||
|
||||
// PK Mode msgs
|
||||
1503: You've entered a PK Zone.
|
||||
1504: You've entered a PK Zone (safe until level %d).
|
||||
|
||||
//Custom translations
|
||||
//import: conf/msg_conf/import/map_msg_eng_conf.txt
|
||||
|
@ -3871,10 +3871,13 @@ by default green
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*showscript "<message>"{,<GID>};
|
||||
*showscript "<message>"{,<GID>, <flag>};
|
||||
|
||||
Makes attached player or GID says a message like shouting a skill name, the message
|
||||
will be seen to everyone around but not in chat window.
|
||||
flag: Specify target
|
||||
AREA - Message is sent to players in the vicinity of the source (default).
|
||||
SELF - Message is sent only to player attached.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
|
@ -8185,6 +8185,7 @@ static const struct _battle_data {
|
||||
{ "equip_self_break_rate", &battle_config.equip_self_break_rate, 100, 0, INT_MAX, },
|
||||
{ "equip_skill_break_rate", &battle_config.equip_skill_break_rate, 100, 0, INT_MAX, },
|
||||
{ "pk_mode", &battle_config.pk_mode, 0, 0, 2, },
|
||||
{ "pk_mode_mes", &battle_config.pk_mode_mes, 1, 0, 1, },
|
||||
{ "pk_level_range", &battle_config.pk_level_range, 0, 0, INT_MAX, },
|
||||
{ "manner_system", &battle_config.manner_system, 0xFFF, 0, 0xFFF, },
|
||||
{ "pet_equip_required", &battle_config.pet_equip_required, 0, 0, 1, },
|
||||
|
@ -349,6 +349,7 @@ extern struct Battle_Config
|
||||
int multi_level_up;
|
||||
int max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
|
||||
int pk_mode;
|
||||
int pk_mode_mes;
|
||||
int pk_level_range;
|
||||
|
||||
int manner_system; // end additions [Valaris]
|
||||
|
@ -10010,6 +10010,28 @@ static bool clif_process_message(struct map_session_data* sd, bool whisperFormat
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a message if the player enters a PK Zone (during pk_mode)
|
||||
* @param sd: Player data
|
||||
*/
|
||||
inline void clif_pk_mode_message(struct map_session_data * sd)
|
||||
{
|
||||
if (battle_config.pk_mode && battle_config.pk_mode_mes &&
|
||||
sd && map[sd->bl.m].flag.pvp) {
|
||||
if( (int)sd->status.base_level < battle_config.pk_min_level ) {
|
||||
char output[CHAT_SIZE_MAX];
|
||||
// 1504: You've entered a PK Zone (safe until level %d).
|
||||
safesnprintf(output, CHAT_SIZE_MAX, msg_txt(sd,1504),
|
||||
battle_config.pk_min_level);
|
||||
clif_showscript(&sd->bl, output, SELF);
|
||||
} else {
|
||||
// 1503: You've entered a PK Zone.
|
||||
clif_showscript(&sd->bl, msg_txt(sd,1503), SELF);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------------------
|
||||
// clif_parse_wanttoconnect
|
||||
// ---------------------
|
||||
@ -10445,6 +10467,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
|
||||
// Instances do not need their own channels
|
||||
if( channel_config.map_tmpl.name != NULL && (channel_config.map_tmpl.opt&CHAN_OPT_AUTOJOIN) && !map[sd->bl.m].flag.chmautojoin && !map[sd->bl.m].instance_id )
|
||||
channel_mjoin(sd); //join new map
|
||||
|
||||
clif_pk_mode_message(sd);
|
||||
} else if (sd->guild && (battle_config.guild_notice_changemap == 2 || guild_notice))
|
||||
clif_guild_notice(sd); // Displays at end
|
||||
|
||||
@ -18738,7 +18762,7 @@ void clif_notify_bindOnEquip(struct map_session_data *sd, int n) {
|
||||
* [Ind/Hercules]
|
||||
* 08b3 <Length>.W <id>.L <message>.?B (ZC_SHOWSCRIPT)
|
||||
**/
|
||||
void clif_showscript(struct block_list* bl, const char* message) {
|
||||
void clif_showscript(struct block_list* bl, const char* message, enum send_target flag) {
|
||||
char buf[256];
|
||||
size_t len;
|
||||
nullpo_retv(bl);
|
||||
@ -18757,7 +18781,7 @@ void clif_showscript(struct block_list* bl, const char* message) {
|
||||
WBUFW(buf,2) = (uint16)(len+8);
|
||||
WBUFL(buf,4) = bl->id;
|
||||
safestrncpy(WBUFCP(buf,8), message, len);
|
||||
clif_send((unsigned char *) buf, WBUFW(buf,2), bl, AREA);
|
||||
clif_send((unsigned char *) buf, WBUFW(buf,2), bl, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1038,7 +1038,7 @@ void clif_update_rankingpoint(struct map_session_data *sd, int rankingtype, int
|
||||
|
||||
void clif_crimson_marker(struct map_session_data *sd, struct block_list *bl, bool remove);
|
||||
|
||||
void clif_showscript(struct block_list* bl, const char* message);
|
||||
void clif_showscript(struct block_list* bl, const char* message, enum send_target flag);
|
||||
void clif_party_leaderchanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid);
|
||||
|
||||
void clif_account_name(int fd, uint32 account_id, const char* accname);
|
||||
|
@ -22083,12 +22083,16 @@ BUILDIN_FUNC(getvar) {
|
||||
|
||||
/**
|
||||
* Display script message
|
||||
* showscript "<message>"{,<GID>};
|
||||
* showscript "<message>"{,<GID>,<flag>};
|
||||
* @param flag: Specify target
|
||||
* AREA - Message is sent to players in the vicinity of the source (default).
|
||||
* SELF - Message is sent only to player attached.
|
||||
**/
|
||||
BUILDIN_FUNC(showscript) {
|
||||
struct block_list *bl = NULL;
|
||||
const char *msg = script_getstr(st,2);
|
||||
int id = 0;
|
||||
send_target target = AREA;
|
||||
|
||||
if (script_hasdata(st,3)) {
|
||||
id = script_getnum(st,3);
|
||||
@ -22104,7 +22108,15 @@ BUILDIN_FUNC(showscript) {
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
clif_showscript(bl, msg);
|
||||
if (script_hasdata(st, 4)) {
|
||||
target = static_cast<send_target>(script_getnum(st, 4));
|
||||
if (target == SELF && map_id2sd(bl->id) == NULL) {
|
||||
ShowWarning("script: showscript: self can't be used for non-players objects.\n");
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
clif_showscript(bl, msg, target);
|
||||
|
||||
script_pushint(st,1);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
@ -24189,7 +24201,7 @@ struct script_function buildin_func[] = {
|
||||
BUILDIN_DEF(npcshopupdate,"sii?"),
|
||||
BUILDIN_DEF(getattachedrid,""),
|
||||
BUILDIN_DEF(getvar,"vi"),
|
||||
BUILDIN_DEF(showscript,"s?"),
|
||||
BUILDIN_DEF(showscript,"s??"),
|
||||
BUILDIN_DEF(ignoretimeout,"i?"),
|
||||
BUILDIN_DEF(geteleminfo,"i?"),
|
||||
BUILDIN_DEF(setquestinfo_level,"iii"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user