Example #1
0
        private void OnClickNew()
        {
            if (m_currentPartyMember != null)
            {
                if (isRoster)
                {
                    if (m_currentPartyMember.MemberStatus == PartyMemberStatus.InactiveOnAdventure)
                    {
                        UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.Ok, GuiStringTable.GetText(873), GuiStringTable.Format(896, m_currentPartyMember.Name, string.Empty));
                    }
                    else if (UISingletonHudWindow <UIPartyManager> .Instance.Party.ActiveChildCount < 6)
                    {
                        UISingletonHudWindow <UIPartyManager> .Instance.PartyCharacter(m_currentPartyMember);
                    }
                }
                else if (!m_currentPartyMember.IsPlayer)
                {
                    UISingletonHudWindow <UIPartyManager> .Instance.BenchCharacter(m_currentPartyMember);
                }

                UISingletonHudWindow <UIPartyManager> .Instance.Reload();
            }
        }
Example #2
0
        public void AdjustMoraleNew(OnyxInt value, string reason, bool log)
        {
            if (!ConfigHasBeenInit)
            {
                InitMods();
            }
            if (!this.HasCrewOnShip())
            {
                return;
            }
            if (log)
            {
                ShipCrewManager.LogMorale(value);
            }

            this.Morale = Mathf.Clamp(this.Morale + (int)value, MinimumMorale, 100);
            UIShipResourceNotificationManager.PostNotification(new SpriteKey(SingletonBehavior <UIAtlasManager> .Instance.GameSystemIcons, "icon_ship_morale"), GuiStringTable.GetText(3709), value, reason);
            ShipCrewManager.OnShipMoraleChanged.Trigger();
            if (this.GetCurrentMoraleState() == MoraleStateType.Mutinous)
            {
                TutorialManager.STriggerTutorialsOfType(TutorialEventType.LowMorale);
            }
        }
Example #3
0
        protected void OnyxUpdateNew()
        {
            //base.OnyxUpdate();

            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.E))
            {
                Game.Console.AddMessage("Pressed LCtrl and E to 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.LeftControl) && Input.GetKeyDown(KeyCode.S))
            {
                Game.Console.AddMessage("Pressed LCtrl and S to 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);
                }
            }
        }
Example #4
0
        static bool Prefix(ShipCrewManager __instance, ref OnyxInt value, string reason, bool log)
        {
            try
            {
                if (!Main.enabled)
                {
                    return(true);
                }

                int currentMorale = __instance.Morale;
                int change        = (int)value;
                int modified      = currentMorale + (int)value;

                /*
                 * int minimumMorale = Main.settings.MinimumMorale;
                 * int maximumMorale = Main.settings.MaximumMorale;
                 *
                 * OnyxInt minChange = minimumMorale - currentMorale;
                 * OnyxInt maxChange = currentMorale - maximumMorale;
                 *
                 * Main.Log($"Value: {change}");
                 * Main.Log($"Current: {currentMorale}, Modified: {modified}");
                 * Main.Log($"Minimum Morale: {minimumMorale}, Maximum Morale: {maximumMorale}");
                 */
                if (log)
                {
                    MethodInfo methodInfo = __instance.GetType().GetMethod("LogMorale", BindingFlags.NonPublic | BindingFlags.Static);
                    methodInfo.Invoke(__instance, new object[] { value });
                }

                __instance.Morale = Mathf.Clamp(modified, Main.settings.MinimumMorale, Main.settings.MaximumMorale);
                UIShipResourceNotificationManager.PostNotification(new SpriteKey(SingletonBehavior <UIAtlasManager> .Instance.GameSystemIcons, "icon_ship_morale"), GuiStringTable.GetText(3709), value, reason);
                ShipCrewManager.OnShipMoraleChanged.Trigger();
                if (__instance.GetCurrentMoraleState() == MoraleStateType.Mutinous)
                {
                    TutorialManager.STriggerTutorialsOfType(TutorialEventType.LowMorale);
                }

                /*
                 * if (GetCurrentMoraleState() == MoraleStateType.Mutinous)
                 *
                 *  if ( )
                 * {
                 *  value = minChange;
                 *  Main.Log($"Min change: {minChange}");
                 * }
                 * else if (currentMorale > maximumMorale || modified > maximumMorale)
                 * {
                 *  value = maxChange;
                 *  Main.Log($"Max change: {maxChange}");
                 * }
                 * else
                 * {
                 *  Main.Log("No change");
                 * }
                 */
                return(false);
            }
            catch (Exception ex)
            {
                Main.LogError(ex);
            }

            return(true);
        }