summaryrefslogtreecommitdiff
path: root/src/map/buyingstore.c
diff options
context:
space:
mode:
authorSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
committerSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
commitd73783f22b2bb881aab74524d153d89a5932a199 (patch)
treefeea3cd428cee18be3da9bf0bee6d4570d9cad02 /src/map/buyingstore.c
parentdc7f14c7dc9829061f8902354367bdc8467eb841 (diff)
downloadhercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.gz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.bz2
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.xz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.zip
Hercules Renewal Phase One : pc, party, map, timer
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
Diffstat (limited to 'src/map/buyingstore.c')
-rw-r--r--src/map/buyingstore.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 0b59e8f1e..0fed57d37 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -64,7 +64,7 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
return false;
}
- if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
+ if( iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending cells
clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return false;
@@ -100,7 +100,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{// custom: GM is not allowed to buy (give zeny)
sd->buyingstore.slots = 0;
clif->message(sd->fd, msg_txt(246));
@@ -119,7 +119,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
+ if( iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending cells
clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return;
@@ -147,7 +147,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
break;
}
- if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, pc_get_group_level(sd), pc_get_group_level(sd)) || ( idx = pc_search_inventory(sd, nameid) ) == -1 )
+ if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, iPc->get_group_level(sd), iPc->get_group_level(sd)) || ( idx = iPc->search_inventory(sd, nameid) ) == -1 )
{// restrictions: allowed, no character-bound items and at least one must be owned
break;
}
@@ -221,13 +221,13 @@ void buyingstore_open(struct map_session_data* sd, int account_id)
return;
}
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{// custom: GM is not allowed to sell
clif->message(sd->fd, msg_txt(246));
return;
}
- if( ( pl_sd = map_id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore )
+ if( ( pl_sd = iMap->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore )
{// not online or not buying
return;
}
@@ -259,14 +259,14 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{// custom: GM is not allowed to sell
clif->message(sd->fd, msg_txt(246));
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
return;
}
- if( ( pl_sd = map_id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id )
+ if( ( pl_sd = iMap->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id )
{// not online, not buying or not same store
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
return;
@@ -314,7 +314,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( sd->status.inventory[index].expire_time || !itemdb_cantrade(&sd->status.inventory[index], pc_get_group_level(sd), pc_get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore_blankslots, sizeof(buyingstore_blankslots)) )
+ if( sd->status.inventory[index].expire_time || !itemdb_cantrade(&sd->status.inventory[index], iPc->get_group_level(sd), iPc->get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore_blankslots, sizeof(buyingstore_blankslots)) )
{// non-tradable item
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid);
return;
@@ -333,7 +333,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( pc_checkadditem(pl_sd, nameid, amount) == ADDITEM_OVERAMOUNT )
+ if( iPc->checkadditem(pl_sd, nameid, amount) == ADDITEM_OVERAMOUNT )
{// buyer does not have enough space for this item
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid);
return;
@@ -369,13 +369,13 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
zeny = amount*pl_sd->buyingstore.items[listidx].price;
// move item
- pc_additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
- pc_delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
+ iPc->additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
+ iPc->delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
pl_sd->buyingstore.items[listidx].amount-= amount;
// pay up
- pc_payzeny(pl_sd, zeny, LOG_TYPE_BUYING_STORE, sd);
- pc_getzeny(sd, zeny, LOG_TYPE_BUYING_STORE, pl_sd);
+ iPc->payzeny(pl_sd, zeny, LOG_TYPE_BUYING_STORE, sd);
+ iPc->getzeny(sd, zeny, LOG_TYPE_BUYING_STORE, pl_sd);
pl_sd->buyingstore.zenylimit-= zeny;
// notify clients
@@ -383,7 +383,7 @@ 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 ) {
+ if( iMap->save_settings&128 ) {
chrif_save(sd, 0);
chrif_save(pl_sd, 0);
}
@@ -409,7 +409,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
// remove auto-trader
if( pl_sd->state.autotrade )
{
- map_quit(pl_sd);
+ iMap->quit(pl_sd);
}
}