announce event in chat
This commit is contained in:
parent
ef052d7012
commit
0f86409859
@ -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):
|
||||
|
@ -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') {
|
||||
|
@ -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."
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user