mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
spjspj - Add in 'View Current Deck' option.
This commit is contained in:
parent
56ce1abb44
commit
6ab4a94bd7
10 changed files with 73 additions and 4 deletions
|
|
@ -269,6 +269,10 @@ public class User {
|
|||
sideboarding.put(tableId, deck);
|
||||
}
|
||||
|
||||
public void ccViewLimitedDeck(final Deck deck, final UUID tableId, final int time, boolean limited) {
|
||||
fireCallback(new ClientCallback(ClientCallbackMethod.VIEW_LIMITED_DECK, tableId, new TableClientMessage(deck, tableId, time, limited)));
|
||||
}
|
||||
|
||||
public void ccConstruct(final Deck deck, final UUID tableId, final int time) {
|
||||
fireCallback(new ClientCallback(ClientCallbackMethod.CONSTRUCT, tableId, new TableClientMessage(deck, tableId, time)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -546,6 +546,9 @@ public class GameController implements GameCallback {
|
|||
requestPermissionToSeeHandCards(userId, (UUID) data);
|
||||
}
|
||||
break;
|
||||
case VIEW_LIMITED_DECK:
|
||||
viewLimitedDeck(getPlayerId(userId), userId);
|
||||
break;
|
||||
default:
|
||||
game.sendPlayerAction(playerAction, getPlayerId(userId), data);
|
||||
}
|
||||
|
|
@ -602,6 +605,22 @@ public class GameController implements GameCallback {
|
|||
}
|
||||
}
|
||||
|
||||
private void viewLimitedDeck(UUID userIdRequester, UUID origId) {
|
||||
Player viewLimitedDeckPlayer = game.getPlayer(userIdRequester);
|
||||
if (viewLimitedDeckPlayer != null) {
|
||||
if (viewLimitedDeckPlayer.isHuman()) {
|
||||
for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) {
|
||||
if (p.getPlayer().getId() == userIdRequester) {
|
||||
Optional<User> u = UserManager.instance.getUser(origId);
|
||||
if (u != null && u.isPresent() && p.getDeck() != null) {
|
||||
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cheat(UUID userId, UUID playerId, DeckCardLists deckList) {
|
||||
try {
|
||||
Deck deck = Deck.load(deckList, false, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue