From a1a4827064ba5d17716a9933ab6999f46a04476d Mon Sep 17 00:00:00 2001
From: jesusalva <cpntb1@ymail.com>
Date: Mon, 12 Feb 2018 22:46:37 -0200
Subject: Sailors quest + bugfixes

---
 npc/002-3/doors.txt   |  2 +-
 npc/002-4/elmo.txt    | 15 ++++++++
 npc/002-4/nard.txt    |  5 ++-
 npc/005-1/_import.txt |  1 +
 npc/005-1/_warps.txt  |  1 -
 npc/005-1/sailors.txt | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 118 insertions(+), 3 deletions(-)
 create mode 100644 npc/005-1/sailors.txt

(limited to 'npc')

diff --git a/npc/002-3/doors.txt b/npc/002-3/doors.txt
index e720e653a..5d48818a4 100644
--- a/npc/002-3/doors.txt
+++ b/npc/002-3/doors.txt
@@ -84,7 +84,7 @@ L_End:
 
 OnTouch:
     .@julia = getq(ShipQuests_Julia);
-    if (.@julia == 2) goto L_Warp;
+    if (.@julia >= 2) goto L_Warp;
     close;
 
 L_Warp:
diff --git a/npc/002-4/elmo.txt b/npc/002-4/elmo.txt
index 2b03b9ad8..9b75c0d82 100644
--- a/npc/002-4/elmo.txt
+++ b/npc/002-4/elmo.txt
@@ -9,6 +9,7 @@
 
     if (LOCATION$ == "") sailortalk;
     if (getq(General_Narrator) == 1) sailortalk;
+    if (getq(CandorQuest_Sailors) == 2) goto L_Party;
 
     mesn;
     mes l("\"Hey, have you already got the money necessary for the travel?");
@@ -27,10 +28,24 @@
     if (.@q < 3)
         mes l("- You can always play with kids. Not very profitable, though.");
 
+    // Sailors Quest
+    .@q=getq(CandorQuest_Sailors);
+    if (.@q < 3)
+        mes l("- Some of our crew are missing. They're probably wasting their time at beach.");
+
     close2;
     goodbye;
     end; // Just for good measure
 
+L_Party:
+    mesn;
+    mesq l("What? A party?");
+    next;
+    setq CandorQuest_Sailors, 3;
+    getexp 10, 0;
+    mesq l("Alright, I'll show up later. Thanks for calling me.");
+    close;
+
 OnInit:
     .sex = G_MALE;
     .distance = 5;
diff --git a/npc/002-4/nard.txt b/npc/002-4/nard.txt
index 98cf5afcf..4ff1d1907 100644
--- a/npc/002-4/nard.txt
+++ b/npc/002-4/nard.txt
@@ -14,7 +14,10 @@
     .@price=2000;
 
 L_Checker:
-    if (getq(CandorQuest_Barrel) == 4 && getq(CandorQuest_HAS) == 3) .@price-=500; // Check Elmo's script. You can do quests later... FOR NOW.
+    if (getq(CandorQuest_Barrel) == 4 &&
+        getq(CandorQuest_HAS) == 3 &&
+        getq(CandorQuest_Sailors) == 3)
+            .@price-=500;
     if (.@narrator == 1) goto L_Travel;
     if (LOCATION$ != "") goto L_NotYet;
 
diff --git a/npc/005-1/_import.txt b/npc/005-1/_import.txt
index fe3f5737c..730921ac0 100644
--- a/npc/005-1/_import.txt
+++ b/npc/005-1/_import.txt
@@ -6,6 +6,7 @@
 "npc/005-1/ayasha.txt",
 "npc/005-1/liana.txt",
 "npc/005-1/maya.txt",
+"npc/005-1/sailors.txt",
 "npc/005-1/ship.txt",
 "npc/005-1/soul-menhir.txt",
 "npc/005-1/warpcandorbattle.txt",
diff --git a/npc/005-1/_warps.txt b/npc/005-1/_warps.txt
index 7524340cf..a0d244861 100644
--- a/npc/005-1/_warps.txt
+++ b/npc/005-1/_warps.txt
@@ -1,6 +1,5 @@
 // This file is generated automatically. All manually added changes will be removed when running the Converter.
 // Map 005-1: Candor Island warps
-005-1,43,107,0	warp	#005-1_43_107	0,0,002-2,21,28
 005-1,31,79,0	warp	#005-1_31_79	0,0,005-2,33,42
 005-1,34,74,0	warp	#005-1_34_74	0,0,005-3,25,42
 005-1,48,70,0	warp	#005-1_48_70	0,0,005-4,25,42
diff --git a/npc/005-1/sailors.txt b/npc/005-1/sailors.txt
new file mode 100644
index 000000000..a1e72eefa
--- /dev/null
+++ b/npc/005-1/sailors.txt
@@ -0,0 +1,97 @@
+// TMW2 scripts.
+// Authors:
+//    Jesusalva
+// Description:
+//    TODO
+// CandorQuest_Sailors
+//  0: Not started
+//  1: Accepted
+//  2: Invite Elmo
+//  3: Completed
+
+005-1,95,99,0	script	Sailors#005-1	NPC_ELVEN_MAN_TRADER_SITTING,0,0,{
+    .@q = getq(CandorQuest_Sailors);
+    if (.@q == 1)
+        goto L_Report;
+    if (.@q == 2)
+        goto L_Elmo;
+    if (.@q == 3)
+        goto L_Complete;
+
+    mesn;
+    mesq l("Ahoy matey!");
+    next;
+    mesq l("Arr, it is always good to be on land after so much time in sea!");
+    next;
+    mesq l("We want to party this moment, but can you believe we ran out of beer?");
+    mes "";
+    menu
+        l("If I were you, I would drink water."),L_Water,
+        l("WHAT? How can you ever do a party without beer?!"),L_Accept;
+
+L_Water:
+    mes "";
+    mesn;
+    mesq l("Ah, it is not the same. Not the same.");
+    next;
+    mesq l("When I am drunk I tell myself to stop drinking, but I won't listen the words of a drunkard.");
+    close;
+
+L_Accept:
+    mes "";
+    mesn;
+    mesq l("We can't, don't you agree?!");
+    next;
+    mesq l("However, if we waste the ship's money in beer, Nard will get mad.");
+    next;
+    mesq l("We won't be able to pay you in money, but we'll make you one of us if you bring us beer!");
+    next;
+    mesq l("Please bring us 5 @@! That should be enough!", getitemlink("Beer"));
+    setq CandorQuest_Sailors, 1;
+    close;
+
+L_Report:
+    mesn;
+    mesq l("I see you brought @@/5 @@ for us!",countitem("Beer"),getitemlink("Beer"));
+    mes "";
+    menu
+        rif(countitem("Beer") >= 5, l("Indeed, matey! Here they are!")), L_Give,
+        rif(countitem("Beer") >= 5, l("You're doing the math wrong, matey! I'll bring them later!")), L_Later,
+        rif(countitem("Beer") < 5, l("Arr, that's not enough! I'll bring more later!")), L_Later;
+    close;
+
+L_Later:
+    mes "";
+    mesn;
+    mesq l("Arr, we will wait for you then! We still have tasks to complete!");
+    close;
+
+L_Give:
+    inventoryplace Bandana, 1;
+    delitem "Beer", 5;
+    getitem Bandana, 1;
+    setq CandorQuest_Sailors, 2;
+    mes "";
+    mesn;
+    mesq l("Arr, that's some fine ale! We can do the party when we're done with our work!");
+    next;
+    mesn;
+    mesq l("Take this @@ to prove you're one of us! Could you also invite Elmo? Thanks, matey!", getitemlink("Bandana"));
+    close;
+
+
+L_Elmo:
+    mesn;
+    mesq l("Please invite Elmo for the party, matey! We can't leave our positions!");
+    close;
+
+L_Complete:
+    mesn;
+    mesq l("Thanks for the help! Arr, that was some fine ale, indeed!");
+    close;
+
+OnInit:
+    .sex = G_OTHER;
+    .distance = 8;
+    end;
+}
-- 
cgit v1.2.3-70-g09d2