Fixed #453
* Added check if cash shop has item on the list or not. Signed-off-by: Cydh Ramdh <cydh@pservero.com>
This commit is contained in:
parent
087d911354
commit
11f42f27ab
@ -12,6 +12,7 @@
|
|||||||
#include <stdlib.h> // atoi
|
#include <stdlib.h> // atoi
|
||||||
|
|
||||||
struct cash_item_db cash_shop_items[CASHSHOP_TAB_SEARCH];
|
struct cash_item_db cash_shop_items[CASHSHOP_TAB_SEARCH];
|
||||||
|
bool cash_shop_defined = false;
|
||||||
|
|
||||||
extern char item_cash_db_db[32];
|
extern char item_cash_db_db[32];
|
||||||
extern char item_cash_db2_db[32];
|
extern char item_cash_db2_db[32];
|
||||||
@ -51,7 +52,7 @@ static int cashshop_parse_dbrow( char** str, const char* source, int line ){
|
|||||||
|
|
||||||
cid->nameid = nameid;
|
cid->nameid = nameid;
|
||||||
cid->price = price;
|
cid->price = price;
|
||||||
|
cash_shop_defined = true;
|
||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
ShowWarning( "cashshop_parse_dbrow: Invalid ID %hu in line %d of \"%s\", skipping...\n", nameid, line, source );
|
ShowWarning( "cashshop_parse_dbrow: Invalid ID %hu in line %d of \"%s\", skipping...\n", nameid, line, source );
|
||||||
@ -201,7 +202,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u
|
|||||||
uint32 totalweight = 0;
|
uint32 totalweight = 0;
|
||||||
int i,new_;
|
int i,new_;
|
||||||
|
|
||||||
if( sd == NULL || item_list == NULL ){
|
if( sd == NULL || item_list == NULL || !cash_shop_defined){
|
||||||
clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN );
|
clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN );
|
||||||
return false;
|
return false;
|
||||||
}else if( sd->state.trading ){
|
}else if( sd->state.trading ){
|
||||||
@ -329,5 +330,6 @@ void do_final_cashshop( void ){
|
|||||||
* 0 : success
|
* 0 : success
|
||||||
*/
|
*/
|
||||||
void do_init_cashshop( void ){
|
void do_init_cashshop( void ){
|
||||||
|
cash_shop_defined = false;
|
||||||
cashshop_read_db();
|
cashshop_read_db();
|
||||||
}
|
}
|
||||||
|
@ -55,5 +55,6 @@ struct cash_item_db{
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern struct cash_item_db cash_shop_items[CASHSHOP_TAB_SEARCH];
|
extern struct cash_item_db cash_shop_items[CASHSHOP_TAB_SEARCH];
|
||||||
|
extern bool cash_shop_defined;
|
||||||
|
|
||||||
#endif /* _CASHSHOP_H_ */
|
#endif /* _CASHSHOP_H_ */
|
||||||
|
@ -15351,7 +15351,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) {
|
|||||||
|
|
||||||
info = &packet_db[sd->packet_ver][cmd];
|
info = &packet_db[sd->packet_ver][cmd];
|
||||||
|
|
||||||
if( sd->state.trading || !sd->npc_shopid ) {
|
if( sd->state.trading || !sd->npc_shopid || !cash_shop_defined) {
|
||||||
clif_cashshop_ack(sd,1);
|
clif_cashshop_ack(sd,1);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user