public Talent(ExportEntry powerClass, bool isEvolution = false)
            {
                PowerExport = powerClass;
                IsEvolution = isEvolution;
                var baseClass    = powerClass;
                var baseClassObj = baseClass.GetDefaults().GetProperty <ObjectProperty>("EvolvedPowerClass1");

                while (baseClassObj == null || baseClassObj.Value == 0)
                {
                    baseClass    = (ExportEntry)baseClass.SuperClass;
                    baseClassObj = baseClass.GetDefaults().GetProperty <ObjectProperty>("EvolvedPowerClass1");
                }

                BasePower = baseClass;

                if (BasePower.ObjectName.Name.Contains("Passive"))
                {
                    IsPassive = true;
                }
                else
                {
                    var baseName = baseClass.GetDefaults().GetProperty <NameProperty>("BaseName");
                    while (baseName == null)
                    {
                        baseClass = (ExportEntry)baseClass.SuperClass;
                        baseName  = baseClass.GetDefaults().GetProperty <NameProperty>("BaseName");
                    }

                    BaseName = baseName.Value.Name;
                }

                // Setup name
                var superDefaults    = PowerExport.GetDefaults();
                var displayNameProps = superDefaults.GetProperties();
                var superProps       = displayNameProps;
                var displayName      = superProps.GetProp <StringRefProperty>("DisplayName");

                while (displayName == null)
                {
                    superDefaults = ((superDefaults.Class as ExportEntry).SuperClass as ExportEntry).GetDefaults();
                    superProps    = superDefaults.GetProperties();
                    superProps.GetProp <StringRefProperty>("DisplayName");
                    displayName = superProps.GetProp <StringRefProperty>("DisplayName");
                }
                PowerName = TLKHandler.TLKLookupByLang(displayName.Value, "INT");

                if (IsEvolution)
                {
                    // Setup the blurb
                    var blurbDesc = TLKHandler.TLKLookupByLang(displayNameProps.GetProp <StringRefProperty>("TalentDescription").Value, "INT").Split('\n')[0];
                    EvolvedBlurb = $"{PowerName}: {blurbDesc}";
                }

                IsAmmoPower   = PowerName.Contains("Ammo");
                IsCombatPower = !IsAmmoPower && !IsPassive;
            }
Esempio n. 2
0
        private static void ZeroOutStatList(ExportEntry statClassExp, string propertyName, bool createIfNonExistent)
        {
            var statExp = statClassExp.GetDefaults();
            var stat    = statExp.GetProperty <ArrayProperty <FloatProperty> >(propertyName);

            if (stat == null && createIfNonExistent)
            {
                stat = new ArrayProperty <FloatProperty>(propertyName);
            }

            if (stat == null)
            {
                return; // Nothing to do
            }
            stat.Clear();
            int i = 0;

            while (i < 4)
            {
                stat.Add(new FloatProperty(0));
                i++;
            }
            statExp.WriteProperty(stat);
        }