From 7bb2379a317df898e7a348c37e3dd8deb325d58a Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Mon, 1 Apr 2019 10:49:30 -0300
Subject: Baktar Quest (woo, a totally useless quest)

---
 npc/012-2/khafar.txt  |  10 ++++
 npc/020-4/_import.txt |   1 +
 npc/020-4/baktar.txt  | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+)
 create mode 100644 npc/020-4/baktar.txt

diff --git a/npc/012-2/khafar.txt b/npc/012-2/khafar.txt
index 5820b86b8..dc60285c5 100644
--- a/npc/012-2/khafar.txt
+++ b/npc/012-2/khafar.txt
@@ -24,6 +24,16 @@
     close;
 
 OnInit:
+    .@npcId = getnpcid(.name$);
+    setunitdata(.@npcId, UDT_HEADTOP, FairyHat);
+    setunitdata(.@npcId, UDT_HEADMIDDLE, ForestArmor);
+    setunitdata(.@npcId, UDT_HEADBOTTOM, CottonShorts);
+    setunitdata(.@npcId, UDT_WEAPON, LousyMoccasins);
+    setunitdata(.@npcId, UDT_HAIRSTYLE, 24);
+    setunitdata(.@npcId, UDT_HAIRCOLOR, 7);
+
+    .sex = G_MALE;
+    .distance = 5;
     npcsit;
     end;
 }
diff --git a/npc/020-4/_import.txt b/npc/020-4/_import.txt
index 404082ea8..15c48c3bd 100644
--- a/npc/020-4/_import.txt
+++ b/npc/020-4/_import.txt
@@ -1,4 +1,5 @@
 // Map 020-4: Nivalis Indoors
 // This file is generated automatically. All manually added changes will be removed when running the Converter.
 "npc/020-4/_warps.txt",
+"npc/020-4/baktar.txt",
 "npc/020-4/gambler.txt",
diff --git a/npc/020-4/baktar.txt b/npc/020-4/baktar.txt
new file mode 100644
index 000000000..90eaf598e
--- /dev/null
+++ b/npc/020-4/baktar.txt
@@ -0,0 +1,126 @@
+// TMW2 Script.
+// Author:
+//    Jesusalva
+// Description:
+//    Baktar
+// Quests:
+//  NivalisQuest_Baktar
+//    .@q1 = Controls Braknar Shield
+//    .@q2 = bitmask with Tulimshar items given
+
+020-4,64,39,6	script	Baktar	NPC_RAIJIN,{
+    .@q=getq(NivalisQuest_Baktar);
+    .@q2=getq2(NivalisQuest_Baktar);
+    if (!.@q)
+        goto L_Start;
+    goto L_Collector;
+
+L_Start:
+    mesn;
+    mesq l("Hello, did you come from Tulimshar? Because you have a nice tan.");
+    next;
+    select
+        l("Yes, I'm coming from Tulimshar."),
+        l("Well, I just like sunbathing."),
+        l("Good bye.");
+    mes "";
+    switch (@menu) {
+        case 2:
+            mesn;
+            mesq l("Bah! Don't try to fool me! The sun can't burn in Nivalis.");
+            // Don't stop now
+        case 3:
+            if (rand(1,5) == 4)
+                mesc l("*cough cough*");
+            close;
+            break;
+    }
+
+    setq NivalisQuest_Baktar, 1, 0;
+    mesn;
+    mesq l("All my parents, grandparents, until the world was born, are from Tulimshar.");
+    next;
+    mesn;
+    mesc l("*cough cough*");
+    mesq l("Thus, I like to collect small memetos from Tulimshar.");
+    next;
+    mesn;
+    mesq l("The doctor told me to move here after I got tuberculosis... But I like Tulimshar so much! Please bring me Tulimshar souvenirs, I'll pay you well!");
+    close;
+
+
+L_Collector:
+    mesn;
+    if (rand(1,5) == 4)
+        mesc l("*cough cough*");
+    mesq l("Did you brought me an souvenir from Tulimshar?");
+    mes "";
+    mes "##B" + l("Drag and drop an item from your inventory.") + "##b";
+
+    .@id = requestitem();
+
+    if (.@id < 1) close;
+    if (countitem(.@id) < 1 || checkbound(.@id))
+        close;
+
+    // No item
+    .@m = htget($@CONTRIBUTORS, str(.@id), 0);
+    if (!.@m) {
+        mesn;
+        if (rand(1,5) == 4)
+            mesc l("*cough cough*");
+        mesq l("What crap is that?! This is not from Tulimshar!");
+        next;
+        mesn;
+        if (rand(1,5) == 4)
+            mesc l("*cough cough*");
+        mesq l("I won't accept stuff from Halinarzo!");
+        mesc l("Baktar can be picky with Tulimshar stuff, too.");
+        close;
+    }
+    // Already given
+    if (.@q2 & .@m) {
+        mesn;
+        if (rand(1,5) == 4)
+            mesc l("*cough cough*");
+        mesq l("I already have that...");
+        close;
+    }
+
+    // Gives 2.5× more
+    .@sp=getiteminfo(.@id, ITEMINFO_SELLPRICE);
+    mesc l("Really give your @@ to Baktar?", getitemlink(.@id)), 1;
+    mesc l("The item will be lost forever.");
+    next;
+    if (askyesno() == ASK_YES) {
+        delitem .@id, 1;
+        Zeny+=(.@sp*25/10);
+        setq2 NivalisQuest_Baktar, .@q2|.@m;
+        mesn;
+        mesq l("Thanks.");
+    }
+
+    close;
+
+OnInit:
+    .@npcId = getnpcid(.name$);
+    setunitdata(.@npcId, UDT_HEADTOP, KnitHat);
+    setunitdata(.@npcId, UDT_HEADMIDDLE, LeatherShirt);
+    setunitdata(.@npcId, UDT_HEADBOTTOM, CottonShorts);
+    setunitdata(.@npcId, UDT_WEAPON, LousyMoccasins);
+    setunitdata(.@npcId, UDT_HAIRSTYLE, 24);
+    setunitdata(.@npcId, UDT_HAIRCOLOR, 1);
+
+    .sex = G_MALE;
+    .distance = 5;
+    npcsit;
+
+    // Constants
+    .TULIMITEM = htnew;
+    htput(.TULIMITEM, str(DesertHat), 1);
+    htput(.TULIMITEM, str(SerfHat), 2);
+    htput(.TULIMITEM, str(BugLeg), 4);
+    htput(.TULIMITEM, str(Dagger), 8);
+    end;
+}
+
-- 
cgit v1.2.3-70-g09d2