summaryrefslogtreecommitdiff
path: root/world/map/npc/008-1/annualeaster.txt
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/008-1/annualeaster.txt')
-rw-r--r--world/map/npc/008-1/annualeaster.txt224
1 files changed, 0 insertions, 224 deletions
diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt
deleted file mode 100644
index 23d7611a..00000000
--- a/world/map/npc/008-1/annualeaster.txt
+++ /dev/null
@@ -1,224 +0,0 @@
-// 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.
-
-008-1,0,0,0|script|Easter Eggs|32767
-{
-
-//////////////////////////////////
-// puppet logic below
-
- if (strnpcinfo(2) == "") end;
- if (get(.disabled, "Easter Eggs") || $@isEaster < 1) goto L_Destroy;
- set @npc_distance, 1;
- callfunc "PCtoNPCRange";
- if(@npc_check) end;
- if ((gettimetick(2)-TUT_var < 5*7*86400) || (BaseLevel < 40)) //player must be created at least 5 weeks ago
- goto L_EndTooYoung;
-
- set @easter_year, (Annual_Quest & BYTE_1_MASK) >> BYTE_1_SHIFT;
-
- if (#EASTERTIMEPENALTY == 0)
- goto L_WarmUp;
- // prevent clicking multiple times:
- if (gettimetick(2) < #EASTERTIMEPENALTY + get(.wait_time, "Easter Eggs"))
- goto L_End2;
- if (@easter_year > gettime(7) - 2000)
- goto L_End3;
- set #EASTERTIMEPENALTY, gettimetick(2);
-
- set .found, .found + 1; // this egg has been found X times
- set @AnnualEasterTries, @AnnualEasterTries + 1; // you tried X times since login
-
- message strcharinfo(0), "Eggs : You found something!";
- set .@size, get(.small_rewards, "Easter Eggs");
- set .@random, rand(.@size+2);
- if (.@random < .@size)
- getitem get(.small_rewards$[.@random], "Easter Eggs"), rand(1, 2);
- elif (.@random == .@size)
- getexp rand(200), 0;
- else
- set Zeny, Zeny + rand(50);
-
- if (rand(get(.chance, "Easter Eggs")))
- goto L_NoEasterEgg;
-
-
- set .@random, rand(get(.medium_rewards$, "Easter Eggs"));
- getitem get(.medium_rewards$[.@random], "Easter Eggs"), 1;
- misceffect FX_GETITEM, strcharinfo(0);
- goto L_NoEasterEgg;
-
-L_NoEasterEgg:
- set .@fchance, get(.final_rew_chance, "Easter Eggs");
- if (@AnnualEasterTries > .@fchance)
- set @AnnualEasterTries, .@fchance;
- set .@random, rand(.@fchance - @AnnualEasterTries + 1);
- if (.@random || @easter_year > gettime(7) - 2000)
- goto L_Reward_End;
-
- // block for further items this year:
- set @easter_year, gettime(7) - 2000 + 1;
- set Annual_Quest, (Annual_Quest & ~(BYTE_1_MASK) | (@easter_year << BYTE_1_SHIFT));
-
- // 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 % get(.big_rewards, "Easter Eggs");
- getitem get(.big_rewards$[.@rewardindex], "Easter Eggs"), 1;
- misceffect FX_GETITEM, strcharinfo(0);
- message strcharinfo(0), "Eggs : This is really special. You won't find anything like this again.";
- goto L_Reward_End;
-
-L_Reward_End:
- if (.found >= get(.mapcount, "Easter Eggs"))
- goto L_Destroy;
- end;
-
-L_Destroy:
- set .eggs, get(.eggs, "Easter Eggs") - 1, "Easter Eggs"; // tell the puppeteer we lost an egg
- destroy;
-
-L_EndTooYoung:
- message strcharinfo(0), "Eggs : The nest is empty.";
- end;
-
-L_WarmUp:
- set #EASTERTIMEPENALTY, gettimetick(2);
- getitem "MoubooFigurine", 1;
- misceffect FX_GETITEM, strcharinfo(0);
- message strcharinfo(0), "Eggs : Hmmm eggs! Maybe you can find something nice there!";
- end;
-
-L_End3:
- message strcharinfo(0), "Eggs : Don't be greedy! You already found something nice.";
- end;
-
-L_End2:
- message strcharinfo(0), "Eggs : Don't be greedy! You just found something a moment ago.";
- set #EASTERTIMEPENALTY, #EASTERTIMEPENALTY + 5;
- if (#EASTERTIMEPENALTY > gettimetick(2))
- set #EASTERTIMEPENALTY, gettimetick(2);
- end;
-
-OnTimer5000:
- if (get(.disabled, "Easter Eggs") || $@isEaster < 1)
- goto L_Destroy;
- initnpctimer;
- end;
-
-
-//////////////////////////////////
-// puppeteer logic below
-
-OnSpawn:
- set .@e, rand(2,.loc[1]);
- set .@x, .loc[.@e];
- set .@y, .loc[(.@e-1)+.loc[1]];
- set .eID, .eID + 1; // give the egg an id
- set .@name$, "#--Ee"+chr(3)+.eID;
- if (.eID == 2147483647)
- set .eID, 0; // start over if id = 0x7FFFFFFF
- if (puppet(strnpcinfo(3), .@x, .@y, .@name$, 375) < 1) goto L_RetrySpawn; // spawn the egg
- initnpctimer .@name$; // init puppeteer check timer
- end;
-
-L_RetrySpawn:
- addnpctimer 0, strnpcinfo(0) + "::OnSpawn"; // schedule a spawn
- end;
-
-S_Spawn:
- if (.eggs >= .max_eggs)
- goto S_Return;
- set .eggs, .eggs + 1;
- addnpctimer 125 + rand(250), strnpcinfo(0) + "::OnSpawn"; // schedule a spawn
- if (.eggs < .min_eggs)
- goto S_Spawn;
- return;
-
-S_Return:
- return;
-
-OnHeartbeat:
- if (.max_eggs < 1 || .disabled || $@isEaster < 1) end;
- set .mapcount, 1 + getmapusers(strnpcinfo(3)) / 3;
- callsub S_Spawn;
- addnpctimer 1000, strnpcinfo(0) + "::OnHeartbeat"; // heartbeat
- end;
-
-OnCheckEaster:
- if ((gettime(6) == 3 && gettime(5) >= 22) || (gettime(6) == 4 && gettime(5) <= 25))
- set $@isEaster, 1;
- else
- set $@isEaster, 0;
- if ($@isEaster && .eggs < 1)
- donpcevent "Easter Eggs::OnStart";
- end;
-
-OnStart:
- if (.disabled || $@isEaster < 1) end;
- set .min_eggs, 1; // min number of eggs
- set .max_eggs, 3; // max number of eggs
- set .eggs, 0; // virtual amount of eggs
- set .eID, 0; // last egg id
- set .wait_time, 15;
- set .final_rew_chance, 70;
- set .chance, 750;
- setarray .loc[0], 0, 1,1, // first row: x, second row: y
- 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,
- 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;
- set .loc[0], (getarraysize(.loc) - 1); // loc 0 and 1 are special (stores array size, and half index)
- set .loc[1], ((.loc[0]+1)/2);
- setarray .small_rewards$[0], 0, "AppleCake", "CactusDrink", "CactusPotion", "Cake", "Candy", "CherryCake", "ChocolateBar", "ChocolateCake", "GreenApple", "Orange", "OrangeCake", "OrangeCupcake", "RedApple", "WhiteCake";
- set .small_rewards, getarraysize(.small_rewards$);
- setarray .medium_rewards$[0], 0, "RedEasterEgg", "GreenEasterEgg", "BlueEasterEgg", "YellowEasterEgg", "PinkEasterEgg", "TealEasterEgg";
- setarray .big_rewards$[0], 0, "RedEggshellHat", "BlueEggshellHat", "YellowEggshellHat", "GreenEggshellHat", "OrangeEggshellHat", "DarkEggshellHat";
- set .big_rewards, getarraysize(.big_rewards$);
- donpcevent strnpcinfo(0) + "::OnHeartbeat"; // first heartbeat
- end;
-}
-
-function|script|Easter Debug
-{
- goto L_Menu;
-
-L_Menu:
- clear;
- mes "Please choose an option.";
- if (get(.disabled, "Easter Eggs"))
- menu
- "Do Nothing.", L_Return,
- "Enable eggs.", L_Enable;
- menu
- "Do Nothing.", L_Return,
- "Disable eggs.", L_Disable;
-
-L_Enable:
- set .disabled, 0, "Easter Eggs";
- clear;
- mes "Easter Eggs enabled.";
- next;
- goto L_Menu;
-
-L_Disable:
- set .disabled, 1, "Easter Eggs"; // TODO: (tmwa) automatically destroy puppets when using @disablenpc & also discard timers
- clear;
- mes "Easter Eggs disabled.";
- next;
- goto L_Menu;
-
-L_Return:
- return;
-}