From 8e783e8cd6fda15f70ff1fb692b3407889e557e3 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Fri, 15 Feb 2013 23:02:47 +0100 Subject: Adding an annual Easter event. --- world/map/npc/008-1/_import.txt | 1 + world/map/npc/008-1/annualeaster.txt | 188 +++++++++++++++++++++++++++++++++++ world/map/npc/011-1/oscar.txt | 2 + 3 files changed, 191 insertions(+) create mode 100644 world/map/npc/008-1/annualeaster.txt (limited to 'world/map/npc') diff --git a/world/map/npc/008-1/_import.txt b/world/map/npc/008-1/_import.txt index 419b018b..7361a1bf 100644 --- a/world/map/npc/008-1/_import.txt +++ b/world/map/npc/008-1/_import.txt @@ -8,3 +8,4 @@ npc: npc/008-1/diryn.txt npc: npc/008-1/dock.txt npc: npc/008-1/george.txt npc: npc/008-1/hinnak.txt +npc: npc/008-1/annualeaster.txt diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt new file mode 100644 index 00000000..6a045618 --- /dev/null +++ b/world/map/npc/008-1/annualeaster.txt @@ -0,0 +1,188 @@ +// Annual easter event. + +// Annual_Quest byte 1 is used, see Oscar.txt for further information. + +// Author: PjotrOrial + +// read up on http://en.wikipedia.org/wiki/Computus +// Easter cannot be before march 22 or after april 25, so activate +// the event in these days. + + +function|script|AnnualEasterEvent|{ + + // prevent clicking multiple times: + if (gettimetick(2) < @eastertimepenalty + $@EASTER_FOUND_WAIT_TIME) + goto L_End; + set @eastertimepenalty, gettimetick(2); + + // global counter to determine reshuffle times of the eggs. + set $@peopleFoundEggs[@EasterEggID], $@peopleFoundEggs[@EasterEggID]+1; + + // give a small reward: + + set @tmp, getarraysize($@SmallAnnualEasterItems$); + set @random, rand(@tmp + 2); + if (@random < @tmp) getitem $@SmallAnnualEasterItems$[@random], rand(1, 2); + if (@random == @tmp) getexp rand(200), 0; + if (@random == @tmp + 1) set Zeny, Zeny + rand(50); + + // give out a better reward occasionally: + // standard case is branch taken, so only if rand yields 0, medium rewarding. + if (rand($@EASTER_EGG_INV_CHANCE)) + goto NoEasterEgg; + + set @random, rand(getarraysize($@MediumAnnualEasterRewards$)); + getitem $@MediumAnnualEasterRewards$[@random], 1; + +NoEasterEgg: + + // If you're lucky you get a bigger unique reward per year: + // so only pass on a small chance iff you don't have the item yet. + // Usually the journey ends here because @random != 0 -> end + callsub S_Read_Annual_Quest; + set @random, rand($@EASTER_FINAL_REW_INV_CHANCE); + if (@random || @easter_year > gettime(7) - 2000) + goto L_End1; + + // block for further items this year: + set @easter_year, gettime(7) - 2000 + 1; + callsub S_Update_Annual_Quest; + + // Hand out pretty unique rewards depending on the current year: + // We'll be handing out 2 different items each year, whereas one of them + // will be very common (95 %) and the other rare (5 %) for the players. + // The rare item will become the common item next year. + set @rewardindex, gettime(7) - 2012; + if (rand(100) < 5) + set @rewardindex, @rewardindex + 1; + + + // now hand out the specific item: + set @rewardindex, @rewardindex % getarraysize($@FinalAnnualEasterReward$); + getitem $@FinalAnnualEasterReward$[@rewardindex], 1; + goto L_End1; + +S_Read_Annual_Quest: + set @easter_year, (Annual_Quest & BYTE_1_MASK) >> BYTE_1_SHIFT; + return; + +S_Update_Annual_Quest: + set Annual_Quest, (Annual_Quest & ~(BYTE_1_MASK) | (@easter_year << BYTE_1_SHIFT)); + return; + +L_End1: + set @rewardindex, 0; + set @easter_year, 0; + set @random, 0; + set @tmp, 0; +L_End: + set @EasterEggID, 0; + return; +} + +008-1.gat,65,40,0|script|#TestEgg0|375,{ + set @EasterEggID, 0; + callfunc("AnnualEasterEvent"); +} + +008-1.gat,65,40,0|script|#TestEgg1|375,{ + set @EasterEggID, 1; + callfunc("AnnualEasterEvent"); +} + +008-1.gat,65,40,0|script|#TestEgg2|375,{ + set @EasterEggID, 2; + callfunc("AnnualEasterEvent"); +} + + +008-1.gat,59,38,0|script|#AnnualEaster|-1,{ + end; + +onInit: + set $@EASTER_FOUND_WAIT_TIME, 30; + set $@EASTER_FINAL_REW_INV_CHANCE, 35; + set $@EASTER_EGG_INV_CHANCE, 750; + + setarray $@easteregg_posx, 41, 45, 50, 57, 60, 64, 67, 65, 59, 72, 70, 82, 81, 93, 97, 101, 88, 108, 115, 122, 122, 129, 129, 130, 135, 123, 132, 132, 127, 124, 121, 107, 100, 101, 109, 104, 88, 84, 92, 59, 71, 65, 53, 55, 74, 59, 53, 46, 44, 44, 38, 43, 40, 43, 37; + setarray $@easteregg_posy, 87, 89, 88, 93, 98, 90, 96, 82, 81, 82, 96, 98, 92, 89, 89, 81, 82, 94, 96, 96, 90, 86, 72, 65, 60, 46, 25, 21, 20, 22, 20, 34, 24, 41, 43, 42, 48, 28, 27, 17, 23, 29, 25, 20, 39, 41, 34, 36, 18, 25, 31, 39, 64, 69, 73; + + if (getarraysize($@easteregg_posy) != getarraysize($@easteregg_posx)) + goto L_FAULTY_SETUP; + + setarray $@SmallAnnualEasterItems$, "AppleCake", "CactusDrink", "CactusPotion", "Cake", "Candy", "CherryCake", "ChocolateBar", "ChocolateCake", "GreenApple", "Orange", "OrangeCake", "OrangeCupcake", "RedApple", "WhiteCake"; + + setarray $@MediumAnnualEasterRewards$, "RedEasterEgg", "GreenEasterEgg", "BlueEasterEgg", "YellowEasterEgg", "PinkEasterEgg", "TealEasterEgg"; + + // DO NOT CHANGE SIZE AFTER EASTER 2013! + setarray $@FinalAnnualEasterReward$, "RedEggshellHat", "BlueEggshellHat", "YellowEggshellHat", "GreenEggshellHat", "OrangeEggshellHat", "DarkEggshellHat"; + + callsub S_disableEggs; + initnpctimer; + end; + +L_FAULTY_SETUP: + gmcommand "@mapexit"; + end; + +OnTimer1000: + setnpctimer 0; + + // an egg can be 'found' multiple times, make this number of possible findings + // depend on the number of players currently on the map. + set $@AEASTER_mapcount, getmapusers("008-1.gat"); + if ($@AEASTER_mapcount > 9) + set $@AEASTER_mapcount, 6 + $@AEASTER_mapcount / 3; + + set $@isEaster, 0; + if ((gettime(6) == 3 && gettime(5) > 22) || (gettime(6) == 4 && gettime(5) < 25) || debug) + set $@isEaster, 1; + + if (!$@wasEaster && $@isEaster) + callsub S_enableEggs; + if ($@wasEaster && !$@isEaster) + callsub S_disableEggs; + + set $@wasEaster, $@isEaster; + + if (!$@isEaster) + goto L_End; + + set $@EggID, 0; + callsub S_relocateEasterEgg; + set $@EggID, 1; + callsub S_relocateEasterEgg; + set $@EggID, 2; + callsub S_relocateEasterEgg; + // intentional fallthrough to L_End + +L_End: + set $@AEASTER_mapcount, 0; + set $@EggID, 0; + set $@isEaster, 0; + end; + +S_enableEggs: + enablenpc "#TestEgg0"; + enablenpc "#TestEgg1"; + enablenpc "#TestEgg2"; + return; + +S_disableEggs: + disablenpc "#TestEgg0"; + disablenpc "#TestEgg1"; + disablenpc "#TestEgg2"; + return; + +S_relocateEasterEgg: + if ($@peopleFoundEggs[$@EggID] < $@AEASTER_mapcount) + return; + + set $@peopleFoundEggs[$@EggID], 0; + + set $@eastereggPos, rand(getarraysize($@easteregg_posx)); + npcwarp $@easteregg_posx[$@eastereggPos], $@easteregg_posy[$@eastereggPos], "#TestEgg" + $@EggID; + return; + +} diff --git a/world/map/npc/011-1/oscar.txt b/world/map/npc/011-1/oscar.txt index 8babc2ec..46fe637d 100644 --- a/world/map/npc/011-1/oscar.txt +++ b/world/map/npc/011-1/oscar.txt @@ -13,6 +13,8 @@ // Be sure to not have a quest whose duration overlaps on two years, // or this will cause problems. +// The second byte contains easter information, see annualeaster.txt for more information. + // Halloween quest states: // 0: nothing started // 1: the player knows the story and is asked to go find pumpkin seeds in the forest -- cgit v1.2.3-60-g2f50 From 56ab7307429dbf71b5eee1f5afefd9a93257e332 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Fri, 15 Feb 2013 23:06:50 +0100 Subject: fixup space. --- world/map/npc/008-1/annualeaster.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'world/map/npc') diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt index 6a045618..0e5194f4 100644 --- a/world/map/npc/008-1/annualeaster.txt +++ b/world/map/npc/008-1/annualeaster.txt @@ -105,7 +105,7 @@ onInit: set $@EASTER_FINAL_REW_INV_CHANCE, 35; set $@EASTER_EGG_INV_CHANCE, 750; - setarray $@easteregg_posx, 41, 45, 50, 57, 60, 64, 67, 65, 59, 72, 70, 82, 81, 93, 97, 101, 88, 108, 115, 122, 122, 129, 129, 130, 135, 123, 132, 132, 127, 124, 121, 107, 100, 101, 109, 104, 88, 84, 92, 59, 71, 65, 53, 55, 74, 59, 53, 46, 44, 44, 38, 43, 40, 43, 37; + setarray $@easteregg_posx, 41, 45, 50, 57, 60, 64, 67, 65, 59, 72, 70, 82, 81, 93, 97, 101, 88, 108, 115, 122, 122, 129, 129, 130, 135, 123, 132, 132, 127, 124, 121, 107, 100, 101, 109, 104, 88, 84, 92, 59, 71, 65, 53, 55, 74, 59, 53, 46, 44, 44, 38, 43, 40, 43, 37; setarray $@easteregg_posy, 87, 89, 88, 93, 98, 90, 96, 82, 81, 82, 96, 98, 92, 89, 89, 81, 82, 94, 96, 96, 90, 86, 72, 65, 60, 46, 25, 21, 20, 22, 20, 34, 24, 41, 43, 42, 48, 28, 27, 17, 23, 29, 25, 20, 39, 41, 34, 36, 18, 25, 31, 39, 64, 69, 73; if (getarraysize($@easteregg_posy) != getarraysize($@easteregg_posx)) -- cgit v1.2.3-60-g2f50 From 3465ccd70f8edee0e0a26532c52712c778bc0ee4 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Sat, 16 Feb 2013 10:42:05 +0100 Subject: message the player if timer has not yet expired. --- world/map/npc/008-1/annualeaster.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'world/map/npc') diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt index 0e5194f4..9bc6b584 100644 --- a/world/map/npc/008-1/annualeaster.txt +++ b/world/map/npc/008-1/annualeaster.txt @@ -13,7 +13,7 @@ function|script|AnnualEasterEvent|{ // prevent clicking multiple times: if (gettimetick(2) < @eastertimepenalty + $@EASTER_FOUND_WAIT_TIME) - goto L_End; + goto L_End2; set @eastertimepenalty, gettimetick(2); // global counter to determine reshuffle times of the eggs. @@ -71,12 +71,13 @@ S_Update_Annual_Quest: set Annual_Quest, (Annual_Quest & ~(BYTE_1_MASK) | (@easter_year << BYTE_1_SHIFT)); return; +L_End2: + message strcharinfo(0), "Why are these empty?"; L_End1: set @rewardindex, 0; set @easter_year, 0; set @random, 0; set @tmp, 0; -L_End: set @EasterEggID, 0; return; } -- cgit v1.2.3-60-g2f50 From 71e07c9d57d99016948e3733cba3bfa1fd78203c Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Sat, 16 Feb 2013 11:17:28 +0100 Subject: prevent low level players from annual easter. --- world/map/npc/008-1/annualeaster.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'world/map/npc') diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt index 9bc6b584..425aa529 100644 --- a/world/map/npc/008-1/annualeaster.txt +++ b/world/map/npc/008-1/annualeaster.txt @@ -11,6 +11,10 @@ function|script|AnnualEasterEvent|{ + // prevent players having level 19 or less to get anything: + if (BaseLevel < 20) + goto L_End2; + // prevent clicking multiple times: if (gettimetick(2) < @eastertimepenalty + $@EASTER_FOUND_WAIT_TIME) goto L_End2; -- cgit v1.2.3-60-g2f50 From f6a824238f3f384a122d922667b67b118d7ec88f Mon Sep 17 00:00:00 2001 From: Jessica Tölke Date: Thu, 7 Mar 2013 23:16:09 +0100 Subject: Modifications on the Easter event after testing with a group of people: - add message when you find something in a nest - add message when you get the unique reward - increase number of relocations - reduce the time penalty after checking a nest from 30 to 15 seconds - change behavior when checking a nest during the penalty time -- message should make it more clear that it's needed to wait a while -- extend the time penalty for a few seconds --- world/map/npc/008-1/annualeaster.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'world/map/npc') diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt index 425aa529..eedd5b9d 100644 --- a/world/map/npc/008-1/annualeaster.txt +++ b/world/map/npc/008-1/annualeaster.txt @@ -13,7 +13,7 @@ function|script|AnnualEasterEvent|{ // prevent players having level 19 or less to get anything: if (BaseLevel < 20) - goto L_End2; + goto L_EndTooYoung; // prevent clicking multiple times: if (gettimetick(2) < @eastertimepenalty + $@EASTER_FOUND_WAIT_TIME) @@ -24,7 +24,7 @@ function|script|AnnualEasterEvent|{ set $@peopleFoundEggs[@EasterEggID], $@peopleFoundEggs[@EasterEggID]+1; // give a small reward: - + message strcharinfo(0), "You found something!"; set @tmp, getarraysize($@SmallAnnualEasterItems$); set @random, rand(@tmp + 2); if (@random < @tmp) getitem $@SmallAnnualEasterItems$[@random], rand(1, 2); @@ -65,6 +65,7 @@ NoEasterEgg: // now hand out the specific item: set @rewardindex, @rewardindex % getarraysize($@FinalAnnualEasterReward$); getitem $@FinalAnnualEasterReward$[@rewardindex], 1; + message strcharinfo(0), "This is really special. You won't find anything like this again."; goto L_End1; S_Read_Annual_Quest: @@ -75,8 +76,15 @@ S_Update_Annual_Quest: set Annual_Quest, (Annual_Quest & ~(BYTE_1_MASK) | (@easter_year << BYTE_1_SHIFT)); return; +L_EndTooYoung: + message strcharinfo(0), "The nest is empty."; + goto L_End1; + L_End2: - message strcharinfo(0), "Why are these empty?"; + message strcharinfo(0), "Don't be greedy! You just found something a moment ago."; + set @eastertimepenalty, @eastertimepenalty + 5; + if (@eastertimepenalty > gettimetick(2)) + set @eastertimepenalty, gettimetick(2); L_End1: set @rewardindex, 0; set @easter_year, 0; @@ -106,7 +114,7 @@ L_End1: end; onInit: - set $@EASTER_FOUND_WAIT_TIME, 30; + set $@EASTER_FOUND_WAIT_TIME, 15; set $@EASTER_FINAL_REW_INV_CHANCE, 35; set $@EASTER_EGG_INV_CHANCE, 750; @@ -136,9 +144,7 @@ OnTimer1000: // an egg can be 'found' multiple times, make this number of possible findings // depend on the number of players currently on the map. - set $@AEASTER_mapcount, getmapusers("008-1.gat"); - if ($@AEASTER_mapcount > 9) - set $@AEASTER_mapcount, 6 + $@AEASTER_mapcount / 3; + set $@AEASTER_mapcount, 1 + getmapusers("008-1.gat") / 3; set $@isEaster, 0; if ((gettime(6) == 3 && gettime(5) > 22) || (gettime(6) == 4 && gettime(5) < 25) || debug) -- cgit v1.2.3-60-g2f50 From 22c00753de1e821fd41323de4e335e7a89042495 Mon Sep 17 00:00:00 2001 From: Jessica Tölke Date: Wed, 20 Mar 2013 20:37:25 +0100 Subject: Introduce a non-permanent counter of tries. The counter gets reset on log out. The probability to get the final reward depending on the counter. --- world/map/npc/008-1/annualeaster.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'world/map/npc') diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt index eedd5b9d..c857326c 100644 --- a/world/map/npc/008-1/annualeaster.txt +++ b/world/map/npc/008-1/annualeaster.txt @@ -23,6 +23,8 @@ function|script|AnnualEasterEvent|{ // global counter to determine reshuffle times of the eggs. set $@peopleFoundEggs[@EasterEggID], $@peopleFoundEggs[@EasterEggID]+1; + set @AnnualEasterTries, @AnnualEasterTries + 1; + // give a small reward: message strcharinfo(0), "You found something!"; set @tmp, getarraysize($@SmallAnnualEasterItems$); @@ -45,7 +47,10 @@ NoEasterEgg: // so only pass on a small chance iff you don't have the item yet. // Usually the journey ends here because @random != 0 -> end callsub S_Read_Annual_Quest; - set @random, rand($@EASTER_FINAL_REW_INV_CHANCE); + + if (@AnnualEasterTries > $@EASTER_FINAL_REW_INV_CHANCE) + set @AnnualEasterTries, $@EASTER_FINAL_REW_INV_CHANCE; + set @random, rand($@EASTER_FINAL_REW_INV_CHANCE - @AnnualEasterTries + 1); if (@random || @easter_year > gettime(7) - 2000) goto L_End1; @@ -115,7 +120,7 @@ L_End1: onInit: set $@EASTER_FOUND_WAIT_TIME, 15; - set $@EASTER_FINAL_REW_INV_CHANCE, 35; + set $@EASTER_FINAL_REW_INV_CHANCE, 70; set $@EASTER_EGG_INV_CHANCE, 750; setarray $@easteregg_posx, 41, 45, 50, 57, 60, 64, 67, 65, 59, 72, 70, 82, 81, 93, 97, 101, 88, 108, 115, 122, 122, 129, 129, 130, 135, 123, 132, 132, 127, 124, 121, 107, 100, 101, 109, 104, 88, 84, 92, 59, 71, 65, 53, 55, 74, 59, 53, 46, 44, 44, 38, 43, 40, 43, 37; -- cgit v1.2.3-60-g2f50