static bool Prefix(CombatHUDFireButton __instance)
        {
            if (__instance == null || __instance.gameObject == null)
            {
                return(true);
            }

            Mod.UILog.Info?.Write($"CHUDFB - OnClick FIRED for FireMode: {__instance.CurrentFireMode}");

            bool shouldReturn = true;
            CombatHUDAttackModeSelector selector = SharedState.CombatHUD.AttackModeSelector;

            if (__instance.gameObject.name == ModConsts.ChargeFB_GO_ID)
            {
                MeleeState meleeState = ModState.GetMeleeState(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    SharedState.CombatHUD.SelectionHandler.ActiveState.PreviewPos);
                ModState.AddOrUpdateSelectedAttack(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    meleeState.Charge
                    );
                Mod.UILog.Info?.Write("User selected Charge button");
                shouldReturn = false;
            }
            else if (__instance.gameObject.name == ModConsts.KickFB_GO_ID)
            {
                MeleeState meleeState = ModState.GetMeleeState(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    SharedState.CombatHUD.SelectionHandler.ActiveState.PreviewPos);
                ModState.AddOrUpdateSelectedAttack(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    meleeState.Kick
                    );
                Mod.UILog.Info?.Write("User selected Kick button");
                shouldReturn = false;
            }
            else if (__instance.gameObject.name == ModConsts.PhysicalWeaponFB_GO_ID)
            {
                MeleeState meleeState = ModState.GetMeleeState(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    SharedState.CombatHUD.SelectionHandler.ActiveState.PreviewPos);
                ModState.AddOrUpdateSelectedAttack(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    meleeState.PhysicalWeapon
                    );
                Mod.UILog.Info?.Write("User selected PhysWeap button");
                shouldReturn = false;
            }
            else if (__instance.gameObject.name == ModConsts.PunchFB_GO_ID)
            {
                MeleeState meleeState = ModState.GetMeleeState(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    SharedState.CombatHUD.SelectionHandler.ActiveState.PreviewPos);
                ModState.AddOrUpdateSelectedAttack(
                    SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                    meleeState.Punch
                    );
                Mod.UILog.Info?.Write("User selected Punch button");
                shouldReturn = false;
            }
            else
            {
                MeleeAttack selectedAttack2 = ModState.GetSelectedAttack(SharedState.CombatHUD?.SelectionHandler?.ActiveState?.SelectedActor);
                if (selectedAttack2 != null)
                {
                    Mod.UILog.Info?.Write("OnClick from generic CHUDFB with selected type, short-cutting to action.");

                    // Disable the buttons to prevent accidental clicks?
                    if (selectedAttack2 is ChargeAttack)
                    {
                        ModState.ChargeFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }
                    if (selectedAttack2 is KickAttack)
                    {
                        ModState.KickFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }
                    if (selectedAttack2 is WeaponAttack)
                    {
                        ModState.PhysicalWeaponFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }
                    if (selectedAttack2 is PunchAttack)
                    {
                        ModState.PunchFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }

                    return(true);
                }
            }

            MeleeAttack selectedAttack = ModState.GetSelectedAttack(SharedState.CombatHUD?.SelectionHandler?.ActiveState?.SelectedActor);

            if (selectedAttack != null)
            {
                Mod.UILog.Debug?.Write("Enabling description container for melee attack");
                selector.DescriptionContainer.SetActive(true);
                selector.DescriptionContainer.gameObject.SetActive(true);

                HashSet <string> descriptonNotes = selectedAttack.DescriptionNotes;
                string           description     = String.Join(", ", descriptonNotes);
                Mod.UILog.Debug?.Write($"Aggregate description is: {description}");

                selector.DescriptionText.SetText(description);
                selector.DescriptionText.ForceMeshUpdate(true);

                // TODO: Update weapon damage instead?

                // Update the weapon strings
                SharedState.CombatHUD.WeaponPanel.RefreshDisplayedWeapons();
            }

            return(shouldReturn);
        }
        static void Postfix(CombatHUDAttackModeSelector __instance, CombatHUDFireButton.FireMode mode,
                            ref string additionalDetails, bool showHeatWarnings)
        {
            try
            {
                // Disable the melee container if there's no active state
                if (SharedState.CombatHUD?.SelectionHandler?.ActiveState == null ||
                    SharedState.CombatHUD?.SelectionHandler?.ActiveState?.SelectedActor == null ||
                    SharedState.CombatHUD?.SelectionHandler?.ActiveState?.PreviewPos == null)
                {
                    Mod.UILog.Trace?.Write($"Disabling all CHUD_Fire_Buttons");
                    ModState.MeleeAttackContainer.SetActive(false);
                    return;
                }

                Mod.UILog.Trace?.Write($"ShowFireButton called with mode: {mode}");

                if (mode == CombatHUDFireButton.FireMode.Engage)
                {
                    Mod.UILog.Trace?.Write($"Enabling all CHUD_Fire_Buttons");
                    ModState.MeleeAttackContainer.SetActive(true);

                    MeleeState meleeState = ModState.GetMeleeState(
                        SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                        SharedState.CombatHUD.SelectionHandler.ActiveState.PreviewPos);

                    // Toggle each button by available state
                    ToggleStateButtons(meleeState);

                    // Autoselect best option
                    MeleeAttack autoselectedAttack = meleeState.GetHighestDamageAttackForUI();
                    if (autoselectedAttack != null)
                    {
                        Mod.UILog.Info?.Write($"Autoselecting state of type: '{autoselectedAttack.Label}' as most damaging.");
                    }
                    else
                    {
                        Mod.UILog.Info?.Write("No highest damaging state - no melee options!");
                    }

                    // Final check - if everything is disabled, disable the button
                    bool hasValidAttack = meleeState.Charge.IsValid || meleeState.Kick.IsValid ||
                                          meleeState.PhysicalWeapon.IsValid || meleeState.Punch.IsValid;
                    if (!hasValidAttack)
                    {
                        Mod.UILog.Info?.Write("NO VALID MELEE ATTACKS, DISABLING!");
                        __instance.FireButton.SetState(ButtonState.Disabled);
                        __instance.FireButton.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                        __instance.DescriptionContainer.SetActive(false);
                        SharedState.CombatHUD.SelectionHandler.ActiveState.BackOut();
                        __instance.ForceRefreshImmediate();
                    }
                    else
                    {
                        Mod.UILog.Info?.Write($" CHECKING FOR VALID ATTACKS: hasValidAttack=>{hasValidAttack}" +
                                              $"  charge=>{meleeState.Charge.IsValid}" +
                                              $"  kick=>{meleeState.Kick.IsValid}" +
                                              $"  punch=>{meleeState.Punch.IsValid}" +
                                              $"  weapon=>{meleeState.PhysicalWeapon.IsValid}" +
                                              $"");
                    }
                }
                else
                {
                    Mod.UILog.Trace?.Write($"Disabling all CHUD_Fire_Buttons");
                    ModState.MeleeAttackContainer.SetActive(false);
                    if (ModState.ChargeFB != null)
                    {
                        ModState.ChargeFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }
                    if (ModState.KickFB != null)
                    {
                        ModState.KickFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }
                    if (ModState.PhysicalWeaponFB != null)
                    {
                        ModState.PhysicalWeaponFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }
                    if (ModState.PunchFB != null)
                    {
                        ModState.PunchFB.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                    }

                    ModState.InvalidateState(SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor);
                }

                // Handle the DFA button here
                if (mode == CombatHUDFireButton.FireMode.DFA)
                {
                    MeleeState meleeState = ModState.GetMeleeState(
                        SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                        SharedState.CombatHUD.SelectionHandler.ActiveState.PreviewPos);

                    // Check for valid attack
                    if (!meleeState.DFA.IsValid)
                    {
                        Mod.UILog.Info?.Write($"DFA attack failed validation, disabling button.");
                        __instance.FireButton.SetState(ButtonState.Disabled);
                        __instance.FireButton.CurrentFireMode = CombatHUDFireButton.FireMode.None;
                        __instance.DescriptionContainer.SetActive(false);
                        SharedState.CombatHUD.SelectionHandler.ActiveState.BackOut();
                        __instance.ForceRefreshImmediate();
                    }

                    HashSet <string> descriptonNotes = meleeState.DFA.DescriptionNotes;
                    additionalDetails = String.Join(", ", descriptonNotes);
                    Mod.UILog.Info?.Write($"Aggregate description is: {additionalDetails}");

                    // Select state here as a click will validate
                    ModState.AddOrUpdateSelectedAttack(
                        SharedState.CombatHUD.SelectionHandler.ActiveState.SelectedActor,
                        meleeState.DFA
                        );
                }
            }
            catch (Exception e)
            {
                Mod.Log.Warn?.Write(e, "Failed to update the CombatButton states - warn Frost!");
            }
        }