getFullGameMinutes

From theLape, 1 Week ago, written in Plain Text, viewed 1 times. This paste will self destruct in 2 Weeks.
URL https://paste.afonso.co/view/a249b66a Embed
Download Paste or View Raw
  1. def getFullGameMinutes(clock, game, parts, forceGetFromGameMovie = False):
  2.         if not forceGetFromGameMovie or game.Possession.GameTime != TimeSpan.Zero: return game.Possession.GameTime  
  3.        
  4.         timeplayed = TimeSpan.Zero
  5.         for part in parts:
  6.                 startPartGameEvent = next((g for g in game.OrderedGameEvents if g.Event.Abbreviation == FootballEvents.Start.Abbreviation and g.GamePart == part.Number), None)
  7.                 if not startPartGameEvent: continue
  8.                 endPartGameEvent = next((g for g in game.OrderedGameEvents if g.Event.Abbreviation == FootballEvents.Stop.Abbreviation and g.GamePart == part.Number), clock)
  9.                 timeplayed += (endPartGameEvent.Time - startPartGameEvent.Time)
  10.         return timeplayed
  11.  

Reply to "getFullGameMinutes"

Here you can reply to the paste above