Class: CatalogManager
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| lib/tocs/CatalogManager.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This class handles catalog & module rights management.
Class Method Registry
Item
Attributes
extract_module_information(row) → Hash
-
get_dev_module_team(client, mid) → Hash
-
get_mdk_modules_available(client, uid) → Array<Hash>
-
get_module_info(client, mid) → Array<Hash>
-
get_module_list(client) → Array<Hash>
-
get_modules_available(client, uid) → Array<Hash>
-
get_my_mdk_modules(client, uinfo) → Array<Hash>
-
get_my_modules(client, uinfo) → Array<Hash>
-
mdk_set_development_editor(client, uinfo, mid, deid) → String
-
Class Method Details
This class method extracts a game module's associated information from its database record.
Parameters:
- row [Hash] — a hash containing data read from TocsCatalog
Returns:
- [Hash] — the module's information
get_dev_module_team(client, mid) → Hash
This class method returns a list all game modules with associated information.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
Returns:
- [Hash] — list of users assigned to the module's development team
get_mdk_modules_available(client, uid) → Array<Hash>
This class method returns a list of a user's modules with associated game and scenario information.
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's ID
Returns:
- [Array<Hash>] — list of the modules the user has rights to with associated game and scenario information
get_module_info(client, mid) → Array<Hash>
This class method returns a list all game modules with associated information.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
Returns:
- [Array<Hash>] — list of all game modules with associated information
get_module_list(client) → Array<Hash>
This class method returns a list all game modules with associated information.
Parameters:
- client [CoreService::Client] — the database connection
Returns:
- [Array<Hash>] — list of all game modules with associated information
get_modules_available(client, uid) → Array<Hash>
This class method returns a list of a user's modules with associated game and scenario information.
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's ID
Returns:
- [Array<Hash>] — list of the modules the user has rights to with associated game and scenario information
get_my_mdk_modules(client, uinfo) → Array<Hash>
This class method returns a list of a user's modules with associated game and scenario information.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
Returns:
- [Array<Hash>] — list of the modules the user has rights to with associated game and scenario information
get_my_modules(client, uinfo) → Array<Hash>
This class method returns a list of a user's modules with associated game and scenario information.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
Returns:
- [Array<Hash>] — list of the modules the user has rights to with associated game and scenario information
mdk_set_development_editor(client, uinfo, mid, deid) → String
This class method allows a module development editor to set a new module development editor.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- mid [String] — the module id
- deid [String] — the new development editor's UID
Returns:
- [String] — the outcome of the operation
Class: CatalogService ← CoreService
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| services/tocs/CatalogService.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This module is responsible for defining the CatalogService API to the outside world.
Constructor Registry
Item
Attributes
new(crux_env)
-
Method Registry
Item
Attributes
get_dev_module_team(ipaddr, input) → Hash
<crux-service>
get_mdk_modules_available(ipaddr, input) → Hash
<crux-service>
get_module_info(ipaddr, input) → Hash
<crux-service>
get_module_list(ipaddr, input) → Hash
<crux-service>
get_modules_available(ipaddr, input) → Hash
<crux-service>
get_my_mdk_modules(ipaddr, input) → Hash
<crux-service>
get_my_modules(ipaddr, input) → Hash
<crux-service>
mdk_set_development_editor(ipaddr, input) → Hash
<crux-service>
Constructor Details
new(crux_env)
This class constructor simply calls the CoreService constructor to set up logging and other common service routines.
Parameters:
- crux_env [Hash] — The Crux service handler environment
- :db_info [Hash] — Database connection information used to establish MySQL database connections
- :host [String] — The hostname of the server hosting the SQL database
- :username [String] — the username of the login credentials for access the SQL databases
- :password [String] — the password of the login credentials for access the SQL databases
- :database [String] — the name of the database to be accesses, differentiated by the is_development value
- :logdir [String] — The desired location of service handler log files
- :repository [String] — The location of service handler modules
- :contracts [String] — The location of service handler contract modules
- :isdev [Boolean] — true if the service is running in a development environment (vs. production)
Method Details
get_dev_module_team(ipaddr, input) → Hash <crux-service>
This method is used to get the the game modules, and associate game box info, for modules the user has rights to
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getDevModuleTeam: { url: '/t/catalog/get_dev_module_team', params: [ 'mid' ] },
})
…
crux.call('getDevModuleTeam', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- list [Hash] — the list of the members of the development team, mapped as uid->username
get_mdk_modules_available(ipaddr, input) → Hash <crux-service>
This method is used to get the list of game modules that a user has development rights to.
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMdkModulesAvailable: { url: '/t/catalog/get_mdk_modules_available', params: [ 'uid' ] },
})
…
crux.call('getMdkModulesAvailable', uid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules the user has development rights to
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
- copyright [String] — the module's copyright
- designers [String] — the module's designers
- framework [String] — the module's framework
- developers [String] — the module's developers
- development_team [Array<String>] — a list of the module's development team, by UID
- development_editor [String] — the module's development editor, by UID
- development_version [String] — the module's development version
get_module_info(ipaddr, input) → Hash <crux-service>
This method is used to get the list of game modules
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getModuleInfo: { url: '/t/catalog/get_module_info', params: [ 'mid' ] },
})
…
crux.call('getModuleInfo', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- info [Hash] — the module's information
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
get_module_list(ipaddr, input) → Hash <crux-service>
This method is used to get the list of game modules
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getModuleList: { url: '/t/catalog/get_module_list', params: [ ] },
})
…
crux.call('getModuleList', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules with associated information
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
get_modules_available(ipaddr, input) → Hash <crux-service>
This method is used to get the list of game modules that a user has rights to.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getModulesAvailable: { url: '/t/catalog/get_modules_available', params: [ 'uid' ] },
})
…
crux.call('getModulesAvailable', uid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules the user has rights to
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
- copyright [String] — the module's copyright
- designers [String] — the module's designers
- framework [String] — the module's framework
- developers [String] — the module's developers
- development_team [Array<String>] — a list of the module's development team, by UID
- development_editor [String] — the module's development editor, by UID
- development_version [String] — the module's development version
get_my_mdk_modules(ipaddr, input) → Hash <crux-service>
This method is used to get the list of game modules that the logged in user has development rights to.
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMyMdkModules: { url: '/t/catalog/get_my_mdk_modules', params: [ ] },
})
…
crux.call('getMyMdkModules', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules the user has development rights to
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
- copyright [String] — the module's copyright
- designers [String] — the module's designers
- framework [String] — the module's framework
- developers [String] — the module's developers
- development_team [Array<String>] — a list of the module's development team, by UID
- development_editor [String] — the module's development editor, by UID
- development_version [String] — the module's development version
get_my_modules(ipaddr, input) → Hash <crux-service>
This method is used to get the list of game modules that the logged in user has rights to.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMyModules: { url: '/t/catalog/get_my_modules', params: [ ] },
})
…
crux.call('getMyModules', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules the user has rights to
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
- copyright [String] — the module's copyright
- designers [String] — the module's designers
- framework [String] — the module's framework
- developers [String] — the module's developers
- development_team [Array<String>] — a list of the module's development team, by UID
- development_editor [String] — the module's development editor, by UID
- development_version [String] — the module's development version
mdk_set_development_editor(ipaddr, input) → Hash <crux-service>
This method lets a module development editor set a new development editor of a game module under development.
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
mdkSetDevelopmentEditor: { url: '/t/catalog/mdk_set_development_editor', params: [ 'mid','deid' ] },
})
…
crux.call('mdkSetDevelopmentEditor', mid, deid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
- deid [String] — the new development editor's UID
Returns:
- [Hash] — the result of the service call
- outcome [String] — the result of the attempted creation, which is one of { 'success', 'module-not-found', 'module-not-under-development', 'not-development-editor', 'not-on-development-team' }
Class: GameManager
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| lib/tocs/GameManager.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This class handles game session management.
Class Method Registry
Item
Attributes
abandon_game(client, uinfo, gsid) → String
-
accept_invitation(client, uinfo, iid, preferred) → String
-
cancel_invitation(client, uinfo, iid) → String
-
decline_invitation(client, uinfo, iid) → String
-
get_active_game_state(client, uinfo, gsid) → Hash
-
get_my_active_games(client, uinfo) → Array<Hash>
-
get_my_invitations(client, uinfo) → Array<Hash>
-
get_ui_game_state(client, uinfo, gsid) → Hash
-
get_user_active_games(client, uid) → Array<Hash>
-
get_user_invitations(client, uid) → Array<Hash>
-
launch_new_game(client, uinfo, iid) → String
-
send_2player_invitation(client, uinfo, title, mid, version, scenario, preferred, invitee) → String
-
send_mplayer_invitation(client, uinfo, title, mid, version, scenario, preferred, invitees) → String
-
set_tableau_ui_state(client, uinfo, gsid, tableau, settings) → String
-
set_unit_degradation(client, uinfo, gsid, eid, grade) → String
-
set_unit_location(client, uinfo, gsid, eid, location) → String
-
set_unit_steps(client, uinfo, gsid, eid, steps) → Hash
-
set_unit_zoc(client, uinfo, gsid, eid, zoc) → String
-
Class Method Details
abandon_game(client, uinfo, gsid) → String
This class method abandons a game that a user is actively participating in. The game will be deleted.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
Returns:
- [String] — the result of the abandonment operation
accept_invitation(client, uinfo, iid, preferred) → String
This class method accepts an invitation.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- iid [String] — the unique invitation identifier
- preferred [String] the preferred side of the invitee, or "[Random], or "[Any] — " if no preference
Returns:
- [String] — the outcome of the acceptance
cancel_invitation(client, uinfo, iid) → String
This class method cancels / deletes an invitation.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- iid [String] — the unique invitation identifier
Returns:
- [String] — the outcome of the cancellation / deletion
decline_invitation(client, uinfo, iid) → String
This class method declines an invitation.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- iid [String] — the unique invitation identifier
Returns:
- [String] — the outcome of the decline
get_active_game_state(client, uinfo, gsid) → Hash
This class method returns the state of a currently active game that the user is playing.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
Returns:
- [Hash] — the state of the game
get_my_active_games(client, uinfo) → Array<Hash>
This class method returns a list of the games this user has sent / initiated.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
Returns:
- [Array<Hash>] — list of the game invitations which include the given user
get_my_invitations(client, uinfo) → Array<Hash>
This class method returns a list of the games this user has sent / initiated.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
Returns:
- [Array<Hash>] — list of the game invitations which include the given user
get_ui_game_state(client, uinfo, gsid) → Hash
This class method gets the ui state of the game.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
Returns:
- [Hash] — the ui state of the game
get_user_active_games(client, uid) → Array<Hash>
This class method returns a list of a user's in-progress games
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's user id
Returns:
- [Array<Hash>] — the list of the games the player is playing
get_user_invitations(client, uid) → Array<Hash>
This class method returns a list of the games the user has sent / initiated.
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's user id
Returns:
- [Array<Hash>] — list of the game invitations which include the given user
launch_new_game(client, uinfo, iid) → String
This class method launches a game based on an accepted invitation.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- iid [String] — the unique invitation identifier
Returns:
- [String] — the outcome of the launch
send_2player_invitation(client, uinfo, title, mid, version, scenario, preferred, invitee) → String
This class method creates a 2-player game invitation.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- title [String] — the name of the module
- mid [String] — the module id
- version [String] — the module version
- scenario [String] — the name of the game scenario
- preferred [String] — the preferred side of the inviter, or "none" if no preference
- invitee [String] — the username of the player invited
Returns:
- [String] — the outcome of the cancellation / deletion
send_mplayer_invitation(client, uinfo, title, mid, version, scenario, preferred, invitees) → String
This class method creates a 2-player game invitation.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- title [String] — the name of the module
- mid [String] — the module id
- version [String] — the module version
- scenario [String] — the name of the game scenario
- preferred [String] the preferred side of the inviter, or "[Random], or "[Any] — " if no preference
- invitees [Array<String>] — the usernames of the players invited
Returns:
- [String] — the outcome of the cancellation / deletion
set_tableau_ui_state(client, uinfo, gsid, tableau, settings) → String
This class method sets the ui state of a specified tableau.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
- tableau [String] — the tableau to set
- settings [String] — the tableau's new settings as a JSON string
Returns:
- [String] — the result of the operation
set_unit_degradation(client, uinfo, gsid, eid, grade) → String
This class method sets the degradation level of a player's unit.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
- eid [String] — the unit to move
- grade [Integer] — the unit's new degradation level
Returns:
- [String] — the result of the operation
set_unit_location(client, uinfo, gsid, eid, location) → String
This class method sets the location of a player's unit.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
- eid [String] — the unit to move
- location [String] — the unit's new location
Returns:
- [String] — the result of the operation
set_unit_steps(client, uinfo, gsid, eid, steps) → Hash
This class method sets the steps of a player's unit.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
- eid [String] — the unit to move
- steps [Integer] — the unit's new steps
Returns:
- [Hash] — the result of the operation as well as modifier unit states based on the step change
set_unit_zoc(client, uinfo, gsid, eid, zoc) → String
This class method sets the degradation level of a player's unit.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- gsid [String] — the active game id
- eid [String] — the unit to move
- zoc [Integer] — the unit's new zoc state
Returns:
- [String] — the result of the operation
Class: GameService ← CoreService
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| services/tocs/GameService.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2024 Brick Mill Games, LLC, All rights reserved. |
Overview
This module is responsible for defining the GameService API to the outside world.
Constructor Registry
Item
Attributes
new(crux_env)
-
Method Registry
Item
Attributes
abandon_game(ipaddr, input) → Hash
<crux-service>
accept_invitation(ipaddr, input) → Hash
<crux-service>
cancel_invitation(ipaddr, input) → Hash
<crux-service>
decline_invitation(ipaddr, input) → Hash
<crux-service>
get_active_game_state(ipaddr, input) → Hash
<crux-service>
get_my_active_games(ipaddr, input) → Hash
<crux-service>
get_my_invitations(ipaddr, input) → Hash
<crux-service>
get_ui_game_state(ipaddr, input) → Hash
<crux-service>
get_user_active_games(ipaddr, input) → Hash
<crux-service>
get_user_invitations(ipaddr, input) → Hash
<crux-service>
launch_new_game(ipaddr, input) → Hash
<crux-service>
send_2player_invitation(ipaddr, input) → Hash
<crux-service>
set_tableau_ui_state(ipaddr, input) → Hash
<crux-service>
set_unit_degradation(ipaddr, input) → Hash
<crux-service>
set_unit_location(ipaddr, input) → Hash
<crux-service>
set_unit_steps(ipaddr, input) → Hash
<crux-service>
set_unit_zoc(ipaddr, input) → Hash
<crux-service>
Constructor Details
new(crux_env)
This class constructor simply calls the CoreService constructor to set up logging and other common service routines.
Parameters:
- crux_env [Hash] — The Crux service handler environment
- :db_info [Hash] — Database connection information used to establish MySQL database connections
- :host [String] — The hostname of the server hosting the SQL database
- :username [String] — the username of the login credentials for access the SQL databases
- :password [String] — the password of the login credentials for access the SQL databases
- :database [String] — the name of the database to be accesses, differentiated by the is_development value
- :logdir [String] — The desired location of service handler log files
- :repository [String] — The location of service handler modules
- :contracts [String] — The location of service handler contract modules
- :isdev [Boolean] — true if the service is running in a development environment (vs. production)
Method Details
abandon_game(ipaddr, input) → Hash <crux-service>
This method is used to abandon an active game.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
abandonGame: { url: '/t/game/abandon_game', params: [ 'gsid' ] },
})
…
crux.call('abandonGame', gsid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted abandonment, which is one of [ 'not-an-active-game','not-playing-in-game','abandoned' ] —
accept_invitation(ipaddr, input) → Hash <crux-service>
This method is used to accept a pending invitation.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
acceptInvitation: { url: '/t/game/accept_invitation', params: [ 'iid','preferred' ] },
})
…
crux.call('acceptInvitation', iid, preferred, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- iid [String] — the 8-byte unique invitation identifier key
- preferred [String] the preferred side of the invitee, used if inviter's preferred side was "[Any] — "
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted cancellation, which is one of [ 'fail', 'not-invited', 'is-inviter', 'accepted' ] —
cancel_invitation(ipaddr, input) → Hash <crux-service>
This method is used to cancel / delete a pending invitation.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
cancelInvitation: { url: '/t/game/cancel_invitation', params: [ 'iid' ] },
})
…
crux.call('cancelInvitation', iid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- iid [String] — the 8-byte unique invitation identifier key
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted cancellation, which is one of [ 'fail', 'cancelled' ] —
decline_invitation(ipaddr, input) → Hash <crux-service>
This method is used to decline a pending invitation.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
declineInvitation: { url: '/t/game/decline_invitation', params: [ 'iid' ] },
})
…
crux.call('declineInvitation', iid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- iid [String] — the 8-byte unique invitation identifier key
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted cancellation, which is one of [ 'fail', 'not-invited', 'is-inviter', 'declined' ] —
get_active_game_state(ipaddr, input) → Hash <crux-service>
This method is used to get the state of an active game for the given user.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getActiveGameState: { url: '/t/game/get_active_game_state', params: [ 'gsid' ] },
})
…
crux.call('getActiveGameState', gsid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
Returns:
- [Hash] — the result of the service call
- state [Hash] — the state of an active game from the current user's perspective
- mid [String] — the module ID of the game
- module [String] — the name of the module of the game
- scenario [String] — the name of the scenario of the module being played
- timestamp [String] — the date & time the game was started
- side [String] — the side the user is playing
- tableaux [Array<String>] — a list of the tableaux the user will interact with
get_my_active_games(ipaddr, input) → Hash <crux-service>
This method is used to get the list of active TOCS game sessions.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMyActiveGames: { url: '/t/game/get_my_active_games', params: [ ] },
})
…
crux.call('getMyActiveGames', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of active game sessions with associated information
- gid [String] — the game's system ID
- mid [String] — the module ID of the game
- module [String] — the name of the module of the game
- scenario [String] — the name of the scenario of the module being played
- timestamp [String] — the date & time the game was started
- players [Array<Hash>] — the registry of players playing the game
- side [String] — the side the user is playing in the game
- opponents [Hash] — the registry of opponents playing the game
get_my_invitations(ipaddr, input) → Hash <crux-service>
This method is used to get the list of TOCS game invitations which the given user is a part of.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMyInvitations: { url: '/t/game/get_my_invitations', params: [ ] },
})
…
crux.call('getMyInvitations', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of games invitations sent or initiated
- iid [String] — the invitation ID
- mid [String] — the module ID in the invitation
- module [String] — the module name in the invitation
- version [String] — the version of the module in the invitation
- scenario [String] — the name of the scenario in the invitation
- sides [Array<String>] — the list of opponents in the invitation's scenario
- inviter [Hash] — the user making the invitation, mapped as uid/username
- preferred [String] — the side preferred by the inviter
- invitees [Hash] — the registry of users who have been invited, mapped as uid/username
- declined [Hash] — the registry of users who have declined the invitation, mapped as uid/username
- accepted [Hash] — the registry of users who have accepted the invitation, mapped as uid/username
- timestamp [String] — the time the invitation was made in ISO 8601 format
get_ui_game_state(ipaddr, input) → Hash <crux-service>
This method is used to get the UI state of an active game for the given user.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUiGameState: { url: '/t/game/get_ui_game_state', params: [ 'gsid' ] },
})
…
crux.call('getUiGameState', gsid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
Returns:
- [Hash] — the result of the service call
- state [Hash] — the UI state of an active game from the current user's perspective
- tableaux [Hash] — a UI state of each tableau
get_user_active_games(ipaddr, input) → Hash <crux-service>
This method is used to get the list of active TOCS game sessions for the specified user.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUserActiveGames: { url: '/t/game/get_user_active_games', params: [ 'uid' ] },
})
…
crux.call('getUserActiveGames', uid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of active game sessions with associated information
- gid [String] — the game's system ID
- mid [String] — the module ID of the game
- module [String] — the name of the module of the game
- scenario [String] — the name of the scenario of the module being played
- timestamp [String] — the date & time the game was started
- players [Array<Hash>] — the registry of players playing the game
- side [String] — the side the user is playing in the game
- opponents [Hash] — the registry of opponents playing the game
get_user_invitations(ipaddr, input) → Hash <crux-service>
This method is used to get the list of TOCS game invitations which the given user is a part of.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUserInvitations: { url: '/t/game/get_user_invitations', params: [ 'uid' ] },
})
…
crux.call('getUserInvitations', uid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of games invitations sent or initiated
- iid [String] — the invitation ID
- mid [String] — the module ID in the invitation
- module [String] — the module name in the invitation
- version [String] — the version of the module in the invitation
- scenario [String] — the name of the scenario in the invitation
- sides [Array<String>] — the list of opponents in the invitation's scenario
- inviter [Hash] — the user making the invitation, mapped as uid/username
- preferred [String] — the side preferred by the inviter
- invitees [Hash] — the registry of users who have been invited, mapped as uid/username
- declined [Hash] — the registry of users who have declined the invitation, mapped as uid/username
- accepted [Hash] — the registry of users who have accepted the invitation, mapped as uid/username
- timestamp [String] — the time the invitation was made in ISO 8601 format
launch_new_game(ipaddr, input) → Hash <crux-service>
This method is used to launch a new game from an accepted invitation.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
launchNewGame: { url: '/t/game/launch_new_game', params: [ 'iid' ] },
})
…
crux.call('launchNewGame', iid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- iid [String] — the 8-byte unique invitation identifier key
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted launch, which is one of [ 'fail', 'launched' ] —
send_2player_invitation(ipaddr, input) → Hash <crux-service>
This method is used to send a new 2-player game invitation.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
send2PlayerInvitation: { url: '/t/game/send_2player_invitation', params: [ 'title','mid','version','scenario','preferred','invitee' ] },
})
…
crux.call('send2PlayerInvitation', title, mid, version, scenario, preferred, invitee, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- title [String] — the TOCS module title
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
- scenario [String] — the name of the game scenario
- preferred [String] — the preferred side of the inviter
- invitee [String] — the username of the player invited
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted creation, which is one of [ 'success', 'fail' ] —
set_tableau_ui_state(ipaddr, input) → Hash <crux-service>
This method is used to set the UI state of an active game's tableau for the given user.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setTableauUiState: { url: '/t/game/set_tableau_ui_state', params: [ 'gsid','tableau','settings' ] },
})
…
crux.call('setTableauUiState', gsid, tableau, settings, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
- tableau [String] — the name of the tableau
- settings [String] — the ui settings string of the tableau to set
Returns:
- [Hash] — the result of the service call
- outcome [String] — the result of the operation
set_unit_degradation(ipaddr, input) → Hash <crux-service>
This method is used to set a unit's degradation level.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setUnitDegradation: { url: '/t/game/set_unit_degradation', params: [ 'gsid','eid','grade' ] },
})
…
crux.call('setUnitDegradation', gsid, eid, grade, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
- eid [String] — the eid of the unit
- grade [Integer] — the unit's degradation level
Returns:
- [Hash] — the result of the service call
- outcome [String] — the result of the attempted operation
set_unit_location(ipaddr, input) → Hash <crux-service>
This method is used to set a unit's location.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setUnitLocation: { url: '/t/game/set_unit_location', params: [ 'gsid','eid','location' ] },
})
…
crux.call('setUnitLocation', gsid, eid, location, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
- eid [String] — the eid of the unit
- location [String] — the string describing the unit's new location
Returns:
- [Hash] — the result of the service call
- outcome [String] — the result of the attempted operation
set_unit_steps(ipaddr, input) → Hash <crux-service>
This method is used to set a unit's number of steps and modify affected combat values.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setUnitSteps: { url: '/t/game/set_unit_steps', params: [ 'gsid','eid','steps' ] },
})
…
crux.call('setUnitSteps', gsid, eid, steps, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
- eid [String] — the eid of the unit
- steps [Integer] — the unit's existing steps
Returns:
- [Hash] — the result of the service call
- state [Hash] — the result of the attempted operation, including modified unit states
- outcome [String] — the result of the attempted operation
- steps [Integer] — the unit's current step size
- atk [Integer] — the unit's current atk strength
- def [Integer] — the unit's current def strength
- armdots [Integer] — the unit's current armdots strength, if applicable
- atdots [Integer] — the unit's current atdots strength, if applicable
- strike [Integer] — the unit's current strike strength, if applicable
set_unit_zoc(ipaddr, input) → Hash <crux-service>
This method is used to set a unit's zoc state.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setUnitZoc: { url: '/t/game/set_unit_zoc', params: [ 'gsid','eid','zoc' ] },
})
…
crux.call('setUnitZoc', gsid, eid, zoc, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- gsid [String] — the 8-byte unique game session key
- eid [String] — the eid of the unit
- zoc [Integer] — the unit's zoc state
Returns:
- [Hash] — the result of the service call
- outcome [String] — the result of the attempted operation
Class: MASLManager
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| lib/tocs/MASLManager.rb | Ruby | Kenneth F. Guerin | Copyright © 2020-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This class handles MASL OOB data operations.
Class Method Registry
Item
Attributes
compile_asl_composition(client, paths, year, nationality, counter_type, composition) → Hash
-
compile_asl_unit_info(maslinfo, shortyear, nationality, smc, mmc, sws, ordnance, vehicles) → Hash
-
compile_unit_composition(maslinfo, year, nationality, counter_type, composition) → Hash
-
masl_search(maslinfo, asl_nationality, item)
<private>
normalize_strength(fp)
<private>
parse_item(str)
<private>
Class Method Details
compile_asl_composition(client, paths, year, nationality, counter_type, composition) → Hash
This class method returns the TOCS values need to build units based on ASL composition
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- year [String] — the service year of the unit
- nationality [String] — the nationality of the unit
- counter_type [String] — the counter type of the unit
- composition [String] — the unit composition
Returns:
- [Hash] — the result of the compilation
compile_asl_unit_info(maslinfo, shortyear, nationality, smc, mmc, sws, ordnance, vehicles) → Hash
This class method returns the TOCS values need to build units based on ASL composition
Parameters:
- maslinfo [Hash] — the MASL information data set
- shortyear [Integer] — the service year of the unit expressed as an integer w/o the century
- nationality [String] — the nationality of the unit
- smc [Array<String>] — the ASL single-man counters in the unit
- mmc [Array<String>] — the ASL multi-man counters in the unit
- sws [Array<String>] — the ASL support weapons in the unit
- ordnance [Array<String>] — the ASL ordnance in the unit
- vehicles [Array<String>] — the ASL vehicles in the unit
Returns:
- [Hash] — the result of the compilation
compile_unit_composition(maslinfo, year, nationality, counter_type, composition) → Hash
Parameters:
- maslinfo [Hash] — the MASL Information data
- year [String] — the year of service of the unit
- nationality [String] — the nationality of the unit
- counter_type [String] — the counter type of the unit
- composition [String] — the ASL unit composition
Returns:
- [Hash] — the data set produced by a successful compilation
masl_search(maslinfo, asl_nationality, item) <private>
This class method returns the TOCS values need to build units based on ASL composition
Parameters:
- maslinfo [Hash] — the MASL Information data
- asl_nationality [String] — the ASL nationality of the item being searched for
- item [String] — the item within the ASL composition
normalize_strength(fp) <private>
This class method is used to normalize a strength calculation.
Parameters:
- fp [Number] — the numeric strength to normalize against
parse_item(str) <private>
This class method is used to parse items within an ASL composition string.
Parameters:
- str [String] — the ASL composition string to parse
Class: ModuleManager
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| lib/tocs/ModuleManager.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This class handles module / catalog management.
Class Method Registry
Item
Attributes
build_dev_map_metadata_hash(smgr, mid, version) → Hash
-
build_dev_oob_hash(smgr, mid, version) → Hash
-
build_dev_scenario_info_hash(smgr, mid, version) → Hash
-
compile_dev_map_metadata(client, paths, mid, force) → Hash
-
compile_dev_oob(client, paths, mid, force) → Hash
-
compile_dev_scenarios(client, paths, mid, force) → Hash
-
find_map_tile(paths, mid, version, name, row, column) → Array<String>
-
get_dev_map_list(client, paths, mid) → Array<String>
-
get_dev_map_manifest_cit_fileid(mid, version) → String
-
get_dev_map_manifest_xml_fileid(mid, version) → String
-
get_dev_map_metadata(client, paths, mid, mapname) → Hash
-
get_dev_map_metadata_cit_fileid(mid, version) → String
-
get_dev_map_metadata_xml_fileid(mid, version) → String
-
get_dev_oob(client, paths, mid) → Hash
-
get_dev_oob_cit_fileid(mid, version) → String
-
get_dev_oob_xml_fileid(mid, version) → String
-
get_dev_scenario_info(client, paths, mid, scenario) → Hash
-
get_dev_scenario_info_cit_fileid(mid, version) → String
-
get_dev_scenario_info_xml_fileid(mid, version) → String
-
get_dev_scenario_list(client, paths, mid) → Array<String>
-
get_formation_manifest(client, mid, version) → Array<Hash>
-
get_map_list(paths, mid, version) → Array<String>
-
get_map_tile(paths, mid, version, name, row, column) → CruxResource
-
get_map_tile_info(paths, mid, version, name) → Hash
-
get_my_module_info(client, uinfo) → Array<Hash>
-
get_oob_manifest(client, mid, version) → Hash
-
get_scenario_list(client, mid, version) → Array<String>
-
get_scenario_manifest(client, mid, version, scenario, side) → Array<Hash>
-
get_scenario_sides(client, mid, version, scenario) → Array<String>
-
get_tableaux_info(paths, mid, version, side) → Hash
-
get_unit_manifest(client, mid, version) → Array<Hash>
-
get_user_module_info(client, uid) → Array<Hash>
-
install_dev_map_metadata(client, paths, mid) → String
-
install_dev_oob(client, paths, mid) → String
-
install_dev_scenarios(client, paths, mid) → String
-
map_metadata_scan(smgr, mid, version)
-
oob_scan(smgr, mid, version)
-
query_module_properties(client, mid) → Hash
-
scenario_info_scan(smgr, mid, version)
-
Class Method Details
build_dev_map_metadata_hash(smgr, mid, version) → Hash
This class method returns the map metadata for the specified module.
Parameters:
- smgr [StorageManager] — the service paths
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Hash] — the module's primary map metadata
build_dev_oob_hash(smgr, mid, version) → Hash
This class method returns the OOB for the specified module.
Parameters:
- smgr [StorageManager] — the service paths
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Hash] — the module's OOB
build_dev_scenario_info_hash(smgr, mid, version) → Hash
This class method returns the scenario information for the specified module.
Parameters:
- smgr [StorageManager] — the service paths
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Hash] — the module's scenario information
compile_dev_map_metadata(client, paths, mid, force) → Hash
This class method returns the map metadata for the specified module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
- force [Boolean] — if true, forces a compilation without checking file modification timestamps
Returns:
- [Hash] — the result of the compilation
compile_dev_oob(client, paths, mid, force) → Hash
This class method returns the OOB for the specified module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
- force [Boolean] — if true, forces a compilation without checking file modification timestamps
Returns:
- [Hash] — the result of the compilation
compile_dev_scenarios(client, paths, mid, force) → Hash
This class method returns the scenario information for the specified module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
- force [Boolean] — if true, forces a compilation without checking file modification timestamps
Returns:
- [Hash] — the result of the compilation
find_map_tile(paths, mid, version, name, row, column) → Array<String>
This class method finds the map tile graphic for download.
Parameters:
- paths [Hash] — the system's path information
- mid [String] — the module id
- version [String] — the module version
- name [String] — the name of the map
- row [Integer] — the tile row index
- column [Integer] — the tile column index
Returns:
- [Array<String>] — the resource information required to download the file
get_dev_map_list(client, paths, mid) → Array<String>
This class method returns the list of maps for the specified module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
Returns:
- [Array<String>] — the module's map list
get_dev_map_manifest_cit_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's map manifest CIT fileid
get_dev_map_manifest_xml_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's map manifest XML fileid
get_dev_map_metadata(client, paths, mid, mapname) → Hash
This class method returns the map metadata for the specified module and map.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
- mapname [String] — the map name, or "all" for all maps
Returns:
- [Hash] — the map's metadata
get_dev_map_metadata_cit_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's map metadata CIT fileid
get_dev_map_metadata_xml_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's map metadata XML fileid
get_dev_oob(client, paths, mid) → Hash
This class method returns the OOB for the specified module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
Returns:
- [Hash] — the module's OOB
get_dev_oob_cit_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's OOB CIT fileid
get_dev_oob_xml_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's OOB XML fileid
get_dev_scenario_info(client, paths, mid, scenario) → Hash
This class method returns the scenario information for the specified module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
- scenario [String] — the scenario name, or "all" for all scenarios
Returns:
- [Hash] — the scenario information
get_dev_scenario_info_cit_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's scenario info CIT fileid
get_dev_scenario_info_xml_fileid(mid, version) → String
Parameters:
- mid [String] — the module id
- version [String] — the module version
Returns:
- [String] — the module's scenario info XML fileid
get_dev_scenario_list(client, paths, mid) → Array<String>
This class method returns the list of scenarios for the module.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
Returns:
- [Array<String>] — the module's scenario list
get_formation_manifest(client, mid, version) → Array<Hash>
This class method returns a list of the formations defined by the given module.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Array<Hash>] — list of the formations defined by the given module along with associated properties
get_map_list(paths, mid, version) → Array<String>
This class method returns a list of the maps contained within the given module.
Parameters:
- paths [Hash] — the service paths
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Array<String>] — list of the module maps
get_map_tile(paths, mid, version, name, row, column) → CruxResource
This class method finds a module's map tile for download.
Parameters:
- paths [Hash] — the system's path information
- mid [String] — the module id
- version [String] — the module version
- name [String] — the name of the map
- row [Integer] — the tile's row index
- column [Integer] — the tile's column index
Returns:
- [CruxResource] — the resource information required to download the file
get_map_tile_info(paths, mid, version, name) → Hash
This class method returns the tiling information for a given map in a given module.
Parameters:
- paths [Hash] — the service paths
- mid [String] — the module id
- version [String] — the module version
- name [String] — the map name
Returns:
- [Hash] — the map's tiling information
get_my_module_info(client, uinfo) → Array<Hash>
This class method returns a list of the modules, with associated game box info, the user has rights to.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
Returns:
- [Array<Hash>] — list of the modules the user has rights to
get_oob_manifest(client, mid, version) → Hash
This class method returns a manifest of a module's OOB, including formations, units and command attachments.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Hash] — the OOB manifest of the given module, including formations, units and command attachments
get_scenario_list(client, mid, version) → Array<String>
This class method returns a list of the scenarios defined by the given module.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Array<String>] — list of the module's scenarios
get_scenario_manifest(client, mid, version, scenario, side) → Array<Hash>
This class method returns a list of the scenarios, with associated information, defined by the given module.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
- version [String] — the module version
- scenario [String] — the name of the scenario, or "any" for any/all scenarios
- side [String] — the player side, or "any" for any/all player information
Returns:
- [Array<Hash>] — list of the scenarios and associated information
get_scenario_sides(client, mid, version, scenario) → Array<String>
This class method returns a list of the sides in a given scenario.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
- version [String] — the module version
- scenario [String] — the scenario name
Returns:
- [Array<String>] — list of the sides in the specified scenario
get_tableaux_info(paths, mid, version, side) → Hash
This class method returns tableaux information for the given module.
Parameters:
- paths [Hash] — the service paths
- mid [String] — the module id
- version [String] — the module version
- side [String] — the player side, or "any" for any/all player information
Returns:
- [Hash] — the module's tableaux information
get_unit_manifest(client, mid, version) → Array<Hash>
This class method returns a list of the units defined by the given module.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
- version [String] — the module version
Returns:
- [Array<Hash>] — list of the units defined by the given module along with associated properties
get_user_module_info(client, uid) → Array<Hash>
This class method returns a list of the modules, with associated game box info, the user has rights to.
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's ID
Returns:
- [Array<Hash>] — list of the modules the user has rights to
install_dev_map_metadata(client, paths, mid) → String
This class method loads compiled map metadata into the module's database.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
Returns:
- [String] — the result of the load operation
install_dev_oob(client, paths, mid) → String
This class method loads a compiled OOB into the module's database.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
Returns:
- [String] — the result of the load operation
install_dev_scenarios(client, paths, mid) → String
This class method loads compiled scenario information into the module's database.
Parameters:
- client [CoreService::Client] — the database connection
- paths [Hash] — the service paths
- mid [String] — the module id
Returns:
- [String] — the result of the load operation
map_metadata_scan(smgr, mid, version)
Parameters:
- smgr [StorageManager] — the service paths
- mid [String] — the module id
- version [String] — the module version
oob_scan(smgr, mid, version)
Parameters:
- smgr [StorageManager] — the service paths
- mid [String] — the module id
- version [String] — the module version
query_module_properties(client, mid) → Hash
This class method returns a module's version information.
Parameters:
- client [CoreService::Client] — the database connection
- mid [String] — the module id
Returns:
- [Hash] — the module's version information (production, playtest, development)
scenario_info_scan(smgr, mid, version)
Parameters:
- smgr [StorageManager] — the service paths
- mid [String] — the module id
- version [String] — the module version
Class: ModuleService ← CoreService
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| services/tocs/ModuleService.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This module is responsible for defining the ModuleService API to the outside world.
Constructor Registry
Item
Attributes
new(crux_env)
-
Method Registry
Item
Attributes
compile_dev_map_metadata(ipaddr, input) → Hash
<crux-service>
compile_dev_oob(ipaddr, input) → Hash
<crux-service>
compile_dev_scenarios(ipaddr, input) → Hash
<crux-service>
get_dev_map_list(ipaddr, input) → Hash
<crux-service>
get_dev_map_metadata(ipaddr, input) → Hash
<crux-service>
get_dev_oob(ipaddr, input) → Hash
<crux-service>
get_dev_scenario_info(ipaddr, input) → Hash
<crux-service>
get_dev_scenario_list(ipaddr, input) → Hash
<crux-service>
get_formation_manifest(ipaddr, input) → Hash
<crux-service>
get_map_list(ipaddr, input) → Hash
<crux-service>
get_map_tile(ipaddr, input) → Nil or CruxResource
<crux-service>
get_map_tile_info(ipaddr, input) → Hash
<crux-service>
get_my_module_info(ipaddr, input) → Hash
<crux-service>
get_oob_manifest(ipaddr, input) → Hash
<crux-service>
get_scenario_list(ipaddr, input) → Hash
<crux-service>
get_scenario_manifest(ipaddr, input) → Hash
<crux-service>
get_tableaux_info(ipaddr, input) → Hash
<crux-service>
get_unit_manifest(ipaddr, input) → Hash
<crux-service>
get_user_module_info(ipaddr, input) → Hash
<crux-service>
install_dev_map_metadata(ipaddr, input) → Hash
<crux-service>
install_dev_oob(ipaddr, input) → Hash
<crux-service>
install_dev_scenarios(ipaddr, input) → Hash
<crux-service>
Constructor Details
new(crux_env)
This class constructor simply calls the CoreService constructor to set up logging and other common service routines.
Parameters:
- crux_env [Hash] — The Crux service handler environment
- :db_info [Hash] — Database connection information used to establish MySQL database connections
- :host [String] — The hostname of the server hosting the SQL database
- :username [String] — the username of the login credentials for access the SQL databases
- :password [String] — the password of the login credentials for access the SQL databases
- :database [String] — the name of the database to be accesses, differentiated by the is_development value
- :logdir [String] — The desired location of service handler log files
- :repository [String] — The location of service handler modules
- :contracts [String] — The location of service handler contract modules
- :isdev [Boolean] — true if the service is running in a development environment (vs. production)
Method Details
compile_dev_map_metadata(ipaddr, input) → Hash <crux-service>
This method is used to compile map metadata in development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
compileDevMapMetadata: { url: '/t/module/compile_dev_map_metadata', params: [ 'mid','force' ] },
})
…
crux.call('compileDevMapMetadata', mid, force, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
- force [Boolean] — a way to force a compilation without checking whether it is necessary
Returns:
- [Hash] — the result of the service call
- result [Hash] — the result of the compilation
- errors [Integer] — the number of errors encountered
- warnings [Integer] — the number of warnings encountered
- progress [Array<String>] — the text of the compilation progress
- clut [Hash] — C-LUT produced by the compilation process
compile_dev_oob(ipaddr, input) → Hash <crux-service>
This method is used to compile an OOB in development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
compileDevOob: { url: '/t/module/compile_dev_oob', params: [ 'mid','force' ] },
})
…
crux.call('compileDevOob', mid, force, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
- force [Boolean] — a way to force a compilation without checking whether it is necessary
Returns:
- [Hash] — the result of the service call
- result [Hash] — the result of the compilation
- errors [Integer] — the number of errors encountered
- warnings [Integer] — the number of warnings encountered
- progress [Array<String>] — the text of the compilation progress
- clut [Hash] — C-LUT produced by the compilation process
compile_dev_scenarios(ipaddr, input) → Hash <crux-service>
This method is used to compile scenarios for a module in development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
compileDevScenarios: { url: '/t/module/compile_dev_scenarios', params: [ 'mid','force' ] },
})
…
crux.call('compileDevScenarios', mid, force, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
- force [Boolean] — a way to force a compilation without checking whether it is necessary
Returns:
- [Hash] — the result of the service call
- result [Hash] — the result of the compilation
- errors [Integer] — the number of errors encountered
- warnings [Integer] — the number of warnings encountered
- progress [Array<String>] — the text of the compilation progress
- clut [Hash] — C-LUT produced by the compilation process
get_dev_map_list(ipaddr, input) → Hash <crux-service>
This method is used to get the list of maps in a module under development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getDevMapList: { url: '/t/module/get_dev_map_list', params: [ 'mid' ] },
})
…
crux.call('getDevMapList', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the module's map list
get_dev_map_metadata(ipaddr, input) → Hash <crux-service>
This method is used to get map metadata in development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getDevMapMetadata: { url: '/t/module/get_dev_map_metadata', params: [ 'mid','mapname' ] },
})
…
crux.call('getDevMapMetadata', mid, mapname, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
- mapname [String] — the map name, or "all" for all maps
Returns:
- [Hash] — the result of the service call
- metadata [Hash] — the module's map metadata
get_dev_oob(ipaddr, input) → Hash <crux-service>
This method is used to get an OOB in development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getDevOob: { url: '/t/module/get_dev_oob', params: [ 'mid' ] },
})
…
crux.call('getDevOob', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- oob [Hash] — the Module's OOB
get_dev_scenario_info(ipaddr, input) → Hash <crux-service>
This method is used to get scenario information for a module in development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getDevScenarioInfo: { url: '/t/module/get_dev_scenario_info', params: [ 'mid','scenario' ] },
})
…
crux.call('getDevScenarioInfo', mid, scenario, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
- scenario [String] — the scenario name, or "all" for all scenarios
Returns:
- [Hash] — the result of the service call
- info [Hash] — the module's scenario information
get_dev_scenario_list(ipaddr, input) → Hash <crux-service>
This method is used to get the list of scenarios in a module under development
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getDevScenarioList: { url: '/t/module/get_dev_scenario_list', params: [ 'mid' ] },
})
…
crux.call('getDevScenarioList', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the module's map list
get_formation_manifest(ipaddr, input) → Hash <crux-service>
This method is used to get the formations manifest of a specified TOCS module.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getFormationManifest: { url: '/t/module/get_formation_manifest', params: [ 'mid','version' ] },
})
…
crux.call('getFormationManifest', mid, version, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
Returns:
- [Hash] — the result of the service call
- manifest [Hash] — the manifest of module formations
get_map_list(ipaddr, input) → Hash <crux-service>
This method is used to get the list of module maps
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMapList: { url: '/t/module/get_map_list', params: [ 'mid','version' ] },
})
…
crux.call('getMapList', mid, version, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the list of module maps
get_map_tile(ipaddr, input) → Nil or CruxResource <crux-service>
This method is used to download a module map tile.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMapTile: { url: '/t/module/get_map_tile', params: [ 'mid','version','name','row','column' ] },
})
…
crux.call('getMapTile', mid, version, name, row, column, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
- name [String] — the map name
- row [Integer] — the tile's row index
- column [Integer] — the tile's column index
Returns:
- [Nil or CruxResource] — the result of the service call
get_map_tile_info(ipaddr, input) → Hash <crux-service>
This method is used to get the tiling information for a given map in a given module.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMapTileInfo: { url: '/t/module/get_map_tile_info', params: [ 'mid','version','name' ] },
})
…
crux.call('getMapTileInfo', mid, version, name, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
- name [String] — the map name
Returns:
- [Hash] — the result of the service call
- info [Hash] — the map's tiling information
- rows [Integer] — the number of map tiles in the vertical direction
- columns [Integer] — the number of map tiles in the horizontal direction
- width [Integer] — the pixel width of each map tile
- height [Integer] — the pixel height of each map tile
- lwidth [Integer] — the pixel width of the right-most map tile
- lheight [Integer] — the pixel width of the bottom map tile
- hexinfo [Hash] — the hex-based information of the entire map
get_my_module_info(ipaddr, input) → Hash <crux-service>
This method is used to get the the game modules, and associate game box info, for modules the user has rights to
Credentials Required: [ tocs, tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMyModuleInfo: { url: '/t/module/get_my_module_info', params: [ ] },
})
…
crux.call('getMyModuleInfo', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules, and associated game box info, the user has rights to
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
- copyright [String] — the module's copyright
- designers [String] — the module's designers
- framework [String] — the module's framework
- developers [String] — the module's developers
- development_team [Array<String>] — a list of the module's development team, by UID
- development_editor [String] — the module's development editor, by UID
- development_version [String] — the module's development version
- gboxes [Hash] — the module's game box information
get_oob_manifest(ipaddr, input) → Hash <crux-service>
This method is used to get the oob manifest of a specified TOCS module.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getOobManifest: { url: '/t/module/get_oob_manifest', params: [ 'mid','version' ] },
})
…
crux.call('getOobManifest', mid, version, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
Returns:
- [Hash] — the result of the service call
- manifest [Hash] — the manifest of module units and formations and command attachments
get_scenario_list(ipaddr, input) → Hash <crux-service>
This method is used to get the scenario list of a specified TOCS module.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getScenarioList: { url: '/t/module/get_scenario_list', params: [ 'mid','version' ] },
})
…
crux.call('getScenarioList', mid, version, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the list of module scenarios
get_scenario_manifest(ipaddr, input) → Hash <crux-service>
This method is used to get the scenario manifest of a specified TOCS module.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getScenarioManifest: { url: '/t/module/get_scenario_manifest', params: [ 'mid','version','scenario','side' ] },
})
…
crux.call('getScenarioManifest', mid, version, scenario, side, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
- scenario [String] — the name of the scenario or "any" for all scenarios
- side [String] — the player side or "any" for all sides
Returns:
- [Hash] — the result of the service call
- scenarios [Array<Hash>] — the list of module scenarios
- name [String] — the name of the scenario
- overview [String] — an overview of the scenario
- location [String] — the location of the scenario
- turns [Integer] — the length of the scenario
- sides [Array<String>] — a list of the opponents for the scenario
- starts [Hash] — the date and time of the scenario start
- ends [Hash] — the date and time of the scenario end
- weather [Hash] — the starting weather for the scenario
- daylight [Hash] — the dawn/dusk information for the scenario
- moon [Hash] — the moon phase for the scenario
- idleDays [Integer] — the number of idle days available in the scenario
get_tableaux_info(ipaddr, input) → Hash <crux-service>
This method is used to get the list of module tableaux and the optimal counter size to use.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getTableauxInfo: { url: '/t/module/get_tableaux_info', params: [ 'mid','version','side' ] },
})
…
crux.call('getTableauxInfo', mid, version, side, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
- side [String] — the player side or "any" for all sides
Returns:
- [Hash] — the result of the service call
- info [Array<String>] — the list of module tableaux and counter size info for a given side
get_unit_manifest(ipaddr, input) → Hash <crux-service>
This method is used to get the units manifest of a specified TOCS module.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUnitManifest: { url: '/t/module/get_unit_manifest', params: [ 'mid','version' ] },
})
…
crux.call('getUnitManifest', mid, version, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the TOCS module id
- version [String] — the TOCS module version
Returns:
- [Hash] — the result of the service call
- manifest [Hash] — the manifest of module units
get_user_module_info(ipaddr, input) → Hash <crux-service>
This method is used to get the the game modules, and associate game box info, for modules the user has rights to
Credentials Required: [ tocs, tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUserModuleInfo: { url: '/t/module/get_user_module_info', params: [ 'uid' ] },
})
…
crux.call('getUserModuleInfo', uid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of game modules, and associated game box info, the user has rights to
- mid [String] — the module's ID
- code [String] — the module's code
- title [String] — the module's title
- description [String] — the module's description
- copyright [String] — the module's copyright
- designers [String] — the module's designers
- framework [String] — the module's framework
- developers [String] — the module's developers
- development_team [Array<String>] — a list of the module's development team, by UID
- development_editor [String] — the module's development editor, by UID
- development_version [String] — the module's development version
- gboxes [Hash] — the module's game box information
install_dev_map_metadata(ipaddr, input) → Hash <crux-service>
This method is used to install compiled map metadata into the module development database.
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
installDevMapMetadata: { url: '/t/module/install_dev_map_metadata', params: [ 'mid' ] },
})
…
crux.call('installDevMapMetadata', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- result [String] — the result of the load operation
install_dev_oob(ipaddr, input) → Hash <crux-service>
This method is used to install a compiled OOB into the module development database.
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
installDevOob: { url: '/t/module/install_dev_oob', params: [ 'mid' ] },
})
…
crux.call('installDevOob', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- result [String] — the result of the load operation
install_dev_scenarios(ipaddr, input) → Hash <crux-service>
This method is used to install compiled scenario information into the module development database.
Credentials Required: [ tmdk ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
installDevScenarios: { url: '/t/module/install_dev_scenarios', params: [ 'mid' ] },
})
…
crux.call('installDevScenarios', mid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- mid [String] — the Module ID
Returns:
- [Hash] — the result of the service call
- result [String] — the result of the load operation
Class: ResourceManager
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| lib/tocs/ResourceManager.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This class handles game session management.
Class Method Registry
Item
Attributes
find_wargame_graphic(paths, era, category, nationality, name, options) → Array<String>
-
get_wg_categories(paths, era) → Array<String>
-
get_wg_eras(paths) → Array<String>
-
get_wg_item(paths, era, category, nationality, name, options) → CruxResource
-
get_wg_metadata(paths, era, category, nationality, name) → Hash
-
get_wg_nationalities(paths, era, category) → Array<String>
-
get_wwii_patch(paths, nationality, size, id) → CruxResource
-
get_wwii_vehicle(paths, nationality, id, options) → CruxResource
-
Class Method Details
find_wargame_graphic(paths, era, category, nationality, name, options) → Array<String>
This class method finds the wargame graphic for download.
Parameters:
- paths [Hash] — the system's path information
- era [String] — the era of the graphic requested
- category [String] — the category of the graphic requested
- nationality [String] — the nationality of the graphic requested
- name [String] — the name of the graphic requested
- options [Array<String>] — options associated with some types of graphics (vehicular)
Returns:
- [Array<String>] — the resource information required to download the file
get_wg_categories(paths, era) → Array<String>
This class method returns a list of installed wargame graphics categories for the specified era.
Parameters:
- paths [Hash] — the system's path information
- era [String] — the era to search for categories
Returns:
- [Array<String>] — list of the installed wargame graphics categories for the specified era
get_wg_eras(paths) → Array<String>
This class method returns a list of installed wargame graphics eras.
Parameters:
- paths [Hash] — the system's path information
Returns:
- [Array<String>] — list of the installed wargame graphics eras
get_wg_item(paths, era, category, nationality, name, options) → CruxResource
This class method finds the wargame graphic for download.
Parameters:
- paths [Hash] — the system's path information
- era [String] — the era of the graphic requested
- category [String] — the category of the graphic requested
- nationality [String] — the nationality of the graphic requested
- name [String] — the name of the graphic requested
- options [Array<String>] — the vehicle's options
Returns:
- [CruxResource] — the resource information required to download the file
get_wg_metadata(paths, era, category, nationality, name) → Hash
This class method returns the metadata of the wargame graphic.
Parameters:
- paths [Hash] — the system's path information
- era [String] — the era of the graphic requested
- category [String] — the category of the graphic requested
- nationality [String] — the nationality of the graphic requested
- name [String] — the name of the graphic requested
Returns:
- [Hash] — the metadata associated with the wargame graphic
get_wg_nationalities(paths, era, category) → Array<String>
This class method returns a list of installed wargame graphics nationalities for the specified era & category.
Parameters:
- paths [Hash] — the system's path information
- era [String] — the era to search for categories
- category [String] — the category to search for nationalities
Returns:
- [Array<String>] — list of the installed wargame graphics nationalities for the specified era & category
get_wwii_patch(paths, nationality, size, id) → CruxResource
This class method finds WWII unit patch insignia.
Parameters:
- paths [Hash] — the system's path information
- nationality [String] — the nationality of the graphic requested
- size [String] — the unit's size
- id [String] — the unit's id
Returns:
- [CruxResource] — the resource information required to download the file
get_wwii_vehicle(paths, nationality, id, options) → CruxResource
This class method finds WWII vehicle graphics.
Parameters:
- paths [Hash] — the system's path information
- nationality [String] — the nationality of the graphic requested
- id [String] — the vehicle's identifier
- options [Array<String>] — the vehicle's options
Returns:
- [CruxResource] — the resource information required to download the file
Class: ResourceService ← CoreService
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| services/tocs/ResourceService.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This module is responsible for defining the ResourceService API to the outside world.
Constructor Registry
Item
Attributes
new(crux_env)
-
Method Registry
Item
Attributes
get_wg_categories(ipaddr, input) → Hash
<crux-service>
get_wg_eras(ipaddr, input) → Hash
<crux-service>
get_wg_item(ipaddr, input) → Nil or CruxResource
<crux-service>
get_wg_metadata(ipaddr, input) → Hash
<crux-service>
get_wg_nationalities(ipaddr, input) → Hash
<crux-service>
get_wwii_patch(ipaddr, input) → Nil or CruxResource
<crux-service>
get_wwii_vehicle(ipaddr, input) → Nil or CruxResource
<crux-service>
Constructor Details
new(crux_env)
This class constructor simply calls the CoreService constructor to set up logging and other common service routines.
Parameters:
- crux_env [Hash] — The Crux service handler environment
- :db_info [Hash] — Database connection information used to establish MySQL database connections
- :host [String] — The hostname of the server hosting the SQL database
- :username [String] — the username of the login credentials for access the SQL databases
- :password [String] — the password of the login credentials for access the SQL databases
- :database [String] — the name of the database to be accesses, differentiated by the is_development value
- :logdir [String] — The desired location of service handler log files
- :repository [String] — The location of service handler modules
- :contracts [String] — The location of service handler contract modules
- :isdev [Boolean] — true if the service is running in a development environment (vs. production)
Method Details
get_wg_categories(ipaddr, input) → Hash <crux-service>
This method is used to get the list of installed categories for a specific era of wargame graphics on the server.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWgCategories: { url: '/t/resource/get_wg_categories', params: [ 'era' ] },
})
…
crux.call('getWgCategories', era, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- era [String] — the era of the graphic
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the list of wargame graphics eras
get_wg_eras(ipaddr, input) → Hash <crux-service>
This method is used to get the list of installed wargame graphics eras on the server.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWgEras: { url: '/t/resource/get_wg_eras', params: [ ] },
})
…
crux.call('getWgEras', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the list of wargame graphics eras
get_wg_item(ipaddr, input) → Nil or CruxResource <crux-service>
This method is used to download a wargame graphic.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWgItem: { url: '/t/resource/get_wg_item', params: [ 'era','category','nationality','name','options' ] },
})
…
crux.call('getWgItem', era, category, nationality, name, options, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- era [String] — the era of the graphic
- category [String] — the category of the graphic
- nationality [String] — the nationality of the graphic
- name [String] — the name of the graphic
- options [String[]] — the graphic's options
Returns:
- [Nil or CruxResource] — the result of the service call
get_wg_metadata(ipaddr, input) → Hash <crux-service>
This method is used to get the metadata for a specific wargame graphic resource.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWgMetadata: { url: '/t/resource/get_wg_metadata', params: [ 'era','category','nationality','name' ] },
})
…
crux.call('getWgMetadata', era, category, nationality, name, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- era [String] — the era of the graphic
- category [String] — the category of the graphic
- nationality [String] — the category of the graphic
- name [String] — the name of the graphic
Returns:
- [Hash] — the result of the service call
- metadata [Hash] — the metadata associated with the requested wargame graphic
get_wg_nationalities(ipaddr, input) → Hash <crux-service>
This method is used to get the list of installed categories for a specific era of wargame graphics on the server.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWgNationalities: { url: '/t/resource/get_wg_nationalities', params: [ 'era','category' ] },
})
…
crux.call('getWgNationalities', era, category, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- era [String] — the era of the graphic
- category [String] — the category of the graphic
Returns:
- [Hash] — the result of the service call
- list [Array<String>] — the list of wargame graphics eras
get_wwii_patch(ipaddr, input) → Nil or CruxResource <crux-service>
This method is used to download a WWII unit patch.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWwiiPatch: { url: '/t/resource/get_wwii_patch', params: [ 'nationality','size','id' ] },
})
…
crux.call('getWwiiPatch', nationality, size, id, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- nationality [String] — the category of the graphic
- size [String] — the unit's size
- id [String] — the unit's id
Returns:
- [Nil or CruxResource] — the result of the service call
get_wwii_vehicle(ipaddr, input) → Nil or CruxResource <crux-service>
This method is used to download a WWII unit vehicle.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getWwiiVehicle: { url: '/t/resource/get_wwii_vehicle', params: [ 'nationality','id','options' ] },
})
…
crux.call('getWwiiVehicle', nationality, id, options, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- nationality [String] — the category of the graphic
- id [String] — the vehicle's identifier
- options [String[]] — the vehicle's options
Returns:
- [Nil or CruxResource] — the result of the service call
Class: UserManager
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| lib/tocs/UserManager.rb | Ruby | Kenneth F. Guerin | Copyright © 2021-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This module is responsible for all TOCS User Services
This manager is a TOCS library devoted to user-level activities
Class Method Registry
Item
Attributes
can_start_playtests(rvalue) → Boolean
-
get_my_user_settings(client, uinfo) → Hash
-
get_user_list(client, role) → Array<Hash>
-
get_user_roles → Array<Hash>
-
get_user_settings(client, uid) → Hash
-
map_uids_to_realnames(client, uid_list) → Hash
-
map_uids_to_usernames(client, uid_list) → Hash
-
map_usernames_to_uids(client, uname_list) → Hash
-
query_developers(client) → Array<String>
-
query_users(client, role) → Array<String>
-
roles_to_rvalue(roles) → Integer
-
roles_to_value(rvalue) → Array<String>
-
set_my_user_settings(client, uinfo, settings) → Hash
-
set_user_settings(client, uid, settings) → Hash
-
Class Method Details
can_start_playtests(rvalue) → Boolean
Can the given user role start playtest games.
Parameters:
- rvalue [Integer] — the user roles to test
Returns:
- [Boolean] — true if the role allows for playtest capability
get_my_user_settings(client, uinfo) → Hash
This class method returns a list of the available user roles.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
Returns:
- [Hash] — the servicing user's TOCS settings
get_user_list(client, role) → Array<Hash>
This class method returns a list of TOCS users in good standing with the optionally-supplied role.
Parameters:
- client [CoreService::Client] — the database connection
- role [Symbol or String] — the role to look for, '-' means unfiltered
Returns:
- [Array<Hash>] — the list of users with their uid, username, realname and roles
get_user_roles → Array<Hash>
This class method returns a list of the available user roles.
Returns:
- [Array<Hash>] — the list of available user roles
get_user_settings(client, uid) → Hash
This class method returns a list of the available user roles.
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's ID
Returns:
- [Hash] — the servicing user's TOCS settings
map_uids_to_realnames(client, uid_list) → Hash
Map a list of UIDs to their realnames.
Parameters:
- client [CoreService::Client] — the database connection
- uid_list [Array<String>] — the UIDs of the users
Returns:
- [Hash] — a map of UID -> realname
map_uids_to_usernames(client, uid_list) → Hash
Map a list of UIDs to their usernames.
Parameters:
- client [CoreService::Client] — the database connection
- uid_list [Array<String>] — the UIDs of the users
Returns:
- [Hash] — a map of UID -> username
map_usernames_to_uids(client, uname_list) → Hash
Map a list of usernames to their UIDs.
Parameters:
- client [CoreService::Client] — the database connection
- uname_list [Array<String>] — the usernames of the users
Returns:
- [Hash] — a map of username -> UID
query_developers(client) → Array<String>
get a list of users who are developers.
Parameters:
- client [CoreService::Client] — the database connection
Returns:
- [Array<String>] — an array of uids of users who are developers
query_users(client, role) → Array<String>
get a list of users who are developers.
Parameters:
- client [CoreService::Client] — the database connection
- role [Symbol or String] — the role to look for, '-' means unfiltered
Returns:
- [Array<String>] — an array of uids of users who are developers
roles_to_rvalue(roles) → Integer
role string array to rvalue conversion function.
Parameters:
- roles [Array<String>] — the user roles to convert
Returns:
- [Integer] — the bitfield value of the roles
roles_to_value(rvalue) → Array<String>
rvalue to role string array conversion function.
Parameters:
- rvalue [Integer] — the role value to convert
Returns:
- [Array<String>] — the array of user roles
set_my_user_settings(client, uinfo, settings) → Hash
This class method returns a list of the available user roles.
Parameters:
- client [CoreService::Client] — the database connection
- uinfo [Hash] — the user's identity information
- settings [Hash] — the user's new settings
Returns:
- [Hash] — the servicing user's TOCS settings
set_user_settings(client, uid, settings) → Hash
This class method returns a list of the available user roles.
Parameters:
- client [CoreService::Client] — the database connection
- uid [String] — the user's ID
- settings [Hash] — the user's new settings
Returns:
- [Hash] — the servicing user's TOCS settings
Class: UserService ← CoreService
File Manifest
File Manifest| File | Language | Author(s) | Copyright |
|---|
| services/tocs/UserService.rb | Ruby | Kenneth F. Guerin | Copyright © 2018-2023 Brick Mill Games, LLC, All rights reserved. |
Overview
This module is responsible for defining the UserService API to the outside world.
Constructor Registry
Item
Attributes
new(crux_env)
-
Method Registry
Item
Attributes
get_my_user_settings(ipaddr, input) → Hash
<crux-service>
get_user_list(ipaddr, input) → Hash
<crux-service>
get_user_roles(ipaddr, input) → Hash
<crux-service>
get_user_settings(ipaddr, input) → Hash
<crux-service>
set_my_user_settings(ipaddr, input) → Hash
<crux-service>
set_user_settings(ipaddr, input) → Hash
<crux-service>
Constructor Details
new(crux_env)
This class constructor simply calls the CoreService constructor to set up logging and other common service routines.
Parameters:
- crux_env [Hash] — The Crux service handler environment
- :db_info [Hash] — Database connection information used to establish MySQL database connections
- :host [String] — The hostname of the server hosting the SQL database
- :username [String] — the username of the login credentials for access the SQL databases
- :password [String] — the password of the login credentials for access the SQL databases
- :database [String] — the name of the database to be accesses, differentiated by the is_development value
- :logdir [String] — The desired location of service handler log files
- :repository [String] — The location of service handler modules
- :contracts [String] — The location of service handler contract modules
- :isdev [Boolean] — true if the service is running in a development environment (vs. production)
Method Details
get_my_user_settings(ipaddr, input) → Hash <crux-service>
This method is used to get the logged in user's TOCS settings
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getMyUserSettings: { url: '/t/user/get_my_user_settings', params: [ ] },
})
…
crux.call('getMyUserSettings', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- settings [Hash] — the user's settings
- tzdesc [String] — the time zone description that the user has set
- timezone [String] — the time zone string that the user has set, formatted as an offset from GMT/UTC
- languages [Array<String>] — the list of languages that the user can use
get_user_list(ipaddr, input) → Hash <crux-service>
This method is used to get a list of TOCS users.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUserList: { url: '/t/user/get_user_list', params: [ 'role' ] },
})
…
crux.call('getUserList', role, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- role [String] — the user's role to filter on
Returns:
- [Hash] — the result of the service call
- list [Array<Hash>] — the list of users and their associated information
- uid [String] — the uid of the user in the list
- username [String] — the user name of the user in the list
- realname [String] — the real name of the user in the list
- roles [Integer] — the integer value of the roles of the user in the list
- rvalue [Array<String>] — the list of roles of the user in the list
get_user_roles(ipaddr, input) → Hash <crux-service>
This method is used to get the list of TOCS system user roles.
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUserRoles: { url: '/t/user/get_user_roles', params: [ ] },
})
…
crux.call('getUserRoles', (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
Returns:
- [Hash] — the result of the service call
- roles [Hash] — the list of user roles containing their bitmask values and associated role names
get_user_settings(ipaddr, input) → Hash <crux-service>
This method is used to get a user's TOCS settings
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
getUserSettings: { url: '/t/user/get_user_settings', params: [ 'uid' ] },
})
…
crux.call('getUserSettings', uid, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
Returns:
- [Hash] — the result of the service call
- settings [Hash] — the user's settings
- tzdesc [String] — the time zone description that the user has set
- timezone [String] — the time zone string that the user has set, formatted as an offset from GMT/UTC
- languages [Array<String>] — the list of language that the user can use
set_my_user_settings(ipaddr, input) → Hash <crux-service>
This method is used to set the logged in user's TOCS settings
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setMyUserSettings: { url: '/t/user/set_my_user_settings', params: [ 'settings' ] },
})
…
crux.call('setMyUserSettings', settings, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- settings [Hash] — the user's settings
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted creation, which is one of [ 'success', 'fail' ] —
set_user_settings(ipaddr, input) → Hash <crux-service>
This method is used to set a user's TOCS settings
Credentials Required: [ tocs ]
Javascript Example (via crux.js module):
crux.loadRegistry({
…
setUserSettings: { url: '/t/user/set_user_settings', params: [ 'uid','settings' ] },
})
…
crux.call('setUserSettings', uid, settings, (jr) => {
// jr is the return Hash as a JS Object
})
Parameters:
- ipaddr [String] — the IP address of the originating request
- input [Hash] — the input parameters supplied to the service from the outside world (JS)
- jwt [String] — the active JWT session authentication token
- uid [String] — the user's UID
- settings [Hash] — the user's settings
Returns:
- [Hash] — the result of the service call
- outcome [String] the result of the attempted creation, which is one of [ 'success', 'fail' ] —