diff options
-rw-r--r-- | npc/001-14/ctrl.txt | 10 | ||||
-rw-r--r-- | npc/001-14/hocus.txt | 239 | ||||
-rw-r--r-- | npc/functions/aurora.txt | 13 |
3 files changed, 143 insertions, 119 deletions
diff --git a/npc/001-14/ctrl.txt b/npc/001-14/ctrl.txt index 7b8386497..c64d20dc6 100644 --- a/npc/001-14/ctrl.txt +++ b/npc/001-14/ctrl.txt @@ -120,6 +120,8 @@ OnCheck: OnEnd: if (@moly_chall != 1) end; + .@pts=getq2(Q_AuroraEvent); + setq2 Q_AuroraEvent, .@pts+rand2(1, 1+@moly_scr/10); dispbottom l("End! Score this time: %d", @moly_score); FYMOLY_ENBALL = max(FYMOLY_ENBALL, @moly_score); @moly_score = 0; @@ -281,6 +283,8 @@ OnTimer10000: if (@moly_chall != 6) end; @moly_score = (getunitdata(.mob, UDT_HP) - getunitdata(.mob, UDT_MAXHP)) * -1; killmonsterall(getmap()); + .@pts=getq2(Q_AuroraEvent); + setq2 Q_AuroraEvent, .@pts+rand2(1, 1+@moly_score/1500); dispbottom l("End! Score this time: %d", @moly_score); FYMOLY_MPWLVL = max(FYMOLY_MPWLVL, @moly_score); @moly_score = 0; @@ -589,6 +593,8 @@ OnWin: if (@moly_tick < gettimetick(2) / 2) end; // Ticks were Corrupted @moly_score = gettimetick(2) - @moly_tick; if (@moly_score < 8) end; // This is impossible*, don't even bother + .@pts=getq2(Q_AuroraEvent); + setq2 Q_AuroraEvent, .@pts+rand2(1, 1+BaseLevel/20); dispbottom l("End! Score this time: %s", FuzzyTime(@moly_tick)); if (FYMOLY_RACERS >= 8) FYMOLY_RACERS = min(FYMOLY_RACERS, @moly_score); @@ -763,6 +769,8 @@ OnClM: OnEnd: if (@moly_chall != 9) end; + .@pts=getq2(Q_AuroraEvent); + setq2 Q_AuroraEvent, .@pts+rand2(1, 1+@moly_score/10); dispbottom l("End! Score this time: %d", @moly_score); FYMOLY_HOCUSM = max(FYMOLY_HOCUSM, @moly_score); @moly_score = 0; @@ -805,6 +813,8 @@ OnCheck: // Game Over! killmonsterall(getmap()); @moly_score = @moly_score / 2; + .@pts=getq2(Q_AuroraEvent); + setq2 Q_AuroraEvent, .@pts+rand2(1, 1+@moly_score/20); dispbottom l("End! Score this time: %s", FuzzyTime(gettimetick(2)+@moly_score)); FYMOLY_SURVIV = max(FYMOLY_SURVIV, @moly_score); @moly_score = 0; diff --git a/npc/001-14/hocus.txt b/npc/001-14/hocus.txt index 29062ec21..3bc241f5b 100644 --- a/npc/001-14/hocus.txt +++ b/npc/001-14/hocus.txt @@ -4,122 +4,7 @@ // Description: // Magic Olympics -001-14,89,89,0 script Hocus Pocus NPC_BLACKWIZARD,{ - function showScores; - function parseScores; - if ($EVENT$ != "Olympics") cwarp "Save", 0, 0; - mesn; - mesq l("Greetings, %s %s, I am Hocus Pocus the Grandmaster.", academicrank(), strcharinfo(0)); - do - { - next; - select - l("Scoreboards"), - l("Detailed Information"), - l("Thanks for your wise words."); - mes ""; - switch (@menu) { - case 1: - showScores(); - break; - case 2: - mesn; - mesq l("The Magic Olympics consist in twelve challenges with scoreboards."); - next; - mesn; - mesq l("Getting ranked #1 in a challenge yields you 10 points, getting ranked #2 yields you 9 points and so on."); - next; - mesn; - mesq l("Not participating in a challenge yields you zero points. In case of a tie, char creation date will be the decisive factor: Older adventurers will get the preference."); - next; - mesn; - mesq l("You also get points for participation, exchange them with Aurora back in Tulimshar before event ends."); - next; - mesn; - mesq l("The grand winner will get a %s. Both the first and second place will get a tuition at the Magic Academy.", getitemlink(BlackyCat)); - next; - mesn; - mesq l("The Magic Olympics happen roughly quarterly, but not always at the same dates. It begins on a monday and ends on the sunday. It usually happens two weeks after the Mining Union Research Request event."); - break; - } - } while (@menu != 3); - close; - -function t { - return gettimetick(2); -} - -function showScores { - parseScores("General Event Score", "$@moly_n$", "$@moly_v"); - mesc l("Reminder: "), 1; - mesc l("Scores are updated every 6 hours."), 1; - next; - parseScores("Energy Balls Challenge", "$@moly01_n$", "$@moly01_v"); - //parseScores("Boss Fight Challenge", "$@moly02_n$", "$@moly02_v", 0); - //parseScores("Fluffy Hunt Challenge", "$@moly03_n$", "$@moly03_v"); - parseScores("Chanting Challenge", "$@moly04_n$", "$@moly04_v"); - parseScores("Alchemy Master Challenge", "$@moly05_n$", "$@moly05_v"); - parseScores("Magic Power Challenge", "$@moly06_n$", "$@moly06_v"); - parseScores("Mana Exp Challenge", "$@moly07_n$", "$@moly07_v"); - parseScores("Obstacle Race Challenge", "$@moly08_n$", "$@moly08_v", t()); - parseScores("Hocus Commands Challenge", "$@moly09_n$", "$@moly09_v"); - parseScores("Survive! Challenge", "$@moly10_n$", "$@moly10_v", t()); - parseScores("Friendship Challenge", "$@moly11_n$", "$@moly11_v"); - parseScores("Intensive Mage Challenge", "$@moly12_n$", "$@moly12_v"); - mes ""; - mesc l("Reminder: "), 1; - mesc l("Scores close at Sunday 23:59 - No scores will be given for last minute rushes!"), 1; - return; -} - -function SCH { - .@n$ = getarg(0); - .@i = getarg(1); - return getd(sprintf("%s[%d]", .@n$, .@i)); -} - -function parseScores { - .@t$ = getarg(0); - .@n$ = getarg(1); - .@v$ = getarg(2); - .@tm = getarg(3, -1); - mes ""; - mes l("##B%s: TOP 10##b", .@t$); - if (.@tm < 0) { - mes("1."+SCH(.@n$, 0)+" ("+fnum(SCH(.@v$, 0))+")"); - mes("2."+SCH(.@n$, 1)+" ("+fnum(SCH(.@v$, 1))+")"); - mes("3."+SCH(.@n$, 2)+" ("+fnum(SCH(.@v$, 2))+")"); - mes("4."+SCH(.@n$, 3)+" ("+fnum(SCH(.@v$, 3))+")"); - mes("5."+SCH(.@n$, 4)+" ("+fnum(SCH(.@v$, 4))+")"); - mes("6."+SCH(.@n$, 5)+" ("+fnum(SCH(.@v$, 5))+")"); - mes("7."+SCH(.@n$, 6)+" ("+fnum(SCH(.@v$, 6))+")"); - mes("8."+SCH(.@n$, 7)+" ("+fnum(SCH(.@v$, 7))+")"); - mes("9."+SCH(.@n$, 8)+" ("+fnum(SCH(.@v$, 8))+")"); - mes("10."+SCH(.@n$, 9)+" ("+fnum(SCH(.@v$, 9))+")"); - } else { - mes("1."+SCH(.@n$, 0)+" ("+FuzzyTime(.@tm - SCH(.@v$, 0))+")"); - mes("2."+SCH(.@n$, 1)+" ("+FuzzyTime(.@tm - SCH(.@v$, 1))+")"); - mes("3."+SCH(.@n$, 2)+" ("+FuzzyTime(.@tm - SCH(.@v$, 2))+")"); - mes("4."+SCH(.@n$, 3)+" ("+FuzzyTime(.@tm - SCH(.@v$, 3))+")"); - mes("5."+SCH(.@n$, 4)+" ("+FuzzyTime(.@tm - SCH(.@v$, 4))+")"); - mes("6."+SCH(.@n$, 5)+" ("+FuzzyTime(.@tm - SCH(.@v$, 5))+")"); - mes("7."+SCH(.@n$, 6)+" ("+FuzzyTime(.@tm - SCH(.@v$, 6))+")"); - mes("8."+SCH(.@n$, 7)+" ("+FuzzyTime(.@tm - SCH(.@v$, 7))+")"); - mes("9."+SCH(.@n$, 8)+" ("+FuzzyTime(.@tm - SCH(.@v$, 8))+")"); - mes("10."+SCH(.@n$, 9)+" ("+FuzzyTime(.@tm - SCH(.@v$, 9))+")"); - } - dnext; - return; -} - -OnInit: - .distance=5; -// Scoreboards are refreshed every 6 hours -OnHour2359: -OnHour0559: -OnHour1159: -OnHour1759: - if ($EVENT$ != "Olympics") end; +function script HocusScoreNew { .@nb = query_sql("SELECT c.name, i.value FROM `char_reg_num_db` AS i, `char` AS c WHERE i.key='FYMOLY_ENBALL' AND i.char_id=c.char_id ORDER BY i.value DESC LIMIT 10", $@moly01_n$, $@moly01_v); .@nb = query_sql("SELECT c.name, i.value FROM `char_reg_num_db` AS i, `char` AS c WHERE i.key='FYMOLY_ICBOSS' AND i.value > 0 AND i.char_id=c.char_id ORDER BY i.value ASC LIMIT 10", $@moly02_n$, $@moly02_v); // Oddball: less is more .@nb = query_sql("SELECT c.name, i.value FROM `char_reg_num_db` AS i, `char` AS c WHERE i.key='FYMOLY_FLUFFY' AND i.char_id=c.char_id ORDER BY i.value DESC LIMIT 10", $@moly03_n$, $@moly03_v); @@ -246,7 +131,127 @@ OnHour1759: array_push($@moly_v, .@moly_v[.@t]); .@moly_v[.@t] = 0; } while (true); - end; + return; } +///////////////////////////////////////////////////////////////////////////////// +001-14,89,89,0 script Hocus Pocus NPC_BLACKWIZARD,{ + function showScores; + function parseScores; + if ($EVENT$ != "Olympics") cwarp "Save", 0, 0; + mesn; + mesq l("Greetings, %s %s, I am Hocus Pocus the Grandmaster.", academicrank(), strcharinfo(0)); + do + { + next; + select + l("Scoreboards"), + l("Detailed Information"), + l("Thanks for your wise words."); + mes ""; + switch (@menu) { + case 1: + showScores(); + break; + case 2: + mesn; + mesq l("The Magic Olympics consist in twelve challenges with scoreboards."); + next; + mesn; + mesq l("Getting ranked #1 in a challenge yields you 10 points, getting ranked #2 yields you 9 points and so on."); + next; + mesn; + mesq l("Not participating in a challenge yields you zero points. In case of a tie, char creation date will be the decisive factor: Older adventurers will get the preference."); + next; + mesn; + mesq l("You also get points for participation, exchange them with Aurora back in Tulimshar before event ends."); + next; + mesn; + mesq l("The grand winner will get a %s. Both the first and second place will get a tuition at the Magic Academy.", getitemlink(BlackyCat)); + next; + mesn; + mesq l("The Magic Olympics happen roughly quarterly, but not always at the same dates. It begins on a monday and ends on the sunday. It usually happens two weeks after the Mining Union Research Request event."); + break; + } + } while (@menu != 3); + close; + +function t { + return gettimetick(2); +} + +function showScores { + parseScores("General Event Score", "$@moly_n$", "$@moly_v"); + mesc l("Reminder: "), 1; + mesc l("Scores are updated every 6 hours."), 1; + next; + parseScores("Energy Balls Challenge", "$@moly01_n$", "$@moly01_v"); + //parseScores("Boss Fight Challenge", "$@moly02_n$", "$@moly02_v", 0); + //parseScores("Fluffy Hunt Challenge", "$@moly03_n$", "$@moly03_v"); + parseScores("Chanting Challenge", "$@moly04_n$", "$@moly04_v"); + parseScores("Alchemy Master Challenge", "$@moly05_n$", "$@moly05_v"); + parseScores("Magic Power Challenge", "$@moly06_n$", "$@moly06_v"); + parseScores("Mana Exp Challenge", "$@moly07_n$", "$@moly07_v"); + parseScores("Obstacle Race Challenge", "$@moly08_n$", "$@moly08_v", t()); + parseScores("Hocus Commands Challenge", "$@moly09_n$", "$@moly09_v"); + parseScores("Survive! Challenge", "$@moly10_n$", "$@moly10_v", t()); + parseScores("Friendship Challenge", "$@moly11_n$", "$@moly11_v"); + parseScores("Intensive Mage Challenge", "$@moly12_n$", "$@moly12_v"); + mes ""; + mesc l("Reminder: "), 1; + mesc l("Scores close at Sunday 23:59 - No scores will be given for last minute rushes!"), 1; + return; +} + +function SCH { + .@n$ = getarg(0); + .@i = getarg(1); + return getd(sprintf("%s[%d]", .@n$, .@i)); +} + +function parseScores { + .@t$ = getarg(0); + .@n$ = getarg(1); + .@v$ = getarg(2); + .@tm = getarg(3, -1); + mes ""; + mes l("##B%s: TOP 10##b", .@t$); + if (.@tm < 0) { + mes("1."+SCH(.@n$, 0)+" ("+fnum(SCH(.@v$, 0))+")"); + mes("2."+SCH(.@n$, 1)+" ("+fnum(SCH(.@v$, 1))+")"); + mes("3."+SCH(.@n$, 2)+" ("+fnum(SCH(.@v$, 2))+")"); + mes("4."+SCH(.@n$, 3)+" ("+fnum(SCH(.@v$, 3))+")"); + mes("5."+SCH(.@n$, 4)+" ("+fnum(SCH(.@v$, 4))+")"); + mes("6."+SCH(.@n$, 5)+" ("+fnum(SCH(.@v$, 5))+")"); + mes("7."+SCH(.@n$, 6)+" ("+fnum(SCH(.@v$, 6))+")"); + mes("8."+SCH(.@n$, 7)+" ("+fnum(SCH(.@v$, 7))+")"); + mes("9."+SCH(.@n$, 8)+" ("+fnum(SCH(.@v$, 8))+")"); + mes("10."+SCH(.@n$, 9)+" ("+fnum(SCH(.@v$, 9))+")"); + } else { + mes("1."+SCH(.@n$, 0)+" ("+FuzzyTime(.@tm - SCH(.@v$, 0))+")"); + mes("2."+SCH(.@n$, 1)+" ("+FuzzyTime(.@tm - SCH(.@v$, 1))+")"); + mes("3."+SCH(.@n$, 2)+" ("+FuzzyTime(.@tm - SCH(.@v$, 2))+")"); + mes("4."+SCH(.@n$, 3)+" ("+FuzzyTime(.@tm - SCH(.@v$, 3))+")"); + mes("5."+SCH(.@n$, 4)+" ("+FuzzyTime(.@tm - SCH(.@v$, 4))+")"); + mes("6."+SCH(.@n$, 5)+" ("+FuzzyTime(.@tm - SCH(.@v$, 5))+")"); + mes("7."+SCH(.@n$, 6)+" ("+FuzzyTime(.@tm - SCH(.@v$, 6))+")"); + mes("8."+SCH(.@n$, 7)+" ("+FuzzyTime(.@tm - SCH(.@v$, 7))+")"); + mes("9."+SCH(.@n$, 8)+" ("+FuzzyTime(.@tm - SCH(.@v$, 8))+")"); + mes("10."+SCH(.@n$, 9)+" ("+FuzzyTime(.@tm - SCH(.@v$, 9))+")"); + } + dnext; + return; +} + +OnInit: + .distance=5; +// Scoreboards are refreshed every 6 hours +OnHour2359: +OnHour0559: +OnHour1159: +OnHour1759: + if ($EVENT$ != "Olympics") end; + HocusScoreNew(); + end; +} diff --git a/npc/functions/aurora.txt b/npc/functions/aurora.txt index bcd50376a..d9dcd9580 100644 --- a/npc/functions/aurora.txt +++ b/npc/functions/aurora.txt @@ -130,7 +130,6 @@ function script FYNewEvent { kamibroadcast("Kamelot Season is now open!", "Aurora Events"); break; case 8: - // FIXME: PLACEHOLDER => Magic Olympics $EVENT$="Olympics"; callfunc("FYEConf_Olympics"); kamibroadcast("Magic Olympics are now open!", "Aurora Events"); @@ -738,7 +737,17 @@ function script FYRewardEvent { if (FYEventUsesRanking()) { debugmes("Rewards are due"); // This code absolutely can't fail: - .@nb = query_sql("SELECT c.name, i.count2, c.char_id FROM `quest` AS i, `char` AS c WHERE i.quest_id="+Q_AuroraEvent+" AND i.char_id=c.char_id ORDER BY i.count2 DESC LIMIT 10", $@aurora_name$, $@aurora_value, $@aurora_charid); + if ($EVENT$ == "Olympics") { + callfunc("HocusScoreNew"); + copyarray $@aurora_name$, $@moly_n$, 10; + copyarray $@aurora_value, $@moly_v, 10; + for (.@i=0; .@i < 10; .@i++) { + if ($@aurora_name$[.@i] == "") break; + $@aurora_charid[.@i] = gf_charnameid($@aurora_name$[.@i]); + } + } else { + .@nb = query_sql("SELECT c.name, i.count2, c.char_id FROM `quest` AS i, `char` AS c WHERE i.quest_id="+Q_AuroraEvent+" AND i.char_id=c.char_id ORDER BY i.count2 DESC LIMIT 10", $@aurora_name$, $@aurora_value, $@aurora_charid); + } $MOST_HEROIC$=$@aurora_name$[0]; for (.@i=0;.@i < getarraysize($@aurora_charid);.@i++) { switch (.@i+1) { |