Skip to content

Commit

Permalink
Fixed VIP char selection window (#1598)
Browse files Browse the repository at this point in the history
* Char selection window went crazy when `VIP_ENABLE` is defined
* Fixed #628

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
  • Loading branch information
cydh committed Oct 11, 2016
1 parent 6663df3 commit 8f3599b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions conf/login_athena.conf
Expand Up @@ -98,8 +98,8 @@ chars_per_account: 0
// 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 2: This setting must be set after chars_per_account.
// Default: 6
vip_char_increase: 6
// -1 will default to MAX_CHAR_VIP (src/config/core.h)
vip_char_increase: -1

// Create accounts with limited time?
// -1: new accounts are created with unlimited time (default)
Expand Down
14 changes: 7 additions & 7 deletions src/char/char_clif.c
Expand Up @@ -336,8 +336,8 @@ int chclif_mmo_send006b(int fd, struct char_session_data* sd){
WFIFOW(fd,0) = 0x6b;
if(newvers){ //20100413
WFIFOB(fd,4) = MAX_CHARS; // Max slots.
WFIFOB(fd,5) = sd->char_slots; // 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,5) = MIN_CHARS; // Available slots. (PremiumStartSlot)
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
j+=char_mmo_chars_fromsql(sd, WFIFOP(fd,j));
Expand All @@ -356,11 +356,11 @@ void chclif_mmo_send082d(int fd, struct char_session_data* sd) {
WFIFOHEAD(fd,29);
WFIFOW(fd,0) = 0x82d;
WFIFOW(fd,2) = 29;
WFIFOB(fd,4) = sd->char_slots;
WFIFOB(fd,5) = MAX_CHARS - sd->char_slots;
WFIFOB(fd,6) = MAX_CHARS - sd->char_slots;
WFIFOB(fd,7) = sd->char_slots;
WFIFOB(fd,8) = sd->char_slots;
WFIFOB(fd,4) = MIN_CHARS; // normal_slot
WFIFOB(fd,5) = sd->chars_vip; // premium_slot
WFIFOB(fd,6) = sd->chars_billing; // billing_slot
WFIFOB(fd,7) = sd->char_slots; // producible_slot
WFIFOB(fd,8) = MAX_CHARS; // valid_slot
memset(WFIFOP(fd,9), 0, 20); // unused bytes
WFIFOSET(fd,29);
}
Expand Down
4 changes: 4 additions & 0 deletions src/char/char_logif.c
Expand Up @@ -332,6 +332,10 @@ int chlogif_parse_ackaccreq(int fd, struct char_session_data* sd){
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 u_fd; //user fd
if (RFIFOREST(fd) < 75)
Expand Down
9 changes: 7 additions & 2 deletions src/login/login.c
Expand Up @@ -655,10 +655,15 @@ bool login_config_read(const char* cfgName, bool normal) {
else if(strcmpi(w1,"vip_group")==0)
login_config.vip_sys.group = cap_value(atoi(w2),0,99);
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",
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
else if(!strcmpi(w1, "import"))
Expand Down
5 changes: 3 additions & 2 deletions src/login/loginchrif.c
Expand Up @@ -163,7 +163,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
char birthdate[10+1] = "";
char pincode[PINCODE_LENGTH+1];
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();

memset(pincode,0,PINCODE_LENGTH+1);
Expand All @@ -183,6 +183,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
char_slots = login_config.char_per_account + char_vip;
} else
char_slots = login_config.char_per_account;
char_billing = MAX_CHAR_BILLING; //TODO create a config for this
#endif
}

Expand All @@ -198,7 +199,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
WFIFOL(fd,68) = (uint32)acc.pincode_change;
WFIFOB(fd,72) = isvip;
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);
return 1;
}
Expand Down

0 comments on commit 8f3599b

Please sign in to comment.