diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/init.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 14 | ||||
-rw-r--r-- | src/map/script.h | 1 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/map/init.c b/src/map/init.c index 1327cb6..eaa99a6 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -46,7 +46,7 @@ HPExport void plugin_init (void) addScriptCommand("restorecam", "", restoreCam); addScriptCommand("npctalk3", "s", npcTalk3); addScriptCommand("closedialog", "", closeDialog); - addScriptCommand("shop", "s", dummy); + addScriptCommand("shop", "s", shop); addScriptCommand("getitemlink", "s", dummyStr); addScriptCommand("l", "s*", l); addScriptCommandDeprecated("getlang", "", getLang); diff --git a/src/map/script.c b/src/map/script.c index e54f6e2..1671f5c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -140,3 +140,17 @@ BUILDIN(closeDialog) send_npccommand(script->rid2sd (st), st->oid, 5); return true; } + +BUILDIN(shop) +{ + getSD(); + struct npc_data *nd = npc->name2id (script_getstr(st, 2)); + if (!nd) + return false; + + 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/map/script.h b/src/map/script.h index 45a3aea..8d929f9 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -12,5 +12,6 @@ BUILDIN(setCamNpc); BUILDIN(restoreCam); BUILDIN(npcTalk3); BUILDIN(closeDialog); +BUILDIN(shop); #endif // EVOL_MAP_SCRIPT |