From a088b12852a87d6b10d5457f2e6f9f10865c4f39 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Tue, 3 Apr 2018 09:27:28 -0300
Subject: Prepare to move Arnea, Silvia's quest

---
 db/quest_db.conf       |   4 ++
 npc/003-1/silvia.txt   |  32 ++++++++++-
 npc/003-10/_import.txt |   1 +
 npc/003-10/arnea.txt   | 145 +++++++++++++++++++++++++++++++++++++++++++++++++
 npc/003-5/_import.txt  |   1 -
 npc/003-5/arnea.txt    | 145 -------------------------------------------------
 npc/004-1/elanore.txt  |   7 ++-
 7 files changed, 185 insertions(+), 150 deletions(-)
 create mode 100644 npc/003-10/arnea.txt
 delete mode 100644 npc/003-5/arnea.txt

diff --git a/db/quest_db.conf b/db/quest_db.conf
index 38e827c03..28287ae20 100644
--- a/db/quest_db.conf
+++ b/db/quest_db.conf
@@ -145,6 +145,10 @@ quest_db: (
     Id: 54
     Name: "TulimsharQuest_Swezanne"
 },
+{
+    Id: 55
+    Name: "TulimsharQuest_Lifestone"
+},
 
 // ID 71 to 90: Hurnscald Quests
 // ID 91 to 110: Nivalis Quests
diff --git a/npc/003-1/silvia.txt b/npc/003-1/silvia.txt
index 666427a7b..fcb8af072 100644
--- a/npc/003-1/silvia.txt
+++ b/npc/003-1/silvia.txt
@@ -7,7 +7,7 @@
 
 if (strcharinfo(0) == $MOST_HEROIC$) npctalk l("Oh my, the great @@ has come to talk to me!", $MOST_HEROIC$);
 if (getq(TulimsharQuest_Swezanne) == 4) goto L_Message;
-if (getq(TulimsharQuest_Swezanne) == 1) goto L_Lifestone;
+if (getq(TulimsharQuest_Swezanne) == 1 && getq(TulimsharQuest_Lifestone) < 2) goto L_Lifestone;
 if (getq(TulimsharQuest_Swezanne) == 2) goto L_Unallowed;
 if (strcharinfo(0) != $MOST_HEROIC$) hello;
 end;
@@ -39,7 +39,30 @@ L_Lifestone:
     next;
     mesn;
     mesq l("I can make you a @@, and for that I will want a @@ and 500 GP.", getitemlink(LifestonePendant), getitemlink(Lifestone));
-    mes col("And I also need Jesusalva to authorize the usage of regenerative items.",1);
+    if (getq(TulimsharQuest_Lifestone) == 0) {
+        next;
+        mesn;
+        mesq l("I am not sure of who makes or haves Lifestones. Try looking outside the city. Who knows.");
+        close;
+    }
+    menu
+        rif(Zeny >= 500 && countitem(Lifestone) > 0, l("Yes, I accept the pendant!")), -,
+        l("Not now, but I may be back later."), L_Close;
+
+    // Whaaaat, this is a major error affecting several scripts!
+    if (Zeny < 500 || countitem(Lifestone) < 0) {
+        atcommand("@request Someone is cheating, call Jesusalva at once!");
+        atcommand("@ban \""+strcharinfo(0)+"\" 15mn"); // I truly hope they bother Jesusalva they were banned
+        disablenpc "Silvia";
+        close;
+    }
+    Zeny-=500;
+    delitem Lifestone, 1;
+    getitem LifestonePendant, 1;
+    setq(TulimsharQuest_Lifestone, 2);
+    mes "";
+    mesn;
+    mesq l("There you go! Thanks for all the help!");
     close;
 
 L_Unallowed:
@@ -50,6 +73,11 @@ L_Unallowed:
     mesq l("She must be thristy, fighting monsters on this sun... If somebody could give her Cactus Potions...");
     close;
 
+L_Close:
+    closedialog;
+    goodbye;
+    close;
+
 OnInit:
     .@npcId = getnpcid(0, .name$);
     setunitdata(.@npcId, UDT_HEADTOP, NPCEyes);
diff --git a/npc/003-10/_import.txt b/npc/003-10/_import.txt
index 215053cd4..357bb6e77 100644
--- a/npc/003-10/_import.txt
+++ b/npc/003-10/_import.txt
@@ -1,3 +1,4 @@
 // Map 003-10: Guard's House
 // This file is generated automatically. All manually added changes will be removed when running the Converter.
 "npc/003-10/_warps.txt",
+"npc/003-10/arnea.txt",
diff --git a/npc/003-10/arnea.txt b/npc/003-10/arnea.txt
new file mode 100644
index 000000000..a55db1fd0
--- /dev/null
+++ b/npc/003-10/arnea.txt
@@ -0,0 +1,145 @@
+// TMW2 Scripts
+// Author:
+//    4144
+//    Jesusalva
+// Description:
+//    Arena for Duels and PVP (003-13,31,31)
+
+003-5,33,37,0	script	Arnea	NPC_ELF_F,{
+    if (DESTROY_ME) {
+        DESTROY_ME=0;
+        instance_destroy(DESTROY_MY_ID);
+    }
+
+    // FIXIT code
+    if (!is_staff()) goto L_Incomplete;
+
+    mesn;
+    mesq l("Welcome to the Arena. Select your action");
+    menu
+        l("Create new arena"), L_NewArena,
+        l("Join existing arena"), L_JoinArena,
+        l("Information"), L_Info,
+        l("Leave"), L_Quit;
+
+L_NewArena:
+    mes "";
+    mesn;
+    if (Zeny < .price) {
+        mesq l("You need @@ GP to use this arena.", .price);
+    } else {
+        mesq l("Okay, which arena will you rent? Cost is @@ GP.", .price);
+        menu
+            rif($@ARENA_INSTANCES[0] < 0, l("Arena 1")), -,
+            rif($@ARENA_INSTANCES[1] < 0, l("Arena 2")), -,
+            rif($@ARENA_INSTANCES[2] < 0, l("Arena 3")), -,
+            rif($@ARENA_INSTANCES[3] < 0, l("Arena 4")), -,
+            rif($@ARENA_INSTANCES[4] < 0, l("Arena 5")), -,
+            l("Give Up"), L_Quit;
+
+        mes (@menu-1);
+        .@ARENA_INSTID = instance_create("003-13@arenax"+(@menu), 0, IOT_NONE);
+        if (.@ARENA_INSTID >= 0)
+        {
+            mes "new instance id: " + str(.@ARENA_INSTID);
+            .@instanceMapName$ = instance_attachmap("003-13", .@ARENA_INSTID, 0, "003-13@a" + (@menu-1));
+            if (.@instanceMapName$ == "")
+            {
+                mes "Error: instance attach map error";
+            } else {
+                mes "Attached instance map name: " + .@instanceMapName$;
+                instance_set_timeout(1000000, 1000000, .@ARENA_INSTID);
+                instance_init(.@ARENA_INSTID);
+                set Zeny, Zeny-1000;
+                $@ARENA_INSTANCES[@menu-1]=getcharid(3);
+            }
+        } else {
+            mes l("An error happened.");
+        }
+    }
+    goto L_Quit;
+
+
+L_Info:
+    mes "npc name: " + .name$;
+    mes "npc ext name: " + .extname$;
+    mes "npc id: " + .id;
+    mes "npc parent id: " + .parent;
+    mes "npc src id: " + .srcId;
+    mes "char id 3: " + getcharid(3);
+    if (instance_id() >= 0)
+        mes "instance id: " + instance_id();
+    close;
+
+L_JoinArena:
+    mes "";
+    mesn;
+    if (Zeny < .price) {
+        mesq l("You need @@ GP to use this arena.", .price);
+    } else {
+        mesq l("Okay, which arena will you join? Cost is @@ GP.", .price);
+        //menu
+        //    rif(has_instance2("003-5@0") >= 0, l("Arena 1")), -,
+        //    rif(has_instance2("003-5@1") >= 0, l("Arena 2")), -,
+        //    rif(has_instance2("003-5@2") >= 0, l("Arena 3")), -,
+        //    rif(has_instance2("003-5@3") >= 0, l("Arena 4")), -,
+        //    rif(has_instance2("003-5@4") >= 0, l("Arena 5")), -,
+        //    l("Give Up"), L_Quit;
+        menu
+            rif($@ARENA_INSTANCES[0] > 0, l("Arena 1")), -,
+            rif($@ARENA_INSTANCES[1] > 0, l("Arena 2")), -,
+            rif($@ARENA_INSTANCES[2] > 0, l("Arena 3")), -,
+            rif($@ARENA_INSTANCES[3] > 0, l("Arena 4")), -,
+            rif($@ARENA_INSTANCES[4] > 0, l("Arena 5")), -,
+            l("Give Up"), L_Quit;
+        warp "003-13@a"+(@menu-1), 31,31;
+        set Zeny, Zeny-.price;
+        //instance_warpall("003-13@a"+@menu, 30, 31); // Only use while in instance
+    }
+    close;
+
+
+L_Quit:
+    close;
+
+L_Incomplete:
+    mesn;
+    mesq lg("Hello darling.");
+    next;
+    mesq l("I am @@, and I take care of the Arena.", .name$);
+    next;
+    mesq l("At the moment, we must wait authorization from Tulimshar's government to re-open doors.");
+    close;
+
+OnInit:
+    .@npcId = getnpcid(0, .name$);
+    setunitdata(.@npcId, UDT_HEADTOP, 2907);
+    setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
+    setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
+    setunitdata(.@npcId, UDT_WEAPON, 3509);
+    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
+    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
+
+    .sex = G_FEMALE;
+    .distance = 5;
+    .alwaysVisible = true;
+    .price=1000;
+    // test instance id
+    setarray $@ARENA_INSTANCES, -1,-1,-1,-1,-1; // Controls Owners
+    setarray $@ARENA_INFOS$, "","","","",""; // Controls Owners
+
+    // Temporary fix
+    disablenpc "Arnea";
+    end;
+
+OnInstanceInit:
+    .@npcId = getnpcid(0, instance_npcname(.name$));
+    setunitdata(.@npcId, UDT_HEADTOP, 2907);
+    setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
+    setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
+    setunitdata(.@npcId, UDT_WEAPON, 3509);
+    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
+    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
+    end;
+
+}
diff --git a/npc/003-5/_import.txt b/npc/003-5/_import.txt
index f768ea85f..62309d1f9 100644
--- a/npc/003-5/_import.txt
+++ b/npc/003-5/_import.txt
@@ -1,4 +1,3 @@
 // Map 003-5: Tulimshar Jeweler
 // This file is generated automatically. All manually added changes will be removed when running the Converter.
-"npc/003-5/arnea.txt",
 "npc/003-5/doors.txt",
diff --git a/npc/003-5/arnea.txt b/npc/003-5/arnea.txt
deleted file mode 100644
index a55db1fd0..000000000
--- a/npc/003-5/arnea.txt
+++ /dev/null
@@ -1,145 +0,0 @@
-// TMW2 Scripts
-// Author:
-//    4144
-//    Jesusalva
-// Description:
-//    Arena for Duels and PVP (003-13,31,31)
-
-003-5,33,37,0	script	Arnea	NPC_ELF_F,{
-    if (DESTROY_ME) {
-        DESTROY_ME=0;
-        instance_destroy(DESTROY_MY_ID);
-    }
-
-    // FIXIT code
-    if (!is_staff()) goto L_Incomplete;
-
-    mesn;
-    mesq l("Welcome to the Arena. Select your action");
-    menu
-        l("Create new arena"), L_NewArena,
-        l("Join existing arena"), L_JoinArena,
-        l("Information"), L_Info,
-        l("Leave"), L_Quit;
-
-L_NewArena:
-    mes "";
-    mesn;
-    if (Zeny < .price) {
-        mesq l("You need @@ GP to use this arena.", .price);
-    } else {
-        mesq l("Okay, which arena will you rent? Cost is @@ GP.", .price);
-        menu
-            rif($@ARENA_INSTANCES[0] < 0, l("Arena 1")), -,
-            rif($@ARENA_INSTANCES[1] < 0, l("Arena 2")), -,
-            rif($@ARENA_INSTANCES[2] < 0, l("Arena 3")), -,
-            rif($@ARENA_INSTANCES[3] < 0, l("Arena 4")), -,
-            rif($@ARENA_INSTANCES[4] < 0, l("Arena 5")), -,
-            l("Give Up"), L_Quit;
-
-        mes (@menu-1);
-        .@ARENA_INSTID = instance_create("003-13@arenax"+(@menu), 0, IOT_NONE);
-        if (.@ARENA_INSTID >= 0)
-        {
-            mes "new instance id: " + str(.@ARENA_INSTID);
-            .@instanceMapName$ = instance_attachmap("003-13", .@ARENA_INSTID, 0, "003-13@a" + (@menu-1));
-            if (.@instanceMapName$ == "")
-            {
-                mes "Error: instance attach map error";
-            } else {
-                mes "Attached instance map name: " + .@instanceMapName$;
-                instance_set_timeout(1000000, 1000000, .@ARENA_INSTID);
-                instance_init(.@ARENA_INSTID);
-                set Zeny, Zeny-1000;
-                $@ARENA_INSTANCES[@menu-1]=getcharid(3);
-            }
-        } else {
-            mes l("An error happened.");
-        }
-    }
-    goto L_Quit;
-
-
-L_Info:
-    mes "npc name: " + .name$;
-    mes "npc ext name: " + .extname$;
-    mes "npc id: " + .id;
-    mes "npc parent id: " + .parent;
-    mes "npc src id: " + .srcId;
-    mes "char id 3: " + getcharid(3);
-    if (instance_id() >= 0)
-        mes "instance id: " + instance_id();
-    close;
-
-L_JoinArena:
-    mes "";
-    mesn;
-    if (Zeny < .price) {
-        mesq l("You need @@ GP to use this arena.", .price);
-    } else {
-        mesq l("Okay, which arena will you join? Cost is @@ GP.", .price);
-        //menu
-        //    rif(has_instance2("003-5@0") >= 0, l("Arena 1")), -,
-        //    rif(has_instance2("003-5@1") >= 0, l("Arena 2")), -,
-        //    rif(has_instance2("003-5@2") >= 0, l("Arena 3")), -,
-        //    rif(has_instance2("003-5@3") >= 0, l("Arena 4")), -,
-        //    rif(has_instance2("003-5@4") >= 0, l("Arena 5")), -,
-        //    l("Give Up"), L_Quit;
-        menu
-            rif($@ARENA_INSTANCES[0] > 0, l("Arena 1")), -,
-            rif($@ARENA_INSTANCES[1] > 0, l("Arena 2")), -,
-            rif($@ARENA_INSTANCES[2] > 0, l("Arena 3")), -,
-            rif($@ARENA_INSTANCES[3] > 0, l("Arena 4")), -,
-            rif($@ARENA_INSTANCES[4] > 0, l("Arena 5")), -,
-            l("Give Up"), L_Quit;
-        warp "003-13@a"+(@menu-1), 31,31;
-        set Zeny, Zeny-.price;
-        //instance_warpall("003-13@a"+@menu, 30, 31); // Only use while in instance
-    }
-    close;
-
-
-L_Quit:
-    close;
-
-L_Incomplete:
-    mesn;
-    mesq lg("Hello darling.");
-    next;
-    mesq l("I am @@, and I take care of the Arena.", .name$);
-    next;
-    mesq l("At the moment, we must wait authorization from Tulimshar's government to re-open doors.");
-    close;
-
-OnInit:
-    .@npcId = getnpcid(0, .name$);
-    setunitdata(.@npcId, UDT_HEADTOP, 2907);
-    setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
-    setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
-    setunitdata(.@npcId, UDT_WEAPON, 3509);
-    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
-    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
-
-    .sex = G_FEMALE;
-    .distance = 5;
-    .alwaysVisible = true;
-    .price=1000;
-    // test instance id
-    setarray $@ARENA_INSTANCES, -1,-1,-1,-1,-1; // Controls Owners
-    setarray $@ARENA_INFOS$, "","","","",""; // Controls Owners
-
-    // Temporary fix
-    disablenpc "Arnea";
-    end;
-
-OnInstanceInit:
-    .@npcId = getnpcid(0, instance_npcname(.name$));
-    setunitdata(.@npcId, UDT_HEADTOP, 2907);
-    setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
-    setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
-    setunitdata(.@npcId, UDT_WEAPON, 3509);
-    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
-    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
-    end;
-
-}
diff --git a/npc/004-1/elanore.txt b/npc/004-1/elanore.txt
index 1278b0ad7..1ca855e52 100644
--- a/npc/004-1/elanore.txt
+++ b/npc/004-1/elanore.txt
@@ -85,8 +85,11 @@ L_Trade:
 
     getitem Lifestone, 1;
 
-    // Possible enhancement: Only grant Experience on first craft
-    getexp 40, 0;
+    // Only grant Experience on first craft
+    if (getq(TulimsharQuest_Lifestone) == 0) {
+        setq TulimsharQuest_Lifestone, 1;
+        getexp 80, 10;
+    }
     mesn;
     mesq l("These will do just fine.");
     next;
-- 
cgit v1.2.3-70-g09d2