Skip to content

Commit 9a3b1f9

Browse files
committed
updated data exports to match new icon paths
1 parent dd0c553 commit 9a3b1f9

File tree

6 files changed

+19
-73
lines changed

6 files changed

+19
-73
lines changed

datasource/!Start.bat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if %GamePath%=="" goto MISSING_PATH
99
echo Game path: %GamePath%
1010
echo.
1111
echo Export data using commands:
12-
echo ui 82100 82999
12+
echo ui 87000 88999
1313
echo allexd
1414
echo exit
1515
echo.
@@ -30,7 +30,8 @@ echo Copying exported data from: %DataPath%
3030
xcopy SaintCoinach\%DataPath%\*.* export\ /e > nul
3131

3232
del ..\assets\icons\*.png
33-
xcopy export\ui\icon\082000\*.png ..\assets\icons\ /s > nul
33+
xcopy export\ui\icon\087000\*.png ..\assets\icons\ /s > nul
34+
xcopy export\ui\icon\088000\*.png ..\assets\icons\ /s > nul
3435

3536
rmdir SaintCoinach\%DataPath% /s /q > nul
3637

sources/data/TriadCardDB.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public TriadCardDB()
1818
{
1919
DBPath = "data/cards.xml";
2020
cards = new List<TriadCard>();
21-
hiddenCard = new TriadCard(0, null, ETriadCardRarity.Common, ETriadCardType.None, 0, 0, 0, 0, 0, 0);
21+
hiddenCard = new TriadCard(0, ETriadCardRarity.Common, ETriadCardType.None, 0, 0, 0, 0, 0, 0);
2222
hiddenCard.Name.Text[LocalizationDB.CodeLanguageIdx] = "(hidden)";
2323

2424
sameNumberMap = new Dictionary<int, List<TriadCard>>();
@@ -51,7 +51,6 @@ public bool Load()
5151

5252
TriadCard newCard = new TriadCard(
5353
int.Parse(cardElem.GetAttribute("id")),
54-
cardElem.GetAttribute("icon"),
5554
cardRarity,
5655
cardType,
5756
ParseCardSideNum(cardElem.GetAttribute("up")),
@@ -144,7 +143,6 @@ public void Save()
144143
{
145144
xmlWriter.WriteStartElement("card");
146145
xmlWriter.WriteAttributeString("id", card.Id.ToString());
147-
xmlWriter.WriteAttributeString("icon", card.IconPath);
148146
xmlWriter.WriteAttributeString("rarity", ((int)card.Rarity).ToString());
149147
xmlWriter.WriteAttributeString("type", ((int)card.Type).ToString());
150148
xmlWriter.WriteAttributeString("up", card.Sides[(int)ETriadGameSide.Up].ToString());

sources/gamelogic/TriadCard.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public class TriadCard : IEquatable<TriadCard>
3939
{
4040
public int Id;
4141
public LocString Name;
42-
public string IconPath;
4342
public ETriadCardRarity Rarity;
4443
public ETriadCardType Type;
4544
public int[] Sides;
@@ -48,6 +47,9 @@ public class TriadCard : IEquatable<TriadCard>
4847
public int Group;
4948
public float OptimizerScore;
5049

50+
public int SmallIconId => 88000 + Id;
51+
public int BigIconId => 87000 + Id;
52+
5153
public TriadCard()
5254
{
5355
Id = -1;
@@ -58,11 +60,10 @@ public TriadCard()
5860
OptimizerScore = 0.0f;
5961
}
6062

61-
public TriadCard(int id, string iconPath, ETriadCardRarity rarity, ETriadCardType type, int numUp, int numDown, int numLeft, int numRight, int sortOrder, int group)
63+
public TriadCard(int id, ETriadCardRarity rarity, ETriadCardType type, int numUp, int numDown, int numLeft, int numRight, int sortOrder, int group)
6264
{
6365
Id = id;
6466
Name = LocalizationDB.Get().FindOrAddLocString(ELocStringType.CardName, id);
65-
IconPath = iconPath;
6667
Rarity = rarity;
6768
Type = type;
6869
Sides = new int[4] { numUp, numLeft, numDown, numRight };

sources/ui/modelproxy/IconDB.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ private void LoadCardImages()
5353
mapCardImages = new List<BitmapImage>();
5454
mapCardImagesBig = new List<BitmapImage>();
5555

56-
string nullImagePath = "icons/082500.png";
56+
string nullImagePath = "icons/088001.png";
5757
var nullImg = LoadImageFromAsset(nullImagePath);
5858

59-
string nullImageBigPath = "icons/082100.png";
59+
string nullImageBigPath = "icons/087000.png";
6060
var nullImgBig = LoadImageFromAsset(nullImageBigPath);
6161

6262
TriadCardDB cardDB = TriadCardDB.Get();
@@ -65,16 +65,11 @@ private void LoadCardImages()
6565
var cardOb = cardDB.cards[idx];
6666
if (cardOb != null && cardOb.IsValid())
6767
{
68-
string loadPath = "icons/" + cardOb.IconPath;
69-
var loadedImage = LoadImageFromAsset(loadPath);
68+
string loadPathSmall = "icons/" + cardOb.SmallIconId.ToString("000000") + ".png";
69+
var loadedImage = LoadImageFromAsset(loadPathSmall);
7070
mapCardImages.Add(loadedImage);
7171

72-
var loadPathIdStr = loadPath.Substring(loadPath.Length - 7, 3);
73-
int loadPathId = int.Parse(loadPathIdStr);
74-
75-
string loadPathBig = loadPath.Substring(0, loadPath.Length - 7);
76-
loadPathBig += (loadPathId - 400);
77-
loadPathBig += ".png";
72+
string loadPathBig = "icons/" + cardOb.BigIconId.ToString("000000") + ".png";
7873
loadedImage = LoadImageFromAsset(loadPathBig);
7974
mapCardImagesBig.Add(loadedImage);
8075
}

sources/utils/DataCoverter.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,7 @@ private bool UpdateCards(GameDataLists gameDataLists, Dictionary<string, ETriadC
169169
cardDB.cards.Add(null);
170170
}
171171

172-
int iconId = 82500 + cardData.Id;
173-
string iconPath = iconId.ToString("000000") + ".png";
174-
175172
cardOb = new TriadCard(cardData.Id,
176-
iconPath,
177173
(ETriadCardRarity)(cardData.rarityIdx - 1),
178174
mapCardTypes[cardData.LinkedType == null ? "" : cardData.LinkedType.Type.GetCodeName()],
179175
cardData.sideTop,
@@ -275,7 +271,7 @@ private bool UpdateNpcs(GameDataLists gameDataLists, Dictionary<string, TriadGam
275271
var listRewards = new List<TriadCard>();
276272
foreach (var rewardData in npcData.LinkedRewards)
277273
{
278-
listRewards.Add(cardDB.cards[rewardData.LinkedCard.Id]);
274+
listRewards.Add(cardDB.cards[rewardData.Id]);
279275
}
280276

281277
npcOb = new TriadNpc(npcId, listMods, listRewards, npcDataDeck);

sources/utils/datamine/GameData.cs

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ public override bool Link(GameDataLists lists)
237237
return false;
238238
}
239239

240-
if (LinkedName.Name.GetCodeName().StartsWith("Wyra"))
241-
{
242-
int a = 1;
243-
a++;
244-
}
245-
246240
return true;
247241
}
248242
}
@@ -331,7 +325,7 @@ public class GameDataNpc : GameData
331325
public List<GameDataCard> LinkedCardsFixed;
332326
public List<GameDataCard> LinkedCardsVariable;
333327
public List<GameDataRule> LinkedRules;
334-
public List<GameDataReward> LinkedRewards;
328+
public List<GameDataCard> LinkedRewards;
335329

336330
public override string ToString() { return string.Format("{0}: {1}", Id.ToString(), LinkedNpcId != null && LinkedNpcId.LinkedName != null ? LinkedNpcId.LinkedName.Name.GetCodeName() : ""); }
337331
public override bool IsRawDataValid(CsvLocalizedData rawData) { return rawData.GetNumColumns() == 31; }
@@ -482,19 +476,19 @@ public override bool Link(GameDataLists lists)
482476
LinkedRules.Add(LinkedRule);
483477
}
484478

485-
LinkedRewards = new List<GameDataReward>();
479+
LinkedRewards = new List<GameDataCard>();
486480
foreach (var itemName in Rewards)
487481
{
488-
var LinkedReward = lists.rewards.Find(x => (x.CardName == itemName));
482+
var LinkedReward = lists.cards.Find(x => (x.LinkedName.Name.GetCodeName() == itemName));
489483
if (LinkedReward == null && itemName.EndsWith(" Card"))
490484
{
491485
var itemName2 = itemName.Substring(0, itemName.Length - 5);
492486

493-
LinkedReward = lists.rewards.Find(x => (x.CardName == itemName2));
487+
LinkedReward = lists.cards.Find(x => (x.LinkedName.Name.GetCodeName() == itemName2));
494488
if (LinkedReward == null)
495489
{
496490
var itemName3 = "The " + itemName2;
497-
LinkedReward = lists.rewards.Find(x => (x.CardName == itemName3));
491+
LinkedReward = lists.cards.Find(x => (x.LinkedName.Name.GetCodeName() == itemName3));
498492
}
499493
}
500494

@@ -511,42 +505,6 @@ public override bool Link(GameDataLists lists)
511505
}
512506
}
513507

514-
public class GameDataReward : GameData
515-
{
516-
public static readonly string CardItemType = "Triple Triad Card";
517-
518-
public string CardName;
519-
520-
public GameDataCard LinkedCard;
521-
522-
public override string ToString() { return Id + ": " + CardName; }
523-
public override bool IsRawDataValid(CsvLocalizedData rawData) { return rawData.GetNumColumns() >= 90; }
524-
public override bool IsValid() { return CardName != null; }
525-
526-
public override void Parse(CsvLocalizedData rawData, int rowIdx)
527-
{
528-
string[] defRow = rawData.data.rows[rowIdx];
529-
530-
if (defRow[16] == CardItemType)
531-
{
532-
Id = int.Parse(defRow[0]);
533-
CardName = defRow[15];
534-
}
535-
}
536-
537-
public override bool Link(GameDataLists lists)
538-
{
539-
LinkedCard = lists.cards.Find(x => (x.LinkedName.Name.GetCodeName() == CardName));
540-
if (LinkedCard == null)
541-
{
542-
Logger.WriteLine("FAILED link: GameDataReward, Id:{0}, Card:{1}, no matching card name", Id, CardName);
543-
return false;
544-
}
545-
546-
return true;
547-
}
548-
}
549-
550508
public class GameDataMap : GameData
551509
{
552510
public string Name;
@@ -708,7 +666,6 @@ public class GameDataLists
708666
public List<GameDataNpcName> npcNames;
709667
public List<GameDataNpcLocation> npcLocations;
710668
public List<GameDataNpc> npcs;
711-
public List<GameDataReward> rewards;
712669
public List<GameDataMap> maps;
713670
public List<GameDataPlaceName> placeNames;
714671
public List<GameDataTournamentName> tournamentNames;
@@ -726,7 +683,6 @@ public void Load(string folderPath)
726683
npcNames = LoadGameData<GameDataNpcName>(folderPath, "ENpcResident");
727684
npcLocations = LoadGameData<GameDataNpcLocation>(folderPath, "Level");
728685
npcs = LoadGameData<GameDataNpc>(folderPath, "TripleTriad");
729-
rewards = LoadGameData<GameDataReward>(folderPath, "Item");
730686
maps = LoadGameData<GameDataMap>(folderPath, "Map");
731687
placeNames = LoadGameData<GameDataPlaceName>(folderPath, "PlaceName");
732688

@@ -747,7 +703,6 @@ public bool Link()
747703
result = result && LinkGameData(npcTriadIds);
748704
result = result && LinkGameData(npcNames);
749705
result = result && LinkGameData(npcs);
750-
result = result && LinkGameData(rewards);
751706
result = result && LinkGameData(npcLocations); // must be after npcs
752707
result = result && LinkGameData(maps);
753708
result = result && LinkGameData(placeNames);

0 commit comments

Comments
 (0)