Ejemplo n.º 1
0
        // Token: 0x06000007 RID: 7 RVA: 0x00002228 File Offset: 0x00000428
        public static Skill.ActivationCondition AddToSkill(Skill skill, bool allowDrawnTwoHandedInRight = false, bool allowSheathedTwoHandedInLeft = false)
        {
            GameObject gameObject = new GameObject("EmptyOffhandCondition");

            Skill.ActivationCondition activationCondition   = new Skill.ActivationCondition();
            EmptyOffHandCondition     emptyOffHandCondition = gameObject.AddComponent <EmptyOffHandCondition>();

            UnityEngine.Object.DontDestroyOnLoad(emptyOffHandCondition);
            gameObject.SetActive(false);
            activationCondition.Condition = emptyOffHandCondition;
            emptyOffHandCondition.AllowDrawnTwoHandedInRight   = allowDrawnTwoHandedInRight;
            emptyOffHandCondition.AllowSheathedTwoHandedInLeft = allowSheathedTwoHandedInLeft;
            At.SetValue <string>("Requires an empty left hand.", typeof(Skill.ActivationCondition), activationCondition, "m_defaultMessage");
            Skill.ActivationCondition[]      array = At.GetValue(typeof(Skill), skill, "m_additionalConditions") as Skill.ActivationCondition[];
            List <Skill.ActivationCondition> list  = ((array != null) ? array.ToList <Skill.ActivationCondition>() : null) ?? new List <Skill.ActivationCondition>();

            list.Add(activationCondition);
            At.SetValue <Skill.ActivationCondition[]>(list.ToArray(), typeof(Skill), skill, "m_additionalConditions");
            return(activationCondition);
        }
Ejemplo n.º 2
0
        private void OnLateApply(object[] obj)
        {
            var skill = obj[0] as Skill;

            if (!skill)
            {
                return;
            }

            if (this.RequiredItems != null)
            {
                var list = new List <Skill.ItemRequired>();
                foreach (var req in this.RequiredItems)
                {
                    if (ResourcesPrefabManager.Instance.GetItemPrefab(req.ItemID) is Item reqItem)
                    {
                        list.Add(new Skill.ItemRequired()
                        {
                            Item     = reqItem,
                            Consume  = req.Consume,
                            Quantity = req.Quantity
                        });
                    }
                }

                skill.RequiredItems = list.ToArray();
            }

            var activationConditions = new List <Skill.ActivationCondition>();

            if (skill.transform.childCount > 0)
            {
                foreach (Transform child in skill.transform)
                {
                    if (child.name.Contains("Activation"))
                    {
                        foreach (var condition in child.GetComponentsInChildren <EffectCondition>())
                        {
                            var skillCondition = new Skill.ActivationCondition
                            {
                                Condition = condition
                            };

                            string msgLoc;
                            if (condition is WindAltarActivatedCondition)
                            {
                                msgLoc = "Notification_Skill_WindAltarRequired";
                            }
                            else
                            {
                                msgLoc = "Notification_Skill_RequirementsNotMet";
                            }

                            At.SetField(skillCondition, "m_messageLocKey", msgLoc);

                            activationConditions.Add(skillCondition);
                        }
                    }
                }
            }

            At.SetField(skill, "m_additionalConditions", activationConditions.ToArray());

            LateApply(skill);
        }