Esempio n. 1
0
            static bool Prefix(PlayerAutoPickTarget __instance)
            {
                if (!enabled)
                {
                    return(true);
                }

                if (Module <Player> .Self == null || Module <Player> .Self.actor == null)
                {
                    return(true);
                }


                Dbgl($"UpdatePickToTarget PlayerAutoPickTarget; pick distance: {__instance.autoPickDistance * settings.DistanceMult}, distance {Vector3.Distance(__instance.transform.position, Module<Player>.Self.GamePos + new Vector3(0f, Module<Player>.Self.actor.GetHeight() / 2f, 0f))}");

                ItemDrop       component = __instance.GetComponent <ItemDrop>();
                ItemPickFollow follow    = __instance.GetComponent <ItemPickFollow>();

                if (Vector3.Distance(__instance.transform.position, Module <Player> .Self.GamePos + new Vector3(0f, Module <Player> .Self.actor.GetHeight() / 2f, 0f)) >= __instance.autoPickDistance * settings.DistanceMult)
                {
                    return(true);
                }
                Dbgl("1");
                if (component != null && follow != null)
                {
                    Dbgl("2");
                    if (follow.CheckCanAddBag(component))
                    {
                        Dbgl("3");
                        component.FetchItem();
                        if (Module <ItemDropManager> .Self != null)
                        {
                            Module <ItemDropManager> .Self.DestroyDropItem(component);
                        }
                        return(false);
                    }
                }
                return(true);
            }