diff options
author | Kisuka <kisuka@kisuka.com> | 2013-10-24 07:03:46 -0700 |
---|---|---|
committer | Kisuka <kisuka@kisuka.com> | 2013-10-24 07:03:46 -0700 |
commit | 94b7b25456aa8a9de1e0f2a147d58dba6e5976dd (patch) | |
tree | 09d5b126dfe1e5ddf801fe6481f7a7b10a320cee /src/map/script.c | |
parent | 835d55b07858202198564bc6c2ff0888a7f78d31 (diff) | |
download | hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.tar.gz hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.tar.bz2 hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.tar.xz hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.zip |
Quest Bubbles (Actually Works Finally)
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 80 |
1 files changed, 72 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c index 3c0742405..cf2ddd812 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15453,12 +15453,68 @@ BUILDIN(readbook) Questlog script commands *******************/ +BUILDIN(questinfo) +{ + struct npc_data *nd = map->id2nd(st->oid); + int quest, icon, job; + + if( nd == NULL ) + return true; + + quest = script_getnum(st, 2); + icon = script_getnum(st, 3); + + #if PACKETVER >= 20120410 + if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. + #else + if(icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; + #endif + + nd->quest.quest_id = quest; + nd->quest.icon = icon; + nd->quest.hasJob = false; + + if(script_hasdata(st, 4)) + { + job = script_getnum(st, 4); + + if (!pcdb_checkid(job)) + { + ShowError("questinfo: Nonexistant Job Class.\n"); + } + else + { + nd->quest.hasJob = true; + nd->quest.job = job; + } + } + + return true; +} + BUILDIN(setquest) { struct map_session_data *sd = script->rid2sd(st); + struct npc_data *nd = map->id2nd(st->oid); nullpo_retr(false,sd); + if (!nd) + return false; + quest->add(sd, script_getnum(st, 2)); + + // If questinfo is set, remove quest bubble once quest is set. + if(nd->quest.quest_id > 0) + #if PACKETVER >= 20120410 + clif->quest_show_event(sd, &nd->bl, 9999, 0); + #else + clif->quest_show_event(sd, &nd->bl, 0, 0); + #endif + return true; } @@ -15507,17 +15563,24 @@ BUILDIN(checkquest) BUILDIN(showevent) { TBL_PC *sd = script->rid2sd(st); struct npc_data *nd = map->id2nd(st->oid); - int state, color; + int icon; if( sd == NULL || nd == NULL ) return true; - state = script_getnum(st, 2); - color = script_getnum(st, 3); - - if( color < 0 || color > 3 ) - color = 0; // set default color + + icon = script_getnum(st, 2); + + #if PACKETVER >= 20120410 + if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. + #else + if(icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; + #endif - clif->quest_show_event(sd, &nd->bl, state, color); + clif->quest_show_event(sd, &nd->bl, icon, 0); return true; } @@ -18023,12 +18086,13 @@ void script_parse_builtin(void) { BUILDIN_DEF(useatcmd, "s"), //Quest Log System [Inkfish] + BUILDIN_DEF(questinfo, "ii?"), BUILDIN_DEF(setquest, "i"), BUILDIN_DEF(erasequest, "i"), BUILDIN_DEF(completequest, "i"), BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(changequest, "ii"), - BUILDIN_DEF(showevent, "ii"), + BUILDIN_DEF(showevent, "i"), /** * hQueue [Ind/Hercules] |