Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
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);
     }
 }