summaryrefslogtreecommitdiff
path: root/src/emap/script_buildins.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r--src/emap/script_buildins.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 99bae19..7393da8 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -187,7 +187,8 @@ BUILDIN(npcTalk3)
BUILDIN(closeDialog)
{
getSD();
- send_npccommand(sd, st->oid, 5);
+ //send_npccommand(sd, st->oid, 5);
+ send_npccommand(sd, st->oid, 14);
return true;
}
@@ -198,6 +199,32 @@ BUILDIN(closeClientDialog)
return true;
}
+// npcshopattach(npc) will tell the scripts to run an event
+// Enabling OnBuyItem and OnSellItem events of npc
+BUILDIN(npcshopattach)
+{
+ const char* npcname = script_getstr(st,2);
+ struct npc_data* nd = npc->name2id(npcname);
+ int flag = 1;
+
+ if( script_hasdata(st,3) )
+ flag = script_getnum(st,3);
+
+ if( !nd ) {
+ //Not found.
+ script_pushint(st,0);
+ return true;
+ }
+
+ if (flag)
+ nd->master_nd = map->id2nd(st->oid);
+ else
+ nd->master_nd = NULL;
+
+ script_pushint(st,1);
+ return true;
+}
+
BUILDIN(shop)
{
getSD();
@@ -209,8 +236,14 @@ BUILDIN(shop)
return false;
}
+ // TMW2 Shops
+ /*
+ Move this to a new function, and comment the autoclose
+ Skip the forced check of SHOP type because I don't like it.
+
st->state = sd->state.dialog == 1 ? CLOSE : END;
clif->scriptclose(sd, st->oid);
+ */
clif->npcbuysell (sd, nd->bl.id);
return true;