summaryrefslogtreecommitdiff
path: root/npc/functions/aurora.txt
blob: 3095b333bdcfb71fbb20f4bb1d6d88a6331f9a6c (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
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    AURORA EVENT FRAMEWORK
//    Previously known as FY:Event System
//
//    Controls weekly events so Saulc, seeds and I can take vacations.
//    See also: seasons.txt, command/event.txt, event.txt, 003-1/events.txt
//    soulmenhir.txt and, of course, the event maps (if any).
//    Aurora Event Framework functions are called by event.txt
//    specs override and is overriden by those defined in commands/event.txt

// Variables:
//      $MOST_HEROIC$
//          Updated every 2 weeks, the top 1 from previous event
//          Only the hero may begin sieges against Fortress Town.
//          Every NPC will recognize them, and Lightbringer will also
//          pay special attention to them.
//      $FYEVENT_CYCLE
//          Current cycle. I thought in using gettimeparam(WEEK) but gave up.
//      $@REGNUM_BLESSMAP$
//          Map under Regnum's Blessing
//      $@REGNUM_BLESSMAP_H$
//          Human-readable form of the map under Regnum's Blessing

// AEF: BEGIN
function	script	FYNewEvent	{
    debugmes "\033[1mFY event is set to happen...";
    $FYEVENT_CYCLE+=1;
    // Overrides standard event system
    $EVENT$="";
    switch ($FYEVENT_CYCLE % 12) {
    case 1:
        $EVENT$="Kamelot";
        kamibroadcast("Kamelot Season is now open!", "Aurora Events");
        break;
    case 2:
        break;
    case 3:
        $EVENT$="Regnum";
        callfunc("FYE_Regnum");
        kamibroadcast("Regnum's Blessing: "+$@REGNUM_BLESSMAP_H$+" is now blessed!", "Aurora Events");
        break;
    case 4:
        break;
    case 5:
        // FIXME: PLACEHOLDER
        $EVENT$="Kamelot";
        kamibroadcast("Kamelot Season is now open!", "Aurora Events");
        break;
    case 6:
        // FIXME: PLACEHOLDER
        break;
    case 7:
        // FIXME: PLACEHOLDER
        $EVENT$="Regnum";
        callfunc("FYE_Regnum");
        kamibroadcast("Regnum's Blessing: "+$@REGNUM_BLESSMAP_H$+" is now blessed!", "Aurora Events");
        break;
    case 8:
        // FIXME: PLACEHOLDER
        break;
    case 9:
        // FIXME: PLACEHOLDER
        $EVENT$="Kamelot";
        kamibroadcast("Kamelot Season is now open!", "Aurora Events");
        break;
    case 10:
        // FIXME: PLACEHOLDER
        break;
    case 11:
        // FIXME: PLACEHOLDER
        $EVENT$="Regnum";
        callfunc("FYE_Regnum");
        kamibroadcast("Regnum's Blessing: "+$@REGNUM_BLESSMAP_H$+" is now blessed!", "Aurora Events");
        break;
    case 12:
        // FIXME: PLACEHOLDER
        break;
    }
    return;
}

// Modify Kamelot
function	script	FYE_Kamelot	{
    .@g=getcharid(2);
    if ($@FYE_KAMELOT[.@g] != gettimeparam(GETTIME_DAYOFMONTH)) {
        mesc l("Kamelot Season is open!");

        // Instance still exists
        if (instanceowner($@KAMELOT_ID[.@g]) == .@g) {
            mesc l("However, your guild just challenged Kamelot Dungeons.");
            mesc l("Please wait a while.");
            return false;
        }
        mesc l("Should we?");
        next;
        if (askyesno() == ASK_NO)
            return false;

        // Someone began while you waited
        if (instanceowner($@KAMELOT_ID[.@g]) == .@g)
            return true;

        // Begin
        callfunc("KamelotCleanup", .@g);
        $KAMELOT_COOLDOWN[.@g] = 0;
        $@FYE_KAMELOT[.@g] = gettimeparam(GETTIME_DAYOFMONTH);
        mesc l("Have fun!");
        next;
        return true;
    }
    return false;
}


// Regnum Blessing
function	script	FYE_Regnum	{
    setarray .@ma$, "004-1", "007-1", "004-2", "010-2", "014-3", "014-5", "015-5",
                    "018-3", "019-1", "025-2", "025-2-1", "soren";
    setarray .@mb$, "Tulimshar Outskirts", "Tulimshar Mines",
                    "Tulimshar (West) Canyon", "Halinarzo (East) Canyon",
                    "Central Woodlands", "North Woodlands",
                    "Abandoned Mines (Woodlands)", "Somber Caves (LoF)",
                    "Snow Field", "Fortress Island - South",
                    "Fortress Island South Cave", "Soren Island";
    .@m=rand2(getarraysize(.@ma$));
    $@REGNUM_BLESSMAP$=.@ma$[.@m];
    $@REGNUM_BLESSMAP_H$=.@mb$[.@m];
    // Apply the blessing
    setmapflag(.@ma$[.@m], mf_bexp, 200);
    return;
}

// Stops any Aurora Event
function	script	FYStopEvent	{
    setarray .@av$, "Kamelot", "Regnum";
    if (array_find(.@av$, $EVENT$) >= 0) {
        sClear();
        $EVENT$="";
    }
    return;
}