跳至內容
可用

Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL

CLclarkdevlinorg0 次瀏覽Universal2026年7月26日
分享
Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL

腳本程式碼

Lua
local SortByRarity = true -- common, uncommon, rare, epic, legendary
local SortBackwards = true

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SellEvent = ReplicatedStorage:WaitForChild("remotes"):WaitForChild("sellItemEvent")
local PlayerGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
local Inventory = PlayerGui:WaitForChild("inventory"):WaitForChild("mainBackground"):WaitForChild("innerBackground"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame")

local function RefreshInventory()
	SellEvent:FireServer({["ability"] = {},["helmet"] = {},["chest"] = {},["weapon"] = {}})
end

local function GetInventorySize(Table)
	local Count = 0
	for i,v in pairs(Table) do
		for ii,v in pairs(v) do
			Count += i == "keys" and 0 or 1
		end
	end
	return Count
end

local RarityLayout = {["common"] = 1, ["uncommon"] = 2, ["rare"] = 3, ["epic"] = 4, ["legendary"] = 5}

local function SortInventory(Table)
	local function SortLocation(Location)
		for _,Label in pairs(Location:GetChildren()) do
			if Label:IsA("ImageLabel") then
				local itemType = Label:WaitForChild("itemType").Value
				local uniqueItemNum = Label:WaitForChild("itemType"):WaitForChild("uniqueItemNum").Value
				for i,v in pairs(itemType == "weapon" and Table.weapons or itemType == "helmet" and Table.helmets or itemType == "ability" and Table.abilities or itemType == "chest" and Table.chests) do
					if tonumber(string.sub(i,itemType == "weapon" and 8 or itemType == "helmet" and 8 or itemType == "ability" and 9 or itemType == "chest" and 7)) == uniqueItemNum then
						Label.LayoutOrder = SortByRarity and SortBackwards and 6-RarityLayout[v.rarity] or SortByRarity and RarityLayout[v.rarity] or SortBackwards and 999-tonumber(v.levelReq) or tonumber(v.levelReq)
					end
				end
			end
		end
	end

	SortLocation(Inventory)
	if PlayerGui:FindFirstChild("tradingGui") then SortLocation(PlayerGui:WaitForChild("tradingGui"):WaitForChild("mainBackground"):WaitForChild("innerBackground"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame")) end
	if PlayerGui:FindFirstChild("blacksmith") then SortLocation(PlayerGui:WaitForChild("blacksmith"):WaitForChild("Frame"):WaitForChild("innerFrame"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame")) end
	if PlayerGui:FindFirstChild("sellShop") then SortLocation(PlayerGui:WaitForChild("sellShop"):WaitForChild("Frame"):WaitForChild("innerFrame"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame")) end
end

ReplicatedStorage.remotes.updateLocalInventoryTable.OnClientEvent:Connect(function(UpdatedTable)
	if UpdatedTable then
		--itemtable = updatedtable;
		--print(GetInventorySize(UpdatedTable))
		SortInventory(UpdatedTable)
	end;
end); RefreshInventory()

PlayerGui.ChildAdded:Connect(function(v)
	if v.Name == "tradingGui" or v.Name == "blacksmith" or v.Name == "sellShop" then
		local ScrollFrame = v.Name == "sellShop" and PlayerGui:WaitForChild("sellShop"):WaitForChild("Frame"):WaitForChild("innerFrame"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame") or 
			v.Name == "blacksmith" and PlayerGui:WaitForChild("blacksmith"):WaitForChild("Frame"):WaitForChild("innerFrame"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame") or 
			v.Name == "tradingGui" and PlayerGui:WaitForChild("tradingGui"):WaitForChild("mainBackground"):WaitForChild("innerBackground"):WaitForChild("rightSideFrame"):WaitForChild("ScrollingFrame")
		ScrollFrame.ChildAdded:Wait()
		RefreshInventory()
	end
end)

描述

Original description was lost during migration. Sorry for any inconvenience caused. - robloxscripts.com Admin

評論 (0)

登入以參與討論

  • 成為第一個評論的人。

常見問題

如何使用 Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL 腳本?
複製上方的腳本程式碼,開啟你的 Roblox 執行器,貼上程式碼,然後在遊戲中點擊執行。腳本執行後功能會立即啟用。
Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL 腳本免費嗎?
是的。此腳本免費複製和使用。如果使用金鑰系統,請透過「獲取金鑰」連結免費解鎖。
使用 Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL 腳本安全嗎?
完整原始碼顯示在此頁面上,讓你在執行前準確了解其功能。請始終使用可信的執行器,並記住使用腳本違反 Roblox 服務條款,風險自負。
哪個執行器相容 Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL?
此腳本相容大多數熱門 Roblox 執行器。查看我們的執行器頁面,為你的裝置找到可信的免費或付費執行器。
Dungeon Quest! INVENTORY SORTER SCRIPT - VERY USEFUL | BloxScripter