Added a state check for the cash shop

If the cash shop is open you can not use the atcommands cash and points.
This is because no update packet exists and the cash shop only gets the current amount when you open the cash shop.
The second way to update the cash shop values is on a successful purchase.
This commit is contained in:
Lemongrass3110 2017-07-03 22:14:34 +02:00
parent eaeec3973e
commit f86ba2b6b8
4 changed files with 12 additions and 1 deletions

View File

@ -1491,7 +1491,9 @@
1373: %s value is now: %d
1374: %s value is now: %s
1375: %s is blank.
//1376: free
// @cash/@points
1376: Please close the cashshop before using this command.
// @reloadquestdb
1377: Quest database has been reloaded.

View File

@ -8407,6 +8407,12 @@ ACMD_FUNC(cash)
int ret=0;
nullpo_retr(-1, sd);
// Since there is no cashpoint update packet we need to force updating like this
if( sd->state.cashshop_open ){
clif_displaymessage(fd, msg_txt(sd, 1376)); // Please close the cashshop before using this command.
return -1;
}
if( !message || !*message || (value = atoi(message)) == 0 ) {
clif_displaymessage(fd, msg_txt(sd,1322)); // Please enter an amount.
return -1;

View File

@ -16078,11 +16078,13 @@ void clif_cashshop_open( struct map_session_data* sd ){
}
void clif_parse_cashshop_open_request( int fd, struct map_session_data* sd ){
sd->state.cashshop_open = true;
sd->npc_shopid = -1; // Set npc_shopid when using cash shop from "cash shop" button [Aelys|Susu] bugreport:96
clif_cashshop_open( sd );
}
void clif_parse_cashshop_close( int fd, struct map_session_data* sd ){
sd->state.cashshop_open = false;
sd->npc_shopid = 0; // Reset npc_shopid when using cash shop from "cash shop" button [Aelys|Susu] bugreport:96
// No need to do anything here
}

View File

@ -267,6 +267,7 @@ struct map_session_data {
bool pc_loaded; // Ensure inventory data and status data is loaded before we calculate player stats
bool keepshop; // Whether shop data should be removed when the player disconnects
bool mail_writing; // Whether the player is currently writing a mail in RODEX or not
bool cashshop_open;
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;