summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--db/packet_db.txt2
-rw-r--r--src/map/clif.c34
-rw-r--r--src/map/clif.h3
-rw-r--r--src/map/pc.h5
-rw-r--r--src/map/script.c25
6 files changed, 69 insertions, 2 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 0e6bf9ee4..0c318bc97 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,8 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+09/08/25
+ * Implemented Progress Bar.(topic:207933) [Inkfish]
09/08/21
* Fixed Teleport through Hocus-Pocus skips menu. (bugreport:3513) [Inkfish]
09/08/20
diff --git a/db/packet_db.txt b/db/packet_db.txt
index 560768b88..d91d2488d 100644
--- a/db/packet_db.txt
+++ b/db/packet_db.txt
@@ -1083,7 +1083,7 @@ packet_ver: 22
0x02bf,0
0x02c0,0
0x02f0,10
-0x02f1,2
+0x02f1,2,progressbar,0
0x02f2,2
//2008-03-25bSakexe
diff --git a/src/map/clif.c b/src/map/clif.c
index 14f7730ac..a3f9968e2 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8267,6 +8267,35 @@ void clif_parse_Hotkey(int fd, struct map_session_data *sd) {
#endif
}
+void clif_progressbar(struct map_session_data * sd, unsigned long color, unsigned int second)
+{
+ int fd = sd->fd;
+
+ WFIFOHEAD(fd,packet_len(0x2f0));
+ WFIFOW(fd,0) = 0x2f0;
+ WFIFOL(fd,2) = color;
+ WFIFOL(fd,6) = second;
+ WFIFOSET(fd,packet_len(0x2f0));
+}
+
+void clif_progressbar_abort(struct map_session_data * sd)
+{
+ int fd = sd->fd;
+
+ WFIFOHEAD(fd,packet_len(0x2f2));
+ WFIFOW(fd,0) = 0x2f2;
+ WFIFOSET(fd,packet_len(0x2f2));
+}
+
+void clif_parse_progressbar(int fd, struct map_session_data * sd)
+{
+ if( gettick() < sd->progressbar.timeout && sd->st )
+ sd->st->state = END;
+
+ npc_scriptcont(sd, sd->progressbar.npc_id);
+ sd->progressbar.npc_id = sd->progressbar.timeout = 0;
+}
+
/*==========================================
*
*------------------------------------------*/
@@ -8282,6 +8311,8 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
if (sd->sc.opt1 && sd->sc.opt1 == OPT1_STONEWAIT)
; //You CAN walk on this OPT1 value.
+ else if( sd->progressbar.npc_id )
+ clif_progressbar_abort(sd);
else if (pc_cant_act(sd))
return;
@@ -13438,7 +13469,7 @@ static int packetdb_readdb(void)
0, 0, 0, 0, 0, 30, 0, 0, 0, 3, 0, 65, 4, 71, 10, 0,
0, 0, 0, 0, 0, 0, 6, -1, 10, 10, 3, 0, -1, 32, 6, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 10, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x0300
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -13657,6 +13688,7 @@ static int packetdb_readdb(void)
{clif_parse_EquipTick,"equiptickbox"},
{clif_parse_BattleChat,"battlechat"},
{clif_parse_mercenary_action,"mermenu"},
+ {clif_parse_progressbar,"progressbar"},
{NULL,NULL}
};
diff --git a/src/map/clif.h b/src/map/clif.h
index bde6e2e83..30491ec4c 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -482,4 +482,7 @@ void clif_readbook(int fd, int book_id, int page);
// Show Picker
void clif_party_show_picker(struct map_session_data * sd, struct item * item_data);
+// Progress Bar [Inkfish]
+void clif_progressbar(struct map_session_data * sd, unsigned long color, unsigned int second);
+
#endif /* _CLIF_H_ */
diff --git a/src/map/pc.h b/src/map/pc.h
index c1102d514..18f8f978e 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -171,6 +171,11 @@ struct map_session_data {
time_t idletime;
struct{
+ int npc_id;
+ unsigned int timeout;
+ } progressbar; //Progress Bar [Inkfish]
+
+ struct{
char name[NAME_LENGTH];
} ignore[MAX_IGNORE_LIST];
diff --git a/src/map/script.c b/src/map/script.c
index ba2c9dc51..6597b3eae 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14101,6 +14101,30 @@ BUILDIN_FUNC(areamobuseskill)
return 0;
}
+
+BUILDIN_FUNC(progressbar)
+{
+#if PACKETVER >= 20080318
+ struct map_session_data * sd = script_rid2sd(st);
+ const char * color;
+ unsigned int second;
+
+ if( !st || !sd )
+ return 0;
+
+ st->state = STOP;
+
+ color = script_getstr(st,2);
+ second = script_getnum(st,3);
+
+ sd->progressbar.npc_id = st->oid;
+ sd->progressbar.timeout = gettick() + second*1000;
+
+ clif_progressbar(sd, strtol(color, (char **)NULL, 0), second);
+#endif
+ return 0;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
BUILDIN_FUNC(defpattern);
@@ -14456,6 +14480,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(readbook,"ii"),
BUILDIN_DEF(setfont,"i"),
BUILDIN_DEF(areamobuseskill,"siiiiviiiii"),
+ BUILDIN_DEF(progressbar, "si"),
// WoE SE
BUILDIN_DEF(agitstart2,""),
BUILDIN_DEF(agitend2,""),