예제 #1
0
        public OnyxInt GetSpellCastMaxNew(CharacterStats caster, CharacterClass spellClass, int spellLevel)
        {
            // Have to init this way because class initialization doesn't work
            if (!ConfigHasBeenInit)
            {
                ConfigHasBeenInit  = true;
                UseMod             = UserConfig.GetValueAsBool("SpellCastsPerLevel", "enableMod");
                BonusCastsPerLevel = UserConfig.GetValueAsInt("SpellCastsPerLevel", "BonusCastsPerLevel");
            }
            if (!UseMod)
            {
                return(orig_GetSpellCastMax(caster, spellClass, spellLevel));
            }

            OnyxInt onyxInt = OnyxInt.PositiveInfinity;

            if (caster != null && spellLevel >= 1)
            {
                onyxInt = this.SpellCastMaxLookup(spellClass, caster.GetClassPowerLevel(spellClass), spellLevel);
                if (onyxInt == -1)
                {
                    onyxInt = OnyxInt.PositiveInfinity;
                }
                if (onyxInt > 0)
                {
                    onyxInt += caster.GetBonusSpellCasts(spellClass, spellLevel) + BonusCastsPerLevel;
                }
            }
            return(onyxInt);
        }
예제 #2
0
        public void OnyxStartNew()
        {
            UseMod              = UserConfig.GetValueAsBool("GameSpeedMod", "enableMod");
            ToggleMaxGameSpeed  = UserConfig.GetValueAsFloat("GameSpeedMod", "toggleGameSpeed");
            MaxGameSpeedSetting = UserConfig.GetValueAsFloat("GameSpeedMod", "maxGameSpeed");
            PrintSpeed          = UserConfig.GetValueAsBool("GameSpeedMod", "PrintSpeed");
            Config              = MaxGameSpeedSetting.ToString();

            this.m_TimeScale = this.NormalTime;
        }
예제 #3
0
        public void mod_OnyxStart()
        {
            UseMod = UserConfig.GetValueAsBool("ShipMechanics", "clickThroughFog");

            // TPS: Original code
            this.m_destinationDummyObject = new GameObject("WorldMapDestinationDummy");
            this.m_destinationDummyObject.transform.SetParent(base.transform.parent, false);
            this.Respawn();
            SingletonBehavior <CameraControl> .Instance.FocusOnPoint(base.transform.position, 0f);

            SingletonBehavior <CameraControl> .Instance.UpdateCamera();
        }
예제 #4
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]);
            }
        }
예제 #5
0
        public static void AutosaveNew()
        {
            if (!ConfigHasBeenInit)
            {
                ConfigHasBeenInit = true;
                UseMod            = UserConfig.GetValueAsBool("DisableAutosave", "enableMod");
            }

            if (!UseMod)
            {
                orig_AutoSave();
            }
            return;
        }
예제 #6
0
        public LevelDifficultyIcons GetDifficultyIconsNew(int playerLevel, int targetLevel)
        {
            if (!ConfigHasBeenInit)
            {
                ConfigHasBeenInit = true;
                UseMod            = UserConfig.GetValueAsBool("DifficultyIconsMod", "enableQuestIcons");
            }

            LevelDifficultyIcons levelDifficultyIconSettings = null;

            // Original condition: re-enable to hide level difficulty icons when level scaling is on
            if (!UseMod)
            {
                if (GameState.Option.LevelScaling == LevelScalingOption.None &&
                    !GameState.Option.ShowDifficultyIndicators)
                {
                    return(null);
                }
            }

            if (!GameState.Option.ShowDifficultyIndicators)
            {
                return(null);
            }

            int num  = int.MinValue;
            int num1 = targetLevel - playerLevel;

            for (int i = 0; i < this.LevelDifficultyIconSettings.Length; i++)
            {
                int levelDifference = this.LevelDifficultyIconSettings[i].LevelDifference;
                if (num1 >= levelDifference && levelDifference > num)
                {
                    num = levelDifference;
                    levelDifficultyIconSettings = this.LevelDifficultyIconSettings[i];
                }
            }

            return(levelDifficultyIconSettings);
        }
예제 #7
0
 public void InitMods()
 {
     UseMod            = UserConfig.GetValueAsBool("ShipMoraleMod", "enableMod");
     MinimumMorale     = UserConfig.GetValueAsInt("ShipMoraleMod", "MinimumMorale");
     ConfigHasBeenInit = true;
 }
예제 #8
0
        public void mod_UpdateCursor()
        {
            if (!ConfigHasBeenInit)
            {
                UseMod            = UserConfig.GetValueAsBool("ShipMechanics", "clickThroughFog");
                ConfigHasBeenInit = true;
            }

            if (GameCursor.CurrentMode == GameCursor.InputMode.Empowering)
            {
                GameCursor.UiCursor = GameCursor.CursorType.Empower;
                return;
            }
            if (Player.IsCasting() && this.CastingAbility != null)
            {
                if (!this.CastingAbility.ReadyForUI)
                {
                    this.CancelModes(true);
                }
                if (this.CastingAbility != null && !this.CastingAbility.IsValidTarget(GameCursor.CharacterUnderCursor))
                {
                    GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk;
                    return;
                }
            }
            if (InGameUIManager.MouseOverUI)
            {
                GameCursor.DesiredCursor = GameCursor.CursorType.Normal;
                if (Player.IsCastingOrRetargeting())
                {
                    if (this.IsCastingAutoAttack)
                    {
                        GameCursor.DesiredCursor = this.GetAttackCursor();
                    }
                    else
                    {
                        GameCursor.DesiredCursor = Player.GetCursorForCastingStatus(this.GetCanCastCurrentAbility());
                    }
                }
                return;
            }
            if (this.m_isSelecting)
            {
                GameCursor.DesiredCursor = GameCursor.CursorType.Normal;
            }
            else if (this.IsInForceAttackMode)
            {
                if (GameCursor.CharacterUnderCursor != null)
                {
                    Health component = GameCursor.CharacterUnderCursor.GetComponent <Health>();
                    if (component == null || !component.IsTargetableByCursor() || SingletonBehavior <PartyManager> .Instance.IsSelectedPartyMember(GameCursor.CharacterUnderCursor))
                    {
                        GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk;
                    }
                    else
                    {
                        GameCursor.DesiredCursor = this.GetAttackCursor();
                    }
                }
                else
                {
                    GameCursor.DesiredCursor = this.GetAttackCursor();
                }
            }
            else if (Player.IsCastingOrRetargeting())
            {
                if (this.IsCastingAutoAttack)
                {
                    GameCursor.DesiredCursor = this.GetAttackCursor();
                }
                else
                {
                    GameCursor.DesiredCursor = Player.GetCursorForCastingStatus(this.GetCanCastCurrentAbility());
                }
            }
            else if (this.RotatingFormation)
            {
                GameCursor.DesiredCursor = GameCursor.CursorType.RotateFormation;
            }
            else if (Player.MouseFollowActive)
            {
                Vector3           position = base.transform.position;
                List <GameObject> selectedPartyMemberGameObjects = SingletonBehavior <PartyManager> .Instance.GetSelectedPartyMemberGameObjects();

                if (selectedPartyMemberGameObjects.Count > 0)
                {
                    position = SingletonBehavior <PartyManager> .Instance.GetSelectedPartyCenter();
                }
                Camera  main   = Camera.main;
                Vector2 vector = main.WorldToScreenPoint(GameInput.WorldMousePosition) - main.WorldToScreenPoint(position);
                int     num    = Mathf.CeilToInt((Mathf.Atan2(vector.y, vector.x) - 0.196349546f) / 0.3926991f);
                GameCursor.DesiredCursor = GameCursor.CursorType.ShipMove_N + (-num + 16 + 4) % 16;
            }
            else
            {
                GameObject objectUnderCursor = GameCursor.ObjectUnderCursor;
                if (objectUnderCursor)
                {
                    Usable         component2 = objectUnderCursor.GetComponent <Usable>();
                    WorldMapUsable component3 = objectUnderCursor.GetComponent <WorldMapUsable>();
                    Faction        component4 = objectUnderCursor.GetComponent <Faction>();
                    Health         component5 = objectUnderCursor.GetComponent <Health>();
                    Destructible   component6 = objectUnderCursor.GetComponent <Destructible>();

                    // TPS: Specified Game.Collider2D here
                    Game.Collider2D component7 = objectUnderCursor.GetComponent <Game.Collider2D>();
                    PartyMember     component8 = objectUnderCursor.GetComponent <PartyMember>();
                    if (component3 != null)
                    {
                        GameCursor.DesiredCursor = component3.HoverCursor;
                    }
                    else if (!SingletonBehavior <PartyManager> .Instance.IsPartyMemberSelected())
                    {
                        if (component8 != null)
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.Normal;
                        }
                        else
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk;
                        }
                    }
                    else if (component2 != null && component2.IconType != ColliderIconType.None)
                    {
                        GameCursor.DesiredCursor = GameCursor.CursorType.Normal;
                    }
                    else if (component6 != null)
                    {
                        if (!component6.IsDestroyed)
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.Attack;
                        }
                        else
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.Normal;
                        }
                    }
                    else if (component4 != null && component4.GetRelationshipToPlayer() == Relationship.Hostile && component5 != null && !component5.IsDeadOrUnconscious && component4.CharacterStats != null && !component4.CharacterStats.IsImmuneToAttacks && !GameCursor.OverrideCharacterUnderCursor)
                    {
                        GameCursor.DesiredCursor = this.GetAttackCursor();
                    }
                    else if (component2 != null)
                    {
                        GameCursor.DesiredCursor = component2.GetDesiredCursor();
                    }
                    else if (component7)
                    {
                        if (!SingletonBehavior <PartyManager> .Instance.IsPrimaryPartyMemberSelected())
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk;
                        }
                        else if (GameCursor.CursorOverride != GameCursor.CursorType.None)
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorOverride;
                        }
                        else
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.Normal;
                        }
                    }
                }
                else if (WorldMapPlayer.Instance != null && WorldMapPlayer.Instance.CanReachMousePosition())
                {
                    if (UseMod)
                    {
                        // TPS: Ignore presence of fog when checking walkable state
                        GameCursor.DesiredCursor = GameCursor.CursorType.Walk;
                    }
                    else // default behavior
                    {
                        if (SingletonBehavior <WorldMapFogOfWar> .Instance.IsFogRevealed(GameInput.WorldMousePosition))
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.Walk;
                        }
                        else
                        {
                            GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk;
                        }
                    }
                }
                else if (this.CanAtLeastOneSelectedPartyMemberReachMousePosition())
                {
                    if (GameState.InCombat && Player.IsSelectedPartyMemberEngaged())
                    {
                        GameCursor.DesiredCursor = GameCursor.CursorType.Disengage;
                    }
                    else
                    {
                        GameCursor.DesiredCursor = GameCursor.CursorType.Walk;
                    }
                }
                else
                {
                    GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk;
                }
            }
            if (GameCursor.DesiredCursor == GameCursor.CursorType.Normal && GameInput.GetControl(MappedControl.MULTISELECT, false))
            {
                GameCursor.DesiredCursor = GameCursor.CursorType.SelectionAdd;
            }
            else if (GameCursor.DesiredCursor == GameCursor.CursorType.Normal && GameInput.GetControl(MappedControl.MULTISELECT_NEGATIVE, false))
            {
                GameCursor.DesiredCursor = GameCursor.CursorType.SelectionSubtract;
            }
            this.WantsAttackAdvantageCursor = false;
        }
        protected void OnyxUpdateNew()
        {
            // Have to init this way because class initialization doesn't work
            if (!ConfigHasBeenInit)
            {
                ConfigHasBeenInit = true;
                UseMod            = UserConfig.GetValueAsBool("ResetEmpowerAndSpellsMod", "enableMod");
            }
            if (!UseMod)
            {
                orig_OnyxUpdate();
                return;
            }

            if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.E))
            {
                Game.Console.AddMessage("Reset Empower");

                //SingletonBehavior<PartyManager>.Instance.GetSelectedPartyMemberGameObjects()

                var selchars = m_selectedCharacters;
                if (selchars != null) // there's a selected char
                {
                    foreach (var selchar in selchars)
                    {
                        //this resets the # used empowered per combat to 0
                        selchar.ResetEmpower();

                        //set empower pts to MaxEmpowerPoints
                        selchar.EmpowerPoints = selchar.MaxEmpowerPoints;
                    }
                }
            }

            if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.S))
            {
                Game.Console.AddMessage("Reset Spellcasts");
                var selchars = m_selectedCharacters;
                if (selchars != null) // there's a selected char
                {
                    foreach (var selchar in selchars)
                    {
                        // FROM EmpowerResources, hopefully fixes spellcasts
                        foreach (AccruedResourceTrait accruedResourceTrait in selchar.AbilityList.FindAbilitiesByType <AccruedResourceTrait>())
                        {
                            //accruedResourceTrait.RestoreResource(accruedResourceTrait.GetSelfEmpowerRestoreCount());
                            accruedResourceTrait.RestoreResource(accruedResourceTrait.GetResourceMax() - accruedResourceTrait.GetResource());
                        }
                        for (CharacterClass characterClass = CharacterClass.None; characterClass < CharacterClass.Count; characterClass++)
                        {
                            for (int i = 1; i <= GlobalGameSettingsGameData.Instance.MaxSpellLevel; i++)
                            {
                                OnyxInt spellCastMax = SingletonBehavior <SpellMax> .Instance.GetSpellCastMax(selchar, characterClass, i);

                                selchar.RestoreSpellCasts(characterClass, i, spellCastMax);
                            }
                            selchar.AddClassAbilityPoolPoints(characterClass, selchar.GetMaxPowerPoolPoints(characterClass, null));
                        }
                    }
                }
            }


            this.m_RefreshTimer -= TimeController.UnscaledDeltaTime;
            if (this.m_NeedsRefresh || this.m_RefreshTimer <= 0f)
            {
                this.m_NeedsRefresh = false;
                this.m_RefreshTimer = float.PositiveInfinity;
                this.Refresh();
            }
            if (GameInput.GetControlDownWithRepeat(MappedControl.UP_ABILITY, true))
            {
                this.NavigateVertical(1);
            }
            else if (GameInput.GetControlDownWithRepeat(MappedControl.DOWN_ABILITY, true))
            {
                this.NavigateVertical(-1);
            }
            if (GameInput.GetControlDownWithRepeat(MappedControl.NEXT_ABILITY, true))
            {
                if (this.m_SelectionRow < 0)
                {
                    this.SelectFirstButton();
                }
                else
                {
                    this.NavigateHorizontal(1);
                }
            }
            else if (GameInput.GetControlDownWithRepeat(MappedControl.PREVIOUS_ABILITY, true))
            {
                if (this.m_SelectionRow < 0)
                {
                    this.SelectLastButton();
                }
                else
                {
                    this.NavigateHorizontal(-1);
                }
            }
            UIAbilityBarButton selectedButton = this.GetSelectedButton();

            if (selectedButton && !selectedButton.gameObject.activeInHierarchy)
            {
                this.CancelSelection();
            }
            if (this.m_SelectionTooltipDelay > 0f)
            {
                this.m_SelectionTooltipDelay -= TimeController.UnscaledDeltaTime;
                if (this.m_SelectionTooltipDelay <= 0f && selectedButton)
                {
                    selectedButton.ShowTooltip();
                }
            }
            UIAbilityBarButton selectedButton2 = this.GetSelectedButton();

            if (selectedButton2 && !Player.IsCastingOrRetargeting() && GameInput.GetControlUp(MappedControl.CAST_SELECTED_ABILITY, true))
            {
                selectedButton2.Trigger();
            }
            if (this.SelectedObject != null)
            {
                CharacterHotkeyBindings orAddComponent = ResourceManager.GetOrAddComponent <CharacterHotkeyBindings>(this.SelectedObject.gameObject);
                if (GameInput.IsKeyUpAvailable(KeyCode.Mouse0) && orAddComponent != null)
                {
                    orAddComponent.Activate(SingletonBehavior <GameInput> .Instance.LastKeyUp);
                }
                if ((this.m_hotkeyRow == null || !this.m_hotkeyRow.gameObject.activeSelf) && (this.m_rows.Count < 2 || this.m_rows[1] == this.m_hotkeyRow || this.m_rows[1].IsEmpty) && orAddComponent != null && !ICollectionUtils.IsNullOrEmpty <KeyValuePair <KeyControl, Guid> >(orAddComponent.AbilityHotkeys))
                {
                    this.m_hotkeyRow = this.ShowSubrow(null, 1);
                    this.m_hotkeyRow.SetIdentification(GuiStringTable.GetText(1662));
                    this.m_hotkeyRow.AddHotkeySet();
                }
                AIController   component      = ComponentUtils.GetComponent <AIController>(this.m_selectedCharacter);
                GenericAbility genericAbility = (!component) ? null : component.GetCurrentIntroStateAbility();
                if (genericAbility != null && genericAbility.Attack != null && !genericAbility.Attack.ForcedTarget)
                {
                    if (this.m_castControlRow == null || !this.m_castControlRow.gameObject.activeSelf)
                    {
                        this.m_castControlRow = this.ShowSubrow(null, 2);
                        this.m_castControlRow.SetIdentification(GuiStringTable.GetText(2994));
                        this.m_castControlRow.AddCurrentCastSet();
                    }
                }
                else
                {
                    this.HideSubrow(2);
                }
            }
        }
예제 #10
0
 public void OnyxEnableNew()
 {
     UseMod          = UserConfig.GetValueAsBool("DifficultyIconsMod", "enableCharacterIcons");
     PrintEnemyLevel = UserConfig.GetValueAsBool("DifficultyIconsMod", "printEnemyLevel");
     ReloadCharacter();
 }