From c31da02d5c1803a1d285767110c20e7555e60de5 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Fri, 14 Dec 2018 16:44:55 -0200
Subject: Blood Donor quest.

---
 db/quest_db.conf    |  4 +++
 npc/001-8/hub.txt   |  8 ++++++
 npc/012-6/nurse.txt | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/db/quest_db.conf b/db/quest_db.conf
index 2900fe81c..635c3fafc 100644
--- a/db/quest_db.conf
+++ b/db/quest_db.conf
@@ -250,6 +250,10 @@ quest_db: (
 	Id: 98
 	Name: "HurnscaldQuest_InjuriedMouboo"
 },
+{
+	Id: 99
+	Name: "HurnscaldQuest_BloodDonor"
+},
 
 // ID 111 to 130: Nivalis Quests
 {
diff --git a/npc/001-8/hub.txt b/npc/001-8/hub.txt
index a0dd07303..145723e1c 100644
--- a/npc/001-8/hub.txt
+++ b/npc/001-8/hub.txt
@@ -379,6 +379,7 @@ OnPCLogoutEvent:
     }
 
     // TODO: Checks which doesn't belong here shouldn't be here!
+    // Died on Terranite Cave where exp penalty is lower
     if (.@mapa$ == "015-6" && @qhub_died) {
         if (readparam(BaseExp) < readparam(BaseExp)*2/100)
             end;
@@ -386,6 +387,7 @@ OnPCLogoutEvent:
         getexp readparam(BaseExp)*2/100, 0;
         warp "Save", 0, 0;
     }
+    // Vanished on Cindy Cave
     if (.@mapa$ == "021-4" && strcharinfo(0) == $@CINDY_HERO$) {
         recovery(getcharid(3));
         warp any("010-1", "010-2"), 0, 0;
@@ -398,6 +400,12 @@ OnPCLogoutEvent:
         recovery(getcharid(3));
         warp "Save", 0, 0;
     }
+    // Logout while donating blood
+    if (getq(HurnscaldQuest_BloodDonor) == 2) {
+        slide 35, 28;
+        setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE, false);
+        setq HurnscaldQuest_BloodDonor, 0, gettimetick(2)+3600; // one hour penalty
+    }
 
     @qhub_victor=0;
     @qhub_died=0;
diff --git a/npc/012-6/nurse.txt b/npc/012-6/nurse.txt
index a818325d7..80d442856 100644
--- a/npc/012-6/nurse.txt
+++ b/npc/012-6/nurse.txt
@@ -2,9 +2,80 @@
 // Author:
 //    Jesusalva
 //    Crazyfefe
+// Notes:
+//  HurnscaldQuest_BloodDonor
+//      1 - Donation finished
+//      2 - Donation in progress
+//  Structure
+//      Status, Next Attempt Timer
 
 012-6,56,67,6	script	Hurnscald's Nurse	NPC_FEMALE,{
-    Nurse(.name$, 10, 6);
+    .@q2=getq2(HurnscaldQuest_BloodDonor);
+    if (.@q2 > gettimetick(2)) {
+        Nurse(.name$, 10, 6);
+        close;
+    }
+    mesn;
+    mesq l("Hello there. Do you want to donate blood?");
+    mesc l("Donating blood will BLOCK YOUR MOVEMENT for three minutes.");
+    mesc l("Do not disconnect while waiting. You need 100% HP to donate.");
+
+L_BLCore;
+    mes "";
+    select
+        l("I need infirmary services."),
+        l("Info"),
+        rif(readparam(Hp) == readparam(MaxHp), l("Yes, please use my blood to save lifes."));
+    mes "";
+    switch (@menu) {
+        case 1:
+            Nurse(.name$, 10, 6);
+            close;
+        case 2:
+            mesn;
+            mesq l("Donating blood is a noble act, which allows to save lifes.");
+            next;
+            mesn;
+            mesq l("When people loses too much blood, they die, unless we can lend them somebody's else blood.");
+            next;
+            mesn;
+            mesq l("Not everyone can be a blood donor. For example, you must be healthy.");
+            mesq l("You can think more info about this on these links:");
+            mes "";
+            mes "[@@https://www.blood.co.uk/|https://www.blood.co.uk/@@]";
+            mes "[@@https://www.nhsbt.nhs.uk/what-we-do/blood-services/blood-donation/|https://www.nhsbt.nhs.uk/what-we-do/blood-services/blood-donation/@@]";
+            mes l("France: [@@https://dondesang.efs.sante.fr/|https://dondesang.efs.sante.fr/@@]");
+            mes l("Brazil: [@@http://www.prosangue.sp.gov.br/home/Default.html|http://www.prosangue.sp.gov.br/home/Default.html@@]");
+            next;
+            goto L_BLCore;
+        case 3:
+            mesn;
+            mesq l("Please don't sound like I was some sort of vampire or something...");
+            next;
+            mesn;
+            mesq l("This will take only a short while.");
+            next;
+            setq1 HurnscaldQuest_BloodDonor, 2;
+            percentheal -90, 0;
+            addtimer(180000, "Hurnscald's Nurse::OnDonationComplete");
+            slide 34, 29;
+            setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE, true);
+            dispbottom l("Any movement/skill/item will be without effect until time is up.");
+            closedialog;
+            close;
+    }
+
+    close;
+
+OnDonationComplete:
+    if (checkpcblock() & PCBLOCK_ATTACK)
+        setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE, false);
+    slide 58, 67;
+    percentheal 100, 0;
+    getexp readparam(Hp)*2, readparam(Hp)/100;
+    setq HurnscaldQuest_BloodDonor, 1, gettimetick(2)+(2592000); // 60*60*24*30
+    mesn;
+    mesq l("Thanks for donating blood. You can donate again in 30 days.");
     close;
 
 OnInit:
-- 
cgit v1.2.3-70-g09d2