summaryrefslogtreecommitdiff
path: root/npc/functions/event.txt
blob: eb83bb2199afb0a5e7cdfd8d4874beee5fb28f1c (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
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Controls world events so Saulc and I can take vacations.
//    See also: seasons.txt, command/event.txt, aurora.txt
//    003-1/events.txt, soulmenhir.txt and, of course, the event maps (if any).
//    Schedule, if needed to change, can be found in the OnInit loop.
//    An event, obviously, cannot last more than 7... 15 days at WORST.
//    Therefore, month checks aren't included in day checks.

-	script	sPatrick	NPC_HIDDEN,{
OnInit:
    end;
}

-	script	sDreamTower	NPC_HIDDEN,{
OnWarpTo:
    if ($EVENT$ != "Tower") end;
    if (!playerattached()) end;
    if (!countitem(EventDreamTicket)) end;

    // Reset progress
    if (DTOWER_DAY != gettimeparam(GETTIME_DAYOFMONTH) || DTOWER_FLOOR < 1) {
        DTOWER_DAY=gettimeparam(GETTIME_DAYOFMONTH);
        DTOWER_FLOOR=1;
        dispbottom l("A new Dream Tower opens its gates before you...");
    }

    // Create maze and populate
    CreateMaze(IOT_CHAR, MAZE_SIZE_S | MAZE_SIZE_M);
    MazeMobs(((BaseLevel/10) + DTOWER_FLOOR * 5), true, rand2(9,14));

    // Spawn & Configure the boss monster
    .@mx=getmapinfo(MAPINFO_SIZE_X, MAZE_MAP$)-20;
    .@my=getmapinfo(MAPINFO_SIZE_Y, MAZE_MAP$)-20;
    .@mob=areamonster(MAZE_MAP$, 20, 20, .@mx, .@my, "Gatekeeper", MonsterSergeant, 1, "sDreamTower::OnBossDie");
    setunitdata(.@mob, UDT_LEVEL, DTOWER_FLOOR * 5);
    setunitdata(.@mob, UDT_STR, DTOWER_FLOOR * 2);
    setunitdata(.@mob, UDT_AGI, DTOWER_FLOOR * 2);
    setunitdata(.@mob, UDT_VIT, DTOWER_FLOOR * 3);
    setunitdata(.@mob, UDT_INT, DTOWER_FLOOR * 1);
    setunitdata(.@mob, UDT_DEX, DTOWER_FLOOR * 3);
    setunitdata(.@mob, UDT_LUK, DTOWER_FLOOR * 2);
    setunitdata(.@mob, UDT_ADELAY, max(640, 1672-(DTOWER_FLOOR * 24)));
    setunitdata(.@mob, UDT_MAXHP,    2000+DTOWER_FLOOR*120);
    setunitdata(.@mob, UDT_HP,       2000+DTOWER_FLOOR*120);
    setunitdata(.@mob, UDT_ATKMIN,   20+DTOWER_FLOOR*4);
    setunitdata(.@mob, UDT_ATKMAX,   40+DTOWER_FLOOR*4);
    setunitdata(.@mob, UDT_DEF,      10+DTOWER_FLOOR*3);
    setunitdata(.@mob, UDT_MDEF,     5+DTOWER_FLOOR);
    setunitdata(.@mob, UDT_HIT,      (BaseLevel+DTOWER_FLOOR)*32/10);
    setunitdata(.@mob, UDT_FLEE,     (BaseLevel+DTOWER_FLOOR)*24/10);
    setunitdata(.@mob, UDT_CRIT,     rand2(40, min(120, 40+DTOWER_FLOOR)));
    // TODO: Spawn more treasure chests? (exp, gp, items)

    // Consume the ticket and begin the maze
    delitem EventDreamTicket, 1;
    InitMaze(3600);
    dispbottom col(l("Reminder : Defeat the %s to win.", b("Gatekeeper")), 2);
    dispbottom l("Mana Plane - Dream Tower, %dº floor. Time limit: 60 minutes or death.", DTOWER_FLOOR);
    end;

// Dream Tower cleared
OnBossDie:
    dispbottom l("Mana Plane - Dream Tower, %dº floor %s", DTOWER_FLOOR, b(l("CLEAR!")));
    DTOWER_FLOOR+=1;
    if ($EVENT$ == "Tower") {
        if (checkweight(BrokenMedal, 1)) {
            getitem BrokenMedal, 1;
        } else {
            // FIXME: Can be kept for next event, a deletion is required!
            rodex_sendmail(getcharid(0), $DREAMTOWER_SAGE$, "You are fat.", "Here is the medal, anyway.", 0, BrokenMedal, 1);
        }
    }
    unitskilluseid(getcharid(3), BS_GREED, 1, getcharid(3));
    sleep2(500);
    teleporthome();
    end;
}

function	script	sThanksgiving	{
    return;
}

// ChocolateDay()
function	script	ChocolateDay	{
    if (!playerattached())
        return;

    // Date check
    if (gettime(6) != JULY)
        return;
    if (gettime(5) != 7)
        return;

    // Max. 80% chances, 0.4% per monster level
    .@lv=min(200, getmonsterinfo(killedrid, MOB_LV));
    if (rand2(10000) < (.@lv*40)) {
        // Chocolate Bar: 73%; Chocolate Dye: 6.7%
        .@choco=any(ChocolateBar, ChocolateBar, ChocolateBar, ChocolateBar,
                    ChocolateMouboo, ChocolateBiscuit, ChocolateBunny,
                    ChocolateBar, ChocolateBar, ChocolateBar, ChocolateBar,
                    ChocolateDye, ChocolateBar, ChocolateBar, ChocolateBar);
        getmapxy(.@m$, .@x, .@y, 0);
        .@x+=rand2(-1,1);
        .@y+=rand2(-1,1);
        makeitem(.@choco, 1, .@m$, .@x, .@y);
    }
    return;
}

// CoffeeDay()
function	script	CoffeeDay	{
    if (!playerattached())
        return;

    // Date check
    if (gettime(6) != OCTOBER)
        return;
    if (gettime(5) != 1)
        return;

    // Max. 22% chances, 0.1% per monster level
    .@lv=min(200, getmonsterinfo(killedrid, MOB_LV));
    if (rand2(10000) < (.@lv*11)) {
        getmapxy(.@m$, .@x, .@y, 0);
        .@x+=rand2(-1,1);
        .@y+=rand2(-1,1);
        makeitem(Coffee, 1, .@m$, .@x, .@y);
    }
    return;
}

// FSFDay()
function	script	FSFDay	{
    return;
}

// CraftmasterDay()
function	script	CraftmasterDay	{
    return;
}