summaryrefslogtreecommitdiff
path: root/src/map/script.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-03-21 13:12:17 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-03-21 13:12:17 -0700
commite03ecd6bdc47fbd4007bfdab07c2402b540d1778 (patch)
tree7c0e8b80d43d4cc6b0eb427c30e0833a416f1826 /src/map/script.cpp
parentaf30bb8316849e96fca2764738d0d3e0060c9be7 (diff)
downloadtmwa-e03ecd6bdc47fbd4007bfdab07c2402b540d1778.tar.gz
tmwa-e03ecd6bdc47fbd4007bfdab07c2402b540d1778.tar.bz2
tmwa-e03ecd6bdc47fbd4007bfdab07c2402b540d1778.tar.xz
tmwa-e03ecd6bdc47fbd4007bfdab07c2402b540d1778.zip
Restore shop script function
Diffstat (limited to 'src/map/script.cpp')
-rw-r--r--src/map/script.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/map/script.cpp b/src/map/script.cpp
index f56cabb..86f6ee6 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -4240,6 +4240,24 @@ void builtin_isin(ScriptState *st)
}
+// Trigger the shop on a (hopefully) nearby shop NPC
+static
+void builtin_shop(ScriptState *st)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ struct npc_data *nd;
+
+ if (!sd)
+ return;
+
+ nd = npc_name2id(conv_str(st, &(st->stack->stack_data[st->start + 2])));
+ if (!nd)
+ return;
+
+ builtin_close(st);
+ clif_npcbuysell(sd, nd->bl.id);
+}
+
/*==========================================
* Check whether the PC is dead
*------------------------------------------
@@ -5183,6 +5201,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(getsavepoint, "i"),
BUILTIN(areatimer, "MxyxytE"),
BUILTIN(isin, "Mxyxy"),
+ BUILTIN(shop, "s"),
BUILTIN(isdead, ""),
BUILTIN(unequipbyid, "i"),
BUILTIN(getx, ""),
@@ -5190,4 +5209,3 @@ BuiltinFunction builtin_functions[] =
BUILTIN(getmap, ""),
{NULL, NULL, NULL},
};
-