|
@@ -6088,7 +6088,7 @@ void clif_displaymessage(const int fd, const char* mes)
|
|
|
#if PACKETVER == 20141022
|
|
|
/** for some reason game client crashes depending on message pattern (only for this packet) **/
|
|
|
/** so we redirect to ZC_NPC_CHAT **/
|
|
|
- //clif_colormes(fd, color_table[COLOR_DEFAULT], mes);
|
|
|
+ //clif_messagecolor(&sd->bl, color_table[COLOR_DEFAULT], mes, false, SELF);
|
|
|
while(line != NULL) {
|
|
|
unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR
|
|
|
unsigned short len = strnlen(line, CHAT_SIZE_MAX);
|
|
@@ -6809,7 +6809,7 @@ void clif_parse_BankOpen(int fd, struct map_session_data* sd) {
|
|
|
//also mark something in case char ain't available for saving, should we check now ?
|
|
|
nullpo_retv(sd);
|
|
|
if( !battle_config.feature_banking ) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1496),false,SELF); //Banking is disabled
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
@@ -6849,7 +6849,7 @@ void clif_parse_BankClose(int fd, struct map_session_data* sd) {
|
|
|
|
|
|
nullpo_retv(sd);
|
|
|
if( !battle_config.feature_banking ) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1496),false,SELF); //Banking is disabled
|
|
|
//still allow to go trough to not stuck player if we have disable it while they was in
|
|
|
}
|
|
|
if(sd->status.account_id == aid){
|
|
@@ -6891,7 +6891,7 @@ void clif_parse_BankCheck(int fd, struct map_session_data* sd) {
|
|
|
nullpo_retv(sd);
|
|
|
|
|
|
if( !battle_config.feature_banking ) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1496),false,SELF); //Banking is disabled
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
@@ -6935,7 +6935,7 @@ void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK r
|
|
|
void clif_parse_BankDeposit(int fd, struct map_session_data* sd) {
|
|
|
nullpo_retv(sd);
|
|
|
if( !battle_config.feature_banking ) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1496),false,SELF); //Banking is disabled
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
@@ -6983,7 +6983,7 @@ void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK
|
|
|
void clif_parse_BankWithdraw(int fd, struct map_session_data* sd) {
|
|
|
nullpo_retv(sd);
|
|
|
if( !battle_config.feature_banking ) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1496),false,SELF); //Banking is disabled
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
@@ -8012,7 +8012,7 @@ void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) {
|
|
|
if (battle_config.mvp_exp_reward_message) {
|
|
|
char e_msg[CHAT_SIZE_MAX];
|
|
|
sprintf(e_msg, msg_txt(sd, 717), exp);
|
|
|
- clif_colormes(sd->fd, color_table[COLOR_CYAN], e_msg); // Congratulations! You are the MVP! Your reward EXP Points are %u !!
|
|
|
+ clif_messagecolor(&sd->bl, color_table[COLOR_CYAN], e_msg, false, SELF); // Congratulations! You are the MVP! Your reward EXP Points are %u !!
|
|
|
}
|
|
|
#else
|
|
|
int fd;
|
|
@@ -8892,14 +8892,6 @@ void clif_marriage_proposal(int fd, struct map_session_data *sd, struct map_sess
|
|
|
*/
|
|
|
|
|
|
|
|
|
-/*==========================================
|
|
|
- *
|
|
|
- *------------------------------------------*/
|
|
|
-void clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len)
|
|
|
-{
|
|
|
- clif_disp_message(&sd->bl, mes, len, SELF);
|
|
|
-}
|
|
|
-
|
|
|
/*==========================================
|
|
|
* Displays a message using the guild-chat colors to the specified targets. [Skotlex]
|
|
|
*------------------------------------------*/
|
|
@@ -9169,65 +9161,30 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen
|
|
|
clif_send(buf, packet_len(0x284), bl, SELF);
|
|
|
}
|
|
|
}
|
|
|
-// Modification of clif_messagecolor to send colored messages to players to chat log only (doesn't display overhead)
|
|
|
-/// 02c1 <packet len>.W <id>.L <color>.L <message>.?B
|
|
|
-int clif_colormes(int fd, unsigned long color, const char* msg) {
|
|
|
- unsigned short msg_len = (unsigned short)(strlen(msg) + 1);
|
|
|
-
|
|
|
- WFIFOHEAD(fd,msg_len + 12);
|
|
|
- WFIFOW(fd,0) = 0x2C1;
|
|
|
- WFIFOW(fd,2) = msg_len + 12;
|
|
|
- WFIFOL(fd,4) = 0;
|
|
|
- WFIFOL(fd,8) = color; //either color_table or channel_table
|
|
|
- safestrncpy(WFIFOCP(fd,12), msg, msg_len);
|
|
|
- WFIFOSET(fd, msg_len + 12);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
|
|
|
/// Monster/NPC color chat [SnakeDrak] (ZC_NPC_CHAT).
|
|
|
/// 02c1 <packet len>.W <id>.L <color>.L <message>.?B
|
|
|
-void clif_messagecolor(struct block_list* bl, unsigned long color, const char* msg) {
|
|
|
+void clif_messagecolor(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type) {
|
|
|
unsigned short msg_len = (unsigned short)(strlen(msg) + 1);
|
|
|
uint8 buf[256];
|
|
|
- color = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16; // RGB to BGR
|
|
|
|
|
|
nullpo_retv(bl);
|
|
|
|
|
|
- if( msg_len > sizeof(buf)-12 ) {
|
|
|
+ if (msg_len > sizeof(buf) - 12) {
|
|
|
ShowWarning("clif_messagecolor: Truncating too long message '%s' (len=%u).\n", msg, msg_len);
|
|
|
- msg_len = sizeof(buf)-12;
|
|
|
+ msg_len = sizeof(buf) - 12;
|
|
|
}
|
|
|
|
|
|
+ if (rgb2bgr)
|
|
|
+ color = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16; // RGB to BGR
|
|
|
+
|
|
|
WBUFW(buf,0) = 0x2C1;
|
|
|
WBUFW(buf,2) = msg_len + 12;
|
|
|
WBUFL(buf,4) = bl->id;
|
|
|
WBUFL(buf,8) = color;
|
|
|
memcpy(WBUFCP(buf,12), msg, msg_len);
|
|
|
|
|
|
- clif_send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC);
|
|
|
-}
|
|
|
-
|
|
|
-void clif_messagecolor2(struct map_session_data *sd, unsigned long color, const char* msg)
|
|
|
-{
|
|
|
- unsigned short msg_len = (unsigned short)(strlen(msg) + 1);
|
|
|
-
|
|
|
- nullpo_retv(sd);
|
|
|
-
|
|
|
- if(msg_len > 0) {
|
|
|
- int fd;
|
|
|
-
|
|
|
- color = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16; // RGB to BGR
|
|
|
-
|
|
|
- fd = sd->fd;
|
|
|
- WFIFOHEAD(fd, msg_len+12);
|
|
|
- WFIFOW(fd,0) = 0x2C1;
|
|
|
- WFIFOW(fd,2) = msg_len+12;
|
|
|
- WFIFOL(fd,4) = 0;
|
|
|
- WFIFOL(fd,8) = color;
|
|
|
- safestrncpy(WFIFOCP(fd,12), msg, msg_len);
|
|
|
- WFIFOSET(fd, WFIFOW(fd,2));
|
|
|
- }
|
|
|
+ clif_send(buf, WBUFW(buf,2), bl, type);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -11576,10 +11533,10 @@ static void clif_noask_sub(struct map_session_data *sd, struct map_session_data
|
|
|
char output[256];
|
|
|
// Your request has been rejected by autoreject option.
|
|
|
msg = msg_txt(sd,392);
|
|
|
- clif_disp_onlyself(sd, msg, strlen(msg));
|
|
|
+ clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], msg, false, SELF);
|
|
|
//Notice that a request was rejected.
|
|
|
snprintf(output, 256, msg_txt(tsd,393+type), sd->status.name, 256);
|
|
|
- clif_disp_onlyself(tsd, output, strlen(output));
|
|
|
+ clif_messagecolor(&tsd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -13296,18 +13253,18 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd){
|
|
|
return;
|
|
|
|
|
|
if(!(battle_config.emblem_woe_change) && is_agit_start() ){
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,385)); //"You not allowed to change emblem during woe"
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,385),false,SELF); //"You not allowed to change emblem during woe"
|
|
|
return;
|
|
|
}
|
|
|
emb_val = clif_validate_emblem(emblem, emblem_len);
|
|
|
if(emb_val == EMBVALIDATE_ERR_RAW_FILEFORMAT){
|
|
|
ShowWarning("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%lu, accound_id=%d, char_id=%d, guild_id=%d).\n", emblem_len, sd->status.account_id, sd->status.char_id, sd->status.guild_id);
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,386)); //"The chosen emblem was detected invalid\n"
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,386),false,SELF); //"The chosen emblem was detected invalid\n"
|
|
|
return;
|
|
|
} else if(emb_val == EMBVALIDATE_ERR_TRANSPARENCY){
|
|
|
char output[128];
|
|
|
safesnprintf(output,sizeof(output),msg_txt(sd,387),battle_config.emblem_transparency_limit);
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],output); //"The chosen emblem was detected invalid as it contain too much transparency (limit=%d)\n"
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],output,false,SELF); //"The chosen emblem was detected invalid as it contain too much transparency (limit=%d)\n"
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -14799,7 +14756,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd)
|
|
|
if( md->full ) {// TODO: is this official?
|
|
|
char output[100];
|
|
|
safesnprintf(output,sizeof(output),"Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
|
|
|
- clif_disp_onlyself(sd, output, strlen(output));
|
|
|
+ clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -18298,7 +18255,7 @@ void clif_parse_RouletteOpen(int fd, struct map_session_data* sd)
|
|
|
nullpo_retv(sd);
|
|
|
|
|
|
if (!battle_config.feature_roulette) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1497)); //Roulette is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1497),false,SELF); //Roulette is disabled
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -18328,7 +18285,7 @@ void clif_parse_RouletteInfo(int fd, struct map_session_data* sd)
|
|
|
nullpo_retv(sd);
|
|
|
|
|
|
if (!battle_config.feature_roulette) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1497)); //Roulette is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1497),false,SELF); //Roulette is disabled
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -18361,7 +18318,7 @@ void clif_parse_RouletteClose(int fd, struct map_session_data* sd)
|
|
|
nullpo_retv(sd);
|
|
|
|
|
|
if (!battle_config.feature_roulette) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1497)); //Roulette is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1497),false,SELF); //Roulette is disabled
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -18432,7 +18389,7 @@ void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd)
|
|
|
nullpo_retv(sd);
|
|
|
|
|
|
if (!battle_config.feature_roulette) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1497)); //Roulette is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1497),false,SELF); //Roulette is disabled
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -18489,7 +18446,7 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd)
|
|
|
nullpo_retv(sd);
|
|
|
|
|
|
if (!battle_config.feature_roulette) {
|
|
|
- clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1497)); //Roulette is disabled
|
|
|
+ clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1497),false,SELF); //Roulette is disabled
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -19804,6 +19761,7 @@ void do_init_clif(void) {
|
|
|
"0xFFFFFF",
|
|
|
"0xFFFF00",
|
|
|
"0x00FFFF",
|
|
|
+ "0xB5FFB5",
|
|
|
};
|
|
|
int i;
|
|
|
/**
|