Ejemplo n.º 1
0
        //public abstract void InitMission(); TODO

        /// <summary>
        /// Initializes the artifact def and adds it to the game's list of artifacts.
        /// </summary>
        protected void InitArtifact()
        {
            R2API.LanguageAPI.Add($"ARTIFACT_{NameToken}_NAME", Name);
            R2API.LanguageAPI.Add($"ARTIFACT_{NameToken}_DESCRIPTION", Description);

            ArtifactDef                  = ScriptableObject.CreateInstance <ArtifactDef>();
            ArtifactDef.cachedName       = $"ARTIFACT_{NameToken}";
            ArtifactDef.nameToken        = $"ARTIFACT_{NameToken}_NAME";
            ArtifactDef.descriptionToken = $"ARTIFACT_{NameToken}_DESCRIPTION";

            // FIXME: research how unlockable defs work
            //if(!UnlockableDef) {
            //    UnlockableDef = ScriptableObject.CreateInstance<UnlockableDef>();
            //    UnlockableDef.cachedName = Name;
            //    UnlockableDef.nameToken = $"{NameToken} Unlock";
            //    UnlockableDef.hidden = false;
            //}
            if (UnlockableDef)
            {
                ArtifactDef.unlockableDef = UnlockableDef;
            }

            ArtifactDef.smallIconSelectedSprite   = IconSelectedSprite;
            ArtifactDef.smallIconDeselectedSprite = IconDeselectedSprite;
            if (PickupModelPrefab)
            {
                ArtifactDef.pickupModelPrefab = PickupModelPrefab;
            }

            R2API.ArtifactAPI.Add(ArtifactDef);
            MoreArtifacts.Logger.LogInfo($"Initialized Artifact: {Name}");
        }
        internal static void Init()
        {
            ContentManager.collectContentPackProviders += AddCustomContent;

            artifactCR                           = ScriptableObject.CreateInstance <ArtifactDef>();
            artifactCR.nameToken                 = "ARTIFACT_CRCORE_NAME";
            artifactCR.descriptionToken          = "ARTIFACT_CRCORE_DESC";
            artifactCR.unlockableDef             = null;
            artifactCR.smallIconSelectedSprite   = Assets.artifactChampionOn;
            artifactCR.smallIconDeselectedSprite = Assets.artifactChampionOff;
            artifactCR.pickupModelPrefab         = GameObject.CreatePrimitive(PrimitiveType.Cube);
            ContentPack.artifactDefs.Add(new ArtifactDef[] { artifactCR });


            voidDebuffDef            = ScriptableObject.CreateInstance <BuffDef>();
            voidDebuffDef.name       = "CRVoidDebuff";
            voidDebuffDef.buffColor  = new Color32(255, 100, 150, 255);
            voidDebuffDef.canStack   = false;
            voidDebuffDef.iconSprite = Resources.Load <Sprite>("textures/bufficons/texBuffNullifyStackIcon");
            voidDebuffDef.isDebuff   = true;
            Debug.Log("Initalized Buff: " + voidDebuffDef.name);

            protectionBuffDef            = ScriptableObject.CreateInstance <BuffDef>();
            protectionBuffDef.name       = "CRVoidProtectionBuff";
            protectionBuffDef.buffColor  = new Color32(100, 30, 255, 255);
            protectionBuffDef.canStack   = false;
            protectionBuffDef.iconSprite = Resources.Load <Sprite>("textures/bufficons/texBuffNullifiedIcon");
            protectionBuffDef.isDebuff   = false;
            Debug.Log("Initalized Buff: " + protectionBuffDef.name);

            ContentPack.buffDefs.Add(new BuffDef[] { protectionBuffDef, voidDebuffDef });

            ContentPack.entityStateTypes.Add(new Type[] { typeof(RiftBaseState), typeof(RiftOffState), typeof(RiftOnState), typeof(RiftCompleteState) });
        }
Ejemplo n.º 3
0
 private static void OnArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
 {
     if (artifactDef == ZetArtifactsContent.Artifacts.ZetEclifact)
     {
         EnableEffects();
     }
 }
Ejemplo n.º 4
0
        internal static void Init()
        {
            LanguageAPI.Add("GENETIC_ARTIFACT_NAME_TOKEN", "Artifact of Genetics");
            LanguageAPI.Add("GENETIC_ARTIFACT_DESCRIPTION_TOKEN", "Monsters will spawn with adjusted stats. Adjustments are determined by a genetic algorithm.");

            artifactDef                           = ScriptableObject.CreateInstance <ArtifactDef>();
            artifactDef.nameToken                 = "GENETIC_ARTIFACT_NAME_TOKEN";
            artifactDef.descriptionToken          = "GENETIC_ARTIFACT_DESCRIPTION_TOKEN";
            artifactDef.smallIconSelectedSprite   = GeneticsArtifactPlugin.geneticAssetBundle.LoadAsset <Sprite>("Assets/Genetics/Selected.png");
            artifactDef.smallIconDeselectedSprite = GeneticsArtifactPlugin.geneticAssetBundle.LoadAsset <Sprite>("Assets/Genetics/Unselected.png");
            artifactDef.pickupModelPrefab         = GeneticsArtifactPlugin.geneticAssetBundle.LoadAsset <GameObject>("Assets/Genetics/PickupGene.prefab");
            //ArtifactAPI.Add(artifactDef);
            ContentAddition.AddArtifactDef(artifactDef);

            geneArtifactCompoundDef             = ScriptableObject.CreateInstance <ArtifactCompoundDef>();
            geneArtifactCompoundDef.modelPrefab = GeneticsArtifactPlugin.geneticAssetBundle.LoadAsset <GameObject>("Assets/Genetics/CompoundGene.prefab");
            geneArtifactCompoundDef.value       = 15;
            ArtifactCodeAPI.AddCompound(geneArtifactCompoundDef);

            artifactCode = ScriptableObject.CreateInstance <ArtifactCode>();
            artifactCode.ArtifactCompounds = new List <int> {
                ArtifactCodeAPI.CompoundValues.Triangle, ArtifactCodeAPI.CompoundValues.Diamond, ArtifactCodeAPI.CompoundValues.Triangle,
                ArtifactCodeAPI.CompoundValues.Circle, geneArtifactCompoundDef.value, ArtifactCodeAPI.CompoundValues.Circle,
                ArtifactCodeAPI.CompoundValues.Triangle, ArtifactCodeAPI.CompoundValues.Diamond, ArtifactCodeAPI.CompoundValues.Triangle
            };

            ArtifactCodeAPI.AddCode(artifactDef, artifactCode);
        }
Ejemplo n.º 5
0
        public void Awake()
        {
            // Initialize config
            CommonItemCount    = Config.Bind("Quantities", "CommonItemCount", 1, "Quantity of the common (white) item to start with.");
            UncommonItemCount  = Config.Bind("Quantities", "UncommonItemCount", 1, "Quantity of the uncommon (green) item to start with.");
            LegendaryItemCount = Config.Bind("Quantities", "LegendaryItemCount", 1, "Quantity of the legendary (red) item to start with.");
            BossItemCount      = Config.Bind("Quantities", "BossItemCount", 1, "Quantity of the boss (yellow) item to start with.");
            LunarItemCount     = Config.Bind("Quantities", "LunarItemCount", 1, "Quantity of the lunar (blue) item to start with.");

            // Initialize the artifact
            Artifact = ScriptableObject.CreateInstance <ArtifactDef>();

            // Artifact info
            Artifact.nameToken                 = "Artifact of Sequencing";
            Artifact.descriptionToken          = "Spawn with a starting item of every tier. Any picked up items will be converted to the starting item of the same tier.";
            Artifact.smallIconSelectedSprite   = LoadIcon(ArtifactOfSequencing.Properties.Resources.texArtifactSequencingEnabled);
            Artifact.smallIconDeselectedSprite = LoadIcon(ArtifactOfSequencing.Properties.Resources.texArtifactSequencingDisabled);

            // Add our custom artifact to the artifact list
            // This uses the ArtifactAPI submodule in R2API
            ArtifactAPI.Add(Artifact);

            // On run start event
            // This is when we add our items
            Run.onRunStartGlobal += AddBeginningItems;
        }
Ejemplo n.º 6
0
 private void OnEvolutionEnable([JetBrains.Annotations.NotNull] RunArtifactManager runArtifactManager,
                                [JetBrains.Annotations.NotNull] ArtifactDef artifactDef)
 {
     if (NetworkServer.active && artifactDef == RoR2Content.Artifacts.monsterTeamGainsItemsArtifactDef)
     {
         Run.onRunStartGlobal += EvolutionListItems;
     }
 }
Ejemplo n.º 7
0
 public static ArtifactDef Add(ArtifactDef artifactDef, String contentPackIdentifier = null)
 {
     contentPackIdentifier = contentPackIdentifier ?? Assembly.GetCallingAssembly().GetName().Name;
     if (!ContentPacks.assemblyDict.ContainsKey(contentPackIdentifier))
     {
         ContentPacks.assemblyDict[contentPackIdentifier] = Assembly.GetCallingAssembly();
     }
     ContentPacks.Packs[contentPackIdentifier].artifactDefs.Add(artifactDef);
     return(artifactDef);
 }
Ejemplo n.º 8
0
        private void Evt_ACGetAdditionalEntries(List <ArtifactDef> addEnts)
        {
            dangerArtifact                           = ScriptableObject.CreateInstance <ArtifactDef>();
            dangerArtifact.nameToken                 = "Danger";
            dangerArtifact.descriptionToken          = "Allows enemies to kill you with one hit.";
            dangerArtifact.smallIconDeselectedSprite = Resources.Load <Sprite>("@GlassArtifactOHP:Assets/GlassArtifactOHP/danger-off.png");
            dangerArtifact.smallIconSelectedSprite   = Resources.Load <Sprite>("@GlassArtifactOHP:Assets/GlassArtifactOHP/danger-on.png");

            addEnts.Add(dangerArtifact);
        }
Ejemplo n.º 9
0
 protected void CreateArtifact()
 {
     ArtifactDef                           = ScriptableObject.CreateInstance <ArtifactDef>();
     ArtifactDef.cachedName                = "ARTIFACT_" + ArtifactLangTokenName;
     ArtifactDef.nameToken                 = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
     ArtifactDef.descriptionToken          = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
     ArtifactDef.smallIconSelectedSprite   = ArtifactEnabledIcon;
     ArtifactDef.smallIconDeselectedSprite = ArtifactDisabledIcon;
     ArtifactAPI.Add(ArtifactDef);
 }
Ejemplo n.º 10
0
        public void EncodeName_PassInValue_TrimsCorrectResults(string input, string expected)
        {
            // ARRANGE

            // ACT
            var result = ArtifactDef.EncodeName(input);

            // ASSERT
            Assert.Equal(expected, result);
        }
Ejemplo n.º 11
0
        private static void OnArtifactEnabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (!NetworkServer.active || artifactDef != myArtifact)
            {
                return;
            }

            // hook things
            Run.onRunStartGlobal += Something;
        }
Ejemplo n.º 12
0
        private static void OnArtifactDisabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (artifactDef != myArtifact)
            {
                return;
            }

            // unhook things
            Run.onRunStartGlobal -= Something;
        }
Ejemplo n.º 13
0
        private static void OnArtifactEnabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (!NetworkServer.active || artifactDef != myArtifact)
            {
                return;
            }

            // do things
            CharacterBody.onBodyStartGlobal += OnBodyStartGlobal;
        }
Ejemplo n.º 14
0
        public void EncodeName_PassInNameWithBadChars_ReturnsCleanName(string test, string expected)
        {
            //ARRANGE

            //ACT
            var actual = ArtifactDef.EncodeName(test);

            //ASSERT
            Assert.Equal(actual, expected);
        }
        // Token: 0x060020A1 RID: 8353 RVA: 0x0009998C File Offset: 0x00097B8C
        private void Start()
        {
            ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef(this.artifactIndex);

            if (artifactDef != null)
            {
                this.image.sprite = artifactDef.smallIconDeselectedSprite;
                this.image.SetNativeSize();
            }
        }
Ejemplo n.º 16
0
        private static void OnArtifactDisabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (artifactDef != myArtifact)
            {
                return;
            }

            // undo things
            CharacterBody.onBodyStartGlobal -= OnBodyStartGlobal;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Registers an ArtifactDef to the ArtifactCatalog.
 /// </summary>
 /// <param name="ArtifactDef">The ArtifactDef you want to register.</param>
 public static void RegisterArtifact(ArtifactDef ArtifactDef)
 {
     //Check if the SurvivorDef has already been registered.
     if (ArtifactDefDefinitions.Contains(ArtifactDef))
     {
         LogCore.LogE(ArtifactDef + " has already been registered, please do not register the same ArtifactDef twice.");
         return;
     }
     //If not, add it to our SurvivorDefinitions
     ArtifactDefDefinitions.Add(ArtifactDef);
 }
Ejemplo n.º 18
0
        private static void OnArtifactEnabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (!NetworkServer.active || artifactDef != myArtifact)
            {
                return;
            }

            // do things
            Run.onRunStartGlobal += SetRandom;
            On.RoR2.HealthComponent.TakeDamage += RandomizeDamage;
        }
Ejemplo n.º 19
0
        private static void OnArtifactDisabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (artifactDef != myArtifact)
            {
                return;
            }

            // undo things
            Run.onRunStartGlobal -= SetRandom;
            On.RoR2.HealthComponent.TakeDamage -= RandomizeDamage;
        }
Ejemplo n.º 20
0
        public void GetName_PassInValue_TrimsCorrectResults(string input, string expected)
        {
            // ARRANGE
            var a = new ArtifactDef();

            a.Name = input;
            // ACT
            var result = a.Name;

            // ASSERT
            Assert.Equal(expected, result);
        }
Ejemplo n.º 21
0
        void InitArtifact()
        {
#if DEBUG
            Logger.LogMessage("GetManifestResourceNames: " + string.Join(" and ", Assembly.GetExecutingAssembly().GetManifestResourceNames()));
#endif
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ForesightArtifact.AssetBundle.foresight"))
            {
                bundle = AssetBundle.LoadFromStream(stream);
            }

            foresightArtifactDef = bundle.LoadAsset <ArtifactDef>("Assets/ForesightArtifact/Foresight.asset");
        }
Ejemplo n.º 22
0
        private static void OnArtifactDisabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (artifactDef != myArtifact)
            {
                return;
            }

            // undo things
            Run.onRunStartGlobal     -= SetRandom;
            Stage.onServerStageBegin -= EmptyList;

            On.RoR2.HealthComponent.TakeDamage -= JumbleDamage;
        }
Ejemplo n.º 23
0
        private static void OnArtifactEnabled(RunArtifactManager man, ArtifactDef artifactDef)
        {
            if (!NetworkServer.active || artifactDef != myArtifact)
            {
                return;
            }

            // do things
            Run.onRunStartGlobal     += SetRandom;
            Stage.onServerStageBegin += EmptyList;

            // MMHook :)
            On.RoR2.HealthComponent.TakeDamage += JumbleDamage;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Adds an ArtifactDef to your Mod's ContentPack
        /// <para>Requires the ArtifactDef's icon sprites to not be null.</para>
        /// </summary>
        /// <param name="artifactDef">The ArtifactDef to Add</param>
        /// <returns>true if valid and added, false if one of the requirements is not met</returns>
        public static bool AddArtifactDef(ArtifactDef artifactDef)
        {
            var asm = Assembly.GetCallingAssembly();

            if (CatalogBlockers.GetAvailability <ArtifactDef>())
            {
                if (artifactDef.smallIconDeselectedSprite == null || artifactDef.smallIconSelectedSprite == null)
                {
                    RejectContent(artifactDef, asm, "ArtifactDef", $"but one of it's icons are null! this is not allowed!");
                    return(false);
                }
                R2APIContentManager.HandleContentAddition(asm, artifactDef);
                return(true);
            }
            RejectContent(artifactDef, asm, "ArtifactDef", "but the ArtifactCatalog has already initialized!");
            return(false);
        }
Ejemplo n.º 25
0
        public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
        {
            DebrisBundle = AssetBundle.LoadFromMemory(Properties.Resources.debrisartifact);

            DebrisArtifact = ScriptableObject.CreateInstance <ArtifactDef>();

            LanguageTokens.Add("DEB_NAME_TOKEN", "Artifact of Debris");
            LanguageTokens.Add("DEB_DESC_TOKEN", "All items turn to scrap to be printed.");

            DebrisArtifact.nameToken                 = "DEB_NAME_TOKEN";
            DebrisArtifact.descriptionToken          = "DEB_DESC_TOKEN";
            DebrisArtifact.smallIconDeselectedSprite = DebrisBundle.LoadAsset <Sprite>("Assets/Scrap_Dim.png");
            DebrisArtifact.smallIconSelectedSprite   = DebrisBundle.LoadAsset <Sprite>("Assets/Scrap.png");

            ContentPack.artifactDefs.Add(new ArtifactDef[] { DebrisArtifact });

            args.ReportProgress(1f);
            yield break;
        }
Ejemplo n.º 26
0
        public static ArtifactDef Add(ArtifactTemplate artifactTemplate, String contentPackIdentifier = null)
        {
            contentPackIdentifier = contentPackIdentifier ?? Assembly.GetCallingAssembly().GetName().Name;
            if (!ContentPacks.assemblyDict.ContainsKey(contentPackIdentifier))
            {
                ContentPacks.assemblyDict[contentPackIdentifier] = Assembly.GetCallingAssembly();
            }
            ArtifactDef artifactDef = ScriptableObject.CreateInstance <ArtifactDef>();

            artifactDef.cachedName                = artifactTemplate.internalName;
            artifactDef.pickupModelPrefab         = artifactTemplate.prefab ?? artifactDef.pickupModelPrefab;
            artifactDef.unlockableDef             = artifactTemplate.unlockableDef ?? artifactDef.unlockableDef;
            artifactDef.smallIconDeselectedSprite = artifactTemplate.smallIconDeselectedSprite ?? artifactDef.smallIconDeselectedSprite;
            artifactDef.smallIconSelectedSprite   = artifactTemplate.smallIconSelectedSprite ?? artifactDef.smallIconSelectedSprite;
            artifactDef.nameToken        = $"ARTIFACT_{artifactTemplate.internalName.ToUpper()}_NAME";
            artifactDef.descriptionToken = $"ARTIFACT_{artifactTemplate.internalName.ToUpper()}_DESC";

            Languages.AddTokenString(artifactDef.nameToken, artifactTemplate.name);
            Languages.AddTokenString(artifactDef.descriptionToken, artifactTemplate.descriptionText);

            return(Add(artifactDef, contentPackIdentifier));
        }
Ejemplo n.º 27
0
        public void Awake()
        {
            Conversion                  = ScriptableObject.CreateInstance <ArtifactDef>();
            Conversion.nameToken        = "Artifact of Conversion";
            Conversion.descriptionToken = "Amount of your items is capped with your experience level, BUT you can DROP your items. Gain experience and share with friends! Click on an item to drop.";
            Sprite template                 = LoadoutAPI.CreateSkinIcon(Color.white, Color.white, Color.white, Color.white);
            string artifactIconPath         = $"file:\\\\{Info.Location}\\..\\conv.png";
            string artifactIconDisabledPath = $"file:\\\\{Info.Location}\\..\\convdis.png";
            WWW    w = new WWW(artifactIconPath);

            while (!w.isDone)
            {
                ;
            }
            WWW ww = new WWW(artifactIconDisabledPath);

            while (!ww.isDone)
            {
                ;
            }
            Texture2D artifactIconTexture         = w.texture;
            Texture2D artifactIconDisabledTexture = ww.texture;
            Sprite    artifactIcon         = Sprite.Create(artifactIconTexture, template.rect, template.pivot);
            Sprite    artifactDisabledIcon = Sprite.Create(artifactIconDisabledTexture, template.rect, template.pivot);

            Conversion.smallIconDeselectedSprite = artifactDisabledIcon;
            Conversion.smallIconSelectedSprite   = artifactIcon;

            ArtifactCatalog.getAdditionalEntries += (list) =>
            {
                list.Add(Conversion);
            };

            RunArtifactManager.onArtifactEnabledGlobal += RunArtifactManager_onArtifactEnabledGlobal;

            RunArtifactManager.onArtifactDisabledGlobal += RunArtifactManager_onArtifactDisabledGlobal;
        }
Ejemplo n.º 28
0
        private void BuildNotification(PickupIndex pickupIndex, RoR2.UI.PingIndicator pingIndicator)
        {
            LocalUser localUser = LocalUserManager.GetFirstLocalUser();

            if (localUser.currentNetworkUser.userName ==
                Util.GetBestMasterName(pingIndicator.pingOwner.GetComponent <CharacterMaster>()))
            {
                if (localUser.userProfile.HasDiscoveredPickup(pickupIndex))
                {
                    PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndex);

                    ItemDef      item     = ItemCatalog.GetItemDef(pickup.itemIndex);
                    EquipmentDef equip    = EquipmentCatalog.GetEquipmentDef(pickup.equipmentIndex);
                    ArtifactDef  artifact = ArtifactCatalog.GetArtifactDef(pickup.artifactIndex);

                    GenericNotification notification = Object
                                                       .Instantiate(Resources.Load <GameObject>("Prefabs/NotificationPanel2"))
                                                       .GetComponent <GenericNotification>();

                    if (item != null)
                    {
                        notification.SetItem(item);
                    }
                    else if (equip != null)
                    {
                        notification.SetEquipment(equip);
                    }
                    else if (artifact != null)
                    {
                        notification.SetArtifact(artifact);
                    }

                    notification.transform.SetParent(RoR2Application.instance.mainCanvas.transform, false);
                    notification.transform.position = new Vector3(notification.transform.position.x + 2, 95, 0);
                }
            }
        }
Ejemplo n.º 29
0
 public static string GetString(ArtifactDef obj)
 {
     return($"public const string {obj.Name} = \"{obj.Guid}\";");
 }
Ejemplo n.º 30
0
        private static void OnCurrentArtifactDiscovered(Action <ArtifactTrialMissionController, ArtifactDef> orig, ArtifactTrialMissionController self, ArtifactDef artifactDef)
        {
            orig(self, artifactDef);

            if (IsEnabled.Value)
            {
                self.artifactWasEnabled = true;
            }
        }