Skip to content

GameRules

The GameRules namespace provides access to match timing, game state, hero and item key-values, and quick-buy helpers.


Functions

GetPointer()DataView | null

Retrieves the pointer.

Returned:

  • DataView | null - The matching object, or null if it is not available.

GetDayTimeStart()number

Retrieves the day time start.

Returned:

  • number - The requested day time start.

GetNightTimeStart()number

Retrieves the night time start.

Returned:

  • number - The requested night time start.

IsDayTime()boolean

Checks whether it is day time.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetNetTimeOfDay()number

Retrieves the net time of day.

Returned:

  • number - The requested net time of day.

GetTickCount()number

Retrieves the tick count.

Returned:

  • number - The requested tick count.

GetItemKeyValue(itemName: string)KeyValue | null

Retrieves the item key value.

  • itemNamestring - The item name.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

GetItemCost(itemName: string)number

Retrieves the item cost.

  • itemNamestring - The item name.

Returned:

  • number - The requested item cost.

GetItemId(itemName: string)number

Retrieves the item id.

  • itemNamestring - The item name.

Returned:

  • number - The requested item id.

GetHeroKeyValue(heroName: string)KeyValue | null

Retrieves the hero key value.

  • heroNamestring - The hero name.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

GetHeroKeyValueById(heroId: number)KeyValue | null

Retrieves the hero key value by id.

  • heroIdnumber - The hero id.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

GetHeroesKeyValue()KeyValue | null

Retrieves the heroes key value.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

SelectItemInShop(itemName: string)void

Provides access to select item in shop.

  • itemNamestring - The item name.

SetItemToQuickBuy(itemName: string)void

Sets the item to quick buy.

  • itemNamestring - The item name.

AddItemToQuickBuy(itemName: string)void

Adds the item to quick buy.

  • itemNamestring - The item name.

ClearQuickBuy()void

Clears the quick buy.


IsHeroAvailableByName(name: string)boolean

Checks whether it is hero available by name.

  • namestring - The name.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetStateTransitionTime()number

Retrieves the state transition time.

Returned:

  • number - The requested state transition time.

CanPurchaseItem(name: string)boolean

Checks whether it can purchase item.

  • namestring - The name.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetRiverType(type: number)void

Sets the river type.

  • typenumber - The type.

GetServerGameState()number

Retrieves the server game state.

Returned:

  • number - The requested server game state.

GetGameState()Enum.GameState

Retrieves the game state.

Returned:


GetGameMode()number

Retrieves the game mode.

Returned:

  • number - The requested game mode.

GetPreGameStartTime()number

Retrieves the pre game start time.

Returned:

  • number - The requested pre game start time.

GetGameStartTime()number

Retrieves the game start time.

Returned:

  • number - The requested game start time.

GetGameEndTime()number

Retrieves the game end time.

Returned:

  • number - The requested game end time.

GetGameLoadTime()number

Retrieves the game load time.

Returned:

  • number - The requested game load time.

GetGameTime()number

Retrieves the game time.

Returned:

  • number - The requested game time.

IsPaused()boolean

Checks whether it is paused.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsTemporaryDay()boolean

Checks whether it is temporary day.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsTemporaryNight()boolean

Checks whether it is temporary night.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsNightstalkerNight()boolean

Checks whether it is nightstalker night.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsActiveGame()boolean

Checks whether it is active game.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetMatchID()bigint

Retrieves the match id.

Returned:

  • bigint - The requested match id.