From fa79d6712da6ec709af4304ff681e118ede6501f Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Fri, 19 Oct 2018 00:16:35 +0200 Subject: [PATCH] Update for week 45, Added markdown export --- CHANGELOG.md | 4 ++ pom.xml | 2 +- .../java/sts_exporter/CreatureExportData.java | 6 +-- src/main/java/sts_exporter/Exporter.java | 5 ++- src/main/resources/ModTheSpire.json | 4 +- src/main/resources/templates/cardlist.md.twig | 5 +++ .../resources/templates/creatures.md.twig | 5 +++ src/main/resources/templates/mod.md.twig | 37 +++++++++++++++++++ src/main/resources/templates/potions.md.twig | 5 +++ src/main/resources/templates/relics.md.twig | 5 +++ 10 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/templates/cardlist.md.twig create mode 100644 src/main/resources/templates/creatures.md.twig create mode 100644 src/main/resources/templates/mod.md.twig create mode 100644 src/main/resources/templates/potions.md.twig create mode 100644 src/main/resources/templates/relics.md.twig diff --git a/CHANGELOG.md b/CHANGELOG.md index 0824e6e..6cdd3c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 0.3.2 +* Fix for week 45 release +* Add markdown export + ### 0.3.1 * Fix mod pages on case sensitive file systems * Fix invalid characters in filenames (issue #1) diff --git a/pom.xml b/pom.xml index 82dd701..eb28f5c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ StSExporter StSExporter - 0.3.1 + 0.3.2 SpireExporter Exports Slay the Spire card images, relics, potions, creatures and other data to HTML diff --git a/src/main/java/sts_exporter/CreatureExportData.java b/src/main/java/sts_exporter/CreatureExportData.java index de73d45..7ea3128 100644 --- a/src/main/java/sts_exporter/CreatureExportData.java +++ b/src/main/java/sts_exporter/CreatureExportData.java @@ -14,8 +14,8 @@ import com.megacrit.cardcrawl.core.AbstractCreature; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.core.Settings; -import com.megacrit.cardcrawl.daily.DailyMods; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; +import com.megacrit.cardcrawl.helpers.ModHelper; import com.megacrit.cardcrawl.helpers.MonsterHelper; import com.megacrit.cardcrawl.map.MapRoomNode; import com.megacrit.cardcrawl.monsters.AbstractMonster; @@ -95,7 +95,7 @@ public static ArrayList getAllCreatures() { // Get all player characters public static ArrayList getAllPlayers() { // We need to initialize DailyMods before creating AbstractPlayers - DailyMods.setModsFalse(); + ModHelper.setModsFalse(); ArrayList players = new ArrayList<>(); try { Method createCharacter = CardCrawlGame.class.getDeclaredMethod("createCharacter", AbstractPlayer.PlayerClass.class); @@ -121,7 +121,7 @@ public static ArrayList getAllMonsters() { AbstractDungeon.generateSeeds(); // For rendering monsters we need: - AbstractDungeon.player = new Ironclad("Ironclad", AbstractPlayer.PlayerClass.IRONCLAD); + AbstractDungeon.player = CardCrawlGame.characterManager.getAllCharacters().get(0); AbstractDungeon.player.isDead = true; // don't render monster health bars AbstractDungeon.currMapNode = new MapRoomNode(0, -1); AbstractDungeon.currMapNode.room = new EmptyRoom(); diff --git a/src/main/java/sts_exporter/Exporter.java b/src/main/java/sts_exporter/Exporter.java index b9c1286..c3a0a96 100644 --- a/src/main/java/sts_exporter/Exporter.java +++ b/src/main/java/sts_exporter/Exporter.java @@ -31,8 +31,8 @@ @SpireInitializer public class Exporter implements PostInitializeSubscriber { public static final Logger logger = LogManager.getLogger(Exporter.class.getName()); - private static final String[] colorTemplates = {"cardlist.html","cardlist.wiki","wiki-card-data.txt"}; - private static final String[] indexTemplates = {"index.html","creatures.html","potions.html","relics.html","style.css"}; + private static final String[] colorTemplates = {"cardlist.html","cardlist.md","cardlist.wiki","wiki-card-data.txt"}; + private static final String[] indexTemplates = {"index.html","creatures.html","potions.html","relics.html","creatures.md","potions.md","relics.md","style.css"}; private static ArrayList mods = new ArrayList<>(); @@ -147,6 +147,7 @@ static void exportAllMods(String modsdir) { model.with("potions", mod.potions); model.with("selection", mod.name); writeTwigTemplate(model, "templates/mod.html.twig", modsdir + "/" + mod.id + ".html"); + writeTwigTemplate(model, "templates/mod.md.twig", modsdir + "/" + mod.id + ".md"); } } diff --git a/src/main/resources/ModTheSpire.json b/src/main/resources/ModTheSpire.json index 16c239b..ed0cd55 100644 --- a/src/main/resources/ModTheSpire.json +++ b/src/main/resources/ModTheSpire.json @@ -3,8 +3,8 @@ "name": "Spire Exporter", "author_list": ["twanvl"], "description": "Exports card images, relics, potions, creatures and other data to HTML.", - "version": "0.3.1", - "sts_version": "08-30-2018", + "version": "0.3.2", + "sts_version": "10-11-2018", "mts_version": "3.0.0", "dependencies": ["basemod"], "update_json": "https://api.github.com/repos/twanvl/sts-exporter/releases/latest" diff --git a/src/main/resources/templates/cardlist.md.twig b/src/main/resources/templates/cardlist.md.twig new file mode 100644 index 0000000..c8ef573 --- /dev/null +++ b/src/main/resources/templates/cardlist.md.twig @@ -0,0 +1,5 @@ +| Name | Image | Upgraded image | Rarity | Type | Cost | Description | +| ---- | ----- | -------------- | ------ | ---- | ---- | ----------- | +{% for card in cards +%}| {{ card.name }} | ![]({{ card.relSmallImage }}) | ![]({{ card.upgrade.relSmallImage }}) | {{ card.rarity }} | {{ card.type }} | {{ card.costAndUpgrade }} | {{ card.textAndUpgrade }} | +{% endfor %} \ No newline at end of file diff --git a/src/main/resources/templates/creatures.md.twig b/src/main/resources/templates/creatures.md.twig new file mode 100644 index 0000000..cb33eee --- /dev/null +++ b/src/main/resources/templates/creatures.md.twig @@ -0,0 +1,5 @@ +| Image | Name | +| ----- | ---- | +{% for creature in creatures +%}| ![]({{ creature.relImage }}) | {{ creature.name }} | +{% endfor %} \ No newline at end of file diff --git a/src/main/resources/templates/mod.md.twig b/src/main/resources/templates/mod.md.twig new file mode 100644 index 0000000..7378720 --- /dev/null +++ b/src/main/resources/templates/mod.md.twig @@ -0,0 +1,37 @@ +{% if mod.cards %} +## Cards + +| Name | Image | Upgraded image | Rarity | Type | Cost | Description | +| ---- | ----- | -------------- | ------ | ---- | ---- | ------------| +{% for card in mod.cards +%}| {{ card.name }} | ![]({{ card.relSmallImage }}) | ![]({{ card.upgrade.relSmallImage }}) | {{ card.rarity }} | {{ card.type }} | {{ card.costAndUpgrade }} | {{ card.textAndUpgrade }} | +{% endfor %} +{% endif %} + +{% if mod.creatures %} +## Potions + +| Image | Name | Rarity | Description | +| ----- | ---- | ------ | ----------- | +{% for potion in mod.potions +%}| ![]({{ potion.relImage }}) | {{ potion.name }} | {{ potion.rarity }} | {{ potion.description }} | +{% endfor %} +{% endif %} + +{% if mod.relics %} +## Relics + +| Image | Name | Rarity | Color | Description | Flavor | +| ----- | ---- | ------ | ----- | ----------- | ------ | +{% for relic in mod.relics +%}| ![]({{ relic.relImage }}) | {{ relic.name }} | {{ relic.tier }} | {{ relic.pool }} | {{ relic.description }} | {{ relic.flavorText }} | +{% endfor %} +{% endif %} + +{% if mod.creatures %} +| Image | Name | +| ----- | ---- | +{% for creature in mod.creatures +%}| ![]({{ creature.relImage }}) | {{ creature.name }} | +{% endfor %} +{% endif %} \ No newline at end of file diff --git a/src/main/resources/templates/potions.md.twig b/src/main/resources/templates/potions.md.twig new file mode 100644 index 0000000..55f2e24 --- /dev/null +++ b/src/main/resources/templates/potions.md.twig @@ -0,0 +1,5 @@ +| Image | Name | Rarity | Description | +| ----- | ---- | ------ | ----------- | +{% for potion in potions +%}| ![]({{ potion.relImage }}) | {{ potion.name }} | {{ potion.rarity }} | {{ potion.description }} | +{% endfor %} diff --git a/src/main/resources/templates/relics.md.twig b/src/main/resources/templates/relics.md.twig new file mode 100644 index 0000000..8b2051d --- /dev/null +++ b/src/main/resources/templates/relics.md.twig @@ -0,0 +1,5 @@ +| Image | Name | Rarity | Color | Description | Flavor | +| ----- | ---- | ------ | ----- | ----------- | ------ | +{% for relic in relics +%}| ![]({{ relic.relImage }}) | {{ relic.name }} | {{ relic.tier }} | {{ relic.pool }} | {{ relic.description }} | {{ relic.flavorText }} | +{% endfor %} \ No newline at end of file