PATCH: Incorrect team colours due to wrong total round number
This commit is contained in:
3
main.py
3
main.py
@@ -7,7 +7,8 @@ def main():
|
|||||||
import demoparser2
|
import demoparser2
|
||||||
|
|
||||||
demo_parser = demoparser2.DemoParser("demo.dem")
|
demo_parser = demoparser2.DemoParser("demo.dem")
|
||||||
game_info = demo_parser.parse_ticks(["X", "Y", "Z", "pitch", "yaw", "is_alive", "team", "player_steamid", "team_rounds_total", "team_num"])
|
game_info = demo_parser.parse_ticks(["X", "Y", "Z", "pitch", "yaw", "is_alive", "team", "player_steamid",
|
||||||
|
"team_rounds_total", "team_num", "total_rounds_played"])
|
||||||
header_info = demo_parser.parse_header()
|
header_info = demo_parser.parse_header()
|
||||||
map_name = header_info['map_name']
|
map_name = header_info['map_name']
|
||||||
players = demo_parser.parse_player_info()
|
players = demo_parser.parse_player_info()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Match:
|
|||||||
self.tick = 1
|
self.tick = 1
|
||||||
self.current_tick = game_info[game_info["tick"] == self.tick]
|
self.current_tick = game_info[game_info["tick"] == self.tick]
|
||||||
|
|
||||||
self.round = self.current_tick["team_rounds_total"].values[0]
|
self.round = self.current_tick["total_rounds_played"].values[0]
|
||||||
|
|
||||||
self.max_tick = game_info["tick"].max()
|
self.max_tick = game_info["tick"].max()
|
||||||
self.game_info = game_info.sort_values(by=["tick", "player_steamid"]) # pd dataframe sorted by tick
|
self.game_info = game_info.sort_values(by=["tick", "player_steamid"]) # pd dataframe sorted by tick
|
||||||
@@ -36,7 +36,7 @@ class Match:
|
|||||||
if self.current_tick.empty:
|
if self.current_tick.empty:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.round = self.current_tick["team_rounds_total"].values[0]
|
self.round = self.current_tick["total_rounds_played"].values[0]
|
||||||
|
|
||||||
if self.round >= 8:
|
if self.round >= 8:
|
||||||
self.team_1.set_t()
|
self.team_1.set_t()
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
from models.player import Player
|
from models.player import Player
|
||||||
|
|
||||||
|
CT_COLOUR = 'blue'
|
||||||
|
T_COLOUR = 'brown'
|
||||||
|
|
||||||
class Team:
|
class Team:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.players = []
|
self.players = []
|
||||||
self.is_ct = False
|
|
||||||
self.colour = 'brown'
|
|
||||||
self.score = 0
|
self.score = 0
|
||||||
|
self.set_t()
|
||||||
|
|
||||||
def add_player(self, player: Player):
|
def add_player(self, player: Player):
|
||||||
self.players.append(player)
|
self.players.append(player)
|
||||||
@@ -15,8 +17,8 @@ class Team:
|
|||||||
|
|
||||||
def set_ct(self):
|
def set_ct(self):
|
||||||
self.is_ct = True
|
self.is_ct = True
|
||||||
self.colour = 'blue'
|
self.colour = CT_COLOUR
|
||||||
|
|
||||||
def set_t(self):
|
def set_t(self):
|
||||||
self.is_ct = False
|
self.is_ct = False
|
||||||
self.colour = 'brown'
|
self.colour = T_COLOUR
|
||||||
Reference in New Issue
Block a user