Skip to content

GwentCommunityDevelopers/card-images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Gwent-data Card Generator 1.3

This PHP script reads the content of the cards.json file generated by Gwent Data and generate cards images to be used with Gwent tools.

Requirement

The script needs PHP >= 5.6 installed with Imagick and Imagick PHP extension installed. It can be called using HTTP or command line.

The Gwent cards artworks need to be extracted from the game using the high card size (located in the high.standard game file) with their original filenames. The Unity Assets Bundle Extractor can be used for this.

Installation

  1. If you're not familiar with composer, download it and install the dependencies of the script.
  2. Get composer.phar and copy it into the Card Generator folder
  3. Call from command-line php composer.phar install and let it go
  4. Copy the cards artworks into the assets/artworks/ folder.
  5. Copy the last cards.json generated file from Gwent Data in the same folder as card_generator.php

Generating Gwent cards

There is two way to generate the cards :

  1. Generate all the cards the json file contains by calling the script
  2. Generate a few specific cards (ideal for updates) by using the cards parameter and giving the ID of the cards separed with commas.
  • Command line : php card_generator.php cards=112101,112102,112105...
  • HTTP : localhost/card_generator.php?cards=112101,112102,112105,... The card will be generated only if the value of released is 1 in the json file.

You can also specify those optional parameters :

  • version (default : v0-9-10) : current Gwent version. Only used in the destination path
  • maxcards (default : 5) : Maximum cards to be generated before the script stops. Generating all Gwent cards with all the sizes can take hours, keep that in mind when you increase this number. Not-generated cards (not released, error during the generation...) are not counted.
  • sizes (default : original,high,medium,low,thumbnail) : Generated sizes. If you don't need all sizes, you can remove some and make the script faster. To give an idea, when the script takes 20 seconds to generate a card (depending of the hardware), 13 seconds are needed to generate the original size, 4 seconds for the high size, 1 second for the medium size, less than 1 second for low and thumbnail size. So by removing the original size it takes only 1/3 of the time.
  • force_released (optional) : Force the generation of the card even if the card isn't released according to JSON (still, if the card isn't released, the artwork may not exist). If given, must be 1.
  • json (default : cards.json) : Filename containing the Gwent-data JSON

Each parameter must be given as parameter=value. Each card will be generated in the images/**GWENT_VERSION**/**CARD_ID**/**VARIATION_ID**/ folder, with 4 different size versions (original, high, medium, low, thumbnail).

Generating custom cards

To generate a custom card, you need to put the image file in the assets/custom-artworks/ folder The script needs to be called with the custom parameters, followed by those parameters :

  • filename (default : default.png) : filename of the image in the custom-artwork folder
  • strength (default : 0) : Strength of the card. Must be an integer between 1 and 99
  • faction (default : neutral) : Card faction. Must be one of these : northernrealms, scoiatael, skellige, monster, nilfgaard, neutral
  • type (default : bronze) : Card type. Must be one of these : bronze, silver, gold
  • rarity (default : common) : Card rarity. Must be one of these : common, rare, epic, legendary
  • position (optional) : Card position. If given, must be one of these : melee, ranged, siege, multiple
  • spy (optional) : Card is an agent. If given, must be 1
  • count (optional) : Card countdown. If given, must be an integer between 1 and 9
  • sizes (default : original,high,medium,low,thumbnail) : Same as the Gwent cards generation

Each parameter must be given as parameter=value. The custom artwork will be resized with the same height or width as a Gwent artwork, then cropped to fit. If you don't want your image to be cropped, the Height/Width ratio of the image must be 10/7. The card will be generated in the custom-images folder with the same different sizes as Gwent cards.

Example

  • Command line : php card_generator.php custom strength=7 filename=my_custom_card.png faction=nilfgaard spy=1 position=multiple
  • HTTP : localhost/card_generator.php?custom=1&strength=7&filename=my_custom_card.png&faction=nilfgaard&spy=1&position=multiple

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages