summaryrefslogtreecommitdiff
path: root/npc/functions/seasons.txt
blob: 8990a9ec5ecddd0ddc4a8efdde70b4bfa5ba8fef (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
// 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;
}

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

OnInit:
OnHour00:
    if ($@SEASON != season()) {

        // Summer extra drops
        if (season() == SUMMER) {
            addmonsterdrop(Duck, CherryCocktail, 300);

            addmonsterdrop(Maggot, CactusCocktail, 100);
            addmonsterdrop(DesertMaggot, CactusCocktail, 120);
            addmonsterdrop(Scorpion, CactusCocktail, 100);
            addmonsterdrop(GiantMaggot, CactusCocktail, 200);

            addmonsterdrop(AlphaMouboo, AppleCocktail, 800);
            addmonsterdrop(Mouboo, AppleCocktail, 200);
        }
        // Summer end delete drops
        if (season() == AUTUMN && $@SEASON == SUMMER) {
            delmonsterdrop(Duck, CherryCocktail);
            delmonsterdrop(Maggot, CactusCocktail);
            delmonsterdrop(DesertMaggot, CactusCocktail);
            delmonsterdrop(Scorpion, CactusCocktail);
            delmonsterdrop(GiantMaggot, CactusCocktail);
            delmonsterdrop(AlphaMouboo, AppleCocktail);
            delmonsterdrop(Mouboo, AppleCocktail);
        }

        $@SEASON=season();
    }
    end;
}