-
Notifications
You must be signed in to change notification settings - Fork 490
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
Open
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.
Open
Changes from all commits
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,201 @@ | ||
| // <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> | ||
| /// Shows 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.</param> | ||
| /// <param name="detailState">Detail state for the current main state.</param> | ||
| /// <param name="canEnter">True if entrance is open (Enter button enabled).</param> | ||
| /// <param name="userCount">Number of players currently inside the event map.</param> | ||
| /// <param name="remainTime"> | ||
| /// Remaining time. Semantics depend on state: | ||
| /// Standby → time until the event opens (client shows minutes). | ||
| /// Tower → time the tower has been open (client shows hours). | ||
| /// Otherwise zero. | ||
| /// </param> | ||
| ValueTask ShowStateInfoAsync(KanturuState state, byte detailState, bool canEnter, int userCount, TimeSpan remainTime); | ||
|
|
||
| /// <summary> | ||
| /// Shows 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. | ||
| /// On success the player is teleported before this is sent. | ||
| /// </summary> | ||
| /// <param name="success">True if the player was successfully entered; false otherwise.</param> | ||
| ValueTask ShowEnterResultAsync(bool success); | ||
|
|
||
| /// <summary> | ||
| /// Shows 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="KanturuState.Tower"/> and | ||
| /// <paramref name="detailState"/> is <see cref="KanturuTowerDetailState.Revitalization"/> or <see cref="KanturuTowerDetailState.Notify"/>, | ||
| /// reloads the success terrain file (<c>EncTerrain<n>01.att</c>), which visually removes the Elphis barrier. | ||
| /// </summary> | ||
| /// <param name="state">Main state.</param> | ||
| /// <param name="detailState">Detail state for the current main state.</param> | ||
| ValueTask ShowStateChangeAsync(KanturuState state, byte detailState); | ||
|
|
||
| /// <summary> | ||
| /// Shows packet 0xD1/0x04 — Kanturu battle result. | ||
| /// <list type="bullet"> | ||
| /// <item>False = failure — shows <c>Failure_kantru.tga</c> overlay.</item> | ||
| /// <item>True = success — shows <c>Success_kantru.tga</c> overlay | ||
| /// (only when client state is already <see cref="KanturuState.NightmareBattle"/>).</item> | ||
| /// </list> | ||
| /// </summary> | ||
| /// <param name="victory">True if the event was won; false if defeated.</param> | ||
| ValueTask ShowBattleResultAsync(bool victory); | ||
|
|
||
| /// <summary> | ||
| /// Shows packet 0xD1/0x05 — countdown timer for the Kanturu HUD. | ||
| /// The HUD divides by 1000 to get seconds and counts down visually. | ||
| /// </summary> | ||
| /// <param name="timeLimit">The time limit to display.</param> | ||
| ValueTask ShowTimeLimitAsync(TimeSpan timeLimit); | ||
|
|
||
| /// <summary> | ||
| /// Shows packet 0xD1/0x07 — remaining monster count and current user count. | ||
| /// Updates the numbers displayed in the Kanturu HUD. | ||
| /// </summary> | ||
| /// <param name="monsterCount">Number of monsters still alive in the current wave.</param> | ||
| /// <param name="userCount">Number of players currently inside the event map.</param> | ||
| ValueTask ShowMonsterUserCountAsync(int monsterCount, int userCount); | ||
|
|
||
| /// <summary> | ||
| /// Shows 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>Storm (true) = stone-storm effect (<c>MODEL_STORM3</c> + falling debris around Hero)</item> | ||
| /// <item>Rain (false) = 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="isStorm">True for storm visual; false for stone-rain visual.</param> | ||
| ValueTask ShowMayaWideAreaAttackAsync(bool isStorm); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Kanturu main state codes matching the client's <c>KANTURU_STATE_TYPE</c> enum. | ||
| /// </summary> | ||
| public enum KanturuState : byte | ||
| { | ||
| /// <summary>No active state.</summary> | ||
| None = 0, | ||
|
|
||
| /// <summary>Waiting for players to enter.</summary> | ||
| Standby = 1, | ||
|
|
||
| /// <summary>Maya battle phase (Phases 1–3 + boss waves).</summary> | ||
| MayaBattle = 2, | ||
|
|
||
| /// <summary>Nightmare battle phase.</summary> | ||
| NightmareBattle = 3, | ||
|
|
||
| /// <summary>Tower of Refinement open (post-victory).</summary> | ||
| Tower = 4, | ||
|
|
||
| /// <summary>Event ended.</summary> | ||
| End = 5, | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Detail state codes for the Nightmare battle phase, | ||
| /// matching <c>KANTURU_NIGHTMARE_DIRECTION_TYPE</c>. | ||
| /// </summary> | ||
| public enum KanturuNightmareDetailState : byte | ||
| { | ||
| /// <summary>No direction set.</summary> | ||
| None = 0, | ||
|
|
||
| /// <summary>Idle — Nightmare present but not yet in battle.</summary> | ||
| Idle = 1, | ||
|
|
||
| /// <summary>Nightmare intro animation.</summary> | ||
| NightmareIntro = 2, | ||
|
|
||
| /// <summary>Active battle — shows the HUD on the client.</summary> | ||
| Battle = 3, | ||
|
|
||
| /// <summary>Battle ended.</summary> | ||
| End = 4, | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Detail state codes for the Tower of Refinement phase, | ||
| /// matching <c>KANTURU_TOWER_STATE_TYPE</c>. | ||
| /// </summary> | ||
| public enum KanturuTowerDetailState : byte | ||
| { | ||
| /// <summary>No tower state.</summary> | ||
| 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> | ||
| Revitalization = 1, | ||
|
|
||
| /// <summary>Tower closing soon — client warns players.</summary> | ||
| Notify = 2, | ||
|
|
||
| /// <summary>Tower closed.</summary> | ||
| Close = 3, | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Detail state codes for the Maya battle phase, | ||
| /// matching <c>KANTURU_MAYA_DIRECTION_TYPE</c>. | ||
| /// </summary> | ||
| public enum KanturuMayaDetailState : byte | ||
| { | ||
| /// <summary>No direction.</summary> | ||
| None = 0, | ||
|
|
||
| /// <summary>Notify cinematic — camera pan + Maya rise animation (KANTURU_MAYA_DIRECTION_NOTIFY).</summary> | ||
| Notify = 2, | ||
|
|
||
| /// <summary>Phase 1 monster wave active — shows HUD.</summary> | ||
| Monster1 = 3, | ||
|
|
||
| /// <summary>Phase 1 boss (Maya Left Hand) — shows HUD.</summary> | ||
| Maya1 = 4, | ||
|
|
||
| /// <summary>Phase 2 monster wave active — shows HUD.</summary> | ||
| Monster2 = 8, | ||
|
|
||
| /// <summary>Phase 2 boss (Maya Right Hand) — shows HUD.</summary> | ||
| Maya2 = 9, | ||
|
|
||
| /// <summary>Phase 3 monster wave active — shows HUD.</summary> | ||
| Monster3 = 13, | ||
|
|
||
| /// <summary>Phase 3 bosses (both hands) — shows HUD.</summary> | ||
| 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> | ||
| EndCycleMaya3 = 16, | ||
| } |
Oops, something went wrong.
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.