440 lines
13 KiB
Lua
440 lines
13 KiB
Lua
-- Ultra Fast Harvest System
|
|
-- ระบบเก็บของแบบเร็วที่สุด
|
|
|
|
print("⚡ Loading Ultra Fast Harvest System...")
|
|
|
|
-- Services
|
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
local Players = game:GetService("Players")
|
|
local RunService = game:GetService("RunService")
|
|
local TweenService = game:GetService("TweenService")
|
|
|
|
local LocalPlayer = Players.LocalPlayer
|
|
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
|
|
local Leaderstats = LocalPlayer:WaitForChild("leaderstats")
|
|
local Backpack = LocalPlayer:WaitForChild("Backpack")
|
|
|
|
-- Ultra Fast Settings
|
|
local UltraSettings = {
|
|
-- Harvest Settings
|
|
MaxHarvestPerSecond = 50, -- เก็บสูงสุดต่อวินาที
|
|
HarvestDelay = 0.001, -- ดีเลย์น้อยที่สุด
|
|
BatchSize = 25, -- ขนาดชุด
|
|
UseThreading = true,
|
|
MaxThreads = 8,
|
|
|
|
-- Inventory Settings
|
|
MaxInventorySlots = 200,
|
|
SellThreshold = 80, -- ขายเมื่อเหลือ 80%
|
|
SmartInventory = true,
|
|
|
|
-- Performance Settings
|
|
UseCache = true,
|
|
CacheDuration = 0.05,
|
|
OptimizeMovement = true,
|
|
|
|
-- Harvest Filter
|
|
HarvestGolden = true,
|
|
HarvestSpecial = false,
|
|
HarvestNormal = true
|
|
}
|
|
|
|
-- Performance Variables
|
|
local HarvestCache = {}
|
|
local LastCacheTime = 0
|
|
local IsHarvesting = false
|
|
local HarvestThreads = {}
|
|
|
|
-- Game Objects
|
|
local GameEvents = ReplicatedStorage:WaitForChild("GameEvents")
|
|
local Farms = workspace:WaitForChild("Farm")
|
|
|
|
-- Find Player's Farm
|
|
local function GetFarm(PlayerName)
|
|
local AllFarms = Farms:GetChildren()
|
|
for _, Farm in pairs(AllFarms) do
|
|
local Important = Farm:FindFirstChild("Important")
|
|
if Important then
|
|
local Data = Important:FindFirstChild("Data")
|
|
if Data then
|
|
local Owner = Data:FindFirstChild("Owner")
|
|
if Owner and Owner.Value == PlayerName then
|
|
return Farm
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
|
|
local MyFarm = GetFarm(LocalPlayer.Name)
|
|
if not MyFarm then
|
|
warn("❌ Cannot find player's farm!")
|
|
return
|
|
end
|
|
|
|
local MyImportant = MyFarm:FindFirstChild("Important")
|
|
local PlantsPhysical = MyImportant:FindFirstChild("Plants_Physical")
|
|
|
|
-- Ultra Fast Harvest Functions
|
|
local function ShouldHarvestPlant(Plant)
|
|
local plantName = Plant.Name:lower()
|
|
|
|
-- Check for special effects
|
|
local specialEffects = {
|
|
"shocked", "moonlit", "twisted", "burnt", "frozen", "wet",
|
|
"bloodlit", "zombified", "celestial", "disco", "plasma",
|
|
"voidtouched", "honeyglazed", "pollinated", "chilled",
|
|
"radiant", "aurora", "crystal", "shadow", "ethereal"
|
|
}
|
|
|
|
local hasSpecialEffect = false
|
|
for _, effect in pairs(specialEffects) do
|
|
if plantName:find(effect) then
|
|
hasSpecialEffect = true
|
|
break
|
|
end
|
|
end
|
|
|
|
local isGolden = plantName:find("golden") or plantName:find("gold")
|
|
|
|
-- Check from model properties
|
|
if Plant:IsA("Model") and Plant.PrimaryPart then
|
|
local primaryPart = Plant.PrimaryPart
|
|
if primaryPart.Color == Color3.new(1, 0.8, 0) or
|
|
primaryPart.Color == Color3.fromRGB(255, 215, 0) then
|
|
isGolden = true
|
|
end
|
|
|
|
if primaryPart:FindFirstChild("PointLight") or
|
|
primaryPart:FindFirstChild("SpotLight") or
|
|
primaryPart:FindFirstChild("SurfaceLight") then
|
|
hasSpecialEffect = true
|
|
end
|
|
end
|
|
|
|
-- Apply filters
|
|
if hasSpecialEffect and not UltraSettings.HarvestSpecial then
|
|
return false
|
|
end
|
|
|
|
if isGolden and not UltraSettings.HarvestGolden then
|
|
return false
|
|
end
|
|
|
|
if not isGolden and not hasSpecialEffect and not UltraSettings.HarvestNormal then
|
|
return false
|
|
end
|
|
|
|
return true
|
|
end
|
|
|
|
-- Ultra Fast Get Harvestable Plants
|
|
local function GetHarvestablePlants()
|
|
local currentTime = tick()
|
|
|
|
-- Use cache if available
|
|
if UltraSettings.UseCache and (currentTime - LastCacheTime) < UltraSettings.CacheDuration then
|
|
return HarvestCache
|
|
end
|
|
|
|
local Plants = {}
|
|
|
|
local function CollectHarvestable(Parent)
|
|
for _, Plant in pairs(Parent:GetChildren()) do
|
|
if #Plants >= UltraSettings.MaxHarvestPerSecond then
|
|
break
|
|
end
|
|
|
|
local Fruits = Plant:FindFirstChild("Fruits")
|
|
if Fruits then
|
|
CollectHarvestable(Fruits)
|
|
end
|
|
|
|
local Prompt = Plant:FindFirstChild("ProximityPrompt", true)
|
|
if Prompt and Prompt.Enabled and ShouldHarvestPlant(Plant) then
|
|
table.insert(Plants, Plant)
|
|
end
|
|
end
|
|
end
|
|
|
|
CollectHarvestable(PlantsPhysical)
|
|
|
|
-- Update cache
|
|
HarvestCache = Plants
|
|
LastCacheTime = currentTime
|
|
|
|
return Plants
|
|
end
|
|
|
|
-- Ultra Fast Harvest Plant
|
|
local function HarvestPlant(Plant)
|
|
local Prompt = Plant:FindFirstChild("ProximityPrompt", true)
|
|
if Prompt and Prompt.Enabled then
|
|
fireproximityprompt(Prompt)
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- Batch Harvest Function
|
|
local function BatchHarvestPlants(Plants, startIndex, endIndex)
|
|
local harvested = 0
|
|
for i = startIndex, endIndex do
|
|
if Plants[i] then
|
|
if HarvestPlant(Plants[i]) then
|
|
harvested = harvested + 1
|
|
end
|
|
end
|
|
end
|
|
return harvested
|
|
end
|
|
|
|
-- Get Inventory Count
|
|
local function GetTotalInventoryCount()
|
|
local totalCount = 0
|
|
local Character = LocalPlayer.Character
|
|
|
|
local function CountFromParent(Parent)
|
|
for _, Tool in pairs(Parent:GetChildren()) do
|
|
if Tool:IsA("Tool") then
|
|
totalCount = totalCount + 1
|
|
end
|
|
end
|
|
end
|
|
|
|
CountFromParent(Backpack)
|
|
if Character then
|
|
CountFromParent(Character)
|
|
end
|
|
|
|
return totalCount
|
|
end
|
|
|
|
-- Smart Inventory Management
|
|
local function ShouldSell()
|
|
local totalItems = GetTotalInventoryCount()
|
|
return totalItems >= (UltraSettings.MaxInventorySlots * UltraSettings.SellThreshold / 100)
|
|
end
|
|
|
|
-- Ultra Fast Sell
|
|
local IsSelling = false
|
|
local function SellInventory()
|
|
if IsSelling then return end
|
|
IsSelling = true
|
|
|
|
local Character = LocalPlayer.Character
|
|
if not Character then
|
|
IsSelling = false
|
|
return
|
|
end
|
|
|
|
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
|
|
if not HumanoidRootPart then
|
|
IsSelling = false
|
|
return
|
|
end
|
|
|
|
local Previous = HumanoidRootPart.CFrame
|
|
local ShecklesCount = Leaderstats:FindFirstChild("Sheckles")
|
|
|
|
-- Ultra fast teleport
|
|
HumanoidRootPart.CFrame = CFrame.new(62, 4, -26)
|
|
wait(0.1)
|
|
|
|
if ShecklesCount then
|
|
local PreviousSheckles = ShecklesCount.Value
|
|
|
|
local SellEvent = GameEvents:FindFirstChild("Sell_Inventory")
|
|
if SellEvent then
|
|
local attempts = 0
|
|
while attempts < 3 do
|
|
if ShecklesCount.Value ~= PreviousSheckles then break end
|
|
SellEvent:FireServer()
|
|
wait(0.05)
|
|
attempts = attempts + 1
|
|
end
|
|
print("💰 ขายได้เงิน " .. (ShecklesCount.Value - PreviousSheckles) .. " sheckles")
|
|
end
|
|
end
|
|
|
|
HumanoidRootPart.CFrame = Previous
|
|
wait(0.05)
|
|
IsSelling = false
|
|
end
|
|
|
|
-- Ultra Fast Harvest Loop
|
|
local function UltraFastHarvestLoop()
|
|
if IsSelling then return end
|
|
|
|
local currentCount = GetTotalInventoryCount()
|
|
if currentCount >= UltraSettings.MaxInventorySlots then
|
|
if ShouldSell() then
|
|
SellInventory()
|
|
end
|
|
return
|
|
end
|
|
|
|
local Plants = GetHarvestablePlants()
|
|
if #Plants == 0 then return end
|
|
|
|
local availableSlots = UltraSettings.MaxInventorySlots - currentCount
|
|
local maxHarvest = math.min(#Plants, availableSlots, UltraSettings.MaxHarvestPerSecond)
|
|
|
|
if UltraSettings.UseThreading then
|
|
-- Multi-threaded harvesting
|
|
local threads = {}
|
|
local batchSize = math.ceil(maxHarvest / UltraSettings.MaxThreads)
|
|
|
|
for i = 1, UltraSettings.MaxThreads do
|
|
local startIndex = (i - 1) * batchSize + 1
|
|
local endIndex = math.min(i * batchSize, maxHarvest)
|
|
|
|
if startIndex <= endIndex then
|
|
local thread = spawn(function()
|
|
return BatchHarvestPlants(Plants, startIndex, endIndex)
|
|
end)
|
|
table.insert(threads, thread)
|
|
end
|
|
end
|
|
|
|
-- Wait for completion
|
|
local totalHarvested = 0
|
|
for _, thread in pairs(threads) do
|
|
totalHarvested = totalHarvested + (thread or 0)
|
|
end
|
|
|
|
if totalHarvested > 0 then
|
|
print("⚡ Ultra Fast Harvest: " .. totalHarvested .. " ต้น")
|
|
end
|
|
|
|
else
|
|
-- Sequential ultra fast harvesting
|
|
local harvested = 0
|
|
for i = 1, maxHarvest do
|
|
if HarvestPlant(Plants[i]) then
|
|
harvested = harvested + 1
|
|
end
|
|
wait(UltraSettings.HarvestDelay)
|
|
end
|
|
|
|
if harvested > 0 then
|
|
print("⚡ Ultra Fast Harvest: " .. harvested .. " ต้น")
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Main Loop
|
|
local function StartUltraFastLoop()
|
|
print("⚡ Starting Ultra Fast Harvest Loop...")
|
|
|
|
spawn(function()
|
|
while true do
|
|
local success, err = pcall(UltraFastHarvestLoop)
|
|
if not success then
|
|
print("⚠️ Ultra Fast Harvest error: " .. tostring(err))
|
|
end
|
|
wait(0.05) -- เร็วมาก
|
|
end
|
|
end)
|
|
|
|
print("✅ Ultra Fast Harvest Loop started")
|
|
end
|
|
|
|
-- Simple UI
|
|
local function CreateUltraFastUI()
|
|
print("🎨 Creating Ultra Fast UI...")
|
|
|
|
local ScreenGui = Instance.new("ScreenGui")
|
|
ScreenGui.Name = "UltraFastHarvestUI"
|
|
ScreenGui.Parent = PlayerGui
|
|
ScreenGui.ResetOnSpawn = false
|
|
|
|
local MainFrame = Instance.new("Frame")
|
|
MainFrame.Name = "MainFrame"
|
|
MainFrame.Parent = ScreenGui
|
|
MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
|
|
MainFrame.BorderSizePixel = 0
|
|
MainFrame.Position = UDim2.new(0, 400, 0, 50)
|
|
MainFrame.Size = UDim2.new(0, 250, 0, 200)
|
|
MainFrame.Active = true
|
|
MainFrame.Draggable = true
|
|
|
|
local Corner = Instance.new("UICorner")
|
|
Corner.CornerRadius = UDim.new(0, 12)
|
|
Corner.Parent = MainFrame
|
|
|
|
local Stroke = Instance.new("UIStroke")
|
|
Stroke.Parent = MainFrame
|
|
Stroke.Color = Color3.fromRGB(255, 100, 100)
|
|
Stroke.Thickness = 2
|
|
|
|
-- Title
|
|
local Title = Instance.new("TextLabel")
|
|
Title.Parent = MainFrame
|
|
Title.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
|
|
Title.BorderSizePixel = 0
|
|
Title.Size = UDim2.new(1, 0, 0, 40)
|
|
Title.Font = Enum.Font.SourceSansBold
|
|
Title.Text = "⚡ Ultra Fast Harvest"
|
|
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
|
|
Title.TextSize = 16
|
|
|
|
local TitleCorner = Instance.new("UICorner")
|
|
TitleCorner.CornerRadius = UDim.new(0, 12)
|
|
TitleCorner.Parent = Title
|
|
|
|
-- Status
|
|
local StatusLabel = Instance.new("TextLabel")
|
|
StatusLabel.Parent = MainFrame
|
|
StatusLabel.BackgroundTransparency = 1
|
|
StatusLabel.Position = UDim2.new(0, 10, 0, 50)
|
|
StatusLabel.Size = UDim2.new(1, -20, 0, 20)
|
|
StatusLabel.Font = Enum.Font.SourceSans
|
|
StatusLabel.Text = "สถานะ: พร้อมใช้งาน"
|
|
StatusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
|
|
StatusLabel.TextSize = 12
|
|
StatusLabel.TextXAlignment = Enum.TextXAlignment.Left
|
|
|
|
-- Stats
|
|
local StatsLabel = Instance.new("TextLabel")
|
|
StatsLabel.Parent = MainFrame
|
|
StatsLabel.BackgroundTransparency = 1
|
|
StatsLabel.Position = UDim2.new(0, 10, 0, 80)
|
|
StatsLabel.Size = UDim2.new(1, -20, 0, 100)
|
|
StatsLabel.Font = Enum.Font.SourceSans
|
|
StatsLabel.Text = "สถิติ:\n- เก็บสูงสุด: " .. UltraSettings.MaxHarvestPerSecond .. " ต้น/วินาที\n- ดีเลย์: " .. UltraSettings.HarvestDelay .. " วินาที\n- Threads: " .. UltraSettings.MaxThreads .. " ตัว\n- กระเป๋า: " .. UltraSettings.MaxInventorySlots .. " ช่อง"
|
|
StatsLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
|
|
StatsLabel.TextSize = 10
|
|
StatsLabel.TextXAlignment = Enum.TextXAlignment.Left
|
|
StatsLabel.TextYAlignment = Enum.TextYAlignment.Top
|
|
|
|
print("✅ Ultra Fast UI created")
|
|
end
|
|
|
|
-- Initialize
|
|
print("⚡ Initializing Ultra Fast Harvest System...")
|
|
|
|
wait(1)
|
|
|
|
CreateUltraFastUI()
|
|
StartUltraFastLoop()
|
|
|
|
game:GetService("StarterGui"):SetCore("SendNotification", {
|
|
Title = "⚡ Ultra Fast Harvest",
|
|
Text = "ระบบเก็บของเร็วที่สุดพร้อมใช้งาน!",
|
|
Duration = 3
|
|
})
|
|
|
|
print("⚡ " .. string.rep("=", 50))
|
|
print("✅ Ultra Fast Harvest System พร้อมใช้งาน!")
|
|
print("⚡ ความเร็วสูงสุด: " .. UltraSettings.MaxHarvestPerSecond .. " ต้น/วินาที")
|
|
print("⚡ ดีเลย์: " .. UltraSettings.HarvestDelay .. " วินาที")
|
|
print("⚡ Threads: " .. UltraSettings.MaxThreads .. " ตัว")
|
|
print("⚡ " .. string.rep("=", 50))
|
|
|
|
return {
|
|
Settings = UltraSettings,
|
|
UI = ScreenGui,
|
|
MyFarm = MyFarm
|
|
} |