-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
115 changed files
with
4,124 additions
and
2,617 deletions.
There are no files selected for viewing
This file contains 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 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
UncreatedWarfare/Commands/WarfareDev/DebugQuickWinCommand.cs
This file contains 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,46 @@ | ||
using DanielWillett.ReflectionTools; | ||
using Uncreated.Warfare.Interaction.Commands; | ||
using Uncreated.Warfare.Layouts; | ||
using Uncreated.Warfare.Layouts.Teams; | ||
using Uncreated.Warfare.Players; | ||
|
||
namespace Uncreated.Warfare.Commands; | ||
|
||
[Command("quickwin", "nextphase"), SubCommandOf(typeof(WarfareDevCommand))] | ||
internal class DebugQuickWinCommand : IExecutableCommand | ||
{ | ||
private readonly Layout _layout; | ||
public CommandContext Context { get; set; } | ||
|
||
public DebugQuickWinCommand(Layout layout) | ||
{ | ||
_layout = layout; | ||
} | ||
|
||
public async UniTask ExecuteAsync(CancellationToken token) | ||
{ | ||
Team? winner = (Context.Caller as WarfarePlayer)?.Team; | ||
if (winner == null || !winner.IsValid || Context.HasArgs(1)) | ||
{ | ||
if (Context.TryGetRange(0, out string? teamLookup)) | ||
{ | ||
winner = _layout.TeamManager.FindTeam(teamLookup); | ||
} | ||
|
||
if (winner == null || !winner.IsValid) | ||
throw Context.ReplyString("Winning team not found."); | ||
} | ||
|
||
_layout.Data[KnownLayoutDataKeys.WinnerTeam] = winner; | ||
|
||
if (_layout.IsActive) | ||
{ | ||
await _layout.MoveToNextPhase(token); | ||
Context.ReplyString($"Moved to next phase: {(_layout.ActivePhase?.GetType() is { } t ? Accessor.ExceptionFormatter.Format(t) : "null")}"); | ||
} | ||
else | ||
{ | ||
Context.ReplyString("Not active."); | ||
} | ||
} | ||
} |
This file contains 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.