Пример #1
0
        public void Load(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            var file = new ContentFile();

            try
            {
                var path = _game.Config.ContentManager.GetSpellDataPath(name);
                var text = File.ReadAllText(Path.GetFullPath(path));
                file = JsonConvert.DeserializeObject <ContentFile>(text);
            }

            catch (ContentNotFoundException)
            {
                _logger.Warn($"Spell data for {name} was not found.");
                return;
            }

            AfterEffectName = file.GetString("SpellData", "AfterEffectName", AfterEffectName);
            //AIEndOnly
            //AILifetime
            //AIRadius
            //AIRange
            //AISendEvent
            //AISpeed
            AlternateName    = file.GetString("SpellData", "AlternateName", name);
            AlwaysSnapFacing = file.GetBool("SpellData", "AlwaysSnapFacing", AlwaysSnapFacing);
            //AmmoCountHiddenInUI
            AmmoRechargeTime = file.GetMultiFloat("SpellData", "AmmoRechargeTime", 6, AmmoRechargeTime[0]);
            AmmoUsed         = file.GetMultiInt("SpellData", "AmmoUsed", 6, AmmoUsed[0]);
            //AnimationLeadOutName
            //AnimationLoopName
            //AnimationName
            //AnimationWinddownName
            //ApplyAttackDamage
            //ApplyAttackEffect
            //ApplyMaterialOnHitSound
            BelongsToAvatar           = file.GetBool("SpellData", "BelongsToAvatar", BelongsToAvatar);
            BounceRadius              = file.GetFloat("SpellData", "BounceRadius", BounceRadius);
            CanCastWhileDisabled      = file.GetBool("SpellData", "CanCastWhileDisabled", CanCastWhileDisabled);
            CancelChargeOnRecastTime  = file.GetFloat("SpellData", "CancelChargeOnRecastTime", CancelChargeOnRecastTime);
            CanMoveWhileChanneling    = file.GetBool("SpellData", "CanMoveWhileChanneling", CanMoveWhileChanneling);
            CannotBeSuppressed        = file.GetBool("SpellData", "CannotBeSuppressed", CannotBeSuppressed);
            CanOnlyCastWhileDead      = file.GetBool("SpellData", "CanOnlyCastWhileDead", CanOnlyCastWhileDead);
            CanOnlyCastWhileDisabled  = file.GetBool("SpellData", "CanOnlyCastWhileDisabled", CanOnlyCastWhileDisabled);
            CantCancelWhileChanneling = file.GetBool("SpellData", "CantCancelWhileChanneling", CantCancelWhileChanneling);
            CantCancelWhileWindingUp  = file.GetBool("SpellData", "CantCancelWhileWindingUp", CantCancelWhileWindingUp);
            CantCastWhileRooted       = file.GetBool("SpellData", "CantCastWhileRooted", CantCastWhileRooted);
            CastConeAngle             = file.GetFloat("SpellData", "CastConeAngle", CastConeAngle);
            CastConeDistance          = file.GetFloat("SpellData", "CastConeDistance", CastConeDistance);
            CastFrame           = file.GetFloat("SpellData", "CastFrame", CastFrame);
            CastRadius          = file.GetMultiFloat("SpellData", "CastRadius", 6, CastRadius[0]);
            CastRadiusSecondary = file.GetMultiFloat("SpellData", "CastRadiusSecondary", 6, CastRadiusSecondary[0]);
            //CastRadiusSecondaryTexture
            //CastRadiusTexture
            CastRange = file.GetMultiFloat("SpellData", "CastRange", 6, CastRange[0]);
            CastRangeDisplayOverride = file.GetMultiFloat("SpellData", "CastRangeDisplayOverride", 6, CastRangeDisplayOverride[0]);
            CastRangeGrowthDuration  = file.GetMultiFloat("SpellData", "CastRangeGrowthDuration", 6, CastRangeGrowthDuration[0]);
            CastRangeGrowthMax       = file.GetMultiFloat("SpellData", "CastRangeGrowthMax", 6, CastRangeGrowthMax[0]);
            //CastRangeTextureOverrideName
            CastRangeUseBoundingBoxes       = file.GetBool("SpellData", "CastRangeUseBoundingBoxes", CastRangeUseBoundingBoxes);
            CastTargetAdditionalUnitsRadius = file.GetFloat("SpellData", "CastTargetAdditionalUnitsRadius", CastTargetAdditionalUnitsRadius);
            CastType                     = file.GetInt("SpellData", "CastType", CastType);
            ChannelDuration              = file.GetMultiFloat("SpellData", "ChannelDuration", 6, ChannelDuration[0]);
            ChargeUpdateInterval         = file.GetFloat("SpellData", "ChargeUpdateInterval", ChargeUpdateInterval);
            CircleMissileAngularVelocity = file.GetFloat("SpellData", "CircleMissileAngularVelocity", CircleMissileAngularVelocity);
            CircleMissileRadialVelocity  = file.GetFloat("SpellData", "CircleMissileRadialVelocity", CircleMissileRadialVelocity);
            //ClientOnlyMissileTargetBoneName
            //Coefficient
            //Coefficient2
            //ConsideredAsAutoAttack
            Cooldown = file.GetMultiFloat("SpellData", "Cooldown", 6, Cooldown[0]);
            //CursorChangesInGrass
            //CursorChangesInTerrain
            DeathRecapPriority     = file.GetInt("SpellData", "DeathRecapPriority", DeathRecapPriority);
            DelayCastOffsetPercent = file.GetFloat("SpellData", "DelayCastOffsetPercent", DelayCastOffsetPercent);
            DelayTotalTimePercent  = file.GetFloat("SpellData", "DelayTotalTimePercent", DelayTotalTimePercent);
            //Description
            //DisableCastBar
            //DisplayName
            DoesntBreakChannels   = file.GetBool("SpellData", "DoesntBreakChannels", DoesntBreakChannels);
            DoNotNeedToFaceTarget = file.GetBool("SpellData", "DoNotNeedToFaceTarget", DoNotNeedToFaceTarget);
            //DrawSecondaryLineIndicator
            //DynamicExtended
            //string DynamicTooltip
            //EffectXLevelYAmmount
            Flags = file.GetInt("SpellData", "Flags", Flags);
            //FloatStaticsDecimalsX
            //FloatVarsDecimalsX
            HaveAfterEffect = file.GetBool("SpellData", "HaveAfterEffect", HaveAfterEffect);
            HaveHitBone     = file.GetBool("SpellData", "HaveHitBone", HaveHitBone);
            HaveHitEffect   = file.GetBool("SpellData", "HaveHitEffect", HaveHitEffect);
            HavePointEffect = file.GetBool("SpellData", "HavePointEffect", HavePointEffect);
            //HideRangeIndicatorWhenCasting
            HitBoneName         = file.GetString("SpellData", "HitBoneName", HitBoneName);
            HitEffectName       = file.GetString("SpellData", "HitEffectName", HitEffectName);
            HitEffectOrientType = file.GetInt("SpellData", "HitEffectOrientType", HitEffectOrientType);
            //HitEffectPlayerName
            IgnoreAnimContinueUntilCastFrame = file.GetBool("SpellData", "IgnoreAnimContinueUntilCastFrame", IgnoreAnimContinueUntilCastFrame);
            IgnoreRangeCheck = file.GetBool("SpellData", "IgnoreRangeCheck", IgnoreRangeCheck);
            //InventoryIconX
            IsDisabledWhileDead = file.GetBool("SpellData", "IsDisabledWhileDead", IsDisabledWhileDead);
            IsToggleSpell       = file.GetBool("SpellData", "IsToggleSpell", IsToggleSpell);
            //KeywordWhenAcquired
            //LevelXDesc
            LineDragLength     = file.GetFloat("SpellData", "LineDragLength", LineDragLength);
            LineMissileBounces = file.GetInt("SpellData", "LineMissileBounces", LineMissileBounces);
            LineMissileCollisionFromStartPoint            = file.GetBool("SpellData", "LineMissileCollisionFromStartPoint", LineMissileCollisionFromStartPoint);
            LineMissileDelayDestroyAtEndSeconds           = file.GetFloat("SpellData", "LineMissileDelayDestroyAtEndSeconds", LineMissileDelayDestroyAtEndSeconds);
            LineMissileEndsAtTargetPoint                  = file.GetBool("SpellData", "LineMissileEndsAtTargetPoint", LineMissileEndsAtTargetPoint);
            LineMissileFollowsTerrainHeight               = file.GetBool("SpellData", "LineMissileFollowsTerrainHeight", LineMissileFollowsTerrainHeight);
            LineMissileTargetHeightAugment                = file.GetFloat("SpellData", "LineMissileTargetHeightAugment", LineMissileTargetHeightAugment);
            LineMissileTimePulseBetweenCollisionSpellHits = file.GetFloat("SpellData", "LineMissileTimePulseBetweenCollisionSpellHits", LineMissileTimePulseBetweenCollisionSpellHits);
            LineMissileTrackUnits = file.GetBool("SpellData", "LineMissileTrackUnits", LineMissileTrackUnits);
            LineMissileUsesAccelerationForBounce = file.GetBool("SpellData", "LineMissileUsesAccelerationForBounce", LineMissileUsesAccelerationForBounce);
            //LineTargetingBaseTextureOverrideName
            //LineTargetingBaseTextureOverrideName
            LineWidth = file.GetFloat("SpellData", "LineWidth", LineWidth);
            LocationTargettingLength = file.GetMultiFloat("SpellData", "LocationTargettingLength", 6, LocationTargettingLength[0]);
            LocationTargettingWidth  = file.GetMultiFloat("SpellData", "LocationTargettingWidth", 6, LocationTargettingWidth[0]);
            LockConeToPlayer         = file.GetBool("SpellData", "LockConeToPlayer", LockConeToPlayer);
            //LookAtPolicy
            LuaOnMissileUpdateDistanceInterval = file.GetFloat("SpellData", "LuaOnMissileUpdateDistanceInterval", LuaOnMissileUpdateDistanceInterval);
            ManaCost = file.GetMultiFloat("SpellData", "ManaCost", 6, ManaCost[0]);
            //Map_X_EffectYLevelZAmmount
            MaxAmmo = file.GetMultiInt("SpellData", "MaxAmmo", 6, MaxAmmo[0]);
            //MaxGrowthRangeTextureName
            //MinimapIcon
            //MinimapIconDisplayFlag
            //MinimapIconRotation
            MissileSpeed                          = file.GetFloat("SpellData", "MissileSpeed", MissileSpeed);
            MissileAccel                          = file.GetFloat("SpellData", "MissileAccel", MissileAccel);
            MissileBoneName                       = file.GetString("SpellData", "MissileBoneName", MissileBoneName);
            MissileEffect                         = file.GetString("SpellData", "MissileEffect", MissileEffect);
            MissileEffectPlayer                   = file.GetString("SpellData", "MissileEffectPlayer", MissileEffectPlayer);
            MissileFixedTravelTime                = file.GetFloat("SpellData", "MissileFixedTravelTime", MissileFixedTravelTime);
            MissileFollowsTerrainHeight           = file.GetBool("SpellData", "MissileFollowsTerrainHeight", MissileFollowsTerrainHeight);
            MissileGravity                        = file.GetFloat("SpellData", "MissileGravity", MissileGravity);
            MissileLifetime                       = file.GetFloat("SpellData", "MissileLifetime", MissileLifetime);
            MissileMaxSpeed                       = file.GetFloat("SpellData", "MissileMaxSpeed", MissileSpeed);
            MissileMinSpeed                       = file.GetFloat("SpellData", "MissileMinSpeed", MissileSpeed);
            MissileMinTravelTime                  = file.GetFloat("SpellData", "MissileMinTravelTime", MissileMinTravelTime);
            MissilePerceptionBubbleRadius         = file.GetFloat("SpellData", "MissilePerceptionBubbleRadius", MissilePerceptionBubbleRadius);
            MissilePerceptionBubbleRevealsStealth = file.GetBool("SpellData", "MissilePerceptionBubbleRevealsStealth", MissilePerceptionBubbleRevealsStealth);
            //MissileSpeed = file.GetFloat("SpellData", "MissileSpeed", MissileSpeed);
            MissileTargetHeightAugment = file.GetFloat("SpellData", "MissileTargetHeightAugment", MissileTargetHeightAugment);
            MissileUnblockable         = file.GetBool("SpellData", "MissileUnblockable", MissileUnblockable);
            NoWinddownIfCancelled      = file.GetBool("SpellData", "NoWinddownIfCancelled", NoWinddownIfCancelled);
            //NumSpellTargeters
            //OrientRadiusTextureFromPlayer
            //OrientRangeIndicatorToCursor
            //OrientRangeIndicatorToFacing
            OverrideCastTime = file.GetFloat("SpellData", "OverrideCastTime", OverrideCastTime);
            //public Vector3 ParticleStartOffset { get; set; } = new Vector3(0, 0, 0);
            var particleStartOffset = file.GetFloatArray("SpellData", "ParticleStartOffset", new[] { ParticleStartOffset.X, ParticleStartOffset.Y, ParticleStartOffset.Z });

            ParticleStartOffset = new Vector3(particleStartOffset[0], particleStartOffset[1], particleStartOffset[2]);
            //PlatformEnabled
            PointEffectName = file.GetString("SpellData", "PointEffectName", PointEffectName);
            //RangeIndicatorTextureName
            RequiredUnitTags    = file.GetString("SpellData", "RequiredUnitTags", RequiredUnitTags);
            SelectionPreference = file.GetString("SpellData", "SelectionPreference", SelectionPreference);
            //Sound_CastName
            //Sound_HitName
            //Sound_VOEventCategory
            SpellCastTime           = file.GetFloat("SpellData", "SpellCastTime", SpellCastTime);
            SpellRevealsChampion    = file.GetFloat("SpellData", "SpellRevealsChampion", SpellRevealsChampion);
            SpellTotalTime          = file.GetFloat("SpellData", "SpellTotalTime", SpellTotalTime);
            StartCooldown           = file.GetFloat("SpellData", "StartCooldown", StartCooldown);
            SubjectToGlobalCooldown = file.GetBool("SpellData", "SubjectToGlobalCooldown", SubjectToGlobalCooldown);
            //TargeterConstrainedToRange
            TargettingType            = file.GetInt("SpellData", "TargettingType", TargettingType);
            TextFlags                 = file.GetString("SpellData", "TextFlags", TextFlags);
            TriggersGlobalCooldown    = file.GetBool("SpellData", "TriggersGlobalCooldown", TriggersGlobalCooldown);
            UpdateRotationWhenCasting = file.GetBool("SpellData", "UpdateRotationWhenCasting", UpdateRotationWhenCasting);
            UseAnimatorFramerate      = file.GetBool("SpellData", "UseAnimatorFramerate", UseAnimatorFramerate);
            UseAutoattackCastTime     = file.GetBool("SpellData", "UseAutoattackCastTime", UseAutoattackCastTime);
            UseChargeChanneling       = file.GetBool("SpellData", "UseChargeChanneling", UseChargeChanneling);
            UseChargeTargeting        = file.GetBool("SpellData", "UseChargeTargeting", UseChargeTargeting);
            UseGlobalLineIndicator    = file.GetBool("SpellData", "UseGlobalLineIndicator", UseGlobalLineIndicator);
            UseMinimapTargeting       = file.GetBool("SpellData", "UseMinimapTargeting", UseMinimapTargeting);
        }
Пример #2
0
        public void Load(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            var             file = new ContentFile();
            List <IPackage> packages;

            try
            {
                file     = (ContentFile)_contentManager.GetContentFileFromJson("Stats", name);
                packages = new List <IPackage>(_contentManager.GetAllLoadedPackages());
            }
            catch (ContentNotFoundException exception)
            {
                _logger.Warn(exception.Message);
                return;
            }

            BaseHp                       = file.GetFloat("Data", "BaseHP", BaseHp);
            BaseMp                       = file.GetFloat("Data", "BaseMP", BaseMp);
            BaseDamage                   = file.GetFloat("Data", "BaseDamage", BaseDamage);
            AttackRange                  = file.GetFloat("Data", "AttackRange", AttackRange);
            MoveSpeed                    = file.GetInt("Data", "MoveSpeed", MoveSpeed);
            Armor                        = file.GetFloat("Data", "Armor", Armor);
            SpellBlock                   = file.GetFloat("Data", "SpellBlock", SpellBlock);
            BaseStaticHpRegen            = file.GetFloat("Data", "BaseStaticHPRegen", BaseStaticHpRegen);
            BaseStaticMpRegen            = file.GetFloat("Data", "BaseStaticMPRegen", BaseStaticMpRegen);
            AttackDelayOffsetPercent     = file.GetFloat("Data", "AttackDelayOffsetPercent", AttackDelayOffsetPercent);
            AttackDelayCastOffsetPercent = file.GetFloat("Data", "AttackDelayCastOffsetPercent", AttackDelayCastOffsetPercent);
            HpPerLevel                   = file.GetFloat("Data", "HPPerLevel", HpPerLevel);
            MpPerLevel                   = file.GetFloat("Data", "MPPerLevel", MpPerLevel);
            DamagePerLevel               = file.GetFloat("Data", "DamagePerLevel", DamagePerLevel);
            ArmorPerLevel                = file.GetFloat("Data", "ArmorPerLevel", ArmorPerLevel);
            SpellBlockPerLevel           = file.GetFloat("Data", "SpellBlockPerLevel", SpellBlockPerLevel);
            HpRegenPerLevel              = file.GetFloat("Data", "HPRegenPerLevel", HpRegenPerLevel);
            MpRegenPerLevel              = file.GetFloat("Data", "MPRegenPerLevel", MpRegenPerLevel);
            AttackSpeedPerLevel          = file.GetFloat("Data", "AttackSpeedPerLevel", AttackSpeedPerLevel);
            IsMelee                      = file.GetString("Data", "IsMelee", IsMelee ? "true" : "false").Equals("true");
            PathfindingCollisionRadius   =
                file.GetFloat("Data", "PathfindingCollisionRadius", PathfindingCollisionRadius);
            GameplayCollisionRadius = file.GetFloat("Data", "GameplayCollisionRadius", GameplayCollisionRadius);
            Enum.TryParse <PrimaryAbilityResourceType>(file.GetString("Data", "PARType", ParType.ToString()),
                                                       out var tempPar);
            ParType = tempPar;

            for (var i = 0; i < 4; i++)
            {
                SpellNames[i] = file.GetString("Data", $"Spell{i + 1}", SpellNames[i]);
            }

            for (var i = 0; i < 4; i++)
            {
                SpellsUpLevels[i] = file.GetIntArray("Data", $"SpellsUpLevels{i + 1}", SpellsUpLevels[i]);
            }

            MaxLevels = file.GetIntArray("Data", "MaxLevels", MaxLevels);
            for (var i = 0; i < 8; i++)
            {
                ExtraSpells[i] = file.GetString("Data", $"ExtraSpell{i + 1}", ExtraSpells[i]);
            }

            for (var i = 0; i < 6; i++)
            {
                Passives[i].PassiveNameStr     = file.GetString("Data", $"Passive{i + 1}Name", Passives[i].PassiveNameStr);
                Passives[i].PassiveAbilityName = PassiveData.GetPassiveAbilityNameFromScriptFile(name, packages);
                Passives[i].PassiveLevels      = file.GetMultiInt("Data", $"Passive{i + 1}Level", 6, -1);
            }
        }
Пример #3
0
        public void Load(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            var file = new ContentFile();

            try
            {
                var path = _game.Config.ContentManager.GetUnitStatPath(name);
                _logger.Debug($"Loading {name}'s Stats  from path: {Path.GetFullPath(path)}!");
                var text = File.ReadAllText(Path.GetFullPath(path));
                file = JsonConvert.DeserializeObject <ContentFile>(text);
            }
            catch (ContentNotFoundException notfound)
            {
                _logger.Warn($"Stats for {name} was not found: {notfound.Message}");
                return;
            }

            BaseHp                     = file.GetFloat("Data", "BaseHP", BaseHp);
            BaseMp                     = file.GetFloat("Data", "BaseMP", BaseMp);
            BaseDamage                 = file.GetFloat("Data", "BaseDamage", BaseDamage);
            AttackRange                = file.GetFloat("Data", "AttackRange", AttackRange);
            MoveSpeed                  = file.GetInt("Data", "MoveSpeed", MoveSpeed);
            Armor                      = file.GetFloat("Data", "Armor", Armor);
            SpellBlock                 = file.GetFloat("Data", "SpellBlock", SpellBlock);
            BaseStaticHpRegen          = file.GetFloat("Data", "BaseStaticHPRegen", BaseStaticHpRegen);
            BaseStaticMpRegen          = file.GetFloat("Data", "BaseStaticMPRegen", BaseStaticMpRegen);
            AttackDelayOffsetPercent   = file.GetFloat("Data", "AttackDelayOffsetPercent", AttackDelayOffsetPercent);
            HpPerLevel                 = file.GetFloat("Data", "HPPerLevel", HpPerLevel);
            MpPerLevel                 = file.GetFloat("Data", "MPPerLevel", MpPerLevel);
            DamagePerLevel             = file.GetFloat("Data", "DamagePerLevel", DamagePerLevel);
            ArmorPerLevel              = file.GetFloat("Data", "ArmorPerLevel", ArmorPerLevel);
            SpellBlockPerLevel         = file.GetFloat("Data", "SpellBlockPerLevel", SpellBlockPerLevel);
            HpRegenPerLevel            = file.GetFloat("Data", "HPRegenPerLevel", HpRegenPerLevel);
            MpRegenPerLevel            = file.GetFloat("Data", "MPRegenPerLevel", MpRegenPerLevel);
            AttackSpeedPerLevel        = file.GetFloat("Data", "AttackSpeedPerLevel", AttackSpeedPerLevel);
            IsMelee                    = file.GetString("Data", "IsMelee", IsMelee ? "Yes" : "No").Equals("yes");
            PathfindingCollisionRadius =
                file.GetFloat("Data", "PathfindingCollisionRadius", PathfindingCollisionRadius);
            GameplayCollisionRadius = file.GetFloat("Data", "GameplayCollisionRadius", GameplayCollisionRadius);
            Enum.TryParse <PrimaryAbilityResourceType>(file.GetString("Data", "PARType", ParType.ToString()),
                                                       out var tempPar);
            ParType = tempPar;

            for (var i = 0; i < 4; i++)
            {
                SpellNames[i] = file.GetString("Data", $"Spell{i + 1}", SpellNames[i]);
            }

            for (var i = 0; i < 4; i++)
            {
                SpellsUpLevels[i] = file.GetIntArray("Data", $"SpellsUpLevels{i + 1}", SpellsUpLevels[i]);
            }

            MaxLevels = file.GetIntArray("Data", "MaxLevels", MaxLevels);
            for (var i = 0; i < 8; i++)
            {
                ExtraSpells[i] = file.GetString("Data", $"ExtraSpell{i + 1}", ExtraSpells[i]);
            }

            for (var i = 0; i < 6; i++)
            {
                Passives[i].PassiveNameStr = file.GetString("Data", $"Passive{i + 1}Name", Passives[i].PassiveNameStr);
                Passives[i].PassiveLuaName =
                    file.GetString("Data", $"Passive{i + 1}LuaName", Passives[i].PassiveLuaName);
                Passives[i].PassiveLevels = file.GetMultiInt("Data", $"Passive{i + 1}Level", 6, -1);
            }
        }