summaryrefslogtreecommitdiff
path: root/npc/items/lofteleporter.txt
blob: 1e2f8e8899fa7d09b9e07071de701ef7292ff26b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// TMW2 scripts.
// Authors:
//    Pyndragon
//    Jesusalva
// Description:
//    Hand Teleporter (also saves coordinates - @memo)

-	script	LoF Teleporter	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:
    mesn;
    mesc l("This teleporter is currently recharging.");
    mesc l("You can use it again in @@.", FuzzyTime(TELEPORTER_TIME));
    close;

OnUse:
    if (TELEPORTER_TIME > gettimetick(2))
        goto L_Cooldown;
    if (readparam(Hp) < readparam(MaxHp)) {
        dispbottom l("You are hurt, and cannot use this.");
        end;
    }
    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(15, countitem(TimeFlask)-1); // up to 10 minutes reduction from quests, and 15 from time flasks

    select
        l("Don't warp"),
        l("Land Of Fire Village (@@m)", 35-.@x),
        l("Tulimshar (@@m)", 35-.@x),
        rif(TELEPORTERS & TP_FROST, l("Frostia (@@m)", 120-.@x)),
        rif(TELEPORTERS & TP_HALIN, l("Halinarzo (@@m)", 120-.@x)),
        rif(TELEPORTERS & TP_LILIT, l("Lilit (@@m)", 150-.@x)),
        rif(GSET_SOULMENHIR_MANUAL, l("Save Point (@@m)", 30-.@x)),
        rif(getq(LoFQuest_EPISODE) >= 15, l("200 years ago, The Great Fire (%dm)", 360-(.@x*2)));

    if (@menu == 1)
        close;

    switch (@menu) {
        case 1:
    }
    if (loftel_check()) {
        dispbottom l("You are hurt, and cannot use this.");
    }
    sshake();
    switch (@menu) {
        case 2:
            warp "017-1", 120, 89;
            TELEPORTER_TIME=loftel_time(35, .@x);
            EnterTown("LoF");
            @timer_navio_running=0;
            break;
        case 3:
            warp "003-1", 41, 49;
            TELEPORTER_TIME=loftel_time(35, .@x);
            EnterTown("Tulim");
            @timer_navio_running=0;
            break;
        case 4:
            warp "024-1", 155, 82;
            TELEPORTER_TIME=loftel_time(120, .@x);
            EnterTown("Frostia");
            @timer_navio_running=0;
            break;
        case 5:
            warp "009-1", 113, 91;
            TELEPORTER_TIME=loftel_time(120, .@x);
            EnterTown("Halin");
            @timer_navio_running=0;
            break;
        case 6:
            warp "018-5", 111, 53;
            TELEPORTER_TIME=loftel_time(150, .@x);
            EnterTown("Lilit");
            @timer_navio_running=0;
            break;
        case 7:
            TELEPORTER_TIME=loftel_time(30, .@x);
            //EnterTown("Save");
            teleporthome();
            @timer_navio_running=0;
            break;
        case 8:
            //atcommand("@block "+strcharinfo(0));
            // Reset your bank savings (temporary)
            #MerchantBank=BankVault;
            BankVault=0;
            setq2 LoFQuest_EPISODE, 0;
            setq3 LoFQuest_EPISODE, 0;
            warp "032-1", 23, 25;
            TELEPORTER_TIME=loftel_time(360, .@x*2);
            @timer_navio_running=0;
            break;
    }
    closedialog;
    end;
}