Page 4 of 82 FirstFirst ... 2 3 4 5 6 14 54 ... LastLast
Results 31 to 40 of 814

Thread: Dota 2 Match History WebAPI

  1. #31
    Yea, that makes a lot more sense. But, still no real output. This I got back:

    array(21) {
      string(238) ""
      string(23) "text/xml; charset=UTF-8"
      array(0) {
    string(222) "<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE result>
    Still no usable result. Anyone got this to work at all?

    Also this is the url which should work anyway but it isn't:
    Last edited by radonthetyrant; 07-19-2012 at 12:09 AM.

  2. #32
    Basic Member
    Join Date
    Jul 2012
    Quote Originally Posted by Drkirby View Post
    How does the tower status work? Do you turn the number into binary, and each digit corresponds if a tower is up or down?
    That was my first inclination as well. Which values go to which towers is something I haven't figured out yet. (Then again, I haven't tried)

    Here's an XML excerpt retrieved for match ID 691926:
    Forgive my speculation here, as I haven't verified any of this, but once you've converted the relevant values to binary, you end up with something a bit like this:
    Note: I padded the <tower_status_radiant> element value with leading zeroes to match the length of the <tower_status_dire> element. (I justified it by stating that both teams have the same number of buildings, so the length of both these values should be the same.

    Seeing as how each team has three towers in each lane, as well as two towers surrounding their Ancient (giving a total tower count of 11) it seems to coincide with the length of the binary string, as it also has a length of 11. The same principle can be applied to the barracks, as each team has a total of six of them, and the length of the binary strings in those fields just happens to share a length of six characters.

    The next question is: which bits represents which buildings?

  3. #33
    Basic Member
    Join Date
    Oct 2011
    For example:
    Account_id = 42417985

    U need do: DEC to BIN and got 10100001110011111101000001
    Add this to begin: 1000100000000000000000001
    And add 0 between this numbers, until u got 57 numbers, so it will be:
    1000100000000000000000001 000000 10100001110011111101000001
    Later do BIN to DEC and u got profile number: 76561198002683713

  4. #34
    Basic Member
    Join Date
    Jul 2012
    Quote Originally Posted by radonthetyrant View Post
    Yea, that makes a lot more sense. But, still no real output. This I got back:

    Still no usable result. Anyone got this to work at all?

    Also this is the url which should work anyway but it isn't:
    In your Steam Games Library, you should have two entries for DOTA2:

    Dota 2 [AppID: 570]
    Dota 2 Test [AppID: 205790]

    The API call you are making is for the AppID of 205790, which isn't the Dota 2 game that most of us are playing. The result that you're getting back seems to indicate that you haven't played any matches in that version.

    In the next update for the mainstream Dota 2 client, they're adding WebAPI support (at which point you can just find/replace "205790" with "570" and everything should work just fine).

    Until then, you can write code and test it against this API so that you're ready when patch day rolls around!

  5. #35
    Damn how can I be so blind

    Thanks that seems to be solved now

  6. #36
    Basic Member
    Join Date
    Jul 2012
    Here's a quick C# enum I wrote (but haven't checked thoroughly, so excuse any errors I may have made) of the heroes and their HeroID values, to save people some time of typing it out themselves.

    public enum Hero
    	AntiMage = 1,
    	Axe = 2,
    	Bane = 3,
    	Bloodseeker = 4,
    	CrystalMaiden = 5,
    	DrowRanger = 6,
    	Earthshaker = 7,
    	Juggernaut = 8,
    	Mirana = 9,
    	Morphling = 10,
    	Nevermore = 11,
    	PhantomLancer = 12,
    	Puck = 13,
    	Pudge = 14,
    	Razor = 15,
    	SandKing = 16,
    	StormSpirit = 17,
    	Sven = 18,
    	Tiny = 19,
    	VengefulSpirit = 20,
    	Windrunner = 21,
    	Zeus = 22,
    	Kunkka = 23,
    	Lina = 25,
    	Lion = 26,
    	ShadowShaman = 27,
    	Slardar = 28,
    	Tidehunter = 29,
    	WitchDoctor = 30,
    	Lich = 31,
    	Riki = 32,
    	Enigma = 33,
    	Tinker = 34,
    	Sniper = 35,
    	Necrolyte = 36,
    	Warlock = 37,
    	Beastmaster = 38,
    	QueenOfPain = 39,
    	Venomancer = 40,
    	FacelessVoid = 41,
    	SkeletonKing = 42,
    	DeathProphet = 43,
    	PhantomAssassin = 44,
    	Pugna = 45,
    	TemplarAssassin = 46,
    	Viper = 47,
    	Luna = 48,
    	DragonKnight = 49,
    	Dazzle = 50,
    	Rattletrap = 51, Clockwerk = 51, // Listed in the file as Rattletrap, but is called Clockwerk in game.
    	Leshrac = 52,
    	Furion = 53, NaturesProphet = 53, // Listed in the file as Furion, but is called Nature's Prophet in game.
    	Lifestealer = 54,
    	DarkSeer = 55,
    	Clinkz = 56,
    	Omniknight = 57,
    	Enchantress = 58,
    	Huskar = 59,
    	NightStalker = 60,
    	Broodmother = 61,
    	BountyHunter = 62,
    	Weaver = 63,
    	Jakiro = 64,
    	Batrider = 65,
    	Chen = 66,
    	Spectre = 67,
    	AncientApparition = 68,
    	DoomBringer = 69,
    	Ursa = 70,
    	SpiritBreaker = 71,
    	Gyrocopter = 72,
    	Alchemist = 73,
    	Invoker = 74,
    	Silencer = 75,
    	ObsidianDestroyer = 76,
    	Lycan = 77,
    	Brewmaster = 78,
    	ShadowDemon = 79,
    	LoneDruid = 80,
    	ChaosKnight = 81,
    	Meepo = 82,
    	TreantProtector = 83,
    	OgreMagi = 84,
    	Undying = 85,
    	Rubick = 86,
    	Disruptor = 87,
    	NyxAssassin = 88,
    	NagaSiren = 89,
    	KeeperOfTheLight = 90,
    	Wisp = 91,
    	Visage = 92,
    A quick tip for those unaware, you can get the name associated with any enumerated value like so:

    String heroName = Enum.GetName(typeof (Hero), int.Parse("integer value of hero ID goes here"));
    It's rudimentary at best because you can't have spaces or punctuation in the names of enumerated values, but it helps for outputting this data for debugging purposes, at least.

    One last thing: you can forgo the int.Parse if you simply specify an integer to begin with, but I wanted it to be as clear as possible.

  7. #37
    Join Date
    Oct 2011
    Zoid, have you considered exposing the player's match making rating with that interface ?

  8. #38
    Basic Member
    Join Date
    Jul 2012
    For any .NET developers wanting an easy way to get the API responses into a strongly typed object, I would encourage them to look into the XSD.EXE utility provided by Microsoft for generating class definitions directly from XML documents.

    To provide an example of how useful this can be, I have attached a text document (Actually a C# class file with a .txt file extension so be sure to change the file extension if you want to use it) of the auto-generated class file created from the result of the GetMatchDetails API call.

    I made a few minor alterations to the definition; mainly renaming the class and updating the ElementName attribute in the class decorations for easier/cleaner implementation. Before anyone calls me out on editing an automatically generated piece of code, I kept my modifications to an absolute minimum, my only changes were to change the name of the class so that additional classes could be generated as well; the root element of the XML response is "result" and having that as a class name is rather confusing, I believe.

    Attachment: MatchDetail.cs.txt

    To deserialize the XML response directly into an instance of this class, you can use the following snippit of code. It uses generics so this same method can be used to deserialize anything; assuming your input is valid, of course.

    public static T Deserialize<T>(string xml) where T : new()
    	var obj = new T();
    	var read = new StringReader(xml);
    	var serializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());
    	XmlReader reader = new XmlTextReader(read);
    	obj = (T)serializer.Deserialize(reader);
    	return obj;

  9. #39
    Basic Member
    Join Date
    Oct 2011
    Rychard, do u know, how to get public enum Items? Just where i can find, where ID items = item?
    Last edited by Addsky; 07-19-2012 at 02:33 AM.

  10. #40
    Basic Member
    Join Date
    Jul 2012
    Quote Originally Posted by Addsky View Post
    Rychard, do u know, how to get public enum Items?
    If you're asking about how one might go about getting an enumeration of items (and their associated item IDs of course) then the same process can be followed that I used to create the enumeration for the heroes.

    In your steam directory a file exists that has a lot of information about the items in the game, most importantly, their names and IDs.

    This should help you find the file I'm referring to: C:\...<example_path>...\Steam\steamapps\common\dot a 2 beta\dota\scripts\npc\items.txt

    On my computer, Steam is installed in the root directory of the D:\ drive, so the full file path for me is as follows:

    D:\Steam\steamapps\common\dota 2 beta\dota\scripts\npc\items.txt
    Here's a snippit of the first item in that file. The parts that you're likely interested in is the name (in this example, it is "Blink dagger", which is at the beginning between the two lines), and the ID value; in this case, it is "1". This same approach can be used on all the other items in this file to create the enumeration.

    // Blink dagger
    	// General
    	"ID"							"1"														// unique ID number for this item.  Do not change this once established or it will invalidate collected stats.
    	"AbilityName"					"item_blink"
    	// Stats
    	"AbilityCastRange"				"0"
    	"AbilityCastPoint"				"0.0"
    	"AbilityCooldown"				"14.0"
    	"AbilityManaCost"				"75"
    	// Item Info
    	"ItemCost"						"2150"
    	"ItemShopTags"					"teleport"
    	"ItemQuality"					"component"
    	"SideShop"						"1"
    	"InvalidHeroes"					"npc_dota_hero_vengefulspirit;npc_dota_hero_pudge"
    	// Special	
    			"var_type"				"FIELD_INTEGER"
    			"blink_range"			"1200"
    			"var_type"				"FIELD_INTEGER"
    			"blink_damage_cooldown"	"3"
    			"var_type"				"FIELD_INTEGER"
    			"blink_range_clamp"	"960"

    Sorry that I haven't gotten around to this personally, but its on my list of things to do.

Posting Permissions

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