From 5a8d6081f975536713974eccd0ed2371c8909495 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Jan 2016 23:13:11 +0300 Subject: Add script function for find craft entry from db based on craft variable. New script command: findcraftentry CRAFTVAR, FLAG Where: CRAFTVAR - variable get from initcraft function. FLAG - flag related to npc. It allow search craft entries only with this flag. --- src/emap/script.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/emap/script.c') diff --git a/src/emap/script.c b/src/emap/script.c index a7aac63..9d89fc7 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -532,7 +532,7 @@ BUILDIN(shop) BUILDIN(getItemLink) { - struct item_data *i_data; + struct item_data *i_data = NULL; char *item_name; int item_id = 0; @@ -1941,6 +1941,16 @@ BUILDIN(validateCraft) return true; } +BUILDIN(findCraftEntry) +{ + getSDReturn(-1) + const int id = craft_find_entry(sd, + script_getnum(st, 2), + script_getnum(st, 3)); + script_pushint(st, id); + return true; +} + BUILDIN(getInvIndexLink) { getSDReturnS("") -- cgit v1.2.3-70-g09d2