Exemple #1
0
        public void Initialize()
        {
            CustomLocalizationManager.ImportCSV("Disciple.csv", ';');
            clanRef = Clan.Make();
            RegisterSubtypes();
            MakeStatuses();
            MakeEnhancers();

            MakeCards();

            foreach (var bundle in BundleManager.LoadedAssetBundles)
            {
                Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, bundle.Value.GetAllAssetNames().Join());
            }

            SecondDisciple.Make();
            Disciple.Make();
            Clan.RegisterBanner();
            MakeArtifacts();

            ProviderManager.SaveManager.GetMetagameSave().SetLevelAndXP(clanRef.GetID(), 10, 99999);

            //PrintCardStats();
            //foreach (SubtypeData s in SubtypeManager.AllData)
            //{
            //    Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Subtype: " + s.LocalizedName + " - Key: " + s.Key);
            //}

            //ProviderManager.SaveManager.EnableTestScenario(ProviderManager.SaveManager.GetAllGameData().FindScenarioDataByName("Level4BattleJunk"), true);
        }
Exemple #2
0
 /// <summary>
 /// Imports localization data for a key.
 /// Sets the translation to text for all languages.
 /// If either key or text is null, the function returns harmlessly.
 /// </summary>
 /// <param name="key">Key to set localization data for</param>
 /// <param name="text">Text for the key in all languages</param>
 public static void ImportStandardLocalization(string key, string text)
 {
     if (key != null && text != null)
     {
         CustomLocalizationManager.ImportSingleLocalization(key, "Text", "", "", "", "", text, text, text, text, text, text);
     }
 }
Exemple #3
0
        public void Initialize()
        {
            CustomLocalizationManager.ImportCSV("influka/Touhou.csv", ';');
            clanRef = TouhouClan.Make();

            StatusEffectMarisaMagic.Make();

            AliceGift.Make();
            Alice.Make();

            Marisa.Make();
            Reimu.Make();

            TouhouClan.RegisterBanner();
            TouhouPlaceholder.Make();
        }
Exemple #4
0
        public void Initialize()
        {
            CustomLocalizationManager.ImportCSV("ag88/Mech.csv", ';');
            clanRef = Clan.Make();
            RegisterSubtypes();

            MakeCards();

            //foreach (var bundle in BundleManager.LoadedAssetBundles)
            //{
            //    API.Log(BepInEx.Logging.LogLevel.All, bundle.Value.GetAllAssetNames().Join());
            //}

            Mechanical.Make();
            SecondMech.Make();
            MakeArtifacts();
        }
Exemple #5
0
        /// <summary>
        /// Builds the RewardData represented by this builder's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created RewardData</returns>
        public RewardData Build()
        {
            RewardData rewardData = ScriptableObject.CreateInstance <DraftRewardData>();

            AccessTools.Field(typeof(GameData), "id").SetValue(rewardData, this.DraftRewardID);
            AccessTools.Field(typeof(DraftRewardData), "classDataOverride").SetValue(rewardData, this.ClassDataOverride);
            AccessTools.Field(typeof(DraftRewardData), "classType").SetValue(rewardData, this.ClassType);
            AccessTools.Field(typeof(DraftRewardData), "classTypeOverride").SetValue(rewardData, this.ClassTypeOverride);
            AccessTools.Field(typeof(DraftRewardData), "draftOptionsCount").SetValue(rewardData, this.DraftOptionsCount);
            AccessTools.Field(typeof(DraftRewardData), "draftPool").SetValue(rewardData, this.DraftPool);
            AccessTools.Field(typeof(DraftRewardData), "grantSingleCard").SetValue(rewardData, this.GrantSingleCard);
            AccessTools.Field(typeof(DraftRewardData), "rarityFloorOverride").SetValue(rewardData, this.RarityFloorOverride);
            AccessTools.Field(typeof(DraftRewardData), "useRunRarityFloors").SetValue(rewardData, this.UseRunRarityFloors);
            AccessTools.Field(typeof(GrantableRewardData), "CanBeSkippedOverride").SetValue(rewardData, this.CanBeSkippedOverride);
            AccessTools.Field(typeof(GrantableRewardData), "ForceContentUnlocked").SetValue(rewardData, this.ForceContentUnlocked);
            AccessTools.Field(typeof(GrantableRewardData), "saveManager").SetValue(rewardData, this.SaveManager);
            AccessTools.Field(typeof(GrantableRewardData), "_isServiceMerchantReward").SetValue(rewardData, this._IsServiceMerchantReward);
            AccessTools.Field(typeof(GrantableRewardData), "_merchantServiceIndex").SetValue(rewardData, this._MerchantServiceIndex);
            AccessTools.Field(typeof(RewardData), "costs").SetValue(rewardData, this.Costs);
            AccessTools.Field(typeof(RewardData), "ShowRewardAnimationInEvent").SetValue(rewardData, this.ShowRewardAnimationInEvent);
            AccessTools.Field(typeof(RewardData), "_collectSFXCueName").SetValue(rewardData, this._CollectSFXCueName);
            if (this.Description != null)
            {
                this._RewardDescriptionKey = "DraftRewardData_" + this.DraftRewardID + "_RewardDescriptionKey";
                // Use Description field for all languages
                // This should be changed in the future to add proper localization support to custom content
                CustomLocalizationManager.ImportSingleLocalization(this._RewardDescriptionKey, "Text", "", "", "", "", this.Description, this.Description, this.Description, this.Description, this.Description, this.Description);
            }
            AccessTools.Field(typeof(RewardData), "_rewardDescriptionKey").SetValue(rewardData, this._RewardDescriptionKey);
            AccessTools.Field(typeof(RewardData), "_rewardSprite").SetValue(rewardData, CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this._RewardSpritePath));
            if (this.Name != null)
            {
                this._RewardTitleKey = "DraftRewardData_" + this.DraftRewardID + "_RewardTitleKey";
                // Use Name field for all languages
                // This should be changed in the future to add proper localization support to custom content
                CustomLocalizationManager.ImportSingleLocalization(this._RewardTitleKey, "Text", "", "", "", "", this.Name, this.Name, this.Name, this.Name, this.Name, this.Name);
            }
            AccessTools.Field(typeof(RewardData), "_rewardTitleKey").SetValue(rewardData, this._RewardTitleKey);
            AccessTools.Field(typeof(RewardData), "_showCancelOverride").SetValue(rewardData, this._ShowCancelOverride);
            AccessTools.Field(typeof(RewardData), "_showRewardFlowInEvent").SetValue(rewardData, this._ShowRewardFlowInEvent);
            return(rewardData);
        }
Exemple #6
0
        /// <summary>
        /// Builds the RewardNodeData represented by this builder's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created RewardNodeData</returns>
        public RewardNodeData Build()
        {
            foreach (var builder in this.RewardBuilders)
            {
                this.Rewards.Add(builder.Build());
            }
            RewardNodeData rewardNodeData = ScriptableObject.CreateInstance <RewardNodeData>();

            AccessTools.Field(typeof(GameData), "id").SetValue(rewardNodeData, this.RewardNodeID);
            AccessTools.Field(typeof(MapNodeData), "ignoreIfNodesPresent").SetValue(rewardNodeData, this.IgnoreIfNodesPresent);
            AccessTools.Field(typeof(MapNodeData), "mapIcon").SetValue(rewardNodeData, CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.MapIconPath));
            if (this.MapIconPrefab == null)
            { // These are too complicated to create from scratch, so by default we copy from an existing game banner and apply our sprites to it
                RewardNodeData copyBanner = (ProviderManager.SaveManager.GetAllGameData().FindMapNodeData("5f35b7b7-75d1-4957-9f78-7d2072237038") as RewardNodeData);
                this.MapIconPrefab = GameObject.Instantiate(copyBanner.GetMapIconPrefab());
                this.MapIconPrefab.transform.parent = null;
                this.MapIconPrefab.name             = this.RewardNodeID;
                GameObject.DontDestroyOnLoad(this.MapIconPrefab);
                var           images      = this.MapIconPrefab.GetComponentsInChildren <Image>(true);
                List <string> spritePaths = new List <string>
                { // This is the order they're listed on the prefab
                    this.ControllerSelectedOutline,
                    this.EnabledSpritePath,
                    this.EnabledVisitedSpritePath,
                    this.DisabledVisitedSpritePath,
                    this.DisabledSpritePath,
                    this.FrozenSpritePath
                };
                for (int i = 0; i < images.Length; i++)
                { // This method of modifying the image's sprite has the unfortunate side-effect of removing the white mouse-over outline
                    var sprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + spritePaths[i]);
                    if (sprite != null)
                    {
                        images[i].sprite   = sprite;
                        images[i].material = null;
                    }
                }
            }
            AccessTools.Field(typeof(MapNodeData), "mapIconPrefab").SetValue(rewardNodeData, this.MapIconPrefab);
            AccessTools.Field(typeof(MapNodeData), "minimapIcon").SetValue(rewardNodeData, CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.MinimapIconPath));
            AccessTools.Field(typeof(MapNodeData), "nodeSelectedSfxCue").SetValue(rewardNodeData, this.NodeSelectedSfxCue);

            AccessTools.Field(typeof(MapNodeData), "skipCheckSettings").SetValue(rewardNodeData, SkipCheckSettings);

            if (this.Description != null)
            {
                this.TooltipBodyKey = "RewardNodeData_" + this.RewardNodeID + "_TooltipBodyKey";
                // Use Description field for all languages
                // This should be changed in the future to add proper localization support to custom content
                CustomLocalizationManager.ImportSingleLocalization(this.TooltipBodyKey, "Text", "", "", "", "", this.Description, this.Description, this.Description, this.Description, this.Description, this.Description);
            }
            AccessTools.Field(typeof(MapNodeData), "tooltipBodyKey").SetValue(rewardNodeData, this.TooltipBodyKey);
            if (this.Name != null)
            {
                this.TooltipTitleKey = "RewardNodeData_" + this.RewardNodeID + "_TooltipTitleKey";
                // Use Name field for all languages
                // This should be changed in the future to add proper localization support to custom content
                CustomLocalizationManager.ImportSingleLocalization(this.TooltipTitleKey, "Text", "", "", "", "", this.Name, this.Name, this.Name, this.Name, this.Name, this.Name);
            }
            AccessTools.Field(typeof(MapNodeData), "tooltipTitleKey").SetValue(rewardNodeData, this.TooltipTitleKey);
            AccessTools.Field(typeof(RewardNodeData), "grantImmediately").SetValue(rewardNodeData, this.GrantImmediately);
            AccessTools.Field(typeof(RewardNodeData), "OverrideTooltipTitleBody").SetValue(rewardNodeData, this.OverrideTooltipTitleBody);
            AccessTools.Field(typeof(RewardNodeData), "requiredClass").SetValue(rewardNodeData, this.RequiredClass);
            AccessTools.Field(typeof(RewardNodeData), "rewards").SetValue(rewardNodeData, this.Rewards);
            return(rewardNodeData);
        }
Exemple #7
0
        /// <summary>
        /// Builds the CardData represented by this builder's parameters recursively;
        /// i.e. all CardEffectBuilders in EffectBuilders will also be built.
        /// </summary>
        /// <returns>The newly created CardData</returns>
        public CardData Build()
        {
            foreach (var builder in this.EffectBuilders)
            {
                this.Effects.Add(builder.Build());
            }
            foreach (var builder in this.TraitBuilders)
            {
                this.Traits.Add(builder.Build());
            }
            foreach (var builder in this.EffectTriggerBuilders)
            {
                this.EffectTriggers.Add(builder.Build());
            }
            foreach (var builder in this.TriggerBuilders)
            {
                this.Triggers.Add(builder.Build());
            }

            var allGameData = ProviderManager.SaveManager.GetAllGameData();

            if (this.LinkedClass == null)
            {
                this.LinkedClass = CustomClassManager.GetClassDataByID(this.ClanID);
            }
            CardData cardData = ScriptableObject.CreateInstance <CardData>();
            var      guid     = GUIDGenerator.GenerateDeterministicGUID(this.CardID);

            AccessTools.Field(typeof(CardData), "id").SetValue(cardData, guid);
            cardData.name = this.CardID;
            if (this.CardArtPrefabVariantRef == null)
            {
                if (this.CardArtPrefabVariantRefBuilder == null)
                {
                    if (this.BundleLoadingInfo != null)
                    {
                        this.BundleLoadingInfo.PluginPath   = this.BaseAssetPath;
                        this.CardArtPrefabVariantRefBuilder = new AssetRefBuilder
                        {
                            AssetLoadingInfo = this.BundleLoadingInfo
                        };
                    }
                    else
                    {
                        var assetLoadingInfo = new AssetLoadingInfo()
                        {
                            FilePath   = this.AssetPath,
                            PluginPath = this.BaseAssetPath,
                            AssetType  = AssetRefBuilder.AssetTypeEnum.CardArt
                        };
                        this.CardArtPrefabVariantRefBuilder = new AssetRefBuilder
                        {
                            AssetLoadingInfo = assetLoadingInfo
                        };
                    }
                }
                this.CardArtPrefabVariantRef = this.CardArtPrefabVariantRefBuilder.BuildAndRegister();
            }
            AccessTools.Field(typeof(CardData), "cardArtPrefabVariantRef").SetValue(cardData, this.CardArtPrefabVariantRef);
            AccessTools.Field(typeof(CardData), "cardLoreTooltipKeys").SetValue(cardData, this.CardLoreTooltipKeys);
            AccessTools.Field(typeof(CardData), "cardType").SetValue(cardData, this.CardType);
            AccessTools.Field(typeof(CardData), "cost").SetValue(cardData, this.Cost);
            AccessTools.Field(typeof(CardData), "costType").SetValue(cardData, this.CostType);
            AccessTools.Field(typeof(CardData), "effects").SetValue(cardData, this.Effects);
            AccessTools.Field(typeof(CardData), "effectTriggers").SetValue(cardData, this.EffectTriggers);
            AccessTools.Field(typeof(CardData), "fallbackData").SetValue(cardData, this.FallbackData);
            AccessTools.Field(typeof(CardData), "ignoreWhenCountingMastery").SetValue(cardData, this.IgnoreWhenCountingMastery);
            AccessTools.Field(typeof(CardData), "linkedClass").SetValue(cardData, this.LinkedClass);
            AccessTools.Field(typeof(CardData), "linkedMasteryCard").SetValue(cardData, this.LinkedMasteryCard);
            if (this.Name != null)
            {
                // Use Name field for all languages
                // This should be changed in the future to add proper localization support to custom content
                CustomLocalizationManager.ImportSingleLocalization(this.NameKey, "Text", "", "", "", "", this.Name, this.Name, this.Name, this.Name, this.Name, this.Name);
            }
            AccessTools.Field(typeof(CardData), "nameKey").SetValue(cardData, this.NameKey);
            if (this.Description != null)
            {
                // Use Description field for all languages
                // This should be changed in the future to add proper localization support to custom content
                CustomLocalizationManager.ImportSingleLocalization(this.OverrideDescriptionKey, "Text", "", "", "", "", this.Description, this.Description, this.Description, this.Description, this.Description, this.Description);
            }
            AccessTools.Field(typeof(CardData), "overrideDescriptionKey").SetValue(cardData, this.OverrideDescriptionKey);
            AccessTools.Field(typeof(CardData), "rarity").SetValue(cardData, this.Rarity);
            AccessTools.Field(typeof(CardData), "sharedMasteryCards").SetValue(cardData, this.SharedMasteryCards);
            if (this.SpriteCache != null)
            {
                AccessTools.Field(typeof(CardData), "spriteCache").SetValue(cardData, this.SpriteCache);
            }
            AccessTools.Field(typeof(CardData), "startingUpgrades").SetValue(cardData, this.StartingUpgrades);
            AccessTools.Field(typeof(CardData), "targetless").SetValue(cardData, this.Targetless);
            AccessTools.Field(typeof(CardData), "targetsRoom").SetValue(cardData, this.TargetsRoom);
            foreach (CardTraitData cardTraitData in this.Traits)
            {
                AccessTools.Field(typeof(CardTraitData), "paramCardData").SetValue(cardTraitData, cardData);
            }
            AccessTools.Field(typeof(CardData), "traits").SetValue(cardData, this.Traits);
            AccessTools.Field(typeof(CardData), "triggers").SetValue(cardData, this.Triggers);
            AccessTools.Field(typeof(CardData), "unlockLevel").SetValue(cardData, this.UnlockLevel);

            return(cardData);
        }