// 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;
default:
debugmes "Invalid mob ID: " + getarg(0);
dispbottom l("ERROR, Please report: GHQ GQID: Invalid ID: @@", getarg(0));
return 0;
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;
default:
debugmes "Invalid quest ID: " + getarg(0);
dispbottom l("ERROR, Please report: GHQ GMID: Invalid ID: @@", getarg(0));
return 0;
break;
}
}
/////////////////////////////////////////////////////////////////////////////////
// Handle milestone rewards; it does NOT update stuff
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;
.@old=GHMEMO[getq(General_Hunter)];
.@new=getq2(General_Hunter);
.@blv=atoi(strmobinfo(3, GHQ_GetMonsterIDByQuestID(getq(General_Hunter))));
.@bhp=atoi(strmobinfo(4, GHQ_GetMonsterIDByQuestID(getq(General_Hunter))));
.@xp=0;
.@gp=0;
.@jp=0;
// 1st step: 1000 kills
if (VarDiffValue(.@old, .@new, 1000)) {
mesc l("Goal: @@/@@ reached!", .@new, 1000), 2;
.@xp+=.@blv*10;
.@gp+=.@bhp;
.@jp+=10;
} else if (.@new < 1000) {
mesc l("@@: @@/@@", l("1st step"), .@new, 1000);
}
// 2nd step: 2500 kills
if (VarDiffValue(.@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 (VarDiffValue(.@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 (VarDiffValue(.@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 (VarDiffValue(.@old, .@new, 10000)) {
mesc l("Goal: @@/@@ reached!", .@new, 10000), 2;
mesc l("You must talk to Aidan to claim rewards!");
}
// Get reward (must have Job Exp)
if (.@jp) {
getexp .@xp, .@jp;
Zeny=Zeny+.@gp;
}
return;
}
/////////////////////////////////////////////////////////////////////////////////
// MobID, Place, Prize
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);
mesn;
mes l("I represent the @@ Hunters. We hunt @@.", .@loc$, getmonsterlink(.@mobId));
mes l("The great prize is @@. It can be claimed with Aidan, on Tulimshar.", .@prize$);
if (.@q == .@id) {
.@m=GHQ_GetMonsterIDByQuestID(.@q);
mes l("You are currently hunting @@/10000 @@. When done, remember to claim rewards with Aidan, on Tulimshar!", .@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));
}
select
l("I'm not interested."),
rif(GHMEMO[.@id] < 10000,l("I'll hunt them for you."));
switch (@menu) {
case 2:
GHQ_GetRewardsOnMilestone();
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;
}
// Handle rewards (must check beforehand)
function script GHQ_GetRewardsOnCompletion {
// 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;
mes l("Current progress: @@/10000 @@", getq2(General_Hunter), getmonsterlink(GHQ_GetMonsterIDByQuestID(getq(General_Hunter))));
mes "";
GHQ_GetRewardsOnMilestone();
GHMEMO[getq(General_Hunter)]=getq2(General_Hunter);
.@xp=atoi(strmobinfo(3, GHQ_GetMonsterIDByQuestID(getq(General_Hunter))))*3150;
getexp .@xp, 100;
switch (GHQ_GetMonsterIDByQuestID(getq(General_Hunter))) {
case Maggot:
setq General_Hunter, 0, 0;
Zeny=Zeny+25000;
inventoryplace MaggotCocoon, 1;
makepet(Maggot); // Works the same, even if I'm using mob_db constant
mesn;
mesq l("Good job, here is 25,000 GP and 15,750 EXP.");
mesq l("And your rare, a @@! Enjoy!", getitemlink(MaggotCocoon));
mesc l("Gained @@ XP", format_number(.@xp));
close;
case Snake:
setq General_Hunter, 0, 0;
Zeny=Zeny+300000;
getitem StrangeCoin, 80;
mesn;
mesq l("Good job, here is @@ GP and @@ @@!", format_number(300000), format_number(80), getitemlink(StrangeCoin));
mesc l("Gained @@ XP", format_number(.@xp));
close;
case Scorpion:
setq General_Hunter, 0, 0;
Zeny=Zeny+100000;
mesn;
mesq l("Good job, here is 100,000 GP!");
mesc l("Gained @@ XP", format_number(.@xp));
close;
case ForestMushroom:
setq General_Hunter, 0, 0;
Zeny=Zeny+175000;
getitem StrangeCoin, 60;
mesn;
mesq l("Good job, here is @@ GP and @@ @@!", format_number(175000), format_number(60), getitemlink(StrangeCoin));
mesc l("Gained @@ XP", format_number(.@xp));
close;
case Pinkie:
setq General_Hunter, 0, 0;
getitem PinkHelmet, 1;
getexp 15750, 100;
mesn;
mesq l("And your rare, a @@! Enjoy!", getitemlink(PinkHelmet));
mesc l("Gained @@ XP", format_number(.@xp));
close;
case Moggun:
setq General_Hunter, 0, 0;
Zeny=Zeny+150000;
getitem StrangeCoin, 60;
mesn;
mesq l("Good job, here is @@ GP and @@ @@!", format_number(150000), format_number(60), getitemlink(StrangeCoin));
mesc l("Gained @@ XP", format_number(.@xp));
close;
case Fluffy:
setq General_Hunter, 0, 0;
Zeny=Zeny+125000;
getitem StrangeCoin, 60;
mesn;
mesq l("Good job, here is @@ GP and @@ @@!", format_number(125000), format_number(60), getitemlink(StrangeCoin));
mesc l("Gained @@ XP", format_number(.@xp));
close;
}
mesc l("ILLEGAL SCRIPT LOGIC REACHED, PLEASE REPORT. (GHQ_GROC)", 1);
return;
}
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;
}