better chat log

This commit is contained in:
Alberto Xamin 2023-01-18 14:01:40 +00:00
parent 42187a0698
commit 9d849d4343
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
3 changed files with 98 additions and 95 deletions

View File

@ -11,7 +11,8 @@
<transition-group name="message" tag="div" id="chatbox" :style="`${collapsed?'display:none':''}`">
<p style="margin:1pt;" class="chat-message" v-for="(msg, i) in messages" v-bind:key="`${i}-c`" :style="`color:${msg.color};background:${msg.bgcolor}${msg.bgcolor?';border-left: medium solid '+msg.color+';padding-left:2pt;':''}`">
<JsonViewer v-if="msg.type == 'json'" :value="msg.json"/>
<span v-else>{{msg.text}}</span>
<span v-else-if="msg.parts" v-for="(part, i) in msg.parts" v-bind:key="`${i}-p`" :style="`${i%2!=0?'font-weight: bold;':''}${part.desc?'text-decoration: dotted underline':''}`" class="msg-part" :title="part.desc">{{part.text}}</span>
<span v-else class="msg-text">{{msg.text}}</span>
</p>
<p class="end" key="end" style="color:#0000">.</p>
</transition-group>
@ -75,10 +76,12 @@ export default {
bg_color = msg.bgcolor
msg = msg.text
}
let desc = undefined
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", 'won'].indexOf(type) !== -1){
params[1] = this.$t(`cards.${params[1]}.name`)
desc = this.$t(`cards.${params[1]}.desc`)
} else if (type === "choose_character"){
params.push(this.$t(`cards.${params[1]}.desc`))
} else if (type === "allroles") {
@ -94,9 +97,9 @@ export default {
}
}
if (t_color != null) {
this.messages.push({color:t_color, bgcolor: bg_color, text:this.$t(`chat.${type}`, params)});
this.messages.push({color:t_color, bgcolor: bg_color, text:false, parts:this.$t(`chat.${type}`, params).split(';').map(x=>({text:x}))});
} else {
this.messages.push({text:this.$t(`chat.${type}`, params)});
this.messages.push({text:false, parts: this.$t(`chat.${type}`, params).split(';').map((x, i)=>({text:x, desc:(i===3&&desc?desc:null)}))});
}
if (type == 'turn' && params[0] == this.username) {
(new Audio(turn_sfx)).play();

View File

@ -97,53 +97,53 @@
"chat": {
"spectators": " | A spectator is watching the game | {n} spectators are watching the game",
"chat": "Chat",
"joined": "{0} joined the lobby",
"died": "{0} died",
"died_role": "{0} was a {1}!",
"won": "{0} won! Their role was {1}",
"choose_character": "{0} has {1} as character, his special ability is: {2}!",
"joined": ";{0}; joined the lobby",
"died": ";{0}; died",
"died_role": ";{0}; was a ;{1};!",
"won": ";{0}; won! Their role was ;{1};",
"choose_character": ";{0}; has ;{1}; as character, his special ability is: ;{2};!",
"starting": "The game is starting!",
"sheriff": "{0} is the sheriff!",
"did_choose_character": "{0} did choose the character.",
"turn": "It is the turn of {0}.",
"draw_from_scrap": "{0} did draw the first card from the scrap pile.",
"draw_from_player": "{0} did draw the first card from the hand of {1}.",
"flipped": "{0} flipped a {1} {2}.",
"explode": "{0} blew up the dynamite.",
"beer_save": "{0} used a beer to save his life.",
"get_nugget": "{0} got a gold nugget using a Beer.",
"play_card": "{0} played {1}.",
"purchase_card": "{0} purchased {1}.",
"play_card_against": "{0} played {1} against {2}.",
"play_card_for": "{0} played {1} for {2}.",
"spilled_beer": "{0} spilled a {1}.",
"diligenza": "{0} played {1} and draws 2 cards.",
"wellsfargo": "{0} played {1} and draws 3 cards.",
"saloon": "{0} player {1} and heals 1 HP to everyone alive.",
"special_bart_cassidy": "{0} received a compensation because he was injured.",
"special_el_gringo": "{0} stole a card from {1} when he was was injured.",
"special_calamity": "{0} played {1} as Bang! against {2}.",
"allroles3": "In the game there are: {1} {0}, {3} {2}, {5} {4}.",
"allroles4": "In the game there are: {1} {0}, {3} {2}, {5} {4}, {7} {6}.",
"guess": "{0} guesses {1}.",
"guess_right": "{0} was right.",
"guess_wrong": "{0} was wrong.",
"fratelli_sangue": "{0} gave one of his lives to {1}.",
"doctor_heal": "{0} was healed by the doctor.",
"respond": "{0} responded with {1}.",
"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",
"flip_event": "🎴 EVENT: {0} 🎴",
"choose_manette": "{0} committed to play only cards of suit {1} in this turn.",
"UnionPacific": "{0} played Union Pacific and draws 4 cards from the deck",
"use_special": "{0} used the special ability of their character ({1})",
"gold_rush_pay_discard": "{0} discarded {2} from {1}.",
"choose_emporio": "{0} has chosen {1} from General Store.",
"shotgun_scrap": "When the shotgun hit {0} a card flew away from his hand ({1})",
"taglia_reward": "{1} got a card from the bounty on {0}",
"snake_bit": "{0} was bitten by the Rattle Snake."
"sheriff": ";{0}; is the sheriff!",
"did_choose_character": ";{0}; did choose the character.",
"turn": "It is the turn of ;{0};.",
"draw_from_scrap": ";{0}; did draw the first card from the scrap pile.",
"draw_from_player": ";{0}; did draw the first card from the hand of ;{1};.",
"flipped": ";{0}; flipped a ;{1}; ;{2};.",
"explode": ";{0}; blew up the dynamite.",
"beer_save": ";{0}; used a beer to save his life.",
"get_nugget": ";{0}; got a gold nugget using a Beer.",
"play_card": ";{0}; played ;{1};.",
"purchase_card": ";{0}; purchased ;{1};.",
"play_card_against": ";{0}; played ;{1}; against ;{2};.",
"play_card_for": ";{0}; played ;{1}; for ;{2};.",
"spilled_beer": ";{0}; spilled a ;{1};.",
"diligenza": ";{0}; played ;{1}; and draws 2 cards.",
"wellsfargo": ";{0}; played ;{1}; and draws 3 cards.",
"saloon": ";{0}; player ;{1}; and heals 1 HP to everyone alive.",
"special_bart_cassidy": ";{0}; received a compensation because he was injured.",
"special_el_gringo": ";{0}; stole a card from ;{1}; when he was was injured.",
"special_calamity": ";{0}; played ;{1}; as Bang! against ;{2};.",
"allroles3": "In the game there are: ;{1}; ;{0};, ;{3}; ;{2};, ;{5}; ;{4};.",
"allroles4": "In the game there are: ;{1}; ;{0};, ;{3}; ;{2};, ;{5}; ;{4};, ;{7}; ;{6};.",
"guess": ";{0}; guesses ;{1};.",
"guess_right": ";{0}; was right.",
"guess_wrong": ";{0}; was wrong.",
"fratelli_sangue": ";{0}; gave one of his lives to ;{1};.",
"doctor_heal": ";{0}; was healed by the doctor.",
"respond": ";{0}; responded with ;{1};.",
"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",
"flip_event": "🎴 EVENT: ;{0}; 🎴",
"choose_manette": ";{0}; committed to play only cards of suit ;{1}; in this turn.",
"UnionPacific": ";{0}; played Union Pacific and draws 4 cards from the deck",
"use_special": ";{0}; used the special ability of their character (;{1};)",
"gold_rush_pay_discard": ";{0}; discarded ;{2}; from ;{1};.",
"choose_emporio": ";{0}; has chosen ;{1}; from General Store.",
"shotgun_scrap": "When the shotgun hit ;{0}; a card flew away from his hand (;{1};)",
"taglia_reward": ";{1}; got a card from the bounty on ;{0};",
"snake_bit": ";{0}; was bitten by the Rattle Snake."
},
"foc": {
"leggedelwest": "He must play this card on this turn if possible."

View File

@ -97,53 +97,53 @@
"chat": {
"spectators": " | Uno spettatore sta guardando la partita | {n} spettatori stanno guardando la partita",
"chat": "Chat",
"joined": "{0} è entrato nella stanza",
"died": "{0} è morto",
"died_role": "{0} era {1}!",
"won": "{0} ha vinto! Il suo ruolo era {1}",
"choose_character": "{0} ha come personaggio {1}, la sua abilità speciale è: {2}!",
"joined": ";{0}; è entrato nella stanza",
"died": ";{0}; è morto",
"died_role": ";{0}; era ;{1};!",
"won": ";{0}; ha vinto! Il suo ruolo era ;{1};",
"choose_character": ";{0}; ha come personaggio ;{1};, la sua abilità speciale è: ;{2};!",
"starting": "La partita sta iniziando!",
"sheriff": "{0} è lo sceriffo!",
"did_choose_character": "{0} ha scelto il personaggio.",
"turn": "È il turno di {0}.",
"draw_from_scrap": "{0} ha pescato la prima carta dalla pila delle carte scartate.",
"draw_from_player": "{0} ha pescato la prima carta dalla mano di {1}.",
"flipped": "{0} ha estratto {1} {2}.",
"explode": "{0} ha fatto esplodere la dinamite.",
"beer_save": "{0} ha usato una birra per recuperare una vita.",
"get_nugget":"{0} ha ottenuto una pepita d'oro usando una Birra.",
"play_card": "{0} ha giocato {1}.",
"purchase_card": "{0} ha comprato {1}.",
"play_card_against": "{0} ha giocato {1} contro {2}.",
"play_card_for": "{0} ha giocato {1} per {2}.",
"spilled_beer": "{0} ha rovesciato una {1}.",
"diligenza": "{0} ha giocato {1} e ha pescato 2 carte.",
"wellsfargo": "{0} ha giocato {1} e ha pescato 3 carte.",
"saloon": "{0} ha giocato {1} e ha curato 1 punto vita a tutti.",
"special_bart_cassidy": "{0} ha ricevuto un risarcimento perchè è stato ferito.",
"special_el_gringo": "{0} rubato una carta a {1} mentre veniva colpito.",
"special_calamity": "{0} ha giocato {1} come un Bang! contro {2}.",
"allroles3": "Nella partita ci sono: {1} {0}, {3} {2} e {5} {4}.",
"allroles4": "Nella partita ci sono: {1} {0}, {3} {2}, {5} {4} e {7} {6}.",
"guess": "{0} pensa sia {1}.",
"guess_right": "{0} ha indovinato.",
"guess_wrong": "{0} ha sbagliato.",
"fratelli_sangue": "{0} ha donato una delle sue vite a {1}.",
"doctor_heal": "{0} è stato curato dal dottore.",
"respond": "{0} ha risposto con {1}.",
"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",
"flip_event": "🎴 EVENTO: {0} 🎴",
"choose_manette": "{0} si è impegnato ad usare solo carte di seme {1} in questo turno.",
"UnionPacific": "{0} ha giocato Union Pacific e ha pescato 4 carte.",
"use_special": "{0} ha usato l'abilità speciale del suo personaggio ({1})",
"gold_rush_pay_discard": "{0} ha fatto scartare {2} a {1}.",
"choose_emporio": "{0} ha scelto {1} da Emporio.",
"shotgun_scrap": "Quando lo shotgun ha colpito {0} gli ha tolto una carta ({1})",
"taglia_reward": "{1} ha ottenuto ricompensa dalla taglia su {0}",
"snake_bit": "{0} è stato morso dal Serpente a Sonagli."
"sheriff": ";{0}; è lo sceriffo!",
"did_choose_character": ";{0}; ha scelto il personaggio.",
"turn": "È il turno di ;{0};.",
"draw_from_scrap": ";{0}; ha pescato la prima carta dalla pila delle carte scartate.",
"draw_from_player": ";{0}; ha pescato la prima carta dalla mano di ;{1};.",
"flipped": ";{0}; ha estratto ;{1}; ;{2};.",
"explode": ";{0}; ha fatto esplodere la dinamite.",
"beer_save": ";{0}; ha usato una birra per recuperare una vita.",
"get_nugget":";{0}; ha ottenuto una pepita d'oro usando una Birra.",
"play_card": ";{0}; ha giocato ;{1};.",
"purchase_card": ";{0}; ha comprato ;{1};.",
"play_card_against": ";{0}; ha giocato ;{1}; contro ;{2};.",
"play_card_for": ";{0}; ha giocato ;{1}; per ;{2};.",
"spilled_beer": ";{0}; ha rovesciato una ;{1};.",
"diligenza": ";{0}; ha giocato ;{1}; e ha pescato 2 carte.",
"wellsfargo": ";{0}; ha giocato ;{1}; e ha pescato 3 carte.",
"saloon": ";{0}; ha giocato ;{1}; e ha curato 1 punto vita a tutti.",
"special_bart_cassidy": ";{0}; ha ricevuto un risarcimento perchè è stato ferito.",
"special_el_gringo": ";{0}; rubato una carta a ;{1}; mentre veniva colpito.",
"special_calamity": ";{0}; ha giocato ;{1}; come un Bang! contro ;{2};.",
"allroles3": "Nella partita ci sono: ;{1}; ;{0};, ;{3}; ;{2}; e ;{5}; ;{4};.",
"allroles4": "Nella partita ci sono: ;{1}; ;{0};, ;{3}; ;{2};, ;{5}; ;{4}; e ;{7}; ;{6};.",
"guess": ";{0}; pensa sia ;{1};.",
"guess_right": ";{0}; ha indovinato.",
"guess_wrong": ";{0}; ha sbagliato.",
"fratelli_sangue": ";{0}; ha donato una delle sue vite a ;{1};.",
"doctor_heal": ";{0}; è stato curato dal dottore.",
"respond": ";{0}; ha risposto con ;{1};.",
"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",
"flip_event": "🎴 EVENTO: ;{0}; 🎴",
"choose_manette": ";{0}; si è impegnato ad usare solo carte di seme ;{1}; in questo turno.",
"UnionPacific": ";{0}; ha giocato Union Pacific e ha pescato 4 carte.",
"use_special": ";{0}; ha usato l'abilità speciale del suo personaggio (;{1};)",
"gold_rush_pay_discard": ";{0}; ha fatto scartare ;{2}; a ;{1};.",
"choose_emporio": ";{0}; ha scelto ;{1}; da Emporio.",
"shotgun_scrap": "Quando lo shotgun ha colpito ;{0}; gli ha tolto una carta (;{1};)",
"taglia_reward": ";{1}; ha ottenuto ricompensa dalla taglia su ;{0};",
"snake_bit": ";{0}; è stato morso dal Serpente a Sonagli."
},
"foc": {
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"