diff --git a/backend/bang/game.py b/backend/bang/game.py index 6078e88..0bebcb1 100644 --- a/backend/bang/game.py +++ b/backend/bang/game.py @@ -346,6 +346,7 @@ class Game: self.deck.flip_event() if len(self.deck.event_cards) > 0 and self.deck.event_cards[0] != None: print(f'flip new event {self.deck.event_cards[0].name}') + self.sio.emit('chat_message', room=self.name, data={'color': f'orange','text':f'_flip_event|{self.deck.event_cards[0].name}'}) if self.check_event(ce.DeadMan): self.did_resuscitate_deadman = False elif self.check_event(ce.RouletteRussa): diff --git a/frontend/src/components/Chat.vue b/frontend/src/components/Chat.vue index 9831d00..ac14072 100644 --- a/frontend/src/components/Chat.vue +++ b/frontend/src/components/Chat.vue @@ -35,7 +35,12 @@ export default { sockets: { chat_message(msg) { // console.log(msg) - if ((typeof msg === "string") && msg.indexOf('_') === 0) { + if ((typeof msg === "string" && msg.indexOf('_') === 0) || (msg.color != null && msg.text.indexOf('_') === 0)) { + let t_color = null + if (msg.color != null) { + t_color = msg.color + msg = msg.text + } let params = msg.split('|') let type = params.shift().substring(1) if (["flipped", "respond", "play_card", "play_card_against", "play_card_for", "spilled_beer", "diligenza", "wellsfargo", "saloon", "special_calamity"].indexOf(type) !== -1){ @@ -54,7 +59,11 @@ export default { type += "4" } } - this.messages.push({text:this.$t(`chat.${type}`, params)}); + if (t_color != null) { + this.messages.push({color:t_color, text:this.$t(`chat.${type}`, params)}); + } else { + this.messages.push({text:this.$t(`chat.${type}`, params)}); + } if (type == 'turn' && params[0] == this.username) { (new Audio(turn_sfx)).play(); } else if (type == 'died_role') { diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index e834e7e..d95b991 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -102,7 +102,8 @@ "change_username": "{0} is now {1}.", "lobby_reset": "Going back to lobby in {0} seconds...", "prison_free": "{0} got out of prison", - "prison_turn": "{0} stayed in prison this turn" + "prison_turn": "{0} stayed in prison this turn", + "flip_event": "🎴 EVENT: {0} 🎴" }, "foc": { "leggedelwest": "He must play this card on this turn if possible." diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json index 4f8131b..b8b8734 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -102,7 +102,8 @@ "change_username": "{0} ha cambiato nome in {1}.", "lobby_reset": "Si ritorna alla stanza in {0} secondi...", "prison_free": "{0} è uscito di prigione", - "prison_turn": "{0} rimane in prigione questo turno" + "prison_turn": "{0} rimane in prigione questo turno", + "flip_event": "🎴 EVENTO: {0} 🎴" }, "foc": { "leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"