-
Notifications
You must be signed in to change notification settings - Fork 15
Official API
This is a list of official APIs (such as hooks, events) that are present in the core.
Hook for intercepting cases where a user does not have a viewpoint. Can be used to provide an entry point to the Game for characters.
-
character: LotGD\Core\Models\Character
. The character requiring a default scene (instance of -
scene: ?LotGD\Core\Models\Scene
. The desired default scene to create a viewpoint from.
Hook for navigating to a certain scene. target
is no-template
if the Scene does not have a SceneTemplate, or the return value of the corresponding SceneTemplates' SceneTemplate::getNavigationEvent()
method.
-
referrer: LotGD\Core\Models\Scene
, the scene the character comes from. -
viewpoint: LotGD\Core\Models\Viewpoint
, the scene the character comes from. -
scene: LotGD\Core\Models\Scene
, the scene the character comes from. -
parameters: array
, parameters from the action causing this scene change. -
redirect: str
, Scene ID to redirect to.
Hook to provide additional values to a scene description for twig formatting.
-
templateValues: ["Character": LotGD\Core\Models\Character, "Scene": LotGD\Core\Models\Scene
.
Hook to change what's allowed in a scene description to access. If you add models to the templateValue hook, you must allow accessible methods and properties in here, too. Write tests when in doubt!
-
tags: array
, list of twig tags allowed (default:if
), see here. -
filters: array
, list of twig filters allowed (default:lower, upper, escape
), see here. Do not removeescape
from this list. -
functions: array
, list of twig functions allowed (default:range
), see here. -
methods: array
, associative array ofclass: [method, ...]
that are allowed to access. Default:
[
LotGD\Core\Models\Character => [
"getDisplayName",
"getLevel",
"isAlive",
"getHealth",
"getMaxHealth",
"getProperty"
],
LotGD\Core\Models\Scene => [
"getProperty"
]
]
-
properties: array
, associative array of property: fields that are allowed to access.
Hook to change the character's base attack value. Use it to add in attack values from weapons, for example. Buff values are not calculated in yet.
character: LotGD\Core\Models\Character
-
value: int
, current attack value.
Hook to change the character's base defense value. Use it to add in defense values from armors, for example. Buff values are not calculated in yet.
character: LotGD\Core\Models\Character
-
value: int
, current attack value.
Hook to populate Character stats with additional values to display (experience, wealth ...)
character: LotGD\Core\Models\Character
stats: LotGD\Core\Models\CharacterStats
Gets raised by daenerys module:config:list
and can be used by modules to provide a list of settings to alter the behaviour of the module.
-
module: LotGD\Core\Models\Module
. Can be used to quickly set/get properties. -
io: SymfonyStyle
. Can be sued to manipulate console output. -
settings: [[str, str, str], ...]
, a list of rows in the format of[setting, value, description]
. Used to generate a table in the command.
Gets raised by daenerys module:config:set
and can be used by modules to accept a setting and a value for configuration.
-
module: LoTGD\Core\Models\Module
. Can be used to quickly set/get properties. -
io: SymfonyStyle
. Can be sued to manipulate console output. -
setting: str
, the name of a setting (should be listed indaenerys module:config:list
) -
value: str
, the corresponding value (string). Conversion necessary. -
return: int
, a return value. By default its 1 (Symfony\Component\Console\Command\Command::FAILURE
). Must be set to 0 if the command should be successful (Symfony\Component\Console\Command\Command::SUCCESS
) -
reason: str
, the reason for failing. Change to whatever to report on errors (eg, if the value is not what you accept). Gets formatted as an error, and only displayed if return is 1.
Gets raised by daenerys module:config:reset
and can be used by modules reset a setting
-
module: LotGD\Core\Models\Module
. Can be used to quickly set/get properties. -
io: SymfonyStyle
. Can be sued to manipulate console output. -
setting: str
, the name of a setting (should be listed indaenerys module:config:list
) -
return: int
, a return value. By default its 1 (Symfony\Component\Console\Command\Command::FAILURE
). Must be set to 0 if the command should be successful (Symfony\Component\Console\Command\Command::SUCCESS
) -
reason: str
, the reason for failing. Change to whatever to report on errors (eg, if the value is not what you accept). Gets formatted as an error, and only displayed if return is 1.