Beispiel #1
0
        public string GetCardStateName(CardState card)
        {
            string             modifiers = "";
            CardStateModifiers st        = card.GetCardStateModifiers();

            if (st != null)
            {
                List <CardUpgradeState> upgrades = st.GetCardUpgrades().OrderBy(x => x.GetUpgradeTitle()).ToList();
                if (upgrades.Count > 0)
                {
                    modifiers += ":";
                }
                for (int index = 0; index < upgrades.Count; index++)
                {
                    modifiers += GetUpgradeText(data.FindCardUpgradeData(upgrades[index].GetCardUpgradeDataId())) + ((index != upgrades.Count - 1) ? ", " : "");
                }
            }
            string text2 = $"{card.GetTitle()}{modifiers}";

            return(text2);
        }
        static void Postfix(CardTooltipContainer __instance, CardState cardState, CardStateModifiers cardModifiers, CardStateModifiers tempCardModifiers, SaveManager saveManager)
        {
            // This generates additional generic tooltips for both the card and the character, hardcoded to this character to avoid conflicts
            if (cardState.GetID() != "e124d0b1-0c5e-4f6b-98a0-4b70faabf752")
            {
                return;
            }

            // This check will find cards that have upgrades already applied to them
            foreach (CardUpgradeState cardUpgrade in cardModifiers.GetCardUpgrades())
            {
                foreach (RoomModifierData roomModifier in cardUpgrade.GetRoomModifierUpgrades())
                {
                    if (roomModifier.GetRoomStateModifierClassName() == typeof(RoomStateModifierStartersConsumeRebate).AssemblyQualifiedName)
                    {
                        // Add tooltips for both Consume and Rebate (in that order)
                        __instance.InstantiateTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), CardTraitData.GetTraitTooltipTextLocalizationKey("CardTraitExhaustState"));
                        __instance.InstantiateTooltip("Rebate_TooltipTitle", TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip("Rebate_TooltipTitle", "Rebate_TooltipBody");
                    }
                }
            }

            // This check will find cards with temporary upgrades (ie. In the Dark Forge)
            foreach (CardUpgradeState cardUpgrade in tempCardModifiers.GetCardUpgrades())
            {
                foreach (RoomModifierData roomModifier in cardUpgrade.GetRoomModifierUpgrades())
                {
                    Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Found Temp RoomModifierData");
                    if (roomModifier.GetRoomStateModifierClassName() == typeof(RoomStateModifierStartersConsumeRebate).AssemblyQualifiedName)
                    {
                        Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Match!");
                        // Add tooltips for both Consume and Rebate (in that order)
                        __instance.InstantiateTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), CardTraitData.GetTraitTooltipTextLocalizationKey("CardTraitExhaustState"));
                        __instance.InstantiateTooltip("Rebate_TooltipTitle", TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip("Rebate_TooltipTitle", "Rebate_TooltipBody");
                    }
                }
            }
        }