diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 0161fbaa79..188f7b03c8 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6615,7 +6615,7 @@ ACMD_FUNC(npctalk) strtok(name, "#"); // discard extra name identifier if present snprintf(temp, sizeof(temp), "%s : %s", name, mes); - if(ifcolor) clif_messagecolor(&nd->bl,color,temp); + if(ifcolor) clif_messagecolor(&nd->bl,color,temp,true,AREA_CHAT_WOC); else clif_disp_overhead(&nd->bl, temp); return 0; @@ -8404,7 +8404,7 @@ ACMD_FUNC(cash) // If this option is set, the message is already sent by pc function if( !battle_config.cashshop_show_points ){ sprintf(output, msg_txt(sd,505), ret, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } } else clif_displaymessage(fd, msg_txt(sd,149)); // Unable to decrease the number/value. @@ -8415,7 +8415,7 @@ ACMD_FUNC(cash) // If this option is set, the message is already sent by pc function if( !battle_config.cashshop_show_points ){ sprintf(output, msg_txt(sd,410), ret, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } } else clif_displaymessage(fd, msg_txt(sd,41)); // Unable to decrease the number/value. @@ -8426,13 +8426,13 @@ ACMD_FUNC(cash) if( value > 0 ) { if( (ret=pc_getcash(sd, 0, value, LOG_TYPE_COMMAND)) >= 0){ sprintf(output, msg_txt(sd,506), ret, sd->kafraPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } else clif_displaymessage(fd, msg_txt(sd,149)); // Unable to decrease the number/value. } else { if( (ret=pc_paycash(sd, -value, -value, LOG_TYPE_COMMAND)) >= 0){ sprintf(output, msg_txt(sd,411), ret, sd->kafraPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } else clif_displaymessage(fd, msg_txt(sd,41)); // Unable to decrease the number/value. } @@ -8528,7 +8528,7 @@ ACMD_FUNC(request) sprintf(atcmd_output, msg_txt(sd,278), message); // (@request): %s intif_wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output); - clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], atcmd_output, false, SELF); clif_displaymessage(sd->fd,msg_txt(sd,279)); // @request sent. return 0; } @@ -8552,7 +8552,7 @@ ACMD_FUNC(auction) nullpo_ret(sd); if (!battle_config.feature_auction) { - clif_colormes(sd->fd, color_table[COLOR_RED], msg_txt(sd, 517)); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 517), false, SELF); return 0; } diff --git a/src/map/channel.c b/src/map/channel.c index 04c81ef2a2..ee90127241 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -168,7 +168,7 @@ int channel_mjoin(struct map_session_data *sd) { if( !( map[sd->bl.m].channel->opt & CHAN_OPT_ANNOUNCE_JOIN ) ) { char mout[60]; sprintf(mout, msg_txt(sd,1435),channel_config.map_chname,map[sd->bl.m].name); // You're now in the '#%s' channel for '%s'. - clif_disp_onlyself(sd, mout, strlen(mout)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], mout, false, SELF); } return channel_join(map[sd->bl.m].channel,sd); @@ -339,7 +339,7 @@ int channel_send(struct Channel *channel, struct map_session_data *sd, const cha return -1; if(!pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && channel->msg_delay != 0 && DIFF_TICK(sd->channel_tick + ( channel->msg_delay * 1000 ), gettick()) > 0) { - clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1455)); //You're talking too fast! + clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1455),false,SELF); //You're talking too fast! return -2; } else { @@ -483,7 +483,7 @@ int channel_display_list(struct map_session_data *sd, char *options){ for( k = 0; k < channel_config.colors_count; k++ ) { if (channel_config.colors[k]) { sprintf(msg, msg_txt(sd,1445),channel_config.colors_name[k]);// - '%s' - clif_colormes(sd->fd,channel_config.colors[k],msg); + clif_messagecolor(&sd->bl,channel_config.colors[k],msg,false,SELF); } } } diff --git a/src/map/clif.c b/src/map/clif.c index 28272a197a..14e3c8e893 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -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 .W .L .L .?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 .W .L .L .?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; /** diff --git a/src/map/clif.h b/src/map/clif.h index 278227e169..e3f8ad6cf8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -779,7 +779,6 @@ void clif_font(struct map_session_data *sd); // atcommand void clif_displaymessage(const int fd, const char* mes); -void clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len); void clif_disp_message(struct block_list* src, const char* mes, int len, enum send_target target); void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, enum send_target target); void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target); @@ -811,8 +810,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_messagecolor(struct block_list* bl, unsigned long color, const char* msg); // Mob/Npc color talk [SnakeDrak] -void clif_messagecolor2(struct map_session_data *sd, unsigned long color, const char* msg); // Use for dispcolor [Napster] +void clif_messagecolor(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type); // Mob/Npc color talk [SnakeDrak] void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target); void clif_GM_kickack(struct map_session_data *sd, int id); @@ -994,10 +992,10 @@ enum clif_colors { COLOR_WHITE, COLOR_YELLOW, COLOR_CYAN, + COLOR_LIGHT_GREEN, COLOR_MAX }; unsigned long color_table[COLOR_MAX]; -int clif_colormes(int fd, unsigned long color, const char* msg); void clif_channel_msg(struct Channel *channel, struct map_session_data *sd, char *msg, short color); diff --git a/src/map/duel.c b/src/map/duel.c index a87338cc91..d1bac173f6 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -61,7 +61,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va) if (sd->duel_group != ssd->duel_group) return 0; sprintf(output, " %d. %s", ++(*p), sd->status.name); - clif_disp_onlyself(ssd, output, strlen(output)); + clif_messagecolor(&ssd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); return 1; } @@ -86,7 +86,7 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd) duel_list[did].members_count, duel_list[did].members_count + duel_list[did].invites_count); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); map_foreachpc(duel_showinfo_sub, sd, &p); } @@ -128,7 +128,7 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl) duel_list[i].max_players_limit = maxpl; strcpy(output, msg_txt(sd,372)); // " -- Duel has been created (@invite/@leave) --" - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); clif_map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); //clif_misceffect2(&sd->bl, 159); diff --git a/src/map/homunculus.c b/src/map/homunculus.c index c3de36d98b..0157916dfb 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -526,7 +526,7 @@ int hom_levelup(struct homun_data *hd) growth_max_hp, growth_max_sp, growth_str/10.0, growth_agi/10.0, growth_vit/10.0, growth_int/10.0, growth_dex/10.0, growth_luk/10.0); - clif_disp_onlyself(hd->master,output,strlen(output)); + clif_messagecolor(&hd->master->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return 1; } diff --git a/src/map/intif.c b/src/map/intif.c index d0d18c07de..8621beb9c8 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2137,7 +2137,7 @@ int intif_parse_Mail_inboxreceived(int fd) { char output[128]; sprintf(output, msg_txt(sd,510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return 1; } diff --git a/src/map/mob.c b/src/map/mob.c index ae544719c2..2ca0fed01e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -517,7 +517,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 ) { sprintf(output, "[KS Warning!! - Owner : %s]", pl_sd->status.name); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); sd->ks_floodprotect_tick = tick + 2000; } @@ -526,7 +526,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) if( DIFF_TICK(pl_sd->ks_floodprotect_tick, tick) <= 0 ) { sprintf(output, "[Watch out! %s is trying to KS you!]", sd->status.name); - clif_disp_onlyself(pl_sd, output, strlen(output)); + clif_messagecolor(&pl_sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); pl_sd->ks_floodprotect_tick = tick + 2000; } @@ -3588,7 +3588,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) snprintf(name, sizeof name,"%s", md->name); strtok(name, "#"); // discard extra name identifier if present [Daegaladh] snprintf(temp, sizeof temp,"%s : %s", name, mc->msg); - clif_messagecolor(&md->bl, mc->color, temp); + clif_messagecolor(&md->bl, mc->color, temp, true, AREA_CHAT_WOC); } if(!(battle_config.mob_ai&0x200)) { //pass on delay to same skill. for (j = 0; j < md->db->maxskill; j++) diff --git a/src/map/npc.c b/src/map/npc.c index 3ae633872d..6dcc1bb8cc 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1276,7 +1276,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd) } if (i == nd->u.shop.count) { - clif_colormes(sd->fd, color_table[COLOR_RED], msg_txt(sd, 534)); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 534), false, SELF); return false; } @@ -1405,7 +1405,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int memset(output, '\0', sizeof(output)); sprintf(output, msg_txt(sd, 712), (id) ? id->jname : "NULL", (id) ? id->nameid : 0); // You do not have enough %s (%hu). - clif_colormes(sd->fd, color_table[COLOR_RED], output); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF); return ERROR_TYPE_PURCHASE_FAIL; } if (id) @@ -1422,12 +1422,12 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int if (cost[0] < (price - points)) { sprintf(output, msg_txt(sd, 713), nd->u.shop.pointshop_str); // You do not have enough '%s'. - clif_colormes(sd->fd, color_table[COLOR_RED], output); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF); return ERROR_TYPE_PURCHASE_FAIL; } pc_setreg2(sd, nd->u.shop.pointshop_str, cost[0] - (price - points)); sprintf(output, msg_txt(sd, 716), nd->u.shop.pointshop_str, cost[0] - (price - points)); // Your '%s' is now: %d - clif_disp_onlyself(sd, output, strlen(output) + 1); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } break; } diff --git a/src/map/pc.c b/src/map/pc.c index 7c939f0fa1..ce2c24c335 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1234,7 +1234,7 @@ bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_ // Message of the Day [Valaris] for(i=0; i < MOTD_LINE_SIZE && motd_text[i][0]; i++) { if (battle_config.motd_type) - clif_disp_onlyself(sd,motd_text[i],strlen(motd_text[i])); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], motd_text[i], false, SELF); else clif_displaymessage(sd->fd, motd_text[i]); } @@ -4261,7 +4261,7 @@ char pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type if( zeny > 0 && sd->state.showzeny ) { char output[255]; sprintf(output, "Removed %dz.", zeny); - clif_disp_onlyself(sd,output,strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return 0; @@ -4296,7 +4296,7 @@ char pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type if( zeny > 0 && sd->state.showzeny ) { char output[255]; sprintf(output, "Gained %dz.", zeny); - clif_disp_onlyself(sd,output,strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return 0; @@ -4350,7 +4350,7 @@ int pc_paycash(struct map_session_data *sd, int price, int points, e_log_pick_ty char output[CHAT_SIZE_MAX]; sprintf(output, msg_txt(sd,504), points, cash, sd->kafraPoints, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return cash+points; } @@ -4387,7 +4387,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_typ if( battle_config.cashshop_show_points ) { sprintf(output, msg_txt(sd,505), cash, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return cash; } @@ -4413,7 +4413,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_typ if( battle_config.cashshop_show_points ) { sprintf(output, msg_txt(sd,506), points, sd->kafraPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } return points; } @@ -4739,7 +4739,7 @@ bool pc_isUseitem(struct map_session_data *sd,int n) } if (sd->state.storage_flag && item->type != IT_CASH) { - clif_colormes(sd->fd, color_table[COLOR_RED], msg_txt(sd,388)); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd,388), false, SELF); return false; // You cannot use this item while storage is open. } @@ -4833,7 +4833,7 @@ bool pc_isUseitem(struct map_session_data *sd,int n) return false; } if( !pc_inventoryblank(sd) ) { - clif_colormes(sd->fd, color_table[COLOR_RED], msg_txt(sd, 732)); //Item cannot be open when inventory is full + clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 732), false, SELF); //Item cannot be open when inventory is full return false; } } @@ -6525,7 +6525,7 @@ void pc_gainexp_disp(struct map_session_data *sd, unsigned int base_exp, unsigne (lost) ? msg_txt(sd,742) : msg_txt(sd,741), (long)base_exp * (lost ? -1 : 1), (base_exp / (float)next_base_exp * 100 * (lost ? -1 : 1)), (long)job_exp * (lost ? -1 : 1), (job_exp / (float)next_job_exp * 100 * (lost ? -1 : 1))); - clif_disp_onlyself(sd, output, strlen(output)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); } /** @@ -11332,7 +11332,7 @@ uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, unsigned else sprintf(e_msg,msg_txt(sd,380), // Item Failed. [%s] is cooling down. Wait %d seconds. itemdb_jname(sd->item_delay[i].nameid), e_tick+1); - clif_colormes(sd->fd,color_table[COLOR_YELLOW],e_msg); + clif_messagecolor(&sd->bl,color_table[COLOR_YELLOW],e_msg,false,SELF); return 1; // Delay has not expired yet } } else {// not yet used item (all slots are initially empty) @@ -11599,7 +11599,7 @@ enum e_BANKING_WITHDRAW_ACK pc_bank_withdraw(struct map_session_data *sd, int mo return BWA_NO_MONEY; } else if ( limit_check > MAX_ZENY ) { /* no official response for this scenario exists. */ - clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1495)); //You can't withdraw that much money + clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1495),false,SELF); //You can't withdraw that much money return BWA_UNKNOWN_ERROR; } diff --git a/src/map/script.c b/src/map/script.c index 5de759500b..fdffd4f56e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14106,9 +14106,9 @@ BUILDIN_FUNC(dispbottom) if(sd) { if (script_hasdata(st,3)) - clif_messagecolor2(sd, color, message); // [Napster] + clif_messagecolor(&sd->bl, color, message, true, SELF); // [Napster] else - clif_disp_onlyself(sd, message, (int)strlen(message)); + clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], message, false, SELF); } return SCRIPT_CMD_SUCCESS; } @@ -16326,7 +16326,7 @@ BUILDIN_FUNC(callshop) } if (i == nd->u.shop.count) { - clif_colormes(sd->fd, color_table[COLOR_RED], msg_txt(sd, 534)); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 534), false, SELF); return SCRIPT_CMD_FAILURE; } @@ -18263,7 +18263,7 @@ BUILDIN_FUNC(openauction) return SCRIPT_CMD_FAILURE; if( !battle_config.feature_auction ) { - clif_colormes(sd->fd, color_table[COLOR_RED], msg_txt(sd, 517)); + clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 517), false, SELF); return SCRIPT_CMD_SUCCESS; } diff --git a/src/map/skill.c b/src/map/skill.c index 7533225812..29df38c80f 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -10615,7 +10615,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(hd->master && hd->sc.data[SC_STYLE_CHANGE]) { char output[128]; safesnprintf(output,sizeof(output),msg_txt(sd,378),(sce->val1==MH_MD_FIGHTING?"fighthing":"grappling")); - clif_colormes(hd->master->fd, color_table[COLOR_RED], output); + clif_messagecolor(&hd->master->bl, color_table[COLOR_RED], output, false, SELF); } } else sc_start(&hd->bl,&hd->bl, SC_STYLE_CHANGE, 100, MH_MD_FIGHTING, -1); @@ -15322,7 +15322,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i char output[128]; sprintf(output,"%s",msg_txt(sd,382)); // You're too close to a stone or emperium to use this skill. - clif_colormes(sd->fd,color_table[COLOR_RED], output); + clif_messagecolor(&sd->bl,color_table[COLOR_RED], output, false, SELF); return false; } } @@ -15715,7 +15715,7 @@ bool skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, skill_get_desc(skill_id), require.ammo_qty, itemdb_jname(sd->inventory.u.items_inventory[i].nameid)); - clif_colormes(sd->fd,color_table[COLOR_RED],e_msg); + clif_messagecolor(&sd->bl,color_table[COLOR_RED],e_msg,false,SELF); return false; } if (!(require.ammo&1<inventory_data[i]->look)) { //Ammo type check. Send the "wrong weapon type" message @@ -15746,7 +15746,7 @@ bool skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, //Official is using msgstringtable.txt for each requirement failure //clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); sprintf(output, msg_txt(sd,720), itemdb_jname(require.itemid[i])); // %s is required. - clif_colormes(sd->fd,color_table[COLOR_RED],output); + clif_messagecolor(&sd->bl,color_table[COLOR_RED],output,false,SELF); } return false; } @@ -19422,7 +19422,7 @@ int skill_poisoningweapon(struct map_session_data *sd, unsigned short nameid) type, chance, val4, skill_get_time(GC_POISONINGWEAPON, sd->menuskill_val)); sprintf(output, msg_txt(sd,721), msg); - clif_colormes(sd->fd,color_table[COLOR_WHITE],output); + clif_messagecolor(&sd->bl,color_table[COLOR_WHITE],output,false,SELF); /*#if PACKETVER >= 20110208 //! TODO: Check the correct PACKVETVER clif_msg(sd,msg); diff --git a/src/map/vending.c b/src/map/vending.c index d8cb623551..997d46dbf9 100755 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -225,7 +225,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui if( battle_config.buyer_name ) { char temp[256]; sprintf(temp, msg_txt(sd,265), sd->status.name); - clif_disp_onlyself(vsd,temp,strlen(temp)); + clif_messagecolor(&vsd->bl, color_table[COLOR_LIGHT_GREEN], temp, false, SELF); } }