diff --git a/src/map/npc.cpp b/src/map/npc.cpp index bf981c06fa..3778b88541 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -1699,6 +1699,10 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, str amount = item_list[i].amount = 1; } + if( nd->master_nd ) { // Script-controlled shops decide by themselves, what can be bought and for what price. + continue; + } + switch( pc_checkadditem(sd,nameid,amount) ) { case CHKADDITEM_NEW: @@ -1712,6 +1716,9 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, str w += itemdb_weight(nameid) * amount; } + if (nd->master_nd) //Script-based shops. + return npc_buylist_sub(sd,count,(struct s_npc_buy_list*)item_list,nd->master_nd); + if( w + sd->weight > sd->max_weight ) return ERROR_TYPE_INVENTORY_WEIGHT; if( pc_inventoryblank(sd) < new_ ) diff --git a/src/map/npc.hpp b/src/map/npc.hpp index 61e0c567cd..3e99c7f90b 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -1237,6 +1237,7 @@ bool npc_scriptcont(struct map_session_data* sd, int id, bool closing); struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl); int npc_buysellsel(struct map_session_data* sd, int id, int type); uint8 npc_buylist(struct map_session_data* sd, uint16 n, struct s_npc_buy_list *item_list); +static int npc_buylist_sub(struct map_session_data* sd, uint16 n, struct s_npc_buy_list *item_list, struct npc_data* nd); uint8 npc_selllist(struct map_session_data* sd, int n, unsigned short *item_list); void npc_parse_mob2(struct spawn_data* mob); struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y);