Skip to content

Commit

Permalink
Update for week 45,
Browse files Browse the repository at this point in the history
Added markdown export
  • Loading branch information
twanvl committed Oct 18, 2018
1 parent d4c8fa1 commit fa79d67
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>StSExporter</groupId>
<artifactId>StSExporter</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>

<name>SpireExporter</name>
<description>Exports Slay the Spire card images, relics, potions, creatures and other data to HTML</description>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/sts_exporter/CreatureExportData.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -95,7 +95,7 @@ public static ArrayList<AbstractCreature> getAllCreatures() {
// Get all player characters
public static ArrayList<AbstractPlayer> getAllPlayers() {
// We need to initialize DailyMods before creating AbstractPlayers
DailyMods.setModsFalse();
ModHelper.setModsFalse();
ArrayList<AbstractPlayer> players = new ArrayList<>();
try {
Method createCharacter = CardCrawlGame.class.getDeclaredMethod("createCharacter", AbstractPlayer.PlayerClass.class);
Expand All @@ -121,7 +121,7 @@ public static ArrayList<AbstractMonster> 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();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/sts_exporter/Exporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModExportData> mods = new ArrayList<>();

Expand Down Expand Up @@ -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");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/ModTheSpire.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/templates/cardlist.md.twig
Original file line number Diff line number Diff line change
@@ -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 %}
5 changes: 5 additions & 0 deletions src/main/resources/templates/creatures.md.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
| Image | Name |
| ----- | ---- |
{% for creature in creatures
%}| ![]({{ creature.relImage }}) | {{ creature.name }} |
{% endfor %}
37 changes: 37 additions & 0 deletions src/main/resources/templates/mod.md.twig
Original file line number Diff line number Diff line change
@@ -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 %}
5 changes: 5 additions & 0 deletions src/main/resources/templates/potions.md.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
| Image | Name | Rarity | Description |
| ----- | ---- | ------ | ----------- |
{% for potion in potions
%}| ![]({{ potion.relImage }}) | {{ potion.name }} | {{ potion.rarity }} | {{ potion.description }} |
{% endfor %}
5 changes: 5 additions & 0 deletions src/main/resources/templates/relics.md.twig
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit fa79d67

Please sign in to comment.