summaryrefslogtreecommitdiff
path: root/npc/functions/mobhunter.txt
blob: b38fea25d2dd98f1b739bacbfb313dd1f326b031 (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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
// TMW-2 Script
// Author: Jesusalva
// Desc:   Grand Hunter Quest Utils

// MobID
function	script	GHQ_GetQuestIDByMonsterID	{
    switch (getarg(0)) {
        case Maggot:
            return 1;
            break;
        case Snake:
            return 2;
            break;
        case Scorpion:
            return 3;
            break;
        case ForestMushroom:
            return 4;
            break;
        case Pinkie:
            return 5;
            break;
        case Moggun:
            return 6;
            break;
        case Fluffy:
            return 7;
            break;
        case MountainSnake:
            return 8;
            break;
        case Duck:
            return 9;
            break;
        case Bat:
            return 10;
            break;
        case GreenDragon:
            return 11;
            break;
        default:
            return Exception("GHQ GQID: Invalid ID: "+getarg(0), RB_DEFAULT^RB_PLEASEREPORT|RB_ISFATAL);
            break;
    }

}

// QuestID (basically reverses the previous code)
function	script	GHQ_GetMonsterIDByQuestID	{
    switch (getarg(0)) {
        case 1:
            return Maggot;
            break;
        case 2:
            return Snake;
            break;
        case 3:
            return Scorpion;
            break;
        case 4:
            return ForestMushroom;
            break;
        case 5:
            return Pinkie;
            break;
        case 6:
            return Moggun;
            break;
        case 7:
            return Fluffy;
            break;
        case 8:
            return MountainSnake;
            break;
        case 9:
            return Duck;
            break;
        case 10:
            return Bat;
            break;
        case 11:
            return GreenDragon;
            break;
        default:
            return Exception("GHQ GMID: Invalid ID: "+getarg(0), RB_DEFAULT^RB_PLEASEREPORT|RB_ISFATAL);
            break;
    }

}

/////////////////////////////////////////////////////////////////////////////////

// Handle milestone rewards; it does NOT update stuff
// Syntax: GHQ_GetRewardsOnMilestone ( rewardoverrideid )
function	script	GHQ_GetRewardsOnMilestone	{

    // Check if you can store a Strange Coin (you really should)
    // Another item too, which I'm sure you won't get it anywhere.
    inventoryplace StrangeCoin, 1, NPCEyes, 1;

    // Global setup
    .@q=getq(General_Hunter);
    .@k=getq2(General_Hunter);
    .@monsterId=GHQ_GetMonsterIDByQuestID(getq(General_Hunter));
    // Setup
    .@old=GHMEMO[getq(General_Hunter)];
    .@new=getq2(General_Hunter);
    .@blv=strmobinfo(3, .@monsterId);
    .@bhp=strmobinfo(4, .@monsterId);
    .@xp=0;
    .@gp=0;
    .@jp=0;
    //if (getq2(General_Hunter) >= 10000) goto L_Finish;

    // 1st step: 1000 kills
    if (is_between(.@old, .@new, 1000)) {
        mesc l("Goal: @@/@@ reached!", .@new, 1000), 2;
        .@xp+=.@blv*10;
        .@gp+=(.@bhp/2);
        .@jp+=10;
    } else if (.@new < 1000) {
        mesc l("@@: @@/@@", l("1st step"), .@new, 1000);
    }

    // 2nd step: 2500 kills
    if (is_between(.@old, .@new, 2500)) {
        mesc l("Goal: @@/@@ reached!", .@new, 2500), 2;
        .@xp+=.@blv*25;
        .@gp+=.@bhp;
        .@jp+=25;
    } else if (.@new < 2500) {
        mesc l("@@: @@/@@", l("2nd step"), .@new, 2500);
    }

    // 3rd step: 5000 kills
    if (is_between(.@old, .@new, 5000)) {
        mesc l("Goal: @@/@@ reached!", .@new, 5000), 2;
        .@xp+=.@blv*50;
        .@gp+=.@bhp;
        .@jp+=50;
    } else if (.@new < 5000) {
        mesc l("@@: @@/@@", l("3rd step"), .@new, 5000);
    }

    // 4th step: 7500 kills
    if (is_between(.@old, .@new, 7500)) {
        mesc l("Goal: @@/@@ reached!", .@new, 7500), 2;
        .@xp+=.@blv*75;
        .@gp+=.@bhp;
        .@jp+=75;
    } else if (.@new < 7500) {
        mesc l("@@: @@/@@", l("4th step"), .@new, 7500);
    }

    // 5th step: 10000 kills
    if (is_between(.@old, .@new, 10000)) {
        mesc l("Goal: @@/@@ reached!", .@new, 10000), 2;

        // Main reward
        getitem StrangeCoin, .@blv*2;
        Zeny=Zeny+.@bhp*25; // Maggot: 10.000 gp. That's plenty.
        getexp .@bhp*BaseLevel, .@bhp; // The monster hp, once again, drastically affects

        // Achievements
        if (!GHQ_WINNER)
            GHQ_WINNER = gettimetick(2);

        // Grand Prize
        switch (.@monsterId) {
        case Pinkie:
            getitem PinkHelmet, 1;
            mesc l("And here's a rare for you, a @@! Good job!", getitemlink(PinkHelmet));
            break;
        default:
            mesc l("A new pet has been unlocked on the @@!", l("Pet Detective"));
        }

    }

    // Get reward (must have Job Exp)
    if (.@jp) {
        getexp .@xp, .@jp;
        Zeny=Zeny+.@gp;
    }

    // Update Grand Hunter memory
    GHMEMO[.@q]=.@k;

    return;
}

/////////////////////////////////////////////////////////////////////////////////

// MobID, Place, Prize Override
function	script	GHQ_Assign	{
    // Arguments
    .@mobId =getarg(0);
    .@loc$  =getarg(1);
    .@prize$=getarg(2, "");

    // Current Quest Status + vars
    .@id=GHQ_GetQuestIDByMonsterID(.@mobId);
    .@q=getq(General_Hunter);
    .@p=getq2(General_Hunter);
    //next;
    //mesq l("Current Quest Progress: @@/10,000 kills", .@p);

    // Handle Partial Rewards
    if (.@q)
        GHQ_GetRewardsOnMilestone();
    mes "";

    mesn;
    mes l("I represent the @@ Hunters. We hunt @@ (Lv @@).", .@loc$, getmonsterlink(.@mobId), strmobinfo(3, .@mobId));
    if (.@prize$ != "")
        mes l("The great prize is @@.", .@prize$);
    else
        mes l("The great prize is to unlock a pet!");
    if (.@q == .@id) {
        .@m=GHQ_GetMonsterIDByQuestID(.@q);
        mes l("You are currently hunting @@/10000 @@.", .@p, getmonsterlink(.@m));
        next;
        closedialog;
        goodbye;
    }
    if (.@q) {
        .@m=GHQ_GetMonsterIDByQuestID(.@q);
        mes l("You are currently hunting @@/10000 @@. Do you want to switch?", .@p, getmonsterlink(.@m));
        mesc l("Protip: Your current progress will be saved.");
    }
    select
        l("I'm not interested."),
        rif(GHMEMO[.@id] < 10000,l("I'll hunt them for you."));

    switch (@menu) {
    case 2:
        GHMEMO[getq(General_Hunter)]=getq2(General_Hunter);
        setq(General_Hunter, .@id, GHMEMO[.@id]);
        mesn;
        mesq l("Good luck! Don't come back until you reach 10000 kills!");
        break;
    }
    closedialog;
    goodbye;

}


function	script	mobhunter	{
    if (getq(General_Hunter) == 0)
        return;

    .@ghd=getq(General_Hunter);
    if (killedrid == GHQ_GetMonsterIDByQuestID(.@ghd)) {
        setq2 General_Hunter, getq2(General_Hunter)+1;
        .@ghd=getq2(General_Hunter);
        if (! (.@ghd % 1000))
            dispbottom l("Grand Hunter Quest: @@/10,000", format_number(.@ghd));
    }
    return;

}