summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-08-24 14:13:25 -0400
committergumi <mekolat@users.noreply.github.com>2017-08-24 15:59:57 -0400
commit3b2d56d7887995cdbb281826a38f97dca45f93dc (patch)
tree05bd053568e2586f5e089cebacefb37c0bc11bea
parent57ded2155cf85f91adf7084dbf285ef3afa798ff (diff)
downloadhercules-s20170918.tar.gz
hercules-s20170918.tar.bz2
hercules-s20170918.tar.xz
hercules-s20170918.zip
allow buildin_callshop to work with any shop types20170918
-rw-r--r--src/map/script.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/map/script.c b/src/map/script.c
index c4f907b64..fdfc09b1a 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17362,13 +17362,21 @@ BUILDIN(callshop)
return true;
}
- if (!nd || nd->bl.type != BL_NPC || (nd->subtype != SHOP && nd->subtype != CASHSHOP)) {
- ShowError("buildin_callshop: Shop [%s] not found (or NPC is not shop type)\n", shopname);
- script_pushint(st,0);
+
+ if (nd == NULL || nd->bl.type != BL_NPC || (nd->subtype != SHOP && nd->subtype != CASHSHOP &&
+ !(nd->subtype == SCRIPT && nd->u.scr.shop != NULL && nd->u.scr.shop->items > 0))) {
+ if (nd != NULL && nd->subtype == SCRIPT) {
+ ShowError("script:callshop: trader '%s' has no shop list.\n", nd->exname);
+ } else if (nd != NULL) {
+ ShowError("script:callshop: npc '%s' is not a shop.\n", nd->exname);
+ } else {
+ ShowError("script:callshop: npc '%s' does not exist.\n", shopname);
+ }
+ script_pushint(st, 0);
return false;
}
- if (nd->subtype == SHOP) {
+ if (nd->subtype != SCRIPT) {
// flag the user as using a valid script call for opening the shop (for floating NPCs)
sd->state.callshop = 1;
@@ -17383,7 +17391,7 @@ BUILDIN(callshop)
clif->npcbuysell(sd, nd->bl.id); // Show buy/sell menu
}
} else {
- clif->cashshop_show(sd, nd);
+ npc->trader_open(sd, nd);
}
sd->npc_shopid = nd->bl.id;