summaryrefslogtreecommitdiff
path: root/npc/014-5/events.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/014-5/events.txt')
-rw-r--r--npc/014-5/events.txt193
1 files changed, 193 insertions, 0 deletions
diff --git a/npc/014-5/events.txt b/npc/014-5/events.txt
new file mode 100644
index 000000000..8e4ea8f5a
--- /dev/null
+++ b/npc/014-5/events.txt
@@ -0,0 +1,193 @@
+// TMW2 scripts.
+// Author:
+// Jesusalva
+// Description:
+// St. Patrick Day
+// Variables:
+// #PATRICK_DAY
+// When you spinned this
+// #PATRICK_CTRL
+// Controls rarity, lowering boost
+// $@PATRICK_DAYMAX
+// Last day in St. Patrick event
+
+014-5,47,53,0 script St. Patrick Gold Pot NPC_COOKIE_MASTER,{
+ function symbol{
+ switch (getarg(0)) {
+ case 0:
+ mesn "%%0";
+ break;
+ case 1:
+ mesn "%%1";
+ break;
+ case 2:
+ mesn "%%2";
+ break;
+ case 3:
+ mesn "%%3";
+ break;
+ case 4:
+ mesn "%%4";
+ break;
+ case 5:
+ mesn "%%5";
+ break;
+ case 6:
+ mesn "%%6";
+ break;
+ default:
+ mesn "%%@";
+ break;
+ }
+ }
+
+ if ($EVENT$ != "St. Patrick" && !$@GM_OVERRIDE) {
+ channelmes("#world", "ERROR, ST. PATRICK GOLD POT: NOEVENT ERROR");
+ disablenpc .name$;
+ atcommand("@kick "+strcharinfo(0));
+ close;
+ }
+ if (#PATRICK_DAY == gettime(GETTIME_DAYOFMONTH)) {
+ mesn;
+ mesc l("You already claimed a reward today! Come back tomorrow, and remember to wear GREEN!"), 2;
+ close;
+ }
+ mesn;
+ mesc l("Lucky you, you found me! Do you want to SPIN THE WHEEL and gain GREAT rewards?"), 2;
+ mesc l("Remember that wearing green BOOSTS the rates at which good stuff will be found!"), 2;
+ next;
+ select
+ l("Spin it!"),
+ l("How does spinning works?"),
+ l("Don't spin it!");
+ mes "";
+ if (@menu == 3)
+ close;
+
+ if (@menu == 2) {
+ mes ("%%0 - "+l("GP"));
+ mes ("%%1 - "+getitemlink(CasinoCoins));
+ mes ("%%2 - "+getitemlink(Topaz));
+ mes ("%%3 - "+getitemlink(StrangeCoin));
+ mes ("%%4 - "+getitemlink(GoldOre));
+ mes ("%%5 - "+getitemlink(GoldenGift));
+ mes ("%%6 - "+getitemlink(GoldenApple));
+ close;
+ }
+
+ if (@menu == 1) {
+ // SPINNING! Set that you can't spin again.
+ #PATRICK_DAY=gettime(GETTIME_DAYOFMONTH);
+
+ // Each green accessory raises boost gauge in 25. Full set raises in further 25.
+ // Hat, Shirt, Pants, Boots and Gloves. Max boost gauge from dye is 150 atm.
+ .@boost=0;
+ if (getequipcardid(EQI_HEAD_TOP, 0) == GreenDye)
+ .@boost+=25;
+ if (getequipcardid(EQI_HEAD_MID, 0) == GreenDye)
+ .@boost+=25;
+ if (getequipcardid(EQI_HEAD_LOW, 0) == GreenDye)
+ .@boost+=25;
+ if (getequipcardid(EQI_SHOES, 0) == GreenDye)
+ .@boost+=25;
+ if (getequipcardid(EQI_GARMENT, 0) == GreenDye)
+ .@boost+=25;
+ if (.@boost >= 125)
+ .@boost+=25;
+
+ // Blv+Jlv gives a small boost. The "maximum" sum is 250, but we divide by 5
+ // So this grants a further boost of 4~50 depending on level.
+ .@boost+=(BaseLevel+JobLevel)/5;
+
+ // .@boost, right now, is a number from 0 to 200.
+ // Randomness factor can make that 20% higher, up to 240.
+ .@r=rand(0,20);
+ .@boost+=(.@boost*.@r/100);
+ // Then it may add or subtract 10 points from boost. Apply a cap to range 0~250.
+ .@boost+=rand(-10, 10);
+
+ // Now, you can't get 5 Golden Apples straight, right?
+ // You lose boost as you get rewards. You lose boost the farther from
+ // event last day you are, too.
+ .@boost-=#PATRICK_CTRL;
+ .@boost-=($@PATRICK_DAYMAX-#PATRICK_DAY);
+
+ // sanitize boost so it ranges from 0 to 250.
+ .@boost=max(0, .@boost);
+
+ // REFERENCE: At release time, max levels ingame were about 60/40.
+ // That would give 10~34 (not green) to 160~214 (fully green) boost value.
+ mesc l("Spinning!"), 2;
+
+ // .@v holds the reward you'll get
+ if (.@boost > 240)
+ .@v=6;
+ else if (.@boost > 200)
+ .@v=5;
+ else if (.@boost > 160)
+ .@v=4;
+ else if (.@boost > 120)
+ .@v=3;
+ else if (.@boost > 80)
+ .@v=2;
+ else if (.@boost > 40)
+ .@v=1;
+ else
+ .@v=0;
+
+ // Tell players what they spinned, and lower rarity on next tries
+ symbol(.@v);
+ #PATRICK_CTRL+=.@v+(.@v/2);
+
+ // Grant players the reward
+ switch (.@v) {
+ case 0: // GP
+ Zeny=Zeny+rand(10, .@boost+10);
+ break;
+ case 1: // Casino Coins
+ getitem CasinoCoins, max(1, .@boost/10);
+ break;
+ case 2: // Topaz
+ getitem Topaz, 1;
+ break;
+ case 3: // Strange Coins
+ getitem StrangeCoin, max(1, .@boost/10);
+ break;
+ case 4: // Gold Ore
+ getitem GoldOre, 1;
+ break;
+ case 5: // Golden Gift
+ getitem GoldenGift, 1;
+ break;
+ case 6: // Golden Apple (OP)
+ getitem GoldenApple, 1;
+ break;
+ }
+ next;
+ mesn;
+ mesc l("Did you like it? Find me tomorrow, until day @@, for another gift!", $@PATRICK_DAYMAX), 2;
+ close;
+ }
+ // Should not reach here
+ close;
+
+OnInit:
+ .sex = G_OTHER;
+ .distance = 4;
+
+ if ($EVENT$ != "St. Patrick") {
+ disablenpc(.name$);
+ end;
+ }
+OnClock0000:
+OnForcedMove:
+ if ($EVENT$ == "St. Patrick") {
+ setarray .@vx, 134, 162, 108, 105, 67, 191, 168, 170, 191, 188, 160, 145, 196, 120;
+ setarray .@vy, 36, 61, 45, 96, 76, 74, 72, 111, 113, 129, 125, 119, 143, 104;
+ .@r=rand(0,getarraysize(.@vx)-1);
+ movenpc .name$, .@vx[.@r], .@vy[.@r];
+ debugmes "Warping to %d,%d (seed %d)", .@vx[.@r], .@vy[.@r], .@r;
+ }
+ end;
+}
+