|
@@ -20264,7 +20264,10 @@ BUILDIN_FUNC(areamobuseskill)
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+/**
|
|
|
+ * Display a progress bar above a character
|
|
|
+ * progressbar "<color>",<seconds>;
|
|
|
+ */
|
|
|
BUILDIN_FUNC(progressbar)
|
|
|
{
|
|
|
struct map_session_data * sd;
|
|
@@ -20287,6 +20290,60 @@ BUILDIN_FUNC(progressbar)
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Display a progress bar above an NPC
|
|
|
+ * progressbar_npc "<color>",<seconds>{,<"NPC Name">};
|
|
|
+ */
|
|
|
+BUILDIN_FUNC(progressbar_npc){
|
|
|
+ struct npc_data* nd = NULL;
|
|
|
+
|
|
|
+ if( script_hasdata(st, 4) ){
|
|
|
+ const char* name = script_getstr(st, 4);
|
|
|
+
|
|
|
+ nd = npc_name2id(name);
|
|
|
+
|
|
|
+ if( !nd ){
|
|
|
+ ShowError( "buildin_progressbar_npc: NPC \"%s\" was not found.\n", name );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ nd = map_id2nd(st->oid);
|
|
|
+ }
|
|
|
+
|
|
|
+ // First call(by function call)
|
|
|
+ if( !nd->progressbar.timeout ){
|
|
|
+ const char *color;
|
|
|
+ int second;
|
|
|
+
|
|
|
+ color = script_getstr(st, 2);
|
|
|
+ second = script_getnum(st, 3);
|
|
|
+
|
|
|
+ if( second < 0 ){
|
|
|
+ ShowError( "buildin_progressbar_npc: negative amount('%d') of seconds is not supported\n", second );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
+ // detach the player
|
|
|
+ script_detach_rid(st);
|
|
|
+
|
|
|
+ // sleep for the target amount of time
|
|
|
+ st->state = RERUNLINE;
|
|
|
+ st->sleep.tick = second * 1000;
|
|
|
+ nd->progressbar.timeout = gettick() + second * 1000;
|
|
|
+ nd->progressbar.color = strtol(color, (char **)NULL, 0);
|
|
|
+
|
|
|
+ clif_progressbar_npc_area(nd);
|
|
|
+ // Second call(by timer after sleeping time is over)
|
|
|
+ } else {
|
|
|
+ // Continue the script
|
|
|
+ st->state = RUN;
|
|
|
+ st->sleep.tick = 0;
|
|
|
+ nd->progressbar.timeout = nd->progressbar.color = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return SCRIPT_CMD_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
BUILDIN_FUNC(pushpc)
|
|
|
{
|
|
|
uint8 dir;
|
|
@@ -23636,6 +23693,7 @@ struct script_function buildin_func[] = {
|
|
|
BUILDIN_DEF(setfont,"i"),
|
|
|
BUILDIN_DEF(areamobuseskill,"siiiiviiiii"),
|
|
|
BUILDIN_DEF(progressbar,"si"),
|
|
|
+ BUILDIN_DEF(progressbar_npc, "si?"),
|
|
|
BUILDIN_DEF(pushpc,"ii"),
|
|
|
BUILDIN_DEF(buyingstore,"i"),
|
|
|
BUILDIN_DEF(searchstores,"ii"),
|