예제 #1
0
        void Update()
        {
            if (G.Settings.MiscOptions.AutoItemPickup)
            {
                Collider[] array = Physics.OverlapSphere(Player.player.transform.position, 19f, RayMasks.ITEM);
                for (int i = 0; i < array.Length; i++)
                {
                    Collider collider = array[i];
                    if (collider == null || collider.GetComponent <InteractableItem>() == null || collider.GetComponent <InteractableItem>().asset == null)
                    {
                        continue;
                    }
                    InteractableItem item = collider.GetComponent <InteractableItem>();

                    if (T.IsItemWhitelisted(item, G.Settings.MiscOptions.AIPWhitelist))
                    {
                        item.use();
                    }
                }
            }

            if (G.Settings.MiscOptions.GrabItemThroughWalls && Input.GetKeyDown(KeyCode.F))
            {
                int?fov = null;
                if (G.Settings.MiscOptions.LimitFOV)
                {
                    fov = G.Settings.MiscOptions.ItemGrabFOV;
                }
                InteractableItem i = T.GetNearestItem(fov);
                if (i != null)
                {
                    i.use();
                }
            }
        }
예제 #2
0
        private IEnumerator AutoItemPickupCoroutine()
        {
            while (true)
            {
                if (!AutoItemPickupEnabled || !Provider.isConnected || Provider.isLoading || LoadingUI.isBlocked || Player.player == null)
                {
                    yield return(new WaitForSeconds(1f));

                    continue;
                }

                Collider[] array = Physics.OverlapSphere(Camera.main.transform.position, 19f, RayMasks.ITEM);
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null && array[i].gameObject != null && array[i].GetComponent <InteractableItem>() != null && array[i].GetComponent <InteractableItem>().asset != null)
                    {
                        InteractableItem item = array[i].GetComponent <InteractableItem>();
                        bool             on   = false;
                        if (MP_ESP.ESP_Items_Types.filter.TryGetValue(item.asset.type, out on))
                        {
                            if (on)
                            {
                                if (IgnoreEmpty && item.item.amount > 0)
                                {
                                    item.use();
                                }
                                else if (!IgnoreEmpty)
                                {
                                    item.use();
                                }
                            }
                        }
                    }
                }

                yield return(new WaitForSeconds(AIP_Update / 1000));
            }
        }
        // Token: 0x060001AE RID: 430 RVA: 0x00002C14 File Offset: 0x00000E14
        public static IEnumerator PickupItems()
        {
            for (;;)
            {
                bool flag  = !DrawUtilities.ShouldRun() || !ItemOptions.AutoItemPickup;
                bool flag4 = flag;
                if (flag4)
                {
                    yield return(new WaitForSeconds(0.5f));
                }
                else
                {
                    Collider[] array = Physics.OverlapSphere(OptimizationVariables.MainPlayer.transform.position, 19f, RayMasks.ITEM);
                    int        num;
                    for (int i = 0; i < array.Length; i = num + 1)
                    {
                        Collider col   = array[i];
                        bool     flag2 = col == null || col.GetComponent <InteractableItem>() == null || col.GetComponent <InteractableItem>().asset == null;
                        bool     flag5 = !flag2;
                        if (flag5)
                        {
                            InteractableItem item  = col.GetComponent <InteractableItem>();
                            bool             flag3 = !ItemUtilities.Whitelisted(item.asset, ItemOptions.ItemFilterOptions);
                            bool             flag6 = !flag3;
                            if (flag6)
                            {
                                item.use();
                                col  = null;
                                item = null;
                            }
                            item = null;
                        }
                        num = i;
                        col = null;
                    }
                    yield return(new WaitForSeconds((float)(ItemOptions.ItemPickupDelay / 1000)));

                    array = null;
                    array = null;
                }
            }
            yield break;
        }
예제 #4
0
        public static IEnumerator PickupItems()
        {
            // #if DEBUG
            DebugUtilities.Log("Starting Item Coroutine");
            //  #endif

            while (true)
            {
                if (!DrawUtilities.ShouldRun() || !ItemOptions.AutoItemPickup)
                {
                    yield return(new WaitForSeconds(0.5f));

                    continue;
                }

                Collider[] array = Physics.OverlapSphere(OptimizationVariables.MainPlayer.transform.position, 19f, RayMasks.ITEM);

                for (int i = 0; i < array.Length; i++)
                {
                    Collider col = array[i];
                    if (col == null || col.GetComponent <InteractableItem>() == null ||
                        col.GetComponent <InteractableItem>().asset == null)
                    {
                        continue;
                    }

                    InteractableItem item = col.GetComponent <InteractableItem>();

                    if (!ItemUtilities.Whitelisted(item.asset, ItemOptions.ItemFilterOptions))
                    {
                        continue;
                    }

                    item.use();
                }

                yield return(new WaitForSeconds(ItemOptions.ItemPickupDelay / 1000));
            }
        }
예제 #5
0
 public void GrabItem(InteractableItem s)
 {
     Toolkit.SendMessageTip("Picking up: " + s.asset.itemName);
     s.use();
     LastPickup = Time.realtimeSinceStartup + 0.7f;
 }
예제 #6
0
 void Update()
 {
     if (Input.GetKeyDown(MenuGUI.instance.itemKey))
     {
         if (MenuGUI.instance.autoItemPickup == true)
         {
             MenuGUI.instance.autoItemPickup = false;
         }
         else
         {
             MenuGUI.instance.autoItemPickup = true;
         }
     }
     if (MenuGUI.instance.autoItemPickup && Provider.isConnected && !Provider.isLoading && !(Player.player == null))
     {
         Collider[] array = Physics.OverlapSphere(Camera.main.transform.position, 19f, RayMasks.ITEM);
         for (int i = 0; i < array.Length; i++)
         {
             if (array[i] != null && array[i].gameObject != null && array[i].GetComponent <InteractableItem>() != null && array[i].GetComponent <InteractableItem>().asset != null)
             {
                 InteractableItem component = array[i].GetComponent <InteractableItem>();
                 if (MenuGUI.instance.pickupAll)
                 {
                     component.use();
                 }
                 else
                 {
                     if (MenuGUI.instance.pickupGun && component.asset is ItemGunAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupBackpack && component.asset is ItemBackpackAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupAmmo && component.asset is ItemMagazineAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupAttachments && (component.asset is ItemBarrelAsset || component.asset is ItemOpticAsset))
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupClothing && component.asset is ItemClothingAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupFuel && component.asset is ItemFuelAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupMedical && component.asset is ItemMedicalAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupMelee && component.asset is ItemMeleeAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupThrowable && component.asset is ItemThrowableAsset)
                     {
                         component.use();
                     }
                     else if (MenuGUI.instance.pickupFoodWater && (component.asset is ItemFoodAsset || component.asset is ItemWaterAsset))
                     {
                         component.use();
                     }
                 }
             }
         }
     }
 }