Example #1
0
    def loadPlayer(self,playerRfid):
        if len(self.playersTeamA) + len(self.playersTeamB) >= 8:
            self.setLayout("error")
            self.invokeLayoutFunction("updateErrorMessage","Max 8 players")
            self.send("lpc",{"head":'get_tag'})
            return

        player = Player.createOrLoad(playerRfid, self.session)
        if player not in self.playersTeamA and player not in self.playersTeamB:
            if(len(self.playersTeamB) < len(self.playersTeamA)):
                self.playersTeamB.append(player)
            else:
                self.playersTeamA.append(player)
        
        self.send("lpc",{"head":'get_tag'})
        self.setLayout("match_setup")
        self.updateLayout()
Example #2
0
 def testPlayerCreateOrLoadDifferent(self):
     playerA = Player.createOrLoad('1',self.session)
     self.session.commit()
     playerB = Player.createOrLoad('2',self.session)
     self.assertNotEqual(playerA,playerB)
Example #3
0
def profile_data() -> Profile:
    return Profile(
        Player(**summary_data()["response"]["players"][0]),
        [Game(**game) for game in player_data()["response"]["games"]],
    )
Example #4
0
 def testPlayerCreateOrLoadSame(self):
     playerA = Player.createOrLoad('1',self.session)
     self.session.commit()
     playerB = Player.createOrLoad('1',self.session)
     self.assertEqual(playerA,playerB)
Example #5
0
async def find_user_summary(user_id: str) -> Player:
    result = await client_fetch("/ISteamUser/GetPlayerSummaries/v2/",
                                {"steamids": user_id})
    return Player(**result["response"]["players"][0])