Results 1 to 5 of 5

Thread: game_mode arg not working?

  1. #1
    Basic Member
    Join Date
    Jan 2013
    Posts
    4

    game_mode arg not working?

    Hi all, perhaps I'm doing something wrong but I can't seem to get game_mode working with GetMatchHistory. No matter what numerical value I enter, it's always ignored and I get matches of all game-modes back as a result. Has anyone else experienced this?

  2. #2
    Basic Member RJackson's Avatar
    Join Date
    Sep 2011
    Posts
    121
    I can confirm, the argument seems to be ignored.

    Here's some example python code to demonstrate it:

    Code:
    import json
    import urllib
    import urllib2
    
    def enum(*sequential, **named):
        enums = dict(zip(sequential, range(len(sequential))), **named)
        reverse = dict((value, key) for key, value in enums.iteritems())
        enums['reverse_mapping'] = reverse
        return type('Enum', (), enums)
    
    GameModes = enum("ALL_PICK",
                     "SINGLE_DRAFT",
                     "ALL_RANDOM",
                     "RANDOM_DRAFT",
                     "CAPTAINS_DRAFT",
                     "CAPTAINS_MODE",
                     "DEATH_MODE",
                     "DIRETIDE",
                     "REVERSE_CAPTAINS_MODE",
                     "THE_GREEVILING",
                     "TUTORIAL",
                     "MID_ONLY",
                     "LEAST_PLAYED",
                     "NEW_PLAYER_POOL")
    
    api_key = ""
    
    getHistoryUrl = "http://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/v1/?{args}"
    getDetailsUrl = "http://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/v1/?{args}"
    
    
    def lookup(url, **kwargs):
        kwargs["key"] = api_key
        encodedArgs = urllib.urlencode(kwargs)
        data = json.loads(
                urllib2.urlopen(
                        url.format(args=encodedArgs)
                    ).read()
            )
        return data
    
    
    def printMatches(amount, gameMode):
        matches = lookup(
                getHistoryUrl,
                game_mode = gameMode,
                matches_requested = amount
            )["result"]["matches"]
    
        results = []
        for item in matches:
            matchID = item["match_id"]
            data = lookup(getDetailsUrl, match_id = matchID)["result"]
            resultID = data["match_id"]
            resultMode = data["game_mode"]
    
            results.append(
                    (
                        resultID,
                        GameModes.reverse_mapping[resultMode]
                    )
                )
    
        print "Expecting {amount} {game_mode} matches:".format(
            amount = amount,
            game_mode = GameModes.reverse_mapping[gameMode])
    
        print "\tmatchid\tgamemode"
        for item in results:
            print "\t{}\t{}".format(item[0], item[1])
    
    
    def main():
        printMatches(5, GameModes.ALL_PICK)
        printMatches(5, GameModes.SINGLE_DRAFT)
        printMatches(5, GameModes.CAPTAINS_MODE)
    
    
    if __name__ == '__main__':
        main()
    And it's output:
    Code:
    Expecting 5 ALL_PICK matches:
    	matchid	gamemode
    	123112854	SINGLE_DRAFT
    	123112706	SINGLE_DRAFT
    	123112690	SINGLE_DRAFT
    	123112146	SINGLE_DRAFT
    	123111977	CAPTAINS_MODE
    Expecting 5 SINGLE_DRAFT matches:
    	matchid	gamemode
    	123112854	SINGLE_DRAFT
    	123112706	SINGLE_DRAFT
    	123112690	SINGLE_DRAFT
    	123112146	SINGLE_DRAFT
    	123111977	CAPTAINS_MODE
    Expecting 5 CAPTAINS_MODE matches:
    	matchid	gamemode
    	123112854	SINGLE_DRAFT
    	123112706	SINGLE_DRAFT
    	123112690	SINGLE_DRAFT
    	123112146	SINGLE_DRAFT
    	123111977	CAPTAINS_MODE

  3. #3
    Basic Member adrianlegg's Avatar
    Join Date
    Mar 2012
    Posts
    568
    To be honest I do not recall it ever working, aside from this wiki I saw no reliable source that there even is such field.

    You might as well ask:
    GetMatchHistory/?key=<key>&max_legs_per_team=6

    and it will post same result - as with any unimplemented argument.
    That's why I posted it as feature request.
    You gotta FIGHT!
    For Your RIGHT!
    To BUUUGFIX!

  4. #4
    Basic Member RJackson's Avatar
    Join Date
    Sep 2011
    Posts
    121
    Quote Originally Posted by adrianlegg View Post
    To be honest I do not recall it ever working, aside from this wiki I saw no reliable source that there even is such field.

    You might as well ask:
    GetMatchHistory/?key=<key>&max_legs_per_team=6

    and it will post same result - as with any unimplemented argument.
    That's why I posted it as feature request.
    Parameters for methods are listed via the ISteamWebAPIUtil/GetSupportedAPIList query, which includes game_mode for IDOTA2Match/GetMatchDetails.

    Code:
    {
        "name": "GetMatchHistory",
        "version": 1,
        "httpmethod": "GET",
        "parameters": [
            {
                "name": "hero_id",
                "type": "uint32",
                "optional": true,
                "description": ""
            },
            {
                "name": "game_mode",
                "type": "uint32",
                "optional": true,
                "description": ""
            },
            {
                "name": "skill",
                "type": "uint32",
                "optional": true,
                "description": ""
           },
           {
                "name": "date_min",
                "type": "uint32",
                "optional": true,
                "description": ""
            },
            {
                "name": "date_max",
                "type": "uint32",
                    "optional": true,
                "description": ""
            },
            {
                "name": "min_players",
                "type": "string",
                "optional": true,
                "description": ""
            },
            {
                "name": "account_id",
                "type": "string",
                "optional": true,
                "description": ""
            },
            {
                "name": "league_id",
                "type": "string",
                "optional": true,
                "description": ""
            },
            {
                "name": "start_at_match_id",
                "type": "string",
                "optional": true,
                "description": ""
            },
            {
                "name": "matches_requested",
                "type": "string",
                "optional": true,
                "description": ""
            },
            {
                "name": "tournament_games_only",
                "type": "string",
                "optional": true,
                "description": ""
            }
        ]
    },

  5. #5
    Basic Member adrianlegg's Avatar
    Join Date
    Mar 2012
    Posts
    568
    Thanks, didn't knew that one.
    You gotta FIGHT!
    For Your RIGHT!
    To BUUUGFIX!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •