Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showHint(txt)
- local m = Instance.new("Message", Workspace)
- m.Text = txt
- wait(5)
- m:Destroy()
- end
- function numerify(n)
- if n == "null" or n == nil then
- return ""
- end
- if n < 1000 then
- return string.format("%d",n)
- elseif n <= 10000 then
- return string.format("%.1fk", n/1000)
- elseif n < 100000 then
- return string.format("%.1fk", n/1000)
- elseif n < 1000000 then
- return string.format("%.0fk", n/1000)
- else
- return string.format("%.2fm", n/1000000)
- end
- end
- function calculateTextWidth(text, fontSize, font)
- --extremely expensive function
- --benchmark it?
- font = font or Enum.Font.SourceSans
- fontSize = fontSize or Enum.FontSize.Size18
- local label = Instance.new("TextLabel")
- label.Text = tostring(text)
- label.Position = UDim2.new(-1, 0, -1, 0)
- label.FontSize = fontSize
- label.Font = font
- label.Parent = script.Parent
- local width = label.TextBounds.X
- label:Destroy()
- return width
- end
- --local DecodeJSON = LoadLibrary("RbxUtility").DecodeJSON
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ClientModules = ReplicatedStorage:WaitForChild("ClientModules")
- local Metro = require(ClientModules:WaitForChild("Metro"))
- local Time = require(ClientModules:WaitForChild("Time"))
- local Class = require(ClientModules:WaitForChild("Class"))
- local Limiteds = require(ClientModules:WaitForChild("Limiteds"))
- local Log = Class.Get("Log")
- local User = Class.Get("User")
- local Player = Players.LocalPlayer
- local Gui = script.Parent
- --[[
- Limiteds:GetUserData(userId)
- Limiteds.UserDataUpdated:connect(function(userId) end)
- Limiteds:GetList()
- Limiteds.ListUpdated:connect(function() end)
- Limiteds:WishlistAdd(assetId)
- Limiteds:WishlistRemove(assetId)
- Limiteds:BlacklistAdd(assetId)
- Limiteds:BlacklistRemove(assetId)
- --]]
- Limiteds.List = Limiteds:GetList()
- Limiteds.ListUpdated:connect(function()
- print("The limiteds list was updated")
- Limiteds.List = Limiteds:GetList()
- end)
- --[[
- Asset:GetName(id)
- Asset:NameContains(id,text)
- Asset:GetType(Id)
- Asset:GetRAP(id)
- --]]
- local Asset = {}
- function Asset:GetName(id)
- return Limiteds.List[id].Name
- end
- function Asset:NameContains(id, text)
- local name = Asset:GetName(id):lower()
- local text = text:lower()
- return (string.find(name, text, 1, true) ~= nil)
- end
- function Asset:GetType(id)
- return Limiteds.List[id].Type
- end
- function Asset:GetRAP(id)
- if not Limiteds.List[id] then
- print("GetRAP: Asset not found in limiteds list.")
- return 0
- end
- return tonumber(Limiteds.List[id].RecentAveragePrice) or 0
- end
- function Asset:GetImage(id)
- return "http://www.roblox.com/Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=110&ht=110&aid=" .. tostring(id)
- end
- function Asset:GetTotalSold(id)
- if Limiteds.List[id] then
- return tonumber(Limiteds.List[id].TotalSold) or 0
- end
- return 0
- end
- local ItemTooltip = {}
- ItemTooltip.Frame = nil
- function ItemTooltip:Hide()
- if ItemTooltip.Frame then
- ItemTooltip.Frame:Destroy()
- end
- end
- function ItemTooltip:Create(userAsset, element)
- if ItemTooltip.Frame then
- ItemTooltip.Frame:Destroy()
- end
- local id = userAsset.Id
- local name = Asset:GetName(id)
- local rap = Asset:GetRAP(id)
- local image = Asset:GetImage(id)
- local type = Asset:GetType(id)
- local totalSold = Asset:GetTotalSold(id)
- local serials = ""
- for i,v in pairs(userAsset.Copies) do
- local num
- if tonumber(v.SerialNumber) then
- num = "#" .. tostring(v.SerialNumber)
- else
- num = "N/A"
- end
- serials = serials .. ", " .. num
- end
- serials = string.sub(serials, 2, string.len(serials))
- local mouseover = false
- --[[local id = 16412796
- local name = "Sk8ter Boi"
- local rap = "704,831 R$"
- local totalSold = "1400"
- local type = "Hat"
- local image = "http://www.roblox.com/Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=110&ht=110&aid=" .. tostring(id)
- --]]
- local margin = 5
- local faved = false
- local notForSale = false
- local tooltipSize = Vector2.new(350, 100)
- local leftOffset = 23
- local frame = Metro.Window(tooltipSize)
- frame.BackgroundTransparency = 0.3
- frame.Position = UDim2.new(0, element.AbsolutePosition.X + element.AbsoluteSize.X + leftOffset, 0 , element.AbsolutePosition.Y + (element.AbsoluteSize.Y * 0.5) + tooltipSize.Y * -0.5)
- frame.Parent = Gui
- element.Changed:connect(function(prop)
- if prop == "AbsolutePosition" then
- frame.Position = UDim2.new(0, element.AbsolutePosition.X + element.AbsoluteSize.X + leftOffset, 0 , element.AbsolutePosition.Y + (element.AbsoluteSize.Y * 0.5) + tooltipSize.Y * -0.5)
- end
- end)
- local imageSize = Vector2.new(100, 100)
- local textHeight = 16
- local imageLabel = Instance.new("ImageLabel")
- imageLabel.BackgroundTransparency = 1
- imageLabel.Image = image
- imageLabel.Size = UDim2.new(0, imageSize.X, 0, imageSize.Y)
- imageLabel.Parent = frame
- local nameLabel = Metro.Label(name,true)
- nameLabel.FontSize = Enum.FontSize.Size14
- nameLabel.Position = UDim2.new(0, imageSize.X + margin, 0, 0)
- nameLabel.Parent = frame
- local assetType = Metro.Label("Type: " .. type)
- assetType.FontSize = Enum.FontSize.Size14
- assetType.Position = UDim2.new(0, imageSize.X + margin, 0, textHeight)
- assetType.Parent = frame
- local totalSold = Metro.Label("Total Sold: " .. totalSold)
- totalSold.FontSize = Enum.FontSize.Size14
- totalSold.Position = UDim2.new(0, imageSize.X + margin, 0, textHeight*2)
- totalSold.Parent = frame
- local rapLabel = Metro.Label("RAP: " .. numerify(rap))
- rapLabel.FontSize = Enum.FontSize.Size14
- rapLabel.Position = UDim2.new(0, imageSize.X + margin, 0, textHeight*3)
- rapLabel.Parent = frame
- local serialNumbersLabel = Metro.Label("Serial Numbers:")
- serialNumbersLabel.FontSize = Enum.FontSize.Size14
- serialNumbersLabel.Position = UDim2.new(0, imageSize.X + margin, 0, textHeight*4)
- serialNumbersLabel.Parent = frame
- local serialNumbers = Metro.Label(serials)
- serialNumbers.FontSize = Enum.FontSize.Size14
- serialNumbers.Position = UDim2.new(0, imageSize.X + margin, 0, textHeight*5)
- serialNumbers.Parent = frame
- local buttonMargin = 2
- local buttonSize = 18
- local starButton, setStarButtonState = Metro.StarButton(faved)
- starButton.Parent = imageLabel
- starButton.Position = UDim2.new(0, buttonMargin, 1, -1 * (buttonSize + buttonMargin))
- starButton.MouseButton1Click:connect(function()
- faved = not faved
- setStarButtonState(faved)
- end)
- local notForSaleButton, setNotForSale = Metro.BlockButton(notForSale)
- notForSaleButton.Position = UDim2.new(0, buttonSize + buttonMargin * 2, 1, -1 * (buttonSize + buttonMargin))
- notForSaleButton.Parent = frame
- notForSaleButton.MouseButton1Click:connect(function()
- notForSale = not notForSale
- setNotForSale(notForSale)
- end)
- frame.MouseEnter:connect(function()
- print("Mouse entered frame")
- mouseover = true
- end)
- element.MouseLeave:connect(function()
- ---wait(0.05)
- --if mouseover then
- -- frame.MouseLeave:connect(function() frame:Destroy() end)
- --else
- --print("Mouse left button")
- frame:Destroy()
- --end
- end)
- local minWidth = 250
- local nameWidth = imageSize.X + margin + calculateTextWidth(nameLabel.Text, nameLabel.FontSize, nameLabel.Font) + margin
- local fullWidth = math.max(minWidth, nameWidth)
- frame.Size = UDim2.new(0, fullWidth, 0, tooltipSize.Y)
- ItemTooltip.Frame = frame
- end
- --[[
- Filter.Apply(list)
- Filter.Sort(list)
- Filter.Reset()
- --]]
- local Filter = {
- AssetTypes = { "All", "Hat", "Gear", "Face" };
- AssetType = "All";
- SearchText = "";
- SortType = "RAP";
- SortAscending = false;
- }
- function Filter:Apply(list)
- local results = {}
- for _,userAsset in pairs(list) do
- local id = userAsset.Id
- if Limiteds.List[id] and (Filter.AssetType == "All" or (Asset:GetType(id) == Filter.AssetType)) then
- if (Filter.SearchText == "" or Asset:NameContains(id,Filter.SearchText)) then
- table.insert(results, userAsset)
- end
- end
- end
- return results
- end
- function Filter:GetSortFunction()
- if Filter.SortType == "RAP" then
- if Filter.SortAscending then
- return function(a,b)
- return Asset:GetRAP(a.Id) < Asset:GetRAP(b.Id)
- end
- else
- return function(a,b)
- return Asset:GetRAP(a.Id) > Asset:GetRAP(b.Id)
- end
- end
- elseif Filter.SortType == "Name" then
- if Filter.SortAscending then
- return function(a,b)
- return Asset:GetName(a.Id) < Asset:GetName(b.Id)
- end
- else
- return function(a,b)
- return Asset:GetName(a.Id) > Asset:GetName(b.Id)
- end
- end
- end
- end
- function Filter:Sort(list)
- local sortFunction = Filter:GetSortFunction()
- table.sort(list, sortFunction)
- return list
- end
- function Filter:Reset()
- Filter.AssetType = "All"
- Filter.SearchText = ""
- Filter.SortType = "RAP"
- Filter.SortAscending = false
- end
- -- for current player, we need both name and id
- -- we want to show whether the player is in-game
- -- we need to support out-of-server players
- -- connect to player added / player removing
- local CurrentUser = {
- Player = nil;
- Id = nil;
- Name = nil;
- --Data = {};
- }
- local SelectionBox = Instance.new("SelectionBox")
- SelectionBox.Color = BrickColor.new("Bright red")
- SelectionBox.Transparency = 0.5
- SelectionBox.Parent = Gui
- CurrentUser.NameCache = {}
- function CurrentUser:SetByPlayer(player)
- if player then
- CurrentUser.Player = player
- CurrentUser.Id = player.userId
- CurrentUser.Name = player.Name
- --CurrentUser.Data = Limiteds:GetUserData(Player.userId)
- end
- end
- function CurrentUser:GetUserAssets()
- return Limiteds:GetUserData(CurrentUser.Id).UserAssets
- end
- function CurrentUser:GetTotalRAP()
- local rap = 0
- local userAssets = CurrentUser:GetUserAssets()
- for _,userAsset in pairs(userAssets) do
- local id = userAsset.Id
- rap = rap + (#userAsset.Copies * Asset:GetRAP(id))
- end
- return rap
- end
- function CurrentUser:SetByName(name)
- for _,player in pairs(Players:GetPlayers()) do
- if name == player.Name then
- CurrentUser:SetByPlayer(player)
- return
- end
- end
- if name == "ROBLOX" then
- CurrentUser.Name = "ROBLOX"
- CurrentUser.Id = 1
- return
- end
- CurrentUser.Player = nil
- CurrentUser.Name = nil
- CurrentUser.Id = nil
- end
- ----------------------------------
- local UpdateItemList = nil
- --Create the GUI
- local margin = 5
- local offset = Vector2.new(0,0)
- function addOffset(x, y)
- offset = offset + Vector2.new(x,y)
- end
- function resetOffset()
- offset = Vector2.new(0,0)
- end
- function resetOffsetX()
- offset = Vector2.new(0,offset.Y)
- end
- function resetOffsetY()
- offset = Vector2.new(offset.X,0)
- end
- function getOffset()
- return UDim2.new(0, offset.X, 0, offset.Y)
- end
- --Sizes
- local windowSize = Vector2.new(320, 360)
- local playerLabelSize = Vector2.new(50,20)
- local playerDropDownSize = Vector2.new(165,20)
- local itemSearchLabelSize = Vector2.new(50,20)
- local itemSearchSize = Vector2.new(100,20)
- local assetTypeDropDownSize = Vector2.new(60, 20)
- local itemLabelSize = Vector2.new(80,13)
- local itemFrameHeight = 290
- local AssetRowHeight = 34
- local ValueWidth = 50
- local scrollWidth = 20
- local AssetTitleRowHeight = 24
- local maxNameWidth = 160
- local windowOffscreen = UDim2.new(0, (-1 * windowSize.X - 1), 0.5, windowSize.Y / -2)
- local windowInscreen = UDim2.new(0, 0, 0.5, windowSize.Y / -2)
- local windowShown = false
- local window = Metro.Window(windowSize)
- window.Active = true
- window.Position = windowOffscreen
- window.BackgroundTransparency = 0.1
- window.Parent = Gui
- local toggleButton = Instance.new("TextButton")
- toggleButton.Size = UDim2.new(0, 40, 1, 0)
- toggleButton.BackgroundColor3 = Color3.new(0,0,0)
- toggleButton.BackgroundTransparency = 0.5
- toggleButton.Position = UDim2.new(1, 0, 0, 0)
- toggleButton.TextTransparency = 0.5
- toggleButton.TextColor3 = Color3.new(255/255, 255/255, 255/255)
- toggleButton.Text = ">"
- toggleButton.FontSize = Enum.FontSize.Size48
- toggleButton.Parent = window
- local tweenTime = 0.3
- local isTweening = false
- function showGui()
- if isTweening or windowShown then return end
- isTweening = true
- windowShown = true
- --toggleButton.Text = "<"
- window:TweenPosition(windowInscreen, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
- Spawn(function()
- for i = 0.5, 1, 0.05 do
- toggleButton.BackgroundTransparency = i
- toggleButton.TextTransparency = i
- wait(tweenTime / 10)
- end
- end)
- wait(tweenTime)
- isTweening = false
- toggleButton.Visible = false
- end
- function hideGui()
- if isTweening or not windowShown then return end
- ItemTooltip:Hide()
- isTweening = true
- windowShown = false
- --toggleButton.Text = ">"
- toggleButton.Visible = true
- Spawn(function()
- for i = 1, 0.5, -0.05 do
- toggleButton.BackgroundTransparency = i
- toggleButton.TextTransparency = i
- wait(tweenTime / 10)
- end
- end)
- window:TweenPosition(windowOffscreen, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
- wait(tweenTime)
- isTweening = false
- end
- function toggleGui()
- if windowShown and not isTweening then
- hideGui()
- else
- showGui()
- end
- end
- toggleButton.MouseButton1Click:connect(toggleGui)
- toggleButton.MouseEnter:connect(function()
- if windowShown == false then
- showGui()
- end
- end)
- --[[local exitBtn = Metro.ExitButton(function() window:Remove() end)
- exitBtn.Parent = window--]]
- addOffset(margin, margin)
- local playerLabel = Metro.Label("player")
- playerLabel.Position = getOffset()
- playerLabel.Size = UDim2.new(0, playerLabelSize.X, 0, playerLabelSize.Y)
- playerLabel.Parent = window
- addOffset(playerLabelSize.X, 0)
- function selectedPlayerChanged(newName)
- local player = game:GetService("Players"):FindFirstChild(newName)
- if player then
- CurrentUser:SetByPlayer(player)
- elseif newName == "ROBLOX" then
- CurrentUser:SetByName("ROBLOX")
- end
- UpdateItemList()
- end
- function selectedAssetTypeChanged(newType)
- Filter.AssetType = newType
- UpdateItemList()
- end
- local playerDropDown, setCurrentPlayerName, updatePlayerChoices = Metro.DropDown({Player.Name}, function(updatedChoice) selectedPlayerChanged(updatedChoice) end)
- playerDropDown.Position = getOffset()
- playerDropDown.Size = UDim2.new(0, playerDropDownSize.X, 0, playerDropDownSize.Y)
- playerDropDown.Parent = window
- addOffset(playerDropDownSize.X, 0)
- addOffset(margin, 0)
- local rapLabel = Metro.Label("")
- rapLabel.Position = getOffset()
- rapLabel.Size = UDim2.new(0, playerLabelSize.X, 0, playerLabelSize.Y)
- rapLabel.Parent = window
- resetOffsetX()
- addOffset(margin, 0)
- addOffset(0,playerDropDownSize.Y)
- addOffset(0, margin*2)
- local itemSearchLabel = Metro.Label("search")
- itemSearchLabel.Position = getOffset()
- itemSearchLabel.Size = UDim2.new(0, playerLabelSize.X, 0, playerLabelSize.Y)
- itemSearchLabel.Parent = window
- addOffset(itemSearchLabelSize.X, 0)
- local itemSearch, itemSearchFrame = Metro.Input()
- itemSearchFrame.Position = getOffset()
- itemSearchFrame.Size = UDim2.new(0, itemSearchSize.X, 0, itemSearchSize.Y)
- itemSearchFrame.Parent = window
- addOffset(itemSearchSize.X, 0)
- addOffset(margin,0)
- local itemTypeDropDown, setCurrentAssetType = Metro.DropDown(Filter.AssetTypes, selectedAssetTypeChanged)
- itemTypeDropDown.Parent = window
- itemTypeDropDown.Size = UDim2.new(0, assetTypeDropDownSize.X, 0, assetTypeDropDownSize.Y)
- itemTypeDropDown.Position = getOffset()
- resetOffsetX()
- addOffset(margin,0)
- addOffset(0,itemSearchSize.Y)
- local ItemFrame = Instance.new("Frame")
- ItemFrame.BackgroundTransparency = 1
- ItemFrame.Size = UDim2.new(1, -2*margin, 0, itemFrameHeight)
- ItemFrame.Position = getOffset()
- ItemFrame.Parent = window
- local ItemScrollBar = Metro.ScrollBar()
- ItemScrollBar.Window.Size = UDim2.new(1, 0, 1, -1 * AssetTitleRowHeight)
- ItemScrollBar.Window.Position = UDim2.new(0, 0, 0, AssetTitleRowHeight)
- ItemScrollBar.SetMaxHeight(0)
- ItemScrollBar.Window.Parent = ItemFrame
- local ItemNameLabel = Metro.LabelButton("name")
- ItemNameLabel.Parent = ItemFrame
- ItemNameLabel.Position = UDim2.new(0,AssetRowHeight,0,margin)
- ItemNameLabel.Size = UDim2.new(0, itemLabelSize.X, 0, itemLabelSize.Y)
- local ItemValueLabel = Metro.LabelButton("rap v")
- ItemValueLabel.Parent = ItemFrame
- ItemValueLabel.Position = UDim2.new(1,-1*(ValueWidth+scrollWidth),0,margin)
- ItemValueLabel.Size = UDim2.new(0, ValueWidth, 0, 13)
- local ItemLine = Instance.new("Frame")
- ItemLine.BackgroundColor3 = Color3.new(89/255, 89/255, 89/255)
- ItemLine.BorderSizePixel = 0
- ItemLine.Size = UDim2.new(1, 0, 0, 1)
- ItemLine.Position = UDim2.new(0, 0, 0, AssetTitleRowHeight)
- ItemLine.Parent = ItemFrame
- function AssetRow(userAsset)
- local id = userAsset.Id
- local name = Asset:GetName(id)
- local rap = numerify(Asset:GetRAP(id))
- local copies = #userAsset.Copies
- --name,value,quantity
- local quantityWidth = 25
- local imageWidth = AssetRowHeight
- local valueWidth = ValueWidth
- local assetFrame = Instance.new("TextButton")
- assetFrame.Active = true
- assetFrame.Text = ""
- assetFrame.BackgroundTransparency = 1
- assetFrame.Size = UDim2.new(1, 0, 0, AssetRowHeight)
- local assetImage = Instance.new("ImageLabel")
- assetImage.BackgroundTransparency = 1
- assetImage.Image = Asset:GetImage(id)
- assetImage.Size = UDim2.new(0,imageWidth,0,imageWidth)
- assetImage.Position = UDim2.new(0, 0, 0, 0)
- assetImage.Parent = assetFrame
- if (copies > 1) then
- local assetQuantity = Instance.new("TextLabel")
- assetQuantity.TextXAlignment = Enum.TextXAlignment.Left
- assetQuantity.TextColor3 = Color3.new(0/255, 144/255, 224/255)
- assetQuantity.Font = Enum.Font.SourceSans
- assetQuantity.BackgroundTransparency = 1
- assetQuantity.TextStrokeTransparency = 0.2
- assetQuantity.FontSize = Enum.FontSize.Size14
- assetQuantity.Size = UDim2.new(0, quantityWidth - margin, 1, 0)
- assetQuantity.Position = UDim2.new(0, imageWidth + margin/2, 0, 0)
- assetQuantity.Parent = assetFrame
- assetQuantity.Text = "x" .. tostring(copies)
- end
- --chop the name off if it's too long
- local nameFontSize = Enum.FontSize.Size14
- local ellipses = "..."
- local ellipsesWidth = calculateTextWidth(ellipses,nameFontSize)
- local textWidth = calculateTextWidth(name, nameFontSize)
- if (textWidth > maxNameWidth) then
- while (textWidth > maxNameWidth) do
- name = string.sub(name, 1, string.len(name) - 1)
- textWidth = calculateTextWidth(name .. ellipses, nameFontSize)
- end
- name = name .. ellipses
- end
- local assetName = Metro.Label(name, true)
- assetName.Size = UDim2.new(1, -1 * (imageWidth + quantityWidth + valueWidth + margin + margin), 1, 0)
- assetName.Position = UDim2.new(0, imageWidth + quantityWidth + margin, 0, 0)
- assetName.FontSize = nameFontSize
- assetName.Parent = assetFrame
- local assetValue = Metro.Label(rap,true)
- assetValue.Size = UDim2.new(0, valueWidth, 1, 0)
- assetValue.Position = UDim2.new(1, -1 * valueWidth, 0, 0)
- assetValue.Parent = assetFrame
- assetFrame.MouseEnter:connect(function()
- ItemTooltip:Create(userAsset, assetFrame)
- end)
- return assetFrame
- end
- local ItemList = {}
- ItemList.Height = 0
- ItemList.RowHeight = 34
- function ItemList:Clear()
- if ItemList.Cancel then
- ItemList.Cancel()
- end
- rapLabel.Text = ""
- ItemScrollBar.ContentFrame:ClearAllChildren()
- ItemList.Height = 0
- ItemScrollBar.SetMaxHeight(0)
- end
- function ItemList:AddSeeMoreButton()
- local showButtonSize = Vector2.new(160, 20)
- local buttonFrame = Instance.new("Frame")
- buttonFrame.BackgroundTransparency = 1
- buttonFrame.Size = UDim2.new(1, 0, 0, ItemList.RowHeight)
- local button = Metro.Button("Show more results")
- button.Position = UDim2.new(0.5, -0.5 * showButtonSize.X, 0.5, -0.5 * showButtonSize.Y)
- button.Size = UDim2.new(0, showButtonSize.X, 0, showButtonSize.Y)
- button.Parent = buttonFrame
- buttonFrame.Position = UDim2.new(0, 0, 0, ItemList.Height)
- buttonFrame.Parent = ItemScrollBar.ContentFrame
- ItemScrollBar.SetMaxHeight(ItemList.Height + ItemList.RowHeight)
- button.MouseButton1Click:wait()
- ItemScrollBar.SetMaxHeight(ItemList.Height)
- buttonFrame:Destroy()
- end
- function ItemList:AddItem(userAsset)
- local item = AssetRow(userAsset)
- item.Parent = ItemScrollBar.ContentFrame
- item.Position = UDim2.new(0, 0, 0, ItemList.Height)
- ItemList.Height = ItemList.Height + ItemList.RowHeight
- end
- function ItemList:Populate()
- local spinner, closeSpinner = Metro.Spinner(false)
- spinner.Parent = ItemFrame
- ItemList:Clear()
- local aborted = false
- local function loaded()
- if closeSpinner then
- closeSpinner()
- end
- end
- local function abort()
- aborted = true
- ItemList.Cancel = nil
- loaded()
- end
- ItemList.Cancel = abort
- local tt = 0
- local getUserAssetTime = 0
- local filterTime = 0
- local sortTime = 0
- local getTotalRap = 0
- local createGuiTime = 0
- tt = tick()
- local userAssets = CurrentUser:GetUserAssets()
- getUserAssetTime = tick() - tt
- tt = tick()
- userAssets = Filter:Apply(userAssets)
- filterTime = tick() - tt
- tt = tick()
- userAssets = Filter:Sort(userAssets)
- sortTime = tick() - tt
- --calculate total RAP
- tt = tick()
- local totalRAP = CurrentUser:GetTotalRAP()
- getTotalRap = tick() - tt
- rapLabel.Text = numerify(totalRAP) .. " R$"
- local itemsSoFar = 0
- local maxItems = 50 -- max items to render at once
- local hasHitMax = false
- local completed = false
- tt = tick()
- Spawn(function()
- for i,userAsset in pairs(userAssets) do
- if aborted then break end
- if Limiteds.List[userAsset.Id] then
- itemsSoFar = itemsSoFar + 1
- if (hasHitMax == false and itemsSoFar > maxItems) then
- --tell the main function to continue
- completed = true
- ItemList:AddSeeMoreButton()
- hasHitMax = true
- end
- ItemList:AddItem(userAsset)
- end
- end
- ItemScrollBar.SetMaxHeight(ItemList.Height)
- completed = true
- end)
- while completed == false do
- wait(.01)
- end
- createGuiTime = tick() - tt
- local myStr = "assets: " .. tostring(getUserAssetTime) .. " filter: " .. tostring(filterTime) .. " sort: " .. tostring(sortTime) .. " rap: " .. tostring(getTotalRap) .. " gui: " .. tostring(createGuiTime)
- --showHint(myStr)
- ItemList.Cancel = nil
- loaded()
- end
- UpdateItemList = function()
- ItemList:Populate()
- end
- function populatePlayerNames()
- playerNames = {"ROBLOX"}
- for _,player in pairs(game:GetService("Players"):GetPlayers()) do
- table.insert(playerNames, player.Name)
- end
- updatePlayerChoices(playerNames)
- end
- populatePlayerNames()
- Players.ChildAdded:connect(populatePlayerNames)
- Players.ChildRemoved:connect(populatePlayerNames)
- --when itemSearch loses focus
- --when dropdown player is changed
- --when dropdown item list is changed
- function updateSortLabels()
- local symbol
- if Filter.SortAscending then
- symbol = " v"
- else
- symbol = " ^"
- end
- if Filter.SortType == "Name" then
- ItemNameLabel.Text = "name" .. symbol
- ItemValueLabel.Text = "rap"
- else
- ItemValueLabel.Text = "rap" .. symbol
- ItemNameLabel.Text = "name"
- end
- end
- ItemNameLabel.MouseButton1Click:connect(function()
- if Filter.SortType == "Name" then
- Filter.SortAscending = not Filter.SortAscending
- else
- Filter.SortType = "Name"
- end
- updateSortLabels()
- ItemList:Populate()
- end)
- ItemValueLabel.MouseButton1Click:connect(function()
- if Filter.SortType == "RAP" then
- Filter.SortAscending = not Filter.SortAscending
- else
- Filter.SortType = "RAP"
- end
- updateSortLabels()
- ItemList:Populate()
- end)
- CurrentUser:SetByPlayer(Player)
- itemSearch.FocusLost:connect(function()
- Filter.SearchText = itemSearch.Text
- ItemList:Populate()
- end)
- local mouse = Player:GetMouse()
- function ReturnMouseOnPlayer()
- --Right Leg
- --Hat handle
- --nil
- local target = mouse.Target
- local player
- if not (target and target.Parent and target.Parent.Parent) then
- player = nil
- else
- player = Players:GetPlayerFromCharacter(target.Parent) or Players:GetPlayerFromCharacter(target.Parent.Parent)
- end
- if player and player.Character then
- SelectionBox.Adornee = player.Character
- else
- SelectionBox.Adornee = nil
- end
- return player
- end
- mouse.Button1Down:connect(function()
- local player = ReturnMouseOnPlayer()
- if player then
- ItemList:Clear()
- showGui()
- setCurrentPlayerName(player.Name)
- CurrentUser:SetByPlayer(player)
- ItemList:Populate()
- else
- hideGui()
- end
- end)
- mouse.Move:connect(function()
- ReturnMouseOnPlayer()
- end)
- ItemList:Populate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement