Exemplo n.º 1
0
        public static bool CanLoot(this HarvestableObject obj, LocalPlayerCharacterView localPlayer)
        {
            if (!obj.IsHarvestable())
            {
                return(false);
            }

            bool requiresTool       = obj.RequiresTool();
            EquipmentItemProxy tool = obj.GetTool(localPlayer);

            if (requiresTool && !tool)
            {
                return(false);
            }

            //TODO: Implement converters
            GuiDurableItemProxy toolProxy = ClientTools.GetStackProxy(tool).GuiItemProxy_Internal as a9h;

            int durability = toolProxy ? ClientTools.SomeCalculationWithUnfloatyFloats(tool.GetUnfloatyFloat(), toolProxy.GetUnfloatyFloat()) : -1;

            if (requiresTool && durability <= 10)
            {
                return(false);
            }

            return(true);
        }