Skip to content

Commit

Permalink
fix: wrong card art for Duos
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Apr 16, 2024
1 parent 852872b commit 9c35db9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions twitch_hdt_ebs/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ class PubSubMessageSerializer(serializers.Serializer):
data = serializers.DictField()
version = serializers.IntegerField(default=0)

def validate_data(self, data):
# Fix wrong card art for Duos by faking it to BGT_BATTLEGROUNDS because the Twitch extension will fetch
# constructed images otherwise.
game_type = data.get("game_type")
player = data.get("player", {})
player_deck = player.get("deck", {})

if game_type in (65, 66, 67, 68) or (game_type == 0 and player_deck.get("size") == 0):
data["game_type"] = 50

return data


class IntegerFieldStoredAsCharField(serializers.IntegerField):
def to_internal_value(self, data):
Expand Down

0 comments on commit 9c35db9

Please sign in to comment.