diff options
-rw-r--r-- | npc/014-5/_import.txt | 1 | ||||
-rw-r--r-- | npc/014-5/events.txt | 193 | ||||
-rw-r--r-- | npc/commands/event.txt | 23 | ||||
-rw-r--r-- | npc/functions/event.txt | 2 |
4 files changed, 214 insertions, 5 deletions
diff --git a/npc/014-5/_import.txt b/npc/014-5/_import.txt index f73cab3a7..6920787dd 100644 --- a/npc/014-5/_import.txt +++ b/npc/014-5/_import.txt @@ -3,5 +3,6 @@ "npc/014-5/_mobs.txt", "npc/014-5/_warps.txt", "npc/014-5/blossom.txt", +"npc/014-5/events.txt", "npc/014-5/sagratha.txt", "npc/014-5/sign.txt", 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; +} + diff --git a/npc/commands/event.txt b/npc/commands/event.txt index 48dd5bef5..fe5c39b78 100644 --- a/npc/commands/event.txt +++ b/npc/commands/event.txt @@ -57,6 +57,9 @@ function script sClear { // Simpler events $PATRICK_DAYCTRL=0; $PATRICK_DAYMAX=0; + DelAccRegFromEveryPlayer("#PATRICK_DAY"); + DelAccRegFromEveryPlayer("#PATRICK_CTRL"); + DelAccRegFromEveryPlayer("#TMW2_LOGINBONUS"); // We must remove any event drop charcommand("@reloadmobdb"); @@ -137,6 +140,7 @@ function script GlobalEventMenu { menu l("Disable event"), -, l("Enable Valentine Day"), -, + l("Enable St. Patrick Day"), -, l("Enable Easter"), -, l("Enable Worker's Day"), -, l("Enable Christmas"), -, @@ -149,8 +153,17 @@ function script GlobalEventMenu { case 2: set $EVENT$, "Valentine"; $@VALENTINE_LOVELETTER = htnew(); $@VALENTINE_GIFTSTACKS = htnew(); logmes "Enabled VALENTINE DAY event.", LOGMES_ATCOMMAND; break; - case 3: sEaster(); break; - case 4: + case 3: + $EVENT$="St. Patrick"; + $@PATRICK_DAYMAX=31; + enablenpc "sPatrick"; + enablenpc "Patrick Saulc"; + enablenpc "St. Patrick Gold Pot"; + donpcevent "St. Patrick Gold Pot::OnForcedMove"; + logmes "Enabled ST. PATRICK DAY event (until day 31).", LOGMES_ATCOMMAND; + break; + case 4: sEaster(); break; + case 5: set $EVENT$, "Worker Day"; logmes "Enabled WORKERS DAY event.", LOGMES_ATCOMMAND; /* @@ -158,16 +171,16 @@ function script GlobalEventMenu { debugmes "Snakes are now dropping Pearls."; */ break; - case 5: + case 6: logmes "Enabled CHRISTMAS event.", LOGMES_ATCOMMAND; query_sql("DELETE FROM `quest` WHERE `quest_id` = '"+SQuest_Christmas+"'"); sChristmas(); break; - case 6: + case 7: $EVENT$=any("Demure Birthday", "Blame Saulc"); dispbottom("Maybe in future this increases everyone attack speed? Well, for now,"); dispbottom("This is not actually an event, it just lower prices at Lua GM shop."); break; - case 7: DelItemFromEveryPlayer(MurdererCrown); break; + case 8: DelItemFromEveryPlayer(MurdererCrown); break; } return; diff --git a/npc/functions/event.txt b/npc/functions/event.txt index 21bfc8444..51a830b1d 100644 --- a/npc/functions/event.txt +++ b/npc/functions/event.txt @@ -157,6 +157,8 @@ OnClock0000: $@PATRICK_DAYMAX=.patrick_endday; enablenpc "sPatrick"; enablenpc "Patrick Saulc"; + enablenpc "St. Patrick Gold Pot"; + donpcevent "St. Patrick Gold Pot::OnForcedMove"; } // End the event the day after if (.@d == .patrick_endday+1) { |