mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
spjspj - Add a View Limited Deck option to allow you to see your deck during matches.
This commit is contained in:
parent
3f8b193da6
commit
0cd4e06e22
10 changed files with 74 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)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -545,6 +545,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);
|
||||
}
|
||||
|
|
@ -601,6 +604,23 @@ public class GameController implements GameCallback {
|
|||
}
|
||||
}
|
||||
|
||||
private void viewLimitedDeck(UUID userIdRequester, UUID origId) {
|
||||
Player viewLimitedDeckPlayer = game.getPlayer(userIdRequester);
|
||||
if (viewLimitedDeckPlayer != null) {
|
||||
if (viewLimitedDeckPlayer.isHuman()) {
|
||||
System.out.println("Origid: " + origId + " req:" + userIdRequester);
|
||||
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