-
Notifications
You must be signed in to change notification settings - Fork 590
feat: Add Kanturu Refinery Tower event implementation #719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
apraxico
wants to merge
11
commits into
MUnique:master
Choose a base branch
from
apraxico:feature/kanturu-event
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dcac53d
feat: Add Kanturu Refinery Tower event implementation
apraxico a933e83
fix: Add exception handling to fire-and-forget tasks in KanturuContext
apraxico 6d0aa62
refactor: Apply Sven's code review changes to Kanturu event
apraxico 13eb948
refactor(kanturu): convert state codes to enums, rename Send* to Show…
apraxico 510fb91
refactor(kanturu): replace manual byte construction with generated Se…
apraxico 8821685
fix(kanturu): volatile→Interlocked/Volatile.Read, async void OnMonste…
apraxico 086f799
refactor(kanturu): update KanturuGatewayPlugIn to use new Show* API w…
apraxico d17db84
feat(kanturu): add KanturuConnectionExtensions with 7 SendKanturu*Asy…
apraxico c07bffa
feat(kanturu): add Kanturu packet Send*Async extension methods to Con…
apraxico ec8267d
chore(kanturu): remove KanturuConnectionExtensions.cs workaround
apraxico d91c703
fix(kanturu): resolve merge conflict in ConnectionExtensions.cs with …
apraxico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| // <copyright file="IKanturuEventViewPlugIn.cs" company="MUnique"> | ||
| // Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
| // </copyright> | ||
|
|
||
| namespace MUnique.OpenMU.GameLogic.MiniGames; | ||
|
|
||
| using MUnique.OpenMU.GameLogic.Views; | ||
|
|
||
| /// <summary> | ||
| /// View plugin interface for Kanturu-specific server-to-client packets (0xD1 group). | ||
| /// Each method maps to one packet subcode. | ||
| /// </summary> | ||
| public interface IKanturuEventViewPlugIn : IViewPlugIn | ||
| { | ||
| /// <summary> | ||
| /// Sends packet 0xD1/0x00 — Kanturu state info (response to NPC talk / info request). | ||
| /// This opens the <c>INTERFACE_KANTURU2ND_ENTERNPC</c> dialog on the client, showing | ||
| /// the current event state, how many players are inside, and whether entry is possible. | ||
| /// </summary> | ||
| /// <param name="state">Main event state (see <see cref="KanturuStateCode"/>).</param> | ||
| /// <param name="detailState">Detail state for the current main state.</param> | ||
| /// <param name="enter">1 = entrance is open (Enter button enabled); 0 = entrance closed.</param> | ||
| /// <param name="userCount">Number of players currently inside the event map.</param> | ||
| /// <param name="remainTimeSec"> | ||
| /// Seconds remaining. Semantics depend on state: | ||
| /// Standby → seconds until the event opens (client shows minutes). | ||
| /// Tower → seconds the tower has been open (client shows hours). | ||
| /// Otherwise 0. | ||
| /// </param> | ||
| ValueTask SendStateInfoAsync(byte state, byte detailState, byte enter, byte userCount, int remainTimeSec); | ||
|
|
||
| /// <summary> | ||
| /// Sends packet 0xD1/0x01 — Kanturu enter result. | ||
| /// Sent after the player's entry attempt is processed. | ||
| /// On the client side this stops the NPC animation and closes the dialog. | ||
| /// Result codes: 0 = failed (generic), use specific POPUP_* values for other errors. | ||
| /// On success the player is teleported before this is sent, so the packet is only | ||
| /// needed for failure cases. | ||
| /// </summary> | ||
| ValueTask SendEnterResultAsync(byte result); | ||
|
|
||
| /// <summary> | ||
| /// Sends packet 0xD1/0x03 — Kanturu state change. | ||
| /// On the client side this: | ||
| /// - Shows/hides the in-map HUD (<c>INTERFACE_KANTURU_INFO</c>). | ||
| /// - Switches background music (Maya, Nightmare, Tower themes). | ||
| /// - When <paramref name="state"/> == <see cref="KanturuStateCode.Tower"/> and | ||
| /// <paramref name="detailState"/> is 1 or 2, reloads the success terrain file | ||
| /// (<c>EncTerrain<n>01.att</c>), which visually removes the Elphis barrier. | ||
| /// </summary> | ||
| /// <param name="state">Main state (see <see cref="KanturuStateCode"/>).</param> | ||
| /// <param name="detailState">Detail state for the current main state.</param> | ||
| ValueTask SendStateChangeAsync(byte state, byte detailState); | ||
|
|
||
| /// <summary> | ||
| /// Sends packet 0xD1/0x04 — Kanturu battle result. | ||
| /// <list type="bullet"> | ||
| /// <item>0 = failure — shows <c>Failure_kantru.tga</c> overlay.</item> | ||
| /// <item>1 = success — shows <c>Success_kantru.tga</c> overlay | ||
| /// (only when client state is already <see cref="KanturuStateCode.NightmareBattle"/>).</item> | ||
| /// </list> | ||
| /// </summary> | ||
| ValueTask SendBattleResultAsync(byte result); | ||
|
|
||
| /// <summary> | ||
| /// Sends packet 0xD1/0x05 — countdown timer for the Kanturu HUD (in milliseconds). | ||
| /// The HUD divides by 1000 to get seconds and counts down visually. | ||
| /// </summary> | ||
| ValueTask SendTimeLimitAsync(int timeLimitMs); | ||
|
|
||
| /// <summary> | ||
| /// Sends packet 0xD1/0x07 — remaining monster count and current user count. | ||
| /// Updates the numbers displayed in the Kanturu HUD. | ||
| /// </summary> | ||
| ValueTask SendMonsterUserCountAsync(byte monsterCount, byte userCount); | ||
|
|
||
| /// <summary> | ||
| /// Sends packet 0xD1/0x06 — Maya wide-area attack visual trigger. | ||
| /// The client calls <c>MayaSceneMayaAction(attackType)</c> on receipt, which plays | ||
| /// one of two client-side visual sequences on the Maya body object: | ||
| /// <list type="bullet"> | ||
| /// <item>0 = stone-storm effect (<c>MODEL_STORM3</c> + falling debris around Hero)</item> | ||
| /// <item>1 = stone-rain effect (<c>MODEL_MAYASTONE</c> projectiles falling on Hero)</item> | ||
| /// </list> | ||
| /// This is a purely cosmetic broadcast — damage is handled by the server-side | ||
| /// <see cref="MonsterDefinition.AttackSkill"/> on Maya Hands (#362/#363). | ||
| /// </summary> | ||
| /// <param name="attackType">0 = storm visual; 1 = stone-rain visual.</param> | ||
| ValueTask SendMayaWideAreaAttackAsync(byte attackType); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Kanturu main state codes matching the client's <c>KANTURU_STATE_TYPE</c> enum. | ||
| /// </summary> | ||
| public static class KanturuStateCode | ||
| { | ||
| /// <summary>No active state.</summary> | ||
| public const byte None = 0; | ||
|
|
||
| /// <summary>Waiting for players to enter.</summary> | ||
| public const byte Standby = 1; | ||
|
|
||
| /// <summary>Maya battle phase (Phases 1–3 + boss waves).</summary> | ||
| public const byte MayaBattle = 2; | ||
|
|
||
| /// <summary>Nightmare battle phase.</summary> | ||
| public const byte NightmareBattle = 3; | ||
|
|
||
| /// <summary>Tower of Refinement open (post-victory).</summary> | ||
| public const byte Tower = 4; | ||
|
|
||
| /// <summary>Event ended.</summary> | ||
| public const byte End = 5; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Detail state codes for the Nightmare battle phase, | ||
| /// matching <c>KANTURU_NIGHTMARE_DIRECTION_TYPE</c>. | ||
| /// </summary> | ||
| public static class KanturuNightmareDetail | ||
| { | ||
| /// <summary>No direction set.</summary> | ||
| public const byte None = 0; | ||
|
|
||
| /// <summary>Idle — Nightmare present but not yet in battle.</summary> | ||
| public const byte Idle = 1; | ||
|
|
||
| /// <summary>Nightmare intro animation.</summary> | ||
| public const byte NightmareIntro = 2; | ||
|
|
||
| /// <summary>Active battle — shows the HUD on the client.</summary> | ||
| public const byte Battle = 3; | ||
|
|
||
| /// <summary>Battle ended.</summary> | ||
| public const byte End = 4; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Detail state codes for the Tower of Refinement phase, | ||
| /// matching <c>KANTURU_TOWER_STATE_TYPE</c>. | ||
| /// </summary> | ||
| public static class KanturuTowerDetail | ||
| { | ||
| /// <summary>No tower state.</summary> | ||
| public const byte None = 0; | ||
|
|
||
| /// <summary> | ||
| /// Tower is open after Nightmare's defeat. | ||
| /// Sending this triggers the client to reload <c>EncTerrain<n>01.att</c> | ||
| /// (the success terrain), which visually removes the Elphis barrier. | ||
| /// </summary> | ||
| public const byte Revitalization = 1; | ||
|
|
||
| /// <summary>Tower closing soon — client warns players.</summary> | ||
| public const byte Notify = 2; | ||
|
|
||
| /// <summary>Tower closed.</summary> | ||
| public const byte Close = 3; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Detail state codes for the Maya battle phase, | ||
| /// matching <c>KANTURU_MAYA_DIRECTION_TYPE</c>. | ||
| /// </summary> | ||
| public static class KanturuMayaDetail | ||
| { | ||
| /// <summary>No direction.</summary> | ||
| public const byte None = 0; | ||
|
|
||
| /// <summary>Phase 1 monster wave active — shows HUD.</summary> | ||
| public const byte Monster1 = 3; | ||
|
|
||
| /// <summary>Phase 1 boss (Maya Left Hand) — shows HUD.</summary> | ||
| public const byte Maya1 = 4; | ||
|
|
||
| /// <summary>Phase 2 monster wave active — shows HUD.</summary> | ||
| public const byte Monster2 = 8; | ||
|
|
||
| /// <summary>Phase 2 boss (Maya Right Hand) — shows HUD.</summary> | ||
| public const byte Maya2 = 9; | ||
|
|
||
| /// <summary>Phase 3 monster wave active — shows HUD.</summary> | ||
| public const byte Monster3 = 13; | ||
|
|
||
| /// <summary>Phase 3 bosses (both hands) — shows HUD.</summary> | ||
| public const byte Maya3 = 14; | ||
|
|
||
| /// <summary> | ||
| /// Maya phase 3 end cycle — triggers the full Maya explosion + player fall cinematic | ||
| /// (<c>KANTURU_MAYA_DIRECTION_ENDCYCLE_MAYA3 = 16</c> on the client). | ||
| /// Sending this via 0xD1/0x03 activates <c>Move2ndDirection()</c>: | ||
| /// camera pans to Maya room → <c>m_bMayaDie = true</c> (explosion) → <c>m_bDownHero = true</c> (fall). | ||
| /// </summary> | ||
| public const byte EndCycleMaya3 = 16; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remainTimeSecto beTimeSpan. The conversion to seconds can be done in the view plugin implementation.Send...toShow.... The game logic should not be aware that it's actually sending something over the network.