summaryrefslogtreecommitdiff
path: root/world/map/npc/009-6/brodomir.txt
blob: c27433668c69ae0503140e1cf48270a6987e0e8c (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
// Last Man Standing PvP Event NPC
// Authors: tux9th, Jenalya
// many thanks to Jenalaya, o11c, Ablu :)
//  CAVE: this script requires a patch by o11c that makes it possible for
//  getareausers to check if players are alive or dead.

// Global Variables:
// $@BRODOMIR_PVP_STATUS:
//      1 if players are waiting to be warped into the fight cave
//      2 if fight is in progress
// $@BRODOMIR_START_TIME:
//      time when the players will be warped into the fight cave
// $@BRODOMIR_PLAYERS: number of players taking part in the event

// $@BRODOMIR_ITEM$: Item that was given by the sponsor as price
// $@BRODOMIR_ITEM_AMOUNT: Amount of price items
// $@BRODOMIR_SPONSOR: player ID of sponsor that gave the item

// $@BRODOMIR_MONEY: Amount of money given by the sponsor

009-6.gat,36,40,0|script|Brodomir|116,{
    set @brodomir_money, 0;
    set @brodomir_item_amount, 0;
    set @brodomir_item$, "";

    if ($@BRODOMIR_PVP_STATUS == 2)
        goto L_Alreadystarted;
    if ($@BRODOMIR_PVP_STATUS == 1)
        goto L_Wait;
    mes "[Brodomir]";
    mes "\"Hi Warrior.\"";
    mes "\"Do you know me? I'm pretty old and I have never been good with faces?\"";
    menu
        "Yes of course! Don't you remember me?", L_Shorttalk,
        "No, who are you?", L_Longtalk,
        "I don't want to know you!", L_Close;

L_Longtalk:
    mes "[Brodomir]";
    mes "\"I'm Brodomir\"";
    mes "Brodomir sighs.";
    mes "\"Once I as well was a powerful warrior. It's been quite a while. But before that I was a miner in Tonori. I can still remember it very good. The Earth was shaking for hours and everything was torn apart. Many many of my friends and beloved ones were devoured by the crevasses which opened up. It was horrific and I am very lucky to have survived that.\"";
    next;
    mes "\"Then everything was pure chaos and I had to fight to survive. We had hardly anything to eat, therefore the strongest survived. I turned out to be a very good warrior. I fought hard. When I felt strong enough to defend others I created a school of martial arts. I took in the weak and tended to them and made them stronger.\"";
    next;
    mes "\"I trained them to fight with all weapons and how to fight bare handed. Taught them how to make their own weapons and what could be used as a weapon. Those were dark times. I'm happy that those times are over and you do not have to live through it.\"";
    next;
    mes "\"When my shelter was no longer required I started to wander around. Now I ended up here old and wrinkly. I'm only able to drive away those weak creatures who try to enter my home all the time. Slowly they learn to leave me alone or I'll squish them.\"";
    next;
    mes "\"I am sorry but I cannot teach you anything anymore. I am too old. But I am still quite good with my pickaxe and I made a cave where you can fight against your friends.\"";
    mes "\"The only things you need is to sponsor some price money and at least two of your friends. If you pay me I will give you about five minutes and after that I will bring you to the cave where you can fight. I will reward the winner. Do you want to give it a shot?\"";
    goto L_Menu;

L_Shorttalk:
    mes "Well... I'm sorry I cannot remember. I'm old. I hope you can forgive me. Well then. Do you want to fight with your friends in my cave? All you need is to sponsor some price money and at least two of your friends.";
    goto L_Menu;

L_Menu:
    menu
        "No.", L_Exit,
        "Yes.", L_Pay,
        "I'd like this item to be the price.", L_Item;

L_Exit:
    mes "[Brodomir]";
    mes "\"Okay, you can come back anytime.\"";
    goto L_Close;

L_Item:
    mes "[Brodomir]";
    mes "\"Ok, which item?\"";
    mes "Make sure to spell correctly and if the item name contains whitespaces, leave them out.";
    input @brodomir_item$;
    mes "[Brodomir]";
    mes "\"And how many?\"";
    input @brodomir_item_amount;
    if (@brodomir_item_amount < 1)
        goto L_Fool;
    mes "[Brodomir]";
    mes "\"So the price should be " + @brodomir_item_amount + " " + @brodomir_item$ + "?\"";
    mes "\"In case there aren't enough people to start the fight, I'll try to give it back to you. If you're not here then... well, then I'll keep it for myself.\"";
    menu
        "Ok.", -,
        "No, you missunderstood me.", L_Item,
        "I changed my mind, forget it.", L_Close;
    if ($@BRODOMIR_PVP_STATUS == 1)
        goto L_Wait;
    if (getareausers("009-6.gat", 20, 20, 80, 80, 1) < 3)
        goto L_NotEnoughPlayers;
    if (countitem(@brodomir_item$) < @brodomir_item_amount)
        goto L_NoItem;
    delitem @brodomir_item$, @brodomir_item_amount;
    set $@BRODOMIR_SPONSOR, getcharid(3);
    goto L_Go;

L_NoItem:
    mes "[Brodomir]";
    mes "\"Hey, you don't have " + @brodomir_item_amount + " " + @brodomir_item$ + "!\"";
    goto L_Close;

L_Fool:
    mes "[Brodomir]";
    mes "\"Are you trying to fool me? Come back when you're more serious.\"";
    goto L_Close;

L_Pay:
    mes "[Brodomir]";
    mes "\"How much money do you want to sponsor as price?\"";
    input @brodomir_money;
    if ($@BRODOMIR_PVP_STATUS == 1)
        goto L_Wait;
    if (getareausers("009-6.gat", 20, 20, 80, 80, 1) < 3)
        goto L_NotEnoughPlayers;
    if (Zeny < @brodomir_money)
        goto L_NotEnoughMoney;
    set Zeny, Zeny - @brodomir_money;
    goto L_Go;

L_Go:
    set $@BRODOMIR_ITEM$, @brodomir_item$;
    set $@BRODOMIR_ITEM_AMOUNT, @brodomir_item_amount;
    set $@BRODOMIR_MONEY, @brodomir_money;
    set $@BRODOMIR_PVP_STATUS, 1;
    mapannounce "009-6.gat", "In 5 minutes I will bring you all to the PvP cave. If there are less than 3 players here the event will not start.", 0;
    if ($@BRODOMIR_ITEM_AMOUNT > 0)
        mapannounce "009-6.gat", "The winner will receive 150GP per player and " + $@BRODOMIR_ITEM_AMOUNT + $@BRODOMIR_ITEM$ + ".", 0;
    if ($@BRODOMIR_MONEY > 0)
        mapannounce "009-6.gat", "The winner will receive " + $@BRODOMIR_MONEY + "GP and additionally 150GP per player.", 0;
    mes "[Brodomir]";
    mes "\"In 5 minutes I will bring you all to the PvP cave. If there are less than 3 players here the event will not start and your money will be lost.\"";
    set $@BRODOMIR_START_TIME, gettimetick(2) + 300;
    initnpctimer;
    goto L_Close;

L_Wait:
    set $@brodomir_seconds, ($@BRODOMIR_START_TIME - gettimetick(2));
    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).\"";
    goto L_Close;

OnTimer5000:
    setnpctimer 0;
    if ($@BRODOMIR_PVP_STATUS > 1)
        goto L_Check;
    if (gettimetick(2) >= $@BRODOMIR_START_TIME)
        goto L_Warp;
    end;

L_Warp:
    if (getareausers("009-6.gat", 20, 20, 80, 80, 1) < 3)
        goto L_Warpfail;
    set $@BRODOMIR_PVP_STATUS, $@BRODOMIR_PVP_STATUS + 1;
    set $@BRODOMIR_PLAYERS, getareausers("009-6.gat", 20, 20, 80, 80, 1);
    mapwarp "009-6.gat", "009-5.gat", 0, 0;
    if ($@BRODOMIR_ITEM_AMOUNT > 0)
        mapannounce "009-6.gat", "The last one standing will receive 150GP per player and " + $@BRODOMIR_ITEM_AMOUNT + $@BRODOMIR_ITEM$ + ".", 0;
    mapannounce "009-5.gat", "PvP On!", 0;
    pvpon "009-5.gat";
    end;

L_Warpfail:
    mapannounce "009-6.gat", "There are not enough players around to start!", 0;
    if ($@BRODOMIR_ITEM_AMOUNT == 0)
        goto L_Cleanup;
    if (attachrid($@BRODOMIR_SPONSOR) != 0)
        getitem $@BRODOMIR_ITEM$, $@BRODOMIR_ITEM_AMOUNT;
    set $@BRODOMIR_ITEM_AMOUNT, 0;
    set $@BRODOMIR_ITEM$, "";
    set $@BRODOMIR_SPONSOR, 0;
    goto L_Cleanup;

L_Check:
    if (getareausers("009-5.gat", 20, 20, 80, 80, 1) > 1)
        end;
    areatimer "009-5.gat", 20, 20, 80, 80, 10, "Brodomir::onReward";
    goto L_End;

onReward:
    if (isdead())
        end;
    message strcharinfo(0), "Congratulations you won!";
    set Zeny, Zeny + ($@BRODOMIR_MONEY + 150 * $@BRODOMIR_PLAYERS);
    getitem $@BRODOMIR_ITEM$, $@BRODOMIR_ITEM_AMOUNT;
    set $@BRODOMIR_ITEM_AMOUNT, 0;
    set $@BRODOMIR_ITEM$, "";
    set $@BRODOMIR_SPONSOR, 0;
    set $@BRODOMIR_MONEY, 0;
    set $@BRODOMIR_PLAYERS, 0;
    end;

L_End:
    mapwarp "009-5.gat", "009-6.gat", 162, 81;
    goto L_Cleanup;

L_NotEnoughPlayers:
    mes "[Brodomir]";
    mes "\"There aren't enough players here to start.\"";
    goto L_Close;

L_Alreadystarted:
    mes "[Brodomir]";
    mes "\"Please wait until the cave is clear again.\"";
    goto L_Close;

L_NotEnoughMoney:
    mes "[Brodomir]";
    mes "\"You don't have enough money.\"";
    goto L_Close;

L_Cleanup:
    pvpoff "009-5.gat";
    set $@BRODOMIR_PVP_STATUS , 0;
    set $@BRODOMIR_START_TIME, 0;
    stopnpctimer;
    end;

L_Close:
    set @brodomir_money, 0;
    set @brodomir_item_amount, 0;
    set @brodomir_item$, "";
    close;
}