game

The game namespace contains functions that daochook has either hooked onto, or needed to interact with from within the hook due to either the calling convention being unfriendly with FFI or similar. These are generally wrappers that are just forwarded to Lua, giving addons access to call them.

Functions exposed by this namespace are accessed via the prefix: game.

Functions

get_version_mode

Returns the internal mode enumeration value that was used to read the games client version information.

It is recommended that addons do no use this value as it can change without notice, and the returned value can mean something different in future updates.

1number game.get_version_mode();
Parameter NameTypeDescription
None.
Returns
(number) The version mode enumeration value.

The version mode values that this function can return explains what version information values should be available/populated.

  • 0 - Flags, Major, Minor1, Minor2, Revision, Build
  • 1 - Flags, Major, Minor1, Minor2
  • 2 - Major, Minor1, Minor2
  • 3 - Major, Minor1

get_version_flags

Returns the game clients version flags.

1number game.get_version_flags();
Parameter NameTypeDescription
None.
Returns
(number) The version flags value if available, 0 otherwise.

get_version_major

Returns the game clients version major value.

1number game.get_version_major();
Parameter NameTypeDescription
None.
Returns
(number) The version major value if available, 0 otherwise.

get_version_minor1

Returns the game clients version minor1 value.

1number game.get_version_minor1();
Parameter NameTypeDescription
None.
Returns
(number) The version minor value if available, 0 otherwise.

get_version_minor2

Returns the game clients version minor2 value.

1number game.get_version_minor2();
Parameter NameTypeDescription
None.
Returns
(number) The version minor value if available, 0 otherwise.

get_version_revision

Returns the game clients version revision value.

1number game.get_version_revision();
Parameter NameTypeDescription
None.
Returns
(number) The version revision value if available, 0 otherwise.

get_version_build

Returns the game clients version build value.

1number game.get_version_build();
Parameter NameTypeDescription
None.
Returns
(number) The version build value if available, 0 otherwise.

get_version_id

Returns the daochook internal version id specifier.

It is recommended that addons do no use this value as it can change without notice, and the returned value can mean something different in future updates.

1number game.get_version_id();
Parameter NameTypeDescription
None.
Returns
(number) The version id enumeration value.

The list of values that this function can return are not intended for use by addons. Therefore the list will not be shared publicly. This value is used internally by daochook to tell what client version is running. Addons can determine that information by using the various other get_version_xxx functions. The values this function returns are subject to change without warning, it is not recommended to rely on this function in your addons.


get_game_state

Returns the game state pointer.

1number game.get_game_state();
Parameter NameTypeDescription
None.
Returns
(number) The game state pointer if valid, 0 otherwise.

get_global_value

Calls a game function that is used to get a global numerical value.

1number game.get_global_value(index);
Parameter NameTypeDescription
indexnumberThe value index to return.
Returns
(number) The global numerical value at the given index.

get_entity_index_by_objectid

Calls a game function that is used to get an entity index by its object id.

1number game.get_entity_index_by_objectid(object_id);
Parameter NameTypeDescription
object_idnumberThe entity object id to obtain the index of.
Returns
(number) The entity index on success, -1 otherwise.

get_entity_string

Calls a game function that is used to return an entity related string.

1string game.get_entity_string(table_index, entity_index);
Parameter NameTypeDescription
table_indexnumberThe table index of the string to obtain.
entity_indexnumberThe entity index to obtain the string for.
Returns
(string) The entity string.

The table index values are:

  • 0 - String table that contains entity titles.
  • 1 - Unknown.
  • 2 - Unknown.
  • 3 - String table that contains entity names.
  • 4 - Unknown.

exec_command

Calls the games input command handler, executing the given command.

1game.exec_command(mode, imode, command);
Parameter NameTypeDescription
modenumberThe command mode.
imodenumberThe command input mode.
commandstringThe command string.
Returns
None.

The command mode values are:

  • 0 - The command should be executed as player input.
  • 1 - The command should be executed as a macro.
  • 2 - The command should be executed as the client/system.

The command input mode values are:

  • 0 - The command should be executed as if it was started by pressing Enter.
  • 1 - The command should be executed as if it was started by pressing /.
  • 2 - The command should be executed as if it was started by pressing ].

add_message

Calls the games output message handler, printing the given message to the chat/combat log(s).

1game.add_message(mode, message);
Parameter NameTypeDescription
modenumberThe message mode.
messagestringThe message string.
Returns
None.

recv_packet

Calls the games packet handler function, sending the given packet to the client as if the server sent it.

1game.recv_packet(opcode, packet);
Parameter NameTypeDescription
opcodenumberThe packet opcode.
packettableThe packet data, as a table of bytes.
Returns
None.

send_packet

Calls the games packet send function, sending the given packet to the server as if the client sent it.

1game.send_packet(opcode, packet, parameter);
Parameter NameTypeDescription
opcodenumberThe packet opcode.
packettableThe packet data, as a table of bytes.
parameternumberThe packet parameter.
Returns
None.