diff options
author | Fedja Beader <fedja@protonmail.ch> | 2024-08-18 13:29:07 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2024-08-18 11:40:50 +0000 |
commit | 325bdd9f42c6afd529c92a3e5486fd70334e036f (patch) | |
tree | 52b9f8e04ab90831297dadd5169c320369985fe6 | |
parent | 4871f91c277df6bd1149285bb8dc1b8333248fcf (diff) | |
download | serverdata-325bdd9f42c6afd529c92a3e5486fd70334e036f.tar.gz serverdata-325bdd9f42c6afd529c92a3e5486fd70334e036f.tar.bz2 serverdata-325bdd9f42c6afd529c92a3e5486fd70334e036f.tar.xz serverdata-325bdd9f42c6afd529c92a3e5486fd70334e036f.zip |
Implement event teleport selection when multiple events are running
-rw-r--r-- | npc/commands/event.txt | 183 |
1 files changed, 121 insertions, 62 deletions
diff --git a/npc/commands/event.txt b/npc/commands/event.txt index b29f7e285..cfd36c302 100644 --- a/npc/commands/event.txt +++ b/npc/commands/event.txt @@ -457,34 +457,119 @@ OnEffect: atcommand "@refresh"; end; } else { + setarray .@choices$, l("Cancel"), "-1"; + + // Not sure which IDs to use here, so I just encode map ID. + // First digit is 1 to avoid octal interpretation + // First part is encoded with 3 digits, + // Second+ part of id gets encoded with 2 digits. + // Note: maybe better to add some more stuff to TP_* constants + // and reuse those? + // Best would be to pass warp X & Y coordinates as well, to avoid + // more conditionals down below and potential desyncs in them. + // One idea is to printf and use scanf to extra the stuff + // but then tower would need special handling as well. + // Note: cannot use menuint & rif as I want for the char to go + // without menu if there is only one option. + // Use of labels would also help, but nobody likes label spaghetti? + if ($@MK_SCENE == MK_SIEGE_TULIM || BaseLevel > 20) { - // Monster King events take precedence over Aeros Event switch ($@MK_SCENE) { case MK_SIEGE_TULIM: - warp "003-1", 40, 49; - specialeffect(63, AREA, getcharid(3)); - end; + array_push(.@choices$, l("Assist %s", "Tulimshar")); + array_push(.@choices$, "100301"); + break; case MK_SIEGE_HALIN: - warp "009-1", 27, 30; - specialeffect(63, AREA, getcharid(3)); - end; + array_push(.@choices$, l("Assist %s", "Halinarzo")); + array_push(.@choices$, "100901"); + break; case MK_SIEGE_HURNS: - warp "012-1", 87, 70; - specialeffect(63, AREA, getcharid(3)); - end; + array_push(.@choices$, l("Assist %s", "Hurnscald")); + array_push(.@choices$, "101201")); + break; case MK_SIEGE_NIVAL: - warp "020-1", 57, 62; - specialeffect(63, AREA, getcharid(3)); - end; + array_push(.@choices$, l("Assist %s", "Nivalis")); + array_push(.@choices$, "102001")); + break; } } - // Aeros Events takes precedence over player events - if ($@GM_EVENT) - { + if ($@GM_EVENT) { + array_push(.@choices$, l("Participate in Aeros event")); + array_push(.@choices$, "100101")); + } + + if ($@FEFE_DELAY > gettimetick(2) && !$@FEFE_CAVE_LEVEL && $@FEFE_CAVE_HERO$ != "" && !$@FEFE_WAVE) { + array_push(.@choices$, l("Assist %s in Candor Battle Cave", $@FEFE_CAVE_HERO$)); + array_push(.@choices$, "100106")); + } + + if ($EVENT$ == "Valentine") { + array_push(.@choices$, l("Go to Valentine Highlands")); + array_push(.@choices$, "100111")); + } + + if ($EVENT$ == "Easter") { + array_push(.@choices$, l("Go to Easter event")); + array_push(.@choices$, "100104")); + } + if ($EVENT$ == "Worker") { + array_push(.@choices$, l("Go to Contributor's Cave")); + array_push(.@choices$, "100105")); + } + if ($EVENT$ == "Christmas" && BaseLevel >= 20) { + array_push(.@choices$, l("Go to the Christmas Workshop")); + array_push(.@choices$, "10190401")); + } + if ($EVENT$ == "Tower" && countitem(EventDreamTicket)) { + array_push(.@choices$, l("Ascend a dream tower")); + array_push(.@choices$, "999999")); // What map ID? + } + if ($EVENT$ == "Olympics") { + array_push(.@choices$, l("Go to Porthos")); + array_push(.@choices$, "100114")); + } + if ($EVENT$ == "Raid") { + array_push(.@choices$, l("Challenge the raiding boss!")); + array_push(.@choices$, "100113")); + } + + if (getarraysize(.@choices$) == 2) { + @menuret = -1; + } else { + menuint2(.@choices$); + deletearray(.@choices$); + } + + switch(@menuret) { + default: + // Seems like it was a Blame Saulc-like event... + dispbottom l("Have a nice %s day!", $EVENT$); + // [[fall-through]] + case -1: + atcommand "@refresh"; + dispbottom l("The mana bridge is closed at the moment."); + break; + case 100301: // tulim + warp "003-1", 40, 49; + specialeffect(63, AREA, getcharid(3)); + break; + case 100901: // halin + warp "009-1", 27, 30; + specialeffect(63, AREA, getcharid(3)); + break; + case 101201: // hurns + warp "012-1", 87, 70; + specialeffect(63, AREA, getcharid(3)); + break; + case 102001: // nivalis + warp "020-1", 57, 62; + specialeffect(63, AREA, getcharid(3)); + break; + case 100101: .@gt=$@AEROS_SPWN; if (.@gt == 2) - .@gt=rand(0,1); + .@gt = rand(0,1); switch (.@gt) { case 0: warp "001-1", 235, 26; break; @@ -492,68 +577,42 @@ OnEffect: warp "001-1", 23, 108; break; } specialeffect(63, AREA, getcharid(3)); - end; - } - - // Player events takes precedence over permanent events - // They also have an hierarchy - // 1. Candor Battle - if ($@FEFE_DELAY > gettimetick(2) && !$@FEFE_CAVE_LEVEL && $@FEFE_CAVE_HERO$ != "" && !$@FEFE_WAVE) { + break; + case 100601: warp "006-1", 49, 53; message strcharinfo(0), l("You are now at Candor Battle Cave at @@'s request.", $@FEFE_CAVE_HERO$); - end; - } - - // Events are the least priority - if ($EVENT$ == "Valentine") { + break; + case 100111: warp "001-11", 38, 32; message strcharinfo(0), l("You are now at the Valentine Highlands."); - end; - } - if ($EVENT$ == "Easter") { + break; + case 100104: warp "001-4", 151, 157; message strcharinfo(0), l("You are now at the Magical Forest."); - end; - } - if ($EVENT$ == "Worker") { + break; + case 100105: warp "001-5", 22, 79; message strcharinfo(0), l("You are now at the Contributor's Cave."); - end; - } - if ($EVENT$ == "Christmas" && BaseLevel >= 20) { + break; + case 10190401: warp "019-4-1", 32, 36; message strcharinfo(0), l("You are now at the Christmas Workshop."); - end; - } - if ($EVENT$ == "Tower" && countitem(EventDreamTicket)) { + break; + case 999999: doevent "sDreamTower::OnWarpTo"; - end; - } - if ($EVENT$ == "Olympics") { - if (callfunc("FYE_Olympics_TO")) { + break; + case 100114": + if (callfunc("FYE_Olympics_TO")) dispbottom l("You are now at Porthos - The Town of Portals."); - end; - } // Failed for some reason - ignore - } - if ($EVENT$ == "Raid") { - getmapxy(@aurora_map$, @aurora_x, @aurora_y, 0); + break; + case 100113: + getmapxy(@aurora_map$, @aurora_x, @aurora_y, 0); // TODO: why this line? callfunc("FYRaid_Select"); - close; + break; } } - // Block here - if (!$@GM_EVENT && !$@MK_SCENE && $EVENT$ == "") { - atcommand "@refresh"; - dispbottom l("The mana bridge is closed at the moment."); - end; - } - - // Seems like it was a Blame Saulc-like event... - dispbottom l("Have a nice @@ day!", $EVENT$); - dispbottom l("The mana bridge is closed at the moment."); - atcommand "@refresh"; end; OnInit: |