summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-25 00:35:15 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-25 00:35:15 -0300
commit548057e189f0cb222833036836d5cda76e9f69c0 (patch)
tree10f8284fb50072a2e3dc91a07bb401ecd6ac827f /src/emap
parent7e0df96304fc6cc6019a46e89f64fbdb16cf7571 (diff)
downloadevol-hercules-548057e189f0cb222833036836d5cda76e9f69c0.tar.gz
evol-hercules-548057e189f0cb222833036836d5cda76e9f69c0.tar.bz2
evol-hercules-548057e189f0cb222833036836d5cda76e9f69c0.tar.xz
evol-hercules-548057e189f0cb222833036836d5cda76e9f69c0.zip
[TMW2 Patch]
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script_buildins.c35
-rw-r--r--src/emap/script_buildins.h1
3 files changed, 36 insertions, 1 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 1ea0ae9..266e6cf 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -223,6 +223,7 @@ HPExport void plugin_init (void)
addScriptCommand("deployhomunculus","",deployhomunculus);
addScriptCommand("recallhomunculus","",recallhomunculus);
addScriptCommand("homstatus","",homstatus);
+ addScriptCommand("npcshopattach","s?",npcshopattach);
do_init_langs();
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;
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 269df3a..96fdf35 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -13,6 +13,7 @@ BUILDIN(restoreCam);
BUILDIN(npcTalk3);
BUILDIN(closeDialog);
BUILDIN(closeClientDialog);
+BUILDIN(npcshopattach);
BUILDIN(shop);
BUILDIN(getItemLink);
BUILDIN(requestLang);