Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom templating engine #436

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Custom templating engine #436

wants to merge 1 commit into from

Conversation

laggron42
Copy link
Member

@laggron42 laggron42 commented Oct 9, 2024

This PR will rework the card generation algorithm to allow any kind of custom template on individual regimes and special events.

A new YAML config file will be introduced in the following provisional format:

default:
  canvas: 1500x2000

  background:
    type: image
    size: fill  # base canvas size
    path: "{{ background }}"

  art:
    type: image
    position: 700x261  # top left coordinate
    size: 1359x731  # size rectangle to fit the image in
    path: ".{{ ball.collection_card }}"

  icon:
    type: image
    position: 1200x300
    size: 192x192
    path: "{{ '.'+ball.economy.icon if ball.economy.icon else '' }}"

  description:
    type: text
    position: 50x20
    text: Hi this is a test
    font: mangati.ttf
    size: 80  # text size
    color: "#44FF00FF"  # text color
    stroke:  # text stroke (color+width)
      width: 5
      color: "#FF44FFFF"
    #wrap_width: 32  # width of the text box (wrap new lines)
    align: left  # left/right/middle alignment on position
    spacing: 20  # size between lines if multiline
    #anchor: ms  # where to attach the text base line, used for positioning
    direction: ttb  # right-to-left, left-to-right or top-to-bottom

special_event:  # create an override
  inherit: default
  background:
    # only change the background
    path: something_cool.png

Jinja2 templating substitution will be supported to allow a lot of extra stuff.

This implies the removal of the special "shiny" status, which will be automatically replaced by an unlimited special event.

Resolves #435, resolves #5, resolves #17

@laggron42 laggron42 self-assigned this Oct 9, 2024
@laggron42 laggron42 added enhancement New feature or request cards Image generation for collection cards core:models core:bot new feature priority:high labels Oct 9, 2024
@laggron42 laggron42 force-pushed the lagg/custom-template branch from 79590a7 to cf71ed4 Compare December 2, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cards Image generation for collection cards core:bot core:models enhancement New feature or request new feature priority:high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic colours on cards Rework collection card generation Clean up shiny spawn algorithm
1 participant