summaryrefslogtreecommitdiff
path: root/world/map/npc/functions
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-04-24 16:47:51 -0400
committermekolat <mekolat@users.noreply.github.com>2015-04-26 01:57:40 -0400
commita413653361e218695fa6305d760c22458ac78657 (patch)
tree93a2c4c2223e7400d1e56697a867ec0f5a710b85 /world/map/npc/functions
parent024b3be4951424cd5a1169020083c331b0cfb445 (diff)
downloadserverdata-a413653361e218695fa6305d760c22458ac78657.tar.gz
serverdata-a413653361e218695fa6305d760c22458ac78657.tar.bz2
serverdata-a413653361e218695fa6305d760c22458ac78657.tar.xz
serverdata-a413653361e218695fa6305d760c22458ac78657.zip
remove other instances of ClearVariables
Diffstat (limited to 'world/map/npc/functions')
-rw-r--r--world/map/npc/functions/clear_vars.txt92
-rw-r--r--world/map/npc/functions/global_event_handler.txt12
2 files changed, 45 insertions, 59 deletions
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;
}