public void AttemptToAddSelectedRelicData() { if (currentSave != null && selectedRelicData != null && selectedRelicDataGameobject.gameObject.activeSelf) { currentSave.AddRelic(selectedRelicData); } }
public static void LoadSaveState(StokerSaveState saveState, SaveManager save) { if (save != null && saveState != null) { //remove all cards except for champion var deckState = save.GetDeckState(); if (deckState != null) { deckState.RemoveAll(x => !x.IsChampionCard()); List <IDeckNotifications> deckNotifications = (List <IDeckNotifications>)AccessTools.Field(typeof(SaveManager), "deckNotifications").GetValue(save); deckNotifications.ForEach(rn => rn.DeckChangedNotification(deckState, save.GetVisibleDeckCount())); } save.RemoveAllRelics(); if (saveState.relics != null) { foreach (var relic in saveState.relics) { if (relic != null) { var relicData = save.GetAllGameData().FindCollectableRelicData(relic); if (relicData != null) { save.AddRelic(relicData); } } } } if (saveState.cards != null) { foreach (var card in saveState.cards) { if (card.cardName != null || card.cardName != "") { var cardData = save.GetAllGameData().FindCardData(card.cardName); var spawn = cardData.GetSpawnCharacterData(); if (cardData != null && (spawn == null || (spawn != null && !spawn.IsChampion()))) { var state = save.AddCardToDeck(cardData); if (card.upgradeNames != null) { foreach (string upgrade in card.upgradeNames) { if (upgrade != "") { CardUpgradeState cardUpgradeState = Activator.CreateInstance <CardUpgradeState>(); CardUpgradeData data = save.GetAllGameData().FindCardUpgradeData(upgrade); cardUpgradeState.Setup(data); state.Upgrade(cardUpgradeState, null); } } } } } } } } }
static void Postfix(ref SaveManager __instance) { __instance.AddRelic(CustomCollectableRelicManager.GetRelicDataByID(Wimpcicle.ID)); }