Skip to content
Kevin Lu edited this page Sep 29, 2019 · 1 revision

group OCGAPI_DuelCreateDestroy {#group___o_c_g_a_p_i___duel_create_destroy}

Summary

Members Descriptions
enum OCG_DuelCreationStatus
public OCGAPI int OCG_CreateDuel(OCG_Duel * duel,OCG_DuelOptions options) Creates a new duel simulation with the specified options and saves the pointer in duel.
public OCGAPI void OCG_DestroyDuel(OCG_Duel duel) Deallocates the duel instance created by OCG_CreateDuel.
public OCGAPI void OCG_DuelNewCard(OCG_Duel duel,OCG_NewCardInfo info) Add the card specified by info to the duel.
public OCGAPI void OCG_StartDuel(OCG_Duel duel) Start the duel simulation and state machine. Call this after all options and cards for the duel have been loaded.
struct OCG_CardData
struct OCG_Player
struct OCG_DuelOptions
struct OCG_NewCardInfo

Members

enum OCG_DuelCreationStatus {#group___o_c_g_a_p_i___duel_create_destroy_1gab23f5e358acb760334db1c7398ef434b}

Values Descriptions
OCG_DUEL_CREATION_SUCCESS
OCG_DUEL_CREATION_NO_OUTPUT
OCG_DUEL_CREATION_NOT_CREATED
OCG_DUEL_CREATION_NULL_DATA_READER
OCG_DUEL_CREATION_NULL_SCRIPT_READER

public OCGAPI int OCG_CreateDuel(OCG_Duel * duel,OCG_DuelOptions options) {#group___o_c_g_a_p_i___duel_create_destroy_1ga1dbbb0cafee1fa820ba62ab8b98d565f}

Creates a new duel simulation with the specified options and saves the pointer in duel.

Returns

OCG_DuelCreationStatus enum values

public OCGAPI void OCG_DestroyDuel(OCG_Duel duel) {#group___o_c_g_a_p_i___duel_create_destroy_1ga81d669dc24c1a83784bb6041b3a92ff3}

Deallocates the duel instance created by OCG_CreateDuel.

public OCGAPI void OCG_DuelNewCard(OCG_Duel duel,OCG_NewCardInfo info) {#group___o_c_g_a_p_i___duel_create_destroy_1ga1a1cd401a6177d1859a4f2f0a8f8ee4f}

Add the card specified by info to the duel.

public OCGAPI void OCG_StartDuel(OCG_Duel duel) {#group___o_c_g_a_p_i___duel_create_destroy_1ga4fb44ad4dd31000c00cc28e0612e86b0}

Start the duel simulation and state machine. Call this after all options and cards for the duel have been loaded.

struct OCG_CardData {#struct_o_c_g___card_data}

Summary

Members Descriptions
public uint32_t code
public uint32_t alias
public uint64_t setcode
public uint32_t type
public uint32_t level
public uint32_t attribute
public uint32_t race
public int32_t attack
public int32_t defense
public uint32_t lscale
public uint32_t rscale
public uint32_t link_marker

Members

public uint32_t code {#struct_o_c_g___card_data_1a52a633b4d25e4ea0f016cf72e022fbba}

public uint32_t alias {#struct_o_c_g___card_data_1a2cefc1db4deccd1502bcb078ec544143}

public uint64_t setcode {#struct_o_c_g___card_data_1a2d3b51455214c799e5abd1823c73eb34}

public uint32_t type {#struct_o_c_g___card_data_1a284ff2fa323bd557ed1b2a381f1b0c4a}

public uint32_t level {#struct_o_c_g___card_data_1a6149e519d6cb6536cbae26883938e7f8}

public uint32_t attribute {#struct_o_c_g___card_data_1a75db6013d9006e738e567424603a9436}

public uint32_t race {#struct_o_c_g___card_data_1aa19721ceda2cb24b14e852414dc77c32}

public int32_t attack {#struct_o_c_g___card_data_1a61bd98c39074ccd98d3dd36a1ca75e54}

public int32_t defense {#struct_o_c_g___card_data_1a457918ebc3d8860dab1129fd2a6557ab}

public uint32_t lscale {#struct_o_c_g___card_data_1a9d7c1980e79e8380d33b9db15e02dcc1}

public uint32_t rscale {#struct_o_c_g___card_data_1a86da396370c39a97f06ca9428f8f9cff}

public uint32_t link_marker {#struct_o_c_g___card_data_1ac3ec89bc963bf13906f7a9e8195f1f5b}

struct OCG_Player {#struct_o_c_g___player}

Summary

Members Descriptions
public int startingLP
public int startingDrawCount
public int drawCountPerTurn

Members

public int startingLP {#struct_o_c_g___player_1a642174553316d0c385c24988752f0b45}

public int startingDrawCount {#struct_o_c_g___player_1a1ba77b8810ee744f1803606ab22412a9}

public int drawCountPerTurn {#struct_o_c_g___player_1a8be28e09999b44261dbced0e18119c35}

struct OCG_DuelOptions {#struct_o_c_g___duel_options}

Summary

Members Descriptions
public uint32_t seed
public int flags
public OCG_Player team1
public OCG_Player team2
public OCG_DataReader cardReader
public void * payload1
public OCG_ScriptReader scriptReader relayed to cardReader
public void * payload2
public OCG_LogHandler logHandler relayed to scriptReader
public void * payload3

Members

public uint32_t seed {#struct_o_c_g___duel_options_1a18d13b725eb82e9eab2dfc2daee7b3ed}

public int flags {#struct_o_c_g___duel_options_1a1173f7cbeed523594d524c1289da5c25}

public OCG_Player team1 {#struct_o_c_g___duel_options_1a18c7c6744b3d5264f8fea7668ba2970f}

public OCG_Player team2 {#struct_o_c_g___duel_options_1af855df765722043c5b6760d2c30f9a2c}

public OCG_DataReader cardReader {#struct_o_c_g___duel_options_1a58f3157f220df2abe30b62fb46aa28aa}

public void * payload1 {#struct_o_c_g___duel_options_1ab32cc08dad0ce23bf71604ce5d2eac96}

public OCG_ScriptReader scriptReader {#struct_o_c_g___duel_options_1adb7687c42a387e447e5fa4be499397a7}

relayed to cardReader

public void * payload2 {#struct_o_c_g___duel_options_1a7aab91fb244f8674b46cfde074398b09}

public OCG_LogHandler logHandler {#struct_o_c_g___duel_options_1aec6800bac7f12fc0336b809b386acf96}

relayed to scriptReader

public void * payload3 {#struct_o_c_g___duel_options_1a37f9ff8de9cc592e449efb311f17c93a}

struct OCG_NewCardInfo {#struct_o_c_g___new_card_info}

Summary

Members Descriptions
public uint8_t team
public uint8_t duelist either 0 or 1
public uint32_t code index of original owner
public uint8_t con
public uint32_t loc
public uint32_t seq
public uint32_t pos

Members

public uint8_t team {#struct_o_c_g___new_card_info_1aa3b4eec20e20fb473cf77c0b80021f10}

public uint8_t duelist {#struct_o_c_g___new_card_info_1a961dcea0ccb6fc54dcedb44ad8e93d72}

either 0 or 1

public uint32_t code {#struct_o_c_g___new_card_info_1a32157704277b6cc54ae6cbd900e1a1ff}

index of original owner

public uint8_t con {#struct_o_c_g___new_card_info_1a4c5c11d0f52f3ad0c1c8315363e1c0f0}

public uint32_t loc {#struct_o_c_g___new_card_info_1a14bb605f8f8ceebd7a3c0fc8cf02fef9}

public uint32_t seq {#struct_o_c_g___new_card_info_1a9d3edbc159487ed240988f8e236e3091}

public uint32_t pos {#struct_o_c_g___new_card_info_1a91d16a0be15b428372debe96bd913083}

group OCGAPI_DuelProcess {#group___o_c_g_a_p_i___duel_process}

Summary

Members Descriptions
enum OCG_DuelStatus
public OCGAPI int OCG_DuelProcess(OCG_Duel duel) Runs the state machine to start the duel or after a waiting state requiring a player response. Returns are OCG_DuelStatus enum values.
public OCGAPI void * OCG_DuelGetMessage(OCG_Duel duel,uint32_t * length) The main interface to the simulation. Returns a pointer to the internal buffer containing all messages from the duel simulation. Subsequent calls invalidate previous buffers, so make a copy! The size of the buffer is written to length if it's not NULL.
public OCGAPI void OCG_DuelSetResponse(OCG_Duel duel,void * buffer,uint32_t length) Sets the next player response for the duel simulation. Subsequent calls overwrite previous responses if not processed.
public OCGAPI int OCG_LoadScript(OCG_Duel duel,const char * buffer,uint32_t length,const char * name) Load a Lua card script or supporting script for the specified duel.

Members

enum OCG_DuelStatus {#group___o_c_g_a_p_i___duel_process_1ga58d0bf5681450f5aefd13705244ab24d}

Values Descriptions
OCG_DUEL_STATUS_END
OCG_DUEL_STATUS_AWAITING
OCG_DUEL_STATUS_CONTINUE

public OCGAPI int OCG_DuelProcess(OCG_Duel duel) {#group___o_c_g_a_p_i___duel_process_1ga4d99e1d305998f0e6a8210b97bd3e7d9}

Runs the state machine to start the duel or after a waiting state requiring a player response. Returns are OCG_DuelStatus enum values.

Returns

OCG_DUEL_STATUS_END Duel ended

Returns

OCG_DUEL_STATUS_AWAITING Player response required

Returns

OCG_DUEL_STATUS_CONTINUE

public OCGAPI void * OCG_DuelGetMessage(OCG_Duel duel,uint32_t * length) {#group___o_c_g_a_p_i___duel_process_1ga1cb53ca8b109e7f3862c15632ae44673}

The main interface to the simulation. Returns a pointer to the internal buffer containing all messages from the duel simulation. Subsequent calls invalidate previous buffers, so make a copy! The size of the buffer is written to length if it's not NULL.

MESSAGE STRUCTURE TODO

public OCGAPI void OCG_DuelSetResponse(OCG_Duel duel,void * buffer,uint32_t length) {#group___o_c_g_a_p_i___duel_process_1ga5384ae650fa580c1d0cc6dfae989364b}

Sets the next player response for the duel simulation. Subsequent calls overwrite previous responses if not processed.

Parameters

  • buffer Pointer to player response message

  • length Size of buffer

RESPONSE STRUCTURE TODO

public OCGAPI int OCG_LoadScript(OCG_Duel duel,const char * buffer,uint32_t length,const char * name) {#group___o_c_g_a_p_i___duel_process_1ga87c125341d04f50c8cda1bb651c7cdd3}

Load a Lua card script or supporting script for the specified duel.

Parameters

  • buffer Lua script code

  • length Size of buffer

  • name Unique identifier of the script

Returns

Positive on success, zero on failure

group OCGAPI_DuelQuery {#group___o_c_g_a_p_i___duel_query}

Summary

Members Descriptions
public OCGAPI uint32_t OCG_DuelQueryCount(OCG_Duel duel,uint8_t team,uint32_t loc) Returns the number of cards in the specified zone.
public OCGAPI void * OCG_DuelQuery(OCG_Duel duel,uint32_t * length,OCG_QueryInfo info) Returns a pointer to an internal buffer for the FIRST card matching the query. The size of the buffer is written to length if it's not NULL. Subsequent calls invalidate previous queries.
public OCGAPI void * OCG_DuelQueryLocation(OCG_Duel duel,uint32_t * length,OCG_QueryInfo info) Returns a pointer to an internal buffer for the ALL cards matching the query. The size of the buffer is written to length if it's not NULL. Subsequent calls invalidate previous queries.
public OCGAPI void * OCG_DuelQueryField(OCG_Duel duel,uint32_t * length) Returns a pointer to an internal buffer containing card counts for every zone in the game. The size of the buffer is written to length if it's not NULL. Subsequent calls invalidate previous queries.
struct OCG_QueryInfo

Members

public OCGAPI uint32_t OCG_DuelQueryCount(OCG_Duel duel,uint8_t team,uint32_t loc) {#group___o_c_g_a_p_i___duel_query_1ga3475bee13c188c0215d9c28804fffcd2}

Returns the number of cards in the specified zone.

public OCGAPI void * OCG_DuelQuery(OCG_Duel duel,uint32_t * length,OCG_QueryInfo info) {#group___o_c_g_a_p_i___duel_query_1gad7f296aaddaf047f18a76801356be09a}

Returns a pointer to an internal buffer for the FIRST card matching the query. The size of the buffer is written to length if it's not NULL. Subsequent calls invalidate previous queries.

public OCGAPI void * OCG_DuelQueryLocation(OCG_Duel duel,uint32_t * length,OCG_QueryInfo info) {#group___o_c_g_a_p_i___duel_query_1ga96b702a77a8b8fc9eb89a7fa36957ad7}

Returns a pointer to an internal buffer for the ALL cards matching the query. The size of the buffer is written to length if it's not NULL. Subsequent calls invalidate previous queries.

public OCGAPI void * OCG_DuelQueryField(OCG_Duel duel,uint32_t * length) {#group___o_c_g_a_p_i___duel_query_1gaddf051ce3f56df097e6bbd33e2fa9c91}

Returns a pointer to an internal buffer containing card counts for every zone in the game. The size of the buffer is written to length if it's not NULL. Subsequent calls invalidate previous queries.

struct OCG_QueryInfo {#struct_o_c_g___query_info}

Summary

Members Descriptions
public uint32_t flags
public uint8_t con
public uint32_t loc
public uint32_t seq
public uint32_t overlay_seq

Members

public uint32_t flags {#struct_o_c_g___query_info_1a975bdfb96e75b8a71635e1d7e0274c36}

public uint8_t con {#struct_o_c_g___query_info_1a8db92766afdaa19c1dded80a2458563a}

public uint32_t loc {#struct_o_c_g___query_info_1a991f60fa6d729b5cdb4bea467f978612}

public uint32_t seq {#struct_o_c_g___query_info_1adac867c78a376f5619f389f7aa42df8e}

public uint32_t overlay_seq {#struct_o_c_g___query_info_1adc04dd0785f5bb9315e876ea22a941b7}

Clone this wiki locally