Пример #1
0
        public override void ApplyToItem(Item item)
        {
            base.ApplyToItem(item);

            var attackSkill = item as AttackSkill;

            if (this.AmmunitionTypes != null)
            {
                attackSkill.AmmunitionTypes = this.AmmunitionTypes.ToList();
            }

            if (this.RequiredOffHandTypes != null)
            {
                attackSkill.RequiredOffHandTypes = this.RequiredOffHandTypes.ToList();
            }

            if (this.RequiredWeaponTypes != null)
            {
                attackSkill.RequiredWeaponTypes = this.RequiredWeaponTypes.ToList();
            }

            if (this.RequireImbue != null)
            {
                attackSkill.RequireImbue = (bool)this.RequireImbue;
            }

            if (this.AmmunitionAmount != null)
            {
                attackSkill.AmmunitionAmount = (int)this.AmmunitionAmount;
            }

            if (this.RequiredWeaponTags != null)
            {
                var list = new List <TagSourceSelector>();
                foreach (var tag in this.RequiredWeaponTags)
                {
                    if (CustomItems.GetTag(tag) is Tag _tag && _tag != Tag.None)
                    {
                        list.Add(new TagSourceSelector(_tag));
                    }
                }
                attackSkill.RequiredTags = list.ToArray();
            }
        }
Пример #2
0
        public override void ApplyToComponent <T>(T component)
        {
            var tag = CustomItems.GetTag(Stat_Tag);

            if (tag == Tag.None)
            {
                SL.Log("AffectStat: could not find tag of ID " + (this.Stat_Tag ?? ""));
                return;
            }

            var comp = component as AffectStat;

            comp.AffectedStat = new TagSourceSelector(tag);
            comp.Value        = this.AffectQuantity;
            comp.IsModifier   = this.IsModifier;

            if (this.Tags != null)
            {
                comp.Tags = this.Tags
                            .Select(it => new TagSourceSelector(CustomTags.GetTag(it)))
                            .ToArray();
            }
        }
Пример #3
0
 internal void Awake()
 {
     Instance = this;
 }
Пример #4
0
        private IEnumerator Init()
        {
            Log("Version " + SL.BaseInstance.Version + " starting...", 0);

            // Add Components
            this.gameObject.AddComponent <AssetBundleLoader>();
            this.gameObject.AddComponent <TexReplacer>();
            this.gameObject.AddComponent <CustomItems>();
            this.gameObject.AddComponent <AudioReplacer>();
            this.gameObject.AddComponent <CustomSkills>();
            this.gameObject.AddComponent <CustomCharacters>();

            // legacy references
            CustomItems = this.gameObject.GetComponent <CustomItems>();
            TexReplacer = this.gameObject.GetComponent <TexReplacer>();

            // read folders, store all file paths in FilePaths dictionary
            CheckFolders();

            // wait for RPM to finish loading
            while (!ResourcesPrefabManager.Instance.Loaded)
            {
                yield return(null);
            }

            // load texture changes
            Loading = true;
            StartCoroutine(TexReplacer.Instance.LoadTextures());
            while (Loading)
            {
                yield return(null);
            }                                      // wait for loading callback to be set to false

            // load asset bundles
            Loading = true;
            StartCoroutine(AssetBundleLoader.Instance.LoadAssetBundles());
            while (Loading)
            {
                yield return(null);
            }

            // load custom items
            Loading = true;
            StartCoroutine(CustomItems.Instance.LoadItems());
            while (Loading)
            {
                yield return(null);
            }

            // load audio filepaths
            Loading = true;
            StartCoroutine(AudioReplacer.Instance.LoadAudioClips());
            while (Loading)
            {
                yield return(null);
            }

            // load something else...

            // Check currently loaded assets and replace what we can
            Loading = true;
            StartCoroutine(TexReplacer.Instance.ReplaceActiveAssets());
            while (Loading)
            {
                yield return(null);
            }

            Log("Finished initialization.", 0);
            InitDone = 1;
        }
Пример #5
0
        public virtual void SetStats(Character character)
        {
            if (character.GetComponent <PlayerCharacterStats>())
            {
                CustomCharacters.FixStats(character);
            }

            var stats = character.GetComponent <CharacterStats>();

            if (!stats)
            {
                return;
            }

            if (Health != null)
            {
                var m_maxHealthStat = (Stat)At.GetField(stats, "m_maxHealthStat");
                m_maxHealthStat.AddStack(new StatStack(SL_STAT_ID, (float)Health - 100), false);
            }

            if (HealthRegen != null)
            {
                var m_healthRegenStat = (Stat)At.GetField(stats, "m_healthRegen");
                m_healthRegenStat.AddStack(new StatStack(SL_STAT_ID, (float)HealthRegen), false);
            }

            if (ImpactResist != null)
            {
                var m_impactResistance = (Stat)At.GetField(stats, "m_impactResistance");
                m_impactResistance.AddStack(new StatStack(SL_STAT_ID, (float)ImpactResist), false);
            }

            if (Protection != null)
            {
                var m_damageProtection = (Stat[])At.GetField(stats, "m_damageProtection");
                m_damageProtection[0].AddStack(new StatStack(SL_STAT_ID, (float)Protection), false);
            }

            if (this.Barrier != null)
            {
                var m_barrier = (Stat)At.GetField(stats, "m_barrierStat");
                m_barrier.AddStack(new StatStack(SL_STAT_ID, (float)Barrier), false);
            }

            if (Damage_Resists != null)
            {
                var m_damageResistance = (Stat[])At.GetField(stats, "m_damageResistance");
                for (int i = 0; i < 6; i++)
                {
                    m_damageResistance[i].AddStack(new StatStack(SL_STAT_ID, Damage_Resists[i]), false);
                }
            }

            if (Damage_Bonus != null)
            {
                var m_damageTypesModifier = (Stat[])At.GetField(stats, "m_damageTypesModifier");
                for (int i = 0; i < 6; i++)
                {
                    m_damageTypesModifier[i].AddStack(new StatStack(SL_STAT_ID, Damage_Bonus[i]), false);
                }
            }

            // status immunity
            if (this.Status_Immunity != null)
            {
                var immunities = new List <TagSourceSelector>();
                foreach (var tagName in this.Status_Immunity)
                {
                    if (CustomItems.GetTag(tagName) is Tag tag && tag != Tag.None)
                    {
                        immunities.Add(new TagSourceSelector(tag));
                    }
                }

                At.SetField(stats, "m_statusEffectsNaturalImmunity", immunities.ToArray());
            }
        }