summaryrefslogtreecommitdiff
path: root/npc/003-1/quirino.txt
blob: 3a77872c529c85e51b5bd043e263a17a770c9c4a (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
// TMW2 Script
// Author:
//    Ernando <ernando.quirino@hotmail.com> (Creator)
//    Jesusalva <admin@tmw2.org>
// Description:
//    Hunger Games™ version for The Mana World Brazil v2, created by Ernando Quirino.
//    Entrance to Hungry Quirin Arena
// Variables:
//      EQ - Ernando Quirino
//      $@EQ_TIMER
//          < gettimetick(2): Can be open!
//          > gettimetick(2): Registration open!
//          = gettimetick(2): Event start!
//      $@EQ_STATUS
//          0: Register open
//          1: Fight happening
//          2: Event finished

003-1,48,73,0	script	Quirin	NPC_ERNANDO,{
    function quirinInfo;
    function quirinHonor;
    if (is_admin())
            goto L_Hub;

    if ($@EQ_STATUS) goto L_NoSeason;
    if ($@EQ_STATUS == 0) {
        if ($@EQ_TIMER < gettimetick(2))
            goto L_Hub;
        else
            goto L_Register;
    }

    npctalk3 l("Bug, report me!");
    end;

L_NoSeason:
    // If it finished, it can be done again in one hour
    if ($@EQ_STATUS == 2) {
        if ($@EQ_TIMER+3600 < gettimetick(2)) {
            $@EQ_STATUS=0;
            npctalkonce l("A sec... And... Done! I just finished cleaning it up!");
        } else {
            npctalkonce l("I'm currently cleaning the arena, wait just @@ more.", FuzzyTime($@EQ_TIMER+3600));
        }
    } else {
        npctalkonce l("I'm currently hosting a fight.");
    }
    end;

L_Register:
    mesn;
    mesq l("Hello player, do you want to participate on HUNGRY QUIRIN event?!");
    if ($@EQ_TIMER+180 < gettimetick(2))
        mesc l("Event will start in @@", FuzzyTime($@EQ_TIMER));
    else
        mesc l("Event will start in @@", FuzzyTime($@EQ_TIMER)), 1;
    next;
    select
        l("Yeah, sign me up!"),
        l("No, not at the moment."),
        l("Does it counts to Honor Ranking?"),
        l("You are holding a few items of mine..."),
        l("Information");

    switch (@menu) {
    case 1:
        goto L_SignUp;
    case 2:
        close;
    case 3:
        quirinHonor();
        break;
    case 4:
        openstorage(2, STORAGE_ACCESS_GET);
        closeclientdialog;
        close;
        break;
    case 5:
        quirinInfo();
    }
    goto L_Register;

function quirinInfo {
    mesn col(l("Hungry Quirin Arena Rules"), 3);
    mesc l("1- You must not be carrying anything with you.");
    mesc l("2- You must not use a cart. If you do, YOU WILL BE SEVERELY PENALIZED.");
    mesc l("3- All items from the Arena are from the Arena. You won't carry any of them back with you.");
    mesc l("4- Experience and Gold earned during this event can be kept.");
    next;
    mesn col(l("Hungry Quirin Arena Information"), 3);
    mesc l("1- Survive. If you die, you will gain nothing. And people want to kill you.");
    mesc l("2- Take everything you can find. You'll be warped without equip or healing items! Kill monsters to get some stuff too!");
    mesc l("3- Trust nobody. There can be only one winner, and it must be you.");
    mesc l("4- Take Care. Wildlife can kill you too. There can be traps.");
    mesc l("5- Trust yourself. You will lose the moment you enter in panic. This arena is not for the weak-willed!");
    next;
    return;
}

function quirinHonor {
    mesn;
    mesq l("Of course it does. And the same level rules applies.");
    next;
    mesn;
    mesq l("But if you believe in such cool challenge like mine there should be no dishonorable fight, comment it on Discord!");
    next;
    mesn;
    mesq l("And it might be changed in a future patch %%g");
    tutmes l("If you kill an opponent stronger than you, you will gain honor points. But if the oponent is 15 levels weaker than you, it will be NEGATIVE!"), l("About Scoreboards and Honor Points");
    tutmes l("If you kill the same person within 30 minutes, honor will not fluctuate. The whole honor system is very experimental."), l("About Scoreboards and Honor Points");
    next;
    return;
}

L_SignUp:
    // Player cannot be carrying anything
	if(Weight >= 1) goto L_Full;
    getcartinventorylist();
	if(@cartinventorylist_count>=1) goto L_Full;

    // Warp player
    if (rand2(1,2) == 1)
        warp "001-8", rand2(42, 57), 42;
    else
        warp "001-8", rand2(42, 57), 57;

    // Prevent further movements!
    setpcblock(PCBLOCK_SOFT, true);
    //dispbottom l("Stay ready!");
    dispbottom l("##1DON'T MOVE until the signal. Stay ready! If you move, you will desync client!");
    close;

L_Full:
    mesn;
    mesq l("You cannot bring anything to the arena. Please put everything on the storage.");
    next;
    mesn;
    mesq l("I can do that for you, but you'll still need to go to storage to get them back.");
    next;
    select
        l("Off to storage I go."),
        l("PLEASE STORE ALL MY ITEMS"),
        l("Alright, I don't like PVP anyways...");
    mes "";
    if (@menu == 2) {
        closeclientdialog;
        charcommand("@storeall 2");
        if (Weight == 0)
            goto L_SignUp;
    }
    close;

L_Hub:
    mesn;
    mesc l("Welcome to HUNGRY QUIRIN ARENA mangment panel.");
    next;
    mesn;
    mesq l("I am Quirino Voraz, and my arena is the coolest PVP Arena on all Mana Worlds.");
    mesq l("However, I need a tax to start, and you need to arrange players. There are no refunds.");
    next;
    mes l("Current player count: @@/5 must be online.", getusers(1));
    mes l("Current arena player count: @@ on map. (Min. 3 to begin event)", getmapusers("001-8"));

    // Open event? Minimum 5 connections or GM_OVERRIDE flag.
    if ($@EQ_TIMER < gettimetick(2) && !$@EQ_STATUS && (getusers(1) >= 5 || $@GM_OVERRIDE)) {
        next;
        mesc l("Activate event?"), 1;
        mesc l("It'll cost @@ GP", .price);
        if (Zeny < .price)
            close;
        menuint
            l("NO"), -1,
            l("Give players 5 minutes"), 300,
            l("Give players 10 minutes"), 600,
            l("Give players 15 minutes"), 900,
            l("Give players 20 minutes"), 1200,
            l("Give players 25 minutes"), 1500,
            l("Give players 30 minutes"), 1800,
            l("NO"), -1;
        mes "";
        if (@menuret > 0) {
            Zeny=Zeny-.price;
            $@EQ_TIMER=gettimetick(2)+@menuret;
            initnpctimer;
            setcells "001-8", 41, 58, 41, 43, 6, "qhubN";
            setcells "001-8", 41, 58, 56, 58, 6, "qhubS";
            announce("##1HUNGRY QUIRIN EVENT: ##3##BRegister is now open! Talk to Quirin, on Tulimshar Councilroom!", bc_all|bc_npc);
            channelmes("#world", strcharinfo(0)+" invites everyone to HUNGER QUIRIN PVP ARENA in Tulimshar. It'll start in "+FuzzyTime($@EQ_TIMER));
        }
        close;
    }

    // Main Control menu. Not using l() on purpose.

    select
        rif($@EQ_STATUS == 0 && (getmapusers("001-8") >= 3 || $@GM_OVERRIDE) && is_admin(), "Start Event at once!"),
        rif($@EQ_STATUS == 1 && is_admin(), "Send wave of items and monsters!"),
        rif($@EQ_STATUS == 0 && $@GM_OVERRIDE && is_admin(), "[DEBUG] Join Event"),
        rif($@EQ_STATUS == 0 && $@GM_OVERRIDE && is_admin(), "[DEBUG] Join & Start Event Now"),
        "I'm done.";

    if (@menu == 1)
        donpcevent("#QuirinoHUB::OnStart");
    if (@menu == 2)
        donpcevent("#QuirinoHUB::OnSendWave");
    if (@menu == 3)
        goto L_Register;
    if (@menu == 4) {
        addtimer 1000, "Quirin::OnDebugReg";
        goto L_SignUp;
    }

    close;

OnDebugReg:
    donpcevent("#QuirinoHUB::OnStart");
    end;

// Each minute
OnTimer60000:
    // We must autostart event now
    if ($@EQ_TIMER <= gettimetick(2)) {
        if (getmapusers("001-8") >= 3 || $@GM_OVERRIDE) {
            donpcevent("#QuirinoHUB::OnStart");
        } else {
            delcells "qhubN";
            delcells "qhubS";
            maptimer("001-8", 1000, "#QuirinoHUB::OnCancel");
            announce("##1HUNGRY QUIRIN EVENT: ##3##BCancelled due lack of players!", bc_all|bc_npc);
        }
        end;
    }
    mapannounce "003-1", "Hungry Quirin starts in " + FuzzyTime($@EQ_TIMER) + " and there are " + getmapusers("001-8") + "/3 player(s) standing by." , 0;
    mapannounce "001-8", "Hungry Quirin starts in " + FuzzyTime($@EQ_TIMER), 0;
    initnpctimer;
    end;

OnInit:
    .price=570;
    .sex=G_MALE;
    .distance=5;
    end;
}


/*
Blockwalls TileCondition and masks for setcells
manaplus/src/enums/resources/map/blockmask.h

        WALL        = 0x80,  // 1000 0000 = 128
        AIR         = 0x04,  // 0000 0100 = 4
        WATER       = 0x08,  // 0000 1000 = 8
        GROUND      = 0x10,  // 0001 0000 = 16
        GROUNDTOP   = 0x20,  // 0010 0000 = 32
        PLAYERWALL  = 0x40,  // 0100 0000 = 64
        MONSTERWALL = 0x02   // 0000 0010 = 2
*/