Skip to content
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

Game listings fetched by IRC List #570

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
aaa74bf
Add initial pass for fetching game listings with list & topic
GrantBartlett Oct 9, 2024
031ae8d
Consistency on naming
GrantBartlett Oct 9, 2024
8780cf6
Tidy up of checkbox checks
GrantBartlett Oct 9, 2024
f39bcef
Upon MOTD received, request channel list
GrantBartlett Oct 9, 2024
4dc36b0
Add game list pattern to game collections
GrantBartlett Oct 9, 2024
2617a2d
Doesn't seem needed
GrantBartlett Oct 9, 2024
c558641
Add way to find gamecollection by hosted channelname, e.g. #cncnet-yr…
GrantBartlett Oct 9, 2024
9c2e6f4
PR feedback fixes
GrantBartlett Oct 9, 2024
a6e79aa
lblSupers to lblSuperWeapons
GrantBartlett Oct 9, 2024
82ad89c
When the host closes a game, ensure we keep the ctcp capture to close…
GrantBartlett Oct 9, 2024
4e06747
Remove duplicate
GrantBartlett Oct 9, 2024
13e884e
Update tuple deconstructing
GrantBartlett Oct 10, 2024
3e6ce20
Remove special hacks, LIST updates and topic setting
GrantBartlett Oct 11, 2024
4ac8f24
Tidy
GrantBartlett Oct 11, 2024
15b0cb4
Further tidy
GrantBartlett Oct 11, 2024
b319952
Add example topic
GrantBartlett Oct 11, 2024
95cecfa
Operators at start of lines
GrantBartlett Oct 13, 2024
1011c7d
Have a clear GAME and DETAIL section in the broadcast topic
GrantBartlett Oct 13, 2024
ef5c6ea
Hybrid ctcp/topic
GrantBartlett Oct 13, 2024
d103b50
Special topic irc message type
GrantBartlett Oct 13, 2024
90c8c84
wip
GrantBartlett Oct 13, 2024
da7888e
wip
GrantBartlett Oct 14, 2024
aed6566
hybrid ctcp/topic handling
GrantBartlett Oct 15, 2024
8ce1a68
Make sure we show the players in the room upon joining and not wait u…
GrantBartlett Oct 15, 2024
3981ea1
Remove mapname from broadcasting topic
GrantBartlett Oct 15, 2024
0e9acfa
Wip updates to ui processing
GrantBartlett Oct 15, 2024
c08e22a
Hosted game changes & user list updates
GrantBartlett Oct 17, 2024
3cc60cc
Puts back other bits
GrantBartlett Oct 17, 2024
2aaa180
Fix pipeline error
GrantBartlett Oct 17, 2024
a8913b2
Few ui fixes
GrantBartlett Oct 17, 2024
0627385
Fixes to ui updating
GrantBartlett Oct 18, 2024
e73fb15
Update channel topic when player extra options updated
GrantBartlett Oct 18, 2024
e21bb2f
Remove our name if its in already in the topic
GrantBartlett Oct 18, 2024
b2e2882
No idea where this came from
GrantBartlett Oct 18, 2024
a5b2369
Pipeline build error fix
GrantBartlett Oct 18, 2024
4eaa3a2
Tidy up of logs
GrantBartlett Oct 18, 2024
61d915c
Tidy up
GrantBartlett Oct 18, 2024
fe09dad
Fix on topic change broadcasting player options
GrantBartlett Oct 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ClientCore/CnCNet5/CnCNetGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ public class CnCNetGame
/// </summary>
public string GameBroadcastChannel { get; set; }


/// <summary>
/// The IRC game pattern of a hosted game channels
/// </summary>
public string GameListPattern { get; set; }


/// <summary>
/// The executable name of the game's client.
/// </summary>
public string ClientExecutableName { get; set; }

public Texture2D Texture { get; set; }

public Texture2D TextureSpecialGameMode { get; set; }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, the solution is hacky, which in this case also goes against the design (this is a distribution/game/mod icon, it can't change depending on a game mode). We would need to come up with a proper way to achieve what you want.

An option I see is:
0. Use both RA2/YR icon as Texture for CnCNet YR,

  1. Make an option in ClientDefintions to hide the main game icon in game list,
  2. Make an option to add enabled/disabled icons to the game settings, something like EnabledIcon and DisabledIcon for INI defined game options, and Icon for dropdown items,
  3. When some option is broadcasted to the outside world - prepend an icon to the game name, same for all of the options.

This way you could define ra2mode as broadcasted to cncnet lobby in INI, define enabled / disabled texture for it and it would change the "icon" of the game.

/// <summary>
/// The location where to read the game's installation path from the registry.
/// </summary>
Expand Down
25 changes: 24 additions & 1 deletion ClientCore/CnCNet5/GameCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void Initialize()
using Stream tsIconStream = assembly.GetManifestResourceStream("ClientCore.Resources.tsicon.png");
using Stream moIconStream = assembly.GetManifestResourceStream("ClientCore.Resources.moicon.png");
using Stream yrIconStream = assembly.GetManifestResourceStream("ClientCore.Resources.yricon.png");
using Stream ra2IconStream = assembly.GetManifestResourceStream("ClientCore.Resources.ra2icon.png");
using Stream rrIconStream = assembly.GetManifestResourceStream("ClientCore.Resources.rricon.png");
using Stream reIconStream = assembly.GetManifestResourceStream("ClientCore.Resources.reicon.png");
using Stream cncrIconStream = assembly.GetManifestResourceStream("ClientCore.Resources.cncricon.png");
Expand All @@ -44,6 +45,7 @@ public void Initialize()
using var tiIcon = Image.Load(tiIconStream);
using var tsIcon = Image.Load(tsIconStream);
using var moIcon = Image.Load(moIconStream);
using var ra2Icon = Image.Load(ra2IconStream);
using var yrIcon = Image.Load(yrIconStream);
using var rrIcon = Image.Load(rrIconStream);
using var reIcon = Image.Load(reIconStream);
Expand All @@ -63,6 +65,7 @@ public void Initialize()
ChatChannel = "#cncnet-dta",
ClientExecutableName = "DTA.exe",
GameBroadcastChannel = "#cncnet-dta-games",
GameListPattern = "#cncnet-dta-game*",
InternalName = "dta",
RegistryInstallPath = "HKCU\\Software\\TheDawnOfTheTiberiumAge",
UIName = "Dawn of the Tiberium Age",
Expand All @@ -74,6 +77,7 @@ public void Initialize()
ChatChannel = "#cncnet-ti",
ClientExecutableName = "TI_Launcher.exe",
GameBroadcastChannel = "#cncnet-ti-games",
GameListPattern = "#cncnet-ti-game*",
InternalName = "ti",
RegistryInstallPath = "HKCU\\Software\\TwistedInsurrection",
UIName = "Twisted Insurrection",
Expand All @@ -85,6 +89,7 @@ public void Initialize()
ChatChannel = "#cncnet-mo",
ClientExecutableName = "MentalOmegaClient.exe",
GameBroadcastChannel = "#cncnet-mo-games",
GameListPattern = "#cncnet-mo-game*",
InternalName = "mo",
RegistryInstallPath = "HKCU\\Software\\MentalOmega",
UIName = "Mental Omega",
Expand All @@ -96,6 +101,7 @@ public void Initialize()
ChatChannel = "#redres-lobby",
ClientExecutableName = "RRLauncher.exe",
GameBroadcastChannel = "#redres-games",
GameListPattern = "#cncnet-rr-game*",
InternalName = "rr",
RegistryInstallPath = "HKLM\\Software\\RedResurrection",
UIName = "YR Red-Resurrection",
Expand All @@ -107,6 +113,7 @@ public void Initialize()
ChatChannel = "#riseoftheeast",
ClientExecutableName = "RELauncher.exe",
GameBroadcastChannel = "#rote-games",
GameListPattern = "#cncnet-re-game*",
InternalName = "re",
RegistryInstallPath = "HKLM\\Software\\RiseoftheEast",
UIName = "Rise of the East",
Expand All @@ -118,6 +125,7 @@ public void Initialize()
ChatChannel = "#cncreloaded",
ClientExecutableName = "CnCReloadedClient.exe",
GameBroadcastChannel = "#cncreloaded-games",
GameListPattern = "#cncnet-cncr-game*",
InternalName = "cncr",
RegistryInstallPath = "HKCU\\Software\\CnCReloaded",
UIName = "C&C: Reloaded",
Expand All @@ -129,6 +137,7 @@ public void Initialize()
ChatChannel = "#cncnet-td",
ClientExecutableName = "TiberianDawn.exe",
GameBroadcastChannel = "#cncnet-td-games",
GameListPattern = "#cncnet-td-game*",
InternalName = "td",
RegistryInstallPath = "HKLM\\Software\\Westwood\\Tiberian Dawn",
UIName = "Tiberian Dawn",
Expand All @@ -141,6 +150,7 @@ public void Initialize()
ChatChannel = "#cncnet-ra",
ClientExecutableName = "RedAlert.exe",
GameBroadcastChannel = "#cncnet-ra-games",
GameListPattern = "#cncnet-ra-game*",
InternalName = "ra",
RegistryInstallPath = "HKLM\\Software\\Westwood\\Red Alert",
UIName = "Red Alert",
Expand All @@ -153,6 +163,7 @@ public void Initialize()
ChatChannel = "#cncnet-d2k",
ClientExecutableName = "Dune2000.exe",
GameBroadcastChannel = "#cncnet-d2k-games",
GameListPattern = "#cncnet-d2k-game*",
InternalName = "d2k",
RegistryInstallPath = "HKLM\\Software\\Westwood\\Dune 2000",
UIName = "Dune 2000",
Expand All @@ -165,6 +176,7 @@ public void Initialize()
ChatChannel = "#cncnet-ts",
ClientExecutableName = "TiberianSun.exe",
GameBroadcastChannel = "#cncnet-ts-games",
GameListPattern = "#cncnet-ts-game*",
InternalName = "ts",
RegistryInstallPath = "HKLM\\Software\\Westwood\\Tiberian Sun",
UIName = "Tiberian Sun",
Expand All @@ -176,17 +188,20 @@ public void Initialize()
ChatChannel = "#cncnet-yr",
ClientExecutableName = "CnCNetClientYR.exe",
GameBroadcastChannel = "#cncnet-yr-games",
GameListPattern = "#cncnet-yr-game*",
InternalName = "yr",
RegistryInstallPath = "HKLM\\Software\\Westwood\\Yuri's Revenge",
UIName = "Yuri's Revenge",
Texture = AssetLoader.TextureFromImage(yrIcon)
Texture = AssetLoader.TextureFromImage(yrIcon),
TextureSpecialGameMode = AssetLoader.TextureFromImage(ra2Icon)
},

new()
{
ChatChannel = "#cncnet-ss",
ClientExecutableName = "SoleSurvivor.exe",
GameBroadcastChannel = "#cncnet-ss-games",
GameListPattern = "#cncnet-ss-game*",
InternalName = "ss",
RegistryInstallPath = "HKLM\\Software\\Westwood\\Sole Survivor",
UIName = "Sole Survivor",
Expand Down Expand Up @@ -350,6 +365,14 @@ public string GetGameBroadcastingChannelNameFromIdentifier(string gameIdentifier
return game.GameBroadcastChannel;
}

public string GetGameListPatternFromIdentifier(string gameIdentifier)
{
CnCNetGame game = GameList.Find(g => g.InternalName == gameIdentifier.ToLowerInvariant());
if (game == null)
return null;
return game.GameListPattern;
}

public string GetGameChatChannelNameFromIdentifier(string gameIdentifier)
{
CnCNetGame game = GameList.Find(g => g.InternalName == gameIdentifier.ToLowerInvariant());
Expand Down
Binary file added ClientCore/Resources/ra2icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void OnJoined()
if (IsHost)
{
connectionManager.SendCustomMessage(new QueuedMessage(
string.Format("MODE {0} +klnNs {1} {2}", channel.ChannelName,
string.Format("MODE {0} +klnN {1} {2}", channel.ChannelName,
channel.Password, SGPlayers.Count),
QueuedMessageType.SYSTEM_MESSAGE, 50));

Expand Down
Loading
Loading