static void Postfix(UnitViewHandSlotData __instance, ref float __result)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (!characterSettings.overrideScale)
         {
             return;
         }
         var realScale = ViewManager.GetRealSizeScale(__instance.Owner.View, characterSettings);
     }
     catch (Exception ex)
     {
         Main.Error(ex);
     }
 }
 static void Postfix(UnitViewHandSlotData __instance)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (characterSettings.hideWeapons)
         {
             if (!__instance.IsActiveSet)
             {
                 __instance.ShowItem(false);
             }
         }
     }
     catch (Exception ex)
     {
         Main.Error(ex);
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
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);
     }
 }
            static bool HasQuiver(UnitViewHandSlotData slotData)
            {
                if (slotData.VisibleItem == null)
                {
                    return(false);
                }
                var blueprint = slotData.VisibleItem.Blueprint as BlueprintItemEquipmentHand;

                if (blueprint == null)
                {
                    return(false);
                }
                return(blueprint.VisualParameters.HasQuiver);
            }
 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);
 }
        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 void Postfix(UnitViewHandSlotData __instance, ref BlueprintItemEquipmentHand __result)
 {
     try
     {
         if (!Main.enabled)
         {
             return;
         }
         if (!__instance.Owner.IsPlayerFaction)
         {
             return;
         }
         var characterSettings = Main.settings.GetCharacterSettings(__instance.Owner);
         if (characterSettings == null)
         {
             return;
         }
         if (__instance.VisibleItem == null)
         {
             return;
         }
         var blueprint      = __instance.VisibleItem.Blueprint as BlueprintItemEquipmentHand;
         var animationStyle = blueprint.VisualParameters.AnimStyle.ToString();
         characterSettings.overrideWeapons.TryGetValue(animationStyle, out BlueprintRef blueprintId);
         if (blueprintId == null || blueprintId == "")
         {
             return;
         }
         var newBlueprint = ResourcesLibrary.TryGetBlueprint <BlueprintItemEquipmentHand>(blueprintId);
         if (newBlueprint == null)
         {
             return;
         }
         __result = newBlueprint;
     }
     catch (Exception ex)
     {
         Main.Error(ex);
     }
 }
        static void ShowUnitViewHandSlotData(UnitViewHandSlotData handData)
        {
            var ownerScale     = handData.Owner.View.GetSizeScale() * Game.Instance.BlueprintRoot.WeaponModelSizing.GetCoeff(handData.Owner.Descriptor.OriginalSize);
            var visualScale    = handData.VisualModel?.transform.localScale ?? Vector3.zero;
            var visualPosition = handData.VisualModel?.transform.localPosition ?? Vector3.zero;
            var sheathScale    = handData.SheathVisualModel?.transform.localScale ?? Vector3.zero;
            var sheathPosition = handData.SheathVisualModel?.transform.localPosition ?? Vector3.zero;

            GUILayout.Label(string.Format($"weapon {ownerScale:0.#}, scale {visualScale} position {visualPosition}"), GUILayout.Width(500));
            GUILayout.Label(string.Format($"sheath {ownerScale:0.#}, scale {sheathScale} position {sheathPosition}"), GUILayout.Width(500));
            GUILayout.BeginHorizontal();
            GUILayout.Label(string.Format("Data {0} Slot {1} Active {2}", handData?.VisibleItem?.Name, handData?.VisualSlot, handData?.IsActiveSet), GUILayout.Width(500));

            if (GUILayout.Button("Unequip", GUILayout.Width(200f)))
            {
                handData.Unequip();
            }
            if (GUILayout.Button("Swap Slot", GUILayout.Width(200f)))
            {
                handData.VisualSlot += 1;
                if (handData.VisualSlot == UnitEquipmentVisualSlotType.Quiver)
                {
                    handData.VisualSlot = 0;
                }
                handData.Owner.View.HandsEquipment.UpdateAll();
            }
            if (GUILayout.Button("ShowItem 0", GUILayout.Width(200f)))
            {
                handData.ShowItem(false);
            }
            if (GUILayout.Button("ShowItem 1", GUILayout.Width(200f)))
            {
                handData.ShowItem(true);
            }
            GUILayout.EndHorizontal();
        }
Exemplo n.º 10
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);
     }
 }