Fixed VIP char selection window (#1598)

* Char selection window went crazy when `VIP_ENABLE` is defined
* Fixed #628

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
This commit is contained in:
Cydh Ramdh 2016-10-12 06:26:30 +07:00 committed by GitHub
parent 6663df344b
commit 8f3599b0e3
5 changed files with 23 additions and 13 deletions

View File

@ -98,8 +98,8 @@ chars_per_account: 0
// Increase the value of MAX_CHARS if you want to increase vip_char_increase. // Increase the value of MAX_CHARS if you want to increase vip_char_increase.
// Note: The amount of VIP characters = MAX_CHARS - chars_per_account. // Note: The amount of VIP characters = MAX_CHARS - chars_per_account.
// Note 2: This setting must be set after chars_per_account. // Note 2: This setting must be set after chars_per_account.
// Default: 6 // -1 will default to MAX_CHAR_VIP (src/config/core.h)
vip_char_increase: 6 vip_char_increase: -1
// Create accounts with limited time? // Create accounts with limited time?
// -1: new accounts are created with unlimited time (default) // -1: new accounts are created with unlimited time (default)

View File

@ -336,8 +336,8 @@ int chclif_mmo_send006b(int fd, struct char_session_data* sd){
WFIFOW(fd,0) = 0x6b; WFIFOW(fd,0) = 0x6b;
if(newvers){ //20100413 if(newvers){ //20100413
WFIFOB(fd,4) = MAX_CHARS; // Max slots. WFIFOB(fd,4) = MAX_CHARS; // Max slots.
WFIFOB(fd,5) = sd->char_slots; // Available slots. (PremiumStartSlot) WFIFOB(fd,5) = MIN_CHARS; // Available slots. (PremiumStartSlot)
WFIFOB(fd,6) = MAX_CHARS; // Premium slots. (Any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red) WFIFOB(fd,6) = MIN_CHARS+sd->chars_vip; // Premium slots. (Any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red)
} }
memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes
j+=char_mmo_chars_fromsql(sd, WFIFOP(fd,j)); j+=char_mmo_chars_fromsql(sd, WFIFOP(fd,j));
@ -356,11 +356,11 @@ void chclif_mmo_send082d(int fd, struct char_session_data* sd) {
WFIFOHEAD(fd,29); WFIFOHEAD(fd,29);
WFIFOW(fd,0) = 0x82d; WFIFOW(fd,0) = 0x82d;
WFIFOW(fd,2) = 29; WFIFOW(fd,2) = 29;
WFIFOB(fd,4) = sd->char_slots; WFIFOB(fd,4) = MIN_CHARS; // normal_slot
WFIFOB(fd,5) = MAX_CHARS - sd->char_slots; WFIFOB(fd,5) = sd->chars_vip; // premium_slot
WFIFOB(fd,6) = MAX_CHARS - sd->char_slots; WFIFOB(fd,6) = sd->chars_billing; // billing_slot
WFIFOB(fd,7) = sd->char_slots; WFIFOB(fd,7) = sd->char_slots; // producible_slot
WFIFOB(fd,8) = sd->char_slots; WFIFOB(fd,8) = MAX_CHARS; // valid_slot
memset(WFIFOP(fd,9), 0, 20); // unused bytes memset(WFIFOP(fd,9), 0, 20); // unused bytes
WFIFOSET(fd,29); WFIFOSET(fd,29);
} }

View File

@ -332,6 +332,10 @@ int chlogif_parse_ackaccreq(int fd, struct char_session_data* sd){
return 1; return 1;
} }
/**
* Receive account data from login-server
* AH 0x2717 <aid>.L <email>.40B <expiration_time>.L <group_id>.B <birthdate>.11B <pincode>.5B <pincode_change>.L <isvip>.B <char_vip>.B <char_billing>.B
**/
int chlogif_parse_reqaccdata(int fd, struct char_session_data* sd){ int chlogif_parse_reqaccdata(int fd, struct char_session_data* sd){
int u_fd; //user fd int u_fd; //user fd
if (RFIFOREST(fd) < 75) if (RFIFOREST(fd) < 75)

View File

@ -655,10 +655,15 @@ bool login_config_read(const char* cfgName, bool normal) {
else if(strcmpi(w1,"vip_group")==0) else if(strcmpi(w1,"vip_group")==0)
login_config.vip_sys.group = cap_value(atoi(w2),0,99); login_config.vip_sys.group = cap_value(atoi(w2),0,99);
else if(strcmpi(w1,"vip_char_increase")==0) { else if(strcmpi(w1,"vip_char_increase")==0) {
if(login_config.vip_sys.char_increase > (unsigned int) MAX_CHARS-login_config.char_per_account) if (atoi(w2) == -1)
login_config.vip_sys.char_increase = MAX_CHAR_VIP;
else
login_config.vip_sys.char_increase = atoi(w2);
if (login_config.vip_sys.char_increase > (unsigned int) MAX_CHARS-login_config.char_per_account) {
ShowWarning("vip_char_increase too high, can only go up to %d, according to your char_per_account config %d\n", ShowWarning("vip_char_increase too high, can only go up to %d, according to your char_per_account config %d\n",
MAX_CHARS-login_config.char_per_account,login_config.char_per_account); MAX_CHARS-login_config.char_per_account,login_config.char_per_account);
login_config.vip_sys.char_increase = cap_value(atoi(w2),0,MAX_CHARS-login_config.char_per_account); login_config.vip_sys.char_increase = MAX_CHARS-login_config.char_per_account;
}
} }
#endif #endif
else if(!strcmpi(w1, "import")) else if(!strcmpi(w1, "import"))

View File

@ -163,7 +163,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
char birthdate[10+1] = ""; char birthdate[10+1] = "";
char pincode[PINCODE_LENGTH+1]; char pincode[PINCODE_LENGTH+1];
char isvip = false; char isvip = false;
uint8 char_slots = MIN_CHARS, char_vip = 0; uint8 char_slots = MIN_CHARS, char_vip = 0, char_billing = 0;
AccountDB* accounts = login_get_accounts_db(); AccountDB* accounts = login_get_accounts_db();
memset(pincode,0,PINCODE_LENGTH+1); memset(pincode,0,PINCODE_LENGTH+1);
@ -183,6 +183,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
char_slots = login_config.char_per_account + char_vip; char_slots = login_config.char_per_account + char_vip;
} else } else
char_slots = login_config.char_per_account; char_slots = login_config.char_per_account;
char_billing = MAX_CHAR_BILLING; //TODO create a config for this
#endif #endif
} }
@ -198,7 +199,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
WFIFOL(fd,68) = (uint32)acc.pincode_change; WFIFOL(fd,68) = (uint32)acc.pincode_change;
WFIFOB(fd,72) = isvip; WFIFOB(fd,72) = isvip;
WFIFOB(fd,73) = char_vip; WFIFOB(fd,73) = char_vip;
WFIFOB(fd,74) = MAX_CHAR_BILLING; //TODO create a config for this WFIFOB(fd,74) = char_billing;
WFIFOSET(fd,75); WFIFOSET(fd,75);
return 1; return 1;
} }