-Follow up r17313
-- fix clif_colormes, turn it into more generic function and remove duplicate equivalent, channel_colormes -- Move allow_user_color_override config into channel option. (only user owner or admin could enable/disable for chan) - Remove some hardcoded string using colormes msg_conf(378-382) - Make clif_GlobalMessage being used in clif_parse_GlobalMessage instead redeclaration. - Add some new packet (0x978,0x979) worldinfo related, thx Shaktoh git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17317 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e1313276df
commit
eaabca1f0c
@ -29,9 +29,6 @@ chsys: (
|
||||
/* (must also allow players to use @channels in groups.conf) */
|
||||
allow_user_channel_creation: true
|
||||
|
||||
/* Allow users to override a Non-Default channel color (@fontcolor) */
|
||||
allow_user_color_override: false
|
||||
|
||||
/* "map_local_channel" is an instanced channel unique to each map. */
|
||||
map_local_channel: true
|
||||
map_local_channel_name: "map"
|
||||
|
@ -350,6 +350,7 @@
|
||||
// 334: Thirty-Four Castles
|
||||
334: Total Domination
|
||||
|
||||
|
||||
// Templates for @who output
|
||||
343: Name: %s
|
||||
344: (%s)
|
||||
@ -386,7 +387,13 @@
|
||||
375: <- Player %s has left the duel --
|
||||
376: -> Player %s has accepted the duel --
|
||||
377: -- Player %s has rejected the duel --
|
||||
//378-389 free
|
||||
//etc
|
||||
378: Eleanor is now in %s mode
|
||||
379: Item Failed. [%s] is cooling down. wait %.1f minutes.
|
||||
380: Item Failed. [%s] is cooling down. wait %d seconds.
|
||||
381: Skill Failed. [%s] requires %dx %s
|
||||
382: You're too close to a stone or emperium to do this skill
|
||||
//383-389 free
|
||||
//NoAsk
|
||||
390: Autorejecting is activated.
|
||||
391: Autorejecting is deactivated.
|
||||
|
@ -1842,11 +1842,14 @@ packet_ver: 34
|
||||
0x090f,-1 // notify_newentry7
|
||||
0x914,-1 // notify_moveentry
|
||||
0x915,-1 // notify_standentry
|
||||
0x978,6,reqworldinfo,2
|
||||
0x979,50 //ackworldinfo
|
||||
0x99a,9 // take_off_equipv5
|
||||
0x997,-1 //ZC_EQUIPWIN_MICROSCOPE_V5
|
||||
0x998,8,equipitem,2:4
|
||||
0x999,11 // cz_wear_equipv5
|
||||
|
||||
|
||||
// New cashshop
|
||||
0x0844,2,cashshopopen,0
|
||||
0x084a,2,cashshopclose,0
|
||||
|
@ -335,13 +335,12 @@ 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,COLOR_RED,msg_txt(sd,1455)); //You're talking too fast!
|
||||
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1455)); //You're talking too fast!
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
char message[CHAN_MSG_LENGTH], color;
|
||||
if((channel->color && Channel_Config.color_override && sd->fontcolor)
|
||||
|| (!channel->color && sd->fontcolor))
|
||||
if((channel->opt)&CHAN_OPT_COLOR_OVERRIDE && sd->fontcolor)
|
||||
color = sd->fontcolor;
|
||||
else
|
||||
color = channel->color;
|
||||
@ -460,25 +459,6 @@ int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel){
|
||||
return k;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replication of clif_colormes but with more avaiable colors
|
||||
* return
|
||||
* 0 : all cases
|
||||
*/
|
||||
int channel_colormes(struct map_session_data *__restrict sd, uint32 channel_color, const char *__restrict msg){
|
||||
uint16 msg_len = strlen(msg) + 1;
|
||||
|
||||
WFIFOHEAD(sd->fd,msg_len + 12);
|
||||
WFIFOW(sd->fd,0) = 0x2C1;
|
||||
WFIFOW(sd->fd,2) = msg_len + 12;
|
||||
WFIFOL(sd->fd,4) = 0;
|
||||
WFIFOL(sd->fd,8) = Channel_Config.colors[channel_color];
|
||||
safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len);
|
||||
WFIFOSET(sd->fd, msg_len + 12);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display some info to user *sd on channels
|
||||
* @options :
|
||||
@ -503,7 +483,7 @@ int channel_display_list(struct map_session_data *sd, char *options){
|
||||
clif_displaymessage(sd->fd, msg_txt(sd,1444)); // ---- Available Colors ----
|
||||
for( k = 0; k < Channel_Config.colors_count; k++ ) {
|
||||
sprintf(msg, msg_txt(sd,1445),Channel_Config.colors_name[k]);// - '%s'
|
||||
channel_colormes(sd, k, msg);
|
||||
clif_colormes(sd,Channel_Config.colors[k],msg);
|
||||
}
|
||||
}
|
||||
else if( options[0] != '\0' && strcmpi(options,"mine") == 0 ) { //display chan I'm into
|
||||
@ -921,10 +901,11 @@ int channel_pcsetopt(struct map_session_data *sd, char *chname, const char *opti
|
||||
struct Channel *channel;
|
||||
char output[128];
|
||||
int k, s=0;
|
||||
const char* opt_str[3] = {
|
||||
const char* opt_str[] = {
|
||||
"None",
|
||||
"JoinAnnounce",
|
||||
"MessageDelay",
|
||||
"ColorOverride",
|
||||
};
|
||||
|
||||
if( channel_chk(chname,NULL,1) ) {
|
||||
@ -945,14 +926,14 @@ int channel_pcsetopt(struct map_session_data *sd, char *chname, const char *opti
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( option == '\0' ) {
|
||||
if(!option || option == '\0' ) {
|
||||
clif_displaymessage(sd->fd, msg_txt(sd,1446));// You need to input an option.
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = ARRAYLENGTH(opt_str);
|
||||
ARR_FIND(1,s,k,( strncmpi(option,opt_str[k],3) == 0 )); //we only cmp 3 letter atm
|
||||
if( k == 3 ) {
|
||||
if( k >= s ) {
|
||||
sprintf(output, msg_txt(sd,1447), option);// Unknown channel option '%s'.
|
||||
clif_displaymessage(sd->fd, output);
|
||||
clif_displaymessage(sd->fd, msg_txt(sd,1414));// ---- Available options:
|
||||
@ -1080,11 +1061,6 @@ void channel_read_config(void) {
|
||||
if( allow_user_channel_creation )
|
||||
Channel_Config.user_chenable = true;
|
||||
|
||||
config_setting_lookup_bool(settings, "allow_user_color_override", &allow_user_color_override);
|
||||
|
||||
if( allow_user_color_override )
|
||||
Channel_Config.color_override = true;
|
||||
|
||||
if( (colors = config_setting_get_member(settings, "colors")) != NULL ) {
|
||||
int color_count = config_setting_length(colors);
|
||||
CREATE( Channel_Config.colors, unsigned long, color_count );
|
||||
|
@ -17,6 +17,7 @@ enum Channel_Opt {
|
||||
CHAN_OPT_BASE = 0,
|
||||
CHAN_OPT_ANNOUNCE_JOIN = 1, //display message when join or leave
|
||||
CHAN_OPT_MSG_DELAY = 2,
|
||||
CHAN_OPT_COLOR_OVERRIDE = 3,
|
||||
};
|
||||
|
||||
enum Channel_Type {
|
||||
|
@ -5472,9 +5472,9 @@ void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, e
|
||||
|
||||
/*==========================================
|
||||
* Displays a message on a 'bl' to all it's nearby clients
|
||||
* Used by npc_globalmessage
|
||||
* 008d <PacketLength>.W <GID> L (ZC_NOTIFY_CHAT)
|
||||
*------------------------------------------*/
|
||||
void clif_GlobalMessage(struct block_list* bl, const char* message) {
|
||||
void clif_GlobalMessage(struct block_list* bl, const char* message, enum send_target target) {
|
||||
char buf[100];
|
||||
int len;
|
||||
nullpo_retv(bl);
|
||||
@ -5493,7 +5493,7 @@ void clif_GlobalMessage(struct block_list* bl, const char* message) {
|
||||
WBUFW(buf,2)=len+8;
|
||||
WBUFL(buf,4)=bl->id;
|
||||
safestrncpy((char *) WBUFP(buf,8),message,len);
|
||||
clif_send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT);
|
||||
clif_send((unsigned char *) buf,WBUFW(buf,2),bl,target);
|
||||
|
||||
}
|
||||
|
||||
@ -8211,14 +8211,14 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen
|
||||
}
|
||||
// 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(struct map_session_data * sd, enum clif_colors color, const char* msg) {
|
||||
int clif_colormes(struct map_session_data * sd, unsigned long color, const char* msg) {
|
||||
unsigned short msg_len = strlen(msg) + 1;
|
||||
|
||||
WFIFOHEAD(sd->fd,msg_len + 12);
|
||||
WFIFOW(sd->fd,0) = 0x2C1;
|
||||
WFIFOW(sd->fd,2) = msg_len + 12;
|
||||
WFIFOL(sd->fd,4) = 0;
|
||||
WFIFOL(sd->fd,8) = Channel_Config.colors[color];
|
||||
WFIFOL(sd->fd,8) = color; //either color_table or channel_table
|
||||
safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len);
|
||||
WFIFOSET(sd->fd, msg_len + 12);
|
||||
|
||||
@ -9681,13 +9681,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
|
||||
textlen = strlen(fakename) + 1;
|
||||
}
|
||||
// send message to others (using the send buffer for temp. storage)
|
||||
WFIFOHEAD(fd, 8 + textlen);
|
||||
WFIFOW(fd,0) = 0x8d;
|
||||
WFIFOW(fd,2) = 8 + textlen;
|
||||
WFIFOL(fd,4) = sd->bl.id;
|
||||
safestrncpy((char*)WFIFOP(fd,8), is_fake ? fakename : text, textlen);
|
||||
//FIXME: chat has range of 9 only
|
||||
clif_send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC);
|
||||
clif_GlobalMessage(&sd->bl,is_fake ? fakename : text,sd->chatID ? CHAT_WOS : AREA_CHAT_WOC);
|
||||
|
||||
// send back message to the speaker
|
||||
if( is_fake ) {
|
||||
@ -16382,6 +16376,31 @@ void clif_cashshop_result( struct map_session_data *sd, uint16 item_id, uint16 r
|
||||
WFIFOSET( sd->fd, 16 );
|
||||
}
|
||||
|
||||
/// Ack world info (ZC_ACK_BEFORE_WORLD_INFO)
|
||||
/// 0979 <world name>.24B <char name>.24B
|
||||
void clif_ackworldinfo(struct map_session_data* sd) {
|
||||
int fd;
|
||||
|
||||
nullpo_retv(sd);
|
||||
fd = sd->fd;
|
||||
|
||||
WFIFOHEAD(fd,packet_len(0x979));
|
||||
WFIFOW(fd,0)=0x979;
|
||||
//AID -> world name ?
|
||||
safestrncpy((char*)WFIFOP(fd,2), '\0' /* World name */, 24);
|
||||
safestrncpy((char*)WFIFOP(fd,26), sd->status.name, NAME_LENGTH);
|
||||
WFIFOSET(fd,packet_len(0x979));
|
||||
}
|
||||
|
||||
/// req world info (CZ_REQ_BEFORE_WORLD_INFO)
|
||||
/// 0978 <AID>.L
|
||||
void clif_parse_reqworldinfo(int fd,struct map_session_data *sd){
|
||||
//uint32 aid = RFIFOL(fd,2); //should we trust client ?
|
||||
if(sd) clif_ackworldinfo(sd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==========================================
|
||||
* Main client packet processing function
|
||||
*------------------------------------------*/
|
||||
@ -16782,7 +16801,7 @@ static int packetdb_readdb(void)
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 14, 6, 50, 0, 0, 0, 0, 0, 0,
|
||||
//#0x0980
|
||||
0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
31, 0, 0, 0, 0, 0, 0, -1, 8, 11, 9, 8, 0, 0, 0, 0,
|
||||
@ -16997,6 +17016,7 @@ static int packetdb_readdb(void)
|
||||
/* */
|
||||
{ clif_parse_MoveItem , "moveitem" },
|
||||
{ clif_parse_GuildInvite2 , "guildinvite2" },
|
||||
{ clif_parse_reqworldinfo, "reqworldinfo"},
|
||||
{NULL,NULL}
|
||||
};
|
||||
|
||||
|
@ -382,7 +382,7 @@ void clif_misceffect(struct block_list* bl,int type); // area
|
||||
void clif_changeoption(struct block_list* bl); // area
|
||||
void clif_changeoption2(struct block_list* bl); // area
|
||||
void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok); // self
|
||||
void clif_GlobalMessage(struct block_list* bl, const char* message);
|
||||
void clif_GlobalMessage(struct block_list* bl, const char* message,enum send_target target);
|
||||
void clif_createchat(struct map_session_data* sd, int flag); // self
|
||||
void clif_dispchat(struct chat_data* cd, int fd); // area or fd
|
||||
void clif_joinchatfail(struct map_session_data *sd,int flag); // self
|
||||
@ -776,7 +776,7 @@ enum clif_colors {
|
||||
COLOR_MAX
|
||||
};
|
||||
unsigned long color_table[COLOR_MAX];
|
||||
int clif_colormes(struct map_session_data * sd, enum clif_colors color, const char* msg);
|
||||
int clif_colormes(struct map_session_data * sd, unsigned long color, const char* msg);
|
||||
|
||||
void clif_channel_msg(struct Channel *channel, struct map_session_data *sd, char *msg, short color);
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ int npc_globalmessage(const char* name, const char* mes)
|
||||
return 0;
|
||||
|
||||
snprintf(temp, sizeof(temp), "%s : %s", name, mes);
|
||||
clif_GlobalMessage(&nd->bl,temp);
|
||||
clif_GlobalMessage(&nd->bl,temp,ALL_CLIENT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
10
src/map/pc.c
10
src/map/pc.c
@ -4107,7 +4107,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
|
||||
return 0;
|
||||
if( !item->script ) //if it has no script, you can't really consume it!
|
||||
return 0;
|
||||
|
||||
|
||||
if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (pc_get_group_level(sd) < item->item_usage.override) ) {
|
||||
return 0; // You cannot use this item while sitting.
|
||||
}
|
||||
@ -4319,14 +4319,14 @@ int pc_useitem(struct map_session_data *sd,int n)
|
||||
int e_tick = DIFF_TICK(sd->item_delay[i].tick, tick)/1000;
|
||||
char e_msg[100];
|
||||
if( e_tick > 99 )
|
||||
sprintf(e_msg,"Item Failed. [%s] is cooling down. wait %.1f minutes.",
|
||||
sprintf(e_msg,msg_txt(sd,379), //Item Failed. [%s] is cooling down. wait %.1f minutes.
|
||||
itemdb_jname(sd->status.inventory[n].nameid),
|
||||
(double)e_tick / 60);
|
||||
else
|
||||
sprintf(e_msg,"Item Failed. [%s] is cooling down. wait %d seconds.",
|
||||
sprintf(e_msg,msg_txt(sd,380), //Item Failed. [%s] is cooling down. wait %d seconds.
|
||||
itemdb_jname(sd->status.inventory[n].nameid),
|
||||
e_tick+1);
|
||||
clif_colormes(sd,COLOR_RED,e_msg);
|
||||
clif_colormes(sd,color_table[COLOR_RED],e_msg);
|
||||
return 0; // Delay has not expired yet
|
||||
}
|
||||
} else {// not yet used item (all slots are initially empty)
|
||||
@ -6591,7 +6591,7 @@ void pc_close_npc(struct map_session_data *sd,int flag)
|
||||
clif_clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
|
||||
sd->state.using_fake_npc = 0;
|
||||
}
|
||||
|
||||
|
||||
if (sd->st) {
|
||||
if(sd->st->state == RUN){ //wait ending code execution
|
||||
add_timer(gettick()+500,pc_close_npc_timer,sd->bl.id,flag);
|
||||
|
@ -9243,8 +9243,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
if(hd->master && hd->sc.data[SC_STYLE_CHANGE]) {
|
||||
int mode = hd->sc.data[SC_STYLE_CHANGE]->val1;
|
||||
char output[128];
|
||||
safesnprintf(output,sizeof(output),"Eleanor is now in %s mode",(sce->val1==MH_MD_FIGHTING?"fighthing":"grappling"));
|
||||
clif_colormes(hd->master,COLOR_RED,output);
|
||||
safesnprintf(output,sizeof(output),msg_txt(sd,378),(sce->val1==MH_MD_FIGHTING?"fighthing":"grappling"));
|
||||
clif_colormes(hd->master,color_table[COLOR_RED],output);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -13262,8 +13262,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
|
||||
if (map_foreachinrange(mob_count_sub, &sd->bl, skill_get_splash(skill_id, skill_lv), BL_MOB,
|
||||
MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) {
|
||||
char output[128];
|
||||
sprintf(output, "You're too close to a stone or emperium to do this skill");
|
||||
clif_colormes(sd, COLOR_RED, output);
|
||||
sprintf(output,"%s",msg_txt(sd,382)); // You're too close to a stone or emperium to do this skill
|
||||
clif_colormes(sd,color_table[COLOR_RED], output);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -13630,11 +13630,11 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
|
||||
return 0;
|
||||
} else if( sd->status.inventory[i].amount < require.ammo_qty ) {
|
||||
char e_msg[100];
|
||||
sprintf(e_msg,"Skill Failed. [%s] requires %dx %s.",
|
||||
sprintf(e_msg,msg_txt(sd,381), //Skill Failed. [%s] requires %dx %s
|
||||
skill_get_desc(skill_id),
|
||||
require.ammo_qty,
|
||||
itemdb_jname(sd->status.inventory[i].nameid));
|
||||
clif_colormes(sd,COLOR_RED,e_msg);
|
||||
clif_colormes(sd,color_table[COLOR_RED],e_msg);
|
||||
return 0;
|
||||
}
|
||||
if (!(require.ammo&1<<sd->inventory_data[i]->look)) { //Ammo type check. Send the "wrong weapon type" message
|
||||
|
Loading…
x
Reference in New Issue
Block a user