internal static void Init() { using (System.IO.Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GiganticAmethyst.amethyst")) { AmethystBundle = AssetBundle.LoadFromStream(stream); AmethystProvider = new AssetBundleResourcesProvider(ModPrefix.Trim(':'), AmethystBundle); ResourcesAPI.AddProvider(AmethystProvider); AmethystPrefab = AmethystBundle.LoadAsset <GameObject>("Assets/Amethyst.prefab"); }; AmethystAsEquip(); }
public static void Init() { if (Loaded) { return; } Loaded = true; var execAssembly = Assembly.GetExecutingAssembly(); using (var stream = execAssembly.GetManifestResourceStream("JarlykMods.Hailstorm.hailstorm.assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(Prefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); DarknessShader = bundle.LoadAsset <Shader>("Assets/Effects/darkness.shader"); PureBlack = bundle.LoadAsset <Material>("Assets/Materials/PureBlack.mat"); PurpleCracks = bundle.LoadAsset <Material>("Assets/Materials/PurpleCracks.mat"); TwisterVisualPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/TwisterVisual.prefab"); TwisterPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/Twister.prefab"); TwisterProjectileController.AugumentPrefab(TwisterPrefab); BarrierMaterial = Resources.Load <GameObject>("Prefabs/TemporaryVisualEffects/barriereffect") .GetComponentInChildren <MeshRenderer>().material; CataclysmPlatformPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/CataclysmPlatform.prefab"); CataclysmPlatformPrefab.AddComponent <MobilePlatform>(); CataclysmSkyboxMaterial = bundle.LoadAsset <Material>("Assets/SpaceSkies Free/Skybox_3/Purple_4K_Resolution.mat"); CataclysmArenaPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/CataclysmArena.prefab"); GravBombPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/GravBomb.prefab"); GravBombEffect.AugmentPrefab(GravBombPrefab); AsteroidProjectilePrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/AsteroidProjectile.prefab"); AsteroidProjectileController.AugmentPrefab(AsteroidProjectilePrefab); LaserChargerPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/LaserCharger.prefab"); LaserChargerInteraction.AugmentPrefab(LaserChargerPrefab); } using (var bankStream = execAssembly.GetManifestResourceStream("JarlykMods.Hailstorm.Hailstorm.bnk")) { var bytes = new byte[bankStream.Length]; bankStream.Read(bytes, 0, bytes.Length); SoundBanks.Add(bytes); } On.RoR2.Networking.GameNetworkManager.OnStartClient += GameNetworkManager_OnStartClient; }
public void Awake() { logger = Logger; cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true); mainMenuOpenDelay = cfgFile.Bind(new ConfigDefinition("Client", "MainMenuOpenDelay"), 0.2f, new ConfigDescription("Time between ping keydown and opening of the radial menu. Faster keyups will cause a quick ping (vanilla behavior).", new AcceptableValueRange <float>(0f, float.MaxValue))).Value; //todo: option to keep first ping preview as result using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RadialPings.radialpings_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@RadialPings", bundle); ResourcesAPI.AddProvider(provider); } using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RadialPings.lang_en.json")) using (var reader = new StreamReader(stream)) { LanguageAPI.Add(reader.ReadToEnd()); } RadialMenu.Setup(); new MainPingMenuBindings(); new PlayersMenuBindings(); new DroneMenuBindings(); new RespondablesMenuBindings(); On.RoR2.PlayerCharacterMasterController.CheckPinging += On_PlayerCharacterMasterController_CheckPinging; On.RoR2.Run.OnDestroy += On_Run_OnDestroy; R2API.Networking.NetworkingAPI.RegisterMessageType <PingMenuHelper.MsgCustomPing>(); #if DEBUG On.RoR2.Networking.GameNetworkManager.OnClientConnect += (orig, self, conn) => { if (!self.clientLoadedScene) { ClientScene.Ready(conn); if (self.autoCreatePlayer) { ClientScene.AddPlayer(0); } } self.clientRttFrame = 0f; self.filteredClientRttFixed = 0f; self.ClientSetPlayers(conn); RoR2.Networking.RttManager.OnConnectionDiscovered(conn); }; On.RoR2.NetworkUser.UpdateUserName += (orig, self) => { self.userName = $"DEBUG USER NetID:{self.netId}"; }; #endif }
public static void PopulateAssets() { // populate ASSets if (MainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FastArtiBolts.arti")) { MainAssetBundle = AssetBundle.LoadFromStream(assetStream); Provider = new AssetBundleResourcesProvider("@FastArtiBolts", MainAssetBundle); ResourcesAPI.AddProvider(Provider); } } // gather assets FastBoltIcon = MainAssetBundle.LoadAsset <Sprite>("texMageSkillIcon"); }
public void Awake() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GlassArtifactOHP.glassohp_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@GlassArtifactOHP", bundle); ResourcesAPI.AddProvider(provider); } IL.RoR2.CharacterBody.RecalculateStats += IL_CBRecalcStats; if (!ilFailed) { ArtifactCatalog.getAdditionalEntries += Evt_ACGetAdditionalEntries; } }
internal static void PopulateAssets() { if (mainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.pleasechangethisnameinyourprojectorelseyouwillcauseconflicts")) { mainAssetBundle = AssetBundle.LoadFromStream(assetStream); var provider = new AssetBundleResourcesProvider("@Henry", mainAssetBundle); ResourcesAPI.AddProvider(provider); } } using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.HenryBank.bnk")) { byte[] array = new byte[manifestResourceStream2.Length]; manifestResourceStream2.Read(array, 0, array.Length); SoundAPI.SoundBanks.Add(array); } swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit"); punchHitSoundEvent = CreateNetworkSoundEventDef("HenryPunchHit"); dustEffect = LoadEffect("HenryDustEffect"); bombExplosionEffect = LoadEffect("BombExplosionEffect"); ShakeEmitter shakeEmitter = bombExplosionEffect.AddComponent <ShakeEmitter>(); shakeEmitter.amplitudeTimeDecay = true; shakeEmitter.duration = 0.5f; shakeEmitter.radius = 200f; shakeEmitter.scaleShakeRadiusWithLocalScale = false; shakeEmitter.wave = new Wave { amplitude = 1f, frequency = 40f, cycleOffset = 0f }; swordSwingEffect = Assets.LoadEffect("HenrySwordSwingEffect"); swordHitImpactEffect = Assets.LoadEffect("ImpactHenrySlash"); punchSwingEffect = Assets.LoadEffect("HenryFistSwingEffect"); //punchImpactEffect = Assets.LoadEffect("ImpactHenryPunch"); // on second thought my effect sucks so imma just clone loader's punchImpactEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniImpactVFXLoader"), "ImpactHenryPunch"); punchImpactEffect.AddComponent <NetworkIdentity>(); EffectAPI.AddEffect(punchImpactEffect); }
public void Awake() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ExtraItems.extraitem_assets")) { MainAssets = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider($"@{ModName}", MainAssets); ResourcesAPI.AddProvider(provider); } //Item initialization var ItemTypes = Assembly.GetExecutingAssembly().GetTypes().Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))); foreach (var itemType in ItemTypes) { ItemBase item = (ItemBase)System.Activator.CreateInstance(itemType); if (ValidateItem(item, Items)) { item.Init(Config); ModLogger.LogInfo("Item: " + item.ItemName + " Initialized!"); } } //Material Shader Conversion var materialAssets = MainAssets.LoadAllAssets <Material>(); ModLogger.LogInfo("Intersection Shader is: " + IntersectionShader); foreach (Material material in materialAssets) { if (!material.shader.name.StartsWith("Fake")) { continue; } switch (material.shader.name.ToLower()) { case ("fake ror/hopoo games/deferred/hgstandard"): material.shader = HopooShader; break; case ("fake ror/hopoo games/fx/hgcloud intersection remap"): material.shader = IntersectionShader; break; case ("fake ror/hopoo games/fx/hgcloud remap"): material.shader = CloudRemapShader; break; } } }
internal static void Init() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GNCProtoRocket.exampleitemmod")) { Debug.Log(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]); var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); GNCProtoRocketPrefab = bundle.LoadAsset <GameObject>("Assets/Import/belt/belt.prefab"); } AddTokens(); AddGNCProtoRocket(); }
internal static void PopulateAssets() { if (mainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MonsterVariants.monstervariants")) { mainAssetBundle = AssetBundle.LoadFromStream(assetStream); var provider = new AssetBundleResourcesProvider("@MonsterVariants", mainAssetBundle); ResourcesAPI.AddProvider(provider); } } armoredMesh = mainAssetBundle.LoadAsset <Mesh>("meshArmoredBeetle"); speedyBeetleMesh = mainAssetBundle.LoadAsset <Mesh>("meshSpeedyBeetle"); }
internal static void PopulateAssets() { if (mainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.PleaseChangeThisNameInYourProjectOrElseYouWillCauseConflicts")) { mainAssetBundle = AssetBundle.LoadFromStream(assetStream); var provider = new AssetBundleResourcesProvider("@Henry", mainAssetBundle); ResourcesAPI.AddProvider(provider); } } //swordSwingEffect = Assets.LoadEffect("HenrySwingEffect"); //swordHitImpactEffect = Assets.LoadEffect("HenrySwingImpactEffect"); }
private void Awake() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ares.ares_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@Ares", bundle); ResourcesAPI.AddProvider(provider); } AffixEquipment.Add(new TheirReminder()); foreach (AffixEquipmentBase AffixEquip in AffixEquipment) { AffixEquip.Init(base.Config); } }
public Assets() { Log.LogI("Loading assets..."); commandoMaterial = Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren <CharacterModel>().baseRendererInfos[0].defaultMaterial; // populate ASSETS if (mainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Henry.henrybundle")) { mainAssetBundle = AssetBundle.LoadFromStream(assetStream); provider = new AssetBundleResourcesProvider("@IGiveEnigmaAllRightsToMyMod", mainAssetBundle); ResourcesAPI.AddProvider(provider); } } }
internal static void Init() { // First registering your AssetBundle into the ResourcesAPI with a modPrefix that'll also be used for your prefab and icon paths // note that the string parameter of this GetManifestResourceStream call will change depending on // your namespace and file name using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomItem.rampage")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); BiscoLeashPrefab = bundle.LoadAsset <GameObject>("Assets/Import/belt/belt.prefab"); } BiscoLeashAsRedTierItem(); BiscoLeashAsEquipment(); AddLanguageTokens(); }
public void Assets() { const string ModPrefix = "@CustomItem:"; const string PrefabPath = ModPrefix + "Assets/Import/belt/belt.prefab"; const string IconPath = ModPrefix + "Assets/Import/belt_icon/belt_icon.png"; using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ModItem.rampage")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); BiscoLeashPrefab = bundle.LoadAsset <GameObject>("Assets/Import/belt/belt.prefab"); } ItemDef itemDef = new ItemDef { name = "ThornsPotion", tier = ItemTier.Tier2, pickupModelPath = PrefabPath, pickupIconPath = IconPath, nameToken = "Thorn's Potion", pickupToken = "Return to sender", descriptionToken = "Have a 30% chance to return the damage delt to you (+100%)", loreToken = "Empty", tags = new[] { ItemTag.Utility, ItemTag.Damage } }; ItemDisplayRule[] itemDisplayRules = new ItemDisplayRule[1]; // keep this null if you don't want the item to show up on the survivor 3d model. You can also have multiple rules ! itemDisplayRules[0].followerPrefab = BiscoLeashPrefab; // the prefab that will show up on the survivor itemDisplayRules[0].childName = "Chest"; // this will define the starting point for the position of the 3d model, you can see what are the differents name available in the prefab model of the survivors itemDisplayRules[0].localScale = new Vector3(0.15f, 0.15f, 0.15f); // scale the model itemDisplayRules[0].localAngles = new Vector3(0f, 180f, 0f); // rotate the model itemDisplayRules[0].localPos = new Vector3(-0.35f, -0.1f, 0f); // position offset relative to the childName, here the survivor Chest var thornsPotion = new CustomItem(itemDef, itemDisplayRules); Class1.ThornsPotion = ItemAPI.Add(thornsPotion); // ItemAPI sends back the ItemIndex of your item }
internal static void Init() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FloppyCrabsItems.floppycrabsitems")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); } // null = Do not display on Character var nullDisplay = new ItemDisplayRuleDict(null); aPistolAsRedTierItem(nullDisplay); garbAsGreenTierItem(nullDisplay); lightArmourAsBuff(); // Adds string definitions for the language tokens defined below AddLanguageTokens(); }
internal static void Init() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GNCItemSuite.exampleitemmod")) { Debug.Log(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]); var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); PoisonOnHitPrefab = bundle.LoadAsset <GameObject>("Assets/Import/belt/Poison.prefab"); BlightOnHitPrefab = bundle.LoadAsset <GameObject>("Assets/Import/belt/Blight.prefab"); RitualDaggerPrefab = bundle.LoadAsset <GameObject>("Assets/Import/belt/dagger.prefab"); } AddTokens(); AddPoisonOnHit(); AddBlightOnHit(); AddRitualDagger(); }
public void Awake() { //acquire my assetbundle and give it to the resource api. using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Diluvian.Resources.diluvian")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new R2API.AssetBundleResourcesProvider(assetPrefix, bundle); ResourcesAPI.AddProvider(provider); } //Check ESO existence. if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("com.jarlyk.eso")) { ESOenabled = true; Logger.LogWarning("Using ESO's elite cards!"); } diluvianArtist = Config.Bind(new ConfigDefinition("Art", "Diluvian"), "avizvul", new ConfigDescription("The artist for the diluvian icon. Options: \"harb\",\"avizvul\",\"horus\"", new AcceptableValueList <string>(new string[] { "avizvul", "harb", "horus" }))); syzygyArtist = Config.Bind(new ConfigDefinition("Art", "OTHER"), "avizvul", new ConfigDescription("The artist for the other icon.Options: \"harb\",\"avizvul\"", new AcceptableValueList <string>(new string[] { "avizvul", "harb" }))); UnlockablesAPI.AddUnlockable <DiluvianCompletedAchievement>(true); UnlockablesAPI.AddUnlockable <SZGAchievement>(true); LanguageAPI.Add("COMPLETE_MAINENDING_DILUVIAN_NAME", "Unobscured. Unblinking. Unrelenting."); LanguageAPI.Add("COMPLETE_MAINENDING_DILUVIAN_DESC", "Completed the game on Diluvian."); LanguageAPI.Add("COMPLETE_AAO_SYZYGY_NAME", "Crescendo"); LanguageAPI.Add("COMPLETE_AAO_SYZYGY_DESC", "Obliterate on Syzygy difficulty with all artifacts enabled."); DiluvianDifficulty.def = new DiluvianDifficulty(); Dindex = DifficultyAPI.AddDifficulty(DiluvianDifficulty.def.DifficultyDef); myDefs.Add(Dindex, DiluvianDifficulty.def); Syzygy.def = new Syzygy(); EDindex = DifficultyAPI.AddDifficulty(Syzygy.def.DifficultyDef, true); myDefs.Add(EDindex, Syzygy.def); On.RoR2.RuleDef.FromDifficulty += RuleDef_FromDifficulty; On.RoR2.UI.RuleCategoryController.SetData += RuleCategoryController_SetData; //This is where my hooks live. They themselves are events, not ONhooks Run.onRunStartGlobal += Run_onRunStartGlobal; Run.onRunDestroyGlobal += Run_onRunDestroyGlobal; }
private void Awake() { _logger = Logger; using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SupplyDrop.supplydrop_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@SupplyDrop", bundle); ResourcesAPI.AddProvider(provider); } ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true); masterItemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo { displayName = "Supply Drop", longIdentifier = "SUPPLYDROP", shortIdentifier = "SUPPDRP", mainConfigFile = ConfigFile }); T2Module.SetupAll_PluginAwake(masterItemList); }
public override void Initialize() { this.m_wordFilters = null; ResourcesAPI resources = base.m_battleNet.Resources; if (resources == null) { base.ApiLog.LogWarning("ResourcesAPI is not initialized! Unable to proceed."); } else { this.m_localeName = Localization.GetLocaleName(); if (string.IsNullOrEmpty(this.m_localeName)) { base.ApiLog.LogWarning("Unable to get Locale from Localization class"); this.m_localeName = Localization.DEFAULT_LOCALE_NAME; } object[] args = new object[] { this.m_localeName }; base.ApiLog.LogDebug("Locale is {0}", args); resources.LookupResource(new FourCC("BN"), new FourCC("apft"), new FourCC(this.m_localeName), new ResourcesAPI.ResourceLookupCallback(this.ResouceLookupCallback), null); } }
internal static void Init() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PocketPrinter.printer")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle); ResourcesAPI.AddProvider(provider); PocketPrinterPrefab = bundle.LoadAsset <GameObject>(PrefabPath); } bool isRedItem = PocketPrinter.FilamentAsRedItem.Value; // Register pocket printer as item var pocketPrinterItemDef = new ItemDef { name = "PocketPrinter", tier = isRedItem ? ItemTier.Tier3 : ItemTier.Tier2, pickupModelPath = PrefabPath, pickupIconPath = isRedItem ? AltIconPath : IconPath, nameToken = "Adaptive Filament", pickupToken = "Duplicates the next item you pick up.\nOnly usable once", descriptionToken = "<style=cIsUtility>Turns into a copy</style> of the next item you pick up before being destroyed.", loreToken = "", tags = new[] { ItemTag.Utility, ItemTag.AIBlacklist } }; // For now, we just won't render it - this might change in the future var itemDisplayRules = new ItemDisplayRule[1]; var pocketPrinter = new R2API.CustomItem(pocketPrinterItemDef, itemDisplayRules); PocketPrinterItemIndex = ItemAPI.Add(pocketPrinter); }
public void Awake() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PlayerBotsItemsMod.playerbotsitems_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@PlayerBotsItems", bundle); ResourcesAPI.AddProvider(provider); } VerifyItem(new CaptainBotSpawner(), Items); VerifyItem(new CommandoBotSpawner(), Items); VerifyItem(new CrocoBotSpawner(), Items); VerifyItem(new EngiBotSpawner(), Items); VerifyItem(new HuntressBotSpawner(), Items); VerifyItem(new LoaderBotSpawner(), Items); VerifyItem(new MageBotSpawner(), Items); VerifyItem(new MercBotSpawner(), Items); VerifyItem(new ToolbotBotSpawner(), Items); VerifyItem(new TreebotBotSpawner(), Items); foreach (ItemBase item in Items) { item.Init(base.Config); } }
public void Awake() { Setconfig(); using (System.IO.Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RoR1ItemRework.ror1item")) { Bundle = AssetBundle.LoadFromStream(stream); Provider = new AssetBundleResourcesProvider(ModPrefix.Trim(':'), Bundle); ResourcesAPI.AddProvider(Provider); }; if (cfgArmsrace.Value) { ArmsRace.ArmsRaceItem.ArmsRaceItemInit(); ArmsRace.ArmsRaceItem.ArmsRaceItemHook(); } if (cfgVial.Value) { Vial.VialItem.VialItemInit(); } if (cfgLeech.Value) { Leech.LeechInit(); } if (cfgThallium.Value) { Thallium.ThalliumItem.ThalliumItemInit(); } ClassicCritThing.CritInit(); if (cfgToughtime.Value) { ToughTimes.ToughTimesItemInit(); } if (cfgRepulsionArmor.Value) { RepulsionArmor.RepulsionArmorItemInit(); } }
public static void PopulateAssets() { if (MainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CRCore3.crcore3")) { MainAssetBundle = AssetBundle.LoadFromStream(assetStream); ResourcesAPI.AddProvider(new AssetBundleResourcesProvider("@CRC3", MainAssetBundle)); } } // include this if you're using a custom soundbank /*using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("ExampleSurvivor.ExampleSurvivor.bnk")) * { * * byte[] array = new byte[manifestResourceStream2.Length]; * manifestResourceStream2.Read(array, 0, array.Length); * SoundAPI.SoundBanks.Add(array); * }*/ // and now we gather the assets artifactChampionOn = MainAssetBundle.LoadAsset <Sprite>("ArtifactChampionsOn"); artifactChampionOff = MainAssetBundle.LoadAsset <Sprite>("ArtifactChampionsOff"); voidRift = MainAssetBundle.LoadAsset <GameObject>("VoidRift"); teleporterRift = MainAssetBundle.LoadAsset <GameObject>("TeleporterRift"); voidSickPPP = MainAssetBundle.LoadAsset <PostProcessProfile>("voidSickPPP"); var sickFog = ScriptableObject.CreateInstance <RampFog>(); sickFog.enabled.value = true; sickFog.fogIntensity.value = 1.0f; sickFog.fogIntensity.overrideState = true; sickFog.fogPower.value = 0.75f; sickFog.fogPower.overrideState = true; sickFog.fogOne.value = 0.05f; sickFog.fogOne.overrideState = true; sickFog.fogZero.value = -0.032f; sickFog.fogZero.overrideState = true; sickFog.fogColorStart.value = new Color32(130, 65, 62, 0); sickFog.fogColorStart.overrideState = true; sickFog.fogColorMid.value = new Color32(43, 51, 65, 100); sickFog.fogColorMid.overrideState = true; sickFog.fogColorEnd.value = new Color32(27, 10, 36, 230); sickFog.fogColorEnd.overrideState = true; sickFog.skyboxStrength.value = 0.15f; sickFog.skyboxStrength.overrideState = true; Assets.voidSickPPP.AddSettings(sickFog); voidSafePPP = MainAssetBundle.LoadAsset <PostProcessProfile>("voidSafePPP"); var safeFog = ScriptableObject.CreateInstance <RampFog>(); safeFog.enabled.value = true; safeFog.fogIntensity.value = 1.0f; safeFog.fogIntensity.overrideState = true; safeFog.fogPower.value = 0.75f; safeFog.fogPower.overrideState = true; safeFog.fogOne.value = 0.05f; safeFog.fogOne.overrideState = true; safeFog.fogZero.value = -0.032f; safeFog.fogZero.overrideState = true; safeFog.fogColorStart.value = new Color32(130, 65, 62, 0); safeFog.fogColorStart.overrideState = true; safeFog.fogColorMid.value = new Color32(43, 51, 65, 200); safeFog.fogColorMid.overrideState = true; safeFog.fogColorEnd.value = new Color32(27, 10, 36, 255); safeFog.fogColorEnd.overrideState = true; safeFog.skyboxStrength.value = 0; safeFog.skyboxStrength.overrideState = true; Assets.voidSafePPP.AddSettings(safeFog); }
private void Awake() { _logger = Logger; Logger.LogDebug("Performing plugin setup..."); #if DEBUG Logger.LogWarning("Running test build with debug enabled! If you're seeing this after downloading the mod from Thunderstore, please panic."); #endif Logger.LogDebug("Loading assets..."); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ClassicItems.classicitems_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@ClassicItems", bundle); ResourcesAPI.AddProvider(provider); } cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true); Logger.LogDebug("Loading global configs..."); globalConfig.BindAll(cfgFile, "ClassicItems", "Global"); globalConfig.ConfigEntryChanged += (sender, args) => { if (args.target.boundProperty.Name == nameof(globalConfig.hSV2NoStomp)) { var toBind = (bool)args.newValue == true; if (toBind && !globalConfig.hSV2Bound) { IL.EntityStates.Headstompers.HeadstompersIdle.FixedUpdate += IL_ESHeadstompersIdleFixedUpdate; } else if (!toBind) { IL.EntityStates.Headstompers.HeadstompersIdle.FixedUpdate -= IL_ESHeadstompersIdleFixedUpdate; } } }; Logger.LogDebug("Instantiating item classes..."); masterItemList = ItemBoilerplate.InitAll("ClassicItems"); Logger.LogDebug("Loading item configs..."); foreach (ItemBoilerplate x in masterItemList) { x.ConfigEntryChanged += (sender, args) => { if ((args.flags & (AutoUpdateEventFlags.InvalidateNameToken | (globalConfig.longDesc ? AutoUpdateEventFlags.InvalidateDescToken : AutoUpdateEventFlags.InvalidatePickupToken))) == 0) { return; } if (x.pickupDef != null) { var ctsf = x.pickupDef.displayPrefab?.transform; if (!ctsf) { return; } var cfront = ctsf.Find("cardfront"); if (!cfront) { return; } cfront.Find("carddesc").GetComponent <TextMeshPro>().text = Language.GetString(globalConfig.longDesc ? x.descToken : x.pickupToken); cfront.Find("cardname").GetComponent <TextMeshPro>().text = Language.GetString(x.nameToken); } if (x.logbookEntry != null) { x.logbookEntry.modelPrefab = x.pickupDef.displayPrefab; } }; x.SetupConfig(cfgFile); } Logger.LogDebug("Registering item attributes..."); int longestName = 0; foreach (ItemBoilerplate x in masterItemList) { string mpnOvr = null; if (x is Item item) { mpnOvr = "@ClassicItems:Assets/ClassicItems/models/" + modelNameMap[item.itemTier] + ".prefab"; } else if (x is Equipment eqp) { mpnOvr = "@ClassicItems:Assets/ClassicItems/models/" + (eqp.eqpIsLunar ? "LqpCard.prefab" : "EqpCard.prefab"); } var ipnOvr = "@ClassicItems:Assets/ClassicItems/icons/" + x.itemCodeName + "_icon.png"; if (mpnOvr != null) { typeof(ItemBoilerplate).GetProperty(nameof(ItemBoilerplate.modelPathName)).SetValue(x, mpnOvr); typeof(ItemBoilerplate).GetProperty(nameof(ItemBoilerplate.iconPathName)).SetValue(x, ipnOvr); } x.SetupAttributes("CLASSICITEMS", "CI"); if (x.itemCodeName.Length > longestName) { longestName = x.itemCodeName.Length; } } Logger.LogMessage("Index dump follows (pairs of name / index):"); foreach (ItemBoilerplate x in masterItemList) { if (x is Equipment eqp) { Logger.LogMessage("Equipment CI" + x.itemCodeName.PadRight(longestName) + " / " + ((int)eqp.regIndex).ToString()); } else if (x is Item item) { Logger.LogMessage(" Item CI" + x.itemCodeName.PadRight(longestName) + " / " + ((int)item.regIndex).ToString()); } else if (x is Artifact afct) { Logger.LogMessage(" Artifact CI" + x.itemCodeName.PadRight(longestName) + " / " + ((int)afct.regIndex).ToString()); } else { Logger.LogMessage(" Other CI" + x.itemCodeName.PadRight(longestName) + " / N/A"); } } Logger.LogDebug("Tweaking vanilla stuff..."); //Remove the H3AD-5T V2 state transition from idle to stomp, as Headstompers has similar functionality if (globalConfig.hSV2NoStomp && !globalConfig.hSV2Bound) { globalConfig.hSV2Bound = true; IL.EntityStates.Headstompers.HeadstompersIdle.FixedUpdate += IL_ESHeadstompersIdleFixedUpdate; } On.RoR2.PickupCatalog.Init += On_PickupCatalogInit; On.RoR2.UI.LogBook.LogBookController.BuildPickupEntries += On_LogbookBuildPickupEntries; if (globalConfig.spinMod) { IL.RoR2.PickupDisplay.Update += IL_PickupDisplayUpdate; } Logger.LogDebug("Registering shared buffs..."); //used only for purposes of Death Mark; applied by Permafrost and Snowglobe var freezeBuffDef = new CustomBuff(new BuffDef { buffColor = Color.cyan, canStack = false, isDebuff = true, name = "CIFreeze", iconPath = "@ClassicItems:Assets/ClassicItems/icons/permafrost_icon.png" }); freezeBuff = BuffAPI.Add(freezeBuffDef); var fearBuffDef = new CustomBuff(new BuffDef { buffColor = Color.red, canStack = false, isDebuff = true, name = "CIFear", iconPath = "textures/miscicons/texSprintIcon" }); fearBuff = BuffAPI.Add(fearBuffDef); IL.EntityStates.AI.Walker.Combat.UpdateAI += IL_ESAIWalkerCombatUpdateAI; Logger.LogDebug("Registering item behaviors..."); foreach (ItemBoilerplate x in masterItemList) { x.SetupBehavior(); } Logger.LogDebug("Initial setup done!"); }
private void Awake() { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SkinTest.skintest")) { var MainAssetBundle = AssetBundle.LoadFromStream(assetStream); ResourcesAPI.AddProvider(new AssetBundleResourcesProvider("@SkinTest", MainAssetBundle)); } var commandoPrefab = Resources.Load <GameObject>("prefabs/characterbodies/CommandoBody").InstantiateClone("CommandoCopy"); var commandoBody = commandoPrefab.GetComponent <CharacterBody>(); commandoBody.baseNameToken = "test"; Debug.Log(string.Join(", ", commandoPrefab.GetComponentInChildren <SkinnedMeshRenderer>().bones.Select(el => "'" + el.name + "'"))); BodyCatalog.getAdditionalEntries += (list) => list.Add(commandoPrefab); var mySurvivorDef = new SurvivorDef { name = "Test commando" + Environment.NewLine, bodyPrefab = commandoPrefab, descriptionToken = "Test commando", displayPrefab = Resources.Load <GameObject>("prefabs/characterdisplays/CommandoDisplay").InstantiateClone("CommandoTestDisplay", false), primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f), unlockableName = "", }; SurvivorAPI.AddSurvivor(mySurvivorDef); var skinController = commandoPrefab.GetComponentInChildren <ModelSkinController>(); var mdl = skinController.gameObject; var renderer = mdl.GetComponentInChildren <SkinnedMeshRenderer>(); var renderers = mdl.transform.GetChild(0).GetComponentsInChildren <Renderer>(); var altSkin = new LoadoutAPI.SkinDefInfo(); altSkin.Name = "ComandoCustomAlt"; altSkin.NameToken = "TEST_SKIN"; altSkin.RootObject = mdl; altSkin.BaseSkins = new SkinDef[0];// { skinController.skins[0] }; altSkin.UnlockableName = ""; altSkin.RendererInfos = new CharacterModel.RendererInfo[] { new CharacterModel.RendererInfo() { defaultMaterial = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = renderer }, new CharacterModel.RendererInfo() { defaultMaterial = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = renderers[0] }, new CharacterModel.RendererInfo() { defaultMaterial = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = renderers[1] } }; altSkin.GameObjectActivations = new SkinDef.GameObjectActivation[0]; //altSkin.MinionSkinReplacements = new SkinDef.MinionSkinReplacement[0]; //altSkin.ProjectileGhostReplacements = new SkinDef.ProjectileGhostReplacement[0]; altSkin.MeshReplacements = new SkinDef.MeshReplacement[] { new SkinDef.MeshReplacement() { mesh = Resources.Load <Mesh>("@SkinTest:Assets/Resources/skintest.blend"), renderer = renderer } }; Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = LoadoutAPI.CreateNewSkinDef(altSkin); }
private void Awake() { _logger = Logger; using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArtifactOfDoom.artifactofdoom")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@ArtifactOfDoom", bundle); ResourcesAPI.AddProvider(provider); } cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true); masterItemList = ItemBoilerplate.InitAll("ArtifactOfDoom"); foreach (ItemBoilerplate x in masterItemList) { x.SetupConfig(cfgFile); } averageItemsPerStage = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "averageItemsPerStage"), 3, new ConfigDescription( "Base chance in percent that enemys steal items from you ((totalItems - currentStage * averageItemsPerStage) ^ exponentTriggerItems; \nIf that value is lower you'll need to kill more enemies to get an item")); exponentTriggerItems = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "exponentTriggerItems"), 2.0, new ConfigDescription( "The exponent for calculation when you'll get an item. If it's 1 you have a linear increase. Default is 2")); minItemsPerStage = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "minItemsPerStage"), 2, new ConfigDescription( "The expected minimum item count per stage. If you have less Items than that you'll have a decreased chance that you lose items")); maxItemsPerStage = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "maxItemsPerStage"), 7, new ConfigDescription( "The expected maximum item count per stage. If you have more Items than that you'll have a chance to lose more than one item per hit")); exponentailFactorToCalculateSumOfLostItems = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "exponentailFactorToCalculateSumOfLostItems"), 1.5, new ConfigDescription( "The exponent to Calculate how many items you'll lose if you're over maxItemsPerStage")); exponentailFactorIfYouAreUnderAverageItemsPerStage = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "exponentailFactorIfYouAreUnderAverageItemsPerStage"), 0.0, new ConfigDescription( "The exponent to Calculate how many kills you'll need if you're under averageItemsPerStage. The formula is totalitems^exponentailFactorIfYouAreUnderAverageItemsPerStage. Default is 0 so you'll need always two kills.")); artifactOfSwarmNerf = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "artifactOfSwarmNerf"), false, new ConfigDescription( "Enable the nerf for Artifact of Swarm where you've to kill double as many enemies")); useArtifactOfSacrificeCalculation = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "useArtifactOfSacreficeCalculation"), false, new ConfigDescription( "Chance the item gain to a specific drop rate of enemys")); multiplayerForArtifactOfSacrificeDropRate = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "multiplayerForArtifactOfSacrificeDropRate"), 2.0, new ConfigDescription( "Multiplier for the drop rate (base Chance is 5)")); disableItemProgressBar = cfgFile.Bind(new ConfigDefinition("UI Settings", "disableItemProgressBar"), false, new ConfigDescription( "If true it disables the Progress bar in the bottom of the UI")); disableSideBars = cfgFile.Bind(new ConfigDefinition("UI Settings", "disableSideBars"), false, new ConfigDescription( "Disables the item Sidebars")); enableChatItemOutput = cfgFile.Bind(new ConfigDefinition("UI Settings", "enableChatItemOutput"), false, new ConfigDescription( "Enables the chat output for gained/lost Items. This setting is not synced.")); sizeOfSideBars = cfgFile.Bind(new ConfigDefinition("UI Settings", "sizeOfSideBars"), 0.02, new ConfigDescription( "Spezifies the size of the sidebars. 1 is whole window 0 is invisible (but for that plase use the disable setting).")); timeAfterHitToNotLoseItemDrizzly = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseItemDrizzly"), 0.8, new ConfigDescription( "The time in seconds where you will not lose items after you lost one on drizzly")); timeAfterHitToNotLoseItemRainstorm = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseItemRainstorm"), 0.2, new ConfigDescription( "The time in seconds where you will not lose items after you lost one on rainstorm")); timeAfterHitToNotLoseItemMonsoon = cfgFile.Bind(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseItemMonsoon"), 0.05, new ConfigDescription( "The time in seconds where you will not lose items after you lost one on monsoon")); CommandoBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "CommandoBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); CommandoMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "commandoMultiplyerForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); HuntressBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "HuntressBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); HuntressMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "HuntressMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); MULTBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "MULTBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); MULTMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "MULTMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); EngineerBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "EngineerBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); EngineerMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "EngineerMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); ArtificerBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "ArtificerBonusItems"), 2.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); ArtificerMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "ArtificerMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); MercenaryBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "MercenaryBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); MercenaryMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "MercenaryMultiplierForTimedBuff"), 4.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); RexBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "RexBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); RexMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "RexMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); LoaderBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "LoaderBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); LoaderMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "LoaderMultiplierForTimedBuff"), 4.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); AcridBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "AcridBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); AcridMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "AcridMultiplierForTimedBuff"), 4.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); CaptainBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "CaptainBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); CaptainMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "CaptainMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems")); CustomSurvivorBonusItems = cfgFile.Bind(new ConfigDefinition("Character specific settings", "CustomSurvivorBonusItems"), 1.0, new ConfigDescription( "The count of items which you get if you kill enough enemies")); CustomSurvivorMultiplierForTimedBuff = cfgFile.Bind(new ConfigDefinition("Character specific settings", "CustomSurvivorMultiplierForTimedBuff"), 1.0, new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLoseItems")); CustomChars = cfgFile.Bind(new ConfigDefinition("Character specific settings", "CustomCharacters"), "[{\"Name\": \"CUSTOM_CHAR_BODY_NAME1\", \"MultiplierForTimedBuff\": 1.0, \"BonusItems\": 1.0},{\"Name\": \"CUSTOM_CHAR_BODY_NAME2\", \"MultiplierForTimedBuff\": 2.0, \"BonusItems\": 2.0}]", new ConfigDescription( "The Multiplier for that specific character for the length of timeAfterHitToNotLoseItems")); int longestName = 0; foreach (ItemBoilerplate x in masterItemList) { x.SetupAttributes("ARTDOOM", "ADOOM"); if (x.itemCodeName.Length > longestName) { longestName = x.itemCodeName.Length; } } Logger.LogMessage("Index dump follows (pairs of name / index):"); foreach (ItemBoilerplate x in masterItemList) { if (x is Artifact afct) { Logger.LogMessage(" Artifact ADOOM" + x.itemCodeName.PadRight(longestName) + " / " + ((int)afct.regIndex).ToString()); } else { Logger.LogMessage("Other ADOOM" + x.itemCodeName.PadRight(longestName) + " / N/A"); } } var didLoseItem = new R2API.CustomBuff("didLoseItem", "", Color.black, false, false); buffIndexDidLoseItem = BuffAPI.Add(didLoseItem); foreach (ItemBoilerplate x in masterItemList) { x.SetupBehavior(); } //On.RoR2.UI.HUD.Awake +=myFunc // ArtifactOfDoomUI test = new ArtifactOfDoomUI(); }
public void Awake() { Assembly execAssembly = Assembly.GetExecutingAssembly(); System.IO.Stream stream = execAssembly.GetManifestResourceStream("ReinLunarWickedRing.Bundle.wickedring"); this.bundle = AssetBundle.LoadFromStream(stream); ResourcesAPI.AddProvider(new AssetBundleResourcesProvider("@ReinWickedRing", this.bundle)); On.RoR2.ItemCatalog.DefineItems += (orig) => { orig(); ItemCatalog.lunarItemList.Add(ItemIndex.CooldownOnCrit); var def = ItemCatalog.GetItemDef(ItemIndex.CooldownOnCrit); def.canRemove = true; def.descriptionToken = "WICKEDRING_LOG_DESC"; def.hidden = false; def.pickupIconPath = "@ReinWickedRing:Assets/AssetBundle/WickedRingIcon.png"; def.pickupToken = "WICKEDRING_PICKUP_DESC"; def.tier = ItemTier.Tier3; def.tags = new ItemTag[] { //ItemTag.Cleansable, ItemTag.Damage, ItemTag.Utility }; def.unlockableName = ""; }; //On.RoR2.CharacterBody.RecalculateStats += (orig, self) => //{ // orig(self); // float startCrit = self.crit; // //Debug.Log(startCrit); // if( self.inventory && self.inventory.GetItemCount(ItemIndex.CooldownOnCrit) > 0 ) // { // startCrit -= 5f; // startCrit -= (self.baseCrit + self.levelCrit * (self.level - 1f)); // } // //Debug.Log(startCrit); // self.SetPropertyValue<float>("crit" , startCrit); // //Debug.Log(self.crit); //}; //On.RoR2.GlobalEventManager.OnHitEnemy += (orig, self, damageInfo, victim) => //{ // orig(self, damageInfo, victim); // if ( damageInfo.attacker && damageInfo.crit ) // { // CharacterBody atBody = damageInfo.attacker.GetComponent<CharacterBody>(); // if( atBody ) // { // if( !this.blacklistedBodies.Contains(atBody.bodyIndex ) ) // { // CharacterMaster master = atBody.master; // if (master) // { // Inventory inv = master.inventory; // if (inv) // { // int count = inv.GetItemCount(ItemIndex.CooldownOnCrit); // if (count > 0 && damageInfo.crit && damageInfo.procCoefficient > 0f) // { // float val1 = damageInfo.procCoefficient * damageInfo.damage / atBody.damage * Mathf.Pow(2f, (float)(inv.GetItemCount(ItemIndex.LunarDagger) + 1f)); // float val2 = 0.9f * (1f - Mathf.Pow(1.15f, -1f * Mathf.Sqrt(val1) * (float)count)); // var hc = atBody.healthComponent; // DamageInfo recoil = new DamageInfo(); // recoil.damage = ( hc.health + hc.shield + hc.barrier ) * val2; // recoil.position = atBody.corePosition; // recoil.force = Vector3.zero; // recoil.damageColorIndex = DamageColorIndex.Default; // recoil.crit = false; // recoil.attacker = null; // recoil.inflictor = null; // recoil.damageType = DamageType.BypassArmor | DamageType.NonLethal; // recoil.procCoefficient = 0f; // recoil.procChainMask = default; // hc.TakeDamage(recoil); // } // } // } // } // } // } //}; //IL.RoR2.HealthComponent.TakeDamage += ( il ) => //{ // ILCursor c = new ILCursor( il ); // c.GotoNext( MoveType.After, // x => x.MatchLdcI4( 90 ), // x => x.MatchCallOrCallvirt<RoR2.Inventory>( "GetItemCount" ) // ); // c.Emit( OpCodes.Ldarg_1 ); // c.EmitDelegate<Func<Int32, DamageInfo, Int32>>( ( count, damage ) => // { // if( ( damage.damageType & DamageType.NonLethal ) > DamageType.Generic ) // { // return 0; // } else // { // return count; // } // } ); // c.GotoNext( MoveType.After, x => x.MatchCallOrCallvirt<RoR2.CharacterBody>( "RollCrit" ) ); // c.Index -= 3; // c.RemoveRange( 3 ); // c.Emit( OpCodes.Ldc_I4_0 ); //}; R2API.AssetPlus.Languages.AddToken("WICKEDRING_PICKUP_DESC", "<style=cIsDamage>Critical Strikes</style> <style=cIsUtility>reduce all cooldowns</style>"); // + //"<style=cIsHealth>at the cost of health.</style>" ); R2API.AssetPlus.Languages.AddToken("WICKEDRING_LOG_DESC", "On <style=cIsDamage>Critical Strike</style> <style=cIsUtility>reduce all cooldowns</style> " + "by <style=cIsUtility>1s</style><style=cStack>(+1s per stack)</style>"); // <style=cIsHealth>but, lose a percentage of current health</style> based on " + //"the damage of the attack." ); }
public UnbundledResourcesProviderFixture() { this.Provider = new UnbundledResourcesProvider("@test"); ResourcesAPI.AddProvider(this.Provider); }
private void Awake() { _logger = Logger; Logger.LogDebug("Performing plugin setup:"); #if DEBUG Logger.LogWarning("Running test build with debug enabled! If you're seeing this after downloading the mod from Thunderstore, please panic."); #endif Logger.LogDebug("Loading assets..."); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ClassicItems.classicitems_assets")) { var bundle = AssetBundle.LoadFromStream(stream); var provider = new AssetBundleResourcesProvider("@ClassicItems", bundle); ResourcesAPI.AddProvider(provider); } cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true); Logger.LogDebug("Loading global configs..."); globalConfig.BindAll(cfgFile, "ClassicItems", "Global"); globalConfig.ConfigEntryChanged += (sender, args) => { if (args.target.boundProperty.Name == nameof(globalConfig.hSV2NoStomp)) { var toBind = (bool)args.newValue == true; if (toBind && !globalConfig.hSV2Bound) { IL.EntityStates.Headstompers.HeadstompersIdle.FixedUpdate += IL_ESHeadstompersIdleFixedUpdate; } else if (!toBind) { IL.EntityStates.Headstompers.HeadstompersIdle.FixedUpdate -= IL_ESHeadstompersIdleFixedUpdate; } } }; Logger.LogDebug("Instantiating item classes..."); masterItemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo { displayName = "Classic Items", longIdentifier = "ClassicItems", shortIdentifier = "CI", mainConfigFile = cfgFile }); var itemType = typeof(Item <>); var scep = (Scepter)FormatterServices.GetUninitializedObject(typeof(Scepter)); var embryo = (Embryo)FormatterServices.GetUninitializedObject(typeof(Embryo)); var scepGenType = itemType.MakeGenericType(typeof(Scepter)); var embGenType = itemType.MakeGenericType(typeof(Embryo)); scepGenType.GetProperty("instance", BindingFlags.Public | BindingFlags.Static).GetSetMethod(true).Invoke(null, new[] { scep }); embGenType.GetProperty("instance", BindingFlags.Public | BindingFlags.Static).GetSetMethod(true).Invoke(null, new[] { embryo }); Logger.LogDebug("Loading item configs..."); foreach (CatalogBoilerplate x in masterItemList) { x.SetupConfig(); } Logger.LogDebug("Registering item attributes..."); foreach (CatalogBoilerplate x in masterItemList) { string mpnOvr = null; if (x is Item_V2 item) { mpnOvr = "@ClassicItems:Assets/ClassicItems/models/" + modelNameMap[item.itemTier] + ".prefab"; } else if (x is Equipment_V2 eqp) { mpnOvr = "@ClassicItems:Assets/ClassicItems/models/" + (eqp.isLunar ? "LqpCard.prefab" : "EqpCard.prefab"); } var ipnOvr = "@ClassicItems:Assets/ClassicItems/icons/" + x.name.Replace("_V2", "") + "_icon.png"; if (mpnOvr != null) { typeof(CatalogBoilerplate).GetProperty(nameof(CatalogBoilerplate.modelResourcePath)).SetValue(x, mpnOvr); typeof(CatalogBoilerplate).GetProperty(nameof(CatalogBoilerplate.iconResourcePath)).SetValue(x, ipnOvr); } x.SetupAttributes(); } Logger.LogDebug("Tweaking vanilla stuff..."); //Remove the H3AD-5T V2 state transition from idle to stomp, as Headstompers has similar functionality if (globalConfig.hSV2NoStomp && !globalConfig.hSV2Bound) { globalConfig.hSV2Bound = true; IL.EntityStates.Headstompers.HeadstompersIdle.FixedUpdate += IL_ESHeadstompersIdleFixedUpdate; } On.RoR2.PickupCatalog.Init += On_PickupCatalogInit; On.RoR2.UI.LogBook.LogBookController.BuildPickupEntries += On_LogbookBuildPickupEntries; Language.onCurrentLanguageChanged += Language_onCurrentLanguageChanged; if (globalConfig.spinMod) { IL.RoR2.PickupDisplay.Update += IL_PickupDisplayUpdate; } Logger.LogDebug("Registering shared buffs..."); //used only for purposes of Death Mark; applied by Permafrost and Snowglobe var freezeBuffDef = new CustomBuff(new BuffDef { buffColor = Color.cyan, canStack = false, isDebuff = true, name = "CIFreeze", iconPath = "@ClassicItems:Assets/ClassicItems/icons/permafrost_icon.png" }); freezeBuff = BuffAPI.Add(freezeBuffDef); var fearBuffDef = new CustomBuff(new BuffDef { buffColor = Color.red, canStack = false, isDebuff = true, name = "CIFear", iconPath = "textures/miscicons/texSprintIcon" }); fearBuff = BuffAPI.Add(fearBuffDef); IL.EntityStates.AI.Walker.Combat.UpdateAI += IL_ESAIWalkerCombatUpdateAI; Logger.LogDebug("Registering item behaviors..."); foreach (CatalogBoilerplate x in masterItemList) { x.SetupBehavior(); } Logger.LogDebug("Initial setup done!"); }
public static void PopulateAssets() { if (mainAssetBundle == null) { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PaladinMod.paladin")) { mainAssetBundle = AssetBundle.LoadFromStream(assetStream); var provider = new AssetBundleResourcesProvider("@Paladin", mainAssetBundle); ResourcesAPI.AddProvider(provider); } } using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("PaladinMod.PaladinBank.bnk")) { byte[] array = new byte[manifestResourceStream2.Length]; manifestResourceStream2.Read(array, 0, array.Length); SoundAPI.SoundBanks.Add(array); } #region Icons charPortrait = mainAssetBundle.LoadAsset <Sprite>("texPaladinIcon").texture; iconP = mainAssetBundle.LoadAsset <Sprite>("PassiveIcon"); icon1 = mainAssetBundle.LoadAsset <Sprite>("SlashIcon"); icon2 = mainAssetBundle.LoadAsset <Sprite>("SpinSlashIcon"); icon2b = mainAssetBundle.LoadAsset <Sprite>("LightningSpearIcon"); icon2c = mainAssetBundle.LoadAsset <Sprite>("LunarShardIcon"); icon3 = mainAssetBundle.LoadAsset <Sprite>("DashIcon"); icon3b = mainAssetBundle.LoadAsset <Sprite>("HealIcon"); icon4 = mainAssetBundle.LoadAsset <Sprite>("HealZoneIcon"); icon4b = mainAssetBundle.LoadAsset <Sprite>("TorporIcon"); icon4c = mainAssetBundle.LoadAsset <Sprite>("WarcryIcon"); icon4S = mainAssetBundle.LoadAsset <Sprite>("ScepterHealZoneIcon"); icon4bS = mainAssetBundle.LoadAsset <Sprite>("ScepterTorporIcon"); icon4cS = mainAssetBundle.LoadAsset <Sprite>("ScepterWarcryIcon"); #endregion #region ProjectileGhosts lightningSpear = mainAssetBundle.LoadAsset <GameObject>("LightningSpear"); swordBeam = mainAssetBundle.LoadAsset <GameObject>("SwordBeam"); swordBeamGhost = mainAssetBundle.LoadAsset <GameObject>("SwordBeamGhost"); swordBeamGhost.AddComponent <ProjectileGhostController>(); tornadoEffect = mainAssetBundle.LoadAsset <GameObject>("PaladinTornadoEffect"); tornadoEffect.AddComponent <ProjectileGhostController>(); #endregion #region SpellEffects healEffectPrefab = mainAssetBundle.LoadAsset <GameObject>("HealEffect"); healZoneEffectPrefab = mainAssetBundle.LoadAsset <GameObject>("HealZoneEffect"); torporEffectPrefab = mainAssetBundle.LoadAsset <GameObject>("TorporEffect"); warcryEffectPrefab = mainAssetBundle.LoadAsset <GameObject>("HealZoneEffect").InstantiateClone("WarcryEffect", false); GameObject engiShieldObj = Resources.Load <GameObject>("Prefabs/Projectiles/EngiBubbleShield"); Material shieldFillMat = UnityEngine.Object.Instantiate <Material>(engiShieldObj.transform.Find("Collision").Find("ActiveVisual").GetComponent <MeshRenderer>().material); Material shieldOuterMat = UnityEngine.Object.Instantiate <Material>(engiShieldObj.transform.Find("Collision").Find("ActiveVisual").Find("Edge").GetComponent <MeshRenderer>().material); GameObject voidExplosionObj = Resources.Load <GameObject>("Prefabs/Effects/NullifierDeathExplosion");//DeathExplosion Material voidMat = voidExplosionObj.transform.Find("AreaIndicator (1)").GetComponent <ParticleSystemRenderer>().material; torporMat = voidMat; GameObject healNovaObj = Resources.Load <GameObject>("Prefabs/Effects/TPHealNovaEffect"); Material healMat = healNovaObj.transform.Find("AreaIndicator").GetComponent <ParticleSystemRenderer>().material; healZoneEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = shieldOuterMat; healZoneEffectPrefab.transform.GetChild(0).GetChild(0).GetComponent <ParticleSystemRenderer>().material = healMat; torporEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = voidMat; warcryEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = shieldOuterMat; warcryEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material.SetColor("_TintColor", Color.red); warcryEffectPrefab.transform.GetChild(0).GetChild(0).GetComponent <ParticleSystemRenderer>().material = Resources.Load <Material>("materials/matFullCrit"); // //GameObject warbannerEffect = Resources.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard").InstantiateClone("x", true); #endregion #region SwordEffects swordSwing = Assets.LoadEffect("PaladinSwing", ""); spinningSlashFX = Assets.LoadEffect("SpinSlashEffect", ""); spinningSlashEmpoweredFX = Assets.LoadEffect("EmpSpinSlashEffect", ""); hitFX = Assets.LoadEffect("ImpactPaladinSwing", ""); swordSwingGreen = Assets.LoadEffect("PaladinSwingGreen", ""); spinningSlashFXGreen = Assets.LoadEffect("SpinSlashEffectGreen", ""); spinningSlashEmpoweredFXGreen = Assets.LoadEffect("EmpSpinSlashEffectGreen", ""); hitFXGreen = Assets.LoadEffect("ImpactPaladinSwingGreen", ""); swordSwingYellow = Assets.LoadEffect("PaladinSwingYellow", ""); spinningSlashFXYellow = Assets.LoadEffect("SpinSlashEffectYellow", ""); spinningSlashEmpoweredFXYellow = Assets.LoadEffect("EmpSpinSlashEffectYellow", ""); hitFXYellow = Assets.LoadEffect("ImpactPaladinSwingYellow", ""); swordSwingWhite = Assets.LoadEffect("PaladinSwingWhite", ""); hitFXBlunt = Assets.LoadEffect("ImpactPaladinSwingBlunt", ""); swordSwingBat = Assets.LoadEffect("PaladinSwingBat", ""); swordSwingRed = Assets.LoadEffect("PaladinSwingRed", ""); spinningSlashFXRed = Assets.LoadEffect("SpinSlashEffectRed", ""); spinningSlashEmpoweredFXRed = Assets.LoadEffect("EmpSpinSlashEffectRed", ""); hitFXRed = Assets.LoadEffect("ImpactPaladinSwingRed", ""); swordSwingClay = Assets.LoadEffect("PaladinSwingClay", ""); spinningSlashFXClay = Assets.LoadEffect("SpinSlashEffectClay", ""); spinningSlashEmpoweredFXClay = Assets.LoadEffect("EmpSpinSlashEffectClay", ""); hitFXClay = Assets.LoadEffect("ImpactPaladinSwingClay", ""); swordSwingPurple = Assets.LoadEffect("PaladinSwingPurple", ""); spinningSlashFXPurple = Assets.LoadEffect("SpinSlashEffectPurple", ""); spinningSlashEmpoweredFXPurple = Assets.LoadEffect("EmpSpinSlashEffectPurple", ""); hitFXPurple = Assets.LoadEffect("ImpactPaladinSwingPurple", ""); swordSwingFlame = Assets.LoadEffect("PaladinSwingFlame", ""); spinningSlashFXFlame = Assets.LoadEffect("SpinSlashEffectFlame", ""); spinningSlashEmpoweredFXFlame = Assets.LoadEffect("EmpSpinSlashEffectFlame", ""); swordSwingBlack = Assets.LoadEffect("PaladinSwingBlack", ""); spinningSlashFXBlack = Assets.LoadEffect("SpinSlashEffectBlack", ""); spinningSlashEmpoweredFXBlack = Assets.LoadEffect("EmpSpinSlashEffectBlack", ""); hitFXBlack = Assets.LoadEffect("ImpactPaladinSwingBlack", ""); #endregion #region MiscEffects lightningHitFX = Assets.LoadEffect("LightningHitFX", ""); lightningImpactFX = Assets.LoadEffect("LightningImpact", "Play_mage_R_lightningBlast"); torporVoidFX = Assets.LoadEffect("TorporVoidFX", "RoR2_nullifier_attack1_explode_02"); #endregion #region Meshes defaultMesh = mainAssetBundle.LoadAsset <Mesh>("meshPaladin"); defaultSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshSword"); lunarMesh = mainAssetBundle.LoadAsset <Mesh>("meshLunarPaladin"); lunarSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshLunarSword"); poisonMesh = mainAssetBundle.LoadAsset <Mesh>("meshNkuhanaPaladin"); poisonSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshNkuhanaSword"); //hunterMesh = mainAssetBundle.LoadAsset<Mesh>("HunterMesh"); dripMesh = mainAssetBundle.LoadAsset <Mesh>("meshDripPaladin"); batMesh = mainAssetBundle.LoadAsset <Mesh>("meshBat"); clayMesh = mainAssetBundle.LoadAsset <Mesh>("meshClayPaladin"); claySwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshClaySword"); minecraftMesh = mainAssetBundle.LoadAsset <Mesh>("meshMinecraftPaladin"); minecraftSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshMinecraftSword"); #endregion //weird shit to get the lightning effect looking how i want it altLightningImpactFX = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/LightningStrikeImpact"), "PaladinLightningStrikeImpact", true); PaladinPlugin.Destroy(altLightningImpactFX.transform.Find("LightningRibbon").gameObject); foreach (ParticleSystemRenderer i in altLightningImpactFX.GetComponentsInChildren <ParticleSystemRenderer>()) { if (i) { i.material.SetColor("_TintColor", Color.yellow); } } altLightningImpactFX.AddComponent <NetworkIdentity>(); EffectAPI.AddEffect(altLightningImpactFX); //clone mithrix's dash effect and resize it for my dash dashFX = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/BrotherDashEffect"), "PaladinDashEffect", true); dashFX.AddComponent <NetworkIdentity>(); dashFX.transform.localScale *= 0.3f; EffectAPI.AddEffect(dashFX); InitCustomItems(); }