Arcade Hooks

Arcade Hooks

integrate_arcade_match
  • Called from: ArcadeGame.php, just after arena match data has been saved.
  • Purpose: Allows you to use the arena score data variables (read only).
  • Accepts: 1 function name.
  • Sends: $id_match, $user_info['id'], $matchInfo['current_round'], $submit_info['score'], $submit_info['duration'], $submit_info['end_time']
    • $id_match - match id number
    • $user_info['id'] - user id of submitted score
    • $matchInfo['current_round'] - round number
    • $submit_info['score'] - game score
    • $submit_info['duration'] - length of time game was played
    • $submit_info['end_time'] - when the score was submitted


integrate_arcade_score
  • Called from: ArcadeGame.php, just after a game score has been saved.
  • Purpose: Allows you to use the game score data variables (read only).
  • Accepts: 1 function name.
  • Sends: $context['game'], $member, $score
    • $context['game'] - array of game data
    • $member - array of member data (id, name, ip)
    • $score - array of score data (score, duration, endTime)


integrate_arcade_guest
  • Called from: ArcadeGame.php, just after a guest game score has been saved.
  • Purpose: Allows you to use the game score data variables (read only).
  • Accepts: 1 function name.
  • Sends: $context['game'], $submit_info['score']
    • $context['game'] - array of game data
    • $submit_info['score'] - game score


Example usage for adding the above hooks:
add_integration_function('integrate_arcade_match', 'modName_arcade_match');
add_integration_function('integrate_arcade_score', 'modName_arcade_score');
add_integration_function('integrate_arcade_guest', 'modName_arcade_guest');


Example usage for removing the above hooks:
remove_integration_function('integrate_arcade_match', 'modName_arcade_match');
remove_integration_function('integrate_arcade_score', 'modName_arcade_score');
remove_integration_function('integrate_arcade_guest', 'modName_arcade_guest');


Example usage for adding functions to your modification:
Note that functions are provided with arguments which are arrays and/or variables.
You can use var_dump or print_r to see what each array or string contains.

function modName_arcade_match($id_match, $userid, $matchInfo, $score, $duration, $end_time)
{
  // use above arrays & variables as you wish (read only)
}

function modName_arcade_score($game, $member, $score)
{
  // use arrays as you wish (read only)
  // log_error($score['score']);
}

function modName_arcade_guest($game, $score)
{
  // use above array & variable as you wish (read only)
}



Arcade List Of Games Function

Arcade_gameData($conditions)
This function is available which returns an array containing a list of games in the database.
All game data from the arcade_games table is included. The function allows unique query conditions as a string.
The default conditions are: $conditions = 'WHERE enabled=1 ORDER BY id_game DESC';
This function can be called/used in your modification's PHP files.


Arcade Custom Skins & Mobile Skins

Custom skins & mobile skins can be added to SMF arcade via the database and custom source + template files.
Any source files you provide should be located in the "Sources" directory path & any template files should be located in the default theme path.
Language files can be loaded in your source file using the existing SMF loadLanguage() function.
For this feature, you should have the ability to create your own arcade plug-in that writes the necessary data to the table shown below.
Creating custom source files & templates is also your responsibility if you want to use this option.

Database table for adding skins: arcade_skins
Database table for adding mobile skins: arcade_mobile_skins
Structure for both tables:
id_skin, skin_name, skin_source_file, skin_function, admin_function, skin_template, enabled

id_skin is the key column which auto increments when you add a custom skin.

Explanation of columns:
skin_name: name of your skin
skin_source_file: name of custom php file located in ../Sources directory path
skin_function: function being used in your source file (Imo use global $context to store your data for the template)
admin_function: return array of settings available in the arcade admin section
skin_template: name of template file located in ../Themes/default directory path
enabled: 0 or 1 to disable/enable template -> when enabled this will appear as an option in the admin & to your users

Enterprise-A is currently added to the arcade as a hook. You can peruse its setup to get an idea on how to use this feature.


Arcade Custom Lists & Mobile Lists

Custom lists & mobile lists can be added to SMF arcade via the database and custom source + template files.
Any source files you provide should be located in the "Sources" directory path & any template files should be located in the default theme path.
Language files can be loaded in your source file using the existing SMF loadLanguage() function.
For this feature, you should have the ability to create your own arcade plug-in that writes the necessary data to the table shown below.
Creating custom source files & templates is also your responsibility if you want to use this option.

Database table for adding lists: arcade_lists
Database table for adding mobile lists: arcade_mobile_lists
Structure for both tables:
id_list, list_name, list_source_file, list_function, list_template, enabled

id_list is the key column which auto increments when you add a custom list.

Explanation of columns:
list_name: name of your list
list_source_file: name of custom php file located in ../Sources directory path
list_function: function being used in your source file (Imo use global $context to store your data for the template)
list_template: name of template file located in ../Themes/default directory path
enabled: 0 or 1 to disable/enable template -> when enabled this will appear as an option in the admin & to your users


Reporting Bugs
Please report bugs to the Official Support Thread!
This helps make this modification better!

Copyright (c) 2004 - 2012, Niko Pahajoki
Copyright (c) 2015 - 2022, Chen Zhen
Current support provided by Chen Zhen @ web-develop.ca
SMF Arcade License: BSD 2