📜GameRules

Table to work with GameRules.

GetServerGameState(): Enum.GameState

Returns the current server game state.


GetGameState(): Enum.GameState

Returns the current game state.


GetGameMode(): Enum.GameMode

Returns the current game mode.


GetPreGameStartTime(): number

Pregame time is the time before the game starts, e.g. ban phase, pick time.

Returns pregame duration or 0 if now is pregame time.


GetGameStartTime(): number

Game start time is 0:00 on ingame timer.

Returns game start time duration or 0 if game is not start yet.


GetGameEndTime(): number

Returns game end time or 0 if game is not end yet.


GetGameLoadTime(): number

No idea what this function does. Returns 0 in all cases what I've tested.


GetGameTime(): number

Can be used to calculate time in an in-game timer. See the example.

Returns the current game time. Starts counting from pregame state.

Example

local game_time = GameRules.GetGameTime();
local ingame_timer = game_time - GameRules.GetGameStartTime();
Log.Write(string.format("Current time: %d:%02d", math.floor(ingame_timer / 60),
math.floor(ingame_timer % 60)))

IsPaused(): boolean

Returns true if game is paused.


IsTemporaryDay(): boolean

Example: Phoenix's Supernova.

Returns true if it's temporary day.


IsTemporaryNight(): boolean

Example: Luna's Eclipse.

Returns true if it's temporary night.


IsNightstalkerNight(): boolean

Returns true if it's nightstalker's night.


GetMatchID(): integer

Returns current match id.


GetLobbyID(): integer

Returns current lobby id.


GetGoodGlyphCD(): number

Could be less than current game time if glyph is already available.

Returns game time when next radiant glyph will be available.


GetBadGlyphCD(): number

Could be less than current game time if glyph is already available.

Returns game time when next dire glyph will be available.


GetGoodScanCD(): number

Could be less than current game time if scan is already available.

Returns game time when next radiant scan will be available.


GetBadScanCD(): number

Could be less than current game time if scan is already available.

Returns game time when next dire scan will be available.


GetGoodScanCharges(): integer

Returns current radiant scan charges.


GetGoodScanCharges(): integer

Returns current dire scan charges.


GetStockCount(item_id: integer): integer

Item id can be found in `assets/data/items.json` file in cheat folder.

Name
Type
Description

item_id

integer

Returns amount of remaining items in shop by item id.

Example

-- "item_ward_observer": {
--     "ID": "42",
Log.Write("Observers available: " .. GameRules.GetStockCount(42))

GetNextCycleTime(): number, boolean

Return time remaining to the next cycle.


GetDaytimeStart(): number

Returns day start time. To work with it use GameRules.GetTimeOfDay


GetNighttimeStart(): number

Returns night start time. To work with it use GameRules.GetTimeOfDay


GetTimeOfDay(): number

Returns current time of day time.


IsInBanPhase(): boolean

Returns true if game is in ban phase.


GetAllDraftPhase(): integer

Returns index of the current draft phase.


IsAllDraftPhaseRadiantFirst(): boolean

Returns true if Radiant picks first.


GetDOTATime(pregame [?]: boolean, negative [?]: boolean): number

Name
Type
Description

pregame [?]

boolean

If true includes pregame time. (default: false)

negative [?]

boolean

If true includes negative time. (default: false)

Returns the actual DOTA in-game clock time.


GetLobbyObjectJson(): string|nil

Returns CSODOTALobby protobuf object as JSON string.


GetBannedHeroes(): integer[]|nil

Returns zero-based array of banned heroes where index corresponds to the player id.


GetStateTransitionTime(): number

Returns time remaining between state changes.

Last updated