예제 #1
0
 static bool Prefix(UnitViewHandsEquipment __instance)
 {
     Main.Logger?.Append("StartCombatChangeAnimation triggered.");
     Main.Logger?.Append($" - Standard action cooldown: {__instance.Owner.CombatState.Cooldown.StandardAction}");
     Main.Logger?.Flush();
     return(true);
 }
예제 #2
0
 static bool Prefix(UnitViewHandsEquipment __instance)
 {
     Main.Logger?.Append("UpdateActiveWeaponSetImmediately triggered.");
     Main.Logger?.Append($" - Standard action cooldown: {__instance.Owner.CombatState.Cooldown.StandardAction}");
     Main.Logger?.Flush();
     return(true);
 }
예제 #3
0
 static void Postfix(UnitViewHandsEquipment __instance, ref WeaponAnimationStyle __result)
 {
     if (__instance.ActiveMainHandWeaponStyle != WeaponAnimationStyle.Fist && __result == WeaponAnimationStyle.Fist)
     {
         __result = WeaponAnimationStyle.None;
     }
 }
 static void Postfix(UnitViewHandsEquipment __instance)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         Settings.CharacterSettings characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (characterSettings.hideWeapons)
         {
             foreach (var kv in __instance.Sets)
             {
                 if (kv.Key.PrimaryHand.Active)
                 {
                     continue;
                 }
                 kv.Value.MainHand.ShowItem(false);
                 kv.Value.OffHand.ShowItem(false);
             }
         }
     }
     catch (Exception ex)
     {
         Main.Error(ex);
     }
 }
예제 #5
0
 static void Postfix(UnitViewHandsEquipment __instance)
 {
     Main.Logger?.Append("StartCombatChangeAnimation done.");
     Main.Logger?.Append($" - Standard action cooldown: {__instance.Owner.CombatState.Cooldown.StandardAction}");
     Main.Logger?.Append(" - note: this method starts a coroutine, so cooldown might be changed after method finish.");
     Main.Logger?.Flush();
 }
예제 #6
0
        static bool Prefix(UnitViewHandsEquipment __instance)
        {
            var tr = Harmony12.Traverse.Create(__instance);

            if (UnitBody__SetEmptyHandWeapon__Patch.no_animation_action)
            {
                tr.Method("ChangeEquipmentWithoutAnimation").GetValue();
                return(false);
            }

            return(true);
        }
        static bool Prefix(UnitViewHandsEquipment __instance)
        {
            if (!(bool)unitViewHandsEquipment_get_Active(__instance))
            {
                return(true);
            }

            if (__instance.Owner.IsFreeEquipmentChange() && __instance.InCombat && (__instance.Owner.Descriptor.State.CanAct || __instance.IsDollRoom))
            {
                MethodInfo updateImmediately = __instance.GetType().GetMethod("UpdateActiveWeaponSetImmediately", BindingFlags.NonPublic | BindingFlags.Instance);
                updateImmediately.Invoke(__instance, new object[0]);
                return(false);
            }

            return(true);
        }
 static bool Prefix(UnitViewHandSlotData __instance, UnitViewHandsEquipment ___m_Equipment)
 {
     try
     {
         if (!Main.enabled)
         {
             return(true);
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return(true);
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return(true);
         }
         if (!HasQuiver(__instance))
         {
             return(true);
         }
         if (characterSettings.hideQuiver)
         {
             UnitViewHandSlotData unitViewHandSlotData = ___m_Equipment.QuiverHandSlot;
             if (unitViewHandSlotData == null)
             {
                 return(true);
             }
             if (unitViewHandSlotData == __instance)
             {
                 return(false);
             }
             if (unitViewHandSlotData.IsActiveSet || unitViewHandSlotData.SheathVisualModel == null || !HasQuiver(unitViewHandSlotData))
             {
                 DestroySheathModelInvoker(unitViewHandSlotData);
                 unitViewHandSlotData = null;
             }
             return(false);
         }
     }
     catch (Exception ex)
     {
         Main.Error(ex);
     }
     return(true);
 }
예제 #9
0
        static bool Prefix(UnitViewHandsEquipment __instance)
        {
            var tr = Harmony12.Traverse.Create(__instance);

            if (!tr.Property("Active").GetValue <bool>())
            {
                return(true);
            }

            if (__instance.Owner.Ensure <UnitPartQuickDraw>().active() &&
                __instance.InCombat && (__instance.Owner.Descriptor.State.CanAct || __instance.IsDollRoom))
            {
                tr.Method("ChangeEquipmentWithoutAnimation").GetValue();
                return(false);
            }

            return(true);
        }
        static bool Prefix(UnitViewHandsEquipment __instance, HandSlot slot, ItemEntity previousItem)
        {
            MethodInfo           getHandSlotMethod = __instance.GetType().GetMethod("GetSlotData", BindingFlags.NonPublic | BindingFlags.Instance);
            UnitViewHandSlotData slotDataCheck     = (UnitViewHandSlotData)getHandSlotMethod.Invoke(__instance, new object[] { slot });

            if (!(bool)unitViewHandsEquipment_get_Active(__instance) || slotDataCheck == null)
            {
                return(true);
            }

            if (__instance.Owner.IsFreeEquipmentChange() && __instance.InCombat && (__instance.Owner.Descriptor.State.CanAct || __instance.IsDollRoom) && slot.Active)
            {
                MethodInfo changeEquipmentWithoutAnimation = __instance.GetType().GetMethod("ChangeEquipmentWithoutAnimation", BindingFlags.NonPublic | BindingFlags.Instance);
                changeEquipmentWithoutAnimation.Invoke(__instance, new object[0]);
                return(false);
            }

            return(true);
        }
        static bool Prefix(UnitViewHandsEquipment __instance, HandSlot slot, ItemEntity previousItem)
        {
            var tr = Harmony12.Traverse.Create(__instance);

            if (!tr.Property("Active").GetValue <bool>() || tr.Method("GetSlotData", slot).GetValue <UnitViewHandSlotData>() == null)
            {
                return(true);
            }


            if (Helpers.isSummoned(slot.MaybeWeapon) || Helpers.isSummoned(previousItem) &&
                __instance.InCombat && (__instance.Owner.Descriptor.State.CanAct || __instance.IsDollRoom) && slot.Active)
            {
                tr.Method("ChangeEquipmentWithoutAnimation").GetValue();
                return(false);
            }

            return(true);
        }
예제 #12
0
 static void Postfix(DollRoom __instance, UnitViewHandsEquipment ___m_AvatarHands, UnitEntityData ___m_Unit)
 {
     try
     {
         if (___m_Unit == null)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(___m_Unit);
         if (characterSettings == null)
         {
             return;
         }
         foreach (var isOffhand in new bool[] { true, false })
         {
             WeaponParticlesSnapMap weaponParticlesSnapMap = ___m_AvatarHands?.GetWeaponModel(isOffhand)?.GetComponent <WeaponParticlesSnapMap>();
             if (weaponParticlesSnapMap)
             {
                 UnityEngine.Object x = weaponParticlesSnapMap;
                 UnityEngine.Object y = isOffhand ?
                                        ___m_Unit?.Body?.SecondaryHand.FxSnapMap :
                                        ___m_Unit?.Body?.PrimaryHand.FxSnapMap;
                 if (x == y)
                 {
                     var weapon = isOffhand ?
                                  ___m_Unit?.Body?.SecondaryHand?.MaybeItem :
                                  ___m_Unit?.Body?.PrimaryHand?.MaybeItem;
                     WeaponEnchantments.TryGetValue(weapon, out List <GameObject> fxObjects);
                     if (fxObjects != null)
                     {
                         foreach (var fxObject in fxObjects)
                         {
                             UnscaleFxTimes(__instance, fxObject);
                         }
                     }
                 }
             }
         }
     } catch (Exception ex)
     {
         Main.DebugError(ex);
     }
 }
 static void Postfix(UnitViewHandsEquipment __instance, GameObject[] ___m_ConsumableSlots)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         Settings.CharacterSettings characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (characterSettings.hideBeltSlots)
         {
             foreach (var go in ___m_ConsumableSlots)
             {
                 go?.SetActive(false);
             }
         }
         if (characterSettings.overrideScale && !__instance.Character.PeacefulMode)
         {
             foreach (var go in ___m_ConsumableSlots)
             {
                 if (go == null)
                 {
                     continue;
                 }
                 go.transform.localScale *= ViewManager.GetRealSizeScale(__instance.Owner.View, characterSettings);
             }
         }
     }
     catch (Exception ex)
     {
         Main.Error(ex);
     }
 }
예제 #14
0
 static void Postfix(UnitViewHandsEquipment __instance)
 {
     Main.Logger?.Append("UpdateActiveWeaponSetImmediately done.");
     Main.Logger?.Append($" - Standard action cooldown: {__instance.Owner.CombatState.Cooldown.StandardAction}");
     Main.Logger?.Flush();
 }
예제 #15
0
 static bool Prefix(UnitViewHandsEquipment __instance)
 {
     Main.Logger?.Write("ChangeEquipmentWithoutAnimation triggered...");
     return(true);
 }
예제 #16
0
 static void Postfix(UnitViewHandsEquipment __instance)
 {
     Main.Logger?.Write("ChangeEquipmentWithoutAnimation finished...");
 }
예제 #17
0
 static void Postfix(UnitViewHandSlotData __instance, bool isVisible, ref List <ItemEnchantment> ___m_VisibleEnchantments, UnitViewHandsEquipment ___m_Equipment)
 {
     try {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (__instance.Slot.MaybeItem == null)
         {
             return;
         }
         if (WeaponEnchantments.ContainsKey(__instance.Slot.MaybeItem))
         {
             foreach (var fxObject in WeaponEnchantments[__instance.Slot.MaybeItem])
             {
                 DestroyFx(fxObject);
             }
             WeaponEnchantments[__instance.Slot.MaybeItem].Clear();
         }
         if (__instance.IsInHand && isVisible)
         {
             if (!WeaponEnchantments.ContainsKey(__instance.Slot.MaybeItem))
             {
                 WeaponEnchantments[__instance.Slot.MaybeItem] = new List <GameObject>();
             }
             var enchantments = __instance.IsOff ?
                                characterSettings.overrideOffhandWeaponEnchantments :
                                characterSettings.overrideMainWeaponEnchantments;
             foreach (var enchantmentId in enchantments)
             {
                 var blueprint = ResourcesLibrary.TryGetBlueprint <BlueprintWeaponEnchantment>(enchantmentId);
                 if (blueprint == null || blueprint.WeaponFxPrefab == null)
                 {
                     continue;
                 }
                 var fxObject = RespawnFx(blueprint.WeaponFxPrefab, __instance.Slot.MaybeItem);
                 WeaponEnchantments[__instance.Slot.MaybeItem].Add(fxObject);
             }
         }
     } catch (Exception ex)
     {
         Main.DebugError(ex);
     }
 }
예제 #18
0
 static void Postfix(UnitViewHandSlotData __instance, ref List <ItemEnchantment> ___m_VisibleEnchantments, UnitViewHandsEquipment ___m_Equipment)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (__instance.Slot.MaybeItem == null)
         {
             return;
         }
         if (!WeaponEnchantments.ContainsKey(__instance.Slot.MaybeItem))
         {
             return;
         }
         foreach (var fxObject in WeaponEnchantments[__instance.Slot.MaybeItem])
         {
             DestroyFx(fxObject);
         }
         WeaponEnchantments[__instance.Slot.MaybeItem].Clear();
         WeaponEnchantments.Remove(__instance.Slot.MaybeItem);
     } catch (Exception ex)
     {
         Main.DebugError(ex);
     }
 }
예제 #19
0
 static void Postfix(UnitViewHandSlotData __instance, ref List <ItemEnchantment> ___m_VisibleEnchantments, UnitViewHandsEquipment ___m_Equipment)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (__instance.Slot.MaybeItem == null)
         {
             return;
         }
         if (characterSettings.hideWeaponEnchantments)
         {
             ___m_VisibleEnchantments.Clear();
         }
     }
     catch (Exception ex)
     {
         Main.DebugError(ex);
     }
 }