Dota Parser

CDP – CTS Dota Parser

Update 1.4 (16.8.2010) : 6.68, Switch & Debugging
Update 1.3.1 (1.4.2010) : 6.67 and 6.66 data and images
Update 1.3 (7.1.2010) : 6.65, SP & Debugging
Update 1.2.2 (27.10.2009) : Debugging skilling & 6.64
Update 1.2.1 (8.10.2009) : Handling morphers
Update 1.2 (5.10.2009) : Hero – Player – Skill handling
Update 1.1.3 (10.9.2009) : Ban / Pick duplication bug.
Update 1.1.2 (7.7.2009) : 64 Bit memory / 6.61
Update 1.1.1 (19.6.2009) : Decompression tweak.
Update 1.1 (12.6.2009) : Added 6.60 support.

Discussion at Play Dota Forums.

Download: CDP Latest (Zipped / 1.4)
Sample: Sample Parsed Replay

Patches


Patch 1.1.1 to 1.1.2
Patch 1.1.2 to 1.1.3
Patch 1.1.3 to 1.2
Patch 1.2 to 1.2.1 ( 16 kb )
Patch 1.2.1 to 1.2.2 ( 74 kb )
Patch 1.2.2 to 1.3 ( 469 kb )
Patch 1.3 to 1.3.1 ( 195 kb )
Patch 1.3 to 1.4 ( 274 kb )

About

CDP CTS Dota Parser is an open source Dota Replay parser written in PHP,
meant to be used with WC3 DoTA replays of version 6.59 and higher.

Quick Feature List
  • Supports CM mode and properly lists bans and picks
  • Supports swapping
  • Supports switching
  • Supports shuffle player mode
  • Displays end game statistics that include
    - Hero Kills / Deaths / Assists
    - Creep Kills / Denies
    - Neutrals killed
    – End game gold
    - End game Inventory
    - POTM Arrow Accuracy
    - Pudge Hook Accuracy
  • Tries to automatically determine the winning side
  • Categorizes player’s actions and calculates his APM excluding picking time.
  • Generates time ordered lists of player’s obtained items and learned skills.
  • Displays colored chat
  • XML database of Items, Skills and Heroes.
  • Easy storing and restoring of parsed replay data with php serialization
Installation
  1. Extract the files.
  2. Ensure the structure is as follows:
  3. ./*.php *.css - All the php / css files
    ./maps/*.xml - All the XML data files
    ./images - All the icons
    ./replays - Folder for storing replays and replay info

  4. Make sure the ./replays folder is writable.
Usage

Use the ./upload_reply.php file to upload replays or
write your own interface, using the included
upload_replay.php file as a guide.

All the replays are parsed upon the first view and a
serialized representation of the replay is stored as
a REPLAY_ID.txt file. Upon further viewing the replay
data is only obtained from the serialized object.

All the replays are saved as unix_timestamp.w3g files
while conserving their original name in the $replay->extra
variable, making it possible to let the user download
the replay with the uploader’s original filename.

Credits
  • Julas – Original wc3 php parser
  • rush4hire – Dota port of Jula’s parser
  • esby – 6.56 XML Structure / Data
  • Tedi Rachmadi – Reshine

Old versions:

Changelog:

  1. 1.4 – 16.8.2010
    • Features:

      • 6.68 images / map data
      • Handles new CM mode 3/2 split
      • Added support for Switch
      • Added an AUTO mode for determening the winner, check
        view_replay.php and upload_replay.php to get the idea
        on how to implement it. It works most of the time, only
        fails when the saver leaves unexpectedly or prematurely.
      • Added POTM Arrow Accuracy data (see “Show more” in a replay with potm)
      • Added Pudge Hook Accuracy data (see “Show more” in a replay with pudge)
      • Added Player Leaving information (see “Show more” in a replay)
    • Various:

      • Tweaked leveling and skill level accuracy for duplicated actions non-owned stats skilling.
    • Bugs:

      • Fixed a bug with skilling non-owned or SP mode owned morphing heroes (ie. Batrider, KOTL)
      • Fixed certain wrong skill IDs in 6.67, 6.68 XML files for Panda, Tiny, Leoric, Gorgon, Lanaya, Ursa, Enigma and Doom Bringer
      • Some other minor bugs.
  2. 1.3.1 – 1.4.2010
    • Features:

      • Added 6.67c and 6.66 data and images.
  3. 1.3 – 7.1.2010
    • Features:

      • 6.65 images / map data.
      • Now properly remaps names in SP mode.
    • Various:

      • Added some base code for handling various drafting modes such as CD and CM, but not finished yet due to 6.65′s buggy replay data serving.
    • Bugs:

      • Fixed an issue with SD mode picks before 15sec.
      • Changed all “Batrider (firefly)” names to “Batrider” in 6.60 to 6.65 xml files.
      • Changed all “Flesh Golem” names to “Undying” in 6.59 to 6.65 xml files.
      • Fixed an issue with failed handling of random hero picks in CM mode.
  4. 1.2.2 – 27.10.2009
    • Bugs:

      • Added delayed skilling for handling first skills.
      • Fixed an error caused by 6.64 & skills.
  5. 1.2.1 – 8.10.2009
    • Bugs:

      • Fixed a problem with ‘morphing’ heroes.
  6. 1.2 – 6.10.2009
    • Features:

      • 6.63 images / map data.
    • Various:

      • Recoded the way Hero – Player – Skills are related.
    • Bugs:

      • Fixed various skill assignment bugs.
  7. 1.1.3 – 10.9.2009
    • Bugs:

      • Fixed an issue with duplicated ban / pick packets.
  8. 1.1.2 – 7.7.2009
    • Features:

      • The script now tries to detect the map version and uses the appropriate .xml file from the maps/ folder.
      • Added some config options to tools.php regarding version handling
      • 6.61 – Weaver’s remade ability
    • Various:

      • Disabled download logging by default. (Channged LOG_DOWNLOADS to false in download.php)
    • Cosmetics:

      • Unified player colors.
    • Bugs:

      • Increased memory_limit to work with 64 bit *nix systems.
      • Added some extra level 25 limit detection.
  9. 1.1.1 – 19.6.2009
    • Bugs:

      • Tweaked zlib decompressing to allow parsing of modified replays
  10. 1.1 – 12.6.2009
    • Features:

      • Added 6.60 XML data to the /maps folder
    • Various:

      • Tweaked the JS / HTML display
    • Bugs:

      • Proper parsing for Batrider’s two hero ID internals
      • Fixed Invoker leveling / skills
      • Fixed XML Parser oddities
  11. 1.0 – 27.2.2009
    • Clean up
dota, php, dota replay parser, dota parser, dota php parser, replay php parser, cts, zabkar, seven, 6.60, batrider, invoker, web script, replay script
  • #1 written by SomeOne
    about 2 weeks ago

    AWSOME Seven!! I wish I could really handle .php as good as you :(
    I really want to learn about it… But I can’t find someone who could tutor me… learning from mr.gogo doesn’t result very well ^^;
    Thanks anyway seven, you’re the best! :D

  • #2 written by Fatal error
    about 2 weeks ago

    Fatal error: Call to a member function getName() on a non-object in c:\home\localhost\www\rp\reshine.php on line 720

    $heroName = $GLOBALS['xml_data']->HashMap[$heroId]->getName();

    replace

    if(isset($heroId))
    $heroName = $GLOBALS['xml_data']->HashMap[$heroId]->getName();

  • #3 written by SomeOne
    about 2 weeks ago

    okay, the player switched… but the hero stay o.O
    any idea to fix this??

  • #4 written by SomeOne
    about 2 weeks ago

    wait, no… the player’s wat not switched @.@
    it’s stuck at the same place…
    not moving anywhere… but the hero switched…

  • #5 written by SomeOne
    about 2 weeks ago

    never mind @.@ just fixed it…

  • #6 written by Excellent
    about 2 weeks ago

    Hey, i got some problems here…
    Your codes

    // For handling SWITCH and leave time / result / items and actions
    $this->players[$wc3pid]['time'] = $wc3idToTime[$renamedWC3PlayerID];
    $this->players[$wc3pid]['leave_result'] = $wc3idToLeaveResult[$renamedWC3PlayerID];
    $this->players[$wc3pid]['items'] = $wc3idToItems[$renamedWC3PlayerID];
    $this->players[$wc3pid]['actions_details'] = $wc3idToActionsDetails[$renamedWC3PlayerID];
    $this->players[$wc3pid]['actions'] = $wc3idToActions[$renamedWC3PlayerID];

    This code make the player stuck on the same place when they’re switching…
    So I make it to these

    // For handling SWITCH and leave time / result / items and actions
    $this->player[$wc3pid]['time'] = $wc3idToTime[$renamedWC3PlayerID];
    $this->player[$wc3pid]['leave_result'] = $wc3idToLeaveResult[$renamedWC3PlayerID];
    $this->player[$wc3pid]['items'] = $wc3idToItems[$renamedWC3PlayerID];
    $this->player[$wc3pid]['actions_details'] = $wc3idToActionsDetails[$renamedWC3PlayerID];
    $this->player[$wc3pid]['actions'] = $wc3idToActions[$renamedWC3PlayerID];

    By erasing the S from Players it worked for switching, but ruining the whole SP system… Can you help me on how to fix this??

  • #7 written by SomeOne
    about 2 weeks ago

    Warning: Invalid argument supplied for foreach() in /home/a7858869/public_html/view_replay.php on line 357

  • #8 written by VioleN
    about 2 weeks ago

    Can you make the replays commentable?

  • #9 written by Seven
    about 2 weeks ago


    SomeOne:

    Warning: Invalid argument supplied for foreach() in /home/a7858869/public_html/view_replay.php on line 357

    Can you upload or send the replay please.

    @VioleN:
    Sorry but no, I’m focusing on the core parser, while the front-end is up to individual implementations.

  • #10 written by Excellent
    about 2 weeks ago

    @Seven
    Sorry, I think it was a false alarm… it only happens when the hero pick no skill at all… Anyway, how to fix excellent problem?? I was wandering about it also…

  • #11 written by Excellent
    about 2 weeks ago

    “okay, the player switched… but the hero stay o.O
    any idea to fix this??”

    i got a dead end T.T

  • #12 written by Excellent
    about 2 weeks ago

    when the player switched place, the hero also need to be switch, any idea how to fix this?

  • #13 written by Farman Ahmed
    about 2 weeks ago

    how can i make an html page of the parser plz give me any tutorial

  • #14 written by Farman Ahmed
    about 2 weeks ago

    hey how to merge it with the html file i want to add some google ads and my template

  • #15 written by hello
    about 2 weeks ago

    hello

    i come from china

    can you make a index that preview all the uploaded replays?

    i think the upload_replay.php is not fit for index.

    add a search function on the index will help so much.

    thank you for your work

  • #16 written by Excellent
    about 2 weeks ago

    @Hello:
    Just copy paste your upload_replay.php and rename it to index, keep your upload_replay.php file in the folder though… It will do…

  • #17 written by hello
    about 1 week ago

    i meant that can you give a page to view all uploaded replays?

  • #18 written by hello
    about 1 week ago
  • #19 written by Flayra
    about 1 week ago

    I was wondering where you get the XML data from. I know you can export it through various tools from the map, but do you maintain the .xml files included with CDP yourself or get them somewhere else?

  • #20 written by Help me
    about 1 week ago

    MY Parser no Upload in MODE -cm

  • #21 written by hello
    about 1 week ago

    i think use mysql as database will enhance this program.

    only file (.txt) will cause problem.

    some advice.

  • #22 written by Excellent
    about 1 week ago

    it took years for me to open your link…
    toying around with this part might help…
    <?php
    if( $print_info ) {
    echo ('

    Compact replay info

    ‘);
    $replay->print_team_heroes(0);

    echo (‘
    extra['original_filename'].’” style=”display: inline;”> »   Download «
    » More Info «
    ‘);
    $replay->print_team_heroes(1);
    echo (‘

    ‘);
    }
    ?>

    if you could modify it to show all the replays you have in your folder i think it’ll work o.O
    (I’m only a newbie, can’t give an advanced tips, and my advice is not guaranteed >.<)

  • #23 written by Excellent
    about 1 week ago

    Seven, can you e-mail me? Someone would like to use your parser for a pretty big gaming community… but, with extra features…

  • #24 written by Excellent
    about 1 week ago

    mail it to fxsavaz@yahoo.com

  • #25 written by SolariiS
    about 1 week ago

    Exist a bug on -CM mode, no parse this on 68c

    fix this :D

    good work

  • #26 written by Farman Ahmed
    about 6 days ago

    Hey there, Excellent
    I am really confused to see my replays in their orignal name…
    And the folder of replays where they are saved, i wanted to see as one list of replay folder with their orignal names.

    can u send me the file to my email address
    farman_ahmed2007@hotmail.com