Corrected 'VIP' personal info notification (#1613)

* Only displayed when map-server is changed or when changing map that has different base rate with previous map's rate, should not when map changed/warped.
* Updated some packet that related with VIP and its doc.

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
This commit is contained in:
Cydh Ramdh 2016-10-14 06:04:09 +07:00 committed by GitHub
parent 8f3599b0e3
commit b2c4178209
10 changed files with 93 additions and 78 deletions

View File

@ -454,13 +454,13 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
0x2742: 0x2742:
Type: HA Type: HA
Structure: <cmd>.W <aid>.L <type>.B <timediff>.L <mapfd>.L Structure: <cmd>.W <aid>.L <flag>.B <timediff>.L <mapfd>.L
index: 0,2,6,7,11 index: 0,2,6,7,11
len: 15 len: 15
parameter: parameter:
- cmd : packet identification (0x2742) - cmd : packet identification (0x2742)
- aid: account identification - aid: account identification
- type: &1 ack vip data to char-serv, &2 add duration - flag: 0x1 ack vip data to char-serv, 0x2 add duration, 0x8 First request on player login
- timediff: tick to add to viptime - timediff: tick to add to viptime
- mapfd: map-serv link to ack if type&1 - mapfd: map-serv link to ack if type&1
desc: desc:
@ -468,16 +468,15 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
0x2743: 0x2743:
Type: AH Type: AH
Structure: <cmd>.W <aid>.L <vip_time>.L <isvip>.B <groupid>.L <isgm>.L <mapfd>.B Structure: <cmd>.W <aid>.L <vip_time>.L <flag>.B <groupid>.L <mapfd>.L
index: 0,2,6,10,11,15,16 index: 0,2,6,10,11,15
len: 20 len: 19
parameter: parameter:
- cmd : packet identification (0x2743) - cmd : packet identification (0x2743)
- aid: account identification - aid: account identification
- vip_time: timestamp of vip_time if he is vip - vip_time: timestamp of vip_time if he is vip
- isvip: is this account in vip mode atm - flag: 0x1: isvip, is this account in vip mode atm, 0x2: isgm, 0x4: show rates on player
- groupid: group id of account - groupid: group id of account
- isgm: is he a gm
- mapfd: map-serv link to ack - mapfd: map-serv link to ack
desc: desc:
- Transmit vip specific data to char-serv (will be transfered to mapserv) - Transmit vip specific data to char-serv (will be transfered to mapserv)
@ -2501,16 +2500,15 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
0x2b2b 0x2b2b
Type: AZ Type: AZ
Structure: <cmd>.W <aid>.L <vip_time>.L <isvip>.B <isgm>.B <groupid>.L Structure: <cmd>.W <aid>.L <vip_time>.L <groupid>.L <flag>.B
index: 0,2,6,10,11,12 index: 0,2,6,10,11
len: 16 len: 15
parameter: parameter:
- cmd : packet identification (0x2b2b) - cmd : packet identification (0x2b2b)
- aid - aid
- vip_time - vip_time
- isvip
- isgm
- groupid - groupid
- flag : 0x1: isvip, is this account in vip mode atm, 0x2: isgm, 0x4: show rates on player
desc: desc:
- Received vip-data from char-serv, fill map-serv data - Received vip-data from char-serv, fill map-serv data

View File

@ -621,38 +621,37 @@ int chlogif_parse_updip(int fd, struct char_session_data* sd){
*/ */
int chlogif_parse_vipack(int fd) { int chlogif_parse_vipack(int fd) {
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
if (RFIFOREST(fd) < 20) if (RFIFOREST(fd) < 19)
return 0; return 0;
else { else {
uint32 aid = RFIFOL(fd,2); //aid uint32 aid = RFIFOL(fd,2); //aid
uint32 vip_time = RFIFOL(fd,6); //vip_time uint32 vip_time = RFIFOL(fd,6); //vip_time
uint8 isvip = RFIFOB(fd,10); //isvip uint8 flag = RFIFOB(fd,10);
uint32 groupid = RFIFOL(fd,11); //new group id uint32 groupid = RFIFOL(fd,11); //new group id
uint8 isgm = RFIFOB(fd,15); //isgm int mapfd = RFIFOL(fd,15); //link to mapserv for ack
int mapfd = RFIFOL(fd,16); //link to mapserv for ack RFIFOSKIP(fd,19);
RFIFOSKIP(fd,20); chmapif_vipack(mapfd,aid,vip_time,groupid,flag);
chmapif_vipack(mapfd,aid,vip_time,isvip,isgm,groupid);
} }
#endif #endif
return 1; return 1;
} }
/** /**
* HZ 0x2b2b * HA 0x2742
* Request vip data from loginserv * Request vip data to loginserv
* @param aid : account_id to request the vip data * @param aid : account_id to request the vip data
* @param type : &2 define new duration, &1 load info * @param flag : 0x1 Select info and update old_groupid, 0x2 VIP duration is changed by atcommand or script, 0x8 First request on player login
* @param add_vip_time : tick to add to vip timestamp * @param add_vip_time : tick to add to vip timestamp
* @param mapfd: link to mapserv for ack * @param mapfd: link to mapserv for ack
* @return 0 if success * @return 0 if success
*/ */
int chlogif_reqvipdata(uint32 aid, uint8 type, int32 timediff, int mapfd) { int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd) {
loginif_check(-1); loginif_check(-1);
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
WFIFOHEAD(login_fd,15); WFIFOHEAD(login_fd,15);
WFIFOW(login_fd,0) = 0x2742; WFIFOW(login_fd,0) = 0x2742;
WFIFOL(login_fd,2) = aid; //aid WFIFOL(login_fd,2) = aid; //aid
WFIFOB(login_fd,6) = type; //type WFIFOB(login_fd,6) = flag; //flag
WFIFOL(login_fd,7) = timediff; //req_inc_duration WFIFOL(login_fd,7) = timediff; //req_inc_duration
WFIFOL(login_fd,11) = mapfd; //req_inc_duration WFIFOL(login_fd,11) = mapfd; //req_inc_duration
WFIFOSET(login_fd,15); WFIFOSET(login_fd,15);

View File

@ -44,7 +44,7 @@ int chlogif_parse_askkick(int fd, struct char_session_data* sd);
int chlogif_parse_updip(int fd, struct char_session_data* sd); int chlogif_parse_updip(int fd, struct char_session_data* sd);
int chlogif_parse_vipack(int fd); int chlogif_parse_vipack(int fd);
int chlogif_reqvipdata(uint32 aid, uint8 type, int32 timediff, int mapfd); int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd);
int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int u_group, int account_id, int8 type); int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int u_group, int account_id, int8 type);
int chlogif_parse(int fd); int chlogif_parse(int fd);

View File

@ -1206,16 +1206,15 @@ int chmapif_parse_updfamelist(int fd){
* HZ 0x2b2b * HZ 0x2b2b
* Transmist vip data to mapserv * Transmist vip data to mapserv
*/ */
int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint8 isvip, uint8 isgm, uint32 groupid) { int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8 flag) {
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
uint8 buf[16]; uint8 buf[15];
WBUFW(buf,0) = 0x2b2b; WBUFW(buf,0) = 0x2b2b;
WBUFL(buf,2) = aid; WBUFL(buf,2) = aid;
WBUFL(buf,6) = vip_time; WBUFL(buf,6) = vip_time;
WBUFB(buf,10) = isvip; WBUFL(buf,10) = groupid;
WBUFB(buf,11) = isgm; WBUFB(buf,14) = flag;
WBUFL(buf,12) = groupid; chmapif_send(mapfd,buf,15); // inform the mapserv back
chmapif_send(mapfd,buf,16); // inform the mapserv back
#endif #endif
return 0; return 0;
} }

View File

@ -47,7 +47,7 @@ int chmapif_parse_reqauth(int fd, int id);
int chmapif_parse_updmapip(int fd, int id); int chmapif_parse_updmapip(int fd, int id);
int chmapif_parse_fw_configstats(int fd); int chmapif_parse_fw_configstats(int fd);
int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint8 isvip, uint8 isgm, uint32 groupid); int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8 flag);
int chmapif_parse_reqcharban(int fd); int chmapif_parse_reqcharban(int fd);
int chmapif_parse_reqcharunban(int fd); int chmapif_parse_reqcharunban(int fd);
int chmapif_bonus_script_get(int fd); int chmapif_bonus_script_get(int fd);

View File

@ -206,18 +206,21 @@ int logchrif_send_accdata(int fd, uint32 aid) {
/** /**
* Transmit vip specific data to char-serv (will be transfered to mapserv) * Transmit vip specific data to char-serv (will be transfered to mapserv)
* @param fd
* @param acc
* @param flag 0x1: VIP, 0x2: GM, 0x4: Show rates on player
* @param mapfd
*/ */
int logchrif_sendvipdata(int fd, struct mmo_account acc, char isvip, char isgm, int mapfd) { int logchrif_sendvipdata(int fd, struct mmo_account acc, unsigned char flag, int mapfd) {
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
WFIFOHEAD(fd,19); WFIFOHEAD(fd,19);
WFIFOW(fd,0) = 0x2743; WFIFOW(fd,0) = 0x2743;
WFIFOL(fd,2) = acc.account_id; WFIFOL(fd,2) = acc.account_id;
WFIFOL(fd,6) = (int)acc.vip_time; WFIFOL(fd,6) = (int)acc.vip_time;
WFIFOB(fd,10) = isvip; WFIFOB(fd,10) = flag;
WFIFOL(fd,11) = acc.group_id; //new group id WFIFOL(fd,11) = acc.group_id; //new group id
WFIFOL(fd,15) = isgm; WFIFOL(fd,15) = mapfd; //link to mapserv
WFIFOL(fd,16) = mapfd; //link to mapserv WFIFOSET(fd,19);
WFIFOSET(fd,20);
logchrif_send_accdata(fd,acc.account_id); //refresh char with new setting logchrif_send_accdata(fd,acc.account_id); //refresh char with new setting
#endif #endif
return 1; return 1;
@ -649,8 +652,9 @@ int logchrif_parse_pincode_authfail(int fd){
/** /**
* Received a vip data reqest from char * Received a vip data reqest from char
* type is the query to perform * type is the query to perform
* &1 : Select info and update old_groupid * 0x1 : Select info and update old_groupid
* &2 : Update vip time * 0x2 : VIP duration is changed by atcommand or script
* 0x8 : First request on player login
* @param fd link to charserv * @param fd link to charserv
* @return 0 missing data, 1 succeeded * @return 0 missing data, 1 succeeded
*/ */
@ -662,7 +666,7 @@ int logchrif_parse_reqvipdata(int fd) {
struct mmo_account acc; struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db(); AccountDB* accounts = login_get_accounts_db();
int aid = RFIFOL(fd,2); int aid = RFIFOL(fd,2);
int8 type = RFIFOB(fd,6); int8 flag = RFIFOB(fd,6);
int32 timediff = RFIFOL(fd,7); int32 timediff = RFIFOL(fd,7);
int mapfd = RFIFOL(fd,11); int mapfd = RFIFOL(fd,11);
RFIFOSKIP(fd,15); RFIFOSKIP(fd,15);
@ -673,10 +677,10 @@ int logchrif_parse_reqvipdata(int fd) {
bool isvip = false; bool isvip = false;
if( acc.group_id > login_config.vip_sys.group ) { //Don't change group if it's higher. if( acc.group_id > login_config.vip_sys.group ) { //Don't change group if it's higher.
logchrif_sendvipdata(fd,acc,false,true,mapfd); logchrif_sendvipdata(fd,acc,0x2|((flag&0x8)?0x4:0),mapfd);
return 1; return 1;
} }
if( type&2 ) { if( flag&2 ) {
if(!vip_time) if(!vip_time)
vip_time = now; //new entry vip_time = now; //new entry
vip_time += timediff; // set new duration vip_time += timediff; // set new duration
@ -696,8 +700,8 @@ int logchrif_parse_reqvipdata(int fd) {
} }
acc.vip_time = vip_time; acc.vip_time = vip_time;
accounts->save(accounts,&acc); accounts->save(accounts,&acc);
if( type&1 ) if( flag&1 )
logchrif_sendvipdata(fd,acc,isvip,false,mapfd); logchrif_sendvipdata(fd,acc,((isvip)?0x1:0)|((flag&0x8)?0x4:0),mapfd);
} }
} }
#endif #endif

View File

@ -9549,8 +9549,6 @@ ACMD_FUNC(vip) {
pl_sd->vip.time += vipdifftime; //increase or reduce VIP duration pl_sd->vip.time += vipdifftime; //increase or reduce VIP duration
if (pl_sd->vip.time <= now) { if (pl_sd->vip.time <= now) {
pl_sd->vip.time = 0;
pl_sd->vip.enabled = 0;
clif_displaymessage(pl_sd->fd, msg_txt(pl_sd,703)); // GM has removed your VIP time. clif_displaymessage(pl_sd->fd, msg_txt(pl_sd,703)); // GM has removed your VIP time.
clif_displaymessage(fd, msg_txt(sd,704)); // Player is no longer VIP. clif_displaymessage(fd, msg_txt(sd,704)); // Player is no longer VIP.
} else { } else {

View File

@ -39,7 +39,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
11,10,10, 0,11, -1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, F->2b13, U->2b14, U->2b15, U->2b16, U->2b17 11,10,10, 0,11, -1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, F->2b13, U->2b14, U->2b15, U->2b16, U->2b17
2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f 2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f
-1,10, 8, 2, 2,14,19,19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27 -1,10, 8, 2, 2,14,19,19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27
-1, 0, 6,16, 0, 6,-1,-1, // 2b28-2b2f: U->2b28, F->2b29, U->2b2a, U->2b2b, F->2b2c, U->2b2d, U->2b2e, U->2b2f -1, 0, 6,15, 0, 6,-1,-1, // 2b28-2b2f: U->2b28, F->2b29, U->2b2a, U->2b2b, F->2b2c, U->2b2d, U->2b2e, U->2b2f
}; };
//Used Packets: //Used Packets:
@ -849,6 +849,10 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email) {
* @operation_type : see chrif_req_op * @operation_type : see chrif_req_op
* @timediff : tick to add or remove to unixtimestamp * @timediff : tick to add or remove to unixtimestamp
* @val1 : extra data value to transfer for operation * @val1 : extra data value to transfer for operation
* CHRIF_OP_LOGIN_VIP: 0x1 : Select info and update old_groupid
* 0x2 : VIP duration is changed by atcommand or script
* 0x4 : Show status reply by char-server through 0x2b0f
* 0x8 : First request on player login
* @val2 : extra data value to transfer for operation * @val2 : extra data value to transfer for operation
*/ */
int chrif_req_login_operation(int aid, const char* character_name, enum chrif_req_op operation_type, int32 timediff, int val1, int val2) { int chrif_req_login_operation(int aid, const char* character_name, enum chrif_req_op operation_type, int32 timediff, int val1, int val2) {
@ -1575,38 +1579,44 @@ void chrif_parse_ack_vipActive(int fd) {
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
int aid = RFIFOL(fd,2); int aid = RFIFOL(fd,2);
uint32 vip_time = RFIFOL(fd,6); uint32 vip_time = RFIFOL(fd,6);
bool isvip = RFIFOB(fd,10); uint32 groupid = RFIFOL(fd,10);
bool isgm = RFIFOB(fd,11); uint8 flag = RFIFOB(fd,14);
uint32 groupid = RFIFOL(fd,12);
TBL_PC *sd = map_id2sd(aid); TBL_PC *sd = map_id2sd(aid);
bool changed = false;
if(sd == NULL) return; if(sd == NULL) return;
sd->group_id = groupid; sd->group_id = groupid;
pc_group_pc_load(sd); pc_group_pc_load(sd);
if(isgm) { if ((flag&0x2)) //isgm
clif_displaymessage(sd->fd,msg_txt(sd,437)); clif_displaymessage(sd->fd,msg_txt(sd,437));
return; else {
} changed = (sd->vip.enabled != (flag&0x1));
if(isvip) { if((flag&0x1)) { //isvip
sd->vip.enabled = 1; sd->vip.enabled = 1;
sd->vip.time = vip_time; sd->vip.time = vip_time;
// Increase storage size for VIP. // Increase storage size for VIP.
sd->storage_size = battle_config.vip_storage_increase + MIN_STORAGE; sd->storage_size = battle_config.vip_storage_increase + MIN_STORAGE;
if (sd->storage_size > MAX_STORAGE) { if (sd->storage_size > MAX_STORAGE) {
ShowError("intif_parse_ack_vipActive: Storage size for player %s (%d:%d) is larger than MAX_STORAGE. Storage size has been set to MAX_STORAGE.\n", sd->status.name, sd->status.account_id, sd->status.char_id); ShowError("intif_parse_ack_vipActive: Storage size for player %s (%d:%d) is larger than MAX_STORAGE. Storage size has been set to MAX_STORAGE.\n", sd->status.name, sd->status.account_id, sd->status.char_id);
sd->storage_size = MAX_STORAGE; sd->storage_size = MAX_STORAGE;
}
// Magic Stone requirement avoidance for VIP.
if (battle_config.vip_gemstone)
sd->special_state.no_gemstone = 2; // need to be done after status_calc_bl(bl,first);
} else if (sd->vip.enabled) {
sd->vip.enabled = 0;
sd->vip.time = 0;
sd->storage_size = MIN_STORAGE;
sd->special_state.no_gemstone = 0;
clif_displaymessage(sd->fd,msg_txt(sd,438));
} }
// Magic Stone requirement avoidance for VIP. }
if (battle_config.vip_gemstone) // Show info if status changed
sd->special_state.no_gemstone = 2; // need to be done after status_calc_bl(bl,first); if (((flag&0x4) || changed) && !sd->vip.disableshowrate) {
} else if (sd->vip.enabled) { clif_display_pinfo(sd,ZC_PERSONAL_INFOMATION);
sd->vip.enabled = 0; //clif_vip_display_info(sd,ZC_PERSONAL_INFOMATION_CHN);
sd->vip.time = 0;
sd->storage_size = MIN_STORAGE;
sd->special_state.no_gemstone = 0;
clif_displaymessage(sd->fd,msg_txt(sd,438));
} }
#endif #endif
} }

View File

@ -10232,7 +10232,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(sd->state.connect_new) { if(sd->state.connect_new) {
int lv; int lv;
guild_notice = true; guild_notice = true;
sd->state.connect_new = 0;
clif_skillinfoblock(sd); clif_skillinfoblock(sd);
clif_hotkeys_send(sd); clif_hotkeys_send(sd);
clif_updatestatus(sd,SP_BASEEXP); clif_updatestatus(sd,SP_BASEEXP);
@ -10303,12 +10302,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif_partyinvitationstate(sd); clif_partyinvitationstate(sd);
clif_equipcheckbox(sd); clif_equipcheckbox(sd);
#endif #endif
#ifdef VIP_ENABLE
if (!sd->vip.disableshowrate) {
clif_display_pinfo(sd,ZC_PERSONAL_INFOMATION);
//clif_vip_display_info(sd,ZC_PERSONAL_INFOMATION_CHN);
}
#endif
if (sd->guild && battle_config.guild_notice_changemap == 1) if (sd->guild && battle_config.guild_notice_changemap == 1)
clif_guild_notice(sd, sd->guild); // Displays after VIP clif_guild_notice(sd, sd->guild); // Displays after VIP
@ -10353,7 +10346,18 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
status_change_clear_onChangeMap(&sd->bl, &sd->sc); status_change_clear_onChangeMap(&sd->bl, &sd->sc);
map_iwall_get(sd); // Updates Walls Info on this Map to Client map_iwall_get(sd); // Updates Walls Info on this Map to Client
status_calc_pc(sd, SCO_NONE); // Some conditions are map-dependent so we must recalculate status_calc_pc(sd, SCO_NONE); // Some conditions are map-dependent so we must recalculate
sd->state.changemap = false;
#ifdef VIP_ENABLE
if (!sd->state.connect_new &&
!sd->vip.disableshowrate &&
sd->state.pmap != sd->bl.m &&
map[sd->state.pmap].adjust.bexp != map[sd->bl.m].adjust.bexp
)
{
clif_display_pinfo(sd,ZC_PERSONAL_INFOMATION);
//clif_vip_display_info(sd,ZC_PERSONAL_INFOMATION_CHN);
}
#endif
// Instances do not need their own channels // Instances do not need their own channels
if( channel_config.map_enable && channel_config.map_autojoin && !map[sd->bl.m].flag.chmautojoin && !map[sd->bl.m].instance_id ) if( channel_config.map_enable && channel_config.map_autojoin && !map[sd->bl.m].flag.chmautojoin && !map[sd->bl.m].instance_id )
@ -10420,6 +10424,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
pc_show_questinfo_reinit(sd); pc_show_questinfo_reinit(sd);
pc_show_questinfo(sd); pc_show_questinfo(sd);
sd->state.connect_new = 0;
sd->state.changemap = false;
} }

View File

@ -1443,7 +1443,7 @@ void pc_reg_received(struct map_session_data *sd)
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
sd->vip.time = 0; sd->vip.time = 0;
sd->vip.enabled = 0; sd->vip.enabled = 0;
chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, 0, 1, 0); // request VIP information chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, 0, 1|8, 0); // request VIP information
#endif #endif
intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
intif_request_questlog(sd); intif_request_questlog(sd);