restore historical blackjack games
parent
f09ec0ca17
commit
d52216beda
|
@ -65,6 +65,7 @@ class Comment(Base):
|
|||
wordle_result = Column(String)
|
||||
treasure_amount = Column(String)
|
||||
slots_result = Column(String)
|
||||
blackjack_result = Column(String)
|
||||
casino_game_id = Column(Integer, ForeignKey("casino_games.id"))
|
||||
|
||||
oauth_app = relationship("OauthApp")
|
||||
|
@ -390,3 +391,40 @@ class Comment(Base):
|
|||
|
||||
body += '</span>'
|
||||
return body
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def blackjack_html(self):
|
||||
if not self.blackjack_result: return ''
|
||||
|
||||
split_result = self.blackjack_result.split('_')
|
||||
blackjack_status = split_result[3]
|
||||
player_hand = split_result[0].replace('X', '10')
|
||||
dealer_hand = split_result[1].split('/')[0] if blackjack_status == 'active' else split_result[1]
|
||||
dealer_hand = dealer_hand.replace('X', '10')
|
||||
wager = int(split_result[4])
|
||||
try: kind = split_result[5]
|
||||
except: kind = "coins"
|
||||
currency_kind = "Coins" if kind == "coins" else "Marseybux"
|
||||
|
||||
try: is_insured = split_result[6]
|
||||
except: is_insured = "0"
|
||||
|
||||
body = f"<span id='blackjack-{self.id}' class='ml-2'><em>{player_hand} vs. {dealer_hand}</em>"
|
||||
|
||||
if blackjack_status == 'push':
|
||||
body += f"<strong class='ml-2'>Pushed. Refunded {wager} {currency_kind}.</strong>"
|
||||
elif blackjack_status == 'bust':
|
||||
body += f"<strong class='ml-2'>Bust. Lost {wager} {currency_kind}.</strong>"
|
||||
elif blackjack_status == 'lost':
|
||||
body += f"<strong class='ml-2'>Lost {wager} {currency_kind}.</strong>"
|
||||
elif blackjack_status == 'won':
|
||||
body += f"<strong class='ml-2'>Won {wager} {currency_kind}.</strong>"
|
||||
elif blackjack_status == 'blackjack':
|
||||
body += f"<strong class='ml-2'>Blackjack! Won {floor(wager * 3/2)} {currency_kind}.</strong>"
|
||||
|
||||
if is_insured == "1":
|
||||
body += f" <em class='text-success'>Insured.</em>"
|
||||
|
||||
body += '</span>'
|
||||
return body
|
||||
|
|
|
@ -209,6 +209,10 @@
|
|||
<em style="position: relative; top: 2px; margin-left: 0.5rem">{{game_state['symbols'].replace(',','')}} {{game_state['text']}}</em>
|
||||
{% endif %}
|
||||
|
||||
{% if c.blackjack_result %}
|
||||
{{c.blackjack_html | safe}}
|
||||
{% endif %}
|
||||
|
||||
{% if c.wordle_result %}
|
||||
{{c.wordle_html(v) | safe}}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue