From cac5c770e7bbb169e9516909dfc0d44afceb1446 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 11 Jul 2023 23:16:30 -0300 Subject: Clean up part (but not the entirety) of Moubootaur Legends Event System --- npc/003-1/events.txt | 499 ----------------------------------- npc/commands/event.txt | 15 +- npc/functions/daily.txt | 3 +- npc/functions/event.txt | 679 ------------------------------------------------ 4 files changed, 3 insertions(+), 1193 deletions(-) delete mode 100644 npc/003-1/events.txt diff --git a/npc/003-1/events.txt b/npc/003-1/events.txt deleted file mode 100644 index d6843d1..0000000 --- a/npc/003-1/events.txt +++ /dev/null @@ -1,499 +0,0 @@ -// TMW2 scripts. -// Author: -// Jesusalva -// Description: -// Controls events, part of Aurora Event System -// -// See also: functions/aurora.txt, functions/seasons.txt, command/event.txt, -// event.txt, functions/soulmenhir.txt and, of course, the event maps (if any). -// -// Script Variables: -// Q_AuroraEvent -// Quest Variable: FYEVENT_CYCLE, Score, ClaimedControl -// -// TODO: Use duplicate() command to make it available in other towns as well - -// Easter -003-1,47,53,0 script Aurora NPC_FEMALE,{ - function handleEaster; - function handleValentine; - function handleStPatrick; - - // Aurora Event functions - function auroraRankings; - function auroraCurrentRankings; - function auroraSubmit; - function auroraListRewards; - - // Handle annuals - //.@v_stday = getvariableofnpc(.valentine_stday, "#EventCore"); - //.@v_stmon = getvariableofnpc(.valentine_stmon, "#EventCore"); - .@v_endday = getvariableofnpc(.valentine_endday, "#EventCore"); - .@v_endmon = getvariableofnpc(.valentine_endmon, "#EventCore"); - - //.@e_stday = getvariableofnpc(.easter_stday, "#EventCore"); - //.@e_stmon = getvariableofnpc(.easter_stmon, "#EventCore"); - .@e_endday = getvariableofnpc(.easter_endday, "#EventCore"); - .@e_endmon = getvariableofnpc(.easter_endmon, "#EventCore"); - - .@dy=gettime(GETTIME_DAYOFMONTH); - .@mo=gettime(GETTIME_MONTH); - - // Debug Overrides - if ($@DEBUG_OD) - .@dy=$@DEBUG_OD; - if ($@DEBUG_OM) - .@mo=$@DEBUG_OM; - - // Annual rewards can only be claimed until the month ends - if ($EVENT$ == "Patrick") - handleStPatrick(); - else if (.@mo == .@v_endmon && .@dy > .@v_endday) - handleValentine(); - else if (.@mo == .@e_endmon && .@dy > .@e_endday) - handleEaster(); - - // Another event is going on, smoothly handle it - if ($EVENT$ != "") - goto L_Aurora; - else - mesc l("Currently, there is no event going on."), 1; - close; - - -// OnRestore causes OnInit to start again -OnRestore: - setnpcdisplay .name$, "Aurora", NPC_FEMALE; -OnInit: - .@npcId = getnpcid(.name$); - setunitdata(.@npcId, UDT_HEADTOP, MiniSkirt); - setunitdata(.@npcId, UDT_HEADMIDDLE, RedStockings); - //setunitdata(.@npcId, UDT_HEADBOTTOM, BlueRoseHat); - setunitdata(.@npcId, UDT_WEAPON, UglyChristmasSweater); // (Blue) Bathrobe? - setunitdata(.@npcId, UDT_HAIRSTYLE, any(8, 8, 8, 20, 20, 11)); - setunitdata(.@npcId, UDT_HAIRCOLOR, 7); - .sex = G_FEMALE; - .distance = 5; - end; - -// Override for Valentine Day - There should be no Aurora -OnValentine: - .@npcId = getnpcid(.name$); - setnpcdisplay .name$, "Demure#ValentineFinal", NPC_FEMALE; - //.@npcId = getnpcid(.name$); - setunitdata(.@npcId, UDT_HEADTOP, Cap); - setunitdata(.@npcId, UDT_HEADMIDDLE, RedStockings); - setunitdata(.@npcId, UDT_HEADBOTTOM, BunnyEars); - setunitdata(.@npcId, UDT_WEAPON, GMRobe); - setunitdata(.@npcId, UDT_HAIRSTYLE, 14); - setunitdata(.@npcId, UDT_HAIRCOLOR, 18); - end; - - - - - - - - - - - - - - - - - - - - - - - - -///////////////////////////////////////////////////////////////////////////////// -function handleEaster { - // Handle rewards before anything else - if (EASTER_YEAR != gettime(GETTIME_YEAR)) { - EASTER_YEAR=gettime(GETTIME_YEAR); - if (strcharinfo(0) == $@easter_name$[0]) { - makepet BhopFluffy; - mesn; - mesc l("For the first place in Easter, you gained a Bhopper Fluffy."), 3; - mesc l("Remember to give it a balanced diet of Aquadas to make it happy."), 3; - next; - } else { - .@pos=array_find($@easter_name$, strcharinfo(0)); - // 0 (aka top 1) is not an appliable winner - if (.@pos > 0) { - // Reverse it so top 10 value is 2, and top 2 value is 10. - .@pos=11-.@pos; - getitem StrangeCoin, .@pos*10; - } - } - } - mesn; - mesq l("Easter is over! I am the last chance to get rid of eggs!!"); - mesc l("Note: Golden and Silver Eggs are deleted after the next event end."), 1; - // Heartbeat - select - l("Trade Silver Eggs"), - l("Trade Golden Eggs"), - l("View LeaderBoard"), - l("Thanks Lilica."); - mes ""; - switch (@menu) { - case 1: - openshop "#eastershop1"; - closedialog; - break; - case 2: - openshop "#eastershop2"; - closedialog; - break; - case 3: - mesn l("Easter @@", gettime(GETTIME_YEAR)); - mes("1."+$@easter_name$[0]+" ("+$@easter_value[0]+")"); - mes("2."+$@easter_name$[1]+" ("+$@easter_value[1]+")"); - mes("3."+$@easter_name$[2]+" ("+$@easter_value[2]+")"); - mes("4."+$@easter_name$[3]+" ("+$@easter_value[3]+")"); - mes("5."+$@easter_name$[4]+" ("+$@easter_value[4]+")"); - mes("6."+$@easter_name$[5]+" ("+$@easter_value[5]+")"); - mes("7."+$@easter_name$[6]+" ("+$@easter_value[6]+")"); - mes("8."+$@easter_name$[7]+" ("+$@easter_value[7]+")"); - mes("9."+$@easter_name$[8]+" ("+$@easter_value[8]+")"); - mes("10."+$@easter_name$[9]+" ("+$@easter_value[9]+")"); - break; - } - return; -} - - - - - - - - - - - - - - - - - - - - - - - - -///////////////////////////////////////////////////////////////////////////////// -function handleValentine { - mesn; - mesq l("Valentine Day is over!"); - next; - mes "##B"+l("Top 10 - Valentine Day")+"##b"; - mes("1." +$@valentine_name$[0]+" ("+$@valentine_value[0]+")"); - mes("2." +$@valentine_name$[1]+" ("+$@valentine_value[1]+")"); - mes("3." +$@valentine_name$[2]+" ("+$@valentine_value[2]+")"); - mes("4." +$@valentine_name$[3]+" ("+$@valentine_value[3]+")"); - mes("5." +$@valentine_name$[4]+" ("+$@valentine_value[4]+")"); - mes("6." +$@valentine_name$[5]+" ("+$@valentine_value[5]+")"); - mes("7." +$@valentine_name$[6]+" ("+$@valentine_value[6]+")"); - mes("8." +$@valentine_name$[7]+" ("+$@valentine_value[7]+")"); - mes("9." +$@valentine_name$[8]+" ("+$@valentine_value[8]+")"); - mes("10."+$@valentine_name$[9]+" ("+$@valentine_value[9]+")"); - - if (#VALENTINE_SENT+#VALENTINE_OPENED <= 0) - return; - next; - - // Handle rewards - #VALENTINE_SENT=0; - #VALENTINE_OPENED=0; - #VALENTINE_RECEIVED=0; - copyarray(.@name$[0], $@valentine_name$[0], 10); - if (strcharinfo(0) == .@name$[0]) { - makepet DoggyDog; - getitem PrismGift, 1; - getitem StrangeCoin, 10; - } else if (strcharinfo(0) == .@name$[1] || strcharinfo(0) == .@name$[2]) { - getitem PrismGift, 1; - getitem GoldenGift, 1; - getitem StrangeCoin, 10; - } else if (strcharinfo(0) == .@name$[3] || strcharinfo(0) == .@name$[4]) { - getitem GoldenGift, 1; - getitem SilverGift, 1; - getitem StrangeCoin, 10; - } else if (strcharinfo(0) == .@name$[5] || strcharinfo(0) == .@name$[6]) { - getitem SilverGift, 1; - getitem BronzeGift, 1; - getitem StrangeCoin, 10; - } else if (strcharinfo(0) == .@name$[7] || strcharinfo(0) == .@name$[8] || strcharinfo(0) == .@name$[9]) { - getitem BronzeGift, 1; - getitem StrangeCoin, 10; - } else { - getitem StrangeCoin, 5; - } - - getexp #VALENTINE_SENT+#VALENTINE_RECEIVED, #VALENTINE_SENT; - Zeny=Zeny+#VALENTINE_OPENED; - - if (strcharinfo(0) == .@name$[0]) - mesc l("You gained a @@ for the #1 place on the event. Remember to feed it @@, or it may run away from you.", getitemlink(DoggyDog), getitemlink(AnimalBones)); - return; -} - - - - - - - - - - - - - - - - - - - - - - - - -///////////////////////////////////////////////////////////////////////////////// -function handleStPatrick { - // Check if St. Patrick day is over D: - if ($EVENT$ != "Patrick") - goto OnRestore; - // Okay, it is still St. Patrick :3 - mesn; - mesc l("It's St. Patrick Event!"), 3; - mes l("At 00:00, 06:00, 12:00, 15:00, 18:00 and 21:00 server time"); - mes l("Several special clovers will show up at forests."); - next; - mes l("They have 10x more chance to drop a @@, so it is a great deal!", getitemlink(FourLeafClover)); - mes l("Also, hidden in a forest which is not hot nor cold, is the Gold Pot Cauldron..."); - mes l("You can get daily something from it, but unless you're green like me, you will have no luck..."); - next; - return; -} - - - - - - - - - - - - - - - - - - - - - - - - -///////////////////////////////////////////////////////////////////////////////// -L_Aurora: - // Define script variables - .@WHAT$=l("event"); - - // Fill them with specific details, if available - if ($EVENT$ == "Expo") { - .@WHAT$=l("world expo"); - } else if ($EVENT$ == "Fishing") { - .@WHAT$=l("golden fish hunt"); - } else if ($EVENT$ == "Kamelot") { - .@WHAT$=l("kamelot raid"); - } else if ($EVENT$ == "Regnum") { - .@WHAT$=l("regnum's blessing"); - } else if ($EVENT$ == "Mining") { - .@WHAT$=l("miners union request"); - } else if ($EVENT$ == "Candor") { - .@WHAT$=l("candor battle season"); - } else if ($EVENT$ == "Celestia") { - .@WHAT$=l("yeti king hunt season"); - } else if ($EVENT$ == "Gemini") { - .@WHAT$=l("gemini season"); - } else if ($EVENT$ == "Rebirth") { - .@WHAT$=l("rebirth season"); - } else if ($EVENT$ == "Tower") { - .@WHAT$=l("dream tower apparition"); - } else if ($EVENT$ == "Raid") { - .@WHAT$=l("boss raid"); - } else if ($EVENT$ == "Olympics") { - .@WHAT$=l("magic olympics"); - } - - mesn; - mesq l("Hello! I am Aurora, and I oversee the %s!", .@WHAT$); - next; - mesn; - mesq l("So, how can I help you today?"); - do - { - next; - select - l("Event Details"), - l("Event Ranking Rewards"), - rif(FYEventUsesRanking(), l("Current Rankings")), - rif(FYEventUsesRanking(), l("List & Claim rewards")), - l("That's all, thanks!"); - mes ""; - switch (@menu) { - case 1: - EventHelp(); - if (FYEventUsesRanking()) { - mesc l("You must claim all rewards and use any event item BEFORE it ends."), 1; - mesc l("Left-overs will be deleted shortly after."), 1; - mesc l("Any eventual ranking reward will be sent by the banker's mail."), 1; - } else { - mesn; - mesq l("Have fun!"); - } - break; - - case 2: - auroraRankings(); - break; - - case 3: - auroraCurrentRankings(); - break; - - case 4: - auroraSubmit(); - auroraListRewards(); - break; - - default: - close; - } - // The code block is done - } while (true); -close; - - - - - - - - - - - - - - - - - - - - - - - - -///////////////////////////////////////////////////////////////////////////////// -function auroraRankings { - setnpcdialogtitle l("Aurora Events")+" - "+$EVENT$; - setskin "aurora_"+$EVENT$; - mes "There is no ranking information available for this event."; - select("Ok"); - setskin ""; - clear; - auroraCurrentRankings(); // More to silence a bug than whatelse - return; -} - - -function auroraCurrentRankings { - if (FYEventUsesRanking()) { - HallOfAurora(); - } else { - mesn; - mesq l("Personally, I like unranked events more than ranked ones..."); - } - return; -} - - -function auroraListRewards { - .@s=getq2(Q_AuroraEvent); - .@r=getq3(Q_AuroraEvent); - mesn; - freeloop(true); - for (.@i=0; .@i < getarraysize($FYREWARD_PT); .@i++) { - mes l("%s %d pts - %d %s", - (.@r > .@i ? "%%A" : (.@r == .@i ? "%%E" : "%%B")), // Status Indicator - $FYREWARD_PT[.@i], $FYREWARD_AM[.@i], getitemlink($FYREWARD_ID[.@i])); - // You're at this milestone? Hmm - if (.@r == .@i) { - // Your score is enough: rank you up - if (.@s >= $FYREWARD_PT[.@i]) { - inventoryplace $FYREWARD_ID[.@i], $FYREWARD_AM[.@i]; - getitem $FYREWARD_ID[.@i], $FYREWARD_AM[.@i]; - .@r+=1; - setq3 Q_AuroraEvent, .@r; - } - } - } - freeloop(false); - return; -} - - -function auroraSubmit { - .@q2=getq2(Q_AuroraEvent); - FYE_Submit(); - mesc l("Event score: %d -> %d", .@q2, getq2(Q_AuroraEvent)); - return; -} - - - - - - - - - - - - - - - - - - - - - - - -// DO NOT REMOVE -} - diff --git a/npc/commands/event.txt b/npc/commands/event.txt index 2be1b53..56f7829 100644 --- a/npc/commands/event.txt +++ b/npc/commands/event.txt @@ -303,15 +303,8 @@ function script GlobalEventMenu { set $EVENT$, "Valentine"; $@VALENTINE_LOVELETTER = htnew(); $@VALENTINE_GIFTSTACKS = htnew(); logmes "Enabled VALENTINE DAY event.", LOGMES_ATCOMMAND; break; case 3: - $EVENT$="Patrick"; - $@PATRICK_DAYMAX=31; - enablenpc "sPatrick"; - setnpcdisplay("Aurora", "Patrick Saulc", NPC_WEIRDGREEN); - 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 4: break; case 5: set $EVENT$, "Worker"; logmes "Enabled WORKERS DAY event.", LOGMES_ATCOMMAND; @@ -321,17 +314,13 @@ function script GlobalEventMenu { */ break; case 6: - $EVENT$="Thanksgiving"; - logmes "Enabled THANKS GIVING event.", LOGMES_ATCOMMAND; break; case 7: $EVENT$="Event"; logmes "Enabled EVENT (HORIZON) event.", LOGMES_ATCOMMAND; break; case 8: - logmes "Enabled CHRISTMAS event.", LOGMES_ATCOMMAND; - DelQuestFromEveryPlayer(SQuest_Christmas); - sChristmas(); break; + break; case 9: $EVENT$=any("Demure Birthday", "Blame Saulc"); dispbottom("Maybe in future this increases everyone attack speed? Well, for now,"); diff --git a/npc/functions/daily.txt b/npc/functions/daily.txt index 747b90b..d784208 100644 --- a/npc/functions/daily.txt +++ b/npc/functions/daily.txt @@ -66,8 +66,7 @@ function script daily_login_bonus_handler { if (gettime(6) == OCTOBER) { if (#TMW2_LOGINBONUS != gettime(GETTIME_YEAR) && gettime(5) == 1) { #TMW2_LOGINBONUS=gettime(GETTIME_YEAR); - getitem Coffee, 1; - getexp BaseLevel, JobLevel; + getitem Coffee, 2; dispbottom "##B##2"+l("It's the International Coffee Day!")+" "+l("Have a warm cup of Coffee on the house, and enjoy!")+"##b##0"; } } diff --git a/npc/functions/event.txt b/npc/functions/event.txt index 89190c3..eb83bb2 100644 --- a/npc/functions/event.txt +++ b/npc/functions/event.txt @@ -11,59 +11,6 @@ - script sPatrick NPC_HIDDEN,{ OnInit: - setarray .maps$, - "005-1", - "013-1", - "014-1", - "014-2", - "014-3", - "014-4", - "014-5", - "017-1", - "018-2", - "018-4", - "018-5", - "soren"; - end; -OnMyMobDeath: - end; -OnClock0000: -OnClock6000: -OnClock1200: -OnClock1500: -OnClock1800: -OnClock2100: - .@d=gettime(GETTIME_DAYOFMONTH); - // Patrick Day should work only in 2 luck days according to Saulc - // If this is required use $PATRICK_DAYCTRL so the days before $@PATRICK_DAYMAX - // act with 100% chances (determinism). - // As it is being spawn 4 times at a day (like TMW-BR events), because it is - // flatly and outright IMPOSSIBLE to add a permanent spawn, that is not required. - if ($EVENT$ == "Patrick" && .@d <= $@PATRICK_DAYMAX) { - for (.@i=0; .@i < getarraysize(.maps$); .@i++) { - .@m$=.maps$[.@i]; - .@x=getmapinfo(MAPINFO_SIZE_X, .@m$)-20; - .@y=getmapinfo(MAPINFO_SIZE_Y, .@m$)-20; - - // Remove previously spawned clovers - killmonster(.@m$, "sPatrick::OnMyMobDeath"); - // It is one clover for each 225 tiles (about a 25x25 square) - .@maparea=(.@x-20)*(.@y-20); - .@mobs=max(1, .@maparea/225); - areamonster .@m$, 20, 20, .@x, .@y, strmobinfo(1, StPatricksClover), StPatricksClover, .@mobs, "sPatrick::OnMyMobDeath"; - } - } - end; - -// Remove previously spawned clovers for event end -// And then disables the NPC -OnCleanUp: - for (.@i=0; .@i < getarraysize(.maps$); .@i++) { - .@m$=.maps$[.@i]; - killmonster(.@m$, "sPatrick::OnMyMobDeath"); - } - disablenpc "sPatrick"; - donpcevent "Aurora::OnRestore"; end; } @@ -132,208 +79,7 @@ OnBossDie: end; } -- script sThankAeros NPC_HIDDEN,{ -OnInit: - .users=getusers(1); - .score=0; - .event=0; - .quota=300; -OnTimer90000: - // Abort event and reset score - if (.event && .event < gettimetick(2)) { - .event=0; - .score=0; - $@GM_EVENT=0; - $@MK_SCENE=MK_NONE; - killmonsterall("001-1"); - mapwarp("001-1", "000-1", 22, 22, 0); - announce ("The event is over!"), bc_all|bc_npc; - } - - // Skip processment until current event ends - if (.event) { - initnpctimer; - end; - } - - // Stop counting or update scores - if ($EVENT$ != "Thanksgiving") - end; - .users=getusers(1); - .score+=.users; - .quota = limit(300, 500 - (.users * 25), 500); - - // Do event (lasts 45 minutes) - if (!.event && !$@MK_SCENE && !$@GM_EVENT && .score > .quota && (.users >= 4 || $@GM_OVERRIDE)) { - /* Reserve Aeros */ - $@MK_SCENE=MK_LOCKED; - /* Setup the event */ - $@AEROS_SPWN=(.users > 6 ? 2 : any(0, 1)); - $@AEROS_AUTOSPAWN=.users+rand2(1, .users); - donpcevent("Mana Being#001-1::OnAutoSched"); - /* Open the event */ - $@GM_EVENT = 2; - .event = gettimetick(2) + 2700; - announce ("The mana bridge to Aeros is open! To participate on event, talk to ##BSoul Menhir##b!"), bc_all|bc_npc; - announce ("##1THANKSGIVING SPECIAL. TIME LIMIT: ##B45 MINUTES.##b##0"), bc_all|bc_npc; - channelmes("#world", "An event is happening on Aeros! Hurry up!"); - } - - initnpctimer; - end; - -OnForceInit: - .score+=9999; - goto OnTimer90000; -} - function script sThanksgiving { - // Variables: - // #THANKS_DAY - // #THANKS_STREAK - // @thanks_card - - // Already spinned - if (#THANKS_DAY == gettime(5) || $EVENT$ != "Thanksgiving") - return; - - // Not spinned yet - showavatar 1102; - mes l(".:: Thanksgiving ::."); - mesc l("Spin daily the card to get prizes!"); - - select - l("SPIN!"), - l("Later"); - mes ""; - if (@menu == 2) { - setskin ""; - closeclientdialog; - return; - } - // Spin it - // Your prize is saved in .@luck. Rigged against fruits - .@luck=rand2(0,11); - .@luck=(.@luck == 10 ? rand2(0,11) : .@luck); - // A fruit before 10 days: rig to Arcmage or to blueprint - if (.@luck == 10 && #THANKS_STREAK < 10) - .@luck+=any(-1,1); - // A fruit before 20 days: Lower chances from 4% to 2% - if (.@luck == 10 && #THANKS_STREAK < 20) - .@luck=rand2(0,11); - // Extra spins - .@extra=rand2(1,3); - .@spins=.@extra*11+.@luck; - //.@extra=0; - - // Show the spins - for (.@i=0;.@i<=.@spins;.@i++) { - .@cur=(.@i%11); - showavatar 1103+.@cur; - sleep2(60); - } - mes l(".:: Congratulations ::."); - #THANKS_DAY = gettime(5); - #THANKS_STREAK+=1; - if (debug || $@GM_OVERRIDE) { - mes l("You got a %d", .@luck); - mesf "Spins: %d/%d (cur %d extra %d)", .@i, .@spins, .@cur, .@extra; - mes ""; - //.@luck=$@GM_OVERRIDE; - } - - // Switch the reward - .@blv = BaseLevel + TOP3AVERAGELVL() / 2; - switch (.@luck) { - case 0: // EXP - .@p=.@blv*#THANKS_STREAK; - .@p*=3; - getexp .@p, 0; - mes l("You got %d EXP!", .@p); - break; - case 1: // JEXP - .@p=.@blv*#THANKS_STREAK; - .@p=.@p*15/10; - getexp 0, .@p; - mes l("You got %d JEXP!", .@p); - break; - case 2: // GP - .@p=.@blv*#THANKS_STREAK; - Zeny+=.@p; - mes l("You got %d GP!", .@p); - break; - case 3: // MOBPT - .@p=.@blv*#THANKS_STREAK; - Mobpt+=.@p; - mes l("You got %d Monster Points!", .@p); - break; - case 4: // RES - .@p=.@blv*#THANKS_STREAK; - .@p*=3; - REAL_ESTATE_CREDITS+=.@p; - mes l("You got %d Real Estate Credits!", .@p); - break; - case 5: // GIFT - .@p=BronzeGift; - .@p=(#THANKS_STREAK > 7 ? SilverGift : .@p); - .@p=(#THANKS_STREAK > 15 ? GoldenGift : .@p); - .@p=(#THANKS_STREAK > 22 ? PrismGift : .@p); - .@p=(#THANKS_STREAK > 27 ? SupremeGift : .@p); - mes l("You got a(n) %s gift!", getitemlink(.@p)); - getitem .@p, 1; - break; - case 6: // STR C - .@p=#THANKS_STREAK; - getitem StrangeCoin, .@p; - mes l("You got %d %s!", .@p, getitemlink(StrangeCoin)); - break; - case 7: // HERO C - .@p=#THANKS_STREAK; - .@p+=getq2(LoFQuest_HH)*max(1,#THANKS_STREAK/10); - getitem HeroCoin, .@p; - mes l("You got %d %s!", .@p, getitemlink(HeroCoin)); - break; - case 8: // MERC - .@p=any(MercCard_GonzoDark, MercCard_Rosa, MercCard_Soren, MercCard_Apane); - .@p=(#THANKS_STREAK > 7 ? any(MercCard_EarthWitch, MercCard_Demure, MercCard_Jesusalva, MercCard_Pookie) : .@p); - .@p=(#THANKS_STREAK > 14 ? any(MercCard_Arthur, MercCard_LawnCable, MercCard_Crazyfefe, MercCard_Saulc) : .@p); - .@p=(#THANKS_STREAK > 21 ? any(MercCard_Swezanne, MercCard_DragonStar, MercCard_Msawis, MercCard_Aisen) : .@p); - .@p=(#THANKS_STREAK > 27 ? any(MercCard_Xanthem, MercCard_Woody, MercCard_Lilanna) : .@p); - getitem .@p, 1; - mes l("You got a %s!", getitemlink(.@p)); - break; - case 9: // CARD - .@p=any(NatureCard, NinjaCard, MageCard, DruidCard, ClericCard, KnightCard, HeroCard, NecromancerCard); - .@p=(#THANKS_STREAK > 24 ? any(SpeedCard, ReflectCard, PowerCard, WallCard) : .@p); - getitem .@p, 1; - mes l("You got a %s!", getitemlink(.@p)); - break; - case 10: // FRUIT - .@p=MysteriousFruit; - getitem .@p, 1; - mes l("You got a %s!", getitemlink(.@p)); - break; - case 11: // BLUE - .@p=any(EquipmentBlueprintA, EquipmentBlueprintA, AlchemyBlueprintA); - .@p=(#THANKS_STREAK > 7 ? any(EquipmentBlueprintB, EquipmentBlueprintB, AlchemyBlueprintB) : .@p); - .@p=(#THANKS_STREAK > 14 ? any(EquipmentBlueprintC, EquipmentBlueprintC, AlchemyBlueprintC) : .@p); - .@p=(#THANKS_STREAK > 21 ? any(EquipmentBlueprintD, EquipmentBlueprintD, AlchemyBlueprintD) : .@p); - .@p=(#THANKS_STREAK > 27 ? any(EquipmentBlueprintE, EquipmentBlueprintE, AlchemyBlueprintE) : .@p); - getitem .@p, 1; - mes l("You got a %s!", getitemlink(.@p)); - break; - } - - // Special bonus - if (#THANKS_STREAK % 7 == 0) { - getitem StrangeCoin, 10; - mesc l("%d day streak! Gained %d bonus %s!", #THANKS_STREAK, 10, getitemlink(StrangeCoin)); - } - - // Close - next; - setskin ""; - closeclientdialog; return; } @@ -388,112 +134,11 @@ function script CoffeeDay { // FSFDay() function script FSFDay { - if (!playerattached()) - return; - - // Date check - if (gettime(6) != SEPTEMBER) - return; - if (gettime(5) != 9) - return; - - // Max. 0.16% chances, 0.008% per monster level - .@lv=min(200, getmonsterinfo(killedrid, MOB_LV)); - if (rand(1000000) < (.@lv*8)) { - getmapxy(.@m$, .@x, .@y, 0); - .@x+=rand2(-1,1); - .@y+=rand2(-1,1); - // Ancient 50%, Equipment 25%, Alchemy 25% - .@bp = any(AncientBlueprint, AncientBlueprint, AncientBlueprint, AncientBlueprint, AncientBlueprint, - AncientBlueprint, AncientBlueprint, AncientBlueprint, AncientBlueprint, AncientBlueprint, - EquipmentBlueprintA, EquipmentBlueprintB, EquipmentBlueprintC, EquipmentBlueprintD, EquipmentBlueprintE, - AlchemyBlueprintA, AlchemyBlueprintB, AlchemyBlueprintC, AlchemyBlueprintD, AlchemyBlueprintE); - makeitem(.@bp, 1, .@m$, .@x, .@y); - } return; } // CraftmasterDay() function script CraftmasterDay { - if (!playerattached()) - return; - - // Date check - if (!$BETASERVER) - return; - if (gettime(7) != 2021) - return; - if (gettime(6) != JUNE) - return; - if (gettime(5) != 21) - return; - if (getmap() != "018-3") - return; - - // Scored a Blue Print (2.5%) - if (rand2(10000) < 250) { - if (BaseLevel > 80 && REBIRTH) - getitem any(EquipmentBlueprintE, AlchemyBlueprintE, - EquipmentBlueprintD, AlchemyBlueprintD, - EquipmentBlueprintC, AlchemyBlueprintC, - EquipmentBlueprintB, AlchemyBlueprintB, - EquipmentBlueprintA, AlchemyBlueprintA), 1; - else if (BaseLevel > 70) - getitem any(EquipmentBlueprintD, AlchemyBlueprintD, - EquipmentBlueprintC, AlchemyBlueprintC, - EquipmentBlueprintB, AlchemyBlueprintB, - EquipmentBlueprintA, AlchemyBlueprintA), 1; - else if (BaseLevel > 45) - getitem any(EquipmentBlueprintC, AlchemyBlueprintC, - EquipmentBlueprintB, AlchemyBlueprintB, - EquipmentBlueprintA, AlchemyBlueprintA), 1; - else if (BaseLevel > 20) - getitem any(EquipmentBlueprintB, AlchemyBlueprintB, - EquipmentBlueprintA, AlchemyBlueprintA), 1; - else - getitem any(EquipmentBlueprintA, AlchemyBlueprintA), 1; - return; - } - - // Scored Monster Points (9%) - if (rand2(10000) < 900) { - .@mpt=rand2(BaseLevel*10, BaseLevel*100); // 600~6000 usually - Mobpt+=.@mpt; - dispbottom l("Acquired: %s Monster Points", fnum(.@mpt)); - return; - } - - // Autocraft (1%) - if (rand2(10000) < 100) { - .@rc=any(rand2(51, 62), 65, 66, rand2(72, 76), rand2(77, 81), 82, 98, - 99, 100, rand2(93, 97), rand2(88, 91), rand(83, 87), 92, 101, - rand2(102,117), any(122, 112), rand2(125, 134), rand2(135, 143)); - // Retrieve ID - .@it=getcraftcode(.@rc); - if (.@it <= 0) - return; - // Mark the crafting in your score variable - CRAFTING_SCORE_COMPLETE+=getiteminfo(.@it, ITEMINFO_ELV); - // Update your score book - CRAFTING_SCORE=(CRAFTING_SCORE_COMPLETE/40); - // Receive item - getitembound(.@it, 1, 1); - // Apply options if possible - if (getskilllv(TMW2_CRAFT)) { - delinventorylist(); // Needed, because we'll rely on rfind() - getinventorylist(); - .@index=array_rfind(@inventorylist_id, .@it); - - // Just to be sure, if this have an option, get something else - if (getitemoptionparambyindex(.@index, 0)) { - .@index=array_find(@inventorylist_id, .@it); - } - - callfunc("csys_Apply", .@index); - } - dispbottom l("Successfully Crafted: %s", getitemname(.@it)); - return; - } return; } @@ -510,327 +155,3 @@ function script CraftmasterDay { - -000-0,0,0,0 script #EventCore NPC_HIDDEN,{ - end; - -// confEvent(event ID, stday, stmon, endday, endmon) -function confEvent { - setd("."+getarg(0)+"_stday", getarg(1)); - setd("."+getarg(0)+"_stmon", getarg(2)); - setd("."+getarg(0)+"_endday", getarg(3)); - setd("."+getarg(0)+"_endmon", getarg(4)); - // Save the event key? - //.@confname=".conf_"+getarg(2)+"$"; - //setd(.@confname+"["+getarraysize(.@confname)+"]", getarg(0)); - // Save only the day? (And use if statement) - .@confname$=".conf_"+getarg(2); - .@size=getarraysize(getd(.@confname$)); - setd(.@confname$+"["+.@size+"]", getarg(1)); - //debugmes "CONFIGURE EVENT, %s[%d] = %d", .@confname$, .@size, getarg(1); - //debugmes "CNAME: %s", getarg(0); - return; -} - -// Event Schedule (all dates are inclusive) -// NEVER, ever, include the last day of the month. -OnInit: - /* - confEvent("valentine", - 13, FEBRUARY, - 16, FEBRUARY); - - confEvent("tmw2day", - 1, MARCH, - 7, MARCH); - - confEvent("patrick", - 15, MARCH, - 19, MARCH); - - confEvent("easter", - 17, APRIL, - 24, APRIL); - - confEvent("worker", - 27, APRIL, - 3, MAY); - - confEvent("thanks", - 1, NOVEMBER, - 29, NOVEMBER); // NEVER use the last day of the month here - - confEvent("xmas", - 19, DECEMBER, - 2, JANUARY); - */ - - // Some setup - .@isinit=true; - disablenpc "sPatrick"; - FYE_Normalize(); - -// Check for events every midnight -OnClock0000: - // No events on test server - if (debug && !$@GM_OVERRIDE) - end; - - // Prepare variables - .@d=gettime(GETTIME_DAYOFMONTH); - .@m=gettime(GETTIME_MONTH); - .@o=gettime(GETTIME_WEEKDAY); // Resets at 0 (sunday) - debugmes "A new day begins! Today is %02d/%02d", .@d, .@m; - - // Override the server-wide randomness - resetrng(); - - // Initialize the event core - if ($@DEBUG_OD) - .@d=$@DEBUG_OD; - if ($@DEBUG_OM) - .@m=$@DEBUG_OM; - consoleinfo "EVENT CORE, the %02d/%02d", .@d, .@m; - - // Is there another event this week? - if (!$HARDCORE && .@o == MONDAY && !.@isinit) { - .@dofy=true; - .@confname$=".conf_"+.@m; - - // NOTE: Maybe make a single .annuals array and cycle it - // Gather the ST variable from interest...? - for (.@i=0;.@i < getarraysize(getd(.@confname$)); .@i++) { - .@val=getd(.@confname$+"["+.@i+"]"); - //debugmes "Looping, %d = %d", .@i, .@val; - - // Erm. - if (.@val == 0) - continue; - - // This script has a weakness: It cannot predict events starting - // at the start or the end of the month. - // So they might still overlap. - // A possible solution is to, eventually, record start and end date. - // And only inhibit FY event if the MONDAY is within the event...? - // XXX: Now it inhibits by itself; But it should NOT begin a FYE if - // another (annual) event is scheduled for the same week. - // Namely: TMW2 Day and Thanksgiving - debugmes "%d >= %d && %d <= %d", .@val, .@d-6, .@val, .@d+6; - // In this case there's already an event! - // .@d == .@val <= .@d+6 AND - if ( .@val >= .@d-6 && .@val <= .@d+6 ) { - .@dofy=false; - break; - } - // continue... - } - - // Stop previous event - FYStopEvent(); - - // Trigger event framework - if (.@dofy && $EVENT$ == "") - FYNewEvent(); - else - debugmes "\033[1mAnother event is scheduled!"; - } - - // Handle Valentine Day - if (.@m >=.valentine_stmon && .@m <= .valentine_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .valentine_stday - 1) { - kamibroadcast("Valentine Day will start tomorrow!"); - } - // Last Day: Send out an announcement - if (.@d == .valentine_endday) { - kamibroadcast("It's the last day for Valentine Event! Hurry up!"); - } - // Begin the event - if (.@d == .valentine_stday) { - kamibroadcast("Valentine Day begun!"); - if ($EVENT$ != "") - FYStopEvent(); - $EVENT$="Valentine"; - $@VALENTINE_LOVELETTER = htnew(); - $@VALENTINE_GIFTSTACKS = htnew(); - } - // End the event the day after - if (.@d == .valentine_endday+1) { - kamibroadcast("Valentine Day ended!"); - sClear(); - $EVENT$=""; - } - } - - - - // Handle TMW2 Day - if (.@m >=.tmw2day_stmon && .@m <= .tmw2day_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .tmw2day_stday - 1) { - kamibroadcast("Moubootaur Legends Anniversary will start tomorrow!"); - } - // Last Day: Send out an announcement - if (.@d == .tmw2day_endday) { - kamibroadcast("It's the last day of our Anniversary Event! Hurry up!"); - } - // Begin the event - if (.@d == .tmw2day_stday) { - kamibroadcast("Moubootaur Legends Anniversary Event begun!"); - if ($EVENT$ != "Anniversary") - $BCONFB_EXPR+=50; - $EVENT$="Anniversary"; - } - // End the event the day after - if (.@d == .tmw2day_endday+1) { - kamibroadcast("Our Special Anniversary Event ended! Thanks!"); - sClear(); - $EVENT$=""; - } - } - - - // Handle St. Patrick Day - // During this day, a special four leaf clover is spawned daily, at 4 times in the day - // in all forests: 6:00, 12:00, 18:00 and 00:00. - // $PATRICK_DAYMAX - if (.@m >=.patrick_stmon && .@m <= .patrick_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .patrick_stday - 1) { - kamibroadcast("St. Patrick Day will start tomorrow!"); - } - // Last Day: Send out an announcement - else if (.@d == .patrick_endday) { - kamibroadcast("It's the last day for St. Patrick Event! Hurry up!"); - } - // Begin the event - else if (.@d == .patrick_stday) { - kamibroadcast("St. Patrick Day begun!"); - if ($EVENT$ != "") - FYStopEvent(); - $EVENT$="Patrick"; - $@PATRICK_DAYMAX=.patrick_endday; - enablenpc "sPatrick"; - setnpcdisplay("Aurora", "Patrick Saulc", NPC_WEIRDGREEN); - enablenpc "St. Patrick Gold Pot"; - donpcevent "St. Patrick Gold Pot::OnForcedMove"; - } - // End the event the day after - else if (.@d == .patrick_endday+1) { - kamibroadcast("St. Patrick Day ended!"); - sClear(); - $EVENT$=""; - donpcevent "sPatrick::OnCleanUp"; - } - } - - - // Handle Easter - if (.@m >=.easter_stmon && .@m <= .easter_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .easter_stday - 1 && .@m == .easter_stmon) { - kamibroadcast("Easter will start tomorrow!"); - } - // Last Day: Send out an announcement - else if (.@d == .easter_endday && .@m == .easter_endmon) { - kamibroadcast("It's the last day for Easter Event! Hurry up!"); - } - // Begin the event - else if (.@d == .easter_stday && .@m == .easter_stmon) { - kamibroadcast("Easter begun!"); - if ($EVENT$ != "") - FYStopEvent(); - sEaster(); - } - // End the event the day after - else if (.@d == .easter_endday+1 && .@m == .easter_endmon) { - kamibroadcast("Easter ended!"); - sClear(); - $EVENT$=""; - } - } - - - // Handle Worker Day - if (.@m >=.worker_stmon && .@m <= .worker_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .worker_stday - 1 && .@m == .worker_stmon) { - kamibroadcast("Worker Day will start tomorrow!"); - } - // Last Day: Send out an announcement - else if (.@d == .worker_endday && .@m == .worker_endmon) { - kamibroadcast("It's the last day for Worker Day Event! Hurry up!"); - } - // Begin the event - else if (.@d == .worker_stday && .@m == .worker_stmon) { - kamibroadcast("Worker Day begun!"); - if ($EVENT$ != "") - FYStopEvent(); - $EVENT$="Worker"; - } - // End the event the day after - else if (.@d == .worker_endday+1 && .@m == .worker_endmon) { - kamibroadcast("Worker Day ended!"); - sClear(); - $EVENT$=""; - } - } - - - // Handle Thanksgiving Day - if (.@m >=.thanks_stmon && .@m <= .thanks_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .thanks_stday - 1 && .@m == .thanks_stmon) { - kamibroadcast("Thanksgiving will start tomorrow!"); - } - // Last Day: Send out an announcement - else if (.@d == .thanks_endday && .@m == .thanks_endmon) { - kamibroadcast("It's the last day for Thanksgiving Event! Hurry up!"); - } - // Begin the event - else if (.@d == .thanks_stday && .@m == .thanks_stmon) { - kamibroadcast("Thanksgiving begun!"); - if ($EVENT$ != "") - FYStopEvent(); - $EVENT$="Thanksgiving"; - donpcevent("sThankAeros::OnTimer90000"); - } - // End the event the day after - else if (.@d == .thanks_endday+1 && .@m == .thanks_endmon) { - kamibroadcast("Thanksgiving ended!"); - sClear(); - $EVENT$=""; - } - } - - - // Handle Christmas. It goes past the year so the rule is different, BEWARE - if (.@m == .xmas_stmon || .@m == .xmas_endmon) { - // It's tomorrow: Send out an announcement - if (.@d == .xmas_stday - 1 && .@m == .xmas_stmon) { - kamibroadcast("Christmas will start tomorrow!"); - } - // Last Day: Send out an announcement - else if (.@d == .xmas_endday && .@m == .xmas_endmon) { - kamibroadcast("It's the last day for Christmas Event! Hurry up!"); - } - // Begin the event - else if (.@d == .xmas_stday && .@m == .xmas_stmon) { - kamibroadcast("Christmas begun!"); - if ($EVENT$ != "") - FYStopEvent(); - $EVENT$="Christmas"; - DelQuestFromEveryPlayer(SQuest_Christmas); - sChristmas(); - } - // End the event the day after - else if (.@d == .xmas_endday+1 && .@m == .xmas_endmon) { - kamibroadcast("Christmas ended!"); - sClear(); - $EVENT$=""; - } - } - debugmes "EVENT CORE has finished"; - end; -} - -- cgit v1.2.3-60-g2f50