From a85d79c9397ec32b5bbd4e8b3d2fb6ff1f29cf39 Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 3 Mar 2015 15:55:56 -0500 Subject: improve humantime --- world/map/npc/functions/time.txt | 57 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'world/map/npc') 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; } -- cgit v1.2.3-60-g2f50 From ba62260c2e047662062a6bb69961004d59abf1eb Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 2 Mar 2015 15:02:29 -0500 Subject: Use HumanTime for Parua --- world/map/npc/029-3/parua.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'world/map/npc') diff --git a/world/map/npc/029-3/parua.txt b/world/map/npc/029-3/parua.txt index 59e0c8b6..b9972f53 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: -- cgit v1.2.3-60-g2f50 From 42e418d881029a97d40ce959c1758e56f28c18a5 Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 2 Mar 2015 15:06:33 -0500 Subject: Use HumanTime for Brodomir --- world/map/npc/009-6/brodomir.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'world/map/npc') diff --git a/world/map/npc/009-6/brodomir.txt b/world/map/npc/009-6/brodomir.txt index 9b2c55d5..21d14fb7 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: -- cgit v1.2.3-60-g2f50 From 423b4cfe8b68db524d6e12940a9dba7f8e962efa Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 3 Mar 2015 14:28:11 -0500 Subject: Add cooldown to towel message --- world/map/npc/items/warpTowels.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'world/map/npc') diff --git a/world/map/npc/items/warpTowels.txt b/world/map/npc/items/warpTowels.txt index 32a52aff..3783113a 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; @@ -123,15 +124,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 +170,3 @@ L_Return: cleararray $@warpTowels$, "", getarraysize($@warpTowels$); return; } - -- cgit v1.2.3-60-g2f50 From 6e9142fdd1b7a186dc093640046883e9a02ea540 Mon Sep 17 00:00:00 2001 From: alexanderlime Date: Thu, 5 Mar 2015 09:31:34 -0500 Subject: Fix lime towel exploit fix traveller exploit --- world/map/npc/functions/travelers.txt | 7 +++++++ world/map/npc/items/warpTowels.txt | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'world/map/npc') 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 3783113a..f586ed99 100644 --- a/world/map/npc/items/warpTowels.txt +++ b/world/map/npc/items/warpTowels.txt @@ -103,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: -- cgit v1.2.3-60-g2f50