Tarot game: invalid cards management

- tarot plugin: card validity check, new signal tarotGameInvalidCards
- wix: when an invalid cards signal is received, the cards are back in the hand, and the state change so the player as to play again.
This commit is contained in:
Goffi 2010-06-18 15:19:32 +08:00
commit e337d590e3

View file

@ -55,6 +55,7 @@ class QuickApp():
self.bridge.register("tarotGameYourTurn", self.tarotMyTurn)
self.bridge.register("tarotGameScore", self.tarotScore)
self.bridge.register("tarotGameCardsPlayed", self.tarotCardsPlayed)
self.bridge.register("tarotGameInvalidCards", self.tarotInvalidCards)
self.bridge.register("subscribe", self.subscribe)
self.bridge.register("paramUpdate", self.paramUpdate)
self.bridge.register("contactDeleted", self.contactDeleted)
@ -324,6 +325,13 @@ class QuickApp():
if self.chat_wins.has_key(room_jid):
self.chat_wins[room_jid].getGame("Tarot").cardsPlayed(player, cards)
def tarotInvalidCards(self, room_jid, phase, played_cards, invalid_cards, profile):
if not self.__check_profile(profile):
return
debug (_("Cards played are not valid: %s") % invalid_cards)
if self.chat_wins.has_key(room_jid):
self.chat_wins[room_jid].getGame("Tarot").invalidCards(phase, played_cards, invalid_cards)
def subscribe(self, type, raw_jid, profile):
"""Called when a subsciption management signal is received"""
if not self.__check_profile(profile):