summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorKisuka <kisuka@kisuka.com>2013-10-24 07:03:46 -0700
committerKisuka <kisuka@kisuka.com>2013-10-24 07:03:46 -0700
commit94b7b25456aa8a9de1e0f2a147d58dba6e5976dd (patch)
tree09d5b126dfe1e5ddf801fe6481f7a7b10a320cee /src/map
parent835d55b07858202198564bc6c2ff0888a7f78d31 (diff)
downloadhercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.tar.gz
hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.tar.bz2
hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.tar.xz
hercules-94b7b25456aa8a9de1e0f2a147d58dba6e5976dd.zip
Quest Bubbles (Actually Works Finally)
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c27
-rw-r--r--src/map/npc.h6
-rw-r--r--src/map/script.c80
3 files changed, 104 insertions, 9 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 9c740d607..3dba530f4 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9316,6 +9316,8 @@ void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
/// Notification from the client, that it has finished map loading and is about to display player's character (CZ_NOTIFY_ACTORINIT).
/// 007d
void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
+ int i;
+
if(sd->bl.prev != NULL)
return;
@@ -9624,10 +9626,33 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
skill->usave_trigger(sd);
}
-// Trigger skill effects if you appear standing on them
+ // Trigger skill effects if you appear standing on them
if(!battle_config.pc_invincible_time)
skill->unit_move(&sd->bl,timer->gettick(),1);
+ // NPC Quest / Event Icon Check [Kisuka]
+ #if PACKETVER >= 20090218
+ for(i = 0; i < map->list[sd->bl.m].npc_num; i++) {
+ TBL_NPC *nd = map->list[sd->bl.m].npc[i];
+
+ // Make sure NPC exists and is not a warp
+ if(nd != NULL)
+ {
+ // Check if NPC has quest attached to it
+ if(nd->quest.quest_id > 0)
+ if(quest->check(sd, nd->quest.quest_id, HAVEQUEST) == -1) // Check if quest is not started
+ // Check if quest is job-specific, check is user is said job class.
+ if(nd->quest.hasJob == true)
+ {
+ if(sd->class_ == nd->quest.job)
+ clif->quest_show_event(sd, &nd->bl, nd->quest.icon, 0);
+ }
+ else {
+ clif->quest_show_event(sd, &nd->bl, nd->quest.icon, 0);
+ }
+ }
+ }
+ #endif
}
diff --git a/src/map/npc.h b/src/map/npc.h
index f809cb19c..c9184b22d 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -48,6 +48,12 @@ struct npc_data {
char* path;/* path dir */
enum npc_subtype subtype;
int src_id;
+ struct {
+ int icon;
+ int quest_id;
+ bool hasJob;
+ int job;
+ } quest;
union {
struct {
struct script_code *script;
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]