Ryzom AMS Plugin Hooks

Ryzom AMS Plugin Hooks

Info

documentation notes

All hooks are designed with the following structure

$pluginname_hook_name

The plugin name is defined in the plugin.info

The plugin name matches the folder it installs to

Hooks are documented in the following way

 

First code block is the psudo code defination, this defines the input and output

param_list = Array()

function func_check takes param_list, boolean returns integer(min = 0, max = 5)
    variable_declaration $username
    variable_declaration $permissions
     ...
     statement 
		param_list[time] set to 0
     ...
     statement
        return false if $permissions < 3
     ...
endfunction

following code blocks are assigned a preceding "type"

array's are formatted in the print_r style

global helper variables are preceded with $

variable param_list
Array
(
    [time] => integer(min = 0, max = 100)
    [name] => string(maxchar(32))
    [values] => Array
        (
            [0] => $username
            [1] => $permissions
        )
)
return
Value definitions

1 = true
2 = false
3 = run again
4 = failed
5 = test succeeded

Global Variables

$username = current users username
$permissions = permissions value 
$current_time = current unix timestamp
$pluginname = name of plugin

 

User Hooks

Admin Hooks

Time Hooks

Hook_Cron

 

Hook_Cron definition
type = integer(min = 0, max = 1, default = 0)
last_run = integer 
	pulled from lib_database table cron column lastrun
time_delta = integer 
	pulled from lib_database table plugins column $pluginname_cron_name_delta
cron_function = string 
	function name to run when cron should be activated

function Hook_Cron takes type, time_delta, cron_name returns integer(min = 0, max = 3)
     variable_declaration $current_time 
     ...
     statement 
		if $current_time > last_run + time_delta then return(3)
		else 
		run cron_function
     statement 
		if cron is running then return(2)
     statement 
	    function failed return 0
		function succeeded return 1
     ...
endfunction
variable Type
0 = normal run
1 = force run
return
Value definitions

0 = cron failed
1 = cron succeeded 
2 = cron running
3 = cron doesn't need to run

Display Hooks