[Game] Populate playerLists for menus in their aboutToShow … (#6214)

* Populate playerLists for menus in their aboutToShow so they are always current and do not rely on playerMenu manually tracking them. Also add playerActions for previous playerListActions.

Took 1 hour 35 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-10-03 15:21:22 +02:00 committed by GitHub
parent 015570c833
commit 30e6b52783
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 313 additions and 159 deletions

View file

@ -197,19 +197,6 @@ void PlayerActions::actViewGraveyard()
player->getGameScene()->toggleZoneView(player, "grave", -1);
}
void PlayerActions::actRevealRandomGraveyardCard()
{
Command_RevealCards cmd;
auto *action = dynamic_cast<QAction *>(sender());
const int otherPlayerId = action->data().toInt();
if (otherPlayerId != -1) {
cmd.set_player_id(otherPlayerId);
}
cmd.set_zone_name("grave");
cmd.add_card_id(RANDOM_CARD_FROM_ZONE);
sendGameCommand(cmd);
}
void PlayerActions::actViewRfg()
{
player->getGameScene()->toggleZoneView(player, "rfg", -1);
@ -1662,6 +1649,78 @@ void PlayerActions::actReveal(QAction *action)
sendGameCommand(cmd);
}
void PlayerActions::actRevealHand(int revealToPlayerId)
{
Command_RevealCards cmd;
if (revealToPlayerId != -1) {
cmd.set_player_id(revealToPlayerId);
}
cmd.set_zone_name("hand");
sendGameCommand(cmd);
}
void PlayerActions::actRevealRandomHandCard(int revealToPlayerId)
{
Command_RevealCards cmd;
if (revealToPlayerId != -1) {
cmd.set_player_id(revealToPlayerId);
}
cmd.set_zone_name("hand");
cmd.add_card_id(RANDOM_CARD_FROM_ZONE);
sendGameCommand(cmd);
}
void PlayerActions::actRevealLibrary(int revealToPlayerId)
{
Command_RevealCards cmd;
if (revealToPlayerId != -1) {
cmd.set_player_id(revealToPlayerId);
}
cmd.set_zone_name("deck");
sendGameCommand(cmd);
}
void PlayerActions::actLendLibrary(int lendToPlayerId)
{
Command_RevealCards cmd;
if (lendToPlayerId != -1) {
cmd.set_player_id(lendToPlayerId);
}
cmd.set_zone_name("deck");
cmd.set_grant_write_access(true);
sendGameCommand(cmd);
}
void PlayerActions::actRevealTopCards(int revealToPlayerId, int amount)
{
Command_RevealCards cmd;
if (revealToPlayerId != -1) {
cmd.set_player_id(revealToPlayerId);
}
cmd.set_zone_name("deck");
cmd.set_top_cards(amount);
// backward compatibility: servers before #1051 only permits to reveal the first card
cmd.add_card_id(0);
sendGameCommand(cmd);
}
void PlayerActions::actRevealRandomGraveyardCard(int revealToPlayerId)
{
Command_RevealCards cmd;
if (revealToPlayerId != -1) {
cmd.set_player_id(revealToPlayerId);
}
cmd.set_zone_name("grave");
cmd.add_card_id(RANDOM_CARD_FROM_ZONE);
sendGameCommand(cmd);
}
void PlayerActions::cardMenuAction()
{
auto *a = dynamic_cast<QAction *>(sender());