예제 #1
0
    def seasonStats(playerName: str, platform: str, authheader, gameplayerMode, seasonValue):
        '''
            Wrapper for lifetime stats.
            playerName - the players name you want to lookup the lifetime stats of (case-sensitive)
            platform - the platform the player is playing on, can be one of the following:
            - XBOX / xbox
            - PC / pc
            - PSN / psn
            - KAKAO / kakao
            authheader - the header we will use to contact the API.
            gameplayerMode - the game mode you want to lookup, one of the following:
            - ALL / all (Displays FPP and TPP lifetime stats)
            - FPP / fpp (Displays FPP only lifetime stats)
            - SOLO-FPP / solo-fpp (Displays only solo FPP lifetime stats)
            - DUO-FPP-FPP / duo-fpp (Displays only duo FPP lifetime stats)
            - SQUAD-FPP / squad-fpp (Displays only squad FPP lifetime stats)
            - TPP / tpp (Displays TPP only lifetime stats)
            - DUO / duo (Displays only duo TPP lifetime stats)
            - SOLO / solo (Displays only  solo TPP lifetime stats)
            - SQUAD / squad (Displays only squad TPP lifetime stats)
        '''

        url = Shard.buildURL(platform)

        playerObject = player(authheader)
        playerObject.getAccountID(playerName, url, 0, True)
        playerObject.seasonStats(url, gameplayerMode.lower(), seasonValue)
예제 #2
0
def create_player(name, description, location = None):
    pers = player.player()
    pers.name = name
    pers.description = description
    pers.location = location
    pers.id = create_id()
    print "player id %i created" % pers.id
    print pers
    register_object(pers)
    return pers
예제 #3
0
    def matchStats(playerName: str, platform: str, authheader, amount: int):
        '''
            Wrapper for a quick breakdown of player stats over a number of matches. 
            Also prints a table including each of these matches out to the console.
            playerName - the players name that you want to produce a quick breakdown of over a number matches (case-sensitive)
            platform - the platform the player is playing on, can be one of the following:
            - XBOX / xbox
            - PC / pc
            - PSN / psn
            - KAKAO / kakao
            authheader - the header we will use to contact the API.
            amount - amount of matches you want to display. 
            The amount of time the script will take to process the data, scales linearly with this.
        '''
        
        url = Shard.buildURL(platform)

        playerObject = player(authheader)
        playerObject.getAccountID(playerName, url, amount, False)
        playerObject.displayMatches(url)
예제 #4
0
 def newGame(self, users, games, slots):
     userB = []
     for u in range(users):
         userB.append(player.player(u))
     for g in range(games):
         team1arr = []
         team2arr = []
         print('meh')
         for o in range(slots):
             while True:
                 randIndex1 = int(random()*users)
                 if len(team1arr) < slots:
                     if userB[randIndex1].gamesPlayed < games and userB[randIndex1].currentTeam == 0:
                         userB[randIndex1].assignTeam(1)
                         team1arr.append(userB[randIndex1])
                         break
                 else:
                     break
             while True:
                 randIndex2 = int(random()*users)
                 if len(team2arr) < slots:
                     if userB[randIndex2].gamesPlayed < games and userB[randIndex2].currentTeam == 0:
                         userB[randIndex2].assignTeam(2)
                         team2arr.append(userB[randIndex2])
                         break
                 else:
                     break
             print(len(team1arr), len(team2arr))
         team1 = team.team(team1arr)
         team2 = team.team(team2arr)
         g = game.game(team1, team2)
         print('g', g.winner)
     w = 0
     for b in userB:
         b.calculateWR()
         w += b.WR
예제 #5
0
        def submitButtonQuery(self, evt):
            
            start_time = time.time()
            header = APIConfig(APISettings.API_TOKEN).setupAuth()        
            platformChoice = self.platformSelect.GetItemLabel(self.platformSelect.GetSelection())

            url = Shard.buildURL(platformChoice)

            if not self.regionDropDown.GetValue():
                self.SetStatusText(f"ERROR: Region cannot be empty!")
                return

            if not self.gameModeDrop.GetValue():
                self.SetStatusText(f"ERROR: Game Mode cannot be empty!")
                return

            if not self.apiTokenBox.GetValue():
                self.SetStatusText(f"ERROR: API Token cannot be empty!")
                return

            if not self.playerNameBox.GetValue():
                self.SetStatusText(f"ERROR: Players Name cannot be empty!")
                return
            
            playerRegion = self.regionDropDown.GetValue()
            playerObject = player(header, playerRegion)
            playerMode = self.gameModeDrop.GetValue()
            playerName = self.playerNameBox.GetValue()

            if self.optionChoicesSelect.GetSelection() == 0:
                
                self.SetStatusText(f"Requesting and Parsing PUBG API Lifetime request for {playerName}...")

                if playerObject.getAccountID(playerName, url, 0, True) != False:
                    playerObject.lifetimeStats(url, playerMode.lower())

            elif self.optionChoicesSelect.GetSelection() == 1:
                
                if not self.seasonDropDown.GetValue():
                    self.SetStatusText(f"ERROR: You must select a season!")
                    return 
                else:
                    
                    seasonValue = self.seasonDropDown.GetValue()

                    self.SetStatusText(f"Requesting and Parsing PUBG API season data for season {seasonValue}...")

                    if playerObject.getAccountID(playerName, url, 0, False) != False:
                        playerObject.seasonStats(url, playerMode.lower(), seasonValue)

            elif self.optionChoicesSelect.GetSelection() == 2:

                if not self.noOfMatches.GetValue():
                    self.SetStatusText(f"ERROR: Cannot enter non-numeric characters in no-of-matches box!")
                    return 
                else:

                    matchAmountValue = self.noOfMatches.GetValue()

                    self.SetStatusText(f"Requesting and Parsing {matchAmountValue} match responses from PUBG API... if this hangs it's fine")

                    if playerObject.getAccountID(playerName, url, int(matchAmountValue), False) != False:
                        playerObject.displayMatches(url)
                    
            self.SetStatusText(f"Took {time.time() - start_time} seconds to complete parsing data...")