-
Notifications
You must be signed in to change notification settings - Fork 119
Companion Mode + New MenuFlow #716
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
artosimonyan
wants to merge
18
commits into
hectorgimenez:main
Choose a base branch
from
artosimonyan:Companion-Mode-Returns
base: main
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 all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f96d9c3
Companion Mode + New Flow
artosimonyan 9ef0ff8
Commit for a comment removal, yes.
artosimonyan fc0349f
Add button to trigger manual join events
artosimonyan b14e427
Add a hacky fix for bugged char select detection
artosimonyan 1cc5076
Switch position of UI element for game join
artosimonyan 4de4a60
Update d2go
artosimonyan 48d0a6b
Merge branch 'main' into Companion-Mode-Returns
artosimonyan a08d5d9
Merge branch 'main' into Companion-Mode-Returns
artosimonyan 5cf68e5
Flow update
artosimonyan 6a99892
Merge branch 'hectorgimenez:main' into Companion-Mode-Returns
artosimonyan cfe1f87
Try #2 of flow revamp
artosimonyan 2169cab
whoops
artosimonyan b3bd984
Added handling for lobby -> char select
artosimonyan 52cafe3
small change
artosimonyan 9fc7745
Bring back game created name pass idk ...
artosimonyan c2eee5c
Merge branch 'main' into Companion-Mode-Returns
artosimonyan 4aea0c8
blah
artosimonyan 7c531d2
Merge branch 'main' into Companion-Mode-Returns
artosimonyan 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package bot | ||
|
||
import ( | ||
"context" | ||
"log/slog" | ||
|
||
"github.com/hectorgimenez/koolo/internal/config" | ||
"github.com/hectorgimenez/koolo/internal/event" | ||
) | ||
|
||
// CompanionEventHandler handles events related to companion functionality | ||
type CompanionEventHandler struct { | ||
supervisor string | ||
log *slog.Logger | ||
cfg *config.CharacterCfg | ||
} | ||
|
||
// NewCompanionEventHandler creates a new instance of CompanionEventHandler | ||
func NewCompanionEventHandler(supervisor string, log *slog.Logger, cfg *config.CharacterCfg) *CompanionEventHandler { | ||
return &CompanionEventHandler{ | ||
supervisor: supervisor, | ||
log: log, | ||
cfg: cfg, | ||
} | ||
} | ||
|
||
// Handle processes companion-related events | ||
func (h *CompanionEventHandler) Handle(ctx context.Context, e event.Event) error { | ||
|
||
switch evt := e.(type) { | ||
|
||
case event.RequestCompanionJoinGameEvent: | ||
|
||
if h.cfg.Companion.Enabled && !h.cfg.Companion.Leader { | ||
|
||
// Check if the leader matches the one in our config or no leader set | ||
if h.cfg.Companion.LeaderName == "" || evt.Leader == h.cfg.Companion.LeaderName { | ||
h.log.Info("Companion join game event received", slog.String("supervisor", h.supervisor), slog.String("leader", evt.Leader), slog.String("name", evt.Name), slog.String("password", evt.Password)) | ||
h.cfg.Companion.CompanionGameName = evt.Name | ||
h.cfg.Companion.CompanionGamePassword = evt.Password | ||
} | ||
} | ||
|
||
case event.ResetCompanionGameInfoEvent: | ||
|
||
// If this character is a companion (not a leader), clear game info | ||
if h.cfg.Companion.Enabled && !h.cfg.Companion.Leader { | ||
|
||
// Check if the leader matches the one in our config or no leader set. | ||
// Additional check for if LeaderName is the same as the character name for Manual join triggers | ||
if h.cfg.Companion.LeaderName == "" || evt.Leader == h.cfg.Companion.LeaderName || h.cfg.CharacterName == evt.Leader { | ||
h.log.Info("Companion reset game info event received", slog.String("supervisor", h.supervisor), slog.String("leader", evt.Leader)) | ||
h.cfg.Companion.CompanionGameName = "" | ||
h.cfg.Companion.CompanionGamePassword = "" | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
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
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.
Uh 10000 oh!
There was an error while loading. Please reload this page.