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); }
public void InitMods() { UseMod = UserConfig.GetValueAsBool("ShipMoraleMod", "enableMod"); MinimumMorale = UserConfig.GetValueAsInt("ShipMoraleMod", "MinimumMorale"); ConfigHasBeenInit = true; }
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); } } }
public void OnyxEnableNew() { UseMod = UserConfig.GetValueAsBool("DifficultyIconsMod", "enableCharacterIcons"); PrintEnemyLevel = UserConfig.GetValueAsBool("DifficultyIconsMod", "printEnemyLevel"); ReloadCharacter(); }