- def __getData(graphicOnAirItem, viewBag, momentExecution):
- orderedEvents = list(Game.Events)
- graphicOnAirItems = IntelliflowController.GetGraphicOnAirItems(
- Script.Name,
- OutputManager.ActiveChannelOutput
- )
- goalKeyMap = {
- "shots6meters": "goals6meters",
- "shots7meters": "goals7meters",
- "shots9meters": "goals9meters",
- "totalShots": "totalGoals",
- "shotsCA": "goalsCA"
- }
- lines = 0
- for i, stat in enumerate(SelectedStats):
- if stat.Key in ["goals6meters", "goals7meters", "goals9meters", "goalsCA"]:
- UserInteraction.NotifyError("Stats", "Don't select Goals 6, 7, 9 and CA.")
- momentExecution.Cancel = True
- return
- shotsKey = None
- goalsKey = None
- if stat.Key == "totalGoals":
- ownGoals = next((x for x in Stats if x.Key == "Own Goals"), None)
- if ownGoals is None: continue
- viewBag.SetString("tHomeStat{:02d}".format(i + 1), int(stat.HomeTeam + ownGoals.AwayTeam))
- viewBag.SetString("tAwayStat{:02d}".format(i + 1), int(stat.AwayTeam + ownGoals.HomeTeam))
- viewBag.SetString("tInfo{:02d}".format(i+1), Dictionary.TranslateWithContext(stat.Key, "stat-efficiency").upper())
- lines +=1
- continue
- if stat.Key in goalKeyMap:
- shotsKey = stat.Key
- goalsKey = goalKeyMap[shotsKey]
- if goalsKey is None or shotsKey is None:
- viewBag.SetString("tHomeStat{:02d}".format(i + 1), int(stat.HomeTeam))
- viewBag.SetString("tAwayStat{:02d}".format(i + 1), int(stat.AwayTeam))
- viewBag.SetString("tInfo{:02d}".format(i+1), Dictionary.TranslateWithContext(stat.Key, "stat-efficiency").upper())
- lines += 1
- continue
- statGoals = next((x for x in Stats if x.Key == goalsKey), None)
- statShots = next((x for x in Stats if x.Key == shotsKey), None)
- homeGoals = 0
- homeShots = 0
- awayGoals = 0
- awayShots = 0
- if statGoals is not None and statShots is not None:
- homeGoals = statGoals.HomeTeam
- awayGoals = statGoals.AwayTeam
- homeShots = statShots.HomeTeam
- awayShots = statShots.AwayTeam
- else:
- continue
- if int(homeGoals) == 0 or int(homeShots) == 0:
- homeEfficiency = 0
- else:
- homeEfficiency = round((float(homeGoals) / float(homeShots)) * 100)
- if int(awayGoals) == 0 or int(awayShots) == 0:
- awayEfficiency = 0
- else:
- awayEfficiency = round((float(awayGoals) / float(awayShots)) * 100)
- viewBag.SetString(
- "tHomeStat{:02d}".format(i + 1),
- "{}/{} {}%".format(
- int(homeGoals),
- int(homeShots),
- int(homeEfficiency)
- )
- )
- viewBag.SetString(
- "tAwayStat{:02d}".format(i + 1),
- "{}/{} {}%".format(
- int(awayGoals),
- int(awayShots),
- int(awayEfficiency)
- )
- )
- viewBag.SetString("tInfo{:02d}".format(i+1), Dictionary.TranslateWithContext(shotsKey, "stat-efficiency").upper())
- lines += 1
- viewBag.SetString("vLines", lines)
Untitled
From Hot Goat, 3 Weeks ago, written in Plain Text, viewed 5 times.
This paste will buy the farm in 4 Hours.
URL https://paste.afonso.co/view/908e3812
Embed
Download Paste or View Raw
— Expand Paste to full width of browser