diff options
author | Wushin <pasekei@gmail.com> | 2015-04-30 00:19:27 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2015-04-30 00:19:27 -0500 |
commit | 86cc243c069b90c3eb47df1faede506822634f4a (patch) | |
tree | 06fa0213f689fc1e5dd3ef03b99eed1b427bf7b0 | |
parent | 17a8452f5a55f93f7d38e027b69d98445daabdef (diff) | |
parent | a413653361e218695fa6305d760c22458ac78657 (diff) | |
download | classic-serverdata-86cc243c069b90c3eb47df1faede506822634f4a.tar.gz classic-serverdata-86cc243c069b90c3eb47df1faede506822634f4a.tar.bz2 classic-serverdata-86cc243c069b90c3eb47df1faede506822634f4a.tar.xz classic-serverdata-86cc243c069b90c3eb47df1faede506822634f4a.zip |
Merge pull request #346 from mekolat/global-handler
onlogin & cleanup
52 files changed, 298 insertions, 328 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/elanore.txt b/world/map/npc/002-1/elanore.txt index be14c8bc..b6cdde5a 100644 --- a/world/map/npc/002-1/elanore.txt +++ b/world/map/npc/002-1/elanore.txt @@ -17,6 +17,24 @@ function|script|ElanoreFix return; } +function|script|elanore_decrease_exp +{ + if (attachrid(@killerrid) == 0) + end; + set @Q_heal_exp, MAGIC_EXPERIENCE >> 24; + if (@Q_heal_exp < 8) goto L_OnPcKillWipe; + set @Q_heal_exp, @Q_heal_exp - 8; + goto L_OnPcKillFinish; + +L_OnPcKillWipe: + set @Q_heal_exp, 0; + goto L_OnPcKillFinish; + +L_OnPcKillFinish: + set MAGIC_EXPERIENCE, (MAGIC_EXPERIENCE & ~(255 << 24)) | (@Q_heal_exp << 24); + return; +} + 002-1,75,62,0|script|Elanore#_M|108 { set @has_magic, getskilllv(SKILL_MAGIC); @@ -155,22 +173,6 @@ L_Main: "Goodbye!", L_bye; goto L_Close; -OnPCKillEvent: - if (attachrid(@killerrid) == 0) - end; - set @Q_heal_exp, MAGIC_EXPERIENCE >> 24; - if (@Q_heal_exp < 8) goto L_OnPcKillWipe; - set @Q_heal_exp, @Q_heal_exp - 8; - goto L_OnPcKillFinish; - -L_OnPcKillWipe: - set @Q_heal_exp, 0; - goto L_OnPcKillFinish; - -L_OnPcKillFinish: - set MAGIC_EXPERIENCE, (MAGIC_EXPERIENCE & ~(255 << 24)) | (@Q_heal_exp << 24); - goto L_Close; - L_Lifestones: mes "[Elanore the Healer]"; mes "\"I always need components for my own healing spells. If you bring me ten gamboge leaves, ten alizarin leaves, ten mauve leaves and ten cobalt leaves, I can make ten lifestones; I will give you half of them.\""; 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 19e5f866..3b7a7232 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/009-7/core.txt b/world/map/npc/009-7/core.txt index ccbec25a..7ee652d8 100644 --- a/world/map/npc/009-7/core.txt +++ b/world/map/npc/009-7/core.txt @@ -460,3 +460,36 @@ function|script|fightclub_exit if(@Duel_HasPendingRequest) message strcharinfo(0), "You have received a new duel request."; return; } + + + +// ** called on OnPCKilledEvent +function|script|fightclub_event_killed +{ + set @duel_killer, 0; + if(@Duel_Fighter != 1) goto L_End; + if(getmap() != "009-7") goto L_End; + set $@duel_loser, getcharid(3); // grab the rid of the victim + set $@duel_winner, @killerrid; // grab the rid of the killer + set @killerrid, 0; // reset killerid + callfunc "fightclub_death"; + goto L_End; +L_End: + if(getpvpflag(0) == $@Duel_Channel) setpvpflag @previous_channel; + return; +} + +// ** called on OnPCDieEvent +function|script|fightclub_event_die +{ + set @duel_killer, 0; + if(@Duel_Fighter != 1) goto L_End; + if(getmap() != "009-7") goto L_End; + set @killerrid, 0; // since the player was not murdered, the killerrid is 0 + set $@duel_loser, getcharid(3); // grab the rid of the victim + callfunc "fightclub_death"; + goto L_End; +L_End: + if(getpvpflag(0) == $@Duel_Channel) setpvpflag @previous_channel; + return; +} 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 c894586b..f26164df 100644 --- a/world/map/npc/functions/clear_vars.txt +++ b/world/map/npc/functions/clear_vars.txt @@ -2,75 +2,88 @@ function|script|ClearVariables { - // Tutorial - if ((TUTORIAL) || (sorfina)) - goto L_ResetTut; - goto L_Heathin; + 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; + 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; +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; -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; +S_Halloween2007: + set QUEST_Halloween07_state, 0; + return; -L_Easter: - // Easter - set EasterQuest, 0; +S_Xmas2006: + if(!XMASQUEST1) goto S_Return; + set XMASQUEST1, 0; + set XMASQUEST2, 0; + set XMASQUEST3, 0; + set XMASQUEST4, 0; + set XMASQUEST5, 0; + set XMASQUEST6, 0; + set XMASQUEST7, 0; + set XMASQUEST8, 0; + set XMASQUEST9, 0; + set XMASQUEST10, 0; + set XMASQUEST11, 0; + set XMASQUEST12, 0; + set XMASQUEST13, 0; + set XMASQUEST14, 0; + set XMASQUEST15, 0; + set XMASQUEST16, 0; + set XMASQUEST17, 0; + set XMASQUEST18, 0; + set XMASQUEST19, 0; + set XMASQUEST20, 0; + return; - // Halloween 2006 +S_Halloween2006: + if(!HWQUEST1) goto S_Return; set HWQUEST1, 0; set HWQUEST2, 0; set HWQUEST3, 0; @@ -92,60 +105,49 @@ L_Easter: set HWQUEST18, 0; set HWQUEST19, 0; set HWQUEST20, 0; + return; - // Christmas 2006 - set XMASQUEST1, 0; - set XMASQUEST2, 0; - set XMASQUEST3, 0; - set XMASQUEST4, 0; - set XMASQUEST5, 0; - set XMASQUEST6, 0; - set XMASQUEST7, 0; - set XMASQUEST8, 0; - set XMASQUEST9, 0; - set XMASQUEST10, 0; - set XMASQUEST11, 0; - set XMASQUEST12, 0; - set XMASQUEST13, 0; - set XMASQUEST14, 0; - set XMASQUEST15, 0; - set XMASQUEST16, 0; - set XMASQUEST17, 0; - set XMASQUEST18, 0; - set XMASQUEST19, 0; - set XMASQUEST20, 0; - - set QUEST_Halloween07_state, 0; - - 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 +157,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 +168,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 +212,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,109 +234,152 @@ 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; + return; -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; +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_Barber_Janitor: - callfunc "getHeadStyles"; // this converts class, color and hair - goto L_Return; +S_Misc: + if(Death_Kill) set Death_Kill, 0; + 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; -} -// 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; +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; -L_Desert: -// move guard and miner subquest into Byte 2 (Nibble 4 and 5) of QUEST_SouthTulimshar +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; + +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; + return; -L_Done: +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; -} --|script|#ClearGlobalVars|-1 -{ - end; +L_Deprecated: + debugmes "Explicitely calling ClearVariables after login is deprecated."; + mapexit; +} -OnInit: +function|script|ClearGlobalVars +{ // Clear some entries of the arrays which save the Fluffy Hunting highscore list set $@loop, 5; goto L_FluffyClear; @@ -387,6 +437,5 @@ L_EventClear: // Variable was used in Voltain's script, was renamed and turned into a temporary variable set $state, 0; - end; } diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt index 45efcaae..9ce44a38 100644 --- a/world/map/npc/functions/global_event_handler.txt +++ b/world/map/npc/functions/global_event_handler.txt @@ -1,44 +1,34 @@ -017-9,0,0,0|script|#GlobalHandler|-1 +// This is the global event dispatcher +// Do not add code to this file. Please only add callfuncs +// +// Author: meko + +-|script|#GlobalHandler|-1 { end; -OnPCLoginEvent: // this does not work yet but as soon as it is implemented it will start working - callfunc "ClearVariables"; +OnPCLoginEvent: + 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: - set Death_Kill, Death_Kill + 1; // this counts the number of players you have killed + callfunc "elanore_decrease_exp"; // decrease heal exp for doing bad things end; OnPCKilledEvent: - goto L_Fightclub_Killed; // this is used by the 1v1 arena + callfunc "fightclub_event_killed"; // this is used by the 1v1 arena + end; OnPCDieEvent: callfunc "fightclub_GoBack"; // this used by the battle master - goto L_Fightclub_Die; // this is used by the 1v1 arena - -// custom handlers below - -L_Fightclub_Killed: - set @duel_killer, 0; - if(@Duel_Fighter != 1) goto L_End; - if(getmap() != "009-7") goto L_End; - set $@duel_loser, getcharid(3); // grab the rid of the victim - set $@duel_winner, @killerrid; // grab the rid of the killer - set @killerrid, 0; // reset killerid - callfunc "fightclub_death"; - goto L_End; - -L_Fightclub_Die: - set @duel_killer, 0; - if(@Duel_Fighter != 1) goto L_End; - if(getmap() != "009-7") goto L_End; - set @killerrid, 0; // since the player was not murdered, the killerrid is 0 - set $@duel_loser, getcharid(3); // grab the rid of the victim - callfunc "fightclub_death"; - goto L_End; + callfunc "fightclub_event_die"; // this is used by the 1v1 arena + end; -L_End: - if(getpvpflag(0) == $@Duel_Channel) setpvpflag @previous_channel; +OnInit: //fixme: change to OnInterIfInit + callfunc "ClearGlobalVars"; end; } |