summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-08-07 09:26:17 -0300
committerJesusaves <cpntb1@ymail.com>2020-08-07 09:26:17 -0300
commitc53f8a099151f2e8c26c0ab36f35d34256c0d6cb (patch)
tree0558845f1cb8070f39f9af424c8ffcd930a33b90 /src/map/npc.c
parentf18ad8f29090dd7c95b47922aabfb5e5569c7630 (diff)
downloadhercules-c53f8a099151f2e8c26c0ab36f35d34256c0d6cb.tar.gz
hercules-c53f8a099151f2e8c26c0ab36f35d34256c0d6cb.tar.bz2
hercules-c53f8a099151f2e8c26c0ab36f35d34256c0d6cb.tar.xz
hercules-c53f8a099151f2e8c26c0ab36f35d34256c0d6cb.zip
This is Hercules v2019.08.25r12.4+1
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 84d292415..1c5c72af9 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2115,7 +2115,7 @@ static int npc_buylist(struct map_session_data *sd, struct itemlist *item_list)
/**
* Processes incoming npc market purchase list
**/
-static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item_list)
+static enum market_buy_result npc_market_buylist(struct map_session_data *sd, struct itemlist *item_list)
{
struct npc_data* nd;
struct npc_item_list *shop = NULL;
@@ -2129,7 +2129,7 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
nd = npc->checknear(sd,map->id2bl(sd->npc_shopid));
if (nd == NULL || nd->subtype != SCRIPT || VECTOR_LENGTH(*item_list) == 0 || !nd->u.scr.shop || nd->u.scr.shop->type != NST_MARKET)
- return 1;
+ return MARKET_BUY_RESULT_ERROR;
shop = nd->u.scr.shop->item;
shop_size = nd->u.scr.shop->items;
@@ -2149,18 +2149,18 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
entry->id == itemdb_viewid(shop[j].nameid) //item_avail replacement
);
if (j == shop_size) /* TODO find official response for this */
- return 1; // no such item in shop
+ return MARKET_BUY_RESULT_ERROR; // no such item in shop
entry->id = shop[j].nameid; //item_avail replacement
if (entry->amount > (int)shop[j].qty)
- return 1;
+ return MARKET_BUY_RESULT_AMOUNT_TOO_BIG;
value = shop[j].value;
npc_market_qty[i] = j;
if (!itemdb->exists(entry->id)) /* TODO find official response for this */
- return 1; // item no longer in itemdb
+ return MARKET_BUY_RESULT_ERROR; // item no longer in itemdb
if (!itemdb->isstackable(entry->id) && entry->amount > 1) {
//Exploit? You can't buy more than 1 of equipment types o.O
@@ -2187,13 +2187,13 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
}
if (z > sd->status.zeny) /* TODO find official response for this */
- return 1; // Not enough Zeny
+ return MARKET_BUY_RESULT_NO_ZENY; // Not enough Zeny
if( w + sd->weight > sd->max_weight ) /* TODO find official response for this */
- return 1; // Too heavy
+ return MARKET_BUY_RESULT_OVER_WEIGHT; // Too heavy
if( pc->inventoryblank(sd) < new_ ) /* TODO find official response for this */
- return 1; // Not enough space to store items
+ return MARKET_BUY_RESULT_OUT_OF_SPACE; // Not enough space to store items
pc->payzeny(sd,(int)z,LOG_TYPE_NPC, NULL);
@@ -2203,7 +2203,7 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
j = npc_market_qty[i];
if (entry->amount > (int)shop[j].qty) /* wohoo someone tampered with the packet. */
- return 1;
+ return MARKET_BUY_RESULT_AMOUNT_TOO_BIG;
shop[j].qty -= entry->amount;
@@ -2224,7 +2224,7 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
if (nd->master_nd != NULL) // TMW2 Script-based shops.
return npc->buylist_sub(sd, item_list, nd->master_nd);
- return 0;
+ return MARKET_BUY_RESULT_SUCCESS;
}
/**