summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/clear_vars.txt
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-04-24 16:20:45 -0400
committermekolat <mekolat@users.noreply.github.com>2015-04-24 16:20:45 -0400
commit024b3be4951424cd5a1169020083c331b0cfb445 (patch)
treeb3e48db64515b102080841cbc56f76f70058f635 /world/map/npc/functions/clear_vars.txt
parent931217d3ba156cecb25fa647bc572630147e60fd (diff)
downloadserverdata-024b3be4951424cd5a1169020083c331b0cfb445.tar.gz
serverdata-024b3be4951424cd5a1169020083c331b0cfb445.tar.bz2
serverdata-024b3be4951424cd5a1169020083c331b0cfb445.tar.xz
serverdata-024b3be4951424cd5a1169020083c331b0cfb445.zip
clean clearvars
Diffstat (limited to 'world/map/npc/functions/clear_vars.txt')
-rw-r--r--world/map/npc/functions/clear_vars.txt340
1 files changed, 204 insertions, 136 deletions
diff --git a/world/map/npc/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt
index 0b363e31..0cfa33cb 100644
--- a/world/map/npc/functions/clear_vars.txt
+++ b/world/map/npc/functions/clear_vars.txt
@@ -2,98 +2,59 @@
function|script|ClearVariables
{
- // Tutorial
- if ((TUTORIAL) || (sorfina))
- goto L_ResetTut;
- goto L_Heathin;
+ callfunc "getHeadStyles"; // this converts class, color and hair
+ callsub S_Tutorial;
+ callsub S_Heathin;
+ callsub S_Remove_Skills;
+ callsub S_FixBank;
+ callsub S_Angus;
+ callsub S_Flags;
+ callsub S_Bitmask;
+
+ callsub S_Easter;
+ callsub S_Easter2008;
+ callsub S_Easter2009;
+ callsub S_Easter2010;
+ callsub S_Easter2011;
+ callsub S_Easter2012;
+ callsub S_Halloween2006;
+ callsub S_Halloween2007;
+ callsub S_Halloween2008;
+ callsub S_Halloween2009;
+ callsub S_Halloween2010;
+ callsub S_Halloween2011;
+ callsub S_Xmas2006;
+ callsub S_Xmas2007;
+ callsub S_Xmas2008;
+ callsub S_Xmas2009;
+ callsub S_Xmas2010;
+ callsub S_Xmas2011;
+ callsub S_Xmas2012;
+
+ callsub S_Misc;
+ return; // go back to global handler
+
+S_Return: // this is to end execution of a sub
+ return;
-L_ResetTut:
- //TUTORIAL to STARTAREA
- if ((sorfina) || (kaan) || (hasan) || (tanisha))
- goto L_ResetAllTut;
- set @tutorial_tmp, ((TUTORIAL & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
- // Tutorial
- // Nibble 0 (sorfina, tanisha, kaan & hasan)
- set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT));
- // Nibble 1 (valon)
- set @tutorial_tmp, ((TUTORIAL & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
- set @valon_done, (TUTORIAL & (1 << 7));
- set @valon_start, (TUTORIAL & (1 << 6));
- if (@valon_start)
- set @tutorial_tmp, (@tutorial_tmp + 2);
- if (@valon_done)
- set @tutorial_tmp, 7;
- set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (@tutorial_tmp << NIBBLE_1_SHIFT));
- // Nibble 2 (Counts)
- set @tutorial_tmp, ((TUTORIAL & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
- set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (@tutorial_tmp << NIBBLE_2_SHIFT));
- // Nibble 3 (Morgan)
- set @tutorial_tmp, ((TUTORIAL & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT);
- set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (@tutorial_tmp << NIBBLE_3_SHIFT));
- // Nibble 4 (Zegas) Barrels shuffled
- set @zegas_done, (TUTORIAL & (1 << 23));
- set @zegas_start, (TUTORIAL & (1 << 16));
- set @zegas_met, (TUTORIAL & (1 << 30));
- set @tutorial_tmp, 0;
- if (@zegas_met)
- set @tutorial_tmp, 1;
- if (@zegas_start)
- set @tutorial_tmp, 2;
- if (@zegas_done)
- set @tutorial_tmp, 4;
- set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (@tutorial_tmp << NIBBLE_4_SHIFT));
- // Nibble 5 (Barrels)
- set @tutorial_tmp, 0;
- set STARTAREA, (STARTAREA & ~(NIBBLE_5_MASK) | (@tutorial_tmp << NIBBLE_5_SHIFT));
- // Nibble 6 (Barrels)
- set STARTAREA, (STARTAREA & ~(NIBBLE_6_MASK) | (@tutorial_tmp << NIBBLE_6_SHIFT));
- set TUTORIAL, 0;
- goto L_Heathin;
-L_ResetAllTut:
- set sorfina, 0;
- set tanisha, 0;
- set hasan, 0;
- set kaan, 0;
- set TUTORIAL, 0;
- set STARTAREA, 0;
- set FLAGS, FLAGS &~ FLAG_TUTORIAL_DONE;
- goto L_Heathin;
-L_Heathin:
- if (HEATHIN_QUEST > 0)
- set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_6_MASK)) | (HEATHIN_QUEST << NIBBLE_6_SHIFT);
- set HEATHIN_QUEST, 0;
- goto L_Easter;
-L_Easter:
- // Easter
- set EasterQuest, 0;
- // Halloween 2006
- set HWQUEST1, 0;
- set HWQUEST2, 0;
- set HWQUEST3, 0;
- set HWQUEST4, 0;
- set HWQUEST5, 0;
- set HWQUEST6, 0;
- set HWQUEST7, 0;
- set HWQUEST8, 0;
- set HWQUEST9, 0;
- set HWQUEST10, 0;
- set HWQUEST11, 0;
- set HWQUEST12, 0;
- set HWQUEST13, 0;
- set HWQUEST14, 0;
- set HWQUEST15, 0;
- set HWQUEST16, 0;
- set HWQUEST17, 0;
- set HWQUEST18, 0;
- set HWQUEST18, 0;
- set HWQUEST19, 0;
- set HWQUEST20, 0;
+S_Xmas2007:
+ if(!QUEST_xmas07_state) goto S_Return;
+ set QUEST_xmas07_state, 0;
+ set QUEST_xmas07_milk, 0;
+ set QUEST_xmas07_cookies, 0;
+ set QUEST_xmas07_presents, 0;
+ return;
+
+S_Halloween2007:
+ set QUEST_Halloween07_state, 0;
+ return;
- // Christmas 2006
+S_Xmas2006:
+ if(!XMASQUEST1) goto S_Return;
set XMASQUEST1, 0;
set XMASQUEST2, 0;
set XMASQUEST3, 0;
@@ -114,38 +75,74 @@ L_Easter:
set XMASQUEST18, 0;
set XMASQUEST19, 0;
set XMASQUEST20, 0;
+ return;
- set QUEST_Halloween07_state, 0;
+S_Halloween2006:
+ if(!HWQUEST1) goto S_Return;
+ set HWQUEST1, 0;
+ set HWQUEST2, 0;
+ set HWQUEST3, 0;
+ set HWQUEST4, 0;
+ set HWQUEST5, 0;
+ set HWQUEST6, 0;
+ set HWQUEST7, 0;
+ set HWQUEST8, 0;
+ set HWQUEST9, 0;
+ set HWQUEST10, 0;
+ set HWQUEST11, 0;
+ set HWQUEST12, 0;
+ set HWQUEST13, 0;
+ set HWQUEST14, 0;
+ set HWQUEST15, 0;
+ set HWQUEST16, 0;
+ set HWQUEST17, 0;
+ set HWQUEST18, 0;
+ set HWQUEST18, 0;
+ set HWQUEST19, 0;
+ set HWQUEST20, 0;
+ return;
- set QUEST_xmas07_state, 0;
- set QUEST_xmas07_milk, 0;
- set QUEST_xmas07_cookies, 0;
- set QUEST_xmas07_presents, 0;
+S_Easter:
+ set EasterQuest, 0;
+ return;
+S_Easter2008:
set QUEST_Easter08_state, 0;
+ return;
+S_Halloween2008:
set Halloween08, 0;
+ return;
+S_Xmas2008:
set QUEST_xmas08_state, 0;
+ return;
+S_Easter2009:
set QUEST_Easter09, 0;
+ set QUEST_Easter09_slots, 0;
+ return;
- set Candyman, 0; // Halloween 2009
+S_Halloween2009:
+ set Candyman, 0;
+ return;
+S_Xmas2009:
set QUEST_Christmas09_state, 0;
+ return;
- set QUEST_Easter09_slots, 0;
-
- // easter 2010
- // This must not be cleared: since some people would like to go to the easter island!
- // set Easter_2010_QuestState, 0;
+S_Easter2010:
+ if(!Easter_2010_QuestState) goto S_Return;
+ set Easter_2010_QuestState, 0;
set Easter_2010_EggState1, 0;
set Easter_2010_EggState2, 0;
set Easter_2010_EggState3, 0;
set Easter_2010_EggState4, 0;
set Easter_2010_EggState5, 0;
+ return;
- // halloween 2010
+S_Halloween2010:
+ if(!hween10) goto S_Return;
set hween10, 0;
set hween10_collect_canpump, 0;
set hween10_credits, 0;
@@ -155,8 +152,10 @@ L_Easter:
set hween10_bonecount, 0;
set hween10_collect_tondel, 0;
set hween10_paid, 0;
+ return;
- // Xmas 2010:
+S_Xmas2010:
+ if(!Xmas2010) goto S_Return;
set Count_Yellow, 0;
set Count_White, 0;
set Maze, 0;
@@ -164,32 +163,34 @@ L_Easter:
set White, 0;
set Xmas2010, 0;
set Golbenez_Inn_Cost, 0;
+ return;
+S_Easter2011:
set QUEST_Easter11, 0;
+ return;
- // contains bad karma information
- // set hw2011, 0;
+S_Halloween2011:
+ set hw2011, 0;
+ return;
+S_Xmas2011:
set xmas11, 0;
+ return;
+S_Easter2012:
set QUEST_Easter12, 0;
+ return;
+S_Xmas2012:
set xmas2012, 0;
+ return;
+S_Angus:
set QUEST_clothdyer_angus, 0;
-
- // Tulimshar and Mine Variables which aren't used anymore
- set Scorp, 0;
- set Bugleg, 0;
- // variable isn't used
set QUEST_clothdyer_state, 0;
- // variable was moved to a temporary player variable
- set KatzeBeenOutside, 0;
- // variable was moved to Nibble 1 of the variable Katze
- set LastHiss, 0;
- // quest was turned into a Daily Quest, so the variable isn't needed anymore
- set CaveSnakeLamp, 0;
+ return;
+S_Bitmask:
// move Scythe quest into bitmasked variable QUEST_Hurnscald
if (QUEST_Scythe_state)
set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_1_MASK)) | (QUEST_Scythe_state << NIBBLE_1_SHIFT);
@@ -206,8 +207,9 @@ L_Easter:
set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (Inspector << NIBBLE_3_SHIFT);
set Inspector, 0;
set @inspector, 0;
+ return;
- //These lines are needed to migrate stuff from variables to flags
+S_Flags:
if (Open_Underground_Palace_Barrier)
set FLAGS, FLAGS | FLAG_OPENED_UNDERGROUND;
set Open_Underground_Palace_Barrier, 0;
@@ -227,44 +229,104 @@ L_Easter:
if (ChestQuest)
set FLAGS, FLAGS | FLAG_HURNSMINE_CHEST;
set ChestQuest, 0;
+ return;
- if (#BankAccount < 0)
- goto L_FixBank;
-
- goto L_Fix_Skills;
-
-L_FixBank:
+S_FixBank:
+ if(#BankAccount >= 0) goto S_Return;
if (Zeny >= -#BankAccount)
- goto L_Fix_Full;
-
+ goto S_Fix_Bank_Full;
// Partial fix
set #BankAccount, #BankAccount + Zeny;
set Zeny, 0;
- goto L_Fix_Skills;
+ return;
-L_Fix_Full:
+S_Fix_Bank_Full:
set Zeny, Zeny + #BankAccount;
set #BankAccount, 0;
- goto L_Fix_Skills;
-
-L_Fix_Skills:
- if(getskilllv(SKILL_TRADE) > 0) setskill SKILL_TRADE, 0;
- if(getskilllv(SKILL_PARTY) > 0) setskill SKILL_PARTY, 0;
- if(getskilllv(SKILL_EMOTE) > 0) setskill SKILL_EMOTE, 0;
- goto L_Barber_Janitor;
+ return;
-L_Barber_Janitor:
- callfunc "getHeadStyles"; // this converts class, color and hair
- goto L_Return;
+S_Remove_Skills:
+ if(getskilllv(SKILL_TRADE) < 1) goto S_Return;
+ setskill SKILL_TRADE, 0;
+ setskill SKILL_PARTY, 0;
+ setskill SKILL_EMOTE, 0;
+ return;
-L_Misc:
+S_Misc:
if(Death_Kill) set Death_Kill, 0;
- goto L_Return;
+ set Scorp, 0; // Tulimshar and Mine Variables which aren't used anymore
+ set Bugleg, 0; // Tulimshar and Mine Variables which aren't used anymore
+ set KatzeBeenOutside, 0; // variable was moved to a temporary player variable
+ set LastHiss, 0; // variable was moved to Nibble 1 of the variable Katze
+ set CaveSnakeLamp, 0; // quest was turned into a Daily Quest, so the variable isn't needed anymore
+ return;
-L_Return:
+S_Tutorial:
+ if(!TUTORIAL && !sorfina) goto S_Return;
+ //TUTORIAL to STARTAREA
+ if ((sorfina) || (kaan) || (hasan) || (tanisha))
+ goto S_ResetAllTut;
+ set @tutorial_tmp, ((TUTORIAL & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+ // Tutorial
+ // Nibble 0 (sorfina, tanisha, kaan & hasan)
+ set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT));
+ // Nibble 1 (valon)
+ set @tutorial_tmp, ((TUTORIAL & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+ set @valon_done, (TUTORIAL & (1 << 7));
+ set @valon_start, (TUTORIAL & (1 << 6));
+ if (@valon_start)
+ set @tutorial_tmp, (@tutorial_tmp + 2);
+ if (@valon_done)
+ set @tutorial_tmp, 7;
+ set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (@tutorial_tmp << NIBBLE_1_SHIFT));
+ // Nibble 2 (Counts)
+ set @tutorial_tmp, ((TUTORIAL & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+ set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (@tutorial_tmp << NIBBLE_2_SHIFT));
+ // Nibble 3 (Morgan)
+ set @tutorial_tmp, ((TUTORIAL & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT);
+ set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (@tutorial_tmp << NIBBLE_3_SHIFT));
+ // Nibble 4 (Zegas) Barrels shuffled
+ set @zegas_done, (TUTORIAL & (1 << 23));
+ set @zegas_start, (TUTORIAL & (1 << 16));
+ set @zegas_met, (TUTORIAL & (1 << 30));
+ set @tutorial_tmp, 0;
+ if (@zegas_met)
+ set @tutorial_tmp, 1;
+ if (@zegas_start)
+ set @tutorial_tmp, 2;
+ if (@zegas_done)
+ set @tutorial_tmp, 4;
+ set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (@tutorial_tmp << NIBBLE_4_SHIFT));
+ // Nibble 5 (Barrels)
+ set @tutorial_tmp, 0;
+ set STARTAREA, (STARTAREA & ~(NIBBLE_5_MASK) | (@tutorial_tmp << NIBBLE_5_SHIFT));
+ // Nibble 6 (Barrels)
+ set STARTAREA, (STARTAREA & ~(NIBBLE_6_MASK) | (@tutorial_tmp << NIBBLE_6_SHIFT));
+ set TUTORIAL, 0;
+ return;
+
+S_ResetAllTut:
+ set sorfina, 0;
+ set tanisha, 0;
+ set hasan, 0;
+ set kaan, 0;
+ set TUTORIAL, 0;
+ set STARTAREA, 0;
+ set FLAGS, FLAGS &~ FLAG_TUTORIAL_DONE;
+ return;
+
+S_Heathin:
+ if(!HEATHIN_QUEST) goto S_Return;
+ 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.
@@ -328,6 +390,12 @@ L_Done:
return;
}
+
+
+
+
+
+
-|script|#ClearGlobalVars|-1
{
end;