summaryrefslogtreecommitdiff
path: root/npc/functions/seasons.txt
blob: 61b7b86a894194c80c51671417248e347358c4a2 (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
// TMW2 Script.
// Authors:
//    Jesusalva
// Description:
//    Season functions

// Function authored by Reid and edited by Jesusalva
// season({day, month})
// SQuest_Summer
//    returns the current season (approximation)
//      WINTER:      Winter, 21/12
//      SPRING:      Spring, 20/03
//      SUMMER:      Summer, 21/06
//      AUTUMN:      Autumn, 22/09

function	script	season	{
    .@current_month = getarg(0, gettime(GETTIME_MONTH));

    if (.@current_month % 3 == 0) {
        .@current_day = getarg(1, gettime(GETTIME_DAYOFMONTH));

        switch (.@current_month) {
            case MARCH:     .@season_day = 20; break;
            case JUNE:      .@season_day = 21; break;
            case SEPTEMBER: .@season_day = 22; break;
            case DECEMBER:  .@season_day = 21; break;
            default: break;
        }

        .@is_after_season_day = .@current_day >= .@season_day ? 0 : -1;
    }

    return (.@current_month / 3 + .@is_after_season_day) % 4;
}


function	script	SeasonControl	{
    do
    {
        select
            "Summer Start",
            "Summer End",
            "Autumn Start",
            "Autumn End",
            "Abort";

        switch (@menu) {
            case 1: donpcevent("#SeasonCore::OnSummerStart"); break;
            case 2: donpcevent("#SeasonCore::OnSummerEnd"); break;
            case 3: donpcevent("#SeasonCore::OnAutumnStart"); break;
            case 4: donpcevent("#SeasonCore::OnAutumnEnd"); break;
        }
    } while (@menu != 5);
    return;
}

// If skip_checks is set, it'll ignore $@SEASON control.
// SeasonReload( {skip_checks} )
function	script	SeasonReload	{
    // Proccess skip_checks
    if (getarg(0,0))
        $@SEASON=99;

    // Summer extra drops
    if (season() == SUMMER && $@SEASON != SUMMER) {
        donpcevent("#SeasonCore::OnSummerStart");
    }
    // Summer end delete drops
    if (season() == AUTUMN && $@SEASON == SUMMER) {
        donpcevent("#SeasonCore::OnSummerEnd");
    }
    // Autumn extra drops
    if (season() == AUTUMN && $@SEASON != AUTUMN) {
        donpcevent("#SeasonCore::OnAutumnStart");
    }
    // Autumn end delete drops
    if (season() == AUTUMN && $@SEASON == SUMMER) {
        donpcevent("#SeasonCore::OnAutumnEnd");
    }

    // Non-season, but season-related
    // Christmas have a special feature
    if ($EVENT$ == "Christmas")
        sChristmas();

    $@SEASON=season();
    return;
}

000-0,0,0,0	script	#SeasonCore	NPC_HIDDEN,{
    end;

OnSummerStart:
    addmonsterdrop(Duck, CherryCocktail, 360);
    addmonsterdrop(Croc, CherryCocktail, 180);
    addmonsterdrop(SaxsoGhost, CherryCocktail, 450);
    addmonsterdrop(RedButterfly, CherryCocktail, 100);

    addmonsterdrop(Maggot, CactusCocktail, 140);
    addmonsterdrop(DesertMaggot, CactusCocktail, 190);
    addmonsterdrop(Scorpion, CactusCocktail, 165);
    addmonsterdrop(GiantMaggot, CactusCocktail, 290);
    addmonsterdrop(Centaur, CactusCocktail, 1000);

    addmonsterdrop(AlphaMouboo, AppleCocktail, 850);
    addmonsterdrop(OceanCroc, AppleCocktail, 480);
    addmonsterdrop(Mouboo, AppleCocktail, 280);
    addmonsterdrop(Pinkie, AppleCocktail, 70);

    addmonsterdrop(Duck, Sunglasses, 1);
    addmonsterdrop(Croc, Sunglasses, 1);
    addmonsterdrop(SaxsoGhost, Sunglasses, 1);
    addmonsterdrop(DesertMaggot, Sunglasses, 1);
    addmonsterdrop(Scorpion, Sunglasses, 1);
    addmonsterdrop(GiantMaggot, Sunglasses, 1);
    addmonsterdrop(Centaur, Sunglasses, 3);
    addmonsterdrop(AlphaMouboo, Sunglasses, 1);
    addmonsterdrop(OceanCroc, Sunglasses, 1);
    addmonsterdrop(Mouboo, Sunglasses, 1);
    addmonsterdrop(Pinkie, Sunglasses, 1);
    addmonsterdrop(Moonshroom, Sunglasses, 2);
    addmonsterdrop(RedButterfly, Sunglasses, 1);
    end;

OnSummerEnd:
    delmonsterdrop(Duck, CherryCocktail);
    delmonsterdrop(Croc, CherryCocktail);
    delmonsterdrop(SaxsoGhost, CherryCocktail);
    delmonsterdrop(RedButterfly, CherryCocktail);
    delmonsterdrop(Maggot, CactusCocktail);
    delmonsterdrop(DesertMaggot, CactusCocktail);
    delmonsterdrop(Scorpion, CactusCocktail);
    delmonsterdrop(GiantMaggot, CactusCocktail);
    delmonsterdrop(Centaur, CactusCocktail);
    delmonsterdrop(AlphaMouboo, AppleCocktail);
    delmonsterdrop(OceanCroc, AppleCocktail);
    delmonsterdrop(Mouboo, AppleCocktail);
    delmonsterdrop(Pinkie, AppleCocktail);
    delmonsterdrop(Duck, Sunglasses);
    delmonsterdrop(Croc, Sunglasses);
    delmonsterdrop(SaxsoGhost, Sunglasses);
    delmonsterdrop(DesertMaggot, Sunglasses);
    delmonsterdrop(Scorpion, Sunglasses);
    delmonsterdrop(GiantMaggot, Sunglasses);
    delmonsterdrop(Centaur, Sunglasses);
    delmonsterdrop(AlphaMouboo, Sunglasses);
    delmonsterdrop(OceanCroc, Sunglasses);
    delmonsterdrop(Mouboo, Sunglasses);
    delmonsterdrop(Pinkie, Sunglasses);
    delmonsterdrop(Moonshroom, Sunglasses);
    delmonsterdrop(RedButterfly, Sunglasses);
    end;

OnAutumnStart:
    // Ched's Quest Winner
    .@nb = query_sql("SELECT c.name FROM `quest` AS i, `char` AS c WHERE i.quest_id="+SQuest_Ched+" AND i.char_id=c.char_id ORDER BY i.count2 DESC LIMIT 1", .@name$);
    $@AUTUMN_VICTOR$=.@name$[0];

    // Fancy trees
    addmapmask "012-1", MASK_AUTUMN;

    // Autumn's Drop
    addmonsterdrop(FafiDragon, PumpkandySeed, 10000);
    addmonsterdrop(BlackMamba, PumpkandySeed, 8000);
    addmonsterdrop(AlphaMouboo, PumpkandySeed, 5000);
    addmonsterdrop(PoisonSpikyMushroom, PumpkandySeed, 3000);
    addmonsterdrop(Mouboo, PumpkandySeed, 2000);
    addmonsterdrop(Bandit, PumpkandySeed, 1600);
    addmonsterdrop(Fluffy, PumpkandySeed, 1500);
    addmonsterdrop(LogHead, PumpkandySeed, 1400);
    addmonsterdrop(CaveSnake, PumpkandySeed, 1380);
    addmonsterdrop(CaveMaggot, PumpkandySeed, 850);
    addmonsterdrop(GreenSlime, PumpkandySeed, 750);
    addmonsterdrop(Piou, PumpkandySeed, 600);
    addmonsterdrop(Squirrel, PumpkandySeed, 500);
    end;

OnAutumnEnd:
    // Ched's rewards can't be claimed anymore. Delete that from all players.
    DelQuestFromEveryPlayer(SQuest_Ched);

    removemapmask "012-1", MASK_AUTUMN;
    delmonsterdrop(FafiDragon, PumpkandySeed);
    delmonsterdrop(Mouboo, PumpkandySeed);
    delmonsterdrop(AlphaMouboo, PumpkandySeed);
    delmonsterdrop(Fluffy, PumpkandySeed);
    delmonsterdrop(Piou, PumpkandySeed);
    delmonsterdrop(CaveSnake, PumpkandySeed);
    delmonsterdrop(CaveMaggot, PumpkandySeed);
    delmonsterdrop(Bandit, PumpkandySeed);
    delmonsterdrop(Squirrel, PumpkandySeed);
    delmonsterdrop(PoisonSpikyMushroom, PumpkandySeed);
    delmonsterdrop(LogHead, PumpkandySeed);
    delmonsterdrop(GreenSlime, PumpkandySeed);
    delmonsterdrop(BlackMamba, PumpkandySeed);
    end;

OnInit:
OnHour00:
    if ($@SEASON != season()) {
        SeasonReload();
    }
    end;
}