Roblox-Bot-Lua/Main/GaG/GameAnalyzer.lua
2025-07-21 10:41:54 +07:00

168 lines
6.0 KiB
Lua

-- GaG Game Analyzer
-- สคริปต์สำหรับวิเคราะห์โครงสร้างเกม GaG
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
print("=== GaG Game Structure Analysis ===")
-- วิเคราะห์ RemoteEvents และ RemoteFunctions
print("\n📡 RemoteEvents และ RemoteFunctions:")
local remotes = {}
local function scanForRemotes(parent, depth)
depth = depth or 0
local indent = string.rep(" ", depth)
for _, child in pairs(parent:GetChildren()) do
if child:IsA("RemoteEvent") or child:IsA("RemoteFunction") then
print(indent .. "🔗 " .. child.ClassName .. ": " .. child.Name)
table.insert(remotes, {
Type = child.ClassName,
Name = child.Name,
Path = child:GetFullName(),
Object = child
})
elseif child:IsA("Folder") or child:IsA("ModuleScript") then
print(indent .. "📁 " .. child.ClassName .. ": " .. child.Name)
if depth < 2 then -- จำกัดความลึก
scanForRemotes(child, depth + 1)
end
end
end
end
scanForRemotes(ReplicatedStorage)
print("\n📋 รายการ Remotes ที่พบ:")
for i, remote in ipairs(remotes) do
print(string.format("%d. %s - %s", i, remote.Type, remote.Name))
end
-- วิเคราะห์ Workspace
print("\n🌍 Workspace Structure:")
local function scanWorkspace(parent, depth)
depth = depth or 0
local indent = string.rep(" ", depth)
for _, child in pairs(parent:GetChildren()) do
if child.Name:lower():find("plot") or
child.Name:lower():find("farm") or
child.Name:lower():find("plant") or
child.Name:lower():find("sell") or
child.Name:lower():find("shop") then
print(indent .. "🎯 " .. child.ClassName .. ": " .. child.Name)
-- ดูข้อมูลเพิ่มเติม
if child:FindFirstChild("Plot") then
print(indent .. " 📦 มี Plot")
end
if child:FindFirstChild("Plant") then
print(indent .. " 🌱 มี Plant")
end
if child:FindFirstChild("Owner") then
print(indent .. " 👤 มี Owner: " .. tostring(child.Owner.Value))
end
elseif depth < 1 then
scanWorkspace(child, depth + 1)
end
end
end
scanWorkspace(Workspace)
-- วิเคราะห์ Player data
print("\n👤 Player Data Structure:")
local function scanPlayerData()
local playerData = Player:FindFirstChild("Data") or Player:FindFirstChild("leaderstats")
if playerData then
print("💾 Player Data พบ:")
for _, child in pairs(playerData:GetChildren()) do
print(" 📊 " .. child.Name .. ": " .. tostring(child.Value))
end
end
-- ดู PlayerGui
local playerGui = Player:FindFirstChild("PlayerGui")
if playerGui then
print("🖥️ PlayerGui:")
for _, gui in pairs(playerGui:GetChildren()) do
if gui.Name:lower():find("farm") or
gui.Name:lower():find("plot") or
gui.Name:lower():find("plant") or
gui.Name:lower():find("inventory") then
print(" 🖼️ " .. gui.Name)
end
end
end
end
scanPlayerData()
-- ค้นหาฟังก์ชันที่เกี่ยวข้องกับการฟาร์ม
print("\n🔍 การค้นหาฟังก์ชันฟาร์ม:")
-- ตรวจสอบ ReplicatedStorage สำหรับ events ที่เกี่ยวข้อง
local function findFarmEvents()
local events = {}
for _, remote in ipairs(remotes) do
local name = remote.Name:lower()
if name:find("plant") or name:find("harvest") or name:find("sell") or
name:find("farm") or name:find("buy") or name:find("purchase") then
print("🎯 พบ Event ที่น่าสนใจ: " .. remote.Name)
table.insert(events, remote)
end
end
return events
end
local farmEvents = findFarmEvents()
-- สร้างฟังก์ชันทดสอบ
print("\n🧪 ฟังก์ชันทดสอบ:")
local function testRemoteEvent(remote, args)
print("🔬 ทดสอบ " .. remote.Name .. " với ข้อมูล: " .. tostring(args))
local success, result = pcall(function()
if remote.Type == "RemoteEvent" then
remote.Object:FireServer(unpack(args or {}))
elseif remote.Type == "RemoteFunction" then
return remote.Object:InvokeServer(unpack(args or {}))
end
end)
if success then
print("✅ สำเร็จ: " .. tostring(result))
else
print("❌ ผิดพลาด: " .. tostring(result))
end
end
-- ทดสอบ events ที่พบ
for _, event in ipairs(farmEvents) do
if event.Name:lower():find("plant") then
print("🌱 ทดสอบปลูกพืช: " .. event.Name)
-- testRemoteEvent(event, {"Carrot", somePosition})
elseif event.Name:lower():find("harvest") then
print("🌾 ทดสอบเก็บเกี่ยว: " .. event.Name)
-- testRemoteEvent(event, {somePlant})
elseif event.Name:lower():find("sell") then
print("💰 ทดสอบขาย: " .. event.Name)
-- testRemoteEvent(event, {})
end
end
-- ส่งออกข้อมูลสำหรับใช้งาน
_G.GaGAnalysis = {
Remotes = remotes,
FarmEvents = farmEvents,
TestFunction = testRemoteEvent
}
print("\n✅ การวิเคราะห์เสร็จสิ้น! ข้อมูลถูกเก็บไว้ใน _G.GaGAnalysis")