summaryrefslogtreecommitdiff
path: root/npc/019-4-1/chief.txt
blob: 43fc53fbe037ac2d8b3f81cee7798dd81f5015c7 (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
// TMW2/LoF scripts.
// Authors:
//    TMW-LoF Team
//    Jesusalva
// Description:
//    Christmas Quest
//      Closed Christmas Boxes have been stolen! Give him any you find for the
//      ranking (and ranking based rewards). The global amount of delivered boxes
//      will determine the gifts (and amount of gifts) handled by Santa!
//
//      Rewards: Santa Hat, Gnome Hat, Santa Bearded Hat, Ugly Christmas Sweater,
//               Turtle Neck Sweater, Santa Globe, Snowman Globe, Red Stocking.
//
//    SQuest_Christmas
//      Current Year
//      Boxes Delivered
//      Money Sponsored
//
//    $XMAS_GIFTS
//      World-wide collected gifts count.

019-4-1,56,33,0	script	Christmas Chief	NPC_GNOME_A,{
    // Last year
    if (getq3(SQuest_Christmas) == gettime(GETTIME_YEAR)-1)
        goto L_Reward;
    // Not on season
    if ($EVENT$ != "Christmas")
        goto L_OutOfSeason;
    // Start Event for the first time
    if (getq3(SQuest_Christmas) < gettime(GETTIME_YEAR))
        setq SQuest_Christmas, 1, 0, gettime(GETTIME_YEAR);
    // Main Loop
    goto L_Main;

L_OutOfSeason:
    mesn;
    mesq l("This workshop doesn't gets too many tasks from Santa outside the Christmas...");
    close;

// TODO Reward
L_Reward:
    inventoryplace NPCEyes, 5, Iten, 1;
    .@q1=getq2(SQuest_Christmas);
    .@q2=getq3(SQuest_Christmas);
    setq SQuest_Christmas, 0, 0, 0;

    /* Handle hChristmas Quest Rewards */
    // TODO

    /* Handle Golbarez Quest Rewards */
    /* Mostly Coins, some Merc Boxes, EXP/JExp */
    /* Gift the best people at this quest, too */
    getexp .@q3/4, .@q3/1000;
    .@coins=.@q3/10000;
    if (.@coins)
        getitem CasinoCoins, .@coins;
    if (.@coins > 3)
        getitem StrangeCoin, .@coins/3;
    // Mercenary boxes (requires certain global donation values)
    .@mc_boxc=.@q3/100000;
    .@mc_boxb=(.@q3/60000)-.@mc_boxc;
    .@mc_boxa=(.@q3/40000)-.@mc_boxb;

    // Event: Good
    if ($XMAS_MONEY >= 750000) {
        if (.@mc_boxc)
            getitem MercBoxC, .@mc_boxb;
        if (.@mc_boxb)
            getitem MercBoxB, .@mc_boxb;
        if (.@mc_boxa)
            getitem MercBoxA, .@mc_boxa+1;
    // Event: Average
    } else if ($XMAS_MONEY >= 250000) {
        if (.@mc_boxb)
            getitem MercBoxB, .@mc_boxb;
        if (.@mc_boxa)
            getitem MercBoxA, .@mc_boxa;
    // Event: Bad (must aid players)
    } else if ($XMAS_MONEY >= 100000) {
        if (.@q3 >= 10000)
            getitem MercBoxA, .@mc_boxa+1;
    }

    // MVP Awards
    if ((.@q*100)/$XMAS_MONEY >= 80) // 80% contribution
        getitem GoldenGift, 1;
    else if ((.@q*100)/$XMAS_MONEY >= 60) // 60% contribution
        getitem SilverGift, 1;
    else if ((.@q*100)/$XMAS_MONEY >= 40) // 40% contribution
        getitem BronzeGift, 1;
    else if ((.@q*100)/$XMAS_MONEY >= 20) // 20% contribution
        getitem CasinoCoins, 1;

    mesn;
    mesc l("Hey hey, how can you finish a quest which never started in first place?"), 1;
    close;

L_Main:
    .@q=getq2(SQuest_Christmas);
    mesn;
    mesq l("The stolen empty boxes!! Christmas is RUINED!!!");
    // How did you even reach here in first place?
    if (BaseLevel < 20) {
        close;
    }
    next;
    mesn;
    mesq l("We only managed to recover @@ thus far...", $XMAS_GIFTS);
    // Same formula from 2007 event
    .@gifts=max(15, log2(gifts/100));
    close;

OnInit:
    .sex=G_MALE;
    .distance=5;
    end;
}