From 8bd89174dec604cd1b39fff4cefc642821bf20a9 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 17 Dec 2018 04:41:58 -0200 Subject: Extra helper for LoF Teleporter. Code simplified. --- npc/items/teleporter.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'npc/items/teleporter.txt') diff --git a/npc/items/teleporter.txt b/npc/items/teleporter.txt index 30a7a7ead..2b95adc0f 100644 --- a/npc/items/teleporter.txt +++ b/npc/items/teleporter.txt @@ -16,6 +16,12 @@ return (.@is_hurt && !.@is_town); } + // Calculate time remaining + // (time, .@x) + function loftel_time { + return gettimetick(2)+max((60*getarg(0))-(getarg(1)*60), 30); + } + L_Cooldown: mesn; mesc l("This teleporter is currently recharging."); @@ -63,19 +69,19 @@ OnUse: switch (@menu) { case 2: warp "017-1", 120, 89; - TELEPORTER_TIME=gettimetick(2)+max((60*50)-(.@x*60), 30); + TELEPORTER_TIME=loftel_time(50, .@x); break; case 3: warp "024-1", 155, 82; - TELEPORTER_TIME=gettimetick(2)+max((60*360)-(.@x*60), 30); + TELEPORTER_TIME=loftel_time(360, .@x); break; case 4: warp "009-1", 113, 91; - TELEPORTER_TIME=gettimetick(2)+max((60*360)-(.@x*60), 30); + TELEPORTER_TIME=loftel_time(360, .@x); break; case 5: warp "Save", 0, 0; - TELEPORTER_TIME=gettimetick(2)+max((60*30)-(.@x*60), 30); + TELEPORTER_TIME=loftel_time(30, .@x); break; } closedialog; -- cgit v1.2.3-70-g09d2