|
@@ -30,6 +30,7 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_
|
|
|
|
|
|
static struct eri *auth_db_ers; //For reutilizing player login structures.
|
|
|
static DBMap* auth_db; // int id -> struct auth_node*
|
|
|
+static bool char_init_done = false; //server already initialized? Used for InterInitOnce and vending loadings
|
|
|
|
|
|
static const int packet_len_table[0x3d] = { // U - used, F - free
|
|
|
60, 3,-1,-1,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff
|
|
@@ -38,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
|
|
|
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, 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:
|
|
@@ -490,8 +491,6 @@ int chrif_changemapserverack(uint32 account_id, int login_id1, int login_id2, ui
|
|
|
* 0x2af9 <errCode>B
|
|
|
*/
|
|
|
int chrif_connectack(int fd) {
|
|
|
- static bool char_init_done = false;
|
|
|
-
|
|
|
if (RFIFOB(fd,2)) {
|
|
|
ShowFatalError("Connection to char-server failed %d, please check conf/import/map_conf userid and passwd.\n", RFIFOB(fd,2));
|
|
|
exit(EXIT_FAILURE);
|
|
@@ -505,7 +504,6 @@ int chrif_connectack(int fd) {
|
|
|
|
|
|
ShowStatus("Event '"CL_WHITE"OnInterIfInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInit"));
|
|
|
if( !char_init_done ) {
|
|
|
- char_init_done = true;
|
|
|
ShowStatus("Event '"CL_WHITE"OnInterIfInitOnce"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInitOnce"));
|
|
|
guild_castle_map_init();
|
|
|
}
|
|
@@ -570,8 +568,12 @@ void chrif_on_ready(void) {
|
|
|
guild_castle_reconnect(-1, 0, 0);
|
|
|
|
|
|
// Charserver is ready for loading autotrader
|
|
|
- do_init_buyingstore_autotrade();
|
|
|
- do_init_vending_autotrade();
|
|
|
+ if (!char_init_done)
|
|
|
+ {
|
|
|
+ do_init_buyingstore_autotrade();
|
|
|
+ do_init_vending_autotrade();
|
|
|
+ char_init_done = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -852,6 +854,10 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email) {
|
|
|
* @operation_type : see chrif_req_op
|
|
|
* @timediff : tick to add or remove to unixtimestamp
|
|
|
* @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
|
|
|
*/
|
|
|
int chrif_req_login_operation(int aid, const char* character_name, enum chrif_req_op operation_type, int32 timediff, int val1, int val2) {
|
|
@@ -1578,38 +1584,44 @@ void chrif_parse_ack_vipActive(int fd) {
|
|
|
#ifdef VIP_ENABLE
|
|
|
int aid = RFIFOL(fd,2);
|
|
|
uint32 vip_time = RFIFOL(fd,6);
|
|
|
- bool isvip = RFIFOB(fd,10);
|
|
|
- bool isgm = RFIFOB(fd,11);
|
|
|
- uint32 groupid = RFIFOL(fd,12);
|
|
|
+ uint32 groupid = RFIFOL(fd,10);
|
|
|
+ uint8 flag = RFIFOB(fd,14);
|
|
|
TBL_PC *sd = map_id2sd(aid);
|
|
|
+ bool changed = false;
|
|
|
|
|
|
if(sd == NULL) return;
|
|
|
|
|
|
sd->group_id = groupid;
|
|
|
pc_group_pc_load(sd);
|
|
|
|
|
|
- if(isgm) {
|
|
|
+ if ((flag&0x2)) //isgm
|
|
|
clif_displaymessage(sd->fd,msg_txt(sd,437));
|
|
|
- return;
|
|
|
- }
|
|
|
- if(isvip) {
|
|
|
- sd->vip.enabled = 1;
|
|
|
- sd->vip.time = vip_time;
|
|
|
- // Increase storage size for VIP.
|
|
|
- sd->storage_size = battle_config.vip_storage_increase + MIN_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);
|
|
|
- sd->storage_size = MAX_STORAGE;
|
|
|
+ else {
|
|
|
+ changed = (sd->vip.enabled != (flag&0x1));
|
|
|
+ if((flag&0x1)) { //isvip
|
|
|
+ sd->vip.enabled = 1;
|
|
|
+ sd->vip.time = vip_time;
|
|
|
+ // Increase storage size for VIP.
|
|
|
+ sd->storage_size = battle_config.vip_storage_increase + MIN_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);
|
|
|
+ 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)
|
|
|
- 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));
|
|
|
+ }
|
|
|
+ // Show info if status changed
|
|
|
+ if (((flag&0x4) || changed) && !sd->vip.disableshowrate) {
|
|
|
+ clif_display_pinfo(sd,ZC_PERSONAL_INFOMATION);
|
|
|
+ //clif_vip_display_info(sd,ZC_PERSONAL_INFOMATION_CHN);
|
|
|
}
|
|
|
#endif
|
|
|
}
|