Fix small typo for Banking
-fix arraylenght for packet buffer causing bank_vault not to be refreshed correctly. -enforce sd check for mappacket -fix unused variables warnings
This commit is contained in:
parent
c83418a60a
commit
ea2954bf3f
@ -2167,7 +2167,7 @@ int loginif_BankingReq(int32 account_id, int8 type, int32 data){
|
|||||||
WFIFOB(login_fd,6) = type;
|
WFIFOB(login_fd,6) = type;
|
||||||
WFIFOL(login_fd,7) = data;
|
WFIFOL(login_fd,7) = data;
|
||||||
WFIFOSET(login_fd,11);
|
WFIFOSET(login_fd,11);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2184,18 +2184,18 @@ int loginif_parse_BankingAck(int fd){
|
|||||||
int32 bank_vault = RFIFOL(fd,6);
|
int32 bank_vault = RFIFOL(fd,6);
|
||||||
char not_fw = RFIFOB(fd,10);
|
char not_fw = RFIFOB(fd,10);
|
||||||
RFIFOSKIP(fd,11);
|
RFIFOSKIP(fd,11);
|
||||||
|
|
||||||
if(!not_fw) mapif_BankingAck(aid, bank_vault);
|
if(not_fw==0) mapif_BankingAck(aid, bank_vault);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//HZ 0x2b29 <aid>L <bank_vault>L
|
//HZ 0x2b29 <aid>L <bank_vault>L
|
||||||
int mapif_BankingAck(int32 account_id, int32 bank_vault){
|
int mapif_BankingAck(int32 account_id, int32 bank_vault){
|
||||||
unsigned char buf[14];
|
unsigned char buf[11];
|
||||||
WBUFW(buf,0) = 0x2b29;
|
WBUFW(buf,0) = 0x2b29;
|
||||||
WBUFL(buf,2) = account_id;
|
WBUFL(buf,2) = account_id;
|
||||||
WBUFL(buf,6) = bank_vault;
|
WBUFL(buf,6) = bank_vault;
|
||||||
mapif_sendall(buf, 10); //inform all maps-attached
|
mapif_sendall(buf, 10); //inform all maps-attached
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2226,7 +2226,7 @@ int mapif_parse_ReqBankInfo(int fd){
|
|||||||
return 0;
|
return 0;
|
||||||
uint32 aid = RFIFOL(fd,2);
|
uint32 aid = RFIFOL(fd,2);
|
||||||
RFIFOSKIP(fd,6);
|
RFIFOSKIP(fd,6);
|
||||||
loginif_BankingReq(aid, 1, 0);
|
loginif_BankingReq(aid, 1, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,12 +956,14 @@ int parse_fromchar(int fd){
|
|||||||
if( !accounts->load_num(accounts, &acc, account_id) )
|
if( !accounts->load_num(accounts, &acc, account_id) )
|
||||||
ShowNotice("Char-server '%s': Error on banking (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
|
ShowNotice("Char-server '%s': Error on banking (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
|
||||||
else{
|
else{
|
||||||
unsigned char buf[11];
|
unsigned char buf[12];
|
||||||
if(type==2){ // upd and Save
|
if(type==2){ // upd and Save
|
||||||
acc.bank_vault = data;
|
acc.bank_vault = data;
|
||||||
accounts->save(accounts, &acc);
|
accounts->save(accounts, &acc);
|
||||||
WBUFB(buf,10) = 1;
|
WBUFB(buf,10) = 1;
|
||||||
}
|
} else {
|
||||||
|
WBUFB(buf,10) = 0;
|
||||||
|
}
|
||||||
// announce to other servers
|
// announce to other servers
|
||||||
WBUFW(buf,0) = 0x2741;
|
WBUFW(buf,0) = 0x2741;
|
||||||
WBUFL(buf,2) = account_id;
|
WBUFL(buf,2) = account_id;
|
||||||
|
@ -1198,7 +1198,7 @@ int chrif_bankdata_request(int account_id, int char_id) {
|
|||||||
WFIFOW(char_fd,0) = 0x2b2a;
|
WFIFOW(char_fd,0) = 0x2b2a;
|
||||||
WFIFOL(char_fd,2) = account_id;
|
WFIFOL(char_fd,2) = account_id;
|
||||||
WFIFOSET(char_fd,6);
|
WFIFOSET(char_fd,6);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int chrif_load_bankdata(int fd){
|
int chrif_load_bankdata(int fd){
|
||||||
@ -1215,7 +1215,7 @@ int chrif_load_bankdata(int fd){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sd->status.bank_vault = bank_vault;
|
sd->status.bank_vault = bank_vault;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int chrif_save_bankdata(struct map_session_data *sd){
|
int chrif_save_bankdata(struct map_session_data *sd){
|
||||||
@ -1226,7 +1226,7 @@ int chrif_save_bankdata(struct map_session_data *sd){
|
|||||||
WFIFOL(char_fd,2) = sd->status.account_id;
|
WFIFOL(char_fd,2) = sd->status.account_id;
|
||||||
WFIFOL(char_fd,6) = sd->status.bank_vault;
|
WFIFOL(char_fd,6) = sd->status.bank_vault;
|
||||||
WFIFOSET(char_fd,10);
|
WFIFOSET(char_fd,10);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex]
|
int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex]
|
||||||
|
@ -6140,7 +6140,10 @@ void clif_cart_additem_ack(struct map_session_data *sd, uint8 flag)
|
|||||||
|
|
||||||
// 09B7 <unknow data> (ZC_ACK_OPEN_BANKING)
|
// 09B7 <unknow data> (ZC_ACK_OPEN_BANKING)
|
||||||
void clif_bank_open(struct map_session_data *sd){
|
void clif_bank_open(struct map_session_data *sd){
|
||||||
int fd = sd->fd;
|
int fd;
|
||||||
|
|
||||||
|
nullpo_retv(sd);
|
||||||
|
fd = sd->fd;
|
||||||
|
|
||||||
WFIFOHEAD(fd,4);
|
WFIFOHEAD(fd,4);
|
||||||
WFIFOW(fd,0) = 0x09b7;
|
WFIFOW(fd,0) = 0x09b7;
|
||||||
@ -6155,6 +6158,7 @@ void clif_bank_open(struct map_session_data *sd){
|
|||||||
void clif_parse_BankOpen(int fd, struct map_session_data* sd) {
|
void clif_parse_BankOpen(int fd, struct map_session_data* sd) {
|
||||||
//TODO check if preventing trade or stuff like that
|
//TODO check if preventing trade or stuff like that
|
||||||
//also mark something in case char ain't available for saving, should we check now ?
|
//also mark something in case char ain't available for saving, should we check now ?
|
||||||
|
nullpo_retv(sd);
|
||||||
if( !battle_config.feature_banking ) {
|
if( !battle_config.feature_banking ) {
|
||||||
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
||||||
return;
|
return;
|
||||||
@ -6162,19 +6166,24 @@ void clif_parse_BankOpen(int fd, struct map_session_data* sd) {
|
|||||||
else {
|
else {
|
||||||
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
|
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
|
||||||
int aid = RFIFOL(fd,info->pos[0]); //unused should we check vs fd ?
|
int aid = RFIFOL(fd,info->pos[0]); //unused should we check vs fd ?
|
||||||
|
if(sd->status.account_id == aid){
|
||||||
sd->state.banking = 1;
|
sd->state.banking = 1;
|
||||||
|
//request save ?
|
||||||
|
//chrif_bankdata_request(sd->status.account_id, sd->status.char_id);
|
||||||
|
//on succes open bank ?
|
||||||
|
clif_bank_open(sd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//request save ?
|
|
||||||
// chrif_bankdata_request(sd->status.account_id, sd->status.char_id);
|
|
||||||
//on succes open bank ?
|
|
||||||
clif_bank_open(sd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 09B9 <unknow data> (ZC_ACK_CLOSE_BANKING)
|
// 09B9 <unknow data> (ZC_ACK_CLOSE_BANKING)
|
||||||
|
|
||||||
void clif_bank_close(struct map_session_data *sd){
|
void clif_bank_close(struct map_session_data *sd){
|
||||||
int fd = sd->fd;
|
int fd;
|
||||||
|
|
||||||
|
nullpo_retv(sd);
|
||||||
|
fd = sd->fd;
|
||||||
|
|
||||||
WFIFOHEAD(fd,4);
|
WFIFOHEAD(fd,4);
|
||||||
WFIFOW(fd,0) = 0x09B9;
|
WFIFOW(fd,0) = 0x09B9;
|
||||||
WFIFOW(fd,2) = 0;
|
WFIFOW(fd,2) = 0;
|
||||||
@ -6188,12 +6197,16 @@ void clif_bank_close(struct map_session_data *sd){
|
|||||||
void clif_parse_BankClose(int fd, struct map_session_data* sd) {
|
void clif_parse_BankClose(int fd, struct map_session_data* sd) {
|
||||||
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
|
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
|
||||||
int aid = RFIFOL(fd,info->pos[0]); //unused should we check vs fd ?
|
int aid = RFIFOL(fd,info->pos[0]); //unused should we check vs fd ?
|
||||||
|
|
||||||
|
nullpo_retv(sd);
|
||||||
if( !battle_config.feature_banking ) {
|
if( !battle_config.feature_banking ) {
|
||||||
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
||||||
//still allow to go trough to not stuck player if we have disable it while they was in
|
//still allow to go trough to not stuck player if we have disable it while they was in
|
||||||
}
|
}
|
||||||
sd->state.banking = 0;
|
if(sd->status.account_id == aid){
|
||||||
clif_bank_close(sd);
|
sd->state.banking = 0;
|
||||||
|
clif_bank_close(sd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6269,6 +6282,7 @@ void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK r
|
|||||||
* 09A7 <AID>L <Money>L (PACKET_CZ_REQ_BANKING_DEPOSIT)
|
* 09A7 <AID>L <Money>L (PACKET_CZ_REQ_BANKING_DEPOSIT)
|
||||||
*/
|
*/
|
||||||
void clif_parse_BankDeposit(int fd, struct map_session_data* sd) {
|
void clif_parse_BankDeposit(int fd, struct map_session_data* sd) {
|
||||||
|
nullpo_retv(sd);
|
||||||
if( !battle_config.feature_banking ) {
|
if( !battle_config.feature_banking ) {
|
||||||
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
||||||
return;
|
return;
|
||||||
@ -6315,7 +6329,8 @@ void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK
|
|||||||
* Request Withdrawing some money from bank
|
* Request Withdrawing some money from bank
|
||||||
* 09A9 <AID>L <Money>L (PACKET_CZ_REQ_BANKING_WITHDRAW)
|
* 09A9 <AID>L <Money>L (PACKET_CZ_REQ_BANKING_WITHDRAW)
|
||||||
*/
|
*/
|
||||||
void clif_parse_BankWithdraw(int fd, struct map_session_data* sd) {
|
void clif_parse_BankWithdraw(int fd, struct map_session_data* sd) {
|
||||||
|
nullpo_retv(sd);
|
||||||
if( !battle_config.feature_banking ) {
|
if( !battle_config.feature_banking ) {
|
||||||
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user