diff options
-rw-r--r-- | db/re/item_db.conf | 56 | ||||
-rw-r--r-- | npc/000-1/exit.txt | 6 | ||||
-rw-r--r-- | npc/items/teleporter.txt | 102 |
3 files changed, 92 insertions, 72 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf index aad9c430b..45d4ca861 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -3157,6 +3157,62 @@ item_db: ( doevent "inc_sc_bonus::OnUse"; "> }, +// 670 broken wc is an exception to the ID rule (BECAUSE I CAN AND WANT) +{ + Id: 670 + AegisName: "BrokenWarpCrystal" + Name: "Broken Warp Crystal" + Type: "IT_ETC" + Buy: 0 + Sell: 0 + Weight: 40 + Refine: false +}, +{ + Id: 671 + AegisName: "TulimWarpCrystal" + Name: "Tulim Warp Crystal" + Type: "IT_USABLE" + Buy: 0 + Sell: 0 + Weight: 40 + Delay: 500 + Script: <" + @dest$="Tulim"; + @itemid=671; + doevent "Warp Crystal::OnUse"; + "> +}, +{ + Id: 672 + AegisName: "HalinWarpCrystal" + Name: "Halin Warp Crystal" + Type: "IT_USABLE" + Buy: 0 + Sell: 0 + Weight: 40 + Delay: 500 + Script: <" + @dest$="Halin"; + @itemid=672; + doevent "Warp Crystal::OnUse"; + "> +}, +{ + Id: 673 + AegisName: "HurnsWarpCrystal" + Name: "Hurns Warp Crystal" + Type: "IT_USABLE" + Buy: 0 + Sell: 0 + Weight: 40 + Delay: 500 + Script: <" + @dest$="Hurns"; + @itemid=673; + doevent "Warp Crystal::OnUse"; + "> +}, // Mounts (690 to 699, probably there will be extra IDs) { diff --git a/npc/000-1/exit.txt b/npc/000-1/exit.txt index b32e22548..fa80138f3 100644 --- a/npc/000-1/exit.txt +++ b/npc/000-1/exit.txt @@ -34,6 +34,12 @@ OnSetLX: savepoint .LOCMASTER_MAP$[@lx], .LOCMASTER_X[@lx], .LOCMASTER_Y[@lx]; end; +// Warp you according to LX +OnVisitLX: + @lx=array_find(.LOCMASTER_LOC$, LOCATION$); + warp .LOCMASTER_MAP$[@lx], .LOCMASTER_X[@lx], .LOCMASTER_Y[@lx]; + end; + OnInit: setarray .LOCMASTER_LOC$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia"; setarray .LOCMASTER_MAP$, "005-1", "003-1", "009-1", "012-1", "017-1", "018-5", "020-1", "024-1"; diff --git a/npc/items/teleporter.txt b/npc/items/teleporter.txt index 7c5ad6c4f..887121a98 100644 --- a/npc/items/teleporter.txt +++ b/npc/items/teleporter.txt @@ -8,86 +8,44 @@ - script Warp Crystal NPC_HIDDEN,{ close; - // Checks if you can warp - function loftel_check { - getmapxy(.@m$, .@x, .@y, 0); - .@is_hurt=(readparam(Hp) < readparam(MaxHp)*9/10); // <90% hp - .@is_town=(getmapflag(.@m$, mf_town)); - 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: +function Cooldown { mesn; - mesc l("This teleporter is currently recharging."); + mesc l("Successive warps cause time-space distortions and thus, are not allowed."); mesc l("You can use it again in @@.", FuzzyTime(TELEPORTER_TIME)); + getitem @itemid, 1; close; +} + +function ReturnItem { + getitem @itemid, 1; + end; +} OnUse: + // Receives @dest$ if (TELEPORTER_TIME > gettimetick(2)) - goto L_Cooldown; - if (readparam(Hp) < readparam(MaxHp)) { - dispbottom l("You are hurt, and cannot use this."); - end; - } + Cooldown(); if (BaseLevel < 20) { dispbottom l("This is too powerful to you. Get level 20 before attempting to use."); - end; - } - - mesn; - mesc l("Ozthokk, a great sage from the Land Of Fire, holds secrets of time and space travel."); - mesc l("This is not magic, it is science!"); - mes ""; - mesc l("PS. Additional reagents may be required for warps."); - next; - - .@x=(reputation("LoF")/10)+min(10, countitem(TimeFlask)-1); // up to 10 minutes reduction from quests, and 10 from time flasks - - select - l("Don't warp"), - l("Land Of Fire Village (@@m)", 50-.@x), - rif(TELEPORTERS & TP_FROST, l("Frostia (@@m)", 360-.@x)), - rif(TELEPORTERS & TP_HALIN, l("Halinarzo (@@m)", 360-.@x)), - l("Save Point (@@m)", 30-.@x); - - if (@menu == 1) - close; - - switch (@menu) { - case 1: - } - if (loftel_check()) { - dispbottom l("You are hurt, and cannot use this."); - } - doevent "shake::OnGM"; - switch (@menu) { - case 2: - warp "017-1", 120, 89; - TELEPORTER_TIME=loftel_time(50, .@x); - LOCATION$="LoF"; - break; - case 3: - warp "024-1", 155, 82; - TELEPORTER_TIME=loftel_time(360, .@x); - LOCATION$="Frostia"; - break; - case 4: - warp "009-1", 113, 91; - TELEPORTER_TIME=loftel_time(360, .@x); - LOCATION$="Halin"; - break; - case 5: - warp "Save", 0, 0; - TELEPORTER_TIME=loftel_time(30, .@x); - LOCATION$="Save"; - break; + ReturnItem(); } - closedialog; + // TODO: Are you already at target point? + + // It have at least 30% chance to break + // Chances begin at 100%, and lower in 0.01% each second + // It will never be below 30%, which happens after 7000 seconds + .@adj_breakrate=max(3000, 10000-(gettimetick(2)-TELEPORTER_TIME) ); + debugmes "Adjusted break ratio: %d", .@adj_breakrate; + if (rand(0,10000) > .@adj_breakrate) + getitem @itemid, 1; + else + getitem BrokenWarpCrystal, 1; + + // Apply Cooldown, same variable as LoF Teleporter + TELEPORTER_TIME=gettimetick(2)+300; + + // Save new location and warp you there + EnterTown(@dest$); + doevent "Emergency Exit::OnVisitLX"; end; } |