DOTA2

When an app wants to receive events from the Game Events Provider it needs to set the requested features from the Game Events Provider.
Each feature corresponds to events by that name paired with event info, so for example when an app registers to DOTA events like the following:

overwolf.games.events.setRequiredFeatures(['game_state_changed', 'death'], function(info) {
console.log(info);
});

the app could receive the game_state_changed and death events.

so registering to game events this way:

overwolf.games.events.onNewEvents.addListener(function(info) {
console.log('EVENT FIRED: ' + JSON.stringify(info));
});

will print to the console these lines when the events will be triggered:

EVENT FIRED: {"events":[{"name":"death","data":"{\r\n \"deaths\": \"1\"\r\n}"}]}
EVENT FIRED: {"events":[{"name":"game_state_changed","data":"{\r\n \"game_state\": \"playing\",\r\n \"match_state\": \"DOTA_GAMERULES_STATE_INIT\",\r\n \"match_id\": \"0\",\r\n \"player_steam_id\": \"76561198035324451\"\r\n}"}]}

Sample app

Game id: 7314

Events:

Event Info Trigger Notes
game_state_changed 
  • game_state – One of ‘playing’, ‘idle’ or ‘spectating’. Idle is when there isn’t a game being played or spectated. 
  • match_state – The internal match state. See ‘match_state_changed’ event for more info. 
  • match_id (not available for ‘idle’): The id of the match. 
  • player_steam_id (not available for ‘idle’): The Steam id of the local player.
The user starts playing, spectating or stops playing (no game available to play or spectate). Note that simply bringing the menu is not enough to trigger the ‘idle’ event – the active game (played or spectated) must be closed.  
match_state_changed 

match_state – One of the following:

  • DOTA_GAMERULES_STATE_WAIT_FOR_PLAYERS_TO_LOAD
  • DOTA_GAMERULES_STATE_HERO_SELECTION
  • DOTA_GAMERULES_STATE_PRE_GAME
  • DOTA_GAMERULES_STATE_GAME_IN_PROGRESS
  • DOTA_GAMERULES_STATE_POST_GAME 
The internal game match state has changed.
  • DOTA_GAMERULES_STATE_WAIT_FOR_PLAYERS_TO_LOAD – Shown with the pre-game “Waiting for loaders” screen.

  • DOTA_GAMERULES_STATE_HERO_SELECTION – Shown with the hero selection screen.

  • DOTA_GAMERULES_STATE_PRE_GAME – Shown when the game begins, before the battle horn is heard.

  • DOTA_GAMERULES_STATE_GAME_IN_PROGRESS – Shown with the start game battle horn.

  • DOTA_GAMERULES_STATE_POST_GAME – Shown with the in-game post-game screen.
 

match_detected

 

* Not available at the moment 

  • gameMode – One of the supported game modes. 
  • playersInfo – An array of 10 player infos with the following fields: 
    • faction – Radiant/Dire
    • isLocalPlayer – True if this is the info for the local player, false otherwise.
    • playerIndex – The index of this player (0 – 9, left to right).
    • steamId – The Steam Id of the player.
As soon as 10 players accepted a match (just after the ‘Accept Match’ prompt).  Supported game modes:
  • AllPick
  • AllPickRanked
  • SingleDraft
  • RandomDraft
  • AllRandom
  • LeastPlayed
  • LimitedHeroes
  • CaptainsMode
  • CaptainsDraft
daytime_changed 
  • daytime – True if it is current day time, false otherwise.

  • clock_time – The amount of seconds from when the game clocked shows (0:00). It can be negative during the Pre-Game phase.

  • nightstalker_night – True if it is currently a Night Stalker ultimate night. 
Fired when the game transitions between day time and night time.   
clock_time_changed  Same as ‘map_daytime_changed’.  Fired every second.   
ward_purchase_cooldown_changed 
  • ward_purchase_cooldown – The cooldown, in seconds, until wards are available for purchase again. 
Fired every second where wards are on cooldown.   
match_ended 
  • winner – radiant/dire 
When the game ends (an ancient is destroyed).   
kill 
  • kills – The total number of kiils the player has.

  • kill_streak – The current number of kills without dying to an enemy champion (denying oneself does not reset this counter).

  • label – the type of kill (kill/double_kill/triple_kill/ultra_kill/rampage)
Whenever the player kills an enemy champion.   
assist 
  • assists – The total number of assists the player has. 
Whenever the player assists in a kill of an enemy champion.   
death 
  • deaths – The total number of deaths the player has. 
Whenever the player dies.   
cs 
  • last_hits – The total amount of last hits (not denies) the player has.

  • denies – The total amount of denies the player has.

  • type – last_hist/deny.
Whenever the player last hits/denies non-champion units that grant creep score.   
xpm 
  • xpm – The current XPM. 
Whenever the XPM changes.   
gpm 
  • gpm – The current GPM. 
Whenever the GPM changes.   
gold 
  • gold – The current gold.

  • gold_reliable – The reliable gold part.

  • gold_unreliable – The unreliable gold part.
Whenever the gold changes.   
hero_leveled_up 
  • hero_level – The current hero level. 
Whenever the player levels up.   
hero_respawned N/A Whenever the player respawns. This is also applicable for buying back.  
hero_buyback_info_changed
  • buyback_cost – The gold cost to buyback

  • buyback_cooldown – The cooldown remaining for buyback to become available.
Every 4 seconds and every level up, since the buyback cost is affected by game time and player level. It will also be called every second when buyback is on cooldown.  
hero_boughtback
  • buyback_cooldown – The cooldown remaining for buyback to become available.
Whenever the player buys back.  
hero_health_mana_info
  • health – The current health.

  • max_health – The current maximal health.

  • mana – The current mana.

  • max_mana – The current maximal mana.
Whenever either of the players mana, health, max mana or max health changes.  
hero_status_effect_changed
  • silenced – True if the player is silenced, false otherwise.

  • stunned – True if the player is stunned, false otherwise.

  • disarmed – True if the player is disarmed, false otherwise.

  • magicimmune – True if the player is magic immune, false otherwise.

  • hexed – True if the player is hexed, false otherwise.

  • muted – True if the player is muted, false otherwise.

  • break – True if the player is broken, false otherwise.

  • has_debuff – True if the player is affected by any debuff, false otherwise.
Whenever any of these effects changes.  
hero_attributes_skilled
  • attributes_level – The current level of the player’s attributes.
Whenever the player skills up his attributes.  
hero_ability_skilled
  • slot – The index of the ability slot (0 – 5, left to right)

  • name – The name of the ability.

  • level – The current level of the ability.

  • can_cast – True unless  the ability is not skilled, there’s not enough mana to cast it, the player is silenced, or is on cooldown.

  • passive – True if the ability is passive.

  • ability_active – Unknown, TBD.

  • cooldown – The remaining cooldown until the ability is ready to cast.

  • ultimate – True if the ability is an ultimate ability.
Whenever the player skills up an ability.  
hero_ability_used Same as ‘hero_ability_skilled’ Whenever the player uses an ability.  
hero_ability_cooldown_changed Same as ‘hero_ability_skilled’ Whenever an ability’s remaining cooldown is changed.  
hero_ability_changed Same as ‘hero_ability_skilled’ Whenever an ability’s name changes.  
hero_item_cooldown_changed
  • slot – The index of the item slot (0 – 5, top row from the left to bottom row from the right)

  • location – hero/stash
  • name – The name of the item.

  • passive – True if the item is passive.

  • can_cast – True unless there’s not enough mana to use the item, the player is muted, or when the item is on cooldown. (only when passive = false)

  • cooldown – The remaining cooldown until the item is ready to be used. (only when passive = false)

  • charges – The remaining charges of the item (only when passive = false and where item can be charged)
Whenever an item’s remaining cooldown is changed.  
hero_item_changed
  • slot – The index of the item slot (0 – 5, top row from the left to bottom row from the right)

  • location – hero/stash

  • name – The name of the item.

  • passive – True if the item is passive.

  • can_cast – True unless there’s not enough mana to use the item, the player is muted, or when the item is on cooldown. (only when passive = false)

  • cooldown – The remaining cooldown until the item is ready to be used. (only when passive = false)

  • charges – The remaining charges of the item (only when passive = false and where item can be charged)
Whenever the item name in some hero/stash slot changes. This would mean that swapping items will trigger 2 events, one for each item.  
hero_item_used Same as ‘hero_item_changed’ Whenever an item is used – Essentially this means when the item goes on cooldown.   
hero_item_consumed Same as ‘hero_item_changed’ Whenever an item’s charges decrease.   
hero_item_charged Same as ‘hero_item_changed’ Whenever an item’s charges increase. location is always ‘hero’
Also triggered when item charges are increased due to kills (Bloodstone, Urn of Shadows).

 

Info Updates:

The Game Events Provider keeps an info DB with various information about the game state.
Updates about this information can be received as events by registering an event listener using overwolf.games.events.onInfoUpdates2()
It is also possible to get the current available information using overwolf.games.events.getInfo()

Feature Information
roster
Key Category Values Notes Since Version
players roster

A string holding a JSON array of player objects.

Example:

"[{\"steamId\":\"90071996842377219\",\"name\":\"Alfred Bot\",\"team\":2,\"hero\":43},
{\"steamId\":\"90071996842377217\",\"name\":\"Benjamin Bot\",\"team\":0,\"hero\":0},
...
{\"steamId\":\"90071996842377216\",\"name\":\"Monty Bot\",\"team\":2,\"hero\":47}]"

Player object structure:

{
  "steamId": "steamId string",
  "name": "player name in game",
  "team": teamId,
  "hero": heroId
}

Notes:

  • “teamId” is usually 2 or 3, 0 if still not in team.
  • “heroId” – Heroes IDs (0 if still not picked)
   0.77.3