diff options
Diffstat (limited to 'src/map/buyingstore.c')
-rw-r--r-- | src/map/buyingstore.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index fb186917b..0b59e8f1e 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams #include "../common/cbasetypes.h" #include "../common/db.h" // ARR_FIND @@ -12,6 +13,7 @@ #include "clif.h" // clif->buyingstore_* #include "log.h" // log_pick_pc, log_zeny #include "pc.h" // struct map_session_data +#include "chrif.h" /// constants (client-side restrictions) @@ -230,7 +232,7 @@ void buyingstore_open(struct map_session_data* sd, int account_id) return; } - if( !searchstore_queryremote(sd, account_id) && ( sd->bl.m != pl_sd->bl.m || !check_distance_bl(&sd->bl, &pl_sd->bl, AREA_SIZE) ) ) + if( !searchstore->queryremote(sd, account_id) && ( sd->bl.m != pl_sd->bl.m || !check_distance_bl(&sd->bl, &pl_sd->bl, AREA_SIZE) ) ) {// out of view range return; } @@ -270,13 +272,13 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int return; } - if( !searchstore_queryremote(sd, account_id) && ( sd->bl.m != pl_sd->bl.m || !check_distance_bl(&sd->bl, &pl_sd->bl, AREA_SIZE) ) ) + if( !searchstore->queryremote(sd, account_id) && ( sd->bl.m != pl_sd->bl.m || !check_distance_bl(&sd->bl, &pl_sd->bl, AREA_SIZE) ) ) {// out of view range clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0); return; } - searchstore_clearremote(sd); + searchstore->clearremote(sd); if( pl_sd->status.zeny < pl_sd->buyingstore.zenylimit ) {// buyer lost zeny in the mean time? fix the limit @@ -381,6 +383,11 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int clif->buyingstore_update_item(pl_sd, nameid, amount); } + if( save_settings&128 ) { + chrif_save(sd, 0); + chrif_save(pl_sd, 0); + } + // check whether or not there is still something to buy ARR_FIND( 0, pl_sd->buyingstore.slots, i, pl_sd->buyingstore.items[i].amount != 0 ); if( i == pl_sd->buyingstore.slots ) @@ -463,7 +470,7 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st ; } - if( !searchstore_result(s->search_sd, sd->buyer_id, sd->status.account_id, sd->message, it->nameid, it->amount, it->price, buyingstore_blankslots, 0) ) + if( !searchstore->result(s->search_sd, sd->buyer_id, sd->status.account_id, sd->message, it->nameid, it->amount, it->price, buyingstore_blankslots, 0) ) {// result set full return false; } @@ -471,3 +478,15 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st return true; } +void buyingstore_defaults(void) { + buyingstore = &buyingstore_s; + + buyingstore->setup = buyingstore_setup; + buyingstore->create = buyingstore_create; + buyingstore->close = buyingstore_close; + buyingstore->open = buyingstore_open; + buyingstore->trade = buyingstore_trade; + buyingstore->search = buyingstore_search; + buyingstore->searchall = buyingstore_searchall; + +} |