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
  1. def __getData(graphicOnAirItem, viewBag, momentExecution):
  2.         orderedEvents = list(Game.Events)
  3.  
  4.         graphicOnAirItems = IntelliflowController.GetGraphicOnAirItems(
  5.                 Script.Name,
  6.                 OutputManager.ActiveChannelOutput
  7.         )
  8.  
  9.         goalKeyMap = {
  10.                 "shots6meters": "goals6meters",
  11.                 "shots7meters": "goals7meters",
  12.                 "shots9meters": "goals9meters",
  13.                 "totalShots": "totalGoals",
  14.                 "shotsCA": "goalsCA"
  15.         }
  16.        
  17.         lines = 0
  18.  
  19.         for i, stat in enumerate(SelectedStats):
  20.                 if stat.Key in ["goals6meters", "goals7meters", "goals9meters", "goalsCA"]:
  21.                         UserInteraction.NotifyError("Stats", "Don't select Goals 6, 7, 9 and CA.")
  22.                         momentExecution.Cancel = True
  23.                         return
  24.  
  25.                 shotsKey = None
  26.                 goalsKey = None
  27.                
  28.                 if stat.Key == "totalGoals":
  29.                         ownGoals = next((x for x in Stats if x.Key == "Own Goals"), None)
  30.                        
  31.                         if ownGoals is None: continue
  32.                        
  33.                         viewBag.SetString("tHomeStat{:02d}".format(i + 1), int(stat.HomeTeam + ownGoals.AwayTeam))     
  34.                         viewBag.SetString("tAwayStat{:02d}".format(i + 1), int(stat.AwayTeam + ownGoals.HomeTeam))
  35.                         viewBag.SetString("tInfo{:02d}".format(i+1), Dictionary.TranslateWithContext(stat.Key, "stat-efficiency").upper())
  36.                         lines +=1
  37.                         continue
  38.                
  39.                 if stat.Key in goalKeyMap:
  40.                         shotsKey = stat.Key
  41.                         goalsKey = goalKeyMap[shotsKey]                
  42.  
  43.                 if goalsKey is None or shotsKey is None:                               
  44.                         viewBag.SetString("tHomeStat{:02d}".format(i + 1), int(stat.HomeTeam)) 
  45.                         viewBag.SetString("tAwayStat{:02d}".format(i + 1), int(stat.AwayTeam))
  46.                         viewBag.SetString("tInfo{:02d}".format(i+1), Dictionary.TranslateWithContext(stat.Key, "stat-efficiency").upper())
  47.                         lines += 1
  48.                         continue
  49.                        
  50.                 statGoals = next((x for x in Stats if x.Key == goalsKey), None)
  51.                 statShots = next((x for x in Stats if x.Key == shotsKey), None)
  52.                
  53.                 homeGoals = 0
  54.                 homeShots = 0
  55.                 awayGoals = 0
  56.                 awayShots = 0
  57.                
  58.                 if statGoals is not None and statShots is not None:
  59.                         homeGoals = statGoals.HomeTeam
  60.                         awayGoals = statGoals.AwayTeam
  61.                        
  62.                         homeShots = statShots.HomeTeam
  63.                         awayShots = statShots.AwayTeam
  64.                 else:
  65.                         continue
  66.  
  67.                 if int(homeGoals) == 0 or int(homeShots) == 0:
  68.                         homeEfficiency = 0
  69.                 else:
  70.                         homeEfficiency = round((float(homeGoals) / float(homeShots)) * 100)
  71.  
  72.                 if int(awayGoals) == 0 or int(awayShots) == 0:
  73.                         awayEfficiency = 0
  74.                 else:
  75.                         awayEfficiency = round((float(awayGoals) / float(awayShots)) * 100)
  76.  
  77.                 viewBag.SetString(
  78.                         "tHomeStat{:02d}".format(i + 1),
  79.                                 "{}/{} {}%".format(
  80.                                         int(homeGoals),
  81.                                         int(homeShots),
  82.                                         int(homeEfficiency)
  83.                                 )
  84.                 )
  85.  
  86.                 viewBag.SetString(
  87.                         "tAwayStat{:02d}".format(i + 1),
  88.                                 "{}/{} {}%".format(
  89.                                         int(awayGoals),
  90.                                         int(awayShots),
  91.                                         int(awayEfficiency)
  92.                                 )
  93.                 )
  94.                
  95.                 viewBag.SetString("tInfo{:02d}".format(i+1), Dictionary.TranslateWithContext(shotsKey, "stat-efficiency").upper())
  96.                
  97.                 lines += 1
  98.        
  99.         viewBag.SetString("vLines", lines)

Reply to "Untitled"

Here you can reply to the paste above