summaryrefslogtreecommitdiff
path: root/npc/commands/event.txt
blob: 6ee100cfed42b7c1fb4d04cae70d315d69554e29 (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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
// Delete item ID on inventories, storages, guild storages and carts. Also affects mails.
// WARNING, irreversible and dangerous!
// DelItemFromEveryPlayer( ID )
function	script	DelItemFromEveryPlayer	{
    if (getarg(0, -1) < 0)
        return;

    query_sql("DELETE FROM `inventory` WHERE `nameid`="+getarg(0));
    query_sql("DELETE FROM `cart_inventory` WHERE `nameid`="+getarg(0));
    query_sql("DELETE FROM `storage` WHERE `nameid`="+getarg(0));
    query_sql("DELETE FROM `guild_storage` WHERE `nameid`="+getarg(0));
    query_sql("DELETE FROM `rodex_items` WHERE `nameid`="+getarg(0));
    query_sql("DELETE FROM `auction` WHERE `nameid`="+getarg(0));
    return;
}

// Delete an acc_reg entry from all players. Full arrays only. Affect num and str db.
// WARNING, irreversible and dangerous!
// DelAccRegFromEveryPlayer( KEY )
function	script	DelAccRegFromEveryPlayer	{
    if (getarg(0, -1) < 0)
        return;

    query_sql("DELETE FROM `acc_reg_num_db` WHERE `key`="+getarg(0));
    query_sql("DELETE FROM `acc_reg_str_db` WHERE `key`="+getarg(0));
    return;
}

// Christmas cannot be on GlobalEventMenu because it affects seasons system
function	script	sChristmas	{
        // Add Christmas drops
        addmonsterdrop(Moggun,      XmasCake,  800);
        addmonsterdrop(AlphaMouboo, XmasCake,  920);
        addmonsterdrop(BlueSlime,   XmasCake, 1000);
        addmonsterdrop(SantaSlime,  XmasCake, 1200);
        addmonsterdrop(IcedFluffy,  XmasCake, 1500);
        addmonsterdrop(Yeti,        XmasCake, 5000);

        addmonsterdrop(Bandit,      XmasCandyCane,  300);
        addmonsterdrop(Mouboo,      XmasCandyCane,  480);
        addmonsterdrop(WhiteSlime,  XmasCandyCane,  500);
        addmonsterdrop(RudolphSlime,XmasCandyCane, 1000);
        addmonsterdrop(Fluffy,      XmasCandyCane, 2000);
        addmonsterdrop(AzulSlime,   XmasCandyCane, 2000);

        addmonsterdrop(Duck,        GingerBreadMan,  360);
        addmonsterdrop(WaterFairy,  GingerBreadMan, 1000);


        if (gettime(5) <= 26) {
            addmonsterdrop(Yeti,        ClosedChristmasBox, 3500);
            addmonsterdrop(WaterFairy,  ClosedChristmasBox, 1080);
            addmonsterdrop(AlphaMouboo, ClosedChristmasBox,  830);
            addmonsterdrop(IcedFluffy,  ClosedChristmasBox,  675);
            addmonsterdrop(BlueSlime,   ClosedChristmasBox,  420);
            addmonsterdrop(Moggun,      ClosedChristmasBox,  400);
            addmonsterdrop(SantaSlime,  ClosedChristmasBox,  360);
            addmonsterdrop(AzulSlime,   ClosedChristmasBox,  200);
            addmonsterdrop(Fluffy,      ClosedChristmasBox,  200);
            addmonsterdrop(RudolphSlime,ClosedChristmasBox,   80);
            addmonsterdrop(WhiteSlime,  ClosedChristmasBox,   30);
            addmonsterdrop(GiantMaggot, ClosedChristmasBox,   15);
        } else { // After Christmas, event drop rates are 50% smaller
            addmonsterdrop(Yeti,        ClosedChristmasBox, 1750);
            addmonsterdrop(WaterFairy,  ClosedChristmasBox,  540);
            addmonsterdrop(AlphaMouboo, ClosedChristmasBox,  415);
            addmonsterdrop(IcedFluffy,  ClosedChristmasBox,  340);
            addmonsterdrop(BlueSlime,   ClosedChristmasBox,  210);
            addmonsterdrop(Moggun,      ClosedChristmasBox,  200);
            addmonsterdrop(SantaSlime,  ClosedChristmasBox,  180);
            addmonsterdrop(AzulSlime,   ClosedChristmasBox,  100);
            addmonsterdrop(Fluffy,      ClosedChristmasBox,  100);
            addmonsterdrop(RudolphSlime,ClosedChristmasBox,   40);
            addmonsterdrop(WhiteSlime,  ClosedChristmasBox,   15);
            addmonsterdrop(GiantMaggot, ClosedChristmasBox,    8);
        }

        // Should not last over two weeks
        addmonsterdrop(WaterFairy,  XmasGift,  54);
        addmonsterdrop(AlphaMouboo, XmasGift,  42);
        addmonsterdrop(IcedFluffy,  XmasGift,  34);
        addmonsterdrop(SantaSlime,  XmasGift,  18);
        addmonsterdrop(Fluffy,      XmasGift,  11);
        addmonsterdrop(AzulSlime,   XmasGift,  10);

        // Change maps for Christmas Season (Specially LoF maps)
        addmapmask "003-1", MASK_CHRISTMAS;
        addmapmask "005-1", MASK_CHRISTMAS;
        addmapmask "009-1", MASK_CHRISTMAS;
        addmapmask "012-1", MASK_CHRISTMAS;
        addmapmask "017-2", MASK_CHRISTMAS;
        addmapmask "017-2-1", MASK_CHRISTMAS;
        addmapmask "017-3", MASK_CHRISTMAS;

        // Enable event
        set $EVENT$, "Christmas";
        //logmes "Enabled CHRISTMAS event.", LOGMES_ATCOMMAND;
        return;
    }
    //MASK_CHRISTMAS

function	script	GlobalEventMenu	{

    function rateManagement {
        clear;
        mes l("To get the current rate:");
        mes col("    @exprate", 7);
        next;
        mes l("To set the exp rate:");
        mes col("    @exprate ##Brate##b hours", 7);
        next;
        mes l("To reset back to normal:");
        mes col("    @exprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
        next;
        return;
    }

    function dropManagement {
        clear;
        mes l("To get the current rate:");
        mes col("    @rates", 7);
        next;
        mes l("To set the drop rate:");
        mes col("    @droprate ##Brate##b hours", 7);
        next;
        mes l("To reset back to normal:");
        mes col("    @droprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
        next;
        return;
    }

    function sEaster {

        // Enable event
        set $EVENT$, "Easter";
        logmes "Enabled EASTER event.", LOGMES_ATCOMMAND;
        return;
    }

    // WARNING, possibly dangerous.
    function sClear {
        // Delete all Easter Stuff from every player
        DelItemFromEveryPlayer(GoldenEasteregg);
        DelItemFromEveryPlayer(GoldenEasteregg);

        // Delete all Christmas stuff
        DelItemFromEveryPlayer(ClosedChristmasBox);
        DelItemFromEveryPlayer(OpenedChristmasBox);
        $XMAS_MONEY=0; // Golbarez
        $XMAS_GIFTS=0; // Chief
        DelAccRegFromEveryPlayer("#XMAS_LOGINBONUS");
    }




















    function seasonManagement {
        clear;
        mes l("Current event: @@", $EVENT$);
        menu
            l("Disable event"), -,
            l("Enable Easter"), -,
            l("Enable Worker's Day"), -,
            l("Enable Christmas"), -,
            l("Reset Kill Saulc Event (Monthly)"), -;

        switch (@menu) {
            case 1: set $EVENT$, ""; sClear(); logmes "Disabled events.", LOGMES_ATCOMMAND;
                break;
            case 2: sEaster(); break;
            case 3:
                set $EVENT$, "Worker Day";
                logmes "Enabled WORKERS DAY event.", LOGMES_ATCOMMAND;
                /*
                addmonsterdrop(Snake, Pearl, 10);
                debugmes "Snakes are now dropping Pearls.";
               */
                break;
            case 4:
                    logmes "Enabled CHRISTMAS event.", LOGMES_ATCOMMAND;
                    query_sql("DELETE FROM `quest` WHERE `quest_id` = '"+SQuest_Christmas+"'");
                    sChristmas(); break;
            case 5: DelItemFromEveryPlayer(MurdererCrown); break;
        }

        return;
    }

    do
    {
        clear;
        setnpcdialogtitle l("Event Management");
        mes l("This menu allows you to manage events and gives access to event-related tools.");
        mes "";
        mes l("What do you want to access?");

        select
            l("Experience Rate management"),
            l("Drop Rate management"),
            l("Change Season Event"),
            rif(getarg(0,0), menuimage("actions/home", l("Return to Super Menu")));

        //.@c = getarg(0,0) ? 2 : 1; // 1 = back to event menu, 2 = back to super menu

        switch (@menu) {
            case 1: rateManagement; break;
            case 2: dropManagement; break;
            case 3: seasonManagement; break;
            default: return;
        }

    } while (true);
}



-	script	@event	32767,{
    end;

OnCall:
    if (!is_gm()) {
        end;
    }

    GlobalEventMenu;
    closedialog;
    end;
}

-	script	@toevent	32767,{
    end;

OnCall:
    if (!$@GM_EVENT)
        dispbottom l("The mana bridge is closed at the moment.");
    else if (BaseLevel < 10)
        dispbottom l("You are not strong enough to survive this trip.");
    else if (readparam(Sp) != readparam(MaxSp))
        dispbottom l("You need all your mana to do this trip.");
    else if (readparam(Hp) != readparam(MaxHp))
        dispbottom l("You cannot be hurt to do this trip.");
    else if (getmapname() ~= "001-*")
        dispbottom l("You are already at the Mana Plane of Existence.");
    else if (getmapname() == "boss" || getmapname() == "sec_pri" || getmapname() ~= "000-*" || getmapname() ~= "008-*" || getmapname() ~= "sore*")
        dispbottom l("The Mana Plane is currently out of reach.");
    else {
        .@gt=$@AEROS_SPWN;
        if (.@gt == 2)
            .@gt=rand(0,1);
        switch (.@gt) {
        case 0:
            warp "001-1", 235, 26; break;
        case 1:
            warp "001-1", 23, 108; break;
        }
        specialeffect(63, AREA, getcharid(3));
    }
    end;

OnInit:
    bindatcmd "event", "@event::OnCall", 99, 99, 0;
    bindatcmd "toevent", "@toevent::OnCall", 0, 99, 0;
}