예제 #1
0
        public int GetClassPowerLevelNew(bool isMulticlassed, int characterLevel)
        {
            if (!ConfigHasBeenInit)
            {
                ConfigHasBeenInit = true;
                UseMod            = UserConfig.GetValueAsBool("MulticlassPenaltyRemover", "enableMod");
            }

            if (UseMod)
            {
                // this is literally the only required changed line
                isMulticlassed = false;
            }

            int charLevelAsIndex = characterLevel - 1;

            if (charLevelAsIndex < 0)
            {
                return(0);
            }
            if (isMulticlassed)
            {
                if (charLevelAsIndex >= this.MultiClassPowerLevelByCharacterLevel.Count)
                {
                    UIDebug.LogOnScreenWarning(string.Concat(new object[]
                    {
                        "Multi Class Power Level By Character Level list only has ",
                        this.MultiClassPowerLevelByCharacterLevel.Count,
                        " entries. Trying to lookup character with class level: ",
                        characterLevel
                    }), UIDebug.Department.Design, 10f);
                    return(this.MultiClassPowerLevelByCharacterLevel[this.MultiClassPowerLevelByCharacterLevel.Count - 1]);
                }
                return(this.MultiClassPowerLevelByCharacterLevel[charLevelAsIndex]);
            }
            else
            {
                if (charLevelAsIndex >= this.SingleClassPowerLevelByCharacterLevel.Count)
                {
                    UIDebug.LogOnScreenWarning(string.Concat(new object[]
                    {
                        "Single Class Power Level By Character Level list only has ",
                        this.SingleClassPowerLevelByCharacterLevel.Count,
                        " entries. Trying to lookup character with class level: ",
                        characterLevel
                    }), UIDebug.Department.Design, 10f);
                    return(this.SingleClassPowerLevelByCharacterLevel[this.MultiClassPowerLevelByCharacterLevel.Count - 1]);
                }
                return(this.SingleClassPowerLevelByCharacterLevel[charLevelAsIndex]);
            }
        }
        public static void CompanionAddRelationshipNew(Guid sourceGuid, Guid targetGuid, Axis axis, Guid strengthGuid, bool onlyInParty)
        {
            Guid strengthOverrideGuid = CompanionStrengthOverrides.First(x => x.Key == strengthGuid).Value;
            ChangeStrengthGameData strengthOverride = Scripts.GetGameDataByGuid <ChangeStrengthGameData>(strengthOverrideGuid);

            sourceGuid = InstanceID.GetObjectID(sourceGuid);
            targetGuid = InstanceID.GetObjectID(targetGuid);

            Guid guid = GameState.PlayerCharacter.GetComponent <InstanceID>().Guid;

            if (onlyInParty && (!SingletonBehavior <PartyManager> .Instance.IsActivePartyMember(sourceGuid) || !SingletonBehavior <PartyManager> .Instance.IsActivePartyMember(targetGuid)))
            {
                return;
            }

            if (sourceGuid == SpecialCharacterInstanceID.PlayerGuid || sourceGuid == guid)
            {
                Debug.LogError("Cannot change the player's relationship towards a companion");
                UIDebug.LogOnScreenWarning("Script is trying to use Player's guid as SourceGuid for CompanionAddRelationship", UIDebug.Department.Design, 10f);
            }
            else if (targetGuid == SpecialCharacterInstanceID.PlayerGuid || targetGuid == guid)
            {
                CompanionGameData sourceCompanion = CompanionManager.GetCompanionData(sourceGuid);
                SingletonBehavior <PartyManager> .Instance.AddPlayerRelationship(sourceCompanion, strengthOverride.ChangeValue, axis);
            }
            else
            {
                CompanionGameData sourceCompanion = CompanionManager.GetCompanionData(sourceGuid);
                CompanionGameData targetCompanion = CompanionManager.GetCompanionData(targetGuid);

                if (sourceCompanion == null || targetCompanion == null)
                {
                    Debug.LogError($"Null companion data being used for guid: {((!(sourceCompanion == null)) ? targetGuid : sourceGuid)}");
                }
                else
                {
                    SingletonBehavior <PartyManager> .Instance.AddRelationship(sourceCompanion, targetCompanion, strengthOverride.ChangeValue, axis);
                }
            }
        }