From 7242d6b1599b876334f70495c743ed35788f0625 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 1 Jun 2018 12:35:45 -0300 Subject: Use a helper for Grand Hunter Quest --- npc/003-1/aidan.txt | 24 +++------------------ npc/009-1/guards.txt | 27 +----------------------- npc/functions/mobhunter.txt | 51 +++++++++++++++++++++++++++++++++++++++++++++ npc/scripts.conf | 1 + 4 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 npc/functions/mobhunter.txt (limited to 'npc') diff --git a/npc/003-1/aidan.txt b/npc/003-1/aidan.txt index 6ac6611a3..415cf9bd6 100644 --- a/npc/003-1/aidan.txt +++ b/npc/003-1/aidan.txt @@ -20,8 +20,7 @@ l("Not at the moment"), l("Information"); - switch (@menu) - { + switch (@menu) { case 1: mes ""; Zeny=Zeny-2000; @@ -102,25 +101,8 @@ L_Register: } L_Assign: - mes ""; - mesn; - mes l("I represent the Tulimshar Hunters. We hunt Maggots."); - mes l("The great prize is @@, a pet which eats Bug Legs.", getitemlink(MaggotCocoon)); - select - l("I'm not interested."), - rif(GHMEMO[1] < 10000,l("I'll hunt 10,000 maggots.")); - - switch (@menu) { - case 2: - GHMEMO[getq(General_Hunter)]=getq2(General_Hunter); - setq(General_Hunter, 1, GHMEMO[1]); - mesn; - mesq l("Good luck! Don't come back until you reach 10000 kills!"); - close; - break; - default: - close; - } + GHQ_Assign(Maggot, "Tulimshar", getitemlink(MaggotCocoon)); + close; L_Finish: GHMEMO[getq(General_Hunter)]=getq2(General_Hunter); diff --git a/npc/009-1/guards.txt b/npc/009-1/guards.txt index e0c4f8573..29912b017 100644 --- a/npc/009-1/guards.txt +++ b/npc/009-1/guards.txt @@ -15,32 +15,7 @@ next; mesn; mesq l("The path will be open when it's safe again for heavily armed travellers."); - if (GHQUEST) goto L_Assign; - close; - -L_Assign: - next; - //mesq l("Current Quest Progress: @@/10,000 kills", getq2(General_Hunter)); - mesn; - mes l("I represent the Halinarzo Hunters. We hunt Snakes."); - mes l("The great prize is @@ GP. It can be claimed with Aidan, on Tulimshar.", "250,000"); - if (getq(General_Hunter)) mes l("You are already hunting something else. Do you want to switch?"); - select - l("I'm not interested."), - rif(GHMEMO[2] < 10000,l("I'll hunt 10,000 snakes.")); - - switch (@menu) { - case 2: - GHMEMO[getq(General_Hunter)]=getq2(General_Hunter); - setq(General_Hunter, 2, GHMEMO[2]); - mesn; - mesq l("Good luck! Don't come back until you reach 10000 kills!"); - close; - break; - default: - close; - } - + if (GHQUEST) GHQ_Assign(Snake, "Halinarzo", "250.000 GP"); close; L_MKControl: diff --git a/npc/functions/mobhunter.txt b/npc/functions/mobhunter.txt new file mode 100644 index 000000000..e11a08559 --- /dev/null +++ b/npc/functions/mobhunter.txt @@ -0,0 +1,51 @@ +// TMW-2 Script +// Author: Jesusalva +// Desc: Grand Hunter Quest Utils + +// MobID, Place, Prize +function GHQ_Assign { + .@id=GHQ_GetQuestIDByMonsterID(getarg(0)); + next; + //mesq l("Current Quest Progress: @@/10,000 kills", getq2(General_Hunter)); + mesn; + mes l("I represent the @@ Hunters. We hunt @@.", getarg(1), getmonsterlink(getarg(0))); + mes l("The great prize is @@. It can be claimed with Aidan, on Tulimshar.", getarg(2)); + if (getq(General_Hunter)) mes l("You are already hunting something else. Do you want to switch?"); + 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!"); + close; + break; + default: + close; + } + + close; + +} + +// MobID +function GHQ_GetQuestIDByMonsterID { + switch (getarg(0)) { + case Maggot: + return 1; + break; + case Snake: + return 2; + break; + default: + debugmes "Invalid mob ID: " + getarg(0); + dispbottom l("ERROR, Please report: GHQ GQID: Invalid ID: @@", getarg(0)); + return 0; + break; + } + +} + diff --git a/npc/scripts.conf b/npc/scripts.conf index 73ea1e971..aeaf614d7 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -37,6 +37,7 @@ "npc/functions/harbours.txt", "npc/functions/marriage.txt", "npc/functions/mobpoint.txt", +"npc/functions/mobhunter.txt", "npc/functions/news.txt", "npc/functions/npcmove.txt", "npc/functions/npcmovegraph.txt", -- cgit v1.2.3-70-g09d2