From b6cf889ded9a3a991293ac4659e92db11a3ab983 Mon Sep 17 00:00:00 2001
From: jesusalva <cpntb1@ymail.com>
Date: Thu, 22 Feb 2018 15:18:17 -0300
Subject: Swezanne quest, repeatable once after 24 hours. Repeating quest will
 give less EXP, and require more expensive potions.

---
 db/quest_db.conf       |  4 +++
 npc/003-1/sarah.txt    |  1 +
 npc/003-1/swezanne.txt | 79 ++++++++++++++++++++++++++++++++++++++------------
 3 files changed, 66 insertions(+), 18 deletions(-)

diff --git a/db/quest_db.conf b/db/quest_db.conf
index fc550b02a..de0d32505 100644
--- a/db/quest_db.conf
+++ b/db/quest_db.conf
@@ -201,6 +201,10 @@ quest_db: (
     Id: 43
     Name: "CandorQuests_Vincent"
 },
+{
+    Id: 44
+    Name: "TulimsharQuest_Swezanne"
+},
 {
 	Id: 1000
 	Name: "Test_testing1"
diff --git a/npc/003-1/sarah.txt b/npc/003-1/sarah.txt
index 0b205e31a..0a2339dd6 100644
--- a/npc/003-1/sarah.txt
+++ b/npc/003-1/sarah.txt
@@ -1,5 +1,6 @@
 // Author:
 //    Saulc
+// TODO: Different reward when repeating quest (eg. 60 GP, so you can have a 10 GP profit selling cakes)
 
 003-1,90,144,0	script	Sarah	NPC_FEMALE,{
 
diff --git a/npc/003-1/swezanne.txt b/npc/003-1/swezanne.txt
index ca0798c85..16e6b4c90 100644
--- a/npc/003-1/swezanne.txt
+++ b/npc/003-1/swezanne.txt
@@ -2,9 +2,14 @@
 //    Jesusalva
 
 003-1,70,100,0	script	Swezanne	NPC_FEMALE,{
-
+    .@q=getq(TulimsharQuest_Swezanne);
     mesn;
     mesq l("Hi.");
+    next;
+    if (.@q == 0) goto L_Quest;
+    if (.@q == 1 && gettimetick(2) >= SWEZANNE_TIMER + 60 * 60 * 24) setq TulimsharQuest_Swezanne, 2;
+    else if (.@q == 2) goto L_Repeat;
+    mesq l("I fight every day in hopes to meet Andrei, the famous hero who prevented Hurnscald from total destruction against a horde of monsters alone.");
     if ($MOST_HEROIC$ != "") goto L_Heroics;
     close;
 
@@ -12,27 +17,65 @@ L_Heroics:
     next;
     mesn;
     .@d=rand(1,6);
-    // This switch loop is temporaly broken.
-    switch (.@d) {
-        case 1:
-            .@deed$="protected our cities!";
-        case 2:
-            .@deed$="did great acts of bravery!";
-        case 3:
-            .@deed$="is just awesome!";
-        case 4:
-            .@deed$="killed a monster army single-handed!";
-        case 5:
-            .@deed$="proved their worth in battlefield!";
-        case 6:
-            .@deed$="impressed even the High Council!";
-        default:
-            .@deed$="is awesome like me!"; // Should be unreachable
-    }
+
+    if      (.@d == 1) .@deed$="protected our cities!";
+    else if (.@d == 2) .@deed$="did great acts of bravery!";
+    else if (.@d == 3) .@deed$="is just awesome!";
+    else if (.@d == 4) .@deed$="killed a monster army single-handed!";
+    else if (.@d == 5) .@deed$="proved their worth in battlefield!";
+    else if (.@d == 6) .@deed$="impressed even the High Council!";
+    else .@deed$="is awesome like me!"; // Should not happen
+
+	/*.@nb = query_sql("select name, fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
+	mes("Hall Of Fame: TOP5");
+	mes("1."+.@name$[0]+"("+.@fame[0]+")"); // Will return a person with the biggest fame value.
+	mes("2."+.@name$[1]+"("+.@fame[1]+")");
+	mes("3."+.@name$[2]+"("+.@fame[2]+")");
+	mes("4."+.@name$[3]+"("+.@fame[3]+")");
+	mes("5."+.@name$[4]+"("+.@fame[4]+")");*/
 
     mesq l("I hope to one day be like @@, who @@", $MOST_HEROIC$, .@deed$);
     close;
 
+L_Quest:
+    mesq l("Ah, fighting monsters under this desert heat makes me thirsty. But someone must do this job, otherwise Tulimshar could fall.");
+    next;
+    mesq l("Maybe you could bring me 5 delicious @@? They have a great effect in quenching thirst and recovering vigour.", getitemlink(CactusDrink));
+    menu
+        rif(countitem(CactusDrink) >= 5, l("Here they are!")), L_Finish,
+        l("I'll get to it."), L_Close;
+    close; // double sure
+
+L_Repeat:
+    mesq l("Ah, fighting monsters under this desert heat makes me thirsty. But someone must do this job, otherwise Tulimshar could fall.");
+    next;
+    mesq l("Maybe you could bring me 5 delicious @@? They have a great effect in quenching thirst and recovering vigour.", getitemlink(CactusPotion));
+    menu
+        rif(countitem(CactusPotion) >= 5, l("Here they are!")), L_Finish2,
+        l("I'll get to it."), L_Close;
+    close;
+
+L_Finish2:
+    delitem CactusPotion, 5;
+    getexp 25, 0;
+    Zeny = (Zeny + 200); // 5*35 = 175 base
+    setq TulimsharQuest_Swezanne, 1;
+    set SWEZANNE_TIMER, gettimetick(2);
+    close;
+
+L_Finish:
+    delitem CactusDrink, 5;
+    getexp 60, 5; // 5 Job points! A great reward.
+    Zeny = (Zeny + 150); // 5*25 = 125 base
+    setq TulimsharQuest_Swezanne, 1;
+    set SWEZANNE_TIMER, gettimetick(2);
+    close;
+
+L_Close:
+    closedialog;
+    goodbye;
+    close;
+
 OnInit:
     .@npcId = getnpcid(0, .name$);
     //setunitdata(.@npcId, UDT_HEADTOP, 2929);
-- 
cgit v1.2.3-70-g09d2