Legend of the Green Dragon v0.4.0-alpha Release Notes

Release Date: 2018-01-14 // over 6 years ago
  • This version introduces several API changes to make module development easier:

    • Viewpoints can now be more easily modified by using $viewpoint->addDescriptionParagraph() to add a single paragraph to the description. Internally, the viewpoint keeps an array of paragraphs and joins it together if $viewpoint->getDescription() is called.
    • Viewpoints can now more easily manage actions.
      • $viewpoint->addActionGroup can be used to add a single action group instead of replacing all.
      • $viewpoint->findActionGroupById can be used to return a selected action group. If not found, the method returns null.
    • ๐Ÿ‘ The dice bag supports now a integer based dice with uniform distribution additionally to the float based uniform distribution.
    • โž• Adds a few more pre-defined EventContextData containers.
    • ๐Ÿ”ง Certain models can now be extended (for now, this is just the characer class) by using the model extension api. For this, a module must include a list of all extending classes in their configuration (lotgd.yml), for example:

      modelExtensions: - "LotGD\Module\Res\Fight\Models\CharacterResFightExtension

    The corresponding class must be annoted with @extension which tells the API which class gets extended. It also must contain annotated, static methods that are annotated with @ExtensionMethod. The parameter "as" tells the API under which method name it can be called from the character model.

    use LotGD\Core\Doctrine\Annotations\Extension;use LotGD\Core\Doctrine\Annotations\ExtensionMethod;/\*\* \* @Extension(of="LotGD\Core\Models\Character") \*/class CharacterResFightExtension{/\*\* \* Levels up a given character. \* @param Character $character \* @ExtensionMethod(as="levelUp")\*/public static function levelUpCharacter(Character $character): void {$character-\>setLevel($character-\>getLevel() + 1); }}
    

    This method would, after loading, be available on the character model using $character->levelUp().