Skip to content

Commit

Permalink
Fix compatibility for Transe Seek saves
Browse files Browse the repository at this point in the history
- Remove custom items from player equipment if items didn't exist on Items.csv (#401)
- If SA custom didn't exist, deactivated on player
  • Loading branch information
DV666 authored Apr 27, 2024
1 parent 73b48cf commit 9cdd3ac
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Assembly-CSharp/Global/JsonParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,10 +1213,13 @@ private void ParseCommonJsonToData(JSONNode jsonData, Boolean oldSaveFormat = tr
player.info.menu_type = (CharacterPresetId)playerInfoClass["menu_type"].AsInt;
if (playerClass["status"] != null)
player.status = (BattleStatus)playerClass["status"].AsInt;
if (playerClass["equip"] != null)
for (Int32 j = 0; j < playerClass["equip"].Count && j < CharacterEquipment.Length; j++)
player.equip[j] = (RegularItem)playerClass["equip"][j].AsInt;
JSONClass playerBonusClass = playerClass["bonus"].AsObject;
if (playerClass["equip"] != null)
for (Int32 j = 0; j < playerClass["equip"].Count && j < CharacterEquipment.Length; j++)
if (ff9item._FF9Item_Data.ContainsKey((RegularItem)playerClass["equip"][j].AsInt))
player.equip[j] = (RegularItem)playerClass["equip"][j].AsInt;
else
player.equip[j] = RegularItem.NoItem;
JSONClass playerBonusClass = playerClass["bonus"].AsObject;
if (playerBonusClass["dex"] != null)
player.bonus.dex = (UInt16)playerBonusClass["dex"].AsInt;
if (playerBonusClass["str"] != null)
Expand Down Expand Up @@ -1262,12 +1265,13 @@ private void ParseCommonJsonToData(JSONNode jsonData, Boolean oldSaveFormat = tr
if ((player.sa[j >> 5] & (1u << j)) != 0u)
player.saExtended.Add((SupportAbility)j);
}
else if (playerClass["sa_extended"] != null)
{
for (Int32 j = 0; j < playerClass["sa_extended"].Count; j++)
ff9abil.FF9Abil_SetEnableSA(player, (SupportAbility)playerClass["sa_extended"][j].AsInt, true);
}
}
else if (playerClass["sa_extended"] != null)
{
for (Int32 j = 0; j < playerClass["sa_extended"].Count; j++)
if (ff9abil.FF9Abil_GetIndex(player, playerClass["sa_extended"][j].AsInt) > 0)
ff9abil.FF9Abil_SetEnableSA(player, (SupportAbility)playerClass["sa_extended"][j].AsInt, true);
}
}
if (playerBonusClass["maxHpLimit"] != null)
player.maxHpLimit = playerBonusClass["maxHpLimit"].AsUInt;
if (playerBonusClass["maxMpLimit"] != null)
Expand Down

0 comments on commit 9cdd3ac

Please sign in to comment.