diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-12-27 21:42:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-01-14 20:18:10 +0300 |
commit | fa1cb492536f2853c59a995dc54aa51ead420546 (patch) | |
tree | b0b3751721d688a4795ca7a8a7b5909dca09191a /src/map/npc.c | |
parent | 93b9a86bed2eb3a54b49557f663e06804985654f (diff) | |
download | hercules-fa1cb492536f2853c59a995dc54aa51ead420546.tar.gz hercules-fa1cb492536f2853c59a995dc54aa51ead420546.tar.bz2 hercules-fa1cb492536f2853c59a995dc54aa51ead420546.tar.xz hercules-fa1cb492536f2853c59a995dc54aa51ead420546.zip |
Add barter type shop and add packet ZC_NPC_BARTER_OPEN
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index fd11b6c5f..4c4cd0bb5 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1449,11 +1449,12 @@ static int npc_cashshop_buylist(struct map_session_data *sd, int points, struct return ERROR_TYPE_NPC; if( nd->subtype != CASHSHOP ) { - if( nd->subtype == SCRIPT && nd->u.scr.shop && nd->u.scr.shop->type != NST_ZENY && nd->u.scr.shop->type != NST_MARKET ) { + if (nd->subtype == SCRIPT && nd->u.scr.shop && nd->u.scr.shop->type != NST_ZENY && nd->u.scr.shop->type != NST_MARKET && nd->u.scr.shop->type != NST_BARTER) { shop = nd->u.scr.shop->item; shop_size = nd->u.scr.shop->items; - } else + } else { return ERROR_TYPE_NPC; + } } else { shop = nd->u.shop.shop_item; shop_size = nd->u.shop.count; @@ -1586,7 +1587,7 @@ static void npc_market_fromsql(void) ShowError("npc_market_fromsql: NPC '%s' not found! skipping...\n",name); npc->market_delfromsql_sub(name, USHRT_MAX); continue; - } else if ( nd->subtype != SCRIPT || !nd->u.scr.shop || !nd->u.scr.shop->items || nd->u.scr.shop->type != NST_MARKET ) { + } else if (nd->subtype != SCRIPT || !nd->u.scr.shop || !nd->u.scr.shop->items || nd->u.scr.shop->type != NST_MARKET) { ShowError("npc_market_fromsql: NPC '%s' is not proper for market, skipping...\n",name); npc->market_delfromsql_sub(name, USHRT_MAX); continue; @@ -1673,6 +1674,9 @@ static bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) clif->npc_market_open(sd,nd); } break; + case NST_BARTER: + clif->npc_barter_open(sd, nd); + break; default: clif->cashshop_show(sd,nd); break; @@ -1799,11 +1803,12 @@ static int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, return ERROR_TYPE_ITEM_ID; // Invalid Item if( nd->subtype != CASHSHOP ) { - if( nd->subtype == SCRIPT && nd->u.scr.shop && nd->u.scr.shop->type != NST_ZENY && nd->u.scr.shop->type != NST_MARKET ) { + if (nd->subtype == SCRIPT && nd->u.scr.shop && nd->u.scr.shop->type != NST_ZENY && nd->u.scr.shop->type != NST_MARKET && nd->u.scr.shop->type != NST_BARTER) { shop = nd->u.scr.shop->item; shop_size = nd->u.scr.shop->items; - } else + } else { return ERROR_TYPE_NPC; + } } else { shop = nd->u.shop.shop_item; shop_size = nd->u.shop.count; |