summaryrefslogtreecommitdiff
path: root/world
diff options
context:
space:
mode:
Diffstat (limited to 'world')
-rw-r--r--world/map/npc/001-2/sandra.txt3
-rw-r--r--world/map/npc/002-1/lieutenant_dausen.txt3
-rw-r--r--world/map/npc/002-1/nickos.txt3
-rw-r--r--world/map/npc/002-1/sarah.txt3
-rw-r--r--world/map/npc/002-1/soul-menhir.txt1
-rw-r--r--world/map/npc/002-1/stewen.txt3
-rw-r--r--world/map/npc/002-2/kylian.txt7
-rw-r--r--world/map/npc/002-2/troupe_leader.txt2
-rw-r--r--world/map/npc/002-3/mining_camp_barrier.txt3
-rw-r--r--world/map/npc/002-3/nathan.txt3
-rw-r--r--world/map/npc/002-4/mine_triggerone.txt3
-rw-r--r--world/map/npc/002-4/mine_triggerthree.txt3
-rw-r--r--world/map/npc/002-4/mine_triggertwo.txt3
-rw-r--r--world/map/npc/002-4/naem.txt3
-rw-r--r--world/map/npc/002-4/underground_palace_barrier.txt3
-rw-r--r--world/map/npc/002-5/chest.txt3
-rw-r--r--world/map/npc/002-5/sema.txt3
-rw-r--r--world/map/npc/008-1/hinnak.txt2
-rw-r--r--world/map/npc/008-1/mikhail.txt3
-rw-r--r--world/map/npc/009-1/jack.txt2
-rw-r--r--world/map/npc/009-1/milly.txt2
-rw-r--r--world/map/npc/009-1/old_man.txt2
-rw-r--r--world/map/npc/009-1/old_woman.txt2
-rw-r--r--world/map/npc/009-1/sabine.txt2
-rw-r--r--world/map/npc/009-1/soul-menhir.txt1
-rw-r--r--world/map/npc/009-2/alan.txt2
-rw-r--r--world/map/npc/009-2/bernard.txt3
-rw-r--r--world/map/npc/009-2/doctor.txt2
-rw-r--r--world/map/npc/009-2/inspector.txt2
-rw-r--r--world/map/npc/009-2/lena.txt3
-rw-r--r--world/map/npc/009-2/nurse.txt1
-rw-r--r--world/map/npc/009-2/richard.txt1
-rw-r--r--world/map/npc/011-6/bryant.txt3
-rw-r--r--world/map/npc/013-3/barrier.txt2
-rw-r--r--world/map/npc/013-3/mask_chest.txt2
-rw-r--r--world/map/npc/013-3/sword_chest.txt1
-rw-r--r--world/map/npc/018-2/angus.txt2
-rw-r--r--world/map/npc/018-2/books.txt2
-rw-r--r--world/map/npc/018-2/caul.txt2
-rw-r--r--world/map/npc/018-2/miners.txt2
-rw-r--r--world/map/npc/018-2/receptionist.txt2
-rw-r--r--world/map/npc/018-3/bookcase.txt2
-rw-r--r--world/map/npc/018-3/evil-obelisk.txt1
-rw-r--r--world/map/npc/019-1/santa_helper.txt1
-rw-r--r--world/map/npc/019-1/snowman.txt1
-rw-r--r--world/map/npc/020-1/soul-menhir.txt1
-rw-r--r--world/map/npc/020-2/banker.txt1
-rw-r--r--world/map/npc/027-2/gy_inn_shops.txt1
-rw-r--r--world/map/npc/functions/clear_vars.txt92
-rw-r--r--world/map/npc/functions/global_event_handler.txt12
50 files changed, 47 insertions, 165 deletions
diff --git a/world/map/npc/001-2/sandra.txt b/world/map/npc/001-2/sandra.txt
index 3eceeff6..a94d10a3 100644
--- a/world/map/npc/001-2/sandra.txt
+++ b/world/map/npc/001-2/sandra.txt
@@ -2,9 +2,6 @@
001-2,98,88,0|script|Sandra|114
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (@state >= 2) goto L_Done;
diff --git a/world/map/npc/002-1/lieutenant_dausen.txt b/world/map/npc/002-1/lieutenant_dausen.txt
index 38ac6b08..2751d49a 100644
--- a/world/map/npc/002-1/lieutenant_dausen.txt
+++ b/world/map/npc/002-1/lieutenant_dausen.txt
@@ -3,9 +3,6 @@
002-1,63,67,0|script|Lieutenant Dausen|122
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state == 21) goto L_LD_Key;
diff --git a/world/map/npc/002-1/nickos.txt b/world/map/npc/002-1/nickos.txt
index 91abe6db..99f17b5c 100644
--- a/world/map/npc/002-1/nickos.txt
+++ b/world/map/npc/002-1/nickos.txt
@@ -3,9 +3,6 @@
002-1,46,108,0|script|Nickos|123
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state == 20) goto L_UGQ;
diff --git a/world/map/npc/002-1/sarah.txt b/world/map/npc/002-1/sarah.txt
index 83fc6558..e638186a 100644
--- a/world/map/npc/002-1/sarah.txt
+++ b/world/map/npc/002-1/sarah.txt
@@ -2,9 +2,6 @@
002-1,93,43,0|script|Sarah|106
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT);
if (@state >= 2) goto L_Done;
diff --git a/world/map/npc/002-1/soul-menhir.txt b/world/map/npc/002-1/soul-menhir.txt
index 3260e511..fa2a4508 100644
--- a/world/map/npc/002-1/soul-menhir.txt
+++ b/world/map/npc/002-1/soul-menhir.txt
@@ -2,7 +2,6 @@
002-1,58,60,0|script|Soul Menhir#tulimshar|345
{
- callfunc "ClearVariables";
set @map$, "001-1";
setarray @Xs, 57, 58, 59, 57, 59, 57, 59;
setarray @Ys, 59, 59, 59, 60, 60, 61, 61;
diff --git a/world/map/npc/002-1/stewen.txt b/world/map/npc/002-1/stewen.txt
index 4368f590..63808935 100644
--- a/world/map/npc/002-1/stewen.txt
+++ b/world/map/npc/002-1/stewen.txt
@@ -3,9 +3,6 @@
002-1,116,93,0|script|Stewen|123
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state == 4) goto L_TMW_Quest_Received;
diff --git a/world/map/npc/002-2/kylian.txt b/world/map/npc/002-2/kylian.txt
index 346fcffa..c5ed0baf 100644
--- a/world/map/npc/002-2/kylian.txt
+++ b/world/map/npc/002-2/kylian.txt
@@ -26,11 +26,11 @@
// state 8: Kylian was in the casino and gives a desert hat as reward
// state 9: Shop approved, go talk Kylian's shopkeeper if you are looking for work.
// state 10: Meet Shop keeper
-// state 11: Start Time Trial
+// state 11: Start Time Trial
// state 12: Return
// state 13: Start Daily Timed
// state 14: Return
-// state 15: Completed
+// state 15: Completed
// Kylian_Timer is used to denote start time.
// temporary variables used to check if the player logged out or left the building in the meanwhile
@@ -82,8 +82,6 @@ OnInit:
set @fun_money, 50;
set @fun_exp, 20;
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
set @fieri, ((QUEST_SouthTulimshar & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT);
if (@state == 15) goto L_Done;
@@ -366,7 +364,6 @@ function|script|SetKylianQuest
function|script|KylianDebug
{
set @state, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT);
- callfunc "ClearVarTMW_Quest";
set @fieri, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
set @run, ((QUEST_NorthTulimshar & TWOBIT_8_MASK) >> TWOBIT_8_SHIFT);
set @run_cnt, ((QUEST_NorthTulimshar & TWOBIT_9_MASK) >> TWOBIT_9_SHIFT);
diff --git a/world/map/npc/002-2/troupe_leader.txt b/world/map/npc/002-2/troupe_leader.txt
index de8517c5..79c85dc6 100644
--- a/world/map/npc/002-2/troupe_leader.txt
+++ b/world/map/npc/002-2/troupe_leader.txt
@@ -2,8 +2,6 @@
002-2,81,21,0|script|Troupe Leader|165
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (@inspector == 4) goto L_NohMask_Troupe;
diff --git a/world/map/npc/002-3/mining_camp_barrier.txt b/world/map/npc/002-3/mining_camp_barrier.txt
index 029722a1..a6550990 100644
--- a/world/map/npc/002-3/mining_camp_barrier.txt
+++ b/world/map/npc/002-3/mining_camp_barrier.txt
@@ -2,9 +2,6 @@
002-3,82,32,0|script|#Sandstorm_Mine_Barrier|45,0,0
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state >= 8) goto L_Barrier_Open;
diff --git a/world/map/npc/002-3/nathan.txt b/world/map/npc/002-3/nathan.txt
index 9661fc18..125c6a01 100644
--- a/world/map/npc/002-3/nathan.txt
+++ b/world/map/npc/002-3/nathan.txt
@@ -2,9 +2,6 @@
002-3,42,45,6|script|Nathan|109
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state >= 20) goto L_Nathan_Complete;
diff --git a/world/map/npc/002-4/mine_triggerone.txt b/world/map/npc/002-4/mine_triggerone.txt
index 03cee2da..ef8a75cb 100644
--- a/world/map/npc/002-4/mine_triggerone.txt
+++ b/world/map/npc/002-4/mine_triggerone.txt
@@ -3,9 +3,6 @@
002-4,30,47,0|script|Button#mine-1|400,0,0
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state == 24) goto L_Trigger_Wrong_1;
diff --git a/world/map/npc/002-4/mine_triggerthree.txt b/world/map/npc/002-4/mine_triggerthree.txt
index fe9fe672..707329da 100644
--- a/world/map/npc/002-4/mine_triggerthree.txt
+++ b/world/map/npc/002-4/mine_triggerthree.txt
@@ -3,9 +3,6 @@
002-4,91,99,0|script|Button#mine-3|400,0,0
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state == 24) goto L_Trigger_Wrong_3;
diff --git a/world/map/npc/002-4/mine_triggertwo.txt b/world/map/npc/002-4/mine_triggertwo.txt
index ec181596..5ec5b659 100644
--- a/world/map/npc/002-4/mine_triggertwo.txt
+++ b/world/map/npc/002-4/mine_triggertwo.txt
@@ -5,9 +5,6 @@
002-4,100,37,0|script|Button#mine-2|400,0,0
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state == 24) goto L_Trigger_2;
diff --git a/world/map/npc/002-4/naem.txt b/world/map/npc/002-4/naem.txt
index 9c2c1f65..34e43b49 100644
--- a/world/map/npc/002-4/naem.txt
+++ b/world/map/npc/002-4/naem.txt
@@ -4,9 +4,6 @@
002-4,91,96,6|script|Naem|109
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (FLAGS & FLAG_GOT_NAEM_GLOVES) goto L_Naem_Complete;
diff --git a/world/map/npc/002-4/underground_palace_barrier.txt b/world/map/npc/002-4/underground_palace_barrier.txt
index 3ed1a0a9..6c9d096a 100644
--- a/world/map/npc/002-4/underground_palace_barrier.txt
+++ b/world/map/npc/002-4/underground_palace_barrier.txt
@@ -2,9 +2,6 @@
002-4,68,98,0|script|#UGP_Barrier|45,0,0
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state >= 25) goto L_Barrier_Open;
diff --git a/world/map/npc/002-5/chest.txt b/world/map/npc/002-5/chest.txt
index fe0c2448..2cdda691 100644
--- a/world/map/npc/002-5/chest.txt
+++ b/world/map/npc/002-5/chest.txt
@@ -2,9 +2,6 @@
002-5,93,37,0|script|Supply Chest|378
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state >= 26) goto L_Finished;
diff --git a/world/map/npc/002-5/sema.txt b/world/map/npc/002-5/sema.txt
index 57ac1790..c80e9660 100644
--- a/world/map/npc/002-5/sema.txt
+++ b/world/map/npc/002-5/sema.txt
@@ -2,9 +2,6 @@
002-5,43,91,6|script|Sema|340
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
if (@state >= 28) goto L_Sema_Done;
diff --git a/world/map/npc/008-1/hinnak.txt b/world/map/npc/008-1/hinnak.txt
index 0213c3cc..c2360141 100644
--- a/world/map/npc/008-1/hinnak.txt
+++ b/world/map/npc/008-1/hinnak.txt
@@ -7,8 +7,6 @@
008-1,101,30,0|script|Hinnak|142
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (@inspector == 10) goto L_NohMask;
diff --git a/world/map/npc/008-1/mikhail.txt b/world/map/npc/008-1/mikhail.txt
index bf804796..98a58d12 100644
--- a/world/map/npc/008-1/mikhail.txt
+++ b/world/map/npc/008-1/mikhail.txt
@@ -2,9 +2,6 @@
008-1,135,25,0|script|Mikhail|120
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
if (@state >= 6) goto L_Done;
diff --git a/world/map/npc/009-1/jack.txt b/world/map/npc/009-1/jack.txt
index 03e38c31..05c9f8c5 100644
--- a/world/map/npc/009-1/jack.txt
+++ b/world/map/npc/009-1/jack.txt
@@ -16,8 +16,6 @@
// Lumberjack
009-1,40,45,0|script|Jack|141
{
- callfunc "ClearVariables";
-
set @RAWLOGS_AMOUNT, 40;
set @SHIELD_COST, 5000;
set @QUEST_SHIELD_EXP, 2500;
diff --git a/world/map/npc/009-1/milly.txt b/world/map/npc/009-1/milly.txt
index 3e389d27..f1408619 100644
--- a/world/map/npc/009-1/milly.txt
+++ b/world/map/npc/009-1/milly.txt
@@ -8,8 +8,6 @@
009-1,81,41,0|script|Milly|114
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
set @got_boneknife, ((QUEST_Forestbow_state & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT) >= 4;
diff --git a/world/map/npc/009-1/old_man.txt b/world/map/npc/009-1/old_man.txt
index ca3999ee..4abf906e 100644
--- a/world/map/npc/009-1/old_man.txt
+++ b/world/map/npc/009-1/old_man.txt
@@ -2,8 +2,6 @@
009-1,85,51,0|script|Old Man|159
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
mes "[Old Man]";
diff --git a/world/map/npc/009-1/old_woman.txt b/world/map/npc/009-1/old_woman.txt
index ac026357..d3b26e7e 100644
--- a/world/map/npc/009-1/old_woman.txt
+++ b/world/map/npc/009-1/old_woman.txt
@@ -2,8 +2,6 @@
009-1,29,43,0|script|Old Woman|154
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (BaseLevel < 40) goto L_Lower;
diff --git a/world/map/npc/009-1/sabine.txt b/world/map/npc/009-1/sabine.txt
index 348e28c4..2f960f75 100644
--- a/world/map/npc/009-1/sabine.txt
+++ b/world/map/npc/009-1/sabine.txt
@@ -2,8 +2,6 @@
009-1,88,27,0|script|Sabine|106
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
mes "[Sabine]";
diff --git a/world/map/npc/009-1/soul-menhir.txt b/world/map/npc/009-1/soul-menhir.txt
index 855eddf1..3b8c5cee 100644
--- a/world/map/npc/009-1/soul-menhir.txt
+++ b/world/map/npc/009-1/soul-menhir.txt
@@ -2,7 +2,6 @@
009-1,53,40,0|script|Soul Menhir#hurnscald|344
{
- callfunc "ClearVariables";
set @map$, "009-1";
setarray @Xs, 52, 53, 54, 52, 54, 52, 54;
setarray @Ys, 39, 39, 39, 40, 40, 41, 41;
diff --git a/world/map/npc/009-2/alan.txt b/world/map/npc/009-2/alan.txt
index 412b5823..6e0e6f21 100644
--- a/world/map/npc/009-2/alan.txt
+++ b/world/map/npc/009-2/alan.txt
@@ -10,8 +10,6 @@
// Archer Shop Master
009-2,99,23,0|script|Alan|125
{
- callfunc "ClearVariables";
-
set @Q_MASK, NIBBLE_0_MASK;
set @Q_SHIFT, NIBBLE_0_SHIFT;
diff --git a/world/map/npc/009-2/bernard.txt b/world/map/npc/009-2/bernard.txt
index f0c03fbc..1d6b4229 100644
--- a/world/map/npc/009-2/bernard.txt
+++ b/world/map/npc/009-2/bernard.txt
@@ -2,9 +2,6 @@
009-2,67,79,0|script|Bernard|117
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
if (@state >= 6) goto L_Done3;
diff --git a/world/map/npc/009-2/doctor.txt b/world/map/npc/009-2/doctor.txt
index 9137d8d4..f44cda64 100644
--- a/world/map/npc/009-2/doctor.txt
+++ b/world/map/npc/009-2/doctor.txt
@@ -2,8 +2,6 @@
009-2,148,25,0|script|Doctor|107
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (getequipid(equip_head) == 616) goto L_Axe;
diff --git a/world/map/npc/009-2/inspector.txt b/world/map/npc/009-2/inspector.txt
index 966fe45e..d61fc708 100644
--- a/world/map/npc/009-2/inspector.txt
+++ b/world/map/npc/009-2/inspector.txt
@@ -2,8 +2,6 @@
009-2,24,99,0|script|Inspector#Hurnscald|150
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (@inspector == 0 && BaseLevel >= 30) goto L_Start;
diff --git a/world/map/npc/009-2/lena.txt b/world/map/npc/009-2/lena.txt
index e151736b..6f22030a 100644
--- a/world/map/npc/009-2/lena.txt
+++ b/world/map/npc/009-2/lena.txt
@@ -3,9 +3,6 @@
009-2,146,43,0|script|Lena|182
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_Hurnscald & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
if (@state >= 6) goto L_Lena_Done;
diff --git a/world/map/npc/009-2/nurse.txt b/world/map/npc/009-2/nurse.txt
index fa1ee5d2..8a5b3862 100644
--- a/world/map/npc/009-2/nurse.txt
+++ b/world/map/npc/009-2/nurse.txt
@@ -24,7 +24,6 @@
//######################################################################################
009-2,147,65,0|script|Nurse|119
{
- callfunc "ClearVariables";
set @halloween_npc_id, $@halloween_npc_nurse;
callfunc "TrickOrTreat";
diff --git a/world/map/npc/009-2/richard.txt b/world/map/npc/009-2/richard.txt
index b39a7969..11c180d4 100644
--- a/world/map/npc/009-2/richard.txt
+++ b/world/map/npc/009-2/richard.txt
@@ -2,7 +2,6 @@
009-2,20,99,0|script|Richard|161
{
- callfunc "ClearVariables";
set @npcname$, "Richard";
callfunc "Banker";
close;
diff --git a/world/map/npc/011-6/bryant.txt b/world/map/npc/011-6/bryant.txt
index fae31706..9969b767 100644
--- a/world/map/npc/011-6/bryant.txt
+++ b/world/map/npc/011-6/bryant.txt
@@ -3,9 +3,6 @@
011-6,27,200,0|script|Bryant|126
{
- // This NPC previously used the variable TMW_Quest
- callfunc "ClearVarTMW_Quest";
-
set @state, ((QUEST_Hurnscald & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
if (@state >= 5) goto L_Bryant_Quiet;
diff --git a/world/map/npc/013-3/barrier.txt b/world/map/npc/013-3/barrier.txt
index 442870d9..0e00a40c 100644
--- a/world/map/npc/013-3/barrier.txt
+++ b/world/map/npc/013-3/barrier.txt
@@ -2,8 +2,6 @@
013-3,71,21,0|script|#DemonMineBarrier1#_M|45,1,1
{
- callfunc "ClearVariables";
-
set @state, ((QUEST_Hurnscald & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
if (@state >= 2) goto L_End;
diff --git a/world/map/npc/013-3/mask_chest.txt b/world/map/npc/013-3/mask_chest.txt
index 1b62e66c..204eec4c 100644
--- a/world/map/npc/013-3/mask_chest.txt
+++ b/world/map/npc/013-3/mask_chest.txt
@@ -2,8 +2,6 @@
013-3,28,27,0|script|Chest#DemonMask|111
{
- callfunc "ClearVariables";
-
set @state, ((QUEST_Hurnscald & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
if (@state < 2) goto L_This_shouldn_t_happen;
diff --git a/world/map/npc/013-3/sword_chest.txt b/world/map/npc/013-3/sword_chest.txt
index de06261d..503dda7e 100644
--- a/world/map/npc/013-3/sword_chest.txt
+++ b/world/map/npc/013-3/sword_chest.txt
@@ -2,7 +2,6 @@
013-3,177,22,0|script|Chest#sword|111
{
- callfunc "ClearVariables";
if (FLAGS & FLAG_HURNSMINE_CHEST) goto L_Finished;
mes "[Chest]";
diff --git a/world/map/npc/018-2/angus.txt b/world/map/npc/018-2/angus.txt
index 5b7dda85..e49d91ae 100644
--- a/world/map/npc/018-2/angus.txt
+++ b/world/map/npc/018-2/angus.txt
@@ -5,8 +5,6 @@
set @honorific$, "lad";
if (Sex == 0) set @honorific$, "lass";
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (@inspector == 10) goto L_NohMask;
diff --git a/world/map/npc/018-2/books.txt b/world/map/npc/018-2/books.txt
index cd8148c0..24624762 100644
--- a/world/map/npc/018-2/books.txt
+++ b/world/map/npc/018-2/books.txt
@@ -2,8 +2,6 @@
018-2,112,19,0|script|#Bookcase38|400,0,1
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
if (@inspector == 11) goto L_NohMask;
diff --git a/world/map/npc/018-2/caul.txt b/world/map/npc/018-2/caul.txt
index 5d53ba48..2a1a2769 100644
--- a/world/map/npc/018-2/caul.txt
+++ b/world/map/npc/018-2/caul.txt
@@ -9,8 +9,6 @@
018-2,37,22,0|script|Caul|107
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
set @SETZER_INITIAL, 0;
diff --git a/world/map/npc/018-2/miners.txt b/world/map/npc/018-2/miners.txt
index e29f15f6..29192eec 100644
--- a/world/map/npc/018-2/miners.txt
+++ b/world/map/npc/018-2/miners.txt
@@ -3,8 +3,6 @@
018-2,85,23,0|script|Malek|109
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
set @MIN_GEM_AMOUNT, 7;
diff --git a/world/map/npc/018-2/receptionist.txt b/world/map/npc/018-2/receptionist.txt
index 50143f2c..efac07d9 100644
--- a/world/map/npc/018-2/receptionist.txt
+++ b/world/map/npc/018-2/receptionist.txt
@@ -2,8 +2,6 @@
018-2,50,24,0|script|Receptionist#mine|108
{
- callfunc "ClearVariables";
-
set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
mes "[Receptionist]";
diff --git a/world/map/npc/018-3/bookcase.txt b/world/map/npc/018-3/bookcase.txt
index a2cf0431..8c5d587f 100644
--- a/world/map/npc/018-3/bookcase.txt
+++ b/world/map/npc/018-3/bookcase.txt
@@ -2,8 +2,6 @@
018-3,75,123,0|script|#DemonMineBookcase1|400
{
- callfunc "ClearVariables";
-
set @state, ((QUEST_Hurnscald & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
if (@state == 0) goto L_Search;
diff --git a/world/map/npc/018-3/evil-obelisk.txt b/world/map/npc/018-3/evil-obelisk.txt
index ac316fd5..4ecc00b3 100644
--- a/world/map/npc/018-3/evil-obelisk.txt
+++ b/world/map/npc/018-3/evil-obelisk.txt
@@ -2,7 +2,6 @@
018-3,67,28,0|script|Evil Obelisk|185
{
- callfunc "ClearVariables";
set @map$, "018-3";
set @x0, 56;
set @y0, 22;
diff --git a/world/map/npc/019-1/santa_helper.txt b/world/map/npc/019-1/santa_helper.txt
index d5b5d3bc..9d8a21b9 100644
--- a/world/map/npc/019-1/santa_helper.txt
+++ b/world/map/npc/019-1/santa_helper.txt
@@ -4,7 +4,6 @@
019-1,74,75,0|script|Santa's Helper|105
{
- callfunc "ClearVariables";
callfunc "XmasStates";
if (($@xmas_time) && (@xmas_sh_done)) goto L_Done;
diff --git a/world/map/npc/019-1/snowman.txt b/world/map/npc/019-1/snowman.txt
index eb72c74a..893ddce4 100644
--- a/world/map/npc/019-1/snowman.txt
+++ b/world/map/npc/019-1/snowman.txt
@@ -3,7 +3,6 @@
019-1,77,44,0|script|Snowman|129
{
- callfunc "ClearVariables";
if (FLAGS & FLAG_SNOWMAN) goto L_Done;
if (gettime(6) == 12 || gettime(6) == 1 || gettime(6) == 2) goto L_Quest;
diff --git a/world/map/npc/020-1/soul-menhir.txt b/world/map/npc/020-1/soul-menhir.txt
index 6066c2ea..c8f7740a 100644
--- a/world/map/npc/020-1/soul-menhir.txt
+++ b/world/map/npc/020-1/soul-menhir.txt
@@ -2,7 +2,6 @@
020-1,63,89,0|script|Soul Menhir#nivalis|346
{
- callfunc "ClearVariables";
set @map$, "020-1";
setarray @Xs, 62, 63, 64, 62, 64, 62, 64;
setarray @Ys, 88, 88, 88, 89, 89, 90, 90;
diff --git a/world/map/npc/020-2/banker.txt b/world/map/npc/020-2/banker.txt
index 3359501b..edf1c26b 100644
--- a/world/map/npc/020-2/banker.txt
+++ b/world/map/npc/020-2/banker.txt
@@ -1,6 +1,5 @@
020-2,122,64,0|script|Ben|193
{
- callfunc "ClearVariables";
set @npcname$, "Ben";
callfunc "Banker";
close;
diff --git a/world/map/npc/027-2/gy_inn_shops.txt b/world/map/npc/027-2/gy_inn_shops.txt
index 8808755d..20f03d3a 100644
--- a/world/map/npc/027-2/gy_inn_shops.txt
+++ b/world/map/npc/027-2/gy_inn_shops.txt
@@ -40,7 +40,6 @@
// Bank and Storage
027-2,88,22,0|script|J.P. Morbid|321
{
- callfunc "ClearVariables";
set @npcname$, "J.P. Morbid";
callfunc "Banker";
close;
diff --git a/world/map/npc/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt
index 0cfa33cb..f26164df 100644
--- a/world/map/npc/functions/clear_vars.txt
+++ b/world/map/npc/functions/clear_vars.txt
@@ -2,7 +2,14 @@
function|script|ClearVariables
{
- callfunc "getHeadStyles"; // this converts class, color and hair
+ if(@login_event != 1) goto L_Deprecated;
+
+ callsub S_Bernard_Mikhail;
+ callsub S_Sarah;
+ callsub S_Vincent;
+ callsub S_Sandra;
+ callsub S_Desert;
+ callsub S_Bandit;
callsub S_Tutorial;
callsub S_Heathin;
callsub S_Remove_Skills;
@@ -37,9 +44,7 @@ function|script|ClearVariables
S_Return: // this is to end execution of a sub
return;
-
-
-
+////////////////////////////////////////////////////////////////
S_Xmas2007:
if(!QUEST_xmas07_state) goto S_Return;
@@ -320,88 +325,61 @@ S_Heathin:
set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_6_MASK)) | (HEATHIN_QUEST << NIBBLE_6_SHIFT);
set HEATHIN_QUEST, 0;
return;
-}
-
-
-
-
-
-// The variable TMW_Quest was used to save the progress in several subquests linearly.
-// The subquests are moved to different nibbles of other variables
-// to make it possible to do some of the quests in parallel.
-function|script|ClearVarTMW_Quest
-{
- if (TMW_Quest == 0) goto L_Done;
- if (TMW_Quest <= 6) goto L_Bernard_Mikhail;
- if (TMW_Quest <= 8) goto L_Sarah;
- if (TMW_Quest <= 10) goto L_Vincent;
- if (TMW_Quest <= 12) goto L_Sandra;
- if (TMW_Quest <= 40) goto L_Desert;
- goto L_Bandit;
-
-L_Bandit:
-// move Bandit subquest into Nibble 0 of QUEST_Hurnscald
- set @bandit, TMW_Quest - 40;
- set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_0_MASK) | (@bandit << NIBBLE_0_SHIFT));
- set TMW_Quest, 40;
- set @bandit, 0;
- goto L_Desert;
-
-L_Desert:
-// move guard and miner subquest into Byte 2 (Nibble 4 and 5) of QUEST_SouthTulimshar
+S_Desert: // move guard and miner subquest into Byte 2 (Nibble 4 and 5) of QUEST_SouthTulimshar
+ if(!TMW_QUEST || TMW_QUEST > 40) goto S_Return;
set @miners, TMW_Quest - 12;
set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@miners << BYTE_2_SHIFT));
set TMW_Quest, 12;
set @miners, 0;
- goto L_Sandra;
+ return;
-L_Sandra:
-// move Sandra subquest into Nibble 3 of QUEST_SouthTulimshar
+S_Sandra: // move Sandra subquest into Nibble 3 of QUEST_SouthTulimshar
+ if(!TMW_QUEST || TMW_QUEST > 12) goto S_Return;
set @sandra, TMW_Quest - 10;
set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_3_MASK) | (@sandra << NIBBLE_3_SHIFT));
set TMW_Quest, 10;
set @sandra, 0;
- goto L_Vincent;
+ return;
-L_Vincent:
-// move Vincent subquest into Nibble 2 of QUEST_SouthTulimshar
+S_Vincent: // move Vincent subquest into Nibble 2 of QUEST_SouthTulimshar
+ if(!TMW_QUEST || TMW_QUEST > 10) goto S_Return;
set @vincent, TMW_Quest - 8;
set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_2_MASK) | (@vincent << NIBBLE_2_SHIFT));
set TMW_Quest, 8;
set @vincent, 0;
- goto L_Sarah;
+ return;
-L_Sarah:
-// move Sarah subquest into Nibble 1 of QUEST_SouthTulimshar
+S_Sarah: // move Sarah subquest into Nibble 1 of QUEST_SouthTulimshar
+ if(!TMW_QUEST || TMW_QUEST > 8) goto S_Return;
set @sarah, TMW_Quest - 6;
set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_1_MASK) | (@sarah << NIBBLE_1_SHIFT));
set TMW_Quest, 6;
set @sarah, 0;
- goto L_Bernard_Mikhail;
+ return;
-L_Bernard_Mikhail:
-// move Bernard and Mikhail subquest into Nibble 0 of QUEST_SouthTulimshar
+S_Bernard_Mikhail: // move Bernard and Mikhail subquest into Nibble 0 of QUEST_SouthTulimshar
+ if(!TMW_QUEST || TMW_QUEST > 6) goto S_Return;
set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_0_MASK) | (TMW_Quest << NIBBLE_0_SHIFT));
set TMW_Quest, 0;
- goto L_Done;
-
-L_Done:
return;
-}
-
-
-
+S_Bandit: // move Bandit subquest into Nibble 0 of QUEST_Hurnscald
+ if(!TMW_QUEST) goto S_Return;
+ set @bandit, TMW_Quest - 40;
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_0_MASK) | (@bandit << NIBBLE_0_SHIFT));
+ set TMW_Quest, 40;
+ set @bandit, 0;
+ return;
+L_Deprecated:
+ debugmes "Explicitely calling ClearVariables after login is deprecated.";
+ mapexit;
+}
--|script|#ClearGlobalVars|-1
+function|script|ClearGlobalVars
{
- end;
-
-OnInit:
-
// Clear some entries of the arrays which save the Fluffy Hunting highscore list
set $@loop, 5;
goto L_FluffyClear;
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
index 0b691e45..9ce44a38 100644
--- a/world/map/npc/functions/global_event_handler.txt
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -3,12 +3,16 @@
//
// Author: meko
-017-9,0,0,0|script|#GlobalHandler|-1
+-|script|#GlobalHandler|-1
{
end;
OnPCLoginEvent:
- callfunc "ClearVariables";
+ set @login_event, 1;
+ callfunc "getHeadStyles"; // converts class, color and hair
+ callfunc "ClearVariables"; // removes / converts old variables
+ // add more here
+ set @login_event, 2;
end;
OnPCKillEvent:
@@ -23,4 +27,8 @@ OnPCDieEvent:
callfunc "fightclub_GoBack"; // this used by the battle master
callfunc "fightclub_event_die"; // this is used by the 1v1 arena
end;
+
+OnInit: //fixme: change to OnInterIfInit
+ callfunc "ClearGlobalVars";
+ end;
}