fix chat for new localization
This commit is contained in:
parent
1201433343
commit
1c61d8f1eb
@ -45,6 +45,9 @@ class Card(ABC):
|
|||||||
return f'{self.name} {char}{self.number}'
|
return f'{self.name} {char}{self.number}'
|
||||||
return super().__str__()
|
return super().__str__()
|
||||||
|
|
||||||
|
def num_suit(self):
|
||||||
|
return f"{['♦️', '♣️', '♥️', '♠️'][int(self.suit)]}{self.number}"
|
||||||
|
|
||||||
def play_card(self, player, against=None, _with=None):#self --> carta
|
def play_card(self, player, against=None, _with=None):#self --> carta
|
||||||
if self.is_equipment:
|
if self.is_equipment:
|
||||||
if self.is_weapon:
|
if self.is_weapon:
|
||||||
@ -150,7 +153,7 @@ class Remington(Card):
|
|||||||
|
|
||||||
class RevCarabine(Card):
|
class RevCarabine(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Rev. Carabine', number,
|
super().__init__(suit, 'Rev Carabine', number,
|
||||||
is_equipment=True, is_weapon=True, range=4)
|
is_equipment=True, is_weapon=True, range=4)
|
||||||
self.icon = '🔫'
|
self.icon = '🔫'
|
||||||
# self.desc = "Puoi sparare a un giocatore che sia distante 4 o meno"
|
# self.desc = "Puoi sparare a un giocatore che sia distante 4 o meno"
|
||||||
|
@ -451,7 +451,7 @@ class Player:
|
|||||||
picked: cs.Card = self.game.deck.pick_and_scrap()
|
picked: cs.Card = self.game.deck.pick_and_scrap()
|
||||||
print(f'Did pick {picked}')
|
print(f'Did pick {picked}')
|
||||||
self.sio.emit('chat_message', room=self.game.name,
|
self.sio.emit('chat_message', room=self.game.name,
|
||||||
data=f'_flipped|{self.name}|{picked}')
|
data=f'_flipped|{self.name}|{picked.name}|{picked.num_suit()}')
|
||||||
if picked.check_suit(self.game, [cs.Suit.SPADES]) and 2 <= picked.number <= 9 and pickable_cards == 0:
|
if picked.check_suit(self.game, [cs.Suit.SPADES]) and 2 <= picked.number <= 9 and pickable_cards == 0:
|
||||||
self.lives -= 3
|
self.lives -= 3
|
||||||
self.game.deck.scrap(self.equipment.pop(i), True)
|
self.game.deck.scrap(self.equipment.pop(i), True)
|
||||||
@ -477,7 +477,7 @@ class Player:
|
|||||||
picked: cs.Card = self.game.deck.pick_and_scrap()
|
picked: cs.Card = self.game.deck.pick_and_scrap()
|
||||||
print(f'Did pick {picked}')
|
print(f'Did pick {picked}')
|
||||||
self.sio.emit('chat_message', room=self.game.name,
|
self.sio.emit('chat_message', room=self.game.name,
|
||||||
data=f'_flipped|{self.name}|{picked}')
|
data=f'_flipped|{self.name}|{picked.name}|{picked.num_suit()}')
|
||||||
if not picked.check_suit(self.game, [cs.Suit.HEARTS]) and pickable_cards == 0:
|
if not picked.check_suit(self.game, [cs.Suit.HEARTS]) and pickable_cards == 0:
|
||||||
self.game.deck.scrap(self.equipment.pop(i), True)
|
self.game.deck.scrap(self.equipment.pop(i), True)
|
||||||
self.sio.emit('chat_message', room=self.game.name, data=f'_prison_turn|{self.name}')
|
self.sio.emit('chat_message', room=self.game.name, data=f'_prison_turn|{self.name}')
|
||||||
@ -691,7 +691,7 @@ class Player:
|
|||||||
picked: cs.Card = self.game.deck.pick_and_scrap()
|
picked: cs.Card = self.game.deck.pick_and_scrap()
|
||||||
print(f'Did pick {picked}')
|
print(f'Did pick {picked}')
|
||||||
self.sio.emit('chat_message', room=self.game.name,
|
self.sio.emit('chat_message', room=self.game.name,
|
||||||
data=f'_flipped|{self.name}|{picked}')
|
data=f'_flipped|{self.name}|{picked.name}|{picked.num_suit()}')
|
||||||
if picked.check_suit(self.game, [cs.Suit.HEARTS]):
|
if picked.check_suit(self.game, [cs.Suit.HEARTS]):
|
||||||
self.mancato_needed -= 1
|
self.mancato_needed -= 1
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
@ -721,7 +721,7 @@ class Player:
|
|||||||
picked: cs.Card = self.game.deck.pick_and_scrap()
|
picked: cs.Card = self.game.deck.pick_and_scrap()
|
||||||
print(f'Did pick {picked}')
|
print(f'Did pick {picked}')
|
||||||
self.sio.emit('chat_message', room=self.game.name,
|
self.sio.emit('chat_message', room=self.game.name,
|
||||||
data=f'_flipped|{self.name}|{picked}')
|
data=f'_flipped|{self.name}|{picked.name}|{picked.num_suit()}')
|
||||||
if picked.check_suit(self.game, [cs.Suit.HEARTS]):
|
if picked.check_suit(self.game, [cs.Suit.HEARTS]):
|
||||||
self.mancato_needed -= 1
|
self.mancato_needed -= 1
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
@ -880,7 +880,7 @@ class Player:
|
|||||||
if self.character.check(self.game, chd.MollyStark) and hand_index < len(self.hand)+1 and not self.is_my_turn and self.event_type != 'duel':
|
if self.character.check(self.game, chd.MollyStark) and hand_index < len(self.hand)+1 and not self.is_my_turn and self.event_type != 'duel':
|
||||||
self.hand.append(self.game.deck.draw(True))
|
self.hand.append(self.game.deck.draw(True))
|
||||||
card.use_card(self)
|
card.use_card(self)
|
||||||
self.sio.emit('chat_message', room=self.game.name, data=f'_respond|{self.name}|{card}')
|
self.sio.emit('chat_message', room=self.game.name, data=f'_respond|{self.name}|{card.name}')
|
||||||
self.game.deck.scrap(card, True)
|
self.game.deck.scrap(card, True)
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
self.mancato_needed -= 1
|
self.mancato_needed -= 1
|
||||||
@ -976,7 +976,7 @@ class Player:
|
|||||||
elif self.pending_action == PendingAction.PLAY or forced:
|
elif self.pending_action == PendingAction.PLAY or forced:
|
||||||
if not forced and self.game.check_event(ce.Vendetta) and self.can_play_vendetta:
|
if not forced and self.game.check_event(ce.Vendetta) and self.can_play_vendetta:
|
||||||
picked: cs.Card = self.game.deck.pick_and_scrap()
|
picked: cs.Card = self.game.deck.pick_and_scrap()
|
||||||
self.sio.emit('chat_message', room=self.game.name, data=f'_flipped|{self.name}|{picked}')
|
self.sio.emit('chat_message', room=self.game.name, data=f'_flipped|{self.name}|{picked.name}|{picked.num_suit()}')
|
||||||
if picked.check_suit(self.game, [cs.Suit.HEARTS]):
|
if picked.check_suit(self.game, [cs.Suit.HEARTS]):
|
||||||
self.play_turn(can_play_vendetta=False)
|
self.play_turn(can_play_vendetta=False)
|
||||||
return
|
return
|
||||||
|
@ -36,6 +36,9 @@ export default {
|
|||||||
if ((typeof msg === "string") && msg.indexOf('_') === 0) {
|
if ((typeof msg === "string") && msg.indexOf('_') === 0) {
|
||||||
let params = msg.split('|')
|
let params = msg.split('|')
|
||||||
let type = params.shift().substring(1)
|
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){
|
||||||
|
params[1] = this.$t(`cards.${params[1]}.name`)
|
||||||
|
}
|
||||||
this.messages.push({text:this.$t(`chat.${type}`, params)});
|
this.messages.push({text:this.$t(`chat.${type}`, params)});
|
||||||
if (type == 'turn' && params[0] == this.username) {
|
if (type == 'turn' && params[0] == this.username) {
|
||||||
(new Audio(turn_sfx)).play();
|
(new Audio(turn_sfx)).play();
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
"turn": "It is the turn of {0}.",
|
"turn": "It is the turn of {0}.",
|
||||||
"draw_from_scrap": "{0} did draw the first card from the scrap pile.",
|
"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}.",
|
"draw_from_player": "{0} did draw the first card from the hand of {1}.",
|
||||||
"flipped": "{0} flipped a {1}.",
|
"flipped": "{0} flipped a {1} {2}.",
|
||||||
"explode": "{0} blew up the dynamite.",
|
"explode": "{0} blew up the dynamite.",
|
||||||
"beer_save": "{0} used a beer to save his life.",
|
"beer_save": "{0} used a beer to save his life.",
|
||||||
"play_card": "{0} played {1}.",
|
"play_card": "{0} played {1}.",
|
||||||
@ -140,7 +140,7 @@
|
|||||||
"name": "Remington",
|
"name": "Remington",
|
||||||
"desc": "You can shoot another player at distance 3 or less"
|
"desc": "You can shoot another player at distance 3 or less"
|
||||||
},
|
},
|
||||||
"Rev. Carabine": {
|
"Rev Carabine": {
|
||||||
"name": "Rev. Carabine",
|
"name": "Rev. Carabine",
|
||||||
"desc": "You can shoot another player at distance 4 or less"
|
"desc": "You can shoot another player at distance 4 or less"
|
||||||
},
|
},
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
"turn": "È il turno di {0}.",
|
"turn": "È il turno di {0}.",
|
||||||
"draw_from_scrap": "{0} ha pescato la prima carta dalla pila delle carte scartate.",
|
"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}.",
|
"draw_from_player": "{0} ha pescato la prima carta dalla mano di {1}.",
|
||||||
"flipped": "{0} ha estratto {1}.",
|
"flipped": "{0} ha estratto {1} {2}.",
|
||||||
"explode": "{0} ha fatto esplodere la dinamite.",
|
"explode": "{0} ha fatto esplodere la dinamite.",
|
||||||
"beer_save": "{0} ha usato una birra per recuperare una vita.",
|
"beer_save": "{0} ha usato una birra per recuperare una vita.",
|
||||||
"play_card": "{0} ha giocato {1}.",
|
"play_card": "{0} ha giocato {1}.",
|
||||||
@ -89,7 +89,7 @@
|
|||||||
"saloon": "{0} ha giocato {1} e ha curato 1 punto vita a tutti.",
|
"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_bart_cassidy": "{0} ha ricevuto un risarcimento perchè è stato ferito.",
|
||||||
"special_el_gringo": "{0} rubato una carta a {1} mentre veniva colpito.",
|
"special_el_gringo": "{0} rubato una carta a {1} mentre veniva colpito.",
|
||||||
"special_calamity": "{0} ha giovato {1} come un Bang! contro {2}.",
|
"special_calamity": "{0} ha giocato {1} come un Bang! contro {2}.",
|
||||||
"allroles": "Nella partita ci sono: {0}.",
|
"allroles": "Nella partita ci sono: {0}.",
|
||||||
"guess": "{0} pensa sia {1}.",
|
"guess": "{0} pensa sia {1}.",
|
||||||
"guess_right": "{0} ha indovinato.",
|
"guess_right": "{0} ha indovinato.",
|
||||||
@ -140,7 +140,7 @@
|
|||||||
"name": "Remington",
|
"name": "Remington",
|
||||||
"desc": "Puoi sparare a un giocatore che sia distante 3 o meno"
|
"desc": "Puoi sparare a un giocatore che sia distante 3 o meno"
|
||||||
},
|
},
|
||||||
"Rev. Carabine": {
|
"Rev Carabine": {
|
||||||
"name": "Rev. Carabine",
|
"name": "Rev. Carabine",
|
||||||
"desc": "Puoi sparare a un giocatore che sia distante 4 o meno"
|
"desc": "Puoi sparare a un giocatore che sia distante 4 o meno"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user