-
Notifications
You must be signed in to change notification settings - Fork 0
ProxyGenerator
Documentation is in the process of being streamlined. Should be complete.
The proxy generator.
#Table of contents
#Overview
This is an option that can be used for definitions to generator mock cards with actual card data. I will try and explain how it is used.
Starting with the basic xml layout and then explaining the different tags in detail.
The basic framework:
<?xml version="1.0" encoding="utf-8" ?>
<templates>
<blocks>
<block type="" id="" src=""> <!-- a block that will be linked in the templates -->
<!-- various options for a block are placed here -->
</block>
</blocks>
<template src="" default="True">
<matches>
<match name="property" value="" /><!-- match a template to a specified property and value-->
</matches>
<overlayblocks>
<link block="" /><!-- the blocks for overlays are linked here like this -->
</overlayblocks>
<textblocks>
<link block="" separator=""><!-- the blocks for text are linked here like this -->
<property name="" /><!-- The property defined on a card to be placed here -->
</link>
</textblocks>
</template>
</templates>
Template are made up of various blocks which can then be linked in any number of templates. For example you can have a default location of the card name. You define it once and then link it in the template you want to use.
Table of contents
#Block elements
Currently block elements have a few attributes of which most are mandatory and some are optional depending on the type of block defined.
Attributes:
- type Mandatory attribute. This defines what sort of block it is. Can only be set to overlay or text. Overlay blocks are used for constructing an image made of various parts. And the text blocks are used to define where on the image you want text to appear.
- id Mandatory attribute. This is the id to be used for linking it in various templates. Has be be a unique id not used in any other blocks.
-
src Optional attribute. This is only used if type is set to overlay. It should contain a relative path to the image file you want to use in constructing the card.
Overlay block:
<block type="overlay" id="overlay1" src="path/to/image">
Text block:
<block type="text" id="textblock1">
block elements can have various sub elements defining where they should be placed and for text blocks you can also define the text color, a rectangle to be used with word wrap and a border to be drawn around the text in a different color to improve readability.
The elements are:
- location Mandatory element. Where the block should be placed.
- text Optional element. What color the text should be and what font size.
- border Optional element. Draw a border around the text with a specified color and thickness.
- wordwrap Optional element. Define a rectangle of a specified height and width to apply word wrapping in.
Now to describe the elements used in blocks in detail.
The location element:
Attributes:
- x Mandatory attribute. The placement of the block on the x axis.
- y Mandatory attribute. The placement of the block on the y axis.
- rotate Optional attribute. The amount of degrees to rotate the text.(0-359). Note: The rotate mathematics are a bit wonky so use at own risk.
- flip Optional attribute. Flip the text True or False. Defaults to False.
<location x="0" y="0" rotate="0" flip="False" />
The text element:
Attributes:
- color Mandatory attribute. The color of the text in a html color format. The # at start of the color code is mandatory.
- size Mandatory attribute. The size of the font in em.
- font Optional attribute. Relative path to a font file.
<text color="#FFFFFF" size="12" font="relative/path/to/fontfile" />
The border element:
Attributes:
- color Mandatory attribute. The color of the border to be drawn around the text in html color format. The # at the start of the color code is mandatory.
- size Mandatory attribute. The size in pixels of the border to be drawn.
<border color="#000000" size="2" />
The wordwrap element:
Attributes:
- height Mandatory attribute. The height of the rectangle to word wrap in.
- width Mandatory attribute. The width of the rectangle to word wrap in.
- align Optional attribute. Horizontal text alignment. Options: near, center, far.
- valign Optional attribute. Vertical text alignment. Options: near, center, far.
<wordwrap height="150" width="300" align="near" valign="near" />
Table of contents
#Templates
A template defines how all the various blocks are placed on a card both for images that get merged into one and the various text that should be used by a specific template. Also which template should be used based on rules you define for the selection.
The template element:
Attributes:
- src Mandatory attribute. The relative path to the base template image.
- default Optional attribute. Its set to False by default. Adding it with True is required on a single template to be used a fallback should no matching templates be found when searching.
<template src="path/to/image" default="True">
Templates are matched on predefined values of certain properties which are declared in match elements. These match elements should always be nested in a single matches element.
There is no limit on the amount of match elements you can use for matching a card to a template.
The match element:
Attributes:
- name Mandatory attribute. The case sensitive name of the card property to check for a value.
- value Mandatory attribute. The case sensitive value of the card property.
<match name="Property" value="thepropertyValue" />
The image to be used can consist of the base image defined in the template element src attribute, but can also have any number of other images added to it as overlays. For overlays to be used in a template the corresponding blocks with the images and locations have to be linked to the template in a overlayblocks element using the link element.
The link element:
Attributes:
- block Mandatory attribute. The case sensitive id you assigned to the block you want to link here.
- separator Optional attribute. This property is used for text blocks which require various properties to be separated. Defined in this attribute is a string sequence that will be used as the glue for it.
<link block="overlay1" separator=" - " />
The text is printed on the image after the overlays are merged into the base image. It uses the same link element as overlays uses but with a sub element name property for getting the right properties printed to the defined locations. You can put multiple property elements under a single link element to have them separated with each other. The default separator is a single spacebar but if defined on the separator attribute of the link element it will use that instead.
The property element:
Attributes:
- name Mandatory attribute. The case sensitive card property to be printed here.
<property name="Name" />
Linebreak character:
or 

Table of contents
#Example xml
<?xml version="1.0" encoding="utf-8" ?>
<templates>
<blocks>
<block type="overlay" id="colorlesstextbox" src="proxy/textbox/colorless.png">
<location x="0" y="0" />
</block>
<block type="overlay" id="colorlesstypeline" src="proxy/typeline/colorless.png">
<location x="0" y="0" />
</block>
<block type="overlay" id="colorlesspt" src="proxy/pt/colorless.png">
<location x="300" y="500" />
</block>
<block type="overlay" id="redtextbox" src="proxy/textbox/red.png">
<location x="0" y="0" />
</block>
<block type="overlay" id="redtypeline" src="proxy/typeline/red.png">
<location x="0" y="0" />
</block>
<block type="overlay" id="redpt" src="proxy/pt/red.png">
<location x="300" y="500" />
</block>
<block type="text" id="title">
<location x="40" y="34" />
<text color="#000000" size="15" />
<border color="#FFFFFF" size="2" />
</block>
<block type="text" id="cost">
<location x="295" y="34" />
<text color="#000000" size="15" />
<border color="#FFFFFF" size="2" />
</block>
<block type="text" id="cardtype">
<location x="40" y="300" />
<text color="#000000" size="15" />
<border color="#FFFFFF" size="2" />
</block>
<block type="text" id="text">
<location x="40" y="330" />
<text color="#000000" size="15" />
<border color="#FFFFFF" size="2" />
<wordwrap height="150" width="300" />
</block>
<block type="text" id="PTBox">
<location x="300" y="470" />
<text color="#000000" size="15" />
<border color="#FFFFFF" size="2" />
</block>
</blocks>
<template src="proxy/border/colorless.png" default="True">
<matches>
<match name="Color" value="value" />
<match name="property2" value="value" />
</matches>
<overlayblocks>
<link block="colorlesstextbox" />
<link block="colorlesstypeline" />
<link block="colorlesspt" />
</overlayblocks>
<textblocks>
<link block="title">
<property name="Name" />
</link>
<link block="cost">
<property name="Cost" />
</link>
<link block="cardtype" separator=" - ">
<property name="Type" />
<property name="Subtype" />
</link>
<link block="text">
<property name="Rules" />
</link>
<link block="PTBox">
<property name="PTBox" />
</link>
</textblocks>
</template>
<template src="proxy/border/red.png">
<matches>
<match name="Color" value="Red" />
<match name="Type" value="Creature" />
</matches>
<overlayblocks>
<link block="redtextbox" />
<link block="redtypeline" />
<link block="redpt" />
</overlayblocks>
<textblocks>
<link block="title">
<property name="Name" />
</link>
<link block="cost">
<property name="Cost" />
</link>
<link block="cardtype" separator=" - ">
<property name="Type" />
<property name="Subtype" />
</link>
<link block="text">
<property name="Rules" />
</link>
<link block="PTBox">
<property name="PTBox" />
</link>
</textblocks>
</template>
</templates>
example gamedef mapping
<proxygen definitionsrc="proxy/proxydef.xml">
</proxygen>