Upgrade from 1.x to 2.0
Yugioh Card 2.0 revises the card data fields. Update constructor data, calls to setData(), and stored JSON together. This guide uses 1.9.2 as the baseline. yugioh-card 1.9.2
Before and after
This is a partial data object for a monster card. Segment numbers start at 1 and follow newlines in cardText.
diff
- { "description": "A demo monster.", "image": "/dragon.png", "scale": 1,
- "firstLineCompress": true, "descriptionAlign": false }
+ { "cardText": "A demo monster.", "artwork": "/dragon.png", "renderScale": 1,
+ "compressCardTextSegments": [1], "cardTextAlign": "justify" }Field mapping
All cards
| 1.x | 2.0 |
|---|---|
scale | renderScale |
radius | roundCorners |
Cards with artwork
| 1.x | 2.0 |
|---|---|
image | artwork |
Yu-Gi-Oh!, Rush Duel, and Series 2
| 1.x | 2.0 |
|---|---|
color | nameColor |
type | cardLayout |
icon | spellTrapIcon |
cardType | monsterFrame |
monsterType | monsterTypeLine |
description | cardText |
descriptionZoom | bodyTextFontSizeScale |
descriptionWeight | bodyTextStrokeWidth |
package | cardNumber |
laser | cornerMark |
firstLineCompress: true / false | compressCardTextSegments: [1] / [] |
descriptionAlign: true / false | cardTextAlign: 'center' / 'justify' |
Yu-Gi-Oh! and Series 2
| 1.x | 2.0 |
|---|---|
align | nameTextAlign |
gradient | applyNameGradient |
gradientColor1 | nameGradientColor1 |
gradientColor2 | nameGradientColor2 |
copyright | copyrightLanguage |
font | textStylePreset |
Yu-Gi-Oh!
| 1.x | 2.0 |
|---|---|
pendulumType | pendulumFrame |
pendulumDescription | pendulumEffect |
atkBar | showBattleStats |
arrowList | linkArrows |
rare | rarity |
twentieth | show20thAnniversaryMark |
Rush Duel
| 1.x | 2.0 |
|---|---|
legend | showLegendMark |
rare | rarity |
Yu-Gi-Oh! Card Back
| 1.x | 2.0 |
|---|---|
type | backDesign |
logo | gameLogo |
konami | showKonamiLogo |
register | showRegisteredMark |
Field Center Card
| 1.x | 2.0 |
|---|---|
cardBack | renderBackSide |
Value and rendering changes
Use linkArrows in place of arrowList. The Link Rating counts unique valid directions. Duplicate positions in older data can produce a different rating in 2.0.
cardTextAlign also accepts 'left' and 'right'. Set compressCardTextSegments: [1, 3] to fit the first and third segments on one line each.
Remove rare from Series 2 data. You can keep password in stored Rush Duel data.
Check the upgrade
- Install the 2.0 package and update the static assets at
resourcePathto the corresponding version, including the newygo-jp.woff2. - Convert stored JSON and check the fields and enums in the API reference. Choose the mapping for the original class. For example,
typerefers to different options on card fronts and card backs. - In both the browser and Node.js, read and await
card.readyafter eachsetData()call, then export. Use the Node.js example to check batch exports. - Re-export representative cards. Check line wrapping and dimensions on Japanese ruby text, longer card text, and Link Monsters.