summaryrefslogtreecommitdiff
path: root/world/map
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-03-08 17:00:18 -0500
committerWushin <pasekei@gmail.com>2015-03-08 17:00:18 -0500
commita7e1ccc2e920ea97c7a0d44ae9ac100ef340a4bb (patch)
tree38ec097ec573e5f7943c707bc0c7a7b531ed5d57 /world/map
parentbd60b84b2262e55c4560eebf09e1c2eb2143c6fe (diff)
parent6e9142fdd1b7a186dc093640046883e9a02ea540 (diff)
downloadserverdata-a7e1ccc2e920ea97c7a0d44ae9ac100ef340a4bb.tar.gz
serverdata-a7e1ccc2e920ea97c7a0d44ae9ac100ef340a4bb.tar.bz2
serverdata-a7e1ccc2e920ea97c7a0d44ae9ac100ef340a4bb.tar.xz
serverdata-a7e1ccc2e920ea97c7a0d44ae9ac100ef340a4bb.zip
Merge pull request #292 from mekolat/time
All about time
Diffstat (limited to 'world/map')
-rw-r--r--world/map/npc/009-6/brodomir.txt9
-rw-r--r--world/map/npc/029-3/parua.txt8
-rw-r--r--world/map/npc/functions/time.txt57
-rw-r--r--world/map/npc/functions/travelers.txt7
-rw-r--r--world/map/npc/items/warpTowels.txt18
5 files changed, 78 insertions, 21 deletions
diff --git a/world/map/npc/009-6/brodomir.txt b/world/map/npc/009-6/brodomir.txt
index 9b7fa583..63bce759 100644
--- a/world/map/npc/009-6/brodomir.txt
+++ b/world/map/npc/009-6/brodomir.txt
@@ -146,13 +146,10 @@ L_Go:
goto L_Close;
L_Wait:
- set $@brodomir_seconds, ($@BRODOMIR_START_TIME - gettimetick(2));
+ set @ms, ($@BRODOMIR_START_TIME - gettimetick(2)) * 1000;
+ callfunc "HumanTime";
mes "[Brodomir]";
- if ($@brodomir_seconds/60 == 0)
- mes "\"Just a little longer. I will bring you there in " + $@brodomir_seconds + " seconds.\"";
- if ($@brodomir_seconds/60 > 0)
- mes "\"Just a little longer. I will bring you there in " + $@brodomir_seconds/60 + " minute(s).\"";
- set $@brodomir_seconds, 0;
+ mes "\"Just a little longer. I will bring you there in " + @time$ + ".\"";
goto L_Close;
OnTimer5000:
diff --git a/world/map/npc/029-3/parua.txt b/world/map/npc/029-3/parua.txt
index e3bb7bfa..f2aa728c 100644
--- a/world/map/npc/029-3/parua.txt
+++ b/world/map/npc/029-3/parua.txt
@@ -105,12 +105,10 @@ L_Enjoy:
goto L_Exit;
L_Wait:
- set @seconds, ($@ANNOUNCE_TIME - gettimetick(2));
+ set @ms, ($@ANNOUNCE_TIME - gettimetick(2)) * 1000;
+ callfunc "HumanTime";
mes "[Parua]";
- if (@seconds/60 == 0)
- mes "\"Be Patient... The fight will start in " + @seconds + " seconds.\"";
- if (@seconds/60 > 0)
- mes "\"Be Patient... The fight will start in " + @seconds/60 + " minute(s).\"";
+ mes "\"Be Patient... The fight will start in " + @time$ + ".\"";
goto L_Exit;
L_NotEnough:
diff --git a/world/map/npc/functions/time.txt b/world/map/npc/functions/time.txt
index 695c4cec..7d16a200 100644
--- a/world/map/npc/functions/time.txt
+++ b/world/map/npc/functions/time.txt
@@ -61,13 +61,20 @@ function|script|time_stamp
// HumanTime - returns a human-readable time
// author: meko
-// Variables:
+// Internal variables:
+// @separator$, @unit$, @unit2$, @unit3$, @unit4$, @unit5$
+// @seconds, @minutes, @hours, @days
+
+// Public Variables:
// input @ms integer
// output @time$ string
function|script|HumanTime
{
set @time$, "now";
+ if(@seconds) set @ms, @ms + (@seconds * 1000);
+ if(@minutes) set @ms, @ms + (@minutes * 60000);
+ if(@days) set @ms, @ms + (@days * 1440000);
if(@ms < 1000) goto L_Millis; // under 1 second we have nothing to count
set @seconds, @ms / 1000;
set @ms, @ms % 1000;
@@ -77,8 +84,11 @@ function|script|HumanTime
if(@minutes < 60) goto L_Minutes;
set @hours, @minutes / 60;
set @minutes, @minutes % 60;
- if(@hours < 60) goto L_Hours;
- return;
+ if(@hours < 24) goto L_Hours;
+ set @days, @hours / 24;
+ set @hours, @hours % 24;
+ if(@days) goto L_Days;
+ goto L_Clean;
L_Millis:
set @time$, @ms + "ms";
@@ -91,7 +101,7 @@ L_Seconds:
if(@ms > 1) set @unit2$, "milliseconds";
set @time$, @seconds + " " + @unit$;
if(@ms) set @time$, @time$ + " and " + @ms + " " + @unit2$;
- return;
+ goto L_Clean;
L_Minutes:
set @unit$, "minute";
@@ -105,7 +115,7 @@ L_Minutes:
if(@ms) set @separator$, ", ";
if(@seconds) set @time$, @time$ + @separator$ + @seconds + " " + @unit2$;
if(@ms) set @time$, @time$ + " and " + @ms + " " + @unit3$;
- return;
+ goto L_Clean;
L_Hours:
set @unit$, "hour";
@@ -124,5 +134,42 @@ L_Hours:
if(@ms) set @separator$, ", ";
if(@seconds) set @time$, @time$ + @separator$ + @seconds + " " + @unit3$;
if(@ms) set @time$, @time$ + " and " + @ms + " " + @unit4$;
+ goto L_Clean;
+
+L_Days:
+ set @unit$, "day";
+ if(@hours > 1) set @unit$, "days";
+ set @unit2$, "hour";
+ if(@hours > 1) set @unit2$, "hours";
+ set @unit3$, "minute";
+ if(@minutes > 1) set @unit3$, "minutes";
+ set @unit4$, "second";
+ if(@seconds > 1) set @unit4$, "seconds";
+ set @unit5$, "millisecond";
+ if(@ms > 1) set @unit5$, "milliseconds";
+ set @time$, @days + " " + @unit$;
+ set @separator$, " and ";
+ if(@minutes || @seconds || @ms) set @separator$, ", ";
+ if(@hours) set @time$, @time$ + @separator$ + @hours + " " + @unit2$;
+ set @separator$, " and ";
+ if(@seconds || @ms) set @separator$, ", ";
+ if(@minutes) set @time$, @time$ + @separator$ + @minutes + " " + @unit3$;
+ set @separator$, " and ";
+ if(@ms) set @separator$, ", ";
+ if(@seconds) set @time$, @time$ + @separator$ + @seconds + " " + @unit3$;
+ if(@ms) set @time$, @time$ + " and " + @ms + " " + @unit4$;
+ goto L_Clean;
+
+L_Clean:
+ set @unit$, "";
+ set @unit2$, "";
+ set @unit3$, "";
+ set @unit4$, "";
+ set @unit5$, "";
+ set @seconds, 0;
+ set @minutes, 0;
+ set @hours, 0;
+ set @days, 0;
+ set @separator$, "";
return;
}
diff --git a/world/map/npc/functions/travelers.txt b/world/map/npc/functions/travelers.txt
index a1db712e..07b084d9 100644
--- a/world/map/npc/functions/travelers.txt
+++ b/world/map/npc/functions/travelers.txt
@@ -189,6 +189,13 @@ L_TravelPachua:
set @NextLocationMap$, "006-1";
set @NextLocationX, 28;
set @NextLocationY, 97;
+ if(QUEST_MIRIAM_start != 0) goto L_Cheat;
+ goto L_TravelChecks;
+
+L_Cheat:
+ set QUEST_MIRIAM_cheat, 1;
+ set QUEST_MIRIAM_run, gettimetick(2) - QUEST_MIRIAM_start;
+ set QUEST_MIRIAM_start, 0;
goto L_TravelChecks;
L_TravelBarbarians:
diff --git a/world/map/npc/items/warpTowels.txt b/world/map/npc/items/warpTowels.txt
index 32a52aff..f586ed99 100644
--- a/world/map/npc/items/warpTowels.txt
+++ b/world/map/npc/items/warpTowels.txt
@@ -1,7 +1,8 @@
// See #TravelConfig
function|script|WarpTowel
{
- if (TowelLastUsed > (gettimetick(2) - 1800))
+ set @seconds, TowelLastUsed - (gettimetick(2) - 1800);
+ if (@seconds > 0)
goto L_DontPanic;
if (isin("botcheck",25,27,51,47))
goto L_Prison;
@@ -102,6 +103,13 @@ L_Lime:
set @NextLocationMap$, "006-1";
set @NextLocationX, 28;
set @NextLocationY, 97;
+ if(QUEST_MIRIAM_start != 0) goto L_Cheat;
+ goto L_WarpPlayer;
+
+L_Cheat:
+ set QUEST_MIRIAM_cheat, 1;
+ set QUEST_MIRIAM_run, gettimetick(2) - QUEST_MIRIAM_start;
+ set QUEST_MIRIAM_start, 0;
goto L_WarpPlayer;
L_Save:
@@ -123,15 +131,16 @@ L_BreakChance:
goto L_End;
L_Forbid:
- message strcharinfo(0), "This area is protected by a force that doesn't tolerate the power of the Towel.";
+ message strcharinfo(0), "##1Towel : This area is protected by a force that doesn't tolerate the power of the Towel.";
goto L_Keep;
L_Prison:
- message strcharinfo(0), "You must be warped by a GM to leave the botcheck area.";
+ message strcharinfo(0), "##1Towel : You must be warped by a GM to leave the botcheck area.";
goto L_Keep;
L_DontPanic:
- message strcharinfo(0), "Your towel is still too low on power to jump again.";
+ callfunc "HumanTime";
+ message strcharinfo(0), "##3Towel : Your towel is still too low on power to jump again. Try again in ##B"+ @time$ + "##b.";
goto L_Keep;
L_Keep:
@@ -168,4 +177,3 @@ L_Return:
cleararray $@warpTowels$, "", getarraysize($@warpTowels$);
return;
}
-