diff options
author | Wushin <pasekei@gmail.com> | 2014-10-10 15:27:07 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2014-10-10 15:27:07 -0500 |
commit | 3179aed603b68d34443b718a130e4a392d4c5ae5 (patch) | |
tree | 550656ed2a414b07b5af5c1e47b602e348d551a1 /world/map | |
parent | ffe40be3361652fc509291fa2f4c814554341957 (diff) | |
parent | 0cc087b9fd3b70706ecd5bd2b96ab14c7c1295ab (diff) | |
download | serverdata-3179aed603b68d34443b718a130e4a392d4c5ae5.tar.gz serverdata-3179aed603b68d34443b718a130e4a392d4c5ae5.tar.bz2 serverdata-3179aed603b68d34443b718a130e4a392d4c5ae5.tar.xz serverdata-3179aed603b68d34443b718a130e4a392d4c5ae5.zip |
Merge pull request #152 from wushin/quest-log-variable-clean-up
Quest log variable clean up
Diffstat (limited to 'world/map')
32 files changed, 564 insertions, 586 deletions
diff --git a/world/map/conf/tmwa-map.conf b/world/map/conf/tmwa-map.conf index 47158cef..44ac5757 100644 --- a/world/map/conf/tmwa-map.conf +++ b/world/map/conf/tmwa-map.conf @@ -11,6 +11,7 @@ battle_conf: conf/battle_athena.conf atcommand_conf: conf/atcommand_athena.conf const_db: db/const.txt +const_db: db/const-quest.txt const_db: db/const-mapflags.txt const_db: db/const-debugflag.txt diff --git a/world/map/db/const-quest.txt b/world/map/db/const-quest.txt new file mode 100644 index 00000000..76407b2a --- /dev/null +++ b/world/map/db/const-quest.txt @@ -0,0 +1,154 @@ +// Variables related to quests +TWOBIT_0_SHIFT 0 +TWOBIT_0_MASK 3 + +TWOBIT_1_SHIFT 2 +TWOBIT_1_MASK 12 + +TWOBIT_2_SHIFT 4 +TWOBIT_2_MASK 48 + +TWOBIT_3_SHIFT 6 +TWOBIT_3_MASK 192 + +TWOBIT_4_SHIFT 8 +TWOBIT_4_MASK 768 + +TWOBIT_5_SHIFT 10 +TWOBIT_5_MASK 3072 + +TWOBIT_6_SHIFT 12 +TWOBIT_6_MASK 12288 + +TWOBIT_7_SHIFT 14 +TWOBIT_7_MASK 49152 + +TWOBIT_8_SHIFT 16 +TWOBIT_8_MASK 196608 + +TWOBIT_9_SHIFT 18 +TWOBIT_9_MASK 786432 + +TWOBIT_10_SHIFT 20 +TWOBIT_10_MASK 3145728 + +TWOBIT_11_SHIFT 22 +TWOBIT_11_MASK 12582912 + +TWOBIT_12_SHIFT 24 +TWOBIT_12_MASK 50331648 + +TWOBIT_13_SHIFT 26 +TWOBIT_13_MASK 201326592 + +TWOBIT_14_SHIFT 28 +TWOBIT_14_MASK 805306368 + +// Not enough space in CONST to store +//TWOBIT_15_SHIFT 30 +//TWOBIT_15_MASK 3221225472 + +NIBBLE_0_SHIFT 0 +NIBBLE_0_MASK 15 + +NIBBLE_1_SHIFT 4 +NIBBLE_1_MASK 240 + +NIBBLE_2_SHIFT 8 +NIBBLE_2_MASK 3840 + +NIBBLE_3_SHIFT 12 +NIBBLE_3_MASK 61440 + +NIBBLE_4_SHIFT 16 +NIBBLE_4_MASK 983040 + +NIBBLE_5_SHIFT 20 +NIBBLE_5_MASK 15728640 + +NIBBLE_6_SHIFT 24 +NIBBLE_6_MASK 251658240 + +NIBBLE_7_SHIFT 28 // Only three bits available in this one +NIBBLE_7_MASK 1879048192 // should be 4026531840 + +BYTE_0_SHIFT 0 +BYTE_0_MASK 255 + +BYTE_1_SHIFT 8 +BYTE_1_MASK 65280 + +BYTE_2_SHIFT 16 +BYTE_2_MASK 16711680 + +BYTE_3_SHIFT 24 // only 7 bits in this one +BYTE_3_MASK 2130706432 // should be 4278190080 + +// Wedding Variables +WEDDING_FEE 100 +DIVORCE_FEE_PER_LEVEL 500 +WEDDING_MIN_LEVEL 32 + +// Flags for the magic quests. +MFLAG_DRANK_POTION 1 // Character drank at least one magic potion as prerequisite for the Mana Seed quest. +MFLAG_KNOWS_MANASEED 2 // Character has found the Mana Seed. +MFLAG_TOUCHED_MANASEED 4 // Character has touched the Mana Seed. +MFLAG_MANASEED_MAXEDOUT 8 // Character has touched the Mana Seed while maxed out on magic. + +MFLAG_KNOWS_AULDSBEL 16 // Character has met Auldsbel. +MFLAG_KNOWS_WYARA 32 // Character has met Wyara. +MFLAG_KNOWS_SAGATHA 64 // Character has met Sagatha. +MFLAG_KNOWS_MANAPOTION 128 // Has heard about the Mana Potion. + +MFLAG_MANASEED_RUMOUR 256 // Has heard rumour about Mana Seed. +MFLAG_KNOWS_CUTTREE 512 // Knows about the 'cut the tree' quest. +MFLAG_DID_CUTTREE 1024 // Did cut off a branch from the druid tree. +MFLAG_KNOWS_DRUIDTREE 2048 // Knows about the druid tree quest. + +MFLAG_KNOWS_IMP 4096 // Knows about the imprisoned forest spirit. +MFLAG_KNOWS_OLD_WIZARD 8192 // Knows Bjorn's old wizard. +MFLAG_MADE_CONC_POTION 16384 // Made a concentration potion with T15 and/or T16. +MFLAG_ELANORE_OMAR 32768 // Told Omar about Elanore's involvement. + +MFLAG_KNOWS_UNFOCUS_RECIPE 65536 // Has been told about unfocus by Luca. + +// Flags set in the FLAGS variable: +FLAG_HAS_BOWLER_BURNSDAY 1 // every year's poem at burns day, shannon gives you a bowler hat +FLAG_OPENED_UNDERGROUND 2 // this flag is a replacement for variable Open_Underground_Palace_Barrier, which was used only as bool +FLAG_GOT_NAEM_GLOVES 4 // this replaces Naem_Quest_Done, which was used as a bool variable +FLAG_GOT_GRADUATIONCAP 8 // this is a bit which was to be found in Tut_var second bit +FLAG_TOWEL_HELPED 16 // gave the towel npc the stuff he wants +FLAG_TOWEL_COMPLETED 32 // got the towel from the towel npc +FLAG_ANDRA_HELPED 64 // Knows Andra and agreed to help her +FLAG_ROSSI_COMPLETED 128 // Completed the Rossi Quest +FLAG_TUTORIAL_DONE 256 // player completed tutorial (or entered the tutorial area from outside after it was added) +FLAG_SNOWMAN 512 // player gave candy to the snowman +FLAG_SANTAS_HELPER 1024 // player gave presents to Santa's helper +FLAG_HURNSMINE_CHEST 2048 // player opened the chest with the short sword in Hurnscald mines +FLAG_GOT_BEANIEHAT 4096 // player got Beanie Copter Hat from Milly +FLAG_DECLINED_BEANIEHAT 8192 // player declined Beanie Copter Hat from Milly + +// Flags for the battle caves. +BATTLE_CAVE1 1 +BATTLE_CAVE2 2 +BATTLE_CAVE3 4 +BATTLE_CAVE4 8 +BATTLE_CAVE5 16 +BATTLE_CAVE6 32 +BATTLE_CAVE7 64 +BATTLE_CAVE8 128 +BATTLE_CAVE9 256 + +// Storage Options +OPT_STORAGE_CLOSE 1 +OPT_BANK_CLOSE 2 + +// Currently used by the fluffy hunt (033-1). +// starts counting with 0 +MAX_HIGH_SCORES 4 + +// Launcher/Ammo Types +AMMO_NONE 0 +AMMO_BOW 1 +AMMO_SLING 2 +AMMO_WAND 3 diff --git a/world/map/db/const.txt b/world/map/db/const.txt index 5c8d4ffa..52752c1d 100644 --- a/world/map/db/const.txt +++ b/world/map/db/const.txt @@ -304,11 +304,6 @@ EMOTE_CURIOUS 40 EMOTE_PAIN 41 EMOTE_TEARS 42 -// Wedding Variables -WEDDING_FEE 100 -DIVORCE_FEE_PER_LEVEL 500 -WEDDING_MIN_LEVEL 32 - sfx_skillup 1 sfx_magic_generic 2 sfx_magic_life 3 @@ -409,42 +404,6 @@ FX_EMOTE_CURIOUS 10039 FX_EMOTE_PAIN 10040 FX_EMOTE_TEARS 10041 -NIBBLE_0_SHIFT 0 -NIBBLE_0_MASK 15 - -NIBBLE_1_SHIFT 4 -NIBBLE_1_MASK 240 - -NIBBLE_2_SHIFT 8 -NIBBLE_2_MASK 3840 - -NIBBLE_3_SHIFT 12 -NIBBLE_3_MASK 61440 - -NIBBLE_4_SHIFT 16 -NIBBLE_4_MASK 983040 - -NIBBLE_5_SHIFT 20 -NIBBLE_5_MASK 15728640 - -NIBBLE_6_SHIFT 24 -NIBBLE_6_MASK 251658240 - -NIBBLE_7_SHIFT 28 // Only three bits available in this one -NIBBLE_7_MASK 1879048192 // should be 4026531840 - -BYTE_0_MASK 255 -BYTE_0_SHIFT 0 - -BYTE_1_MASK 65280 -BYTE_1_SHIFT 8 - -BYTE_2_MASK 16711680 -BYTE_2_SHIFT 16 - -BYTE_3_MASK 2130706432 // should be 4278190080 -BYTE_3_SHIFT 24 // only 7 bits in this one - // Basic Skills SKILL_EMOTE 1 SKILL_TRADE 2 @@ -468,179 +427,3 @@ SKILL_MAGIC_TRANSMUTE 343 SKILL_MAGIC_NATURE 344 SKILL_MAGIC_ASTRAL 345 SKILL_MAGIC_DARK 346 - -// Flags for the magic quests. -MFLAG_DRANK_POTION 1 // Character drank at least one magic potion as prerequisite for the Mana Seed quest. -MFLAG_KNOWS_MANASEED 2 // Character has found the Mana Seed. -MFLAG_TOUCHED_MANASEED 4 // Character has touched the Mana Seed. -MFLAG_MANASEED_MAXEDOUT 8 // Character has touched the Mana Seed while maxed out on magic. - -MFLAG_KNOWS_AULDSBEL 16 // Character has met Auldsbel. -MFLAG_KNOWS_WYARA 32 // Character has met Wyara. -MFLAG_KNOWS_SAGATHA 64 // Character has met Sagatha. -MFLAG_KNOWS_MANAPOTION 128 // Has heard about the Mana Potion. - -MFLAG_MANASEED_RUMOUR 256 // Has heard rumour about Mana Seed. -MFLAG_KNOWS_CUTTREE 512 // Knows about the 'cut the tree' quest. -MFLAG_DID_CUTTREE 1024 // Did cut off a branch from the druid tree. -MFLAG_KNOWS_DRUIDTREE 2048 // Knows about the druid tree quest. - -MFLAG_KNOWS_IMP 4096 // Knows about the imprisoned forest spirit. -MFLAG_KNOWS_OLD_WIZARD 8192 // Knows Bjorn's old wizard. -MFLAG_MADE_CONC_POTION 16384 // Made a concentration potion with T15 and/or T16. -MFLAG_ELANORE_OMAR 32768 // Told Omar about Elanore's involvement. - -MFLAG_KNOWS_UNFOCUS_RECIPE 65536 // Has been told about unfocus by Luca. - -// Flags set in the FLAGS variable: -FLAG_HAS_BOWLER_BURNSDAY 1 // every year's poem at burns day, shannon gives you a bowler hat -FLAG_OPENED_UNDERGROUND 2 // this flag is a replacement for variable Open_Underground_Palace_Barrier, which was used only as bool -FLAG_GOT_NAEM_GLOVES 4 // this replaces Naem_Quest_Done, which was used as a bool variable -FLAG_GOT_GRADUATIONCAP 8 // this is a bit which was to be found in Tut_var second bit -FLAG_TOWEL_HELPED 16 // gave the towel npc the stuff he wants -FLAG_TOWEL_COMPLETED 32 // got the towel from the towel npc -FLAG_ANDRA_HELPED 64 // Knows Andra and agreed to help her -FLAG_ROSSI_COMPLETED 128 // Completed the Rossi Quest -FLAG_TUTORIAL_DONE 256 // player completed tutorial (or entered the tutorial area from outside after it was added) -FLAG_SNOWMAN 512 // player gave candy to the snowman -FLAG_SANTAS_HELPER 1024 // player gave presents to Santa's helper -FLAG_HURNSMINE_CHEST 2048 // player opened the chest with the short sword in Hurnscald mines -FLAG_GOT_BEANIEHAT 4096 // player got Beanie Copter Hat from Milly -FLAG_DECLINED_BEANIEHAT 8192 // player declined Beanie Copter Hat from Milly - -DOCK_tulimshar 1 -DOCK_hurnscald 2 -DOCK_candor 3 -DOCK_nivalis 4 - -// ----------------- -// -- Easter 2010 -- -// ----------------- - -// Dealing with the Old Woman's token quest. -E10_STATE_EGG_MASK 3 -E10_STATE_EGGS_COLLECTED_MASK 31 -E10_STATE_EGGS_COLLECTED_SHIFT 2 -E10_STATE_EGG_COLLECTING 1 -E10_STATE_EGG_COLLECTED 2 -E10_STATE_EGG_REWARDED 3 -E10_STATE_ROSE_MASK 3 -E10_STATE_ROSE_SHIFT 7 -E10_STATE_ROSE_ROSE_USED 1 -E10_STATE_ROSE_ROSE_COMPLETE 2 -E10_STATE_ROSE_RETURNED 3 - - -// Dealing with $Easter_2010_Npc_State1. -E10_TIMER_STATE_EGGS_MASK 31 -E10_TIMER_STATE_TREES_MASK 31 -E10_TIMER_STATE_TREES_SHIFT 5 -E10_TIMER_STATE_DOCTOR_MASK 31 -E10_TIMER_STATE_DOCTOR_SHIFT 10 -E10_EGGS_TIMER_OVERTICK_MASK 31 -E10_EGGS_TIMER_OVERTICK_SHIFT 15 -E10_TREES_OVERTICK_MASK 31 -E10_TREES_OVERTICK_SHIFT 20 -E10_DOCTOR_TIMER_OVERTICK_MASK 31 -E10_DOCTOR_TIMER_OVERTICK_SHIFT 25 - - -// Dealing with $Easter_2010_Npc_State2. -E10_DOCTOR_POSITION_MASK 7 -E10_DOCTOR_POSITION_SHIFT 0 -E10_DOCTOR_POSITION_NULL 0 -E10_DOCTOR_POSITION_BIGTREE 1 -E10_DOCTOR_POSITION_ISLAND 2 -E10_DOCTOR_POSITION_STONES 3 -E10_DOCTOR_POSITION_FRUIT 4 -E10_DOCTOR_POSITION_CAVE 5 -E10_BARRIER_MASK 1 -E10_BARRIER_SHIFT 4 -E10_BARRIER_OPEN 0 -E10_BARRIER_ACTIVE 1 -E10_PRE_WARP_SHIFT 5 -E10_NEEDLE_SHIFT 6 -E10_NEEDLE_MASK 31 - -// Dealing with the doctor. -E10_DOCTOR_HELP_STATES_MASK 15 -E10_DOCTOR_HELP_STATES_SHIFT 11 -E10_FLAG_KNOWS_DOCTOR_MASK 1 -E10_FLAG_KNOWS_DOCTOR_SHIFT 10 -E10_FLAG_KNOWS_DOCTOR 1 -E10_FLAG_HELPED_DOCTOR_TREE_MASK 1 -E10_FLAG_HELPED_DOCTOR_TREE_SHIFT 11 -E10_FLAG_HELPED_DOCTOR_TREE 1 -E10_FLAG_HELPED_DOCTOR_ISLAND_MASK 1 -E10_FLAG_HELPED_DOCTOR_ISLAND_SHIFT 12 -E10_FLAG_HELPED_DOCTOR_ISLAND 1 -E10_FLAG_HELPED_DOCTOR_STONES_MASK 1 -E10_FLAG_HELPED_DOCTOR_STONES_SHIFT 13 -E10_FLAG_HELPED_DOCTOR_STONES 1 -E10_FLAG_HELPED_DOCTOR_FRUIT_MASK 1 -E10_FLAG_HELPED_DOCTOR_FRUIT_SHIFT 14 -E10_FLAG_HELPED_DOCTOR_FRUIT 1 -E10_HELPED_DOCTOR_SHIFT 11 -E10_HELPED_DOCTOR_MASK 15 -E10_FLAG_MID_REWARD 1 -E10_FLAG_MID_REWARD_SHIFT 15 -E10_FLAG_MID_REWARD_MASK 1 -E10_FLAG_RETURN_READY 1 -E10_FLAG_RETURN_READY_SHIFT 16 -E10_FLAG_RETURN_READY_MASK 1 -E10_FLAG_USED_FREE_WARP_SHIFT 17 -E10_STATE_REWARDS_SHIFT 18 -E10_STATE_REWARDS_MASK 3 -E10_STATE_REWARD_RABBIT_EARS 1 -E10_STATE_REWARD_EGGSHELL 2 -E10_LOC_NEEDLE_SHIFT 20 -E10_LOC_NEEDLE_MASK 31 - -// Menus -E10_STONES_WISP 0 -E10_STONES_SPECTRE 1 -E10_STONES_POLTERGEIST 2 -E10_STONES_SOUL 3 -E10_STONES_HEART 4 -E10_STONES_EAR 5 -E10_STONES_EYE 6 -E10_STONES_BONE 7 -E10_STONES_SKULL 8 -E10_STONES_CRYSTAL 9 -E10_STONES_RAGS 10 -E10_STONES_PETAL 11 -E10_STONES_NEVERMIND 12 -E10_ISLAND_MENU_DEATH_AWE 12 -E10_ISLAND_MENU_SCARED 13 -E10_ISLAND_MENU_WISPS 14 -E10_ISLAND_MENU_OFFER_LIFESTONE 15 - -// Flags for the battle caves. -BATTLE_CAVE1 1 -BATTLE_CAVE2 2 -BATTLE_CAVE3 4 -BATTLE_CAVE4 8 -BATTLE_CAVE5 16 -BATTLE_CAVE6 32 -BATTLE_CAVE7 64 -BATTLE_CAVE8 128 -BATTLE_CAVE9 256 - -// Miscellaneous -E10_COLLECT_EGGS_ID 1246 -E10_TOKEN_ID 666 -E10_MIDREWARD_ID 1247 // Valentine's Glasses (as described) - -// Storage Options -OPT_STORAGE_CLOSE 1 -OPT_BANK_CLOSE 2 - -// Currently used by the fluffy hunt (033-1). -// starts counting with 0 -MAX_HIGH_SCORES 4 - -// Launcher/Ammo Types -AMMO_NONE 0 -AMMO_BOW 1 -AMMO_SLING 2 -AMMO_WAND 3 diff --git a/world/map/npc/001-2/casino.txt b/world/map/npc/001-2/casino.txt index ea29e9bd..7648190b 100644 --- a/world/map/npc/001-2/casino.txt +++ b/world/map/npc/001-2/casino.txt @@ -4,7 +4,7 @@ 001-2.gat,32,72,0|script|#CasinoEntrance|32767,1,1, { set QUEST_NorthTulimshar, QUEST_NorthTulimshar | $@knowCasinoNT; - set @kylian, ((QUEST_NorthTulimshar & $@businessmanNT_MASK) >> $@businessmanNT_SHIFT); + set @kylian, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT); if (@kylian != 6) goto L_End; message strcharinfo(0), "You wonder if Kylian would like to visit the casino in the evening."; diff --git a/world/map/npc/021-1/banu.txt b/world/map/npc/021-1/banu.txt index fac61bc1..e614fcae 100644 --- a/world/map/npc/021-1/banu.txt +++ b/world/map/npc/021-1/banu.txt @@ -5,9 +5,7 @@ 021-1.gat,102,54,0|script|Banu|154, { - set @BanuNT_MASK, 0xC00; - set @BanuNT_SHIFT, 10; - set @state, ((QUEST_NorthTulimshar & @BanuNT_MASK) >> @BanuNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & TWOBIT_5_MASK) >> TWOBIT_5_SHIFT); set @EXP, 30; set @money_water, 200; set @money_knife, 60; @@ -106,11 +104,9 @@ L_Close: set @EXP, 0; set @state, 0; set @rand, 0; - set @BanuNT_MASK, 0; - set @BanuNT_SHIFT, 0; close; S_Update_Mask: - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(@BanuNT_MASK)) | (@state << @BanuNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(TWOBIT_5_MASK)) | (@state << TWOBIT_5_SHIFT); return; } diff --git a/world/map/npc/021-1/hideandseek.txt b/world/map/npc/021-1/hideandseek.txt index 58095234..4768eef1 100644 --- a/world/map/npc/021-1/hideandseek.txt +++ b/world/map/npc/021-1/hideandseek.txt @@ -1,9 +1,10 @@ // Children playing Hide and Seek -// Quest uses Nibble 0 and 1 of QUEST_NorthTulimshar +// QUEST_NorthTulimshar +// BYTE 0 // Bit 0: started quest at Ayasha // Bit 1 - 5: found one of the kids each -// bit 6: talked to Ayasha after finding all kids -// bit 7: unused +// Bit 6: talked to Ayasha after finding all kids +// Bit 7: unused // Author: Jenalya -|script|#hideandseekNTconfig|-1, @@ -11,25 +12,60 @@ end; OnInit: - set $@hideandseekNT_MASK, BYTE_0_MASK; - set $@hideandseekNT_SHIFT, BYTE_0_SHIFT; - - set $@hideandseekNT_started, 0x00000001; - set $@hideandseekNT_found1, 0x00000002; - set $@hideandseekNT_found2, 0x00000004; - set $@hideandseekNT_found3, 0x00000008; - set $@hideandseekNT_found4, 0x00000010; - set $@hideandseekNT_found5, 0x00000020; - set $@hideandseekNT_ended, 0x00000040; + set $@hideandseekNT_started, (1 << 0); + set $@hideandseekNT_found1, (1 << 1); + set $@hideandseekNT_found2, (1 << 2); + set $@hideandseekNT_found3, (1 << 3); + set $@hideandseekNT_found4, (1 << 4); + set $@hideandseekNT_found5, (1 << 5); + set $@hideandseekNT_ended, (1 << 6); end; } +021-1.gat,89,66,0|script|AyashaDebug|258, +{ + mes "[Ayasha Debug]"; + menu + "Show", L_Show, + "Reset", L_Reset, + "Close.", L_Close; + +L_Show: + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); + mes "State: " + @state; + if (QUEST_NorthTulimshar & $@hideandseekNT_started) + mes "Start set"; + if (QUEST_NorthTulimshar & $@hideandseekNT_found1) + mes "Found 1 set"; + if (QUEST_NorthTulimshar & $@hideandseekNT_found2) + mes "Found 2 set"; + if (QUEST_NorthTulimshar & $@hideandseekNT_found3) + mes "Found 3 set"; + if (QUEST_NorthTulimshar & $@hideandseekNT_found4) + mes "Found 4 set"; + if (QUEST_NorthTulimshar & $@hideandseekNT_found5) + mes "Found 5 set"; + if (QUEST_NorthTulimshar & $@hideandseekNT_ended) + mes "Complete set"; + goto L_Close; +L_Reset: + set QUEST_NorthTulimshar, 0; + goto L_Close; + +L_Close: + close; + +OnInit: + if (!debug) + disablenpc "AyashaDebug"; + end; +} 021-1.gat,87,66,0|script|Ayasha|258, { set @child_number, 0; callfunc "XmasList"; - set @state, ((QUEST_NorthTulimshar & $@hideandseekNT_MASK) >> $@hideandseekNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); set @EXP, 75; @@ -97,7 +133,7 @@ L_Close: { set @child_number, 1; callfunc "XmasList"; - set @state, ((QUEST_NorthTulimshar & $@hideandseekNT_MASK) >> $@hideandseekNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); set @EXP, 15; @@ -159,7 +195,7 @@ L_Close: { set @child_number, 2; callfunc "XmasList"; - set @state, ((QUEST_NorthTulimshar & $@hideandseekNT_MASK) >> $@hideandseekNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); set @EXP, 15; @@ -213,7 +249,7 @@ L_Close: { set @child_number, 3; callfunc "XmasList"; - set @state, ((QUEST_NorthTulimshar & $@hideandseekNT_MASK) >> $@hideandseekNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); set @EXP, 25; @@ -265,7 +301,7 @@ L_Close: { set @child_number, 4; callfunc "XmasList"; - set @state, ((QUEST_NorthTulimshar & $@hideandseekNT_MASK) >> $@hideandseekNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); set @EXP, 15; @@ -306,7 +342,7 @@ L_Close: { set @child_number, 5; callfunc "XmasList"; - set @state, ((QUEST_NorthTulimshar & $@hideandseekNT_MASK) >> $@hideandseekNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & BYTE_0_MASK) >> BYTE_0_SHIFT); set @EXP, 15; diff --git a/world/map/npc/021-1/imec.txt b/world/map/npc/021-1/imec.txt index 61e1fca7..07965951 100644 --- a/world/map/npc/021-1/imec.txt +++ b/world/map/npc/021-1/imec.txt @@ -2,20 +2,9 @@ // after finishing this, daily quest with scorpion stingers // Using bit 8 and 9 of QUEST_NorthTulimshar (first half of nibble 2) // author: Jenalya - --|script|#ImecShopConfig|-1, -{ - end; - -OnInit: - set $@ImecShopNT_MASK, 0x300; - set $@ImecShopNT_SHIFT, 8; - end; -} - 021-1.gat,120,31,0|script|Imec|162, { - set @state, ((QUEST_NorthTulimshar & $@ImecShopNT_MASK) >> $@ImecShopNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & TWOBIT_4_MASK) >> TWOBIT_4_SHIFT); set @money, 500; if (@state >= 3) goto L_Stingers; @@ -117,6 +106,6 @@ L_Close: close; S_Update_Mask: - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@ImecShopNT_MASK)) | (@state << $@ImecShopNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(TWOBIT_4_MASK)) | (@state << TWOBIT_4_SHIFT); return; } diff --git a/world/map/npc/021-1/weellos.txt b/world/map/npc/021-1/weellos.txt index cb75bde1..3e6236ea 100644 --- a/world/map/npc/021-1/weellos.txt +++ b/world/map/npc/021-1/weellos.txt @@ -4,7 +4,7 @@ 021-1.gat,130,125,0|script|Weellos|103, { set QUEST_NorthTulimshar, QUEST_NorthTulimshar | $@knowWeellosNT; - set @kylian, ((QUEST_NorthTulimshar & $@businessmanNT_MASK) >> $@businessmanNT_SHIFT); + set @kylian, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT); if isin("021-1.gat", 130, 120, 140, 125) goto L_In; diff --git a/world/map/npc/021-2/heathin.txt b/world/map/npc/021-2/heathin.txt index 45f041c5..5f9f26c7 100644 --- a/world/map/npc/021-2/heathin.txt +++ b/world/map/npc/021-2/heathin.txt @@ -6,21 +6,23 @@ set @TARROW_REQ_COAL, 5; set @TARROW_REQ_GP, 3000; - if (HEATHIN_QUEST == 14) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows_Trade; - if (HEATHIN_QUEST == 13) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows_Ready; - if (HEATHIN_QUEST == 12) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows_Forge; - if (HEATHIN_QUEST == 11) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows; - if (HEATHIN_QUEST == 10) && (BaseLevel >= 80) goto L_Heathin_Terranite_Chest_Armor_Ready; - if (HEATHIN_QUEST == 9) && (BaseLevel >= 80) goto L_Heathin_Terranite_Chest_Armor_Forge; - if (HEATHIN_QUEST == 8) && (BaseLevel >= 80) goto L_Heathin_Terranite_Chest_Armor; - if (HEATHIN_QUEST == 7) && (BaseLevel >= 80) goto L_Heathin_Terranite_Legs_Ready; - if (HEATHIN_QUEST == 6) && (BaseLevel >= 80) goto L_Heathin_Terranite_Legs_Forge; - if (HEATHIN_QUEST == 5) && (BaseLevel >= 80) goto L_Heathin_Terranite_Legs; - if (HEATHIN_QUEST == 4) && (BaseLevel >= 80) goto L_Heathin_Terranite_Hood_Ready; - if (HEATHIN_QUEST == 3) && (BaseLevel >= 80) goto L_Heathin_Terranite_Hood_Forge; - if (HEATHIN_QUEST == 2) && (BaseLevel >= 80) goto L_Heathin_Terranite_Hood; - if (HEATHIN_QUEST == 2) && (BaseLevel >= 60) goto L_Heathin_Ring_Thanks; - if (HEATHIN_QUEST == 1) && (BaseLevel >= 60) goto L_Heathin_Ring_Award; + set @state, ((QUEST_NorthTulimshar & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT); + + if (@state == 14) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows_Trade; + if (@state == 13) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows_Ready; + if (@state == 12) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows_Forge; + if (@state == 11) && (BaseLevel >= 80) goto L_Heathin_Terranite_Arrows; + if (@state == 10) && (BaseLevel >= 80) goto L_Heathin_Terranite_Chest_Armor_Ready; + if (@state == 9) && (BaseLevel >= 80) goto L_Heathin_Terranite_Chest_Armor_Forge; + if (@state == 8) && (BaseLevel >= 80) goto L_Heathin_Terranite_Chest_Armor; + if (@state == 7) && (BaseLevel >= 80) goto L_Heathin_Terranite_Legs_Ready; + if (@state == 6) && (BaseLevel >= 80) goto L_Heathin_Terranite_Legs_Forge; + if (@state == 5) && (BaseLevel >= 80) goto L_Heathin_Terranite_Legs; + if (@state == 4) && (BaseLevel >= 80) goto L_Heathin_Terranite_Hood_Ready; + if (@state == 3) && (BaseLevel >= 80) goto L_Heathin_Terranite_Hood_Forge; + if (@state == 2) && (BaseLevel >= 80) goto L_Heathin_Terranite_Hood; + if (@state == 2) && (BaseLevel >= 60) goto L_Heathin_Ring_Thanks; + if (@state == 1) && (BaseLevel >= 60) goto L_Heathin_Ring_Award; if (BaseLevel >= 60) goto L_Heathin_Start; mes "[Heathin]"; @@ -44,7 +46,8 @@ L_Heathin_Start: "Wait, what kind of award are we talking about?", L_Heathin_Interested; L_Heathin_Help: - set HEATHIN_QUEST, 1; + set @state, 1; + callsub S_Update_Mask; mes "[Heathin]"; mes "\"Excellent! I am always glad when someone can be of service not just to me, but to all of Tulimshar. Please get me 50 Coal and 100,000 gold pieces, and you will be compensated for your efforts.\""; close; @@ -73,7 +76,8 @@ L_Heathin_Ring_Award: getinventorylist; if ((checkweight("SimpleRing", 1) == 0) || (@inventorylist_count == 100)) goto L_InventoryNoSpace; - set HEATHIN_QUEST, 2; + set @state, 2; + callsub S_Update_Mask; set Zeny, Zeny - 100000; delitem "Coal", 50; getitem "SimpleRing", 1; @@ -120,7 +124,8 @@ L_Heathin_Terranite_No: close; L_Heathin_Terranite_Yes: - set HEATHIN_QUEST, 3; + set @state, 3; + callsub S_Update_Mask; mes "[Heathin]"; mes "\"Great, this is going to be fun! As I have not had much practice with this armor, I'd like to get started soon.\""; next; @@ -136,7 +141,8 @@ L_Heathin_Terranite_Hood_Forge: || (countitem("Coal") < 100) || (countitem("TerraniteOre") < 10) ) goto L_Heathin_Terranite_Hood_Wait; - set HEATHIN_QUEST, 4; + set @state, 4; + callsub S_Update_Mask; delitem "Coal", 100; delitem "TerraniteOre", 10; set Zeny, Zeny - 200000; @@ -153,14 +159,16 @@ L_Heathin_Terranite_Hood_Ready: getinventorylist; if ((checkweight("TerraniteHelmet", 1) == 0) || (@inventorylist_count == 100)) goto L_InventoryNoSpace; - set HEATHIN_QUEST, 5; + set @state, 5; + callsub S_Update_Mask; getitem "TerraniteHelmet", 1; mes "[Heathin]"; mes "\"I am all done with your terranite hood. I hope you enjoy it! I have some work to wrap up for the Council, but come back later and I might be able to assist you again.\""; close; L_Heathin_Terranite_Legs: - set HEATHIN_QUEST, 6; + set @state, 6; + callsub S_Update_Mask; mes "[Heathin]"; mes "\"I am glad you are back! I've just finished up some more of my commission. Now I can get back to making terranite armor for you. This time I will make some pants, but they need more ore, more Coal to heat my forge and of course, more gold for my efforts.\""; next; @@ -172,7 +180,8 @@ L_Heathin_Terranite_Legs_Forge: || (countitem("Coal") < 200) || (countitem("TerraniteOre") < 30) ) goto L_Heathin_Terranite_Legs_Wait; - set HEATHIN_QUEST, 7; + set @state, 7; + callsub S_Update_Mask; delitem "Coal", 200; delitem "TerraniteOre", 30; set Zeny, Zeny - 400000; @@ -189,14 +198,16 @@ L_Heathin_Terranite_Legs_Ready: getinventorylist; if ((checkweight("TerraniteLegs", 1) == 0) || (@inventorylist_count == 100)) goto L_InventoryNoSpace; - set HEATHIN_QUEST, 8; + set @state, 8; + callsub S_Update_Mask; getitem "TerraniteLegs", 1; mes "[Heathin]"; mes "\"I am all done with your terranite pants. Hope you enjoy them! I have some more work to complete for the Council. Come back later and I might be able to assist you again.\""; close; L_Heathin_Terranite_Chest_Armor: - set HEATHIN_QUEST, 9; + set @state, 9; + callsub S_Update_Mask; mes "[Heathin]"; mes "\"Good to see you again. I have just finished up some more of my commission. Now I can get back to making terranite armor for you. This time, I will make some terranite chest armor, but it needs more ore, more Coal for my forge and of course, more gold to compensate for my efforts.\""; next; @@ -208,7 +219,8 @@ L_Heathin_Terranite_Chest_Armor_Forge: || (countitem("Coal") < 250) || (countitem("TerraniteOre") < 40) ) goto L_Heathin_Terranite_Chest_Armor_Wait; - set HEATHIN_QUEST, 10; + set @state, 10; + callsub S_Update_Mask; delitem "Coal", 250; delitem "TerraniteOre", 40; set Zeny, Zeny - 500000; @@ -225,7 +237,8 @@ L_Heathin_Terranite_Chest_Armor_Ready: getinventorylist; if ((checkweight("TerraniteChestArmor", 1) == 0) || (@inventorylist_count == 100)) goto L_InventoryNoSpace; - set HEATHIN_QUEST, 11; + set @state, 11; + callsub S_Update_Mask; getitem "TerraniteChestArmor", 1; mes "[Heathin]"; mes "\"I have completed your terranite chest armor. I hope you enjoy it! I have some work to wrap up for the Council again, but come back later and I might be able to assist you once more.\""; @@ -246,7 +259,8 @@ L_Heathin_Terranite_Arrows_No: close; L_Heathin_Terranite_Arrows_Yes: - set HEATHIN_QUEST, 12; + set @state, 12; + callsub S_Update_Mask; mes "[Heathin]"; mes "\"Good, good. I shall begin crafting these arrows as soon as you come back. However, I cannot just make small handfuls as it would not be worth my time and effort to have my concentration interrupted for small tasks. I will make 1,000 Terranite Arrows per request, for which I will need "+@TARROW_REQ_TERRA_ORE+" Terranite Ore, "+@TARROW_REQ_COAL+" Coal and "+@TARROW_REQ_GP+" gold pieces.\""; next; @@ -258,7 +272,8 @@ L_Heathin_Terranite_Arrows_Forge: || (countitem("Coal") < @TARROW_REQ_COAL) || (countitem("TerraniteOre") < @TARROW_REQ_TERRA_ORE) ) goto L_Heathin_Terranite_Arrows_Wait; - set HEATHIN_QUEST, 13; + set @state, 13; + callsub S_Update_Mask; delitem "Coal", @TARROW_REQ_COAL; delitem "TerraniteOre", @TARROW_REQ_TERRA_ORE; set Zeny, Zeny - @TARROW_REQ_GP; @@ -275,7 +290,8 @@ L_Heathin_Terranite_Arrows_Ready: getinventorylist; if ((checkweight("TerraniteArrow", 1000) == 0) || (@inventorylist_count == 100)) goto L_InventoryNoSpace; - set HEATHIN_QUEST, 14; + set @state, 14; + callsub S_Update_Mask; getitem "TerraniteArrow", 1000; mes "[Heathin]"; mes "\"All done, here you go! I hope you like them. I am still working on my commission, but if you ever need any more Terranite Arrows, just come on by with "+@TARROW_REQ_COAL+" Coal, "+@TARROW_REQ_TERRA_ORE+" Terranite Ore and "+@TARROW_REQ_GP+" gold pieces and I will make another 1,000 arrows for you. By now I have enough Terranite Ore in reserve that you can just trade me my requirements to keep my resources up. Thank you for all your efforts!\""; @@ -320,4 +336,7 @@ L_InventoryNoSpace: mes "\"Hm no. You can't carry this right now. Make some room and come back.\""; close; +S_Update_Mask: + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_6_MASK)) | (@state << NIBBLE_6_SHIFT); + return; } diff --git a/world/map/npc/021-2/kylian.txt b/world/map/npc/021-2/kylian.txt index 71dcb896..fc8242c5 100644 --- a/world/map/npc/021-2/kylian.txt +++ b/world/map/npc/021-2/kylian.txt @@ -38,16 +38,12 @@ OnInit: // Nibble 4 - set $@knowYanisNT, 0x10000; - set $@knowLatoyNT, 0x20000; - set $@knowWeellosNT, 0x40000; - set $@knowCasinoNT, 0x80000; - - set $@businessmanNT_MASK, NIBBLE_5_MASK; - set $@businessmanNT_SHIFT, NIBBLE_5_SHIFT; + set $@knowYanisNT, (1 << 16); + set $@knowLatoyNT, (1 << 17); + set $@knowWeellosNT, (1 << 18); + set $@knowCasinoNT, (1 << 19); end; } - 021-2.gat,25,67,0|script|#KylianOut|32767,1,1, { set @KylianNTLicense, 0; @@ -55,10 +51,9 @@ OnInit: set @KylianNTCasino, 0; end; } - 021-2.gat,89,55,0|script|Kylian|193, { - set @state, ((QUEST_NorthTulimshar & $@businessmanNT_MASK) >> $@businessmanNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT); set @acorn_amount, 12; set @suitcase_money, 100; @@ -307,6 +302,6 @@ L_Close: close; S_Update_Mask: - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@businessmanNT_MASK)) | (@state << $@businessmanNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_5_MASK)) | (@state << NIBBLE_5_SHIFT); return; } diff --git a/world/map/npc/021-2/yanis.txt b/world/map/npc/021-2/yanis.txt index bde24ec3..86c40fad 100644 --- a/world/map/npc/021-2/yanis.txt +++ b/world/map/npc/021-2/yanis.txt @@ -4,8 +4,8 @@ 021-2.gat,33,17,0|script|Yanis|107, { set QUEST_NorthTulimshar, QUEST_NorthTulimshar | $@knowYanisNT; - set @kylian, ((QUEST_NorthTulimshar & $@businessmanNT_MASK) >> $@businessmanNT_SHIFT); - set @imec, ((QUEST_NorthTulimshar & $@ImecShopNT_MASK) >> $@ImecShopNT_SHIFT); + set @kylian, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT); + set @imec, ((QUEST_NorthTulimshar & TWOBIT_4_MASK) >> TWOBIT_4_SHIFT); mes "[Yanis]"; mes "\"Welcome. I'm handling issues with trading licenses for the shop owners in Tulimshar. Can I help you?\""; @@ -24,7 +24,7 @@ L_Next: mes "[Yanis]"; mes "\"Here you have a letter of acknowledgement. You can bring that back to Imec. We will have a look at his case.\""; set @imec, 2; - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@ImecShopNT_MASK)) | (@imec << $@ImecShopNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(TWOBIT_4_MASK)) | (@imec << TWOBIT_4_SHIFT); goto L_BeforeClose; L_BeforeClose: diff --git a/world/map/npc/022-1/_import.txt b/world/map/npc/022-1/_import.txt index 9695d72f..543a85c0 100644 --- a/world/map/npc/022-1/_import.txt +++ b/world/map/npc/022-1/_import.txt @@ -9,4 +9,3 @@ npc: npc/022-1/dock.txt npc: npc/022-1/ferry_master.txt npc: npc/022-1/mapflags.txt npc: npc/022-1/npcs.txt -npc: npc/022-1/tutorial.txt diff --git a/world/map/npc/022-1/adrian.txt b/world/map/npc/022-1/adrian.txt index e4e1e2c6..978c537e 100644 --- a/world/map/npc/022-1/adrian.txt +++ b/world/map/npc/022-1/adrian.txt @@ -7,7 +7,7 @@ 022-1.gat,58,54,0|script|Adrian|213, { - set @state, ((QUEST_NorthTulimshar & $@businessmanNT_MASK) >> $@businessmanNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT); mes "[Adrian]"; mes "\"Hello. Are you here to get the luggage for some of our passengers?\""; @@ -36,7 +36,7 @@ L_Get: mes "Adrain hands you a very heavy suitcase."; getitem "LeatherSuitcase", 1; set @state, 2; - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@businessmanNT_MASK)) | (@state << $@businessmanNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_5_MASK)) | (@state << NIBBLE_5_SHIFT); goto L_Close; L_Inventory: diff --git a/world/map/npc/022-1/anwar.txt b/world/map/npc/022-1/anwar.txt index f01089aa..7c031d9c 100644 --- a/world/map/npc/022-1/anwar.txt +++ b/world/map/npc/022-1/anwar.txt @@ -16,20 +16,9 @@ // state 13: Anwar asked to bring present to Eomie // state 14: gave present to Eomie // state 15: reported back to Anwar and done - --|script|#magicfieldNTconfig|-1, -{ - end; - -OnInit: - set $@magicfieldNT_MASK, NIBBLE_3_MASK; - set $@magicfieldNT_SHIFT, NIBBLE_3_SHIFT; - end; -} - 022-1.gat,41,46,0|script|Anwar|156, { - set @state, ((QUEST_NorthTulimshar & $@magicfieldNT_MASK) >> $@magicfieldNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); set @cloth_amount, 3; set @silk_amount, 30; @@ -209,6 +198,6 @@ L_Close: close; S_Update_Mask: - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@magicfieldNT_MASK)) | (@state << $@magicfieldNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_3_MASK)) | (@state << NIBBLE_3_SHIFT); return; } diff --git a/world/map/npc/022-1/tutorial.txt b/world/map/npc/022-1/tutorial.txt deleted file mode 100644 index c249d79d..00000000 --- a/world/map/npc/022-1/tutorial.txt +++ /dev/null @@ -1,80 +0,0 @@ -// This file is part of the Tutorial -// Author: Jenalya -// if you enter the tutorial area from outside, it is set to be already done -// Tutorial -// Nibble 0 -// 1-4: Sorfina -// 5-7: Tanisha -// 8-13: Kaan & Hasan -// 14: Hasan Complete -// 15: Open -// Nibble 1 -// 4: Sorfina Bit -// 5: Tanisha Bit -// 6: Valon Start -// 7: Valon Done -// Nibble 2 -// 1: Maggots -// 2: House Maggots -// 3: TameScorpion -// 4: Scorpion -// 5-15: Open -// Nibble 3 -// 1-15: Count -// Nibble 4 -// 16: Start -// 17: Barrel -// 18: Barrel -// 19: Barrel -// Nibble 5 -// 20: Barrel -// 21: Barrel -// 22: Barrel -// 23: Found -// Nibble 6 -// 1: Seen -// 2: Started -// 3: -// 24: Magic -// 25: -// 26: -// 27: -// Nibble 7 -// 28: Magic Start -// 29: Magic End -// 30: Zegas Met -// 31: Hasan Complete --|script|#TutorialConfig|-1, -{ - end; - -OnInit: - set $@ScorpionFighter, 0; - set $@ScorpionTimer, 0; - set $@ScorpDeath, 0; - set $@SorfinaHasanBit, (1 << 4); - set $@TanishaHasanBit, (1 << 5); - set $@HasanCompleteBit, (1 << 31); - end; -} -function|script|TutorialState|, -{ - callfunc "ClearVariables"; - set @tutorial, ((TUTORIAL & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT); - set @sorfina_hasan, (TUTORIAL & $@SorfinaHasanBit); - set @tanisha_hasan, (TUTORIAL & $@TanishaHasanBit); - set @hasan_complete, (TUTORIAL & $@HasanCompleteBit); - return; -} -function|script|SetTutorialMask|, -{ - set TUTORIAL, (TUTORIAL & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); - set @tutorial_tmp, 0; - return; -} -function|script|TutorialCompleted|, -{ - set FLAGS, FLAGS | FLAG_TUTORIAL_DONE; - callfunc "ClearVariables"; - return; -} diff --git a/world/map/npc/024-1/eomie.txt b/world/map/npc/024-1/eomie.txt index 680e77a6..e14a323c 100644 --- a/world/map/npc/024-1/eomie.txt +++ b/world/map/npc/024-1/eomie.txt @@ -20,7 +20,7 @@ 024-1.gat,72,94,0|script|Eomie|164, { - set @state, ((QUEST_NorthTulimshar & $@magicfieldNT_MASK) >> $@magicfieldNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); set @grass_amount, 5; set @water_amount, 2; @@ -140,6 +140,6 @@ L_Close: close; S_Update_Mask: - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@magicfieldNT_MASK)) | (@state << $@magicfieldNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_3_MASK)) | (@state << NIBBLE_3_SHIFT); return; } diff --git a/world/map/npc/024-1/tinris.txt b/world/map/npc/024-1/tinris.txt index 34352a74..c1d969fd 100644 --- a/world/map/npc/024-1/tinris.txt +++ b/world/map/npc/024-1/tinris.txt @@ -19,7 +19,7 @@ 024-1.gat,82,64,0|script|Tinris|160, { - set @state, ((QUEST_NorthTulimshar & $@magicfieldNT_MASK) >> $@magicfieldNT_SHIFT); + set @state, ((QUEST_NorthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); set @cake_exp, 50; set @sweater_exp, 400; @@ -214,6 +214,6 @@ L_Close: close; S_Update_Mask: - set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~($@magicfieldNT_MASK)) | (@state << $@magicfieldNT_SHIFT); + set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_3_MASK)) | (@state << NIBBLE_3_SHIFT); return; } diff --git a/world/map/npc/042-1/hasan.txt b/world/map/npc/042-1/hasan.txt index 722c8f62..39e549cd 100644 --- a/world/map/npc/042-1/hasan.txt +++ b/world/map/npc/042-1/hasan.txt @@ -8,31 +8,41 @@ 042-1.gat,104,49,0|script|Scared Man|160, { - if ((@hasan_complete) && ((@tutorial == 12) || (@tutorial == 14))) + setarray @npc_loc, 104, 49, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_End; + if (@tutorial >= 13) goto L_TutDone; message strcharinfo(0), "He looks too afraid to say anything."; - end; + goto L_End; L_TutDone: message strcharinfo(0), "Thanks. Kaan's been much nicer to me now"; + goto L_End; + +L_End: end; } 042-1.gat,102,49,0|script|Hasan|189,2,2, { + setarray @npc_loc, 102, 49, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; goto L_Main; L_Main: callfunc "TutorialState"; if ((getcharid(3) == $@ScorpionFighter) || ($@ScorpionFighter && $@ScorpionFighter != getcharid(3))) goto L_Afraid; - if ((@hasan_complete) && ((@tutorial == 12) || (@tutorial == 14))) + if (@tutorial == 14) goto L_TutDone; - // implicitly, $@ScorpionFighter is nonzero - if ((@hasan_complete) && (@tutorial == 13)) + if (@tutorial == 13) goto L_Thank; - if (@tutorial == 12) + if (@tutorial == 12) goto L_Trick; - if ((@tutorial == 10) || (@tutorial == 11)) + if ((@tutorial == 9) || (@tutorial == 10) || (@tutorial == 11)) goto L_FightAgain; mes "You over hear some people nearby."; @@ -58,7 +68,7 @@ L_Main: next; mes "Sounds like this person is in trouble.\""; next; - set @tutorial_tmp, 10; + set @tutorial_tmp, 9; callfunc "SetTutorialMask"; mes "[Unfriendly Guy]"; mes "\"What are you looking at?\""; @@ -93,7 +103,8 @@ L_Trick: L_ScratchHead: if ($@ScorpionFighter) goto L_Wait; - set TUTORIAL, TUTORIAL | $@HasanCompleteBit; + set @tutorial_tmp, 14; + callfunc "SetTutorialMask"; set $@ScorpionTimer, 0; set $@ScorpionFighter, getcharid(3); set $@ScorpDeath, PC_DIE_COUNTER; @@ -157,7 +168,7 @@ L_Close: close; OnTouch: - if ((@hasan_complete) && ((@tutorial == 12) || (@tutorial == 14))) + if (@tutorial >= 13) end; goto L_Main; } diff --git a/world/map/npc/042-1/kaan.txt b/world/map/npc/042-1/kaan.txt index 0d71cee3..1444cd67 100644 --- a/world/map/npc/042-1/kaan.txt +++ b/world/map/npc/042-1/kaan.txt @@ -3,16 +3,22 @@ 042-1.gat,109,87,0|script|Kaan|160, { + setarray @npc_loc, 109, 87, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; + callfunc "TutorialState"; - if ((@hasan_complete) && (@tutorial == 13)) goto L_Hasan_Saved; - if (@hasan_complete) goto L_TutDone; + if (!(@kaan_talked)) goto L_Tanisha; + if (@tutorial >= 13) goto L_TutDone; if (@tutorial == 12) goto L_Plan; - if ((@tutorial == 11) && ((@sorfina_hasan) || (@tanisha_hasan))) goto L_TrickKnown; - if (@tutorial == 11) goto L_Trick; - if (@tutorial == 10) goto L_Hasan; - if (@tutorial == 9) goto L_Out; - if (@tutorial == 8) goto L_Tanisha; + if (@tutorial == 11) goto L_TrickKnown; + if (@tutorial == 10) goto L_Trick; + if (@tutorial == 9) goto L_Hasan; + goto L_Out; +L_Tanisha: + set STARTAREA, STARTAREA | $@SpokeToKaan; mes "[Young Man]"; mes "\"You're the person Tanisha brought here, right?"; mes "My name is Kaan, I'm her brother.\""; @@ -23,17 +29,12 @@ mes "[Kaan]"; mes "\"She hates maggots.\""; next; - mes "\"Maybe you should go and see her...she was really upset about what happened to you.\""; - goto L_Close; - -L_Tanisha: - mes "[Kaan]"; mes "\"Did you already talk to Tanisha?\""; menu - "Yes, I helped her with the maggots.",L_Tanisha3, - "Yeah, and she's done with the maggots.",L_Tanisha3; + "Yes, I helped her with the maggots.",L_Tanisha1, + "Yeah, and she's done with the maggots.",L_Tanisha1; -L_Tanisha3: +L_Tanisha1: mes "[Kaan]"; mes "\"Ah, that is good news."; mes "You know, we have a lot of problems with bugs here.\""; @@ -58,17 +59,7 @@ L_Next: mes "\"Are you going to visit Tulimshar?"; mes "The bazaar there is a wondeful place! Traders, entertainers, adventurers - it's very exciting.\""; next; - mes "\"Ah, I forgot. Without some money the bazaar is less fun I suppose."; - mes "Here, take this.\""; - set Zeny, Zeny + 15; - next; mes "\"And Ian the trainer is hanging around there often. You should talk to him, he's a smart guy.\""; - set @tutorial_tmp, 9; - callfunc "SetTutorialMask"; - if (hasan) - menu - "A guy named Hasan is bullying someone.",L_Hasan, - "Thanks for the advice.",L_Close; goto L_Out; L_Out: @@ -92,7 +83,7 @@ L_Next1: mes "He might listen to one of the adult men, but they're all off to work in Tulimshar during the day.\""; next; mes "\"We should think about some kind of trick. Ah, if only I knew his weak point.\""; - set @tutorial_tmp, 11; + set @tutorial_tmp, 10; callfunc "SetTutorialMask"; next; goto L_Trick; @@ -142,14 +133,6 @@ L_Plan: "Yes please.",L_Explain, "No, everything's alright.",L_Close; -L_Hasan_Saved: - mes "[Kaan]"; - mes "\"You did not to fight the scorpion."; - mes "But maybe Hasan is more thankful now?\""; - next; - mes "\"Why don't you talk to him again and see what he says.\""; - goto L_Close; - L_TutDone: mes "[Kaan]"; mes "\"Hi there. I hope you enjoy your time in Tulimshar."; diff --git a/world/map/npc/042-1/liana.txt b/world/map/npc/042-1/liana.txt index 6eb9972b..f1e5a4f9 100644 --- a/world/map/npc/042-1/liana.txt +++ b/world/map/npc/042-1/liana.txt @@ -2,11 +2,23 @@ 042-1.gat,82,96,0|script|Liana|205, { - set @npcname$, "Liana"; + setarray @npc_loc, 82, 96, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_End; + goto L_Talk; - mes "[" + @npcname$ + "]"; +L_Talk: + mes "[Liana]"; mes "\"Tulimshar is a large city. I'm sure glad I live in the suburbs because I know where everything's at.\""; next; mes "\"I think Tanisha is in the building to the right. That girl is growing up fast.\""; + goto L_Close; + +L_End: + mes "You'll have to move closer"; + goto L_Close; + +L_Close: close; } diff --git a/world/map/npc/042-1/tutorial.txt b/world/map/npc/042-1/tutorial.txt index 3129faaa..d51c30be 100644 --- a/world/map/npc/042-1/tutorial.txt +++ b/world/map/npc/042-1/tutorial.txt @@ -1,10 +1,67 @@ // This file is part of the Tutorial // Author: Jenalya -// if you enter the tutorial area, it is set to be already done +// if you enter the tutorial area from outside, it is set to be already done +-|script|#TutorialConfig|-1, +{ + end; +OnInit: + set $@ScorpionFighter, 0; + set $@ScorpionTimer, 0; + set $@ScorpDeath, 0; + set $@SpokeToKaan, (1 << 31); + end; +} +function|script|TutorialState|, +{ + callfunc "ClearVariables"; + set @tutorial, ((STARTAREA & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT); + set @kaan_talked, (STARTAREA & $@SpokeToKaan); + return; +} +function|script|SetTutorialMask|, +{ + set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + set @tutorial_tmp, 0; + return; +} +042-2.gat,21,26,0|script|TutDebug|154, +{ + mes "[TutDebug]"; + mes "Reset?"; + menu + "Yes.",L_Reset, + "No.",L_End; + +L_Reset: + set TUT_var, 0; + set @tutorial_tmp, 0; + set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + set STARTAREA, STARTAREA &~ $@SpokeToKaan; + mes "Reset!"; + goto L_End; + +L_End: + end; + +OnInit: + if(!debug) + disablenpc "TutDebug"; + end; +} 042-1.gat,63,47,0|script|#tutorialoutside|45,0,0 { - callfunc "TutorialCompleted"; + callfunc "TutorialState"; + if (@tutorial >= 8) + goto L_Warp; + goto L_ResetTutorial; + +L_ResetTutorial: + set @tutorial_tmp, 8; + callfunc "SetTutorialMask"; + goto L_Warp; + +L_Warp: warp "042-2.gat", 114, 92; end; } diff --git a/world/map/npc/042-1/valon.txt b/world/map/npc/042-1/valon.txt index a844f861..f4296af9 100644 --- a/world/map/npc/042-1/valon.txt +++ b/world/map/npc/042-1/valon.txt @@ -5,8 +5,6 @@ end; OnInit: - set $@ValonStartBit, (1 << 6); - set $@ValonEndBit, (1 << 7); setarray $@ValonMob, 1002,1050,1046,1003; setarray $@ValonMobName$, "Maggots","House Maggots","Tame Scorpions","Scorpion"; setarray $@ValonMobCnt, 10,5,3,1; @@ -14,32 +12,30 @@ OnInit: } function|script|ValonState|, { - set @valon_mob, ((TUTORIAL & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT); - set @valon_count, ((TUTORIAL & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); - set @valon_start, (TUTORIAL & $@ValonStartBit); - set @valon_end, (TUTORIAL & $@ValonEndBit); + set @valon_state, ((STARTAREA & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT); + set @valon_mob, 0; + if (@valon_state >= 2) + set @valon_mob, (@valon_state - 2); + set @valon_count, ((STARTAREA & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT); return; } -function|script|AddValonMobMask|, +function|script|setValonMask|, { - set @valon_tmp, (@valon_mob + 1); - if (@valon_tmp > 15) - set @valon_tmp, 15; - set TUTORIAL, (TUTORIAL & ~(NIBBLE_2_MASK) | (@valon_tmp << NIBBLE_2_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (@valon_tmp << NIBBLE_1_SHIFT)); set @valon_tmp, 0; return; } function|script|ResetValonCntMask|, { - set TUTORIAL, (TUTORIAL & ~(NIBBLE_3_MASK) | (0 << NIBBLE_3_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (0 << NIBBLE_2_SHIFT)); return; } function|script|AddValonCntMask|, { set @valon_tmp, (@valon_count + 1); - if (@valon_tmp > 15) - set @valon_tmp, 15; - set TUTORIAL, (TUTORIAL & ~(NIBBLE_3_MASK) | (@valon_tmp << NIBBLE_3_SHIFT)); + if (@valon_tmp > $@ValonMobCnt[@valon_mob]) + set @valon_tmp, $@ValonMobCnt[@valon_mob]; + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (@valon_tmp << NIBBLE_2_SHIFT)); set @valon_tmp, 0; callfunc "ValonProgress"; return; @@ -47,7 +43,7 @@ function|script|AddValonCntMask|, function|script|ValonProgress|, { callfunc "ValonState"; - if ((@valon_start) && (!(@valon_end))) + if ((@valon_state > 1) && (@valon_state < 6)) message strcharinfo(0), $@ValonMobName$[@valon_mob] + ": " + @valon_count + "/" + $@ValonMobCnt[@valon_mob]; return; } @@ -60,10 +56,8 @@ function|script|ValonProgress|, "No.", L_End; L_Reset: - set TUTORIAL, (TUTORIAL & ~(NIBBLE_2_MASK) | (0 << NIBBLE_2_SHIFT)); - set TUTORIAL, (TUTORIAL & ~(NIBBLE_3_MASK) | (0 << NIBBLE_3_SHIFT)); - set TUTORIAL, TUTORIAL &~ $@ValonStartBit; - set TUTORIAL, TUTORIAL &~ $@ValonEndBit; + set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (0 << NIBBLE_1_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (0 << NIBBLE_2_SHIFT)); mes "Reset!"; goto L_End; @@ -77,14 +71,18 @@ OnInit: } 042-1.gat,48,111,0|script|Valon|156, { + setarray @npc_loc, 48, 111, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; callfunc "ValonState"; - if (@valon_end) + if (@valon_state >= 6) goto L_QuestComplete; - if (!(@valon_start) && (@valon_count)) + if (@valon_start == 1) goto L_QuestAskAgain; - if (((@valon_start) && (!(@valon_end))) && (@valon_count >= $@ValonMobCnt[@valon_mob])) + if (@valon_count >= $@ValonMobCnt[@valon_mob]) goto L_NextMob; - if ((@valon_start) && (!(@valon_end))) + if ((@valon_state >= 2) && (@valon_state < 6)) goto L_QuestStarted; goto L_QuestAsk; @@ -93,7 +91,7 @@ L_QuestAskAgain: mes "\"Hello, Adventurer! Have you come back to help?\""; menu "Yes. I will help with the desert beasts.", L_Accept, - "Maybe some other time.", L_NoThanks; + "Maybe some other time.", L_Close; L_QuestAsk: mes "[Valon]"; @@ -109,17 +107,17 @@ L_QuestAsk: mes "\"Maybe you would like help and earn your stripes?\""; next; mes "\"The Council of Wizard's does offer a reward for helping...\""; + set @valon_tmp, 1; + callfunc "setValonMask"; + callfunc "ResetValonCntMask"; menu "YES!!! let me at them!", L_Accept, - "Maybe some other time.", L_NoThanks; - -L_NoThanks: - callfunc "AddValonCntMask"; - goto L_Close; + "Maybe some other time.", L_Close; L_Accept: - callfunc "ResetValonCntMask"; - set TUTORIAL, TUTORIAL | $@ValonStartBit; + set @valon_tmp, 2; + callfunc "setValonMask"; + callfunc "ValonState"; goto L_NewMob; L_NextMob: @@ -128,10 +126,11 @@ L_NextMob: next; mes "\"The Wizard's thank thee as well.\""; set Zeny, Zeny + 25; - next; + set @valon_tmp, (@valon_state + 1); + callfunc "setValonMask"; callfunc "ResetValonCntMask"; - callfunc "AddValonMobMask"; callfunc "ValonState"; + next; if (@valon_mob == getarraysize($@ValonMob)) goto L_QuestOver; goto L_NewMob; @@ -155,7 +154,8 @@ L_QuestOver: mes "[Valon]"; mes "\"Thanks once again for helping with the monsters in the desert.\""; getexp 50, 0; - set TUTORIAL, TUTORIAL | $@ValonEndBit; + set @valon_tmp, (@valon_state + 1); + callfunc "setValonMask"; goto L_Close; L_QuestComplete: diff --git a/world/map/npc/042-1/zegas.txt b/world/map/npc/042-1/zegas.txt index d3dc118c..36443a91 100644 --- a/world/map/npc/042-1/zegas.txt +++ b/world/map/npc/042-1/zegas.txt @@ -32,7 +32,8 @@ L_Meet: mes "\"Wouldn't you know it, the bug bomb Eomie gave us is in one of the store room barrels.\""; next; mes "\"Can you search the barrels for the bug bomb and set it off when you find it?\""; - set TUTORIAL, TUTORIAL | $@ZegasMetBit; + set @barrel_tmp, 1; + callfunc "SetBarrelMask"; menu "Sure.",L_Start, "Maybe some other time.",L_Close; @@ -48,7 +49,8 @@ L_Find: L_Start: mes "[Zegas]"; - set TUTORIAL, TUTORIAL | $@BarrelStartBit; + set @barrel_tmp, 2; + callfunc "SetBarrelMask"; mes "\"Thanks, come back and see me once you found the bug bomb and set it off.\""; goto L_Close; @@ -60,11 +62,12 @@ L_Looking: L_QuestEnd: mes "[Zegas]"; mes "\"From the smell I can see you found the bug bomb!\""; - getexp 50, 0; - next; mes "\"Thanks once again, I know it's not much but here is 50 GP for your troubles.\""; + getexp 50, 0; set Zeny, (Zeny + 50); - set TUTORIAL, TUTORIAL | $@BarrelEndBit; + set @barrel_tmp, 4; + callfunc "SetBarrelMask"; + next; goto L_Close; L_Thanks: @@ -84,15 +87,15 @@ L_Close: "No.", L_End; L_Reset: - set TUTORIAL, TUTORIAL &~ $@BarrelStartBit; - set TUTORIAL, TUTORIAL &~ $@BarrelEndBit; - set TUTORIAL, TUTORIAL &~ (1 << 17); - set TUTORIAL, TUTORIAL &~ (1 << 18); - set TUTORIAL, TUTORIAL &~ (1 << 19); - set TUTORIAL, TUTORIAL &~ (1 << 20); - set TUTORIAL, TUTORIAL &~ (1 << 21); - set TUTORIAL, TUTORIAL &~ (1 << 22); - set TUTORIAL, TUTORIAL &~ (1 << 30); + set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (0 << NIBBLE_4_SHIFT)); + set STARTAREA, STARTAREA &~ (1 << 20); + set STARTAREA, STARTAREA &~ (1 << 21); + set STARTAREA, STARTAREA &~ (1 << 22); + set STARTAREA, STARTAREA &~ (1 << 23); + set STARTAREA, STARTAREA &~ (1 << 24); + set STARTAREA, STARTAREA &~ (1 << 25); + set STARTAREA, STARTAREA &~ (1 << 26); + set STARTAREA, STARTAREA &~ (1 << 27); mes "Reset!"; goto L_End; diff --git a/world/map/npc/042-2/barrels.txt b/world/map/npc/042-2/barrels.txt index 43d4444e..540027ac 100644 --- a/world/map/npc/042-2/barrels.txt +++ b/world/map/npc/042-2/barrels.txt @@ -1,6 +1,5 @@ // Barrels // Author: Wushin -// Barrels 042-2.gat,23,86,0|script|Barrel#0|400, { setarray @npc_loc, 23, 86, 2; @@ -46,3 +45,17 @@ OnMaggotDeath: callfunc "CheckBarrel"; end; } +042-2.gat,29,92,0|script|Barrel#6|400, +{ + setarray @npc_loc, 29, 92, 2; + set @barrel, 6; + callfunc "CheckBarrel"; + end; +} +042-2.gat,24,91,0|script|Barrel#7|400, +{ + setarray @npc_loc, 24, 91, 2; + set @barrel, 7; + callfunc "CheckBarrel"; + end; +} diff --git a/world/map/npc/042-2/barrels_config.txt b/world/map/npc/042-2/barrels_config.txt index 85c78e41..0b45af21 100644 --- a/world/map/npc/042-2/barrels_config.txt +++ b/world/map/npc/042-2/barrels_config.txt @@ -6,40 +6,34 @@ end; OnInit: - set $@BarrelStartBit, (1 << 16); - set $@BarrelEndBit, (1 << 23); - set $@ZegasMetBit, (1 << 30); - setarray $@BarrelBits, (1 << 17), (1 << 18), (1 << 19), (1 << 20), (1 << 21), (1 << 22); + setarray $@BarrelBits, (1 << 20), (1 << 21), (1 << 22), (1 << 23), (1 << 24), (1 << 25), (1 << 26), (1 << 27); setarray $@BarrelRewards, 533, 507, 505, 518, 537, 526; set $@BarrelSpawnCnt, 1; set $@BarrelSpawnId, 1050; set $@BarrelSpawnName$, "House Maggot"; set $@BarrelMax, getarraysize($@BarrelBits); end; - +} +function|script|SetBarrelMask|, +{ + set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (@barrel_tmp << NIBBLE_4_SHIFT)); + set @barrel_tmp, 0; + return; } function|script|CheckBarrelQuest|, { callfunc "CountBarrels"; - set @barrel_quest, 0; - if (TUTORIAL & $@ZegasMetBit) - set @barrel_quest, 1; - if (TUTORIAL & $@BarrelStartBit) - set @barrel_quest, 2; - if (!(TUTORIAL & $@BarrelStartBit) && (@barrel_count)) - set @barrel_quest, 3; - if (TUTORIAL & $@BarrelEndBit) - set @barrel_quest, 4; + set @barrel_quest, ((STARTAREA & NIBBLE_4_MASK) >> NIBBLE_4_SHIFT); return; } function|script|CountBarrels|, { set @barrel_count, 0; - set @barrel_tmp, 0; + set @count_tmp, 0; goto L_Loop; L_Loop: - if (TUTORIAL & $@BarrelBits[@barrel_tmp]) + if (STARTAREA & $@BarrelBits[@barrel_tmp]) goto L_AddOne; goto L_LoopAgain; @@ -48,8 +42,8 @@ L_AddOne: goto L_LoopAgain; L_LoopAgain: - set @barrel_tmp, (@barrel_tmp + 1); - if (@barrel_tmp == getarraysize($@BarrelBits)) + set @count_tmp, (@count_tmp + 1); + if (@count_tmp == getarraysize($@BarrelBits)) goto L_BarrelTally; goto L_Loop; @@ -62,11 +56,11 @@ function|script|CheckBarrel|, if (@npc_check) goto L_Range; callfunc "CheckBarrelQuest"; - if (!(@barrel_quest)) + if (!(@barrel_quest == 2)) goto L_NoI; - if (TUTORIAL & $@BarrelBits[@barrel]) + if (STARTAREA & $@BarrelBits[@barrel]) goto L_Empty; - set TUTORIAL, TUTORIAL | $@BarrelBits[@barrel]; + set STARTAREA, STARTAREA | $@BarrelBits[@barrel]; callfunc "CountBarrels"; if (@barrel_count == $@BarrelMax) @@ -92,7 +86,8 @@ L_Empty: L_QuestReward: message strcharinfo(0), "You found the bug bomb."; misceffect 33; - set TUTORIAL, TUTORIAL &~ $@BarrelStartBit; + set @barrel_tmp, 3; + callfunc "SetBarrelMask"; killmonster getmap() + ".gat", "Barrel#0::OnMaggotDeath"; goto L_Return; diff --git a/world/map/npc/042-2/morgan.txt b/world/map/npc/042-2/morgan.txt index 3ea1a2e8..20cc34c1 100644 --- a/world/map/npc/042-2/morgan.txt +++ b/world/map/npc/042-2/morgan.txt @@ -6,12 +6,12 @@ function|script|MorganState|, { callfunc "ClearVariables"; - set @morgan, ((TUTORIAL & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT); + set @morgan, ((STARTAREA & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); return; } function|script|SetMorganMask|, { - set TUTORIAL, (TUTORIAL & ~(NIBBLE_6_MASK) | (@morgan_tmp << NIBBLE_6_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (@morgan_tmp << NIBBLE_3_SHIFT)); set @morgan_tmp, 0; return; } @@ -23,7 +23,7 @@ function|script|SetMorganMask|, "Yes.", L_Reset, "No.", L_End; L_Reset: - set TUTORIAL, (TUTORIAL & ~(NIBBLE_6_MASK) | (0 << NIBBLE_6_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (0 << NIBBLE_3_SHIFT)); mes "Reset!"; goto L_End; @@ -37,6 +37,10 @@ OnInit: } 042-2,101,57,0|script|Morgan|355, { + setarray @npc_loc, 101, 57, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; callfunc "MorganState"; if (readparam(bInt) >= 5) goto L_Learn; diff --git a/world/map/npc/042-2/sorfina.txt b/world/map/npc/042-2/sorfina.txt index 2bad44d5..22216327 100644 --- a/world/map/npc/042-2/sorfina.txt +++ b/world/map/npc/042-2/sorfina.txt @@ -1,34 +1,12 @@ // This file is part of the Tutorial // Author: Jenalya -042-2.gat,21,26,0|script|TutDebug|154, -{ - mes "[TutDebug]"; - mes "Reset?"; - menu - "Yes.",L_Reset, - "No.",L_End; - -L_Reset: - set TUT_var, 0; - set @tutorial_tmp, 0; - set TUTORIAL, (TUTORIAL & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); - set TUTORIAL, TUTORIAL &~ $@SorfinaHasanBit; - set TUTORIAL, TUTORIAL &~ $@TanishaHasanBit; - set TUTORIAL, TUTORIAL &~ $@HasanCompleteBit; - set FLAGS, FLAGS &~ FLAG_TUTORIAL_DONE; - mes "Reset!"; - goto L_End; - -L_End: - end; - -OnInit: - if(!debug) - disablenpc "TutDebug"; - end; -} 042-2.gat,28,26,0|script|Sorfina|154,1,4 { + setarray @npc_loc, 28, 26, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; + callfunc "TutorialState"; if ((Hp != MaxHp) && (@tutorial >= 4)) @@ -43,8 +21,7 @@ L_Heal: goto L_Main; L_Main: - if ((@tutorial == 11) && !(@sorfina_hasan)) goto L_Hasan; - if (FLAGS & FLAG_TUTORIAL_DONE) goto L_Again; + if (@tutorial == 10) goto L_Hasan; if (@tutorial >= 4) goto L_Again; if (@tutorial == 3) goto L_Clothes; if (@tutorial == 2) goto L_Chest; @@ -262,7 +239,8 @@ L_Next: next; mes "\"However, the scorpions poison caused a bad fever and once Hasan had recovered from that, he was even more malicious than before.\""; mes "She sighs."; - set TUTORIAL, TUTORIAL | $@SorfinaHasanBit; + set @tutorial_tmp, 11; + callfunc "SetTutorialMask"; goto L_Close; L_SkipTut: @@ -275,7 +253,6 @@ L_SkipTut: L_Bye: mes "[Sorfina]"; mes "\"Alright, if you say so. But take at least this."; - callfunc "TutorialCompleted"; getitem "Knife", 1; getitem "SlingShot", 1; getitem "SlingBullet", 100; @@ -283,6 +260,8 @@ L_Bye: getitem "CottonShirt", 1; getitem "RaggedShorts", 1; set Zeny, Zeny + 50; + set @tutorial_tmp, 8; + callfunc "SetTutorialMask"; mes "Good luck.\""; goto L_Close; @@ -356,7 +335,7 @@ L_Empty: OnTouch: callfunc "TutorialState"; - if ((@tutorial < 4) && !(FLAGS & FLAG_TUTORIAL_DONE)) + if (@tutorial < 4) goto L_Block; warp "042-1.gat", 51, 44; end; diff --git a/world/map/npc/042-2/stat_reset.txt b/world/map/npc/042-2/stat_reset.txt index c033fcb2..a6b61378 100644 --- a/world/map/npc/042-2/stat_reset.txt +++ b/world/map/npc/042-2/stat_reset.txt @@ -2,6 +2,10 @@ 042-2.gat,98,91,0|script|Jessie|159, { + setarray @npc_loc, 98, 91, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; if (BaseLevel >= 10) goto L_Sorry; diff --git a/world/map/npc/042-2/tanisha.txt b/world/map/npc/042-2/tanisha.txt index 77a02948..77e95ab7 100644 --- a/world/map/npc/042-2/tanisha.txt +++ b/world/map/npc/042-2/tanisha.txt @@ -4,13 +4,17 @@ 042-2.gat,110,88,0|script|Tanisha|114, { + setarray @npc_loc, 110, 88, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; + if (isin("042-2.gat", 98, 84, 106, 89)) goto L_Fighting; - callfunc "TutorialState"; - if ((@tutorial == 11) && !(@tanisha_hasan)) goto L_Hasan; - if ((@tutorial >= 8) || (FLAGS & FLAG_TUTORIAL_DONE)) goto L_Tut_Done; + if (@tutorial == 10) goto L_Hasan; + if (@tutorial >= 8) goto L_Tut_Done; if (@tutorial == 7) goto L_Stats; if (@tutorial == 6) goto L_Fail; if (@tutorial == 5) goto L_Maggots; @@ -146,7 +150,6 @@ L_Money: mes "You can have my pocket money. Here.\""; set @tutorial_tmp, 8; callfunc "SetTutorialMask"; - callfunc "TutorialCompleted"; set Zeny, Zeny + 5; next; goto L_Advice; @@ -204,7 +207,8 @@ L_Next3: mes "\"The only thing he's afraid of are scorpions."; mes "I'm not sure why, some bad experience when he was a child."; mes "That was before I was born.\""; - set TUTORIAL, TUTORIAL | $@TanishaHasanBit; + set @tutorial_tmp, 11; + callfunc "SetTutorialMask"; goto L_Close; L_Tut_Done: @@ -311,7 +315,6 @@ OnMaggotDeath: end; L_Close: - set @menu, 0; close; OnInit: @@ -325,18 +328,9 @@ OnInit: OnTouch: callfunc "TutorialState"; - if ((@tutorial >= 8) && !(FLAGS & FLAG_TUTORIAL_DONE)) - goto L_Complete; - goto L_Check; - -L_Complete: - callfunc "TutorialCompleted"; - goto L_Warp; - -L_Check: - if (!(FLAGS & FLAG_TUTORIAL_DONE)) - goto L_Block; - goto L_Warp; + if (@tutorial >= 8) + goto L_Warp; + goto L_Block; L_Warp: warp "042-1.gat", 63, 48; diff --git a/world/map/npc/068-2/latoy.txt b/world/map/npc/068-2/latoy.txt index b1dca208..9031979f 100644 --- a/world/map/npc/068-2/latoy.txt +++ b/world/map/npc/068-2/latoy.txt @@ -7,7 +7,7 @@ 068-2.gat,92,83,0|script|Latoy|106, { set QUEST_NorthTulimshar, QUEST_NorthTulimshar | $@knowLatoyNT; - set @kylian, ((QUEST_NorthTulimshar & $@businessmanNT_MASK) >> $@businessmanNT_SHIFT); + set @kylian, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT); mes "[Latoy]"; mes "\"Is there something I can help you with?\""; diff --git a/world/map/npc/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt index a0c5e787..289b7a75 100644 --- a/world/map/npc/functions/clear_vars.txt +++ b/world/map/npc/functions/clear_vars.txt @@ -3,25 +3,67 @@ function|script|ClearVariables|, { // Tutorial - if (sorfina) - goto L_SetAllTut; - goto L_Easter; + if ((TUTORIAL) || (sorfina)) + goto L_ResetTut; + goto L_Heathin; -L_SetAllTut: - if (FLAGS & FLAG_TUTORIAL_DONE) +L_ResetTut: + //TUTORIAL to STARTAREA + if ((sorfina) || (kaan) || (hasan) || (tanisha)) goto L_ResetAllTut; - if ((FLAGS & FLAG_TUTORIAL_DONE) && (!(TUTORIAL & $@HasanCompleteBit))) - set TUTORIAL, TUTORIAL | $@HasanCompleteBit; - set @tutorial_tmp, (sorfina + tanisha + hasan + kaan); - set TUTORIAL, (TUTORIAL & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + 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; - goto L_ResetAllTut; + 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: @@ -92,7 +134,7 @@ L_Easter: set QUEST_Christmas09_state, 0; - set QUEST_Easter09_slots, 0; + set QUEST_Easter09_slots, 0; // easter 2010 // This must not be cleared: since some people would like to go to the easter island! diff --git a/world/map/npc/functions/mob_points.txt b/world/map/npc/functions/mob_points.txt index eb5aeff7..6e0744c3 100644 --- a/world/map/npc/functions/mob_points.txt +++ b/world/map/npc/functions/mob_points.txt @@ -138,7 +138,7 @@ function|script|MobPoints|, set Mobpt, Mobpt + @points[@mobID - 1002]; callfunc "ValonState"; - if (((@valon_start) && (!(@valon_end))) && (@mobID == $@ValonMob[@valon_mob])) + if (((@valon_state >= 2) && (@valon_state < 6)) && (@mobID == $@ValonMob[@valon_mob])) goto L_ValonMobKill; goto L_NatureKarma; |