diff --git a/luau/107893730.luau b/luau/107893730.luau index ec7f1f2..e62864c 100644 --- a/luau/107893730.luau +++ b/luau/107893730.luau @@ -46,20 +46,22 @@ local spinnerIcons local smallScreenThreshold = 450 -- user facing images -local assetUrl = "http://banland.xyz/Asset/?id=" +local function assetUrl(id: number) + return `https://banland.xyz/asset?id={id}` +end -local errorImageUrl = `{assetUrl}42557901` -local buyImageUrl = `{assetUrl}104651457` -local buyImageDownUrl = `{assetUrl}104651515` -local buyImageDisabledUrl = `{assetUrl}104651532` -local cancelButtonImageUrl = `{assetUrl}104651592` -local cancelButtonDownUrl = `{assetUrl}104651639` -local okButtonUrl = `{assetUrl}104651665` -local okButtonPressedrl = `{assetUrl}104651707` -local freeButtonImageUrl = `{assetUrl}104651733` -local freeButtonImageDownUrl = `{assetUrl}104651761` -local tixIcon = `{assetUrl}102481431` -local robuxIcon = `{assetUrl}102481419` +local errorImageUrl = assetUrl(42557901) +local buyImageUrl = assetUrl(104651457) +local buyImageDownUrl = assetUrl(104651515) +local buyImageDisabledUrl = assetUrl(104651532) +local cancelButtonImageUrl = assetUrl(104651592) +local cancelButtonDownUrl = assetUrl(104651639) +local okButtonUrl = assetUrl(104651665) +local okButtonPressedrl = assetUrl(104651707) +local freeButtonImageUrl = assetUrl(104651733) +local freeButtonImageDownUrl = assetUrl(104651761) +local tixIcon = assetUrl(102481431) +local robuxIcon = assetUrl(102481419) -- user facing string local buyHeaderText = "Buy" @@ -82,22 +84,23 @@ local freeItemBalanceText = -------------------------------- End Global Variables ---------------------------------------- ----------------------------- Util Functions --------------------------------------------- -function getSecureApiBaseUrl() + +local function getSecureApiBaseUrl() local secureApiUrl = baseUrl secureApiUrl = string.gsub(secureApiUrl, "http", "https") secureApiUrl = string.gsub(secureApiUrl, "www", "api") return secureApiUrl end -function getRbxUtility() +local function getRbxUtility() if not RbxUtility then RbxUtility = LoadLibrary "RbxUtility" end return RbxUtility end -function preloadAssets() - for _, assetUrl in ipairs { +local function preloadAssets() + for _, url in ipairs { errorImageUrl, buyImageUrl, buyImageDownUrl, @@ -111,13 +114,15 @@ function preloadAssets() tixIcon, robuxIcon, } do - game:GetService("ContentProvider"):Preload(assetUrl) + game:GetService("ContentProvider"):Preload(url) end end + ----------------------------- End Util Functions --------------------------------------------- -------------------------------- Accept/Decline Functions -------------------------------------- -function removeCurrentPurchaseInfo() + +local function removeCurrentPurchaseInfo() currentAssetId = nil currentCurrencyType = nil currentCurrencyAmount = nil @@ -129,7 +134,12 @@ function removeCurrentPurchaseInfo() checkingPlayerFunds = false end -function closePurchasePrompt() +local function hidePurchasing() + purchaseDialog.PurchasingFrame.Visible = false + spinning = false +end + +local function closePurchasePrompt() purchaseDialog:TweenPosition( hidePosition, Enum.EasingDirection.Out, @@ -145,25 +155,7 @@ function closePurchasePrompt() ) end -function userPurchaseActionsEnded(isSuccess: boolean) - checkingPlayerFunds = false - - if isSuccess then -- show the user we bought the item successfully, when they close this dialog we will call signalPromptEnded - local newPurchasedSucceededText = string.gsub( - purchaseSucceededText, - "itemName", - tostring(currentProductInfo.Name) - ) - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = - newPurchasedSucceededText - setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton) - hidePurchasing() - else -- otherwise we didn't purchase, no need to show anything, just signal and close dialog - signalPromptEnded(isSuccess) - end -end - -function signalPromptEnded(isSuccess) +local function signalPromptEnded(isSuccess) closePurchasePrompt() if purchasingConsumable then MarketplaceService:SignalPromptProductPurchaseFinished( @@ -181,344 +173,45 @@ function signalPromptEnded(isSuccess) removeCurrentPurchaseInfo() end --- make sure our gui displays the proper purchase data, and set the productid we will try and buy if use specifies a buy action -function updatePurchasePromptData(_) - local newItemDescription = "" +-- convenience method to say exactly what buttons should be visible (all others are not!) +local function setButtonsVisible(...) + local args = { ... } + local argCount = select("#", ...) - -- id to use when we request a purchase - if not currentProductId then - currentProductId = currentProductInfo.ProductId + local bodyFrameChildren = purchaseDialog.BodyFrame:GetChildren() + for i = 1, #bodyFrameChildren do + if bodyFrameChildren[i]:IsA "GuiButton" then + bodyFrameChildren[i].Visible = false + for j = 1, argCount do + if bodyFrameChildren[i] == args[j] then + bodyFrameChildren[i].Visible = true + break + end + end + end end +end - if isFreeItem() then - newItemDescription = string.gsub( - freeItemPurchaseText, +local function userPurchaseActionsEnded(isSuccess: boolean) + checkingPlayerFunds = false + + if isSuccess then -- show the user we bought the item successfully, when they close this dialog we will call signalPromptEnded + local newPurchasedSucceededText = string.gsub( + purchaseSucceededText, "itemName", tostring(currentProductInfo.Name) ) - newItemDescription = string.gsub( - newItemDescription, - "assetType", - tostring(assetTypeToString(currentProductInfo.AssetTypeId)) - ) - setHeaderText(takeHeaderText) - else -- otherwise item costs something, so different prompt - newItemDescription = string.gsub( - productPurchaseText, - "itemName", - tostring(currentProductInfo.Name) - ) - newItemDescription = string.gsub( - newItemDescription, - "currencyType", - tostring(currencyTypeToString(currentCurrencyType)) - ) - newItemDescription = string.gsub( - newItemDescription, - "currencyAmount", - tostring(currentCurrencyAmount) - ) - setHeaderText(buyHeaderText) - end - - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = - newItemDescription - - if purchasingConsumable then - purchaseDialog.BodyFrame.ItemPreview.Image = - `{baseUrl}thumbs/asset.ashx?assetid={currentProductInfo.IconImageAssetId}&x=100&y=100&format=png` - else - purchaseDialog.BodyFrame.ItemPreview.Image = - `{baseUrl}thumbs/asset.ashx?assetid={currentAssetId}&x=100&y=100&format=png` + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newPurchasedSucceededText + setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton) + hidePurchasing() + else -- otherwise we didn't purchase, no need to show anything, just signal and close dialog + signalPromptEnded(isSuccess) end end -function doPlayerFundsCheck(checkIndefinitely) - if checkingPlayerFunds then - local canPurchase, insufficientFunds = canPurchaseItem() -- check again to see if we can buy item - if canPurchase and insufficientFunds then -- wait a bit and try a few more times - local retries = 1000 - while - (retries > 0 or checkIndefinitely) - and insufficientFunds - and checkingPlayerFunds - and canPurchase - do - wait(0.1) - canPurchase, insufficientFunds = canPurchaseItem() - retries -= 1 - end - end - if canPurchase and not insufficientFunds then - -- we can buy item! set our buttons up and we will exit this loop - setButtonsVisible( - purchaseDialog.BodyFrame.BuyButton, - purchaseDialog.BodyFrame.CancelButton, - purchaseDialog.BodyFrame.AfterBalanceButton - ) - end - end -end - -function showPurchasePrompt() - local canPurchase, insufficientFunds, notRightBC, override, descText = - canPurchaseItem() - - if canPurchase then - updatePurchasePromptData() - - if override and descText then - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = descText - purchaseDialog.BodyFrame.AfterBalanceButton.Visible = false - end - game.GuiService:AddCenterDialog( - purchaseDialog, - Enum.CenterDialogType.ModalDialog, - --ShowFunction - function() - -- set the state for our buttons - purchaseDialog.Visible = true - if isFreeItem() then - setButtonsVisible( - purchaseDialog.BodyFrame.FreeButton, - purchaseDialog.BodyFrame.CancelButton, - purchaseDialog.BodyFrame.AfterBalanceButton - ) - elseif notRightBC then - purchaseDialog.BodyFrame.AfterBalanceButton.Text = - "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade." - if not openBCUpSellWindowConnection then - openBCUpSellWindowConnection = purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect( - function() - if - purchaseDialog.BodyFrame.AfterBalanceButton.Text - == "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade." - then - openBCUpSellWindow() - end - end - ) - end - setButtonsVisible( - purchaseDialog.BodyFrame.BuyDisabledButton, - purchaseDialog.BodyFrame.CancelButton, - purchaseDialog.BodyFrame.AfterBalanceButton - ) - elseif insufficientFunds then - setButtonsVisible( - purchaseDialog.BodyFrame.BuyDisabledButton, - purchaseDialog.BodyFrame.CancelButton, - purchaseDialog.BodyFrame.AfterBalanceButton - ) - elseif override then - setButtonsVisible( - purchaseDialog.BodyFrame.BuyDisabledButton, - purchaseDialog.BodyFrame.CancelButton - ) -- , purchaseDialog.BodyFrame.AfterBalanceButton) - else - setButtonsVisible( - purchaseDialog.BodyFrame.BuyButton, - purchaseDialog.BodyFrame.CancelButton - ) -- , purchaseDialog.BodyFrame.AfterBalanceButton) - end - - purchaseDialog:TweenPosition( - showPosition, - Enum.EasingDirection.Out, - Enum.EasingStyle.Quad, - tweenTime, - true - ) - - if - canPurchase - and insufficientFunds - and not enableBrowserWindowClosedEvent - then - checkingPlayerFunds = true - doPlayerFundsCheck(true) - end - end, - --HideFunction - function() - purchaseDialog.Visible = false - end - ) - else -- we failed in prompting a purchase, do a decline - doDeclinePurchase() - end -end - --- given an asset id, this function will grab that asset from the website, and return the first "Tool" object found inside it -function getToolAssetID(assetID) - local newTool = game:GetService("InsertService"):LoadAsset(assetID) - if not newTool then - return nil - end - - if newTool:IsA "Tool" then - return newTool - end - - local toolChildren = newTool:GetChildren() - for i = 1, #toolChildren do - if toolChildren[i]:IsA "Tool" then - return toolChildren[i] - end - end - return nil -end - --- the user tried to purchase by clicking the purchase button, but something went wrong. --- let them know their account was not charged, and that they do not own the item yet. -function purchaseFailed(inGamePurchasesDisabled) - local name = "Item" - if currentProductInfo then - name = currentProductInfo.Name - end - - local newPurchasedFailedText = - string.gsub(purchaseFailedText, "itemName", tostring(name)) - if inGamePurchasesDisabled then - newPurchasedFailedText = string.gsub( - newPurchasedFailedText, - "errorReason", - tostring(errorPurchasesDisabledText) - ) - else - newPurchasedFailedText = string.gsub( - newPurchasedFailedText, - "errorReason", - tostring(errorPurchasesUnknownText) - ) - end - - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = - newPurchasedFailedText - purchaseDialog.BodyFrame.ItemPreview.Image = errorImageUrl - - setButtonsVisible(purchaseDialog.BodyFrame.OkButton) - - setHeaderText(buyFailedHeaderText) - - hidePurchasing() -end - --- user has specified they want to buy an item, now try to attempt to buy it for them -function doAcceptPurchase(_) - showPurchasing() -- shows a purchasing ui (shows spinner) - - local startTime = tick() - - -- http call to do the purchase - local response = "none" - local url = `{getSecureApiBaseUrl()}marketplace/` - - local currencyData = `¤cyTypeId={currencyEnumToInt( - currentCurrencyType - )}¤cyTypeId={currencyEnumToInt( - currentCurrencyType - )}` - - -- consumables need to use a different url - if purchasingConsumable then - url ..= `submitpurchase?productId={currentProductId}{currencyData}&expectedUnitPrice={currentCurrencyAmount}&placeId={Game.PlaceId}` - else - url ..= `purchase?productId={currentProductId}{currencyData}&purchasePrice={currentCurrencyAmount}&locationType=Game&locationId={Game.PlaceId}` - end - - local success, reason = ypcall(function() - response = game:HttpPostAsync(url, "RobloxPurchaseRequest") - end) - - -- debug output for us (found in the logs from local) - print( - "doAcceptPurchase success from ypcall is ", - success, - "reason is", - reason - ) - - if (tick() - startTime) < 1 then - wait(1) -- allow the purchasing waiting dialog to at least be readable (otherwise it might flash, looks bad)... - end - - -- check to make sure purchase actually happened on the web end - if response == "none" or response == nil or response == "" then - print( - "did not get a proper response from web on purchase of", - currentAssetId, - currentProductId - ) - purchaseFailed() - return - end - - -- parse our response, decide how to react - response = getRbxUtility().DecodeJSON(response) - - if response then - if response.success == false then - if response.status ~= "AlreadyOwned" then - print( - "web return response of fail on purchase of", - currentAssetId, - currentProductId - ) - purchaseFailed((response.status == "EconomyDisabled")) - return - end - end - else - print( - "web return response of non parsable JSON on purchase of", - currentAssetId - ) - purchaseFailed() - return - end - - -- check to see if this item was bought, and if we want to equip it (also need to make sure the asset type was gear) - if - currentEquipOnPurchase - and success - and currentAssetId - and tonumber(currentProductInfo.AssetTypeId) == 19 - then - local tool = getToolAssetID(tonumber(currentAssetId)) - if tool then - tool.Parent = game.Players.LocalPlayer.Backpack - end - end - - if purchasingConsumable then - if not response.receipt then - print( - "tried to buy productId, but no receipt returned. productId was", - currentProductId - ) - purchaseFailed() - return - end - MarketplaceService:SignalClientPurchaseSuccess( - tostring(response.receipt), - game.Players.LocalPlayer.userId, - currentProductId - ) - else - userPurchaseActionsEnded(success) - end -end - --- user pressed the cancel button, just remove all purchasing prompts -function doDeclinePurchase() - userPurchaseActionsEnded(false) -end --------------------------------- End Accept/Decline Functions -------------------------------------- - ----------------------------------------------- Currency Functions --------------------------------------------- -- enums have no implicit conversion to numbers in lua, has to have a function to do this -function currencyEnumToInt(currencyEnum: Enum.CurrencyType) +local function currencyEnumToInt(currencyEnum: Enum.CurrencyType) if currencyEnum == Enum.CurrencyType.Tix then return 2 end @@ -526,7 +219,7 @@ function currencyEnumToInt(currencyEnum: Enum.CurrencyType) end -- oi, this is ugly -function assetTypeToString(assetType) +local function assetTypeToString(assetType) if assetType == 1 then return "Image" elseif assetType == 2 then @@ -594,80 +287,100 @@ function assetTypeToString(assetType) return "" end -function currencyTypeToString(currencyType) +local function isFreeItem() + -- if both of these are true, then the item is free, just prompt user if they want to take one + return currentProductInfo + and currentProductInfo.IsForSale == true + and currentProductInfo.IsPublicDomain == true +end + +local function setHeaderText(text) + purchaseDialog.TitleLabel.Text = text + purchaseDialog.TitleBackdrop.Text = text +end + +local function currencyTypeToString(currencyType) if currencyType == Enum.CurrencyType.Tix then return "Tix" end return "R$" end --- figure out what currency to use based on the currency you can actually sell the item in and what the script specified -local function setCurrencyAmountAndType(priceInRobux, priceInTix) - if - currentCurrencyType == Enum.CurrencyType.Default - or currentCurrencyType == Enum.CurrencyType.Robux - then -- sell for default (user doesn't care) or robux - if priceInRobux ~= nil and priceInRobux ~= 0 then -- we can sell for robux - currentCurrencyAmount = priceInRobux - currentCurrencyType = Enum.CurrencyType.Robux - else -- have to use tix - currentCurrencyAmount = priceInTix - currentCurrencyType = Enum.CurrencyType.Tix - end - elseif currentCurrencyType == Enum.CurrencyType.Tix then -- we want to sell for tix - if priceInTix ~= nil and priceInTix ~= 0 then -- we can sell for tix - currentCurrencyAmount = priceInTix - currentCurrencyType = Enum.CurrencyType.Tix - else -- have to use robux - currentCurrencyAmount = priceInRobux - currentCurrencyType = Enum.CurrencyType.Robux - end +-- make sure our gui displays the proper purchase data, and set the productid we will try and buy if use specifies a buy action +local function updatePurchasePromptData(_) + local newItemDescription = "" + + -- id to use when we request a purchase + if not currentProductId then + currentProductId = currentProductInfo.ProductId + end + + if isFreeItem() then + newItemDescription = string.gsub( + freeItemPurchaseText, + "itemName", + tostring(currentProductInfo.Name) + ) + newItemDescription = string.gsub( + newItemDescription, + "assetType", + tostring(assetTypeToString(currentProductInfo.AssetTypeId)) + ) + setHeaderText(takeHeaderText) + else -- otherwise item costs something, so different prompt + newItemDescription = string.gsub( + productPurchaseText, + "itemName", + tostring(currentProductInfo.Name) + ) + newItemDescription = string.gsub( + newItemDescription, + "currencyType", + tostring(currencyTypeToString(currentCurrencyType)) + ) + newItemDescription = string.gsub( + newItemDescription, + "currencyAmount", + tostring(currentCurrencyAmount) + ) + setHeaderText(buyHeaderText) + end + + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newItemDescription + + if purchasingConsumable then + purchaseDialog.BodyFrame.ItemPreview.Image = + `{baseUrl}thumbs/asset.ashx?assetid={currentProductInfo.IconImageAssetId}&x=100&y=100&format=png` else - return false + purchaseDialog.BodyFrame.ItemPreview.Image = + `{baseUrl}thumbs/asset.ashx?assetid={currentAssetId}&x=100&y=100&format=png` end - - if currentCurrencyAmount == nil then - return false - end - - return true end --- will get the player's balance of robux and tix, return in a table -local function getPlayerBalance() - local playerBalance - local success, errorCode = ypcall(function() - playerBalance = - game:HttpGetAsync(`{getSecureApiBaseUrl()}currency/balance`) - end) - if not success then - print("Get player balance failed because", errorCode) - return +-- more enum to int fun! +local function membershipTypeToNumber(membership) + if membership == Enum.MembershipType.None then + return 0 + elseif membership == Enum.MembershipType.BuildersClub then + return 1 + elseif membership == Enum.MembershipType.TurboBuildersClub then + return 2 + elseif membership == Enum.MembershipType.OutrageousBuildersClub then + return 3 end - if playerBalance == "" then - return - end - - playerBalance = getRbxUtility().DecodeJSON(playerBalance) - - return playerBalance + return -1 end -- should open an external default browser window to this url -function openBuyCurrencyWindow() +local function openBuyCurrencyWindow() checkingPlayerFunds = true GuiService:OpenBrowserWindow(`{baseUrl}Upgrades/Robux.aspx`) end -function openBCUpSellWindow() - GuiService:OpenBrowserWindow( - `{baseUrl}Upgrades/BuildersClubMemberships.aspx` - ) -end - -- set up the gui text at the bottom of the prompt (alerts user to how much money they will have left, or if they need to buy more to buy the item) -function updateAfterBalanceText(playerBalance, notRightBc) +local function updateAfterBalanceText(playerBalance, notRightBc) if isFreeItem() then purchaseDialog.BodyFrame.AfterBalanceButton.Text = freeItemBalanceText return true, false @@ -722,33 +435,61 @@ function updateAfterBalanceText(playerBalance, notRightBc) return true, false end -function isFreeItem() - -- if both of these are true, then the item is free, just prompt user if they want to take one - return currentProductInfo - and currentProductInfo.IsForSale == true - and currentProductInfo.IsPublicDomain == true -end ----------------------------------------------- End Currency Functions --------------------------------------------- - ----------------------------------------------- Data Functions ----------------------------------------------------- - --- more enum to int fun! -local function membershipTypeToNumber(membership) - if membership == Enum.MembershipType.None then - return 0 - elseif membership == Enum.MembershipType.BuildersClub then - return 1 - elseif membership == Enum.MembershipType.TurboBuildersClub then - return 2 - elseif membership == Enum.MembershipType.OutrageousBuildersClub then - return 3 +-- will get the player's balance of robux and tix, return in a table +local function getPlayerBalance() + local playerBalance + local success, errorCode = ypcall(function() + playerBalance = + game:HttpGetAsync(`{getSecureApiBaseUrl()}currency/balance`) + end) + if not success then + print("Get player balance failed because", errorCode) + return end - return -1 + if playerBalance == "" then + return + end + + playerBalance = getRbxUtility().DecodeJSON(playerBalance) + + return playerBalance +end + +-- figure out what currency to use based on the currency you can actually sell the item in and what the script specified +local function setCurrencyAmountAndType(priceInRobux, priceInTix) + if + currentCurrencyType == Enum.CurrencyType.Default + or currentCurrencyType == Enum.CurrencyType.Robux + then -- sell for default (user doesn't care) or robux + if priceInRobux ~= nil and priceInRobux ~= 0 then -- we can sell for robux + currentCurrencyAmount = priceInRobux + currentCurrencyType = Enum.CurrencyType.Robux + else -- have to use tix + currentCurrencyAmount = priceInTix + currentCurrencyType = Enum.CurrencyType.Tix + end + elseif currentCurrencyType == Enum.CurrencyType.Tix then -- we want to sell for tix + if priceInTix ~= nil and priceInTix ~= 0 then -- we can sell for tix + currentCurrencyAmount = priceInTix + currentCurrencyType = Enum.CurrencyType.Tix + else -- have to use robux + currentCurrencyAmount = priceInRobux + currentCurrencyType = Enum.CurrencyType.Robux + end + else + return false + end + + if currentCurrencyAmount == nil then + return false + end + + return true end -- This functions checks to make sure the purchase is even possible, if not it returns false and we don't prompt user (some situations require user feedback when we won't prompt) -function canPurchaseItem() +local function canPurchaseItem() -- first we see if player already owns the asset/get the productinfo local playerOwnsAsset = false local notRightBc = false @@ -895,30 +636,186 @@ function canPurchaseItem() return true, insufficientFunds end --- function computeSpaceString(pLabel) --- local nString = " " --- local tempSpaceLabel = Instance.new "TextButton" --- tempSpaceLabel.Size = --- UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y) --- tempSpaceLabel.FontSize = pLabel.FontSize --- tempSpaceLabel.Parent = pLabel.Parent --- tempSpaceLabel.BackgroundTransparency = 1 --- tempSpaceLabel.Text = nString --- tempSpaceLabel.Name = "SpaceButton" +local function doPlayerFundsCheck(checkIndefinitely) + if checkingPlayerFunds then + local canPurchase, insufficientFunds = canPurchaseItem() -- check again to see if we can buy item + if canPurchase and insufficientFunds then -- wait a bit and try a few more times + local retries = 1000 + while + (retries > 0 or checkIndefinitely) + and insufficientFunds + and checkingPlayerFunds + and canPurchase + do + wait(0.1) + canPurchase, insufficientFunds = canPurchaseItem() + retries -= 1 + end + end + if canPurchase and not insufficientFunds then + -- we can buy item! set our buttons up and we will exit this loop + setButtonsVisible( + purchaseDialog.BodyFrame.BuyButton, + purchaseDialog.BodyFrame.CancelButton, + purchaseDialog.BodyFrame.AfterBalanceButton + ) + end + end +end --- while tempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do --- nString ..= " " --- tempSpaceLabel.Text = nString --- end --- nString ..= " " --- tempSpaceLabel.Text = "" --- return nString --- end +local function openBCUpSellWindow() + GuiService:OpenBrowserWindow( + `{baseUrl}Upgrades/BuildersClubMemberships.aspx` + ) +end ----------------------------------------------- End Data Functions ----------------------------------------------------- +-- user pressed the cancel button, just remove all purchasing prompts ----------------------------------------------- Gui Functions ---------------------------------------------- -function startSpinner() +local function showPurchasePrompt() + local canPurchase, insufficientFunds, notRightBC, override, descText = + canPurchaseItem() + + if canPurchase then + updatePurchasePromptData() + + if override and descText then + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = descText + purchaseDialog.BodyFrame.AfterBalanceButton.Visible = false + end + game.GuiService:AddCenterDialog( + purchaseDialog, + Enum.CenterDialogType.ModalDialog, + --ShowFunction + function() + -- set the state for our buttons + purchaseDialog.Visible = true + if isFreeItem() then + setButtonsVisible( + purchaseDialog.BodyFrame.FreeButton, + purchaseDialog.BodyFrame.CancelButton, + purchaseDialog.BodyFrame.AfterBalanceButton + ) + elseif notRightBC then + purchaseDialog.BodyFrame.AfterBalanceButton.Text = + "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade." + if not openBCUpSellWindowConnection then + openBCUpSellWindowConnection = purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect( + function() + if + purchaseDialog.BodyFrame.AfterBalanceButton.Text + == "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade." + then + openBCUpSellWindow() + end + end + ) + end + setButtonsVisible( + purchaseDialog.BodyFrame.BuyDisabledButton, + purchaseDialog.BodyFrame.CancelButton, + purchaseDialog.BodyFrame.AfterBalanceButton + ) + elseif insufficientFunds then + setButtonsVisible( + purchaseDialog.BodyFrame.BuyDisabledButton, + purchaseDialog.BodyFrame.CancelButton, + purchaseDialog.BodyFrame.AfterBalanceButton + ) + elseif override then + setButtonsVisible( + purchaseDialog.BodyFrame.BuyDisabledButton, + purchaseDialog.BodyFrame.CancelButton + ) -- , purchaseDialog.BodyFrame.AfterBalanceButton) + else + setButtonsVisible( + purchaseDialog.BodyFrame.BuyButton, + purchaseDialog.BodyFrame.CancelButton + ) -- , purchaseDialog.BodyFrame.AfterBalanceButton) + end + + purchaseDialog:TweenPosition( + showPosition, + Enum.EasingDirection.Out, + Enum.EasingStyle.Quad, + tweenTime, + true + ) + + if + canPurchase + and insufficientFunds + and not enableBrowserWindowClosedEvent + then + checkingPlayerFunds = true + doPlayerFundsCheck(true) + end + end, + --HideFunction + function() + purchaseDialog.Visible = false + end + ) + else -- we failed in prompting a purchase, do a decline + userPurchaseActionsEnded(false) + end +end + +-- given an asset id, this function will grab that asset from the website, and return the first "Tool" object found inside it +local function getToolAssetID(assetID) + local newTool = game:GetService("InsertService"):LoadAsset(assetID) + if not newTool then + return nil + end + + if newTool:IsA "Tool" then + return newTool + end + + local toolChildren = newTool:GetChildren() + for i = 1, #toolChildren do + if toolChildren[i]:IsA "Tool" then + return toolChildren[i] + end + end + return nil +end + +-- the user tried to purchase by clicking the purchase button, but something went wrong. +-- let them know their account was not charged, and that they do not own the item yet. +local function purchaseFailed(inGamePurchasesDisabled) + local name = "Item" + if currentProductInfo then + name = currentProductInfo.Name + end + + local newPurchasedFailedText = + string.gsub(purchaseFailedText, "itemName", tostring(name)) + if inGamePurchasesDisabled then + newPurchasedFailedText = string.gsub( + newPurchasedFailedText, + "errorReason", + tostring(errorPurchasesDisabledText) + ) + else + newPurchasedFailedText = string.gsub( + newPurchasedFailedText, + "errorReason", + tostring(errorPurchasesUnknownText) + ) + end + + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newPurchasedFailedText + purchaseDialog.BodyFrame.ItemPreview.Image = errorImageUrl + + setButtonsVisible(purchaseDialog.BodyFrame.OkButton) + + setHeaderText(buyFailedHeaderText) + + hidePurchasing() +end + +local function startSpinner() spinning = true Spawn(function() local spinPos = 0 @@ -927,11 +824,9 @@ function startSpinner() while pos < 8 do if pos == spinPos or pos == ((spinPos + 1) % 8) then - spinnerIcons[pos + 1].Image = - "http://banland.xyz/Asset/?id=45880668" + spinnerIcons[pos + 1].Image = assetUrl(45880668) else - spinnerIcons[pos + 1].Image = - "http://banland.xyz/Asset/?id=45880710" + spinnerIcons[pos + 1].Image = assetUrl(45880710) end pos += 1 @@ -942,31 +837,120 @@ function startSpinner() end) end -function stopSpinner() - spinning = false -end +-- user has specified they want to buy an item, now try to attempt to buy it for them +local function acceptPurchase() + -- shows a purchasing ui (shows spinner) + startSpinner() + purchaseDialog.PurchasingFrame.Visible = true --- convenience method to say exactly what buttons should be visible (all others are not!) -function setButtonsVisible(...) - local args = { ... } - local argCount = select("#", ...) + local startTime = tick() - local bodyFrameChildren = purchaseDialog.BodyFrame:GetChildren() - for i = 1, #bodyFrameChildren do - if bodyFrameChildren[i]:IsA "GuiButton" then - bodyFrameChildren[i].Visible = false - for j = 1, argCount do - if bodyFrameChildren[i] == args[j] then - bodyFrameChildren[i].Visible = true - break - end + -- http call to do the purchase + local response = "none" + local url = `{getSecureApiBaseUrl()}marketplace/` + + local currencyData = `¤cyTypeId={currencyEnumToInt( + currentCurrencyType + )}¤cyTypeId={currencyEnumToInt( + currentCurrencyType + )}` + + -- consumables need to use a different url + if purchasingConsumable then + url ..= `submitpurchase?productId={currentProductId}{currencyData}&expectedUnitPrice={currentCurrencyAmount}&placeId={Game.PlaceId}` + else + url ..= `purchase?productId={currentProductId}{currencyData}&purchasePrice={currentCurrencyAmount}&locationType=Game&locationId={Game.PlaceId}` + end + + local success, reason = ypcall(function() + response = game:HttpPostAsync(url, "RobloxPurchaseRequest") + end) + + -- debug output for us (found in the logs from local) + print( + "acceptPurchase success from ypcall is ", + success, + "reason is", + reason + ) + + if tick() - startTime < 1 then + wait(1) -- allow the purchasing waiting dialog to at least be readable (otherwise it might flash, looks bad)... + end + + -- check to make sure purchase actually happened on the web end + if response == "none" or response == nil or response == "" then + print( + "did not get a proper response from web on purchase of", + currentAssetId, + currentProductId + ) + purchaseFailed() + return + end + + -- parse our response, decide how to react + response = getRbxUtility().DecodeJSON(response) + + if response then + if response.success == false then + if response.status ~= "AlreadyOwned" then + print( + "web return response of fail on purchase of", + currentAssetId, + currentProductId + ) + purchaseFailed((response.status == "EconomyDisabled")) + return end end + else + print( + "web return response of non parsable JSON on purchase of", + currentAssetId + ) + purchaseFailed() + return + end + + -- check to see if this item was bought, and if we want to equip it (also need to make sure the asset type was gear) + if + currentEquipOnPurchase + and success + and currentAssetId + and tonumber(currentProductInfo.AssetTypeId) == 19 + then + local tool = getToolAssetID(tonumber(currentAssetId)) + if tool then + tool.Parent = game.Players.LocalPlayer.Backpack + end + end + + if purchasingConsumable then + if not response.receipt then + print( + "tried to buy productId, but no receipt returned. productId was", + currentProductId + ) + purchaseFailed() + return + end + MarketplaceService:SignalClientPurchaseSuccess( + tostring(response.receipt), + game.Players.LocalPlayer.userId, + currentProductId + ) + else + userPurchaseActionsEnded(success) end end +-------------------------------- End Accept/Decline Functions -------------------------------------- + +---------------------------------------------- Gui Functions ---------------------------------------------- + -- used for the "Purchasing..." frame -function createSpinner(size, position, parent) +local function createSpinner(size, position, parent) local spinnerFrame = Instance.new "Frame" spinnerFrame.Name = "Spinner" spinnerFrame.Size = size @@ -979,7 +963,7 @@ function createSpinner(size, position, parent) local spinnerNum = 1 while spinnerNum <= 8 do local spinnerImage = Instance.new "ImageLabel" - spinnerImage.Name = "Spinner" .. spinnerNum + spinnerImage.Name = `Spinner{spinnerNum}` spinnerImage.Size = UDim2.new(0, 16, 0, 16) spinnerImage.Position = UDim2.new( 0.5 + 0.3 * math.cos(math.rad(45 * spinnerNum)), @@ -989,7 +973,7 @@ function createSpinner(size, position, parent) ) spinnerImage.BackgroundTransparency = 1 spinnerImage.ZIndex = 10 - spinnerImage.Image = "http://banland.xyz/Asset/?id=45880710" + spinnerImage.Image = assetUrl(45880710) spinnerImage.Parent = spinnerFrame spinnerIcons[spinnerNum] = spinnerImage @@ -997,8 +981,65 @@ function createSpinner(size, position, parent) end end +local function userPurchaseProductActionsEnded(userIsClosingDialog) + checkingPlayerFunds = false + + if userIsClosingDialog then + closePurchasePrompt() + if currentServerResponseTable then + local isPurchased = false + if + tostring(currentServerResponseTable.isValid):lower() + == "true" + then + isPurchased = true + end + + MarketplaceService:SignalPromptProductPurchaseFinished( + tonumber(currentServerResponseTable.playerId), + tonumber(currentServerResponseTable.productId), + isPurchased + ) + else + print "Something went wrong, no currentServerResponseTable" + end + removeCurrentPurchaseInfo() + else + local newPurchasedSucceededText = string.gsub( + purchaseSucceededText, + "itemName", + tostring(currentProductInfo.Name) + ) + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newPurchasedSucceededText + setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton) + hidePurchasing() + end +end + +local function createImageButton(name) + local imageButton = Instance.new "ImageButton" + imageButton.Size = UDim2.new(0, 153, 0, 46) + imageButton.Name = name + return imageButton +end + +local function createTextObject(name, text, type, size) + local textLabel = Instance.new(type) + textLabel.Font = Enum.Font.ArialBold + textLabel.TextColor3 = Color3.new(217 / 255, 217 / 255, 217 / 255) + textLabel.TextWrapped = true + textLabel.Name = name + textLabel.Text = text + textLabel.BackgroundTransparency = 1 + textLabel.BorderSizePixel = 0 + textLabel.FontSize = size + + return textLabel +end + -- all the gui init. Would be nice if this didn't have to be a script -function createPurchasePromptGui() +local function createPurchasePromptGui() purchaseDialog = Instance.new "Frame" purchaseDialog.Name = "PurchaseFrame" purchaseDialog.Size = UDim2.new(0, 660, 0, 400) @@ -1056,7 +1097,10 @@ function createPurchasePromptGui() cancelButton.MouseLeave:connect(function() cancelButton.Image = cancelButtonImageUrl end) - cancelButton.MouseButton1Click:connect(doDeclinePurchase) + cancelButton.MouseButton1Click:connect(function() + -- user pressed the cancel button, just remove all purchasing prompts + userPurchaseActionsEnded(false) + end) local buyButton = createImageButton "BuyButton" buyButton.Position = @@ -1146,10 +1190,10 @@ function createPurchasePromptGui() end end) buyButton.MouseButton1Click:connect(function() - doAcceptPurchase(Enum.CurrencyType.Robux) + acceptPurchase() end) freeButton.MouseButton1Click:connect(function() - doAcceptPurchase(false) + acceptPurchase() end) local itemPreview = Instance.new "ImageLabel" @@ -1214,44 +1258,10 @@ function createPurchasePromptGui() end -- next two functions control the "Purchasing..." overlay -function showPurchasing() - startSpinner() - purchaseDialog.PurchasingFrame.Visible = true -end - -function hidePurchasing() - purchaseDialog.PurchasingFrame.Visible = false - stopSpinner() -end -- next 2 functions are convenienvce creation functions for guis -function createTextObject(name, text, type, size) - local textLabel = Instance.new(type) - textLabel.Font = Enum.Font.ArialBold - textLabel.TextColor3 = Color3.new(217 / 255, 217 / 255, 217 / 255) - textLabel.TextWrapped = true - textLabel.Name = name - textLabel.Text = text - textLabel.BackgroundTransparency = 1 - textLabel.BorderSizePixel = 0 - textLabel.FontSize = size - return textLabel -end - -function createImageButton(name) - local imageButton = Instance.new "ImageButton" - imageButton.Size = UDim2.new(0, 153, 0, 46) - imageButton.Name = name - return imageButton -end - -function setHeaderText(text) - purchaseDialog.TitleLabel.Text = text - purchaseDialog.TitleBackdrop.Text = text -end - -function cutSizeInHalfRecursive(_) +local function cutSizeInHalfRecursive(_) -- todo: change the gui size based on how much space we have --[[changeSize(instance,0.5) @@ -1261,7 +1271,7 @@ function cutSizeInHalfRecursive(_) end]] end -function doubleSizeRecursive(_) +local function doubleSizeRecursive(_) -- todo: change the gui size based on how much space we have --[[changeSize(instance,2) @@ -1271,16 +1281,16 @@ function doubleSizeRecursive(_) end]] end -function modifyForSmallScreen() +local function modifyForSmallScreen() cutSizeInHalfRecursive(purchaseDialog) end -function modifyForLargeScreen() +local function modifyForLargeScreen() doubleSizeRecursive(purchaseDialog) end -- depending on screen size, we need to change the gui -function changeGuiToScreenSize(smallScreen) +local function changeGuiToScreenSize(smallScreen) if smallScreen then modifyForSmallScreen() else @@ -1288,7 +1298,7 @@ function changeGuiToScreenSize(smallScreen) end end -function doPurchasePrompt( +local function doPurchasePrompt( player, assetId, equipIfPurchased, @@ -1317,43 +1327,7 @@ function doPurchasePrompt( end end -function userPurchaseProductActionsEnded(userIsClosingDialog) - checkingPlayerFunds = false - - if userIsClosingDialog then - closePurchasePrompt() - if currentServerResponseTable then - local isPurchased = false - if - tostring(currentServerResponseTable.isValid):lower() - == "true" - then - isPurchased = true - end - - MarketplaceService:SignalPromptProductPurchaseFinished( - tonumber(currentServerResponseTable.playerId), - tonumber(currentServerResponseTable.productId), - isPurchased - ) - else - print "Something went wrong, no currentServerResponseTable" - end - removeCurrentPurchaseInfo() - else - local newPurchasedSucceededText = string.gsub( - purchaseSucceededText, - "itemName", - tostring(currentProductInfo.Name) - ) - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = - newPurchasedSucceededText - setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton) - hidePurchasing() - end -end - -function doProcessServerPurchaseResponse(serverResponseTable) +local function doProcessServerPurchaseResponse(serverResponseTable) if not serverResponseTable then print "Server response table was nil, cancelling purchase" purchaseFailed() diff --git a/luau/152908679.luau b/luau/152908679.luau deleted file mode 100644 index fd46075..0000000 --- a/luau/152908679.luau +++ /dev/null @@ -1,314 +0,0 @@ --- CoreGui.RobloxGui.CoreScripts/ContextActionTouch --- Unused by Mercury -print "[Mercury]: Loaded corescript 152908679" -for _ = 1, 4 do - pcall(function() - warn "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS" - end) - print "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS" -end - --- ContextActionTouch.lua --- this script controls ui and firing of lua functions that are bound in ContextActionService for touch inputs --- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this - --- Variables -local contextActionService = Game:GetService "ContextActionService" -local isTouchDevice = Game:GetService("UserInputService").TouchEnabled -local functionTable = {} -local buttonVector = {} -local buttonScreenGui, buttonFrame - -local ContextDownImage = "http://banland.xyz/asset/?id=97166756" -local ContextUpImage = "http://banland.xyz/asset/?id=97166444" - -local oldTouches = {} - -local buttonPositionTable = { - [1] = UDim2.new(0, 123, 0, 70), - [2] = UDim2.new(0, 30, 0, 60), - [3] = UDim2.new(0, 180, 0, 160), - [4] = UDim2.new(0, 85, 0, -25), - [5] = UDim2.new(0, 185, 0, -25), - [6] = UDim2.new(0, 185, 0, 260), - [7] = UDim2.new(0, 216, 0, 65), -} -local maxButtons = #buttonPositionTable - --- Preload images -Game:GetService("ContentProvider"):Preload(ContextDownImage) -Game:GetService("ContentProvider"):Preload(ContextUpImage) - -while not Game.Players do - wait() -end - -while not Game.Players.LocalPlayer do - wait() -end - -function createContextActionGui() - if not buttonScreenGui and isTouchDevice then - buttonScreenGui = Instance.new "ScreenGui" - buttonScreenGui.Name = "ContextActionGui" - - buttonFrame = Instance.new "Frame" - buttonFrame.BackgroundTransparency = 1 - buttonFrame.Size = UDim2.new(0.3, 0, 0.5, 0) - buttonFrame.Position = UDim2.new(0.7, 0, 0.5, 0) - buttonFrame.Name = "ContextButtonFrame" - buttonFrame.Parent = buttonScreenGui - end -end - --- functions --- function setButtonSizeAndPosition(object) --- local buttonSize = 55 --- local xOffset = 10 --- local yOffset = 95 - --- -- todo: better way to determine mobile sized screens --- local onSmallScreen = (game.CoreGui.RobloxGui.AbsoluteSize.X < 600) --- if not onSmallScreen then --- buttonSize = 85 --- xOffset = 40 --- end - --- object.Size = UDim2.new(0, buttonSize, 0, buttonSize) --- end - -function contextButtonDown(button, inputObject, actionName) - if inputObject.UserInputType == Enum.UserInputType.Touch then - button.Image = ContextDownImage - contextActionService:CallFunction( - actionName, - Enum.UserInputState.Begin, - inputObject - ) - end -end - -function contextButtonMoved(button, inputObject, actionName) - if inputObject.UserInputType == Enum.UserInputType.Touch then - button.Image = ContextDownImage - contextActionService:CallFunction( - actionName, - Enum.UserInputState.Change, - inputObject - ) - end -end - -function contextButtonUp(button, inputObject, actionName) - button.Image = ContextUpImage - if - inputObject.UserInputType == Enum.UserInputType.Touch - and inputObject.UserInputState == Enum.UserInputState.End - then - contextActionService:CallFunction( - actionName, - Enum.UserInputState.End, - inputObject - ) - end -end - -function isSmallScreenDevice() - return Game:GetService("GuiService"):GetScreenResolution().y <= 320 -end - -function createNewButton(actionName, functionInfoTable) - local contextButton = Instance.new "ImageButton" - contextButton.Name = "ContextActionButton" - contextButton.BackgroundTransparency = 1 - contextButton.Size = UDim2.new(0, 90, 0, 90) - contextButton.Active = true - if isSmallScreenDevice() then - contextButton.Size = UDim2.new(0, 70, 0, 70) - end - contextButton.Image = ContextUpImage - contextButton.Parent = buttonFrame - - local currentButtonTouch - - Game:GetService("UserInputService").InputEnded:connect(function(inputObject) - oldTouches[inputObject] = nil - end) - contextButton.InputBegan:connect(function(inputObject) - if oldTouches[inputObject] then - return - end - - if - inputObject.UserInputState == Enum.UserInputState.Begin - and currentButtonTouch == nil - then - currentButtonTouch = inputObject - contextButtonDown(contextButton, inputObject, actionName) - end - end) - contextButton.InputChanged:connect(function(inputObject) - if oldTouches[inputObject] then - return - end - if currentButtonTouch ~= inputObject then - return - end - - contextButtonMoved(contextButton, inputObject, actionName) - end) - contextButton.InputEnded:connect(function(inputObject) - if oldTouches[inputObject] then - return - end - if currentButtonTouch ~= inputObject then - return - end - - currentButtonTouch = nil - oldTouches[inputObject] = true - contextButtonUp(contextButton, inputObject, actionName) - end) - - local actionIcon = Instance.new "ImageLabel" - actionIcon.Name = "ActionIcon" - actionIcon.Position = UDim2.new(0.175, 0, 0.175, 0) - actionIcon.Size = UDim2.new(0.65, 0, 0.65, 0) - actionIcon.BackgroundTransparency = 1 - if - functionInfoTable.image - and type(functionInfoTable.image) == "string" - then - actionIcon.Image = functionInfoTable.image - end - actionIcon.Parent = contextButton - - local actionTitle = Instance.new "TextLabel" - actionTitle.Name = "ActionTitle" - actionTitle.Size = UDim2.new(1, 0, 1, 0) - actionTitle.BackgroundTransparency = 1 - actionTitle.Font = Enum.Font.SourceSansBold - actionTitle.TextColor3 = Color3.new(1, 1, 1) - actionTitle.TextStrokeTransparency = 0 - actionTitle.FontSize = Enum.FontSize.Size18 - actionTitle.TextWrapped = true - actionTitle.Text = "" - if - functionInfoTable.title - and type(functionInfoTable.title) == "string" - then - actionTitle.Text = functionInfoTable.title - end - actionTitle.Parent = contextButton - - return contextButton -end - -function createButton(actionName, functionInfoTable) - local button = createNewButton(actionName, functionInfoTable) - - local position - for i = 1, #buttonVector do - if buttonVector[i] == "empty" then - position = i - break - end - end - - if not position then - position = #buttonVector + 1 - end - - if position > maxButtons then - return -- todo: let user know we have too many buttons already? - end - - buttonVector[position] = button - functionTable[actionName]["button"] = button - - button.Position = buttonPositionTable[position] - button.Parent = buttonFrame - - if buttonScreenGui and buttonScreenGui.Parent == nil then - buttonScreenGui.Parent = Game.Players.LocalPlayer.PlayerGui - end -end - -function removeAction(actionName) - if not functionTable[actionName] then - return - end - - local actionButton = functionTable[actionName]["button"] - - if actionButton then - actionButton.Parent = nil - - for i = 1, #buttonVector do - if buttonVector[i] == actionButton then - buttonVector[i] = "empty" - break - end - end - - actionButton:Destroy() - end - - functionTable[actionName] = nil -end - -function addAction(actionName, createTouchButton, functionInfoTable) - if functionTable[actionName] then - removeAction(actionName) - end - functionTable[actionName] = { functionInfoTable } - if createTouchButton and isTouchDevice then - createContextActionGui() - createButton(actionName, functionInfoTable) - end -end - --- Connections -contextActionService.BoundActionChanged:connect( - function(actionName, changeName, changeTable) - if functionTable[actionName] and changeTable then - local button = functionTable[actionName]["button"] - if button then - if changeName == "image" then - button.ActionIcon.Image = changeTable[changeName] - elseif changeName == "title" then - button.ActionTitle.Text = changeTable[changeName] - -- elseif changeName == "description" then - -- -- todo: add description to menu - elseif changeName == "position" then - button.Position = changeTable[changeName] - end - end - end - end -) - -contextActionService.BoundActionAdded:connect( - function(actionName, createTouchButton, functionInfoTable) - addAction(actionName, createTouchButton, functionInfoTable) - end -) - -contextActionService.BoundActionRemoved:connect(function(actionName, _) - removeAction(actionName) -end) - -contextActionService.GetActionButtonEvent:connect(function(actionName) - if functionTable[actionName] then - contextActionService:FireActionButtonFoundSignal( - actionName, - functionTable[actionName]["button"] - ) - end -end) - --- make sure any bound data before we setup connections is handled -local boundActions = contextActionService:GetAllBoundActionInfo() -for actionName, actionData in pairs(boundActions) do - addAction(actionName, actionData.createTouchButton, actionData) -end diff --git a/luau/153556783.luau b/luau/153556783.luau deleted file mode 100644 index 0bbff0a..0000000 --- a/luau/153556783.luau +++ /dev/null @@ -1,773 +0,0 @@ --- CoreGui.RobloxGui.CoreScripts/TouchControls --- Unused by Mercury -print "[Mercury]: Loaded corescript 153556783" -for _ = 1, 4 do - pcall(function() - warn "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS" - end) - print "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS" -end - --- This is responsible for all touch controls we show (as of this writing, only on iOS) --- this includes character move thumbsticks, and buttons for jump, use of items, camera, etc. - --- obligatory stuff to make sure we don't access nil data -while not Game do - wait() -end -while not Game:FindFirstChild "Players" do - wait() -end -while not Game.Players.LocalPlayer do - wait() -end -while not Game:FindFirstChild "CoreGui" do - wait() -end -while not Game.CoreGui:FindFirstChild "RobloxGui" do - wait() -end - -local userInputService = Game:GetService "UserInputService" -local success = pcall(function() - userInputService:IsLuaTouchControls() -end) -if not success then - script:Destroy() -end - ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- --- Variables -local screenResolution = Game:GetService("GuiService"):GetScreenResolution() -function isSmallScreenDevice() - return screenResolution.y <= 320 -end - -local localPlayer = Game.Players.LocalPlayer -local thumbstickSize = 120 -if isSmallScreenDevice() then - thumbstickSize = 70 -end - -local touchControlsSheet = "rbxasset://textures/ui/TouchControlsSheet.png" -local ThumbstickDeadZone = 5 -local ThumbstickMaxPercentGive = 0.92 -local thumbstickTouches = {} - -local jumpButtonSize = 90 -if isSmallScreenDevice() then - jumpButtonSize = 70 -end -local oldJumpTouches = {} -local currentJumpTouch - -local CameraRotateSensitivity = 0.007 -local CameraRotateDeadZone = CameraRotateSensitivity * 16 -local CameraZoomSensitivity = 0.03 -local PinchZoomDelay = 0.2 -local cameraTouch - --- make sure all of our images are good to go -Game:GetService("ContentProvider"):Preload(touchControlsSheet) - ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- --- Functions - -function DistanceBetweenTwoPoints(point1, point2) - local dx = point2.x - point1.x - local dy = point2.y - point1.y - return math.sqrt((dx * dx) + (dy * dy)) -end - -function transformFromCenterToTopLeft(pointToTranslate, guiObject) - return UDim2.new( - 0, - pointToTranslate.x - guiObject.AbsoluteSize.x / 2, - 0, - pointToTranslate.y - guiObject.AbsoluteSize.y / 2 - ) -end - -function rotatePointAboutLocation(pointToRotate, pointToRotateAbout, radians) - local sinAnglePercent = math.sin(radians) - local cosAnglePercent = math.cos(radians) - - local transformedPoint = pointToRotate - - -- translate point back to origin: - transformedPoint = Vector2.new( - transformedPoint.x - pointToRotateAbout.x, - transformedPoint.y - pointToRotateAbout.y - ) - - -- rotate point - local xNew = transformedPoint.x * cosAnglePercent - - transformedPoint.y * sinAnglePercent - local yNew = transformedPoint.x * sinAnglePercent - + transformedPoint.y * cosAnglePercent - - -- translate point back: - transformedPoint = - Vector2.new(xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y) - - return transformedPoint -end - -function dotProduct(v1, v2) - return ((v1.x * v2.x) + (v1.y * v2.y)) -end - -function stationaryThumbstickTouchMove( - thumbstickFrame, - thumbstickOuter, - touchLocation -) - local thumbstickOuterCenterPosition = Vector2.new( - thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2, - thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2 - ) - local centerDiff = - DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenterPosition) - - -- thumbstick is moving outside our region, need to cap its distance - if centerDiff > (thumbstickSize / 2) then - local thumbVector = Vector2.new( - touchLocation.x - thumbstickOuterCenterPosition.x, - touchLocation.y - thumbstickOuterCenterPosition.y - ) - local normal = thumbVector.unit - if normal.x == math.nan or normal.x == math.inf then - normal = Vector2.new(0, normal.y) - end - if normal.y == math.nan or normal.y == math.inf then - normal = Vector2.new(normal.x, 0) - end - - local newThumbstickInnerPosition = thumbstickOuterCenterPosition - + (normal * (thumbstickSize / 2)) - thumbstickFrame.Position = transformFromCenterToTopLeft( - newThumbstickInnerPosition, - thumbstickFrame - ) - else - thumbstickFrame.Position = - transformFromCenterToTopLeft(touchLocation, thumbstickFrame) - end - - return Vector2.new( - thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset, - thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset - ) -end - -function followThumbstickTouchMove( - thumbstickFrame, - thumbstickOuter, - touchLocation -) - local thumbstickOuterCenter = Vector2.new( - thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2, - thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2 - ) - - -- thumbstick is moving outside our region, need to position outer thumbstick texture carefully (to make look and feel like actual joystick controller) - if - DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenter) - > thumbstickSize / 2 - then - local thumbstickInnerCenter = Vector2.new( - thumbstickFrame.Position.X.Offset - + thumbstickFrame.AbsoluteSize.x / 2, - thumbstickFrame.Position.Y.Offset - + thumbstickFrame.AbsoluteSize.y / 2 - ) - local movementVectorUnit = Vector2.new( - touchLocation.x - thumbstickInnerCenter.x, - touchLocation.y - thumbstickInnerCenter.y - ).unit - - local outerToInnerVectorCurrent = Vector2.new( - thumbstickInnerCenter.x - thumbstickOuterCenter.x, - thumbstickInnerCenter.y - thumbstickOuterCenter.y - ) - local outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit - local movementVector = Vector2.new( - touchLocation.x - thumbstickInnerCenter.x, - touchLocation.y - thumbstickInnerCenter.y - ) - - -- First, find the angle between the new thumbstick movement vector, - -- and the vector between thumbstick inner and thumbstick outer. - -- We will use this to pivot thumbstick outer around thumbstick inner, gives a nice joystick feel - local crossOuterToInnerWithMovement = ( - outerToInnerVectorCurrentUnit.x * movementVectorUnit.y - ) - (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x) - local angle = math.atan2( - crossOuterToInnerWithMovement, - dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit) - ) - local anglePercent = angle - * math.min( - movementVector.magnitude / outerToInnerVectorCurrent.magnitude, - 1.0 - ) - - -- If angle is significant, rotate about the inner thumbsticks current center - if math.abs(anglePercent) > 0.00001 then - local outerThumbCenter = rotatePointAboutLocation( - thumbstickOuterCenter, - thumbstickInnerCenter, - anglePercent - ) - thumbstickOuter.Position = transformFromCenterToTopLeft( - Vector2.new(outerThumbCenter.x, outerThumbCenter.y), - thumbstickOuter - ) - end - - -- now just translate outer thumbstick to make sure it stays nears inner thumbstick - thumbstickOuter.Position = UDim2.new( - 0, - thumbstickOuter.Position.X.Offset + movementVector.x, - 0, - thumbstickOuter.Position.Y.Offset + movementVector.y - ) - end - - thumbstickFrame.Position = - transformFromCenterToTopLeft(touchLocation, thumbstickFrame) - - -- a bit of error checking to make sure thumbsticks stay close to eachother - local thumbstickFramePosition = Vector2.new( - thumbstickFrame.Position.X.Offset, - thumbstickFrame.Position.Y.Offset - ) - local thumbstickOuterPosition = Vector2.new( - thumbstickOuter.Position.X.Offset, - thumbstickOuter.Position.Y.Offset - ) - if - DistanceBetweenTwoPoints( - thumbstickFramePosition, - thumbstickOuterPosition - ) > thumbstickSize / 2 - then - local vectorWithLength = ( - thumbstickOuterPosition - thumbstickFramePosition - ).unit * thumbstickSize / 2 - thumbstickOuter.Position = UDim2.new( - 0, - thumbstickFramePosition.x + vectorWithLength.x, - 0, - thumbstickFramePosition.y + vectorWithLength.y - ) - end - - return Vector2.new( - thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset, - thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset - ) -end - -function movementOutsideDeadZone(movementVector) - return ( - (math.abs(movementVector.x) > ThumbstickDeadZone) - or (math.abs(movementVector.y) > ThumbstickDeadZone) - ) -end - -function constructThumbstick( - defaultThumbstickPos, - updateFunction, - stationaryThumbstick -) - local thumbstickFrame = Instance.new "Frame" - thumbstickFrame.Name = "ThumbstickFrame" - thumbstickFrame.Active = true - thumbstickFrame.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize) - thumbstickFrame.Position = defaultThumbstickPos - thumbstickFrame.BackgroundTransparency = 1 - - local outerThumbstick = Instance.new "ImageLabel" - outerThumbstick.Name = "OuterThumbstick" - outerThumbstick.Image = touchControlsSheet - outerThumbstick.ImageRectOffset = Vector2.new(0, 0) - outerThumbstick.ImageRectSize = Vector2.new(220, 220) - outerThumbstick.BackgroundTransparency = 1 - outerThumbstick.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize) - outerThumbstick.Position = defaultThumbstickPos - outerThumbstick.Parent = Game.CoreGui.RobloxGui - - local innerThumbstick = Instance.new "ImageLabel" - innerThumbstick.Name = "InnerThumbstick" - innerThumbstick.Image = touchControlsSheet - innerThumbstick.ImageRectOffset = Vector2.new(220, 0) - innerThumbstick.ImageRectSize = Vector2.new(111, 111) - innerThumbstick.BackgroundTransparency = 1 - innerThumbstick.Size = - UDim2.new(0, thumbstickSize / 2, 0, thumbstickSize / 2) - innerThumbstick.Position = UDim2.new( - 0, - thumbstickFrame.Size.X.Offset / 2 - thumbstickSize / 4, - 0, - thumbstickFrame.Size.Y.Offset / 2 - thumbstickSize / 4 - ) - innerThumbstick.Parent = thumbstickFrame - innerThumbstick.ZIndex = 2 - - local thumbstickTouch - local userInputServiceTouchMovedCon - local userInputSeviceTouchEndedCon - - local startInputTracking = function(inputObject) - if thumbstickTouch then - return - end - if inputObject == cameraTouch then - return - end - if inputObject == currentJumpTouch then - return - end - if inputObject.UserInputType ~= Enum.UserInputType.Touch then - return - end - - thumbstickTouch = inputObject - table.insert(thumbstickTouches, thumbstickTouch) - - thumbstickFrame.Position = transformFromCenterToTopLeft( - thumbstickTouch.Position, - thumbstickFrame - ) - outerThumbstick.Position = thumbstickFrame.Position - - userInputServiceTouchMovedCon = userInputService.TouchMoved:connect( - function(movedInput) - if movedInput == thumbstickTouch then - local movementVector - if stationaryThumbstick then - movementVector = stationaryThumbstickTouchMove( - thumbstickFrame, - outerThumbstick, - Vector2.new( - movedInput.Position.x, - movedInput.Position.y - ) - ) - else - movementVector = followThumbstickTouchMove( - thumbstickFrame, - outerThumbstick, - Vector2.new( - movedInput.Position.x, - movedInput.Position.y - ) - ) - end - - if updateFunction then - updateFunction( - movementVector, - outerThumbstick.Size.X.Offset / 2 - ) - end - end - end - ) - userInputSeviceTouchEndedCon = userInputService.TouchEnded:connect( - function(endedInput) - if endedInput == thumbstickTouch then - if updateFunction then - updateFunction(Vector2.new(0, 0), 1) - end - - userInputSeviceTouchEndedCon:disconnect() - userInputServiceTouchMovedCon:disconnect() - - thumbstickFrame.Position = defaultThumbstickPos - outerThumbstick.Position = defaultThumbstickPos - - for i, object in pairs(thumbstickTouches) do - if object == thumbstickTouch then - table.remove(thumbstickTouches, i) - break - end - end - thumbstickTouch = nil - end - end - ) - end - - userInputService.Changed:connect(function(prop) - if prop == "ModalEnabled" then - thumbstickFrame.Visible = not userInputService.ModalEnabled - outerThumbstick.Visible = not userInputService.ModalEnabled - end - end) - - thumbstickFrame.InputBegan:connect(startInputTracking) - return thumbstickFrame -end - -function setupCharacterMovement(parentFrame) - local lastMovementVector, lastMaxMovement - local moveCharacterFunc = localPlayer.MoveCharacter - local moveCharacterFunction = function(movementVector, maxMovement) - if localPlayer then - if movementOutsideDeadZone(movementVector) then - lastMovementVector = movementVector - lastMaxMovement = maxMovement - -- sometimes rounding error will not allow us to go max speed at some - -- thumbstick angles, fix this with a bit of fudging near 100% throttle - if - movementVector.magnitude / maxMovement - > ThumbstickMaxPercentGive - then - maxMovement = movementVector.magnitude - 1 - end - moveCharacterFunc(localPlayer, movementVector, maxMovement) - else - lastMovementVector = Vector2.new(0, 0) - lastMaxMovement = 1 - moveCharacterFunc( - localPlayer, - lastMovementVector, - lastMaxMovement - ) - end - end - end - - local thumbstickPos = - UDim2.new(0, thumbstickSize / 2, 1, -thumbstickSize * 1.75) - if isSmallScreenDevice() then - thumbstickPos = - UDim2.new(0, (thumbstickSize / 2) - 10, 1, -thumbstickSize - 20) - end - local characterThumbstick = - constructThumbstick(thumbstickPos, moveCharacterFunction, false) - characterThumbstick.Name = "CharacterThumbstick" - characterThumbstick.Parent = parentFrame - - local refreshCharacterMovement = function() - if - localPlayer - and moveCharacterFunc - and lastMovementVector - and lastMaxMovement - then - moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement) - end - end - return refreshCharacterMovement -end - -function setupJumpButton(parentFrame) - local jumpButton = Instance.new "ImageButton" - jumpButton.Name = "JumpButton" - jumpButton.BackgroundTransparency = 1 - jumpButton.Image = touchControlsSheet - jumpButton.ImageRectOffset = Vector2.new(176, 222) - jumpButton.ImageRectSize = Vector2.new(174, 174) - jumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize) - if isSmallScreenDevice() then - jumpButton.Position = - UDim2.new(1, -(jumpButtonSize * 2.25), 1, -jumpButtonSize - 20) - else - jumpButton.Position = - UDim2.new(1, -(jumpButtonSize * 2.75), 1, -jumpButtonSize - 120) - end - - local playerJumpFunc = localPlayer.JumpCharacter - - local doJumpLoop = function() - while currentJumpTouch do - if localPlayer then - playerJumpFunc(localPlayer) - end - wait(1 / 60) - end - end - - jumpButton.InputBegan:connect(function(inputObject) - if inputObject.UserInputType ~= Enum.UserInputType.Touch then - return - end - if currentJumpTouch then - return - end - if inputObject == cameraTouch then - return - end - for _, touch in pairs(oldJumpTouches) do - if touch == inputObject then - return - end - end - - currentJumpTouch = inputObject - jumpButton.ImageRectOffset = Vector2.new(0, 222) - jumpButton.ImageRectSize = Vector2.new(174, 174) - doJumpLoop() - end) - jumpButton.InputEnded:connect(function(inputObject) - if inputObject.UserInputType ~= Enum.UserInputType.Touch then - return - end - - jumpButton.ImageRectOffset = Vector2.new(176, 222) - jumpButton.ImageRectSize = Vector2.new(174, 174) - - if inputObject == currentJumpTouch then - table.insert(oldJumpTouches, currentJumpTouch) - currentJumpTouch = nil - end - end) - userInputService.InputEnded:connect(function(globalInputObject) - for i, touch in pairs(oldJumpTouches) do - if touch == globalInputObject then - table.remove(oldJumpTouches, i) - break - end - end - end) - - userInputService.Changed:connect(function(prop) - if prop == "ModalEnabled" then - jumpButton.Visible = not userInputService.ModalEnabled - end - end) - - jumpButton.Parent = parentFrame -end - -function isTouchUsedByJumpButton(touch) - if touch == currentJumpTouch then - return true - end - for _, touchToCompare in pairs(oldJumpTouches) do - if touch == touchToCompare then - return true - end - end - - return false -end - -function isTouchUsedByThumbstick(touch) - for _, touchToCompare in pairs(thumbstickTouches) do - if touch == touchToCompare then - return true - end - end - - return false -end - -function setupCameraControl(parentFrame, refreshCharacterMoveFunc) - local lastPos - local hasRotatedCamera = false - local rotateCameraFunc = userInputService.RotateCamera - - local pinchTime = -1 - local shouldPinch = false - local lastPinchScale - local zoomCameraFunc = userInputService.ZoomCamera - local pinchTouches = {} - local pinchFrame - - local resetCameraRotateState = function() - cameraTouch = nil - hasRotatedCamera = false - lastPos = nil - end - - local resetPinchState = function() - pinchTouches = {} - lastPinchScale = nil - shouldPinch = false - pinchFrame:Destroy() - pinchFrame = nil - end - - local startPinch = function(firstTouch, secondTouch) - -- track pinching in new frame - if pinchFrame then - pinchFrame:Destroy() - end -- make sure we didn't track in any mud - pinchFrame = Instance.new "Frame" - pinchFrame.Name = "PinchFrame" - pinchFrame.BackgroundTransparency = 1 - pinchFrame.Parent = parentFrame - pinchFrame.Size = UDim2.new(1, 0, 1, 0) - - pinchFrame.InputChanged:connect(function(inputObject) - if not shouldPinch then - resetPinchState() - return - end - resetCameraRotateState() - - if lastPinchScale == nil then -- first pinch move, just set up scale - if inputObject == firstTouch then - lastPinchScale = ( - inputObject.Position - secondTouch.Position - ).magnitude - firstTouch = inputObject - elseif inputObject == secondTouch then - lastPinchScale = ( - inputObject.Position - firstTouch.Position - ).magnitude - secondTouch = inputObject - end - else -- we are now actually pinching, do comparison to last pinch size - local newPinchDistance = 0 - if inputObject == firstTouch then - newPinchDistance = ( - inputObject.Position - secondTouch.Position - ).magnitude - firstTouch = inputObject - elseif inputObject == secondTouch then - newPinchDistance = ( - inputObject.Position - firstTouch.Position - ).magnitude - secondTouch = inputObject - end - if newPinchDistance ~= 0 then - local pinchDiff = newPinchDistance - lastPinchScale - if pinchDiff ~= 0 then - zoomCameraFunc( - userInputService, - (pinchDiff * CameraZoomSensitivity) - ) - end - lastPinchScale = newPinchDistance - end - end - end) - pinchFrame.InputEnded:connect( - function(inputObject) -- pinch is over, destroy all - if inputObject == firstTouch or inputObject == secondTouch then - resetPinchState() - end - end - ) - end - - local pinchGestureReceivedTouch = function(inputObject) - if #pinchTouches < 1 then - table.insert(pinchTouches, inputObject) - pinchTime = tick() - shouldPinch = false - elseif #pinchTouches == 1 then - shouldPinch = ((tick() - pinchTime) <= PinchZoomDelay) - - if shouldPinch then - table.insert(pinchTouches, inputObject) - startPinch(pinchTouches[1], pinchTouches[2]) - else -- shouldn't ever get here, but just in case - pinchTouches = {} - end - end - end - - parentFrame.InputBegan:connect(function(inputObject) - if inputObject.UserInputType ~= Enum.UserInputType.Touch then - return - end - if isTouchUsedByJumpButton(inputObject) then - return - end - - local usedByThumbstick = isTouchUsedByThumbstick(inputObject) - if not usedByThumbstick then - pinchGestureReceivedTouch(inputObject) - end - - if cameraTouch == nil and not usedByThumbstick then - cameraTouch = inputObject - lastPos = - Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y) - -- lastTick = tick() - end - end) - userInputService.InputChanged:connect(function(inputObject) - if inputObject.UserInputType ~= Enum.UserInputType.Touch then - return - end - if cameraTouch ~= inputObject then - return - end - - local newPos = - Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y) - local touchDiff = (lastPos - newPos) * CameraRotateSensitivity - - -- first time rotating outside deadzone, just setup for next changed event - if - not hasRotatedCamera - and (touchDiff.magnitude > CameraRotateDeadZone) - then - hasRotatedCamera = true - lastPos = newPos - end - - -- fire everytime after we have rotated out of deadzone - if hasRotatedCamera and (lastPos ~= newPos) then - rotateCameraFunc(userInputService, touchDiff) - refreshCharacterMoveFunc() - lastPos = newPos - end - end) - userInputService.InputEnded:connect(function(inputObject) - if cameraTouch == inputObject or cameraTouch == nil then - resetCameraRotateState() - end - - for i, touch in pairs(pinchTouches) do - if touch == inputObject then - table.remove(pinchTouches, i) - end - end - end) -end - -function setupTouchControls() - local touchControlFrame = Instance.new "Frame" - touchControlFrame.Name = "TouchControlFrame" - touchControlFrame.Size = UDim2.new(1, 0, 1, 0) - touchControlFrame.BackgroundTransparency = 1 - touchControlFrame.Parent = Game.CoreGui.RobloxGui - - local refreshCharacterMoveFunc = setupCharacterMovement(touchControlFrame) - setupJumpButton(touchControlFrame) - setupCameraControl(touchControlFrame, refreshCharacterMoveFunc) - - userInputService.ProcessedEvent:connect(function(inputObject, processed) - if not processed then - return - end - - -- kill camera pan if the touch is used by some user controls - if - inputObject == cameraTouch - and inputObject.UserInputState == Enum.UserInputState.Begin - then - cameraTouch = nil - end - end) -end - ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- --- Start of Script - -if true then --userInputService:IsLuaTouchControls() then - setupTouchControls() -else - script:Destroy() -end diff --git a/luau/157877000.luau b/luau/157877000.luau index 63666c1..38f57d5 100644 --- a/luau/157877000.luau +++ b/luau/157877000.luau @@ -267,7 +267,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 0, 0.5, -8), Rotation = 180, Size = UDim2.new(1, 0, 0, 16), - Image = "http://banland.xyz/Asset?id=151205881", + Image = "https://banland.xyz/Asset?id=151205881", } local Dev_DownButton = Create "ImageButton" { @@ -286,7 +286,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 3, 0, 3), Size = UDim2.new(0, 14, 0, 14), Rotation = 180, - Image = "http://banland.xyz/Asset?id=151205813", + Image = "https://banland.xyz/Asset?id=151205813", } local Dev_UpButton = Create "ImageButton" { @@ -304,7 +304,7 @@ function initializeDeveloperConsole() BackgroundTransparency = 1, Position = UDim2.new(0, 3, 0, 3), Size = UDim2.new(0, 14, 0, 14), - Image = "http://banland.xyz/Asset?id=151205813", + Image = "https://banland.xyz/Asset?id=151205813", } local Dev_TextBox = Create "Frame" { @@ -341,7 +341,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(1, 0, 1, 0), Rotation = 0, - Image = "http://banland.xyz/Asset?id=152093917", + Image = "https://banland.xyz/Asset?id=152093917", } local Dev_ResizeButton = Create "ImageButton" { @@ -360,7 +360,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 6, 0, 6), Size = UDim2.new(0.8, 0, 0.8, 0), Rotation = 135, - Image = "http://banland.xyz/Asset?id=151205813", + Image = "https://banland.xyz/Asset?id=151205813", } Create "TextButton" { @@ -415,7 +415,7 @@ function initializeDeveloperConsole() BackgroundTransparency = 1, Position = UDim2.new(0, 3, 0, 3), Size = UDim2.new(0, 14, 0, 14), - Image = "http://banland.xyz/Asset?id=151205852", + Image = "https://banland.xyz/Asset?id=151205852", } Create "TextButton" { @@ -864,8 +864,6 @@ function initializeDeveloperConsole() return (num < 10 and "0" or "") .. num end - local str = "%s:%s:%s" - local function ConvertTimeStamp(timeStamp) local localTime = timeStamp - os.time() + math.floor(tick()) local dayTime = localTime % 86400 @@ -881,7 +879,7 @@ function initializeDeveloperConsole() local m = numberWithZero(minute) local s = numberWithZero(dayTime) - return str:format(h, m, s) + return `{h}{m}{s}` end --Filter diff --git a/luau/37801172.luau b/luau/37801172.luau index c72f26f..e1c470c 100644 --- a/luau/37801172.luau +++ b/luau/37801172.luau @@ -6,11 +6,6 @@ local scriptContext = game:GetService "ScriptContext" -- Creates all neccessary scripts for the gui on initial load, everything except build tools -- Please note that these are loaded in a specific order to diminish errors/perceived load time by user -local touchEnabled = false -pcall(function() - touchEnabled = game:GetService("UserInputService").TouchEnabled -end) - -- library registration scriptContext:AddCoreScript( 60595695, @@ -23,30 +18,14 @@ local function waitForChild(instance, name) instance.ChildAdded:wait() end end --- local function waitForProperty(instance, property) --- while not instance[property] do --- instance.Changed:wait() --- end --- end - --- Responsible for tracking logging items -scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections") waitForChild(game:GetService "CoreGui", "RobloxGui") local screenGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui" -if not touchEnabled then - -- ToolTipper (creates tool tips for gui) - scriptContext:AddCoreScript(36868950, screenGui, "CoreScripts/ToolTip") - -- SettingsScript - scriptContext:AddCoreScript(46295863, screenGui, "CoreScripts/Settings") -else - scriptContext:AddCoreScript( - 153556783, - screenGui, - "CoreScripts/TouchControls" - ) -end +-- ToolTipper (creates tool tips for gui) +scriptContext:AddCoreScript(36868950, screenGui, "CoreScripts/ToolTip") +-- SettingsScript +scriptContext:AddCoreScript(46295863, screenGui, "CoreScripts/Settings") -- MainBotChatScript scriptContext:AddCoreScript( @@ -72,7 +51,7 @@ scriptContext:AddCoreScript( "CoreScripts/PurchasePromptScript" ) -if not touchEnabled or screenGui.AbsoluteSize.Y > 600 then +if screenGui.AbsoluteSize.Y > 600 then -- New Player List scriptContext:AddCoreScript( 48488235, @@ -125,14 +104,6 @@ if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove p screenGui.CurrentLoadout, "CoreScripts/BackpackScripts/LoadoutScript" ) - -- if game.CoreGui.Version >= 8 then - -- -- Wardrobe script handles all character dressing operations - -- scriptContext:AddCoreScript( - -- -1, - -- Backpack, - -- "CoreScripts/BackpackScripts/BackpackWardrobe" - -- ) - -- end end local IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable" @@ -151,19 +122,3 @@ game.Workspace.ChildAdded:connect(function(nchild) ) end end) - -if touchEnabled then -- touch devices don't use same control frame - -- only used for touch device button generation - scriptContext:AddCoreScript( - 152908679, - screenGui, - "CoreScripts/ContextActionTouch" - ) - - waitForChild(screenGui, "ControlFrame") - waitForChild(screenGui.ControlFrame, "BottomLeftControl") - screenGui.ControlFrame.BottomLeftControl.Visible = false - - waitForChild(screenGui.ControlFrame, "TopLeftControl") - screenGui.ControlFrame.TopLeftControl.Visible = false -end diff --git a/luau/45284430.luau b/luau/45284430.luau index 867b98f..097dfb5 100644 --- a/luau/45284430.luau +++ b/luau/45284430.luau @@ -1,7 +1,7 @@ -- RbxGui print "[Mercury]: Loaded corescript 45284430" -local t = {} +local RbxGui = {} local function ScopedConnect( parentInstance, @@ -135,7 +135,7 @@ local function cancelSlide(areaSoak) end end -t.CreateStyledMessageDialog = function(title, message, style, buttons) +RbxGui.CreateStyledMessageDialog = function(title, message, style, buttons) local frame = Instance.new "Frame" frame.Size = UDim2.new(0.5, 0, 0, 165) frame.Position = UDim2.new(0.25, 0, 0.5, -72.5) @@ -149,15 +149,15 @@ t.CreateStyledMessageDialog = function(title, message, style, buttons) styleImage.Position = UDim2.new(0, 5, 0, 15) if style == "error" or style == "Error" then styleImage.Size = UDim2.new(0, 71, 0, 71) - styleImage.Image = "http://banland.xyz/asset?id=42565285" + styleImage.Image = "https://banland.xyz/asset?id=42565285" elseif style == "notify" or style == "Notify" then styleImage.Size = UDim2.new(0, 71, 0, 71) - styleImage.Image = "http://banland.xyz/asset?id=42604978" + styleImage.Image = "https://banland.xyz/asset?id=42604978" elseif style == "confirm" or style == "Confirm" then styleImage.Size = UDim2.new(0, 74, 0, 76) - styleImage.Image = "http://banland.xyz/asset?id=42557901" + styleImage.Image = "https://banland.xyz/asset?id=42557901" else - return t.CreateMessageDialog(title, message, buttons) + return RbxGui.CreateMessageDialog(title, message, buttons) end styleImage.Parent = frame @@ -195,7 +195,7 @@ t.CreateStyledMessageDialog = function(title, message, style, buttons) return frame end -t.CreateMessageDialog = function(title, message, buttons) +RbxGui.CreateMessageDialog = function(title, message, buttons) local frame = Instance.new "Frame" frame.Size = UDim2.new(0.5, 0, 0.5, 0) frame.Position = UDim2.new(0.25, 0, 0.25, 0) @@ -235,7 +235,8 @@ t.CreateMessageDialog = function(title, message, buttons) return frame end -t.CreateDropDownMenu = function(items, onSelect, forRoblox) +local scrollMouseCount +RbxGui.CreateDropDownMenu = function(items, onSelect, forRoblox) local width = UDim.new(0, 100) local height = UDim.new(0, 32) @@ -263,7 +264,7 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) local dropDownIcon = Instance.new "ImageLabel" dropDownIcon.Name = "Icon" dropDownIcon.Active = false - dropDownIcon.Image = "http://banland.xyz/asset/?id=45732894" + dropDownIcon.Image = "https://banland.xyz/asset/?id=45732894" dropDownIcon.BackgroundTransparency = 1 dropDownIcon.Size = UDim2.new(0, 11, 0, 6) dropDownIcon.Position = UDim2.new(1, -11, 0.5, -2) @@ -325,7 +326,7 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) local scrollUpButton local scrollDownButton - local scrollMouseCount = 0 + scrollMouseCount = 0 local setZIndex = function(baseZIndex) droppedDownMenu.ZIndex = baseZIndex + 1 @@ -580,7 +581,7 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) return frame, updateSelection end -t.CreatePropertyDropDownMenu = function(instance, property, enum) +RbxGui.CreatePropertyDropDownMenu = function(instance, property, enum) local items = enum:GetEnumItems() local names = {} local nameToItem = {} @@ -591,7 +592,7 @@ t.CreatePropertyDropDownMenu = function(instance, property, enum) local frame local updateSelection - frame, updateSelection = t.CreateDropDownMenu(names, function(text) + frame, updateSelection = RbxGui.CreateDropDownMenu(names, function(text) instance[property] = nameToItem[text] end) @@ -606,7 +607,7 @@ t.CreatePropertyDropDownMenu = function(instance, property, enum) return frame end -t.GetFontHeight = function(font, fontSize) +RbxGui.GetFontHeight = function(font, fontSize) if font == nil or fontSize == nil then error "Font and FontSize must be non-nil" end @@ -743,7 +744,7 @@ local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) end end -t.LayoutGuiObjects = function(frame, guiObjects, settingsTable) +RbxGui.LayoutGuiObjects = function(frame, guiObjects, settingsTable) if not frame:IsA "GuiObject" then error "Frame must be a GuiObject" end @@ -797,7 +798,7 @@ t.LayoutGuiObjects = function(frame, guiObjects, settingsTable) layoutGuiObjectsHelper(wrapperFrame, guiObjects, settingsTable) end -t.CreateSlider = function(steps, width, position) +RbxGui.CreateSlider = function(steps, width, position) local sliderGui = Instance.new "Frame" sliderGui.Size = UDim2.new(1, 0, 1, 0) sliderGui.BackgroundTransparency = 1 @@ -910,7 +911,7 @@ t.CreateSlider = function(steps, width, position) return sliderGui, sliderPosition, sliderSteps end -t.CreateTrueScrollingFrame = function() +RbxGui.CreateTrueScrollingFrame = function() local lowY local highY @@ -988,14 +989,14 @@ t.CreateTrueScrollingFrame = function() end scrollDownButton.MouseEnter:connect(function() scrollDownButton.BackgroundTransparency = 0.1 - local downChildren = scrollDownButton:GetChildren() + downChildren = scrollDownButton:GetChildren() for i = 1, #downChildren do downChildren[i].BackgroundTransparency = 0.1 end end) scrollDownButton.MouseLeave:connect(function() scrollDownButton.BackgroundTransparency = 0.5 - local downChildren = scrollDownButton:GetChildren() + downChildren = scrollDownButton:GetChildren() for i = 1, #downChildren do downChildren[i].BackgroundTransparency = 0.5 end @@ -1308,11 +1309,12 @@ t.CreateTrueScrollingFrame = function() reentrancyGuardScrollDown = false end + local scrollStamp + local function scrollUp(mouseYPos) if scrollUpButton.Active then - local scrollStamp = tick() + scrollStamp = tick() local current = scrollStamp - local upCon upCon = mouseDrag.MouseButton1Up:connect(function() scrollStamp = tick() mouseDrag.Parent = nil @@ -1343,7 +1345,7 @@ t.CreateTrueScrollingFrame = function() local function scrollDown(mouseYPos) if scrollDownButton.Active then - local scrollStamp = tick() + scrollStamp = tick() local current = scrollStamp local downCon downCon = mouseDrag.MouseButton1Up:connect(function() @@ -1380,7 +1382,6 @@ t.CreateTrueScrollingFrame = function() scrollbar.MouseButton1Down:connect(function(_, y) if scrollbar.Active then - local scrollStamp = tick() local mouseOffset = y - scrollbar.AbsolutePosition.y if dragCon then dragCon:disconnect() @@ -1391,30 +1392,28 @@ t.CreateTrueScrollingFrame = function() upCon = nil end local reentrancyGuardMouseScroll = false - dragCon = mouseDrag.MouseMoved:connect(function(x, y) + dragCon = mouseDrag.MouseMoved:connect(function(x2, y2) if reentrancyGuardMouseScroll then return end reentrancyGuardMouseScroll = true - if positionScrollBar(x, y, mouseOffset) then + if positionScrollBar(x2, y2, mouseOffset) then recalculate() end reentrancyGuardMouseScroll = false end) upCon = mouseDrag.MouseButton1Up:connect(function() - scrollStamp = tick() mouseDrag.Parent = nil dragCon:disconnect() dragCon = nil upCon:disconnect() - drag = nil end) mouseDrag.Parent = getScreenGuiAncestor(scrollbar) end end) - local scrollMouseCount = 0 + scrollMouseCount = 0 scrollUpButton.MouseButton1Down:connect(function() scrollUp() @@ -1507,7 +1506,7 @@ t.CreateTrueScrollingFrame = function() return scrollingFrame, controlFrame end -t.CreateScrollingFrame = function(orderList, scrollStyle) +RbxGui.CreateScrollingFrame = function(orderList, scrollStyle) local frame = Instance.new "Frame" frame.Name = "ScrollingFrame" frame.BackgroundTransparency = 1 @@ -1534,7 +1533,7 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local scrollStamp = 0 local scrollDrag = Instance.new "ImageButton" - scrollDrag.Image = "http://banland.xyz/asset/?id=61367186" + scrollDrag.Image = "https://banland.xyz/asset/?id=61367186" scrollDrag.Size = UDim2.new(1, 0, 0, 16) scrollDrag.BackgroundTransparency = 1 scrollDrag.Name = "ScrollDrag" @@ -1676,7 +1675,8 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) setRowSize = true local lastChildSize = 0 - local xOffset, yOffset = 0 + local xOffset = 0 + local yOffset = 0 if guiObjects[1] then yOffset = math.ceil( math.floor( @@ -1924,7 +1924,7 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) recalculate() end - local scrollUp = function(mouseYPos) + local function scrollUp(mouseYPos) if scrollUpButton.Active then scrollStamp = tick() local current = scrollStamp @@ -2001,17 +2001,17 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local mouseOffset = y - scrollDrag.AbsolutePosition.y local dragCon local upCon - dragCon = mouseDrag.MouseMoved:connect(function(_, y) + dragCon = mouseDrag.MouseMoved:connect(function(_, y2) local barAbsPos = scrollbar.AbsolutePosition.y local barAbsSize = scrollbar.AbsoluteSize.y local dragAbsSize = scrollDrag.AbsoluteSize.y local barAbsOne = barAbsPos + barAbsSize - dragAbsSize - y -= mouseOffset - y = y < barAbsPos and barAbsPos - or y > barAbsOne and barAbsOne - or y - y -= barAbsPos + y2 -= mouseOffset + y2 = y2 < barAbsPos and barAbsPos + or y2 > barAbsOne and barAbsOne + or y2 + y2 -= barAbsPos local guiObjects = 0 local children = frame:GetChildren() @@ -2023,7 +2023,7 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) end end - local doublePercent = y / (barAbsSize - dragAbsSize) + local doublePercent = y2 / (barAbsSize - dragAbsSize) local rowDiff = rowSize local totalScrollCount = guiObjects - (howManyDisplayed - 1) local newScrollPosition = math.floor( @@ -2046,13 +2046,12 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) dragCon:disconnect() dragCon = nil upCon:disconnect() - drag = nil end) mouseDrag.Parent = getScreenGuiAncestor(scrollbar) end end) - local scrollMouseCount = 0 + scrollMouseCount = 0 scrollUpButton.MouseButton1Down:connect(function() scrollUp() @@ -2151,7 +2150,7 @@ local function getGuiOwner(instance) return nil end -t.AutoTruncateTextObject = function(textLabel) +RbxGui.AutoTruncateTextObject = function(textLabel) local text = textLabel.Text local fullLabel = textLabel:Clone() @@ -2304,7 +2303,7 @@ local function TransitionTutorialPages( ) end -t.CreateTutorial = function(name, tutorialKey, createButtons) +RbxGui.CreateTutorial = function(name, tutorialKey, createButtons) local frame = Instance.new "Frame" frame.Name = "Tutorial-" .. name frame.BackgroundTransparency = 1 @@ -2545,7 +2544,7 @@ local function CreateBasicTutorialPage( return frame, innerFrame end -t.CreateTextTutorialPage = function(name, text, skipTutorialFunc) +RbxGui.CreateTextTutorialPage = function(name, text, skipTutorialFunc) local frame local contentFrame @@ -2561,8 +2560,8 @@ t.CreateTextTutorialPage = function(name, text, skipTutorialFunc) textLabel.Size = UDim2.new(1, 0, 1, 0) local function handleResize(minSize, maxSize) - local size = binaryShrink(minSize, maxSize, function(size) - frame.Size = UDim2.new(0, size, 0, size) + local size = binaryShrink(minSize, maxSize, function(newSize) + frame.Size = UDim2.new(0, newSize, 0, newSize) return textLabel.TextFits end) frame.Size = UDim2.new(0, size, 0, size) @@ -2576,7 +2575,7 @@ t.CreateTextTutorialPage = function(name, text, skipTutorialFunc) return frame end -t.CreateImageTutorialPage = function( +RbxGui.CreateImageTutorialPage = function( name, imageAsset, x, @@ -2594,8 +2593,8 @@ t.CreateImageTutorialPage = function( imageLabel.Position = UDim2.new(0.5, -x / 2, 0.5, -y / 2) local function handleResize(minSize, maxSize) - local size = binaryShrink(minSize, maxSize, function(size) - return size >= x and size >= y + local size = binaryShrink(minSize, maxSize, function(newSize) + return newSize >= x and newSize >= y end) if size >= x and size >= y then imageLabel.Size = UDim2.new(0, x, 0, y) @@ -2627,7 +2626,7 @@ t.CreateImageTutorialPage = function( return frame end -t.AddTutorialPage = function(tutorial, tutorialPage) +RbxGui.AddTutorialPage = function(tutorial, tutorialPage) local transitionFrame = tutorial.TransitionFrame local currentPageValue = tutorial.CurrentTutorialPage @@ -2682,7 +2681,7 @@ t.AddTutorialPage = function(tutorial, tutorialPage) end end -t.CreateSetPanel = function( +RbxGui.CreateSetPanel = function( userIdsForSets, objectSelected, dialogClosed, @@ -2813,7 +2812,7 @@ t.CreateSetPanel = function( waterForceDirLabel.Position = UDim2.new(0, 0, 0, 50) waterForceDirLabel.Parent = waterFrame - local waterTypeChangedEvent = Instance.new "BindableEvent" + waterTypeChangedEvent = Instance.new "BindableEvent" waterTypeChangedEvent.Name = "WaterTypeChangedEvent" waterTypeChangedEvent.Parent = waterFrame @@ -2827,7 +2826,7 @@ t.CreateSetPanel = function( end local waterForceDirectionDropDown, forceWaterDirectionSelection = - t.CreateDropDownMenu( + RbxGui.CreateDropDownMenu( waterForceDirections, waterForceDirectionSelectedFunc ) @@ -2837,7 +2836,7 @@ t.CreateSetPanel = function( waterForceDirectionDropDown.Parent = waterForceDirLabel local waterForceDropDown, forceWaterForceSelection = - t.CreateDropDownMenu(waterForces, waterForceSelectedFunc) + RbxGui.CreateDropDownMenu(waterForces, waterForceSelectedFunc) forceWaterForceSelection "None" waterForceDropDown.Size = UDim2.new(1, 0, 0, 25) waterForceDropDown.Position = UDim2.new(0, 0, 1, 3) @@ -2848,7 +2847,7 @@ t.CreateSetPanel = function( -- Helper Function that contructs gui elements local function createSetGui() - local setGui = Instance.new "ScreenGui" + setGui = Instance.new "ScreenGui" setGui.Name = "SetGui" local setPanel = Instance.new "Frame" @@ -2929,7 +2928,7 @@ t.CreateSetPanel = function( line.ZIndex = 6 line.Parent = sets - local setsLists, controlFrame = t.CreateTrueScrollingFrame() + local setsLists, controlFrame = RbxGui.CreateTrueScrollingFrame() setsLists.Size = UDim2.new(1, -6, 0.94, 0) setsLists.Position = UDim2.new(0, 0, 0.06, 0) setsLists.BackgroundTransparency = 1 @@ -2965,7 +2964,7 @@ t.CreateSetPanel = function( local cancelImage = Instance.new "ImageLabel" cancelImage.Name = "CancelImage" cancelImage.BackgroundTransparency = 1 - cancelImage.Image = "http://banland.xyz/asset?id=54135717" + cancelImage.Image = "https://banland.xyz/asset?id=54135717" cancelImage.Position = UDim2.new(0, -2, 0, -2) cancelImage.Size = UDim2.new(0, 16, 0, 16) cancelImage.ZIndex = 6 @@ -3201,7 +3200,7 @@ t.CreateSetPanel = function( local function createDropDownMenuButton(parent) local dropDownButton = Instance.new "ImageButton" dropDownButton.Name = "DropDownButton" - dropDownButton.Image = "http://banland.xyz/asset/?id=67581509" + dropDownButton.Image = "https://banland.xyz/asset/?id=67581509" dropDownButton.BackgroundTransparency = 1 dropDownButton.Size = UDim2.new(0, 16, 0, 16) dropDownButton.Position = UDim2.new(1, -24, 0, 6) @@ -3529,7 +3528,7 @@ t.CreateSetPanel = function( end ) - local scrollFrame, controlFrame = t.CreateTrueScrollingFrame() + local scrollFrame, controlFrame = RbxGui.CreateTrueScrollingFrame() scrollFrame.Size = UDim2.new(0.54, 0, 0.85, 0) scrollFrame.Position = UDim2.new(0.24, 0, 0.085, 0) scrollFrame.Name = "ItemsFrame" @@ -3542,6 +3541,11 @@ t.CreateSetPanel = function( controlFrame.Parent = setGui.SetPanel controlFrame.Position = UDim2.new(0.76, 5, 0, 0) + local rows = + math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.Y / buttonHeight) + local columns = + math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.X / buttonWidth) + local debounce = false controlFrame.ScrollBottom.Changed:connect(function(_) if controlFrame.ScrollBottom.Value == true then @@ -3573,10 +3577,6 @@ t.CreateSetPanel = function( userCategoryButtons = processCategory(userData) end - rows = math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.Y / buttonHeight) - columns = - math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.X / buttonWidth) - populateSetsFrame() --[[local insertPanelCloseCon = ]] @@ -3611,7 +3611,7 @@ t.CreateSetPanel = function( waterTypeChangedEvent end -t.CreateTerrainMaterialSelector = function(size, position) +RbxGui.CreateTerrainMaterialSelector = function(size, position) local terrainMaterialSelectionChanged = Instance.new "BindableEvent" terrainMaterialSelectionChanged.Name = "TerrainMaterialSelectionChanged" @@ -3619,11 +3619,7 @@ t.CreateTerrainMaterialSelector = function(size, position) local frame = Instance.new "Frame" frame.Name = "TerrainMaterialSelector" - if size then - frame.Size = size - else - frame.Size = UDim2.new(0, 245, 0, 230) - end + frame.Size = size or UDim2.new(0, 245, 0, 230) if position then frame.Position = position end @@ -3770,63 +3766,63 @@ t.CreateTerrainMaterialSelector = function(size, position) materialToImageMap[v] = {} if v == "Grass" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=56563112" + "https://banland.xyz/asset/?id=56563112" elseif v == "Sand" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=62356652" + "https://banland.xyz/asset/?id=62356652" elseif v == "Brick" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=65961537" + "https://banland.xyz/asset/?id=65961537" elseif v == "Granite" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532153" + "https://banland.xyz/asset/?id=67532153" elseif v == "Asphalt" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532038" + "https://banland.xyz/asset/?id=67532038" elseif v == "Iron" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532093" + "https://banland.xyz/asset/?id=67532093" elseif v == "Aluminum" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67531995" + "https://banland.xyz/asset/?id=67531995" elseif v == "Gold" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532118" + "https://banland.xyz/asset/?id=67532118" elseif v == "Plastic (red)" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67531848" + "https://banland.xyz/asset/?id=67531848" elseif v == "Plastic (blue)" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67531924" + "https://banland.xyz/asset/?id=67531924" elseif v == "Plank" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532015" + "https://banland.xyz/asset/?id=67532015" elseif v == "Log" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532051" + "https://banland.xyz/asset/?id=67532051" elseif v == "Gravel" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532206" + "https://banland.xyz/asset/?id=67532206" elseif v == "Cinder Block" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532103" + "https://banland.xyz/asset/?id=67532103" elseif v == "Stone Wall" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67531804" + "https://banland.xyz/asset/?id=67531804" elseif v == "Concrete" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=67532059" + "https://banland.xyz/asset/?id=67532059" elseif v == "Water" then materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=81407474" + "https://banland.xyz/asset/?id=81407474" else materialToImageMap[v].Regular = - "http://banland.xyz/asset/?id=66887593" -- fill in the rest here!! + "https://banland.xyz/asset/?id=66887593" -- fill in the rest here!! end end local scrollFrame, scrollUp, scrollDown, recalculateScroll = - t.CreateScrollingFrame(nil, "grid") + RbxGui.CreateScrollingFrame(nil, "grid") scrollFrame.Size = UDim2.new(0.85, 0, 1, 0) scrollFrame.Position = UDim2.new(0, 0, 0, 0) scrollFrame.Parent = frame @@ -3940,9 +3936,9 @@ t.CreateTerrainMaterialSelector = function(size, position) return frame, terrainMaterialSelectionChanged, forceTerrainMaterialSelection end -t.CreateLoadingFrame = function(name, size, position) +RbxGui.CreateLoadingFrame = function(name, size, position) game:GetService("ContentProvider") - :Preload "http://banland.xyz/asset/?id=35238053" + :Preload "https://banland.xyz/asset/?id=35238053" local loadingFrame = Instance.new "Frame" loadingFrame.Name = "LoadingFrame" @@ -3969,7 +3965,7 @@ t.CreateLoadingFrame = function(name, size, position) local loadingGreenBar = Instance.new "ImageLabel" loadingGreenBar.Name = "LoadingGreenBar" - loadingGreenBar.Image = "http://banland.xyz/asset/?id=35238053" + loadingGreenBar.Image = "https://banland.xyz/asset/?id=35238053" loadingGreenBar.Position = UDim2.new(0, 0, 0, 0) loadingGreenBar.Size = UDim2.new(0, 0, 1, 0) loadingGreenBar.Visible = false @@ -4082,8 +4078,15 @@ t.CreateLoadingFrame = function(name, size, position) return loadingFrame, updateLoadingGuiPercent, cancelButtonClicked end -t.CreatePluginFrame = function(name, size, position, scrollable, parent) - function createMenuButton(size, position, text, fontsize, name, parent) +RbxGui.CreatePluginFrame = function(name, size, position, scrollable, parent) + local function createMenuButton( + size, + position, + text, + fontsize, + name, + parent + ) local button = Instance.new "TextButton" button.AutoButtonColor = false button.Name = name @@ -4298,7 +4301,7 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) local frame, control, verticalDragger if scrollable then --frame for widgets - frame, control = t.CreateTrueScrollingFrame() + frame, control = RbxGui.CreateTrueScrollingFrame() frame.Size = UDim2.new(1, 0, 1, 0) frame.BackgroundColor3 = Color3.new(72 / 255, 72 / 255, 72 / 255) frame.BorderColor3 = Color3.new(0, 0, 0) @@ -4450,11 +4453,11 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) return dragBar, widgetContainer, helpFrame, closeEvent end -t.Help = function(funcNameOrFunc) +RbxGui.Help = function(funcNameOrFunc) --input argument can be a string or a function. Should return a description (of arguments and expected side effects) if funcNameOrFunc == "CreatePropertyDropDownMenu" - or funcNameOrFunc == t.CreatePropertyDropDownMenu + or funcNameOrFunc == RbxGui.CreatePropertyDropDownMenu then return "Function CreatePropertyDropDownMenu. " .. "Arguments: (instance, propertyName, enumType). " @@ -4462,7 +4465,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "CreateDropDownMenu" - or funcNameOrFunc == t.CreateDropDownMenu + or funcNameOrFunc == RbxGui.CreateDropDownMenu then return "Function CreateDropDownMenu. " .. "Arguments: (items, onItemSelected). " @@ -4470,7 +4473,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "CreateMessageDialog" - or funcNameOrFunc == t.CreateMessageDialog + or funcNameOrFunc == RbxGui.CreateMessageDialog then return "Function CreateMessageDialog. " .. "Arguments: (title, message, buttons). " @@ -4478,7 +4481,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "CreateStyledMessageDialog" - or funcNameOrFunc == t.CreateStyledMessageDialog + or funcNameOrFunc == RbxGui.CreateStyledMessageDialog then return "Function CreateStyledMessageDialog. " .. "Arguments: (title, message, style, buttons). " @@ -4486,7 +4489,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "GetFontHeight" - or funcNameOrFunc == t.GetFontHeight + or funcNameOrFunc == RbxGui.GetFontHeight then return "Function GetFontHeight. " .. "Arguments: (font, fontSize). " @@ -4494,7 +4497,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "CreateScrollingFrame" - or funcNameOrFunc == t.CreateScrollingFrame + or funcNameOrFunc == RbxGui.CreateScrollingFrame then return "Function CreateScrollingFrame. " .. "Arguments: (orderList, style) " @@ -4502,7 +4505,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "CreateTrueScrollingFrame" - or funcNameOrFunc == t.CreateTrueScrollingFrame + or funcNameOrFunc == RbxGui.CreateTrueScrollingFrame then return "Function CreateTrueScrollingFrame. " .. "Arguments: (nil) " @@ -4510,20 +4513,23 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "AutoTruncateTextObject" - or funcNameOrFunc == t.AutoTruncateTextObject + or funcNameOrFunc == RbxGui.AutoTruncateTextObject then return "Function AutoTruncateTextObject. " .. "Arguments: (textLabel) " .. "Side effect: returns 2 objects, (textLabel, changeText). The 'textLabel' input is modified to automatically truncate text (with ellipsis), if it gets too small to fit. 'changeText' is a function that can be used to change the text, it takes 1 string as an argument" end - if funcNameOrFunc == "CreateSlider" or funcNameOrFunc == t.CreateSlider then + if + funcNameOrFunc == "CreateSlider" + or funcNameOrFunc == RbxGui.CreateSlider + then return "Function CreateSlider. " .. "Arguments: (steps, width, position) " .. "Side effect: returns 2 objects, (sliderGui, sliderPosition). The 'steps' argument specifies how many different positions the slider can hold along the bar. 'width' specifies in pixels how wide the bar should be (modifiable afterwards if desired). 'position' argument should be a UDim2 for slider positioning. 'sliderPosition' is an IntValue whose current .Value specifies the specific step the slider is currently on." end if funcNameOrFunc == "CreateLoadingFrame" - or funcNameOrFunc == t.CreateLoadingFrame + or funcNameOrFunc == RbxGui.CreateLoadingFrame then return "Function CreateLoadingFrame. " .. "Arguments: (name, size, position) " @@ -4531,7 +4537,7 @@ t.Help = function(funcNameOrFunc) end if funcNameOrFunc == "CreateTerrainMaterialSelector" - or funcNameOrFunc == t.CreateTerrainMaterialSelector + or funcNameOrFunc == RbxGui.CreateTerrainMaterialSelector then return "Function CreateTerrainMaterialSelector. " .. "Arguments: (size, position) " @@ -4539,4 +4545,4 @@ t.Help = function(funcNameOrFunc) end end -return t +return RbxGui diff --git a/luau/46295863.luau b/luau/46295863.luau index 29232a6..528de79 100644 --- a/luau/46295863.luau +++ b/luau/46295863.luau @@ -23,8 +23,8 @@ local RbxGui local helpButton, updateCameraDropDownSelection, updateVideoCaptureDropDownSelection local tweenTime = 0.2 -local mouseLockLookScreenUrl = "http://banland.xyz/asset?id=54071825" -local classicLookScreenUrl = "http://banland.xyz/Asset?id=45915798" +local mouseLockLookScreenUrl = "https://banland.xyz/asset?id=54071825" +local classicLookScreenUrl = "https://banland.xyz/Asset?id=45915798" local hasGraphicsSlider = (game:GetService("CoreGui").Version >= 5) local GraphicsQualityLevels = 10 -- how many levels we allow on graphics slider @@ -415,17 +415,17 @@ local function createHelpDialog(baseZIndex) buttons[2] = {} buttons[2].Text = "Move" buttons[2].Function = function() - image.Image = "http://banland.xyz/Asset?id=45915811" + image.Image = "https://banland.xyz/Asset?id=45915811" end buttons[3] = {} buttons[3].Text = "Gear" buttons[3].Function = function() - image.Image = "http://banland.xyz/Asset?id=45917596" + image.Image = "https://banland.xyz/Asset?id=45917596" end buttons[4] = {} buttons[4].Text = "Zoom" buttons[4].Function = function() - image.Image = "http://banland.xyz/Asset?id=45915825" + image.Image = "https://banland.xyz/Asset?id=45915825" end CreateTextButtons(buttonRow, buttons, UDim.new(0, 0), UDim.new(1, 0)) @@ -2007,7 +2007,7 @@ local createSaveDialogs = function() -8 ) spinnerImage.BackgroundTransparency = 1 - spinnerImage.Image = "http://banland.xyz/Asset?id=45880710" + spinnerImage.Image = "https://banland.xyz/Asset?id=45880710" spinnerImage.Parent = spinnerFrame spinnerIcons[spinnerNum] = spinnerImage @@ -2029,10 +2029,10 @@ local createSaveDialogs = function() while pos < 8 do if pos == spinPos or pos == ((spinPos + 1) % 8) then spinnerIcons[pos + 1].Image = - "http://banland.xyz/Asset?id=45880668" + "https://banland.xyz/Asset?id=45880668" else spinnerIcons[pos + 1].Image = - "http://banland.xyz/Asset?id=45880710" + "https://banland.xyz/Asset?id=45880710" end pos += 1 @@ -2169,7 +2169,7 @@ local createReportAbuseDialog = function() frame.Active = true frame.Parent = shield - local settingsFrame = Instance.new "Frame" + settingsFrame = Instance.new "Frame" settingsFrame.Name = "ReportAbuseStyle" settingsFrame.Size = UDim2.new(1, 0, 1, 0) settingsFrame.Style = Enum.FrameStyle.RobloxRound @@ -2602,25 +2602,3 @@ if success and luaChat then end) end ]] - ---[[ -local BurningManPlaceID = 41324860 --- TODO: remove click to walk completely if testing shows we don't need it --- Removes click to walk option from Burning Man -delay(0, function() - waitForChild(game, "NetworkClient") - waitForChild(game, "Players") - waitForProperty(game.Players, "LocalPlayer") - waitForProperty(game.Players.LocalPlayer, "Character") - waitForChild(game.Players.LocalPlayer.Character, "Humanoid") - waitForProperty(game, "PlaceId") - - if game.PlaceId == BurningManPlaceID then - game.Players.LocalPlayer.Character.Humanoid:SetClickToWalkEnabled(false) - game.Players.LocalPlayer.CharacterAdded:connect(function(character) - waitForChild(character, "Humanoid") - character.Humanoid:SetClickToWalkEnabled(false) - end) - end -end) -]] diff --git a/luau/48488235.luau b/luau/48488235.luau index 1570a70..a1d9c98 100644 --- a/luau/48488235.luau +++ b/luau/48488235.luau @@ -7,130 +7,12 @@ print "[Mercury]: Loaded corescript 48488235" -- Super Util -------------------- ---[[ local ADMINS = -{ - aceswayuphigh = 1, - adamintygum = 1, - afackler11 = 1, - aleverns = 1, - aquabot8 = 1, - arbolito = 1, - argforpirates = 1, - argonpirate = 1, - asmohdian = 1, - bellavour = 1, - blockhaak = 1, - brighteyes = 1, - briguy9876 = 1, - builderman = 1, - cdakkar = 1, - chiefjustus = 1, - chro = 1, - cmed = 1, - coatp0cketninja = 1, - codewriter = 1, - commandercrow = 1, - corgiparade = 1, - dapperbuffalo = 1, - dbapostle = 1, - deeana00 = 1, - doughtless = 1, - dunbar1138 = 1, - echodown = 1, - ffjosh = 1, - foyle = 1, - gemlocker = 1, - goddessnoob = 1, - gongfutiger = 1, - gordonrox24 = 1, - gorroth = 1, - grossinger = 1, - groundcontroll2 = 1, - hawkeyebandit = 1, - hawkington = 1, - ibanez2189 = 1, - iltalumi = 1, - inventx = 1, - jackssmirkingrevenge = 1, - jeditkacheff = 'http://banland.xyz/asset/?id=134032333', - kbux = 1, - keith = 1, - limon = 1, - loopylens = 1, - lordrugdumph = 1, - majortom4321 = 1, - malcomso = 1, - maxvee = 1, - midwinterfires = 1, - mistersquirrel = 1, - morganic = 1, - motornerve = 1, - mrdoombringer = 1, - mse6 = 1, - newtrat = 1, - niquemonster = 1, - nobledragon = 1, - noob007 = 1, - nrawat1 = 1, - olive71 = 1, - onlytwentycharacters = 1, - orcasparkles = 1, - ostrichsized = 1, - phaedre = 1, - phil = 1, - pulmoesflor = 1, - raeglyn = 1, - rbadam = 1, - reesemcblox = 1, - robliu = 1, - roblowilson = 1, - robloxsai = 1, - roboyz = 1, - saurauss = 1, - screenme = 1, - scubasomething = 1, - seanthornton = 1, - shedletsky = 'http://banland.xyz/asset/?id=105897927', - sickenedmonkey = 1, - slingshotjunkie = 1, - smeaferblox = 1, - soggoth = 1, - solarcrane = 1, - sooraya = 1, - sorcus = 'http://banland.xyz/asset/?id=113059239', - squidcod = 1, - stickmasterluke = 1, - stuball = 1, - tabemono = 1, - tarabyte = 1, - thelorekt = 1, - thorasaur = 1, - timobius = 1, - tobotrobot = 1, - tone = 1, - totallynothere = 1, - totbl = 1, - twberg = 1, - vaiobot = 1, - varia = 1, - vladthefirst = 1, - wonderboy76 = 1, - xerolayne = 1, - yesth = 1, - yumyumcheerios = 1, - zeuxcg = 1, - zodiaczak = 1, - ['erik.cassel'] = 1, - ['david.baszucki'] = 1, - ['matt dusek'] = 1, -} --]] - local ADMINS = { taskmanager = 1, heliodex = 1, - multako = "http://banland.xyz/asset/?id=6923328292", + multako = "https://banland.xyz/asset?id=6923328292", mercury = 1, - pizzaboxer = "http://banland.xyz/asset/?id=6917566633", + pizzaboxer = "https://banland.xyz/asset?id=6917566633", } local Images = { @@ -162,8 +44,7 @@ local MOUSE_DRAG_DISTANCE = 15 Generic object Create function, which I am using to create Gui's Thanks to Stravant! --]] -local Obj = {} -function Obj.Create(guiType) +local function Create(guiType) return function(data) local obj = Instance.new(guiType) for k, v in pairs(data) do @@ -184,7 +65,7 @@ end @Return: background gui object --]] local function MakeBackgroundGuiObj(imgName) - return Obj.Create "ImageLabel" { + return Create "ImageLabel" { Name = "Background", BackgroundTransparency = 1, Image = imgName, @@ -206,7 +87,7 @@ end local function getMembershipTypeIcon(membershipType, playerName) if ADMINS[string.lower(playerName)] ~= nil then if ADMINS[string.lower(playerName)] == 1 then - return "http://banland.xyz/asset/?id=6923330951" + return "https://banland.xyz/asset?id=6923330951" end return ADMINS[string.lower(playerName)] elseif membershipType == Enum.MembershipType.None then @@ -229,16 +110,18 @@ local function getFriendStatusIcon(friendStatus) then return "" elseif friendStatus == Enum.FriendStatus.Friend then - return "http://banland.xyz/asset/?id=99749771" + return "https://banland.xyz/asset?id=99749771" elseif friendStatus == Enum.FriendStatus.FriendRequestSent then - return "http://banland.xyz/asset/?id=99776888" + return "https://banland.xyz/asset?id=99776888" elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then - return "http://banland.xyz/asset/?id=99776838" + return "https://banland.xyz/asset?id=99776838" else error(`Unknown FriendStatus {friendStatus}`) end end +local HeaderFrame + --[[ Utility function to create buttons for the popup menus @Args: @@ -248,14 +131,14 @@ end last is this the last element of the popup menu @Return: a popup menu button --]] -function MakePopupButton(nparent, ntext, index, last) - local tobj = Obj.Create "ImageButton" { +local function MakePopupButton(nparent, ntext, index, last) + local tobj = Create "ImageButton" { Name = "ReportButton", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 1 * index, 0), Size = UDim2.new(1, 0, 1, 0), ZIndex = 7, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "ButtonText", BackgroundTransparency = 1, Position = UDim2.new(0.07, 0, 0.07, 0), @@ -272,40 +155,25 @@ function MakePopupButton(nparent, ntext, index, last) Parent = nparent, } if index == 0 then - tobj.Image = "http://banland.xyz/asset/?id=97108784" + tobj.Image = "https://banland.xyz/asset?id=97108784" elseif last then if index % 2 == 1 then - tobj.Image = "http://banland.xyz/asset/?id=" + tobj.Image = "https://banland.xyz/asset?id=" .. Images.LightPopupBottom else - tobj.Image = "http://banland.xyz/asset/?id=" + tobj.Image = "https://banland.xyz/asset?id=" .. Images.DarkPopupBottom end else if index % 2 == 1 then - tobj.Image = "http://banland.xyz/asset/?id=97112126" + tobj.Image = "https://banland.xyz/asset?id=97112126" else - tobj.Image = "http://banland.xyz/asset/?id=97109338" + tobj.Image = "https://banland.xyz/asset?id=97109338" end end return tobj end ---[[ - obligatory wait for child function - @Args: - parent Parent object to look for child in - child name of child object to look for - @Return: object waited for ---]] -local function WaitForChild(parent, child) - while not parent:FindFirstChild(child) do - wait() - debugprint(` child {parent.Name} waiting for {child}`) - end - return parent[child] -end - --------------------------- -- Workspace Objects --------------------------- @@ -320,13 +188,13 @@ end local LocalPlayer = Players.LocalPlayer local Mouse = LocalPlayer:GetMouse() -local ScreenGui = Obj.Create "Frame" { +local ScreenGui = Create "Frame" { Name = "PlayerListScreen", Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, Parent = script.Parent, } -local MainFrame = Obj.Create "Frame" { +local MainFrame = Create "Frame" { Name = "LeaderBoardFrame", Position = UDim2.new(1, -150, 0.005, 0), Size = UDim2.new(0, 150, 0, 800), @@ -335,7 +203,7 @@ local MainFrame = Obj.Create "Frame" { } --frame used for expanding leaderstats when frame is 'focused' -local FocusFrame = Obj.Create "Frame" { +local FocusFrame = Create "Frame" { Name = "FocusFrame", Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(1, 0, 0, 100), @@ -345,16 +213,16 @@ local FocusFrame = Obj.Create "Frame" { } -- HEADER -local HeaderFrame = Obj.Create "Frame" { +HeaderFrame = Create "Frame" { Name = "Header", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(1, 0, 0.07, 0), Parent = MainFrame, - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=94692054", + MakeBackgroundGuiObj "https://banland.xyz/asset?id=94692054", } local HeaderFrameHeight = HeaderFrame.Size.Y.Scale -local MaximizeButton = Obj.Create "ImageButton" { +local MaximizeButton = Create "ImageButton" { Name = "MaximizeButton", Active = true, BackgroundTransparency = 1, @@ -362,7 +230,7 @@ local MaximizeButton = Obj.Create "ImageButton" { Size = UDim2.new(1, 0, 1, 0), Parent = HeaderFrame, } -local HeaderName = Obj.Create "TextLabel" { +local HeaderName = Create "TextLabel" { Name = "PlayerName", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0.01, 0), @@ -378,7 +246,7 @@ local HeaderName = Obj.Create "TextLabel" { TextXAlignment = "Right", TextYAlignment = "Center", } -local HeaderScore = Obj.Create "TextLabel" { +local HeaderScore = Create "TextLabel" { Name = "PlayerScore", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0.4, 0), @@ -395,22 +263,22 @@ local HeaderScore = Obj.Create "TextLabel" { } -- BOTTOM --used for shifting bottom frame for mouse over effects -local BottomShiftFrame = Obj.Create "Frame" { +local BottomShiftFrame = Create "Frame" { Name = "BottomShiftFrame", BackgroundTransparency = 1, Position = UDim2.new(0, 0, HeaderFrameHeight, 0), Size = UDim2.new(1, 0, 1, 0), Parent = MainFrame, } -local BottomFrame = Obj.Create "Frame" { +local BottomFrame = Create "Frame" { Name = "Bottom", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0.07, 0), Size = UDim2.new(1, 0, 0.03, 0), Parent = BottomShiftFrame, - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=94754966", + MakeBackgroundGuiObj "https://banland.xyz/asset?id=94754966", } -local ExtendButton = Obj.Create "ImageButton" { +local ExtendButton = Create "ImageButton" { Name = "bigbutton", Active = true, BackgroundTransparency = 1, @@ -419,16 +287,16 @@ local ExtendButton = Obj.Create "ImageButton" { ZIndex = 3, Parent = BottomFrame, } -local ExtendTab = Obj.Create "ImageButton" { +local ExtendTab = Create "ImageButton" { Name = "extendTab", Active = true, BackgroundTransparency = 1, - Image = "http://banland.xyz/asset/?id=94692731", + Image = "https://banland.xyz/asset?id=94692731", Position = UDim2.new(0.608, 0, 0.3, 0), Size = UDim2.new(0.3, 0, 0.7, 0), Parent = BottomFrame, } -local TopClipFrame = Obj.Create "Frame" { +local TopClipFrame = Create "Frame" { Name = "ListFrame", BackgroundTransparency = 1, Position = UDim2.new(-1, 0, 0.07, 0), @@ -436,7 +304,7 @@ local TopClipFrame = Obj.Create "Frame" { Parent = MainFrame, ClipsDescendants = true, } -local BottomClipFrame = Obj.Create "Frame" { +local BottomClipFrame = Create "Frame" { Name = "BottomFrame", BackgroundTransparency = 1, Position = UDim2.new(0, 0, -0.8, 0), @@ -444,14 +312,14 @@ local BottomClipFrame = Obj.Create "Frame" { Parent = TopClipFrame, ClipsDescendants = true, } -local ScrollBarFrame = Obj.Create "Frame" { +local ScrollBarFrame = Create "Frame" { Name = "ScrollBarFrame", BackgroundTransparency = 1, Position = UDim2.new(0.987, 0, 0.8, 0), Size = UDim2.new(0.01, 0, 0.2, 0), Parent = BottomClipFrame, } -local ScrollBar = Obj.Create "Frame" { +local ScrollBar = Create "Frame" { Name = "ScrollBar", BackgroundTransparency = 0, BackgroundColor3 = Color3.new(0.2, 0.2, 0.2), @@ -460,14 +328,14 @@ local ScrollBar = Obj.Create "Frame" { ZIndex = 5, Parent = ScrollBarFrame, } -local ListFrame = Obj.Create "Frame" { +local ListFrame = Create "Frame" { Name = "SubFrame", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0.8, 0), Size = UDim2.new(1, 0, 1, 0), Parent = BottomClipFrame, } -local PopUpClipFrame = Obj.Create "Frame" { +local PopUpClipFrame = Create "Frame" { Name = "PopUpFrame", BackgroundTransparency = 1, SizeConstraint = "RelativeXX", @@ -478,7 +346,7 @@ local PopUpClipFrame = Obj.Create "Frame" { ZIndex = 7, } local PopUpPanel -local PopUpPanelTemplate = Obj.Create "Frame" { +local PopUpPanelTemplate = Create "Frame" { Name = "Panel", BackgroundTransparency = 1, Position = UDim2.new(1, 0, 0, 0), @@ -486,7 +354,7 @@ local PopUpPanelTemplate = Obj.Create "Frame" { Parent = PopUpClipFrame, } -local StatTitles = Obj.Create "Frame" { +local StatTitles = Create "Frame" { Name = "StatTitles", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 1, -10), @@ -499,12 +367,12 @@ local IsMaximized = Instance.new "BoolValue" local IsTabified = Instance.new "BoolValue" local AreNamesExpanded = Instance.new "BoolValue" -local MiddleTemplate = Obj.Create "Frame" { +local MiddleTemplate = Create "Frame" { Name = "MidTemplate", BackgroundTransparency = 1, Position = UDim2.new(100, 0, 0.07, 0), Size = UDim2.new(0.5, 0, 0.025, 0), --UDim2.new(1, 0, .03, 0), - Obj.Create "ImageLabel" { + Create "ImageLabel" { Name = "BCLabel", Active = true, BackgroundTransparency = 1, @@ -514,7 +382,7 @@ local MiddleTemplate = Obj.Create "Frame" { Image = "", ZIndex = 3, }, - Obj.Create "ImageLabel" { + Create "ImageLabel" { Name = "FriendLabel", Active = true, BackgroundTransparency = 1, @@ -524,7 +392,7 @@ local MiddleTemplate = Obj.Create "Frame" { Image = "", ZIndex = 3, }, - Obj.Create "ImageButton" { + Create "ImageButton" { Name = "ClickListener", Active = true, BackgroundTransparency = 1, @@ -532,13 +400,13 @@ local MiddleTemplate = Obj.Create "Frame" { Size = UDim2.new(0.96, 0, 1, 0), ZIndex = 3, }, - Obj.Create "Frame" { + Create "Frame" { Name = "TitleFrame", BackgroundTransparency = 1, Position = UDim2.new(0.01, 0, 0, 0), Size = UDim2.new(0, 140, 1, 0), ClipsDescendants = true, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "Title", BackgroundTransparency = 1, Position = UDim2.new(0, 5, 0, 0), @@ -552,7 +420,7 @@ local MiddleTemplate = Obj.Create "Frame" { }, }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "PlayerScore", BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0, 0), @@ -565,22 +433,22 @@ local MiddleTemplate = Obj.Create "Frame" { TextYAlignment = "Center", ZIndex = 3, }, - --Obj.Create'IntValue'{Name = 'ID'}, - --Obj.Create'ObjectValue'{Name = 'Player'}, - --Obj.Create'IntValue'{Name = 'Score'}, + --Create'IntValue'{Name = 'ID'}, + --Create'ObjectValue'{Name = 'Player'}, + --Create'IntValue'{Name = 'Score'}, ZIndex = 3, } -local MiddleBGTemplate = Obj.Create "Frame" { +local MiddleBGTemplate = Create "Frame" { Name = "MidBGTemplate", BackgroundTransparency = 1, Position = UDim2.new(100, 0, 0.07, 0), Size = UDim2.new(0.5, 0, 0.025, 0), --UDim2.new(1, 0, .03, 0), - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=94692025", + MakeBackgroundGuiObj "https://banland.xyz/asset?id=94692025", } -- REPORT ABUSE OBJECTS -local ReportAbuseShield = Obj.Create "TextButton" { +local ReportAbuseShield = Create "TextButton" { Name = "ReportAbuseShield", Text = "", AutoButtonColor = false, @@ -592,7 +460,7 @@ local ReportAbuseShield = Obj.Create "TextButton" { BackgroundTransparency = 1, } -local ReportAbuseFrame = Obj.Create "Frame" { +local ReportAbuseFrame = Create "Frame" { Name = "Settings", Position = UDim2.new(0.5, -250, 0.5, -200), Size = UDim2.new(0, 500, 0, 400), @@ -601,13 +469,13 @@ local ReportAbuseFrame = Obj.Create "Frame" { Parent = ReportAbuseShield, } -local AbuseSettingsFrame = Obj.Create "Frame" { +local AbuseSettingsFrame = Create "Frame" { Name = "ReportAbuseStyle", Size = UDim2.new(1, 0, 1, 0), Active = true, BackgroundTransparency = 1, - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96488767", -- 96480351'), - Obj.Create "TextLabel" { + MakeBackgroundGuiObj "https://banland.xyz/asset?id=96488767", -- 96480351'), + Create "TextLabel" { Name = "Title", Text = "Report Abuse", TextColor3 = Color3I(221, 221, 221), @@ -615,7 +483,7 @@ local AbuseSettingsFrame = Obj.Create "Frame" { Font = Enum.Font.ArialBold, FontSize = Enum.FontSize.Size36, }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "Description", Text = "This will send a complete report to a moderator. The moderator will review the chat log and take appropriate action.", TextColor3 = Color3I(221, 221, 221), @@ -628,7 +496,7 @@ local AbuseSettingsFrame = Obj.Create "Frame" { TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Top, }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "AbuseLabel", Text = "What did they do?", Font = Enum.Font.Arial, @@ -639,7 +507,7 @@ local AbuseSettingsFrame = Obj.Create "Frame" { TextColor3 = Color3I(255, 255, 255), TextXAlignment = Enum.TextXAlignment.Left, }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "ShortDescriptionLabel", Text = "Short Description: (optional)", Font = Enum.Font.Arial, @@ -650,7 +518,7 @@ local AbuseSettingsFrame = Obj.Create "Frame" { TextXAlignment = Enum.TextXAlignment.Left, BackgroundTransparency = 1, }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "ReportingPlayerLabel", Text = "Reporting Player", BackgroundTransparency = 1, @@ -660,13 +528,12 @@ local AbuseSettingsFrame = Obj.Create "Frame" { Size = UDim2.new(0.95, 0, 0, 36), TextColor3 = Color3I(255, 255, 255), TextXAlignment = Enum.TextXAlignment.Left, - Parent = AbuseSettingsFrame, }, Parent = ReportAbuseFrame, } -local AbusePlayerLabel = Obj.Create "TextLabel" { +local AbusePlayerLabel = Create "TextLabel" { Name = "PlayerLabel", Text = "", BackgroundTransparency = 1, @@ -679,28 +546,28 @@ local AbusePlayerLabel = Obj.Create "TextLabel" { Parent = AbuseSettingsFrame, } -local SubmitReportButton = Obj.Create "ImageButton" { +local SubmitReportButton = Create "ImageButton" { Name = "SubmitReportBtn", Active = false, BackgroundTransparency = 1, Position = UDim2.new(0.5, -200, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = false, - Image = "http://banland.xyz/asset/?id=96502438", -- 96501119', + Image = "https://banland.xyz/asset?id=96502438", -- 96501119', Parent = AbuseSettingsFrame, } -local CancelReportButton = Obj.Create "ImageButton" { +local CancelReportButton = Create "ImageButton" { Name = "CancelBtn", BackgroundTransparency = 1, Position = UDim2.new(0.5, 50, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = true, - Image = "http://banland.xyz/asset/?id=96500683", + Image = "https://banland.xyz/asset?id=96500683", Parent = AbuseSettingsFrame, } -local AbuseDescriptionWrapper = Obj.Create "Frame" { +local AbuseDescriptionWrapper = Create "Frame" { Name = "AbuseDescriptionWrapper", Position = UDim2.new(0.025, 0, 0, 220), Size = UDim2.new(0.95, 0, 1, -310), @@ -711,7 +578,7 @@ local AbuseDescriptionWrapper = Obj.Create "Frame" { local AbuseDescriptionBox -local OriginalAbuseDescriptionBox = Obj.Create "TextBox" { +local OriginalAbuseDescriptionBox = Create "TextBox" { Name = "TextBox", Text = "", ClearTextOnFocus = false, @@ -727,13 +594,13 @@ local OriginalAbuseDescriptionBox = Obj.Create "TextBox" { BorderSizePixel = 0, } -local CalmingAbuseBox = Obj.Create "Frame" { +local CalmingAbuseBox = Create "Frame" { Name = "AbuseFeedbackBox", BackgroundTransparency = 1, Position = UDim2.new(0.25, 0, 0.300000012, 0), Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96506233", - Obj.Create "TextLabel" { + MakeBackgroundGuiObj "https://banland.xyz/asset?id=96506233", + Create "TextLabel" { Name = "Header", Position = UDim2.new(0, 10, 0.05, 0), Size = UDim2.new(1, -30, 0.15, 0), @@ -746,7 +613,7 @@ local CalmingAbuseBox = Obj.Create "Frame" { FontSize = Enum.FontSize.Size48, Font = "ArialBold", }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "content", Position = UDim2.new(0, 10, 0.20, 0), Size = UDim2.new(1, -30, 0.40, 0), @@ -759,22 +626,22 @@ local CalmingAbuseBox = Obj.Create "Frame" { FontSize = Enum.FontSize.Size24, Font = "Arial", }, - Obj.Create "ImageButton" { + Create "ImageButton" { Name = "OkButton", BackgroundTransparency = 1, Position = UDim2.new(0.5, -75, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = true, - Image = "http://banland.xyz/asset/?id=96507959", + Image = "https://banland.xyz/asset?id=96507959", }, } -local NormalAbuseBox = Obj.Create "Frame" { +local NormalAbuseBox = Create "Frame" { Name = "AbuseFeedbackBox", BackgroundTransparency = 1, Position = UDim2.new(0.25, 0, 0.300000012, 0), Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96506233", - Obj.Create "TextLabel" { + MakeBackgroundGuiObj "https://banland.xyz/asset?id=96506233", + Create "TextLabel" { Name = "Header", Position = UDim2.new(0, 10, 0.05, 0), Size = UDim2.new(1, -30, 0.15, 0), @@ -787,7 +654,7 @@ local NormalAbuseBox = Obj.Create "Frame" { FontSize = Enum.FontSize.Size48, Font = "ArialBold", }, - Obj.Create "TextLabel" { + Create "TextLabel" { Name = "content", Position = UDim2.new(0, 10, 0.20, 0), Size = UDim2.new(1, -30, 0.15, 0), @@ -800,13 +667,13 @@ local NormalAbuseBox = Obj.Create "Frame" { FontSize = Enum.FontSize.Size24, Font = "Arial", }, - Obj.Create "ImageButton" { + Create "ImageButton" { Name = "OkButton", BackgroundTransparency = 1, Position = UDim2.new(0.5, -75, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = true, - Image = "http://banland.xyz/asset/?id=96507959", + Image = "https://banland.xyz/asset?id=96507959", }, } @@ -818,7 +685,7 @@ BigButton.Visible = false --BigButton.Active=false BigButton.Parent = ScreenGui -local debugFrame = Obj.Create "Frame" { +local debugFrame = Create "Frame" { Name = "debugframe", --Position = UDim2.new(0, 0, 0, 0), --Size = UDim2.new(0, 150, 0, 800),--0.99000001 @@ -826,24 +693,9 @@ local debugFrame = Obj.Create "Frame" { BackgroundTransparency = 1, Position = UDim2.new(0.25, 0, 0.300000012, 0), Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96506233", + MakeBackgroundGuiObj "https://banland.xyz/asset?id=96506233", } -local debugplayers = Obj.Create "TextLabel" { - BackgroundTransparency = 0.8, - Position = UDim2.new(0, 0, 0.01, 0), - Size = UDim2.new(1, 0, 0.5, 0), - Parent = debugFrame, - Font = "ArialBold", - Text = "--", - FontSize = "Size14", - TextWrapped = true, - TextColor3 = Color3.new(1, 1, 1), - TextStrokeColor3 = Color3.new(0, 0, 0), - TextStrokeTransparency = 0, - TextXAlignment = "Right", - TextYAlignment = "Center", -} -local debugOutput = Obj.Create "TextLabel" { +local debugOutput = Create "TextLabel" { BackgroundTransparency = 0.8, Position = UDim2.new(0, 0, 0.5, 0), Size = UDim2.new(1, 0, 0.5, 0), @@ -863,13 +715,28 @@ local debugOutput = Obj.Create "TextLabel" { simple function to toggle the display of debug output --]] local DebugPrintEnabled = true -function debugprint(str) +local function debugprint(str) --print(str) if DebugPrintEnabled then debugOutput.Text = str end end +--[[ + obligatory wait for child function + @Args: + parent Parent object to look for child in + child name of child object to look for + @Return: object waited for +--]] +local function WaitForChild(parent, child) + while not parent:FindFirstChild(child) do + wait() + debugprint(` child {parent.Name} waiting for {child}`) + end + return parent[child] +end + ------------------------- -- Script objects ------------------------- @@ -880,7 +747,7 @@ local DefaultEntriesOnScreen = 8 for _, i in pairs(Images) do Game:GetService("ContentProvider") - :Preload(`http://banland.xyz/asset/?id={i}`) + :Preload(`https://banland.xyz/asset?id={i}`) end -- ordered array of 'score data', each entry has: @@ -1126,7 +993,7 @@ end player player to change rank of nrank new integer rank to give player --]] -function SetPrivilegeRank(player, nrank) +local function SetPrivilegeRank(player, nrank) while player.PersonalServerRank < nrank do game:GetService("PersonalServerService"):Promote(player) end @@ -1134,13 +1001,48 @@ function SetPrivilegeRank(player, nrank) game:GetService("PersonalServerService"):Demote(player) end end + +--[[ + Highlights current rank of this player in the popup menu + @Args: + player Player to check for rank on +--]] +local function HighlightMyRank( + player, + BanPlayerButton, + VisitorButton, + MemberButton, + AdminButton +) + BanPlayerButton.Image = + `https://banland.xyz/asset?id={Images.LightPopupMid}` + VisitorButton.Image = `https://banland.xyz/asset?id={Images.DarkPopupMid}` + MemberButton.Image = `https://banland.xyz/asset?id={Images.LightPopupMid}` + AdminButton.Image = `https://banland.xyz/asset?id={Images.DarkPopupBottom}` + + local rank = player.PersonalServerRank + if rank <= PrivilegeLevel.Banned then + BanPlayerButton.Image = + `https://banland.xyz/asset?id={Images.LightBluePopupMid}` + elseif rank <= PrivilegeLevel.Visitor then + VisitorButton.Image = + `https://banland.xyz/asset?id={Images.DarkBluePopupMid}` + elseif rank <= PrivilegeLevel.Member then + MemberButton.Image = + `https://banland.xyz/asset?id={Images.LightBluePopupMid}` + elseif rank <= PrivilegeLevel.Admin then + AdminButton.Image = + `https://banland.xyz/asset?id={Images.DarkBluePopupBottom}` + end +end + --[[ called when player selects new privilege level from popup menu @Args: player player to set privileges on nlevel new privilege level for this player --]] -function OnPrivilegeLevelSelect( +local function OnPrivilegeLevelSelect( player, nlevel, BanPlayerButton, @@ -1159,47 +1061,28 @@ function OnPrivilegeLevelSelect( ) end ---[[ - Highlights current rank of this player in the popup menu - @Args: - player Player to check for rank on ---]] -function HighlightMyRank( - player, - BanPlayerButton, - VisitorButton, - MemberButton, - AdminButton -) - BanPlayerButton.Image = - `http://banland.xyz/asset/?id={Images.LightPopupMid}` - VisitorButton.Image = `http://banland.xyz/asset/?id={Images.DarkPopupMid}` - MemberButton.Image = `http://banland.xyz/asset/?id={Images.LightPopupMid}` - AdminButton.Image = `http://banland.xyz/asset/?id={Images.DarkPopupBottom}` - - local rank = player.PersonalServerRank - if rank <= PrivilegeLevel.Banned then - BanPlayerButton.Image = - `http://banland.xyz/asset/?id={Images.LightBluePopupMid}` - elseif rank <= PrivilegeLevel.Visitor then - VisitorButton.Image = - `http://banland.xyz/asset/?id={Images.DarkBluePopupMid}` - elseif rank <= PrivilegeLevel.Member then - MemberButton.Image = - `http://banland.xyz/asset/?id={Images.LightBluePopupMid}` - elseif rank <= PrivilegeLevel.Admin then - AdminButton.Image = - `http://banland.xyz/asset/?id={Images.DarkBluePopupBottom}` - end -end - -------------------------- -- Report abuse handling -------------------------- + +--[[ + resets and closes abuse dialog +--]] +local function CloseAbuseDialog() + AbuseName = nil + SubmitReportButton.Active = false + SubmitReportButton.Image = "https://banland.xyz/asset?id=96502438" -- 96501119', + AbuseDescriptionBox:Destroy() + CalmingAbuseBox.Parent = nil + NormalAbuseBox.Parent = nil + ReportAbuseShield.Parent = nil + AbuseSettingsFrame.Visible = true +end + --[[ does final reporting of abuse on selected player, calls closeAbuseDialog --]] -function OnSubmitAbuse() +local function OnSubmitAbuse() if SubmitReportButton.Active then if AbuseName and SelectedPlayer then AbuseSettingsFrame.Visible = false @@ -1223,6 +1106,25 @@ function OnSubmitAbuse() end end +local function ClosePopUpPanel() + if SelectedPlayerEntry then + local tframe = SelectedPlayerEntry.Frame + Spawn(function() + TweenProperty(tframe, "BackgroundTransparency", 0.5, 1, BASE_TWEEN) + end) + end + PopUpPanel:TweenPosition( + UDim2.new(1, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) + wait(0.1) + InPopupWaitForClick = false + SelectedPlayerEntry = nil +end + --[[ opens the abuse dialog, initialises text to display selectedplayer --]] @@ -1242,19 +1144,6 @@ local function OpenAbuseDialog() ReportAbuseShield.Parent = ScreenGui ClosePopUpPanel() end ---[[ - resets and closes abuse dialog ---]] -function CloseAbuseDialog() - AbuseName = nil - SubmitReportButton.Active = false - SubmitReportButton.Image = "http://banland.xyz/asset/?id=96502438" -- 96501119', - AbuseDescriptionBox:Destroy() - CalmingAbuseBox.Parent = nil - NormalAbuseBox.Parent = nil - ReportAbuseShield.Parent = nil - AbuseSettingsFrame.Visible = true -end --[[ creates dropdownbox, registers all listeners for abuse dialog @@ -1264,7 +1153,7 @@ local function InitReportAbuse() AbuseName = abuseText if AbuseName and SelectedPlayer then SubmitReportButton.Active = true - SubmitReportButton.Image = "http://banland.xyz/asset/?id=96501119" + SubmitReportButton.Image = "https://banland.xyz/asset?id=96501119" end end @@ -1310,7 +1199,7 @@ end when friend button is clicked, tries to take appropriate action, based on current friend status with SelectedPlayer --]] -function OnFriendButtonSelect() +local function OnFriendButtonSelect() local friendStatus = GetFriendStatus(SelectedPlayer) if friendStatus == Enum.FriendStatus.Friend then LocalPlayer:RevokeFriendship(SelectedPlayer) @@ -1327,7 +1216,7 @@ function OnFriendButtonSelect() --PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Linear", BASE_TWEEN,true) end -function OnFriendRefuseButtonSelect() +local function OnFriendRefuseButtonSelect() LocalPlayer:RevokeFriendship(SelectedPlayer) ClosePopUpPanel() PopUpPanel:TweenPosition( @@ -1344,7 +1233,7 @@ end --[[ used by lua's table.sort to sort player entries --]] -function PlayerSortFunction(a, b) +local function PlayerSortFunction(a, b) -- prevents flipping out leaderboard if a.Score == b.Score then return a.Player.Name:upper() < b.Player.Name:upper() @@ -1361,8 +1250,812 @@ end --------------------------------- -- Stat Handling --------------------------------- + +--------------------------- +-- Minimizing and maximizing +--------------------------- + +local function ExpandNames() + if #ScoreNames ~= 0 then + for _, i in pairs(StatTitles:GetChildren()) do + Spawn(function() + TweenProperty( + i, + "TextTransparency", + i.TextTransparency, + 0, + BASE_TWEEN + ) + end) + end + HeaderFrameHeight = 0.09 + --as of writing, this and 'CloseNames' are the only places headerframe is resized + HeaderFrame:TweenSizeAndPosition( + UDim2.new( + HeaderFrame.Size.X.Scale, + HeaderFrame.Size.X.Offset, + HeaderFrameHeight, + 0 + ), + HeaderFrame.Position, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + TopClipFrame:TweenPosition( + UDim2.new(TopClipFrame.Position.X.Scale, 0, HeaderFrameHeight, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + BottomShiftFrame:TweenPosition( + UDim2.new(0, 0, HeaderFrameHeight, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + end +end + +local function CloseNames() + if #ScoreNames ~= 0 then + HeaderFrameHeight = 0.07 + if not IsMaximized.Value then + for _, i in pairs(StatTitles:GetChildren()) do + Spawn(function() + TweenProperty( + i, + "TextTransparency", + i.TextTransparency, + 1, + BASE_TWEEN + ) + end) + end + end + BottomShiftFrame:TweenPosition( + UDim2.new(0, 0, HeaderFrameHeight, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + HeaderFrame:TweenSizeAndPosition( + UDim2.new( + HeaderFrame.Size.X.Scale, + HeaderFrame.Size.X.Offset, + HeaderFrameHeight, + 0 + ), + HeaderFrame.Position, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + TopClipFrame:TweenPosition( + UDim2.new(TopClipFrame.Position.X.Scale, 0, HeaderFrameHeight, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + end +end + +local function UpdateStatNames() + if not AreNamesExpanded.Value or IsMinimized.Value then + CloseNames() + else + ExpandNames() + end +end + +local function ToggleMinimize() + IsMinimized.Value = not IsMinimized.Value + UpdateStatNames() +end + +local FONT_SIZES = { + "Size8", + "Size9", + "Size10", + "Size11", + "Size12", + "Size14", + "Size24", + "Size36", + "Size48", +} + +--[[ + Will fit the player's name to the bounds of the header + called on resize of the window and playedr name change events + HACK: cannot use 'Textscaled' due to unable to find text bounds when scaled +--]] +local function UpdateHeaderNameSize() + local tHeader = HeaderName:Clone() + tHeader.Position = UDim2.new(2, 0, 2, 0) + tHeader.Parent = ScreenGui + local fSize = 7 --Size24 in table + tHeader.FontSize = FONT_SIZES[fSize] + Delay(0.2, function() + while tHeader.TextBounds.x == 0 do + wait() + end + while tHeader.TextBounds.x - NormalBounds.X.Offset > 1 do + fSize -= 1 + tHeader.FontSize = FONT_SIZES[fSize] + wait(0.2) + end + HeaderName.FontSize = tHeader.FontSize + tHeader:Destroy() + end) +end +ScreenGui.Changed:connect(UpdateHeaderNameSize) + +local UpdateMinimize + +--[[ + Manages the position/size of the mainFrame, swaps out different resolution images for the frame + fades in and out the stat names, moves position of headername and header score +--]] +local function UpdateMaximize() + if IsMaximized.Value then + for j = 1, #ScoreNames, 1 do + local scoreval = ScoreNames[j] + StatTitles[scoreval.Name]:TweenPosition( + UDim2.new(0.4 + ((0.6 / #ScoreNames) * (j - 1)) - 1, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) + end + + if IsMinimized.Value then + ToggleMinimize() + else + UpdateMinimize() + end + + MainFrame:TweenSizeAndPosition( + MaximizedBounds, + MaximizedPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + HeaderScore:TweenPosition( + UDim2.new(0, 0, HeaderName.Position.Y.Scale, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + HeaderName:TweenPosition( + UDim2.new( + -0.1, + -HeaderScore.TextBounds.x, + HeaderName.Position.Y.Scale, + 0 + ), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + HeaderFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.LargeHeader + BottomFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.LargeBottom + for index, i in ipairs(MiddleFrameBackgrounds) do + if (index % 2) ~= 1 then + i.Background.Image = "https://banland.xyz/asset?id=" + .. Images.LargeDark + else + i.Background.Image = "https://banland.xyz/asset?id=" + .. Images.LargeLight + end + end + for _, i in ipairs(MiddleFrames) do + if i:FindFirstChild "ClickListener" then + i.ClickListener.Size = + UDim2.new(0.974, 0, i.ClickListener.Size.Y.Scale, 0) + end + for j = 1, #ScoreNames, 1 do + local scoreval = ScoreNames[j] + if i:FindFirstChild(scoreval.Name) then + i[scoreval.Name]:TweenPosition( + UDim2.new( + 0.4 + ((0.6 / #ScoreNames) * (j - 1)) - 1, + 0, + 0, + 0 + ), + "Out", + "Linear", + BASE_TWEEN, + true + ) + end + end + end + for _, entry in ipairs(PlayerFrames) do + WaitForChild(entry.Frame, "TitleFrame").Size = + UDim2.new(0.38, 0, entry.Frame.TitleFrame.Size.Y.Scale, 0) + end + + for _, entry in ipairs(TeamFrames) do + WaitForChild(entry.Frame, "TitleFrame").Size = + UDim2.new(0.38, 0, entry.Frame.TitleFrame.Size.Y.Scale, 0) + end + else + if not IsMinimized.Value then + MainFrame:TweenSizeAndPosition( + NormalBounds, + NormalPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + end + HeaderScore:TweenPosition( + UDim2.new(0, 0, 0.4, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + HeaderName:TweenPosition( + UDim2.new(0, 0, HeaderName.Position.Y.Scale, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + HeaderFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.NormalHeader + BottomFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.NormalBottom + for index, i in ipairs(MiddleFrameBackgrounds) do + if index % 2 ~= 1 then + i.Background.Image = "https://banland.xyz/asset?id=" + .. Images.midDark + else + i.Background.Image = "https://banland.xyz/asset?id=" + .. Images.midLight + end + end + for _, i in ipairs(MiddleFrames) do + if i:FindFirstChild "ClickListener" then + i.ClickListener.Size = + UDim2.new(0.96, 0, i.ClickListener.Size.Y.Scale, 0) + for j = 1, #ScoreNames, 1 do + local scoreval = ScoreNames[j] + if i:FindFirstChild(scoreval.Name) and scoreval.XOffset then + -- print(`updateing stat position {scoreval["Name"]}`) + i[scoreval.Name]:TweenPosition( + UDim2.new(RightEdgeSpace, -scoreval.XOffset, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) + end + end + end + end + + for _, entry in ipairs(TeamFrames) do + WaitForChild(entry.Frame, "TitleFrame").Size = UDim2.new( + 0, + BaseScreenXSize * 0.9, + entry.Frame.TitleFrame.Size.Y.Scale, + 0 + ) + end + for _, entry in ipairs(PlayerFrames) do + WaitForChild(entry.Frame, "TitleFrame").Size = UDim2.new( + 0, + BaseScreenXSize * 0.9, + entry.Frame.TitleFrame.Size.Y.Scale, + 0 + ) + end + end +end + +local function GetScoreValue(score) + if + score:IsA "DoubleConstrainedValue" or score:IsA "IntConstrainedValue" + then + return score.ConstrainedValue + elseif score:IsA "BoolValue" then + if score.Value then + return 1 + end + return 0 + end + return score.Value +end + +--[[ + updates size of scrollbar depending on how many entries exist +--]] +local function UpdateScrollBarSize() + local entryListSize = #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale + local shownAreaSize = (BottomClipFrame.Position.Y.Scale + 1) + ScrollBar.Size = UDim2.new(1, 0, shownAreaSize / entryListSize, 0) +end + +--[[ + updates whether the scroll bar should be showing, if it is showing, updates + the size of it +--]] +local function UpdateScrollBarVisibility() + if AreAllEntriesOnScreen() then + ScrollBar.BackgroundTransparency = 1 + else + ScrollBar.BackgroundTransparency = 0 + UpdateScrollBarSize() + end +end + +--[[ + updates position of listframe so that no gaps at the bottom or top of the list are visible + updates position of scrollbar to match what parts of the list are visible +--]] +local function UpdateScrollPosition() + local minPos = GetMinScroll() + local maxPos = GetMaxScroll() + local scrollLength = maxPos - minPos + + local yscrollpos = + math.max(math.min(ListFrame.Position.Y.Scale, maxPos), minPos) + ListFrame.Position = UDim2.new( + ListFrame.Position.X.Scale, + ListFrame.Position.X.Offset, + yscrollpos, + ListFrame.Position.Y.Offset + ) + + local adjustedLength = 1 - ScrollBar.Size.Y.Scale + ScrollBar.Position = UDim2.new( + 0, + 0, + adjustedLength + - ( + adjustedLength + * ((ListFrame.Position.Y.Scale - minPos) / scrollLength) + ), + 0 + ) +end + +--[[ + turns a list of team entries with sub lists of players into a single ordered + list, in the correct order,and of the correct length + @Args: + tframes the team entries to unroll + outframes the list to unroll these entries into +--]] +local function UnrollTeams(tframes: table, outframes: table) + local numEntries = 0 + if NeutralTeam and not NeutralTeam.IsHidden then + for _, val in ipairs(NeutralTeam.MyPlayers) do + numEntries += 1 + outframes[numEntries] = val.Frame + end + numEntries += 1 + outframes[numEntries] = NeutralTeam.Frame + end + for _, val in ipairs(tframes) do + if not val.IsHidden then + for _, pval in ipairs(val.MyPlayers) do + numEntries += 1 + outframes[numEntries] = pval.Frame + end + numEntries += 1 + outframes[numEntries] = val.Frame + end + end + -- clear any additional entries from outframes + for i = numEntries + 1, #outframes, 1 do + outframes[i] = nil + end +end + +-- OUTLINE +--[[ + adds up all the score of this team's players to form the team score + @Args: + team team entry to sum the scores of +--]] +local function AddTeamScores(team) + for j = 1, #ScoreNames, 1 do + local i = ScoreNames[j] + local tscore = 0 + for _, k in ipairs(team.MyPlayers) do + local tval = k.Player:FindFirstChild "leaderstats" + and k.Player.leaderstats:FindFirstChild(i.Name) + if tval and not tval:IsA "StringValue" then + tscore += GetScoreValue((k.Player.leaderstats)[i.Name]) + end + end + if team.Frame:FindFirstChild(i.Name) then + -- team.Frame[i.Name].Size = UDim2.new( + -- 1 - (ScrollBarFrame.Size.X.Scale * 2), + -- -((j - 1) * SpacingPerStat), + -- 1, + -- 0 + -- ) + team.Frame[i.Name].Text = tostring(tscore) + end + end + UpdateMinimize() +end + +--[[ + uses lua's table.sort to sort the teams +--]] +local function TeamSortFunc(a, b) + if a.TeamScore == b.TeamScore then + return a.ID < b.ID + end + if not a.TeamScore then + return false + end + if not b.TeamScore then + return true + end + return a.TeamScore < b.TeamScore +end + +--[[ + consider adding lock with wait for performance + sorts each of the team's player lists induvidually, adds up the team scores. + @Args: + tentries table of team entries +--]] +local function SortTeams(tentries) + for _, val in ipairs(tentries) do + table.sort(val.MyPlayers, PlayerSortFunction) + AddTeamScores(val) + end + table.sort(tentries, TeamSortFunc) +end + +local RecreateScoreColumns + +--[[ + base update for team mode, adds up the scores of all teams, sorts them, + then unrolls them into middleframes +--]] +local function TeamListModeUpdate() + RecreateScoreColumns(PlayerFrames) + SortTeams(TeamFrames) + if NeutralTeam then + AddTeamScores(NeutralTeam) + --RecreateScoreColumns(NeutralTeam['MyPlayers']) + end + UnrollTeams(TeamFrames, MiddleFrames) +end + +-- OUTLINE +--[[ + the basic update for the playerlist mode's state, + assures the order and length of the player frames + --]] +local function PlayerListModeUpdate() + RecreateScoreColumns(PlayerFrames) + table.sort(PlayerFrames, PlayerSortFunction) + for i, val in ipairs(PlayerFrames) do + MiddleFrames[i] = val.Frame + end + for i = #PlayerFrames + 1, #MiddleFrames, 1 do + MiddleFrames[i] = nil + end + UpdateMinimize() +end + +--[[ + called when ANYTHING changes the state of the playerlist + re-sorts everything,assures correct positions of all elements +--]] +local function BaseUpdate() + while BaseUpdateLock do + debugprint "in baseupdate lock" + wait() + end + BaseUpdateLock = true + --print ('baseupdate') + UpdateStatNames() + + if #TeamFrames == 0 and not NeutralTeam then + PlayerListModeUpdate() + else + TeamListModeUpdate() + end + for i, key in ipairs(MiddleFrames) do + if key.Parent ~= nil then + key:TweenPosition( + UDim2.new(0.5, 0, ((#MiddleFrames - i) * key.Size.Y.Scale), 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) + end + end + if not IsMinimized.Value and #MiddleFrames > DefaultEntriesOnScreen then + UpdateScrollPosition() + end + + UpdateMinimize() + + UpdateScrollBarSize() + UpdateScrollPosition() + + UpdateScrollBarVisibility() + --debugprint('EndBaseUpdate') + BaseUpdateLock = false +end + +RecreateScoreColumns = function(ptable) + -- OUTLINE + local function MakeScoreEntry(entry, scoreval, panel) + if not panel:FindFirstChild "PlayerScore" then + return + end + local nscoretxt = panel:FindFirstChild("PlayerScore"):Clone() + local thisScore + --here lies the resting place of a once great and terrible bug + --may its treachery never be forgoten, lest its survivors fall for it again + --RIP the leaderstat bug, oct 2012-nov 2012 + wait() + if + entry.Player:FindFirstChild "leaderstats" + and entry.Player.leaderstats:FindFirstChild(scoreval.Name) + then + thisScore = entry.Player + :FindFirstChild("leaderstats") + :FindFirstChild(scoreval.Name) + else + return + end + + if not entry.Player.Parent then + return + end + + nscoretxt.Name = scoreval.Name + nscoretxt.Text = tostring(GetScoreValue(thisScore)) + if scoreval.Name == ScoreNames[1]["Name"] then + debugprint "changing score" + entry.Score = GetScoreValue(thisScore) + if entry.Player == LocalPlayer then + HeaderScore.Text = tostring(GetScoreValue(thisScore)) + end + end + + thisScore.Changed:connect(function() + if not thisScore.Parent then + return + end + if scoreval.Name == ScoreNames[1]["Name"] then + entry.Score = GetScoreValue(thisScore) + if entry.Player == LocalPlayer then + HeaderScore.Text = tostring(GetScoreValue(thisScore)) + end + end + nscoretxt.Text = tostring(GetScoreValue(thisScore)) + BaseUpdate() + end) + return nscoretxt + end + + while AddingStatLock do + debugprint "In Adding Stat Lock2" + wait() + end + AddingStatLock = true + local Xoffset = 5 --15 --current offset from Right + local maxXOffset = Xoffset + local MaxSizeColumn = 0 --max size for this column + + -- foreach known leaderstat + for j = #ScoreNames, 1, -1 do + local scoreval = ScoreNames[j] + + MaxSizeColumn = 0 + -- for each entry in this player table + for _, entry in ipairs(ptable) do + local panel = entry.Frame + -- if this panel does not have an element named after this stat + if not panel:FindFirstChild(scoreval.Name) then + -- make an entry for this object + local nentry = MakeScoreEntry(entry, scoreval, panel) + if nentry then + debugprint(`adding {nentry.Name} to {entry.Player.Name}`) + nentry.Parent = panel + -- add score to team + if + entry.MyTeam + and entry.MyTeam ~= NeutralTeam + and not entry.MyTeam.Frame:FindFirstChild(scoreval.Name) + then + local ntitle = nentry:Clone() + --ntitle.TextXAlignment = 'Right' + ntitle.Parent = entry.MyTeam.Frame + end + end + end + scoreval.XOffset = Xoffset + + if panel:FindFirstChild(scoreval.Name) then + MaxSizeColumn = + math.max(MaxSizeColumn, panel[scoreval.Name].TextBounds.X) + end + end + + if AreNamesExpanded.Value then + MaxSizeColumn = + math.max(MaxSizeColumn, StatTitles[scoreval.Name].TextBounds.X) + StatTitles[scoreval.Name]:TweenPosition( + UDim2.new(RightEdgeSpace, -Xoffset, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) + else + StatTitles[scoreval.Name]:TweenPosition( + UDim2.new((0.4 + ((0.6 / #ScoreNames) * (j - 1))) - 1, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) + end + scoreval.ColumnSize = MaxSizeColumn + Xoffset += SpacingPerStat + MaxSizeColumn + maxXOffset = math.max(Xoffset, maxXOffset) + end + NormalBounds = + UDim2.new(0, BaseScreenXSize + maxXOffset - SpacingPerStat, 0, 800) + NormalPosition = + UDim2.new(1, -NormalBounds.X.Offset, NormalPosition.Y.Scale, 0) + UpdateHeaderNameSize() + UpdateMaximize() + + AddingStatLock = false +end + +local function ToggleMaximize() + IsMaximized.Value = not IsMaximized.Value + RecreateScoreColumns(PlayerFrames) --done to re-position stat names NOTE: optimize-able +end + +--[[ + Does more than it looks like + monitors positions of the clipping frames and bottom frames + called from EVERYWHERE, too much probably +--]] +UpdateMinimize = function() + if IsMinimized.Value then + if IsMaximized.Value then + ToggleMaximize() + end + if not IsTabified.Value then + MainFrame:TweenSizeAndPosition( + UDim2.new( + 0.010, + HeaderName.TextBounds.X, + NormalBounds.Y.Scale, + NormalBounds.Y.Offset + ), + UDim2.new( + 0.990, + -HeaderName.TextBounds.X, + NormalPosition.Y.Scale, + 0 + ), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + else + MainFrame:TweenSizeAndPosition( + NormalBounds, + NormalPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + end + --(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale) + BottomClipFrame:TweenPosition( + UDim2.new(0, 0, -1, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + BottomFrame:TweenPosition( + UDim2.new(0, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + FocusFrame.Size = UDim2.new(1, 0, HeaderFrameHeight, 0) + ExtendTab.Image = "https://banland.xyz/asset?id=94692731" + else + if not IsMaximized.Value then + MainFrame:TweenSizeAndPosition( + NormalBounds, + NormalPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + end + --do limiting + DefaultBottomClipPos = math.min( + math.max(DefaultBottomClipPos, -1), + -1 + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) + ) + UpdateScrollPosition() + + BottomClipFrame.Position = UDim2.new(0, 0, DefaultBottomClipPos, 0) + local bottomPositon = ( + DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale + ) + BottomFrame.Position = UDim2.new(0, 0, bottomPositon, 0) + FocusFrame.Size = UDim2.new(1, 0, bottomPositon + HeaderFrameHeight, 0) + ExtendTab.Image = "https://banland.xyz/asset?id=94825585" + end +end + +local function Tabify() + IsTabified.Value = true + IsMaximized.Value = false + IsMinimized.Value = true + UpdateMinimize() + IsTabified.Value = true + ScreenGui:TweenPosition( + UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset - 10, 0, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) +end + +local function UnTabify() + if IsTabified.Value then + IsTabified.Value = false + ScreenGui:TweenPosition( + UDim2.new(0, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + end +end + -- removes and closes all leaderboard stuffs -function BlowThisPopsicleStand() +local function BlowThisPopsicleStand() --ScreenGui:Destroy() --script:Destroy() --time to make the fanboys rage... @@ -1371,7 +2064,7 @@ end --[[ used by lua's table.sort to prioritize score entries --]] -function StatSort(a, b) +local function StatSort(a, b) -- primary stats should be shown before all others if a.IsPrimary ~= b.IsPrimary then return a.IsPrimary @@ -1382,19 +2075,34 @@ function StatSort(a, b) end return a.Priority < b.Priority end + --[[ doing WAAY too much here, for optimization update only your team @Args: playerEntry Entry of player who had a stat change property Name of stat changed --]] -function StatChanged(_, _) --playerEntry, property) +local function StatChanged(_, _) --playerEntry, property) -- if(playerEntry['MyTeam']) then -- UpdateSingleTeam(playerEntry['MyTeam']) -- else BaseUpdate() -- end end + +local function CreateStatTitle(statName) + local ntitle = MiddleTemplate:FindFirstChild("PlayerScore"):Clone() + ntitle.Name = statName + ntitle.Text = statName + -- ntitle + if IsMaximized.Value then + ntitle.TextTransparency = 0 + else + ntitle.TextTransparency = 1 + end + ntitle.Parent = StatTitles +end + --[[ Called when stat is added if playerEntry is localplayer, will add to score names and re-sort the stats, and resize the width of the leaderboard @@ -1405,7 +2113,7 @@ end nchild new child value to leaderstats playerEntry entry this stat was added to --]] -function StatAdded(nchild, playerEntry) +local function StatAdded(nchild, playerEntry) -- dont re - add a leaderstat I alreday have while AddingStatLock do debugprint "in stat added function lock" @@ -1482,7 +2190,7 @@ end nchild ___value to be removed playerEntry entry of player value is being removed from --]] -function StatRemoved(nchild, playerEntry) +local function StatRemoved(nchild, playerEntry) while AddingStatLock do debugprint "In Adding Stat Lock1" wait() @@ -1514,568 +2222,13 @@ end clears all stats from a given playerEntry used when leaderstats are removed, or when new leaderstats are added(for weird edge case)+ --]] -function RemoveAllStats(playerEntry) +local function RemoveAllStats(playerEntry) for _, val in ipairs(ScoreNames) do StatRemoved(val, playerEntry) end end -function GetScoreValue(score) - if - score:IsA "DoubleConstrainedValue" or score:IsA "IntConstrainedValue" - then - return score.ConstrainedValue - elseif score:IsA "BoolValue" then - if score.Value then - return 1 - end - return 0 - end - return score.Value -end ---[[ - ---]] -function MakeScoreEntry(entry, scoreval, panel) - if not panel:FindFirstChild "PlayerScore" then - return - end - local nscoretxt = panel:FindFirstChild("PlayerScore"):Clone() - local thisScore - --here lies the resting place of a once great and terrible bug - --may its treachery never be forgoten, lest its survivors fall for it again - --RIP the leaderstat bug, oct 2012-nov 2012 - wait() - if - entry.Player:FindFirstChild "leaderstats" - and entry.Player.leaderstats:FindFirstChild(scoreval.Name) - then - thisScore = entry.Player - :FindFirstChild("leaderstats") - :FindFirstChild(scoreval.Name) - else - return - end - - if not entry.Player.Parent then - return - end - - nscoretxt.Name = scoreval.Name - nscoretxt.Text = tostring(GetScoreValue(thisScore)) - if scoreval.Name == ScoreNames[1]["Name"] then - debugprint "changing score" - entry.Score = GetScoreValue(thisScore) - if entry.Player == LocalPlayer then - HeaderScore.Text = tostring(GetScoreValue(thisScore)) - end - end - - thisScore.Changed:connect(function() - if not thisScore.Parent then - return - end - if scoreval.Name == ScoreNames[1]["Name"] then - entry.Score = GetScoreValue(thisScore) - if entry.Player == LocalPlayer then - HeaderScore.Text = tostring(GetScoreValue(thisScore)) - end - end - nscoretxt.Text = tostring(GetScoreValue(thisScore)) - BaseUpdate() - end) - return nscoretxt -end - -function CreateStatTitle(statName) - local ntitle = MiddleTemplate:FindFirstChild("PlayerScore"):Clone() - ntitle.Name = statName - ntitle.Text = statName - -- ntitle - if IsMaximized.Value then - ntitle.TextTransparency = 0 - else - ntitle.TextTransparency = 1 - end - ntitle.Parent = StatTitles -end - -function RecreateScoreColumns(ptable) - while AddingStatLock do - debugprint "In Adding Stat Lock2" - wait() - end - AddingStatLock = true - local Xoffset = 5 --15 --current offset from Right - local maxXOffset = Xoffset - local MaxSizeColumn = 0 --max size for this column - - -- foreach known leaderstat - for j = #ScoreNames, 1, -1 do - local scoreval = ScoreNames[j] - - MaxSizeColumn = 0 - -- for each entry in this player table - for _, entry in ipairs(ptable) do - local panel = entry.Frame - local tplayer = entry.Player - -- if this panel does not have an element named after this stat - if not panel:FindFirstChild(scoreval.Name) then - -- make an entry for this object - local nentry = MakeScoreEntry(entry, scoreval, panel) - if nentry then - debugprint(`adding {nentry.Name} to {entry.Player.Name}`) - nentry.Parent = panel - -- add score to team - if - entry.MyTeam - and entry.MyTeam ~= NeutralTeam - and not entry.MyTeam.Frame:FindFirstChild(scoreval.Name) - then - local ntitle = nentry:Clone() - --ntitle.TextXAlignment = 'Right' - ntitle.Parent = entry.MyTeam.Frame - end - end - end - scoreval.XOffset = Xoffset - - if panel:FindFirstChild(scoreval.Name) then - MaxSizeColumn = - math.max(MaxSizeColumn, panel[scoreval.Name].TextBounds.X) - end - end - - if AreNamesExpanded.Value then - MaxSizeColumn = - math.max(MaxSizeColumn, StatTitles[scoreval.Name].TextBounds.X) - StatTitles[scoreval.Name]:TweenPosition( - UDim2.new(RightEdgeSpace, -Xoffset, 0, 0), - "Out", - "Linear", - BASE_TWEEN, - true - ) - else - StatTitles[scoreval.Name]:TweenPosition( - UDim2.new((0.4 + ((0.6 / #ScoreNames) * (j - 1))) - 1, 0, 0, 0), - "Out", - "Linear", - BASE_TWEEN, - true - ) - end - scoreval.ColumnSize = MaxSizeColumn - Xoffset += SpacingPerStat + MaxSizeColumn - maxXOffset = math.max(Xoffset, maxXOffset) - end - NormalBounds = - UDim2.new(0, BaseScreenXSize + maxXOffset - SpacingPerStat, 0, 800) - NormalPosition = - UDim2.new(1, -NormalBounds.X.Offset, NormalPosition.Y.Scale, 0) - UpdateHeaderNameSize() - UpdateMaximize() - - AddingStatLock = false -end ---------------------------- --- Minimizing and maximizing ---------------------------- - -function ToggleMinimize() - IsMinimized.Value = not IsMinimized.Value - UpdateStatNames() -end - -function ToggleMaximize() - IsMaximized.Value = not IsMaximized.Value - RecreateScoreColumns(PlayerFrames) --done to re-position stat names NOTE: optimize-able -end - -function Tabify() - IsTabified.Value = true - IsMaximized.Value = false - IsMinimized.Value = true - UpdateMinimize() - IsTabified.Value = true - ScreenGui:TweenPosition( - UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset - 10, 0, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) -end - -function UnTabify() - if IsTabified.Value then - IsTabified.Value = false - ScreenGui:TweenPosition( - UDim2.new(0, 0, 0, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - end -end - ---[[ - Does more than it looks like - monitors positions of the clipping frames and bottom frames - called from EVERYWHERE, too much probably ---]] -function UpdateMinimize() - if IsMinimized.Value then - if IsMaximized.Value then - ToggleMaximize() - end - if not IsTabified.Value then - MainFrame:TweenSizeAndPosition( - UDim2.new( - 0.010, - HeaderName.TextBounds.X, - NormalBounds.Y.Scale, - NormalBounds.Y.Offset - ), - UDim2.new( - 0.990, - -HeaderName.TextBounds.X, - NormalPosition.Y.Scale, - 0 - ), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - else - MainFrame:TweenSizeAndPosition( - NormalBounds, - NormalPosition, - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - end - --(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale) - BottomClipFrame:TweenPosition( - UDim2.new(0, 0, -1, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - BottomFrame:TweenPosition( - UDim2.new(0, 0, 0, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - FocusFrame.Size = UDim2.new(1, 0, HeaderFrameHeight, 0) - ExtendTab.Image = "http://banland.xyz/asset/?id=94692731" - else - if not IsMaximized.Value then - MainFrame:TweenSizeAndPosition( - NormalBounds, - NormalPosition, - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - end - --do limiting - DefaultBottomClipPos = math.min( - math.max(DefaultBottomClipPos, -1), - -1 + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) - ) - UpdateScrollPosition() - - BottomClipFrame.Position = UDim2.new(0, 0, DefaultBottomClipPos, 0) - local bottomPositon = ( - DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale - ) - BottomFrame.Position = UDim2.new(0, 0, bottomPositon, 0) - FocusFrame.Size = UDim2.new(1, 0, bottomPositon + HeaderFrameHeight, 0) - ExtendTab.Image = "http://banland.xyz/asset/?id=94825585" - end -end - ---[[ - Manages the position/size of the mainFrame, swaps out different resolution images for the frame - fades in and out the stat names, moves position of headername and header score ---]] -function UpdateMaximize() - if IsMaximized.Value then - for j = 1, #ScoreNames, 1 do - local scoreval = ScoreNames[j] - StatTitles[scoreval.Name]:TweenPosition( - UDim2.new(0.4 + ((0.6 / #ScoreNames) * (j - 1)) - 1, 0, 0, 0), - "Out", - "Linear", - BASE_TWEEN, - true - ) - end - - if IsMinimized.Value then - ToggleMinimize() - else - UpdateMinimize() - end - - MainFrame:TweenSizeAndPosition( - MaximizedBounds, - MaximizedPosition, - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - HeaderScore:TweenPosition( - UDim2.new(0, 0, HeaderName.Position.Y.Scale, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - HeaderName:TweenPosition( - UDim2.new( - -0.1, - -HeaderScore.TextBounds.x, - HeaderName.Position.Y.Scale, - 0 - ), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - HeaderFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.LargeHeader - BottomFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.LargeBottom - for index, i in ipairs(MiddleFrameBackgrounds) do - if (index % 2) ~= 1 then - i.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.LargeDark - else - i.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.LargeLight - end - end - for _, i in ipairs(MiddleFrames) do - if i:FindFirstChild "ClickListener" then - i.ClickListener.Size = - UDim2.new(0.974, 0, i.ClickListener.Size.Y.Scale, 0) - end - for j = 1, #ScoreNames, 1 do - local scoreval = ScoreNames[j] - if i:FindFirstChild(scoreval.Name) then - i[scoreval.Name]:TweenPosition( - UDim2.new( - 0.4 + ((0.6 / #ScoreNames) * (j - 1)) - 1, - 0, - 0, - 0 - ), - "Out", - "Linear", - BASE_TWEEN, - true - ) - end - end - end - for _, entry in ipairs(PlayerFrames) do - WaitForChild(entry.Frame, "TitleFrame").Size = - UDim2.new(0.38, 0, entry.Frame.TitleFrame.Size.Y.Scale, 0) - end - - for _, entry in ipairs(TeamFrames) do - WaitForChild(entry.Frame, "TitleFrame").Size = - UDim2.new(0.38, 0, entry.Frame.TitleFrame.Size.Y.Scale, 0) - end - else - if not IsMinimized.Value then - MainFrame:TweenSizeAndPosition( - NormalBounds, - NormalPosition, - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - end - HeaderScore:TweenPosition( - UDim2.new(0, 0, 0.4, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - HeaderName:TweenPosition( - UDim2.new(0, 0, HeaderName.Position.Y.Scale, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - HeaderFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.NormalHeader - BottomFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.NormalBottom - for index, i in ipairs(MiddleFrameBackgrounds) do - if index % 2 ~= 1 then - i.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.midDark - else - i.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.midLight - end - end - for _, i in ipairs(MiddleFrames) do - if i:FindFirstChild "ClickListener" then - i.ClickListener.Size = - UDim2.new(0.96, 0, i.ClickListener.Size.Y.Scale, 0) - for j = 1, #ScoreNames, 1 do - local scoreval = ScoreNames[j] - if i:FindFirstChild(scoreval.Name) and scoreval.XOffset then - -- print(`updateing stat position {scoreval["Name"]}`) - i[scoreval.Name]:TweenPosition( - UDim2.new(RightEdgeSpace, -scoreval.XOffset, 0, 0), - "Out", - "Linear", - BASE_TWEEN, - true - ) - end - end - end - end - - for _, entry in ipairs(TeamFrames) do - WaitForChild(entry.Frame, "TitleFrame").Size = UDim2.new( - 0, - BaseScreenXSize * 0.9, - entry.Frame.TitleFrame.Size.Y.Scale, - 0 - ) - end - for _, entry in ipairs(PlayerFrames) do - WaitForChild(entry.Frame, "TitleFrame").Size = UDim2.new( - 0, - BaseScreenXSize * 0.9, - entry.Frame.TitleFrame.Size.Y.Scale, - 0 - ) - end - end -end - -function ExpandNames() - if #ScoreNames ~= 0 then - for _, i in pairs(StatTitles:GetChildren()) do - Spawn(function() - TweenProperty( - i, - "TextTransparency", - i.TextTransparency, - 0, - BASE_TWEEN - ) - end) - end - HeaderFrameHeight = 0.09 - --as of writing, this and 'CloseNames' are the only places headerframe is resized - HeaderFrame:TweenSizeAndPosition( - UDim2.new( - HeaderFrame.Size.X.Scale, - HeaderFrame.Size.X.Offset, - HeaderFrameHeight, - 0 - ), - HeaderFrame.Position, - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - TopClipFrame:TweenPosition( - UDim2.new(TopClipFrame.Position.X.Scale, 0, HeaderFrameHeight, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - BottomShiftFrame:TweenPosition( - UDim2.new(0, 0, HeaderFrameHeight, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - end -end - -function CloseNames() - if #ScoreNames ~= 0 then - HeaderFrameHeight = 0.07 - if not IsMaximized.Value then - for _, i in pairs(StatTitles:GetChildren()) do - Spawn(function() - TweenProperty( - i, - "TextTransparency", - i.TextTransparency, - 1, - BASE_TWEEN - ) - end) - end - end - BottomShiftFrame:TweenPosition( - UDim2.new(0, 0, HeaderFrameHeight, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - HeaderFrame:TweenSizeAndPosition( - UDim2.new( - HeaderFrame.Size.X.Scale, - HeaderFrame.Size.X.Offset, - HeaderFrameHeight, - 0 - ), - HeaderFrame.Position, - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - TopClipFrame:TweenPosition( - UDim2.new(TopClipFrame.Position.X.Scale, 0, HeaderFrameHeight, 0), - "Out", - "Linear", - BASE_TWEEN * 1.2, - true - ) - end -end - -function UpdateStatNames() - if not AreNamesExpanded.Value or IsMinimized.Value then - CloseNames() - else - ExpandNames() - end -end - -function OnScrollWheelMove(direction) +local function OnScrollWheelMove(direction) if not (IsTabified.Value or IsMinimized.Value or InPopupWaitForClick) then local StartFrame = ListFrame.Position local newFrameY = math.max( @@ -2093,7 +2246,7 @@ function OnScrollWheelMove(direction) end end -function AttachScrollWheel() +local function AttachScrollWheel() if ScrollWheelConnections then return end @@ -2112,7 +2265,7 @@ function AttachScrollWheel() ) end -function DetachScrollWheel() +local function DetachScrollWheel() if ScrollWheelConnections then for _, i in pairs(ScrollWheelConnections) do i:disconnect() @@ -2135,381 +2288,12 @@ end) ------------------------ -- Scroll Bar functions ------------------------ ---[[ - updates whether the scroll bar should be showing, if it is showing, updates - the size of it ---]] -function UpdateScrollBarVisibility() - if AreAllEntriesOnScreen() then - ScrollBar.BackgroundTransparency = 1 - else - ScrollBar.BackgroundTransparency = 0 - UpdateScrollBarSize() - end -end ---[[ - updates size of scrollbar depending on how many entries exist ---]] -function UpdateScrollBarSize() - local entryListSize = #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale - local shownAreaSize = (BottomClipFrame.Position.Y.Scale + 1) - ScrollBar.Size = UDim2.new(1, 0, shownAreaSize / entryListSize, 0) -end ---[[ - updates position of listframe so that no gaps at the bottom or top of the list are visible - updates position of scrollbar to match what parts of the list are visible ---]] -function UpdateScrollPosition() - local minPos = GetMinScroll() - local maxPos = GetMaxScroll() - local scrollLength = maxPos - minPos - - local yscrollpos = - math.max(math.min(ListFrame.Position.Y.Scale, maxPos), minPos) - ListFrame.Position = UDim2.new( - ListFrame.Position.X.Scale, - ListFrame.Position.X.Offset, - yscrollpos, - ListFrame.Position.Y.Offset - ) - - local adjustedLength = 1 - ScrollBar.Size.Y.Scale - ScrollBar.Position = UDim2.new( - 0, - 0, - adjustedLength - - ( - adjustedLength - * ((ListFrame.Position.Y.Scale - minPos) / scrollLength) - ), - 0 - ) -end - ---[[ - WARNING:this is in a working state, but uses massive hacks - revize when global input is available - Manages scrolling of the playerlist on mouse drag ---]] -function StartDrag(entry, startx, starty) - local openPanel = true - --[[local draggedFrame = ]] - WaitForChild(entry.Frame, "ClickListener") - local function dragExit() - -- stopDrag = true - - if - entry.Player - and SelectedPlayer - and openPanel - and entry.Player ~= LocalPlayer - and SelectedPlayer.userId > 1 - and LocalPlayer.userId > 1 - then - ActivatePlayerEntryPanel(entry) - end - end - local startY - local StartFrame = ListFrame.Position - local function dragpoll(nx, ny) - if not startY then - startY = AbsoluteToPercent(nx, ny).Y - end - local nowY = AbsoluteToPercent(nx, ny).Y - debugprint( - `drag dist {Vector2.new(startx - nx, starty - ny).magnitude}` - ) - if - Vector2.new(startx - nx, starty - ny).magnitude - > MOUSE_DRAG_DISTANCE - then - openPanel = false - end - - local newFrameY = math.max( - math.min(StartFrame.Y.Scale + (nowY - startY), GetMaxScroll()), - GetMinScroll() - ) - ListFrame.Position = UDim2.new( - StartFrame.X.Scale, - StartFrame.X.Offset, - newFrameY, - StartFrame.Y.Offset - ) - UpdateScrollPosition() - end - WaitForClick(ScreenGui, dragpoll, dragExit) -end - -function StartMinimizeDrag() - Delay(0, function() - local startTime = tick() - debugprint "Got Click2" - local function dragExit() - --debugprint('undone click2') - if tick() - startTime < 0.25 then --was click - ToggleMinimize() - else --was drag - DidMinimizeDrag = true - if IsMinimized.Value then - ToggleMinimize() - end - end - -- stopDrag = true - end - local startY - local StartFrame = DefaultBottomClipPos - local function dragpoll(nx, ny) - if not IsMinimized.Value then - if not startY then - startY = AbsoluteToPercent(nx, ny).Y - end - local nowY = AbsoluteToPercent(nx, ny).Y - local newFrameY - newFrameY = math.min( - math.max(StartFrame + (nowY - startY), -1), - -1 - + ( - #MiddleFrameBackgrounds - * MiddleBGTemplate.Size.Y.Scale - ) - ) - DefaultBottomClipPos = newFrameY - UpdateMinimize() - ScrollBarFrame.Size = UDim2.new( - ScrollBarFrame.Size.X.Scale, - 0, - (DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale), - 0 - ) - ScrollBarFrame.Position = UDim2.new( - ScrollBarFrame.Position.X.Scale, - 0, - 1 - ScrollBarFrame.Size.Y.Scale, - 0 - ) - UpdateScrollBarSize() - UpdateScrollPosition() - UpdateScrollBarVisibility() - end - end - Spawn(function() - WaitForClick(ScreenGui, dragpoll, dragExit) - end) - end) -end - -------------------------------- --- Input Callback functions -------------------------------- -IsMaximized.Value = false -IsMinimized.Value = false -IsMaximized.Changed:connect(UpdateMaximize) -IsMinimized.Changed:connect(UpdateMinimize) - -ExtendButton.MouseButton1Down:connect(function() - if (time() - LastClick < ButtonCooldown) or InPopupWaitForClick then - return - end - LastClick = time() - if IsTabified.Value then - UnTabify() - else - StartMinimizeDrag() - end -end) - -MaximizeButton.MouseButton1Click:connect(function() - if (time() - LastClick < ButtonCooldown) or InPopupWaitForClick then - return - end - LastClick = time() - if IsTabified.Value then - UnTabify() - elseif not AreNamesExpanded.Value then - AreNamesExpanded.Value = true - BaseUpdate() - else - ToggleMaximize() - end -end) - -MaximizeButton.MouseButton2Click:connect(function() - if (time() - LastClick < ButtonCooldown) or InPopupWaitForClick then - return - end - LastClick = time() - if IsTabified.Value then - UnTabify() - elseif IsMaximized.Value then - ToggleMaximize() - elseif AreNamesExpanded.Value then - AreNamesExpanded.Value = false - BaseUpdate() - else - Tabify() - end -end) - -------------------------------- --- MiddleFrames management -------------------------------- ---[[ - adds a background frame to the listframe ---]] -function AddMiddleBGFrame() - local nBGFrame = MiddleBGTemplate:Clone() - nBGFrame.Position = - UDim2.new(0.5, 0, (#MiddleFrameBackgrounds * nBGFrame.Size.Y.Scale), 0) - if (#MiddleFrameBackgrounds + 1) % 2 ~= 1 then - if IsMaximized.Value then - nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.LargeDark - else - nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.midDark - end - else - if IsMaximized.Value then - nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.LargeLight - else - nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" - .. Images.midLight - end - end - nBGFrame.Parent = ListFrame - table.insert(MiddleFrameBackgrounds, nBGFrame) - - if #MiddleFrameBackgrounds < DefaultListSize and not DidMinimizeDrag then - --print('readjusting bottom clip') - DefaultBottomClipPos = -1 - + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) - end - - if not IsMinimized.Value then - UpdateMinimize() - end -end ---[[ - removes a background from from the listframe ---]] -function RemoveMiddleBGFrame() - MiddleFrameBackgrounds[#MiddleFrameBackgrounds]:Destroy() - table.remove(MiddleFrameBackgrounds, #MiddleFrameBackgrounds) - if not IsMinimized.Value then - UpdateMinimize() - end -end -------------------------------- --- Player Callback functions -------------------------------- -local FONT_SIZES = { - "Size8", - "Size9", - "Size10", - "Size11", - "Size12", - "Size14", - "Size24", - "Size36", - "Size48", -} ---[[ - note:should probably set to something other than mainFrame.AbsoluteSize, should work for now - if textbounds ever works on textscaled, switch to that :( ---]] -function ChangeHeaderName(nname) - HeaderName.Text = nname - UpdateHeaderNameSize() -end - ---[[ - Will fit the player's name to the bounds of the header - called on resize of the window and playedr name change events - HACK: cannot use 'Textscaled' due to unable to find text bounds when scaled ---]] -function UpdateHeaderNameSize() - local tHeader = HeaderName:Clone() - tHeader.Position = UDim2.new(2, 0, 2, 0) - tHeader.Parent = ScreenGui - local fSize = 7 --Size24 in table - tHeader.FontSize = FONT_SIZES[fSize] - Delay(0.2, function() - while tHeader.TextBounds.x == 0 do - wait() - end - while tHeader.TextBounds.x - NormalBounds.X.Offset > 1 do - fSize -= 1 - tHeader.FontSize = FONT_SIZES[fSize] - wait(0.2) - end - HeaderName.FontSize = tHeader.FontSize - tHeader:Destroy() - end) -end -ScreenGui.Changed:connect(UpdateHeaderNameSize) - ---[[ - called only when the leaderstats object is added to a given player entry - removes old stats, adds any existing stats, and sets up listeners for new stats - @Args: - playerEntry A reference to the ENTRY(table) of the player who had leaderstats added ---]] -function LeaderstatsAdded(playerEntry) - --RemoveAllStats(playerEntry) - local nplayer = playerEntry.Player - for _, i in pairs(nplayer.leaderstats:GetChildren()) do - StatAdded(i, playerEntry) - end - nplayer.leaderstats.ChildAdded:connect(function(nchild) - StatAdded(nchild, playerEntry) - end) - nplayer.leaderstats.ChildRemoved:connect(function(nchild) - StatRemoved(nchild, playerEntry) - end) -end ---[[ - called when leaderstats object is removed from play in player entry - Note: may not be needed, might be able to just rely on leaderstats added - @Args: - oldLeaderstats leaderstats object to be removed - playerEntry A reference to the ENTRY(table) of the player ---]] -function LeaderstatsRemoved(_, playerEntry) - while AddingFrameLock do - debugprint(`waiting to insert {playerEntry.Player.Name}`) - wait() - end - AddingFrameLock = true - RemoveAllStats(playerEntry) - AddingFrameLock = false -end - -function ClosePopUpPanel() - if SelectedPlayerEntry then - local tframe = SelectedPlayerEntry.Frame - Spawn(function() - TweenProperty(tframe, "BackgroundTransparency", 0.5, 1, BASE_TWEEN) - end) - end - PopUpPanel:TweenPosition( - UDim2.new(1, 0, 0, 0), - "Out", - "Linear", - BASE_TWEEN, - true - ) - wait(0.1) - InPopupWaitForClick = false - SelectedPlayerEntry = nil -end --[[ prepares the needed popup to be tweened on screen, and updates the position of the popup clip frame to match the selected player frame's position --]] -function InitMovingPanel(entry, player) +local function InitMovingPanel(entry, player) PopUpClipFrame.Parent = ScreenGui if PopUpPanel then @@ -2647,6 +2431,279 @@ function InitMovingPanel(entry, player) end) end +local function ActivatePlayerEntryPanel(entry) + entry.Frame.BackgroundColor3 = Color3.new(0, 1, 1) + Spawn(function() + TweenProperty(entry.Frame, "BackgroundTransparency", 1, 0.5, 0.5) + end) + InPopupWaitForClick = true + InitMovingPanel(entry, entry.Player) +end + +--[[ + WARNING:this is in a working state, but uses massive hacks + revize when global input is available + Manages scrolling of the playerlist on mouse drag +--]] +local function StartDrag(entry, startx, starty) + local openPanel = true + --[[local draggedFrame = ]] + WaitForChild(entry.Frame, "ClickListener") + local function dragExit() + -- stopDrag = true + + if + entry.Player + and SelectedPlayer + and openPanel + and entry.Player ~= LocalPlayer + and SelectedPlayer.userId > 1 + and LocalPlayer.userId > 1 + then + ActivatePlayerEntryPanel(entry) + end + end + local startY + local StartFrame = ListFrame.Position + local function dragpoll(nx, ny) + if not startY then + startY = AbsoluteToPercent(nx, ny).Y + end + local nowY = AbsoluteToPercent(nx, ny).Y + debugprint( + `drag dist {Vector2.new(startx - nx, starty - ny).magnitude}` + ) + if + Vector2.new(startx - nx, starty - ny).magnitude + > MOUSE_DRAG_DISTANCE + then + openPanel = false + end + + local newFrameY = math.max( + math.min(StartFrame.Y.Scale + (nowY - startY), GetMaxScroll()), + GetMinScroll() + ) + ListFrame.Position = UDim2.new( + StartFrame.X.Scale, + StartFrame.X.Offset, + newFrameY, + StartFrame.Y.Offset + ) + UpdateScrollPosition() + end + WaitForClick(ScreenGui, dragpoll, dragExit) +end + +local function StartMinimizeDrag() + Delay(0, function() + local startTime = tick() + debugprint "Got Click2" + local function dragExit() + --debugprint('undone click2') + if tick() - startTime < 0.25 then --was click + ToggleMinimize() + else --was drag + DidMinimizeDrag = true + if IsMinimized.Value then + ToggleMinimize() + end + end + -- stopDrag = true + end + local startY + local StartFrame = DefaultBottomClipPos + local function dragpoll(nx, ny) + if not IsMinimized.Value then + if not startY then + startY = AbsoluteToPercent(nx, ny).Y + end + local nowY = AbsoluteToPercent(nx, ny).Y + local newFrameY + newFrameY = math.min( + math.max(StartFrame + (nowY - startY), -1), + -1 + + ( + #MiddleFrameBackgrounds + * MiddleBGTemplate.Size.Y.Scale + ) + ) + DefaultBottomClipPos = newFrameY + UpdateMinimize() + ScrollBarFrame.Size = UDim2.new( + ScrollBarFrame.Size.X.Scale, + 0, + (DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale), + 0 + ) + ScrollBarFrame.Position = UDim2.new( + ScrollBarFrame.Position.X.Scale, + 0, + 1 - ScrollBarFrame.Size.Y.Scale, + 0 + ) + UpdateScrollBarSize() + UpdateScrollPosition() + UpdateScrollBarVisibility() + end + end + Spawn(function() + WaitForClick(ScreenGui, dragpoll, dragExit) + end) + end) +end + +------------------------------- +-- Input Callback functions +------------------------------- +IsMaximized.Value = false +IsMinimized.Value = false +IsMaximized.Changed:connect(UpdateMaximize) +IsMinimized.Changed:connect(UpdateMinimize) + +ExtendButton.MouseButton1Down:connect(function() + if (time() - LastClick < ButtonCooldown) or InPopupWaitForClick then + return + end + LastClick = time() + if IsTabified.Value then + UnTabify() + else + StartMinimizeDrag() + end +end) + +MaximizeButton.MouseButton1Click:connect(function() + if (time() - LastClick < ButtonCooldown) or InPopupWaitForClick then + return + end + LastClick = time() + if IsTabified.Value then + UnTabify() + elseif not AreNamesExpanded.Value then + AreNamesExpanded.Value = true + BaseUpdate() + else + ToggleMaximize() + end +end) + +MaximizeButton.MouseButton2Click:connect(function() + if (time() - LastClick < ButtonCooldown) or InPopupWaitForClick then + return + end + LastClick = time() + if IsTabified.Value then + UnTabify() + elseif IsMaximized.Value then + ToggleMaximize() + elseif AreNamesExpanded.Value then + AreNamesExpanded.Value = false + BaseUpdate() + else + Tabify() + end +end) + +------------------------------- +-- MiddleFrames management +------------------------------- +--[[ + adds a background frame to the listframe +--]] +local function AddMiddleBGFrame() + local nBGFrame = MiddleBGTemplate:Clone() + nBGFrame.Position = + UDim2.new(0.5, 0, (#MiddleFrameBackgrounds * nBGFrame.Size.Y.Scale), 0) + if (#MiddleFrameBackgrounds + 1) % 2 ~= 1 then + if IsMaximized.Value then + nBGFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.LargeDark + else + nBGFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.midDark + end + else + if IsMaximized.Value then + nBGFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.LargeLight + else + nBGFrame.Background.Image = "https://banland.xyz/asset?id=" + .. Images.midLight + end + end + nBGFrame.Parent = ListFrame + table.insert(MiddleFrameBackgrounds, nBGFrame) + + if #MiddleFrameBackgrounds < DefaultListSize and not DidMinimizeDrag then + --print('readjusting bottom clip') + DefaultBottomClipPos = -1 + + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) + end + + if not IsMinimized.Value then + UpdateMinimize() + end +end +--[[ + removes a background from from the listframe +--]] +local function RemoveMiddleBGFrame() + MiddleFrameBackgrounds[#MiddleFrameBackgrounds]:Destroy() + table.remove(MiddleFrameBackgrounds, #MiddleFrameBackgrounds) + if not IsMinimized.Value then + UpdateMinimize() + end +end +------------------------------- +-- Player Callback functions +------------------------------- + +--[[ + note:should probably set to something other than mainFrame.AbsoluteSize, should work for now + if textbounds ever works on textscaled, switch to that :( +--]] +local function ChangeHeaderName(nname) + HeaderName.Text = nname + UpdateHeaderNameSize() +end + +--[[ + called only when the leaderstats object is added to a given player entry + removes old stats, adds any existing stats, and sets up listeners for new stats + @Args: + playerEntry A reference to the ENTRY(table) of the player who had leaderstats added +--]] +local function LeaderstatsAdded(playerEntry) + --RemoveAllStats(playerEntry) + local nplayer = playerEntry.Player + for _, i in pairs(nplayer.leaderstats:GetChildren()) do + StatAdded(i, playerEntry) + end + nplayer.leaderstats.ChildAdded:connect(function(nchild) + StatAdded(nchild, playerEntry) + end) + nplayer.leaderstats.ChildRemoved:connect(function(nchild) + StatRemoved(nchild, playerEntry) + end) +end +--[[ + called when leaderstats object is removed from play in player entry + Note: may not be needed, might be able to just rely on leaderstats added + @Args: + oldLeaderstats leaderstats object to be removed + playerEntry A reference to the ENTRY(table) of the player +--]] +local function LeaderstatsRemoved(_, playerEntry) + while AddingFrameLock do + debugprint(`waiting to insert {playerEntry.Player.Name}`) + wait() + end + AddingFrameLock = true + RemoveAllStats(playerEntry) + AddingFrameLock = false +end + --[[ Called when a player entry in the leaderboard is clicked either will highlight entry and start the drag event, or open a popup menu @@ -2662,29 +2719,211 @@ local function OnPlayerEntrySelect(entry, startx, starty) end end -function ActivatePlayerEntryPanel(entry) - entry.Frame.BackgroundColor3 = Color3.new(0, 1, 1) - Spawn(function() - TweenProperty(entry.Frame, "BackgroundTransparency", 1, 0.5, 0.5) - end) - InPopupWaitForClick = true - InitMovingPanel(entry, entry.Player) +local function RemoveNeutralTeam() + while NeutralTeamLock do + debugprint "in neutral team lock" + wait() + end + NeutralTeamLock = true + NeutralTeam.Frame:Destroy() + NeutralTeam = nil + RemoveMiddleBGFrame() + NeutralTeamLock = false end --[[ - the basic update for the playerlist mode's state, - assures the order and length of the player frames + removes a single player from a given team (not usually called directly) + @Args: + teamEntry team entry to remove player from + index index of player in 'MyPlayers' list to remove --]] -local function PlayerListModeUpdate() - RecreateScoreColumns(PlayerFrames) - table.sort(PlayerFrames, PlayerSortFunction) - for i, val in ipairs(PlayerFrames) do - MiddleFrames[i] = val.Frame +local function RemovePlayerFromTeam(teamEntry, index) + table.remove(teamEntry.MyPlayers, index) + --if teamEntry.AutoHide and #teamEntry.MyPlayers == 0 then + if teamEntry == NeutralTeam and #teamEntry.MyPlayers == 0 then + RemoveNeutralTeam() end - for i = #PlayerFrames + 1, #MiddleFrames, 1 do - MiddleFrames[i] = nil +end + +--[[ + finds previous team this player was on, and if it exists calls removeplayerfromteam + @Args + entry Player entry +--]] +local function FindRemovePlayerFromTeam(entry) + if entry.MyTeam then + for j, oldEntry in ipairs(entry.MyTeam.MyPlayers) do + if oldEntry.Player == entry.Player then + RemovePlayerFromTeam(entry.MyTeam, j) + return + end + end + elseif NeutralTeam then + for j, oldEntry in ipairs(NeutralTeam.MyPlayers) do + if oldEntry.Player == entry.Player then + RemovePlayerFromTeam(NeutralTeam, j) + return + end + end end - UpdateMinimize() +end + +--[[ + adds player entry entry to teamentry + removes them from any previous team + @Args: + teamEntry entry of team to add player to + entry player entry to add to this team +--]] +local function AddPlayerToTeam(teamEntry, entry) + FindRemovePlayerFromTeam(entry) + table.insert(teamEntry.MyPlayers, entry) + entry.MyTeam = teamEntry + if teamEntry.IsHidden then + teamEntry.Frame.Parent = ListFrame + AddMiddleBGFrame() + end + teamEntry.IsHidden = false +end + +--[[ + adds a neutral team if nessisary + Note: a lot of redundant code here, might want to refactor to share a function with insertteamframe +--]] +local function AddNeutralTeam() + while NeutralTeamLock do + debugprint "in neutral team 2 lock" + wait() + end + NeutralTeamLock = true + + local defaultTeam = Instance.new "Team" + defaultTeam.TeamColor = BrickColor.new "White" + defaultTeam.Name = "Neutral" + local nentry = {} + nentry.MyTeam = defaultTeam + nentry.MyPlayers = {} + nentry.Frame = MiddleTemplate:Clone() + WaitForChild(WaitForChild(nentry.Frame, "TitleFrame"), "Title").Text = + defaultTeam.Name + nentry.Frame.TitleFrame.Position = UDim2.new( + nentry.Frame.TitleFrame.Position.X.Scale, + nentry.Frame.TitleFrame.Position.X.Offset, + 0.1, + 0 + ) + nentry.Frame.TitleFrame.Size = UDim2.new( + nentry.Frame.TitleFrame.Size.X.Scale, + nentry.Frame.TitleFrame.Size.X.Offset, + 0.8, + 0 + ) + nentry.Frame.TitleFrame.Title.Font = "ArialBold" + nentry.Frame.Position = + UDim2.new(1, 0, (#MiddleFrames * nentry.Frame.Size.Y.Scale), 0) + WaitForChild(nentry.Frame, "ClickListener").MouseButton1Down:connect( + function(nx, ny) + StartDrag(nentry, nx, ny) + end + ) + nentry.Frame.ClickListener.BackgroundColor3 = Color3.new(1, 1, 1) + nentry.Frame.ClickListener.BackgroundTransparency = 0.7 + nentry.Frame.ClickListener.AutoButtonColor = false + nentry.AutoHide = true + nentry.IsHidden = true + for _, i in pairs(PlayerFrames) do + if i.Player.Neutral or not i.MyTeam then + AddPlayerToTeam(nentry, i) + end + end + if #nentry.MyPlayers > 0 then + NeutralTeam = nentry + UpdateMinimize() + BaseUpdate() + end + NeutralTeamLock = false +end + +local function SetPlayerToTeam(entry) + FindRemovePlayerFromTeam(entry) + -- check to see if team exists, if it does add to that team + local setToTeam = false + for _, tframe in ipairs(TeamFrames) do + -- add my entry on the new team + if tframe.MyTeam.TeamColor == entry.Player.TeamColor then + AddPlayerToTeam(tframe, entry) + setToTeam = true + end + end + -- if player was set to an invalid team, then set it back to neutral + if not setToTeam and #(game.Teams:GetTeams()) > 0 then + debugprint(`{entry.Player.Name} could not find team`) + entry.MyTeam = nil + if not NeutralTeam then + AddNeutralTeam() + else + AddPlayerToTeam(NeutralTeam, entry) + end + end +end + +--[[ + Note:another big one, consiter breaking up + called when any children of player changes + handles 'Neutral', teamColor, Name and MembershipType changes + @Args + entry Player entry changed + property name of property changed +--]] +local function PlayerChanged(entry, property) + while PlayerChangedLock do + debugprint "in playerchanged lock" + wait() + end + PlayerChangedLock = true + if property == "Neutral" then + -- if player changing to neutral + if entry.Player.Neutral and #(game.Teams:GetTeams()) > 0 then + debugprint(`{entry.Player.Name} setting to neutral`) + FindRemovePlayerFromTeam(entry) + entry.MyTeam = nil + if not NeutralTeam then + debugprint(`{entry.Player.Name} creating neutral team`) + AddNeutralTeam() + else + debugprint(`{entry.Player.Name} adding to neutral team`) + AddPlayerToTeam(NeutralTeam, entry) + end + elseif #(game.Teams:GetTeams()) > 0 then -- else player switching to a team, or a weird edgecase + debugprint(`{entry.Player.Name} has been set non-neutral`) + SetPlayerToTeam(entry) + end + BaseUpdate() + elseif + property == "TeamColor" + and not entry.Player.Neutral + and entry.Player ~= entry.MyTeam + then + debugprint(`{entry.Player.Name} setting to new team`) + SetPlayerToTeam(entry) + BaseUpdate() + elseif property == "Name" or property == "MembershipType" then + entry.Frame:FindFirstChild("BCLabel").Image = getMembershipTypeIcon( + entry.Player.MembershipType, + entry.Player.Name + ) + entry.Frame.Name = entry.Player.Name + entry.Frame.TitleFrame.Title.Text = entry.Player.Name + if entry.Frame.BCLabel.Image ~= "" then + entry.Frame.TitleFrame.Title.Position = UDim2.new(0.01, 30, 0.1, 0) + end + if entry.Player == LocalPlayer then + entry.Frame.TitleFrame.DropShadow.Text = entry.Player.Name + ChangeHeaderName(entry.Player.Name) + end + BaseUpdate() + end + PlayerChangedLock = false end --[[ @@ -2829,7 +3068,7 @@ end Note:major optimization can be done here removes this player's frame if it exists, calls base update --]] -function RemovePlayerFrame(tplayer) +local function RemovePlayerFrame(tplayer) while AddingFrameLock do debugprint "in removing player frame lock" wait() @@ -2866,249 +3105,8 @@ Players.ChildRemoved:connect(RemovePlayerFrame) ---------------------------- -- Team Callback Functions ---------------------------- ---[[ - turns a list of team entries with sub lists of players into a single ordered - list, in the correct order,and of the correct length - @Args: - tframes the team entries to unroll - outframes the list to unroll these entries into ---]] -function UnrollTeams(tframes, outframes) - local numEntries = 0 - if NeutralTeam and not NeutralTeam.IsHidden then - for _, val in ipairs(NeutralTeam.MyPlayers) do - numEntries += 1 - outframes[numEntries] = val.Frame - end - numEntries += 1 - outframes[numEntries] = NeutralTeam.Frame - end - for _, val in ipairs(tframes) do - if not val.IsHidden then - for _, pval in ipairs(val.MyPlayers) do - numEntries += 1 - outframes[numEntries] = pval.Frame - end - numEntries += 1 - outframes[numEntries] = val.Frame - end - end - -- clear any additional entries from outframes - for i = numEntries + 1, #outframes, 1 do - outframes[i] = nil - end -end ---[[ - uses lua's table.sort to sort the teams ---]] -function TeamSortFunc(a, b) - if a.TeamScore == b.TeamScore then - return a.ID < b.ID - end - if not a.TeamScore then - return false - end - if not b.TeamScore then - return true - end - return a.TeamScore < b.TeamScore -end ---[[ - adds up all the score of this team's players to form the team score - @Args: - team team entry to sum the scores of ---]] -local function AddTeamScores(team) - for j = 1, #ScoreNames, 1 do - local i = ScoreNames[j] - local tscore = 0 - for _, k in ipairs(team.MyPlayers) do - local tval = k.Player:FindFirstChild "leaderstats" - and k.Player.leaderstats:FindFirstChild(i.Name) - if tval and not tval:IsA "StringValue" then - tscore += GetScoreValue((k.Player.leaderstats)[i.Name]) - end - end - if team.Frame:FindFirstChild(i.Name) then - -- team.Frame[i.Name].Size = UDim2.new( - -- 1 - (ScrollBarFrame.Size.X.Scale * 2), - -- -((j - 1) * SpacingPerStat), - -- 1, - -- 0 - -- ) - team.Frame[i.Name].Text = tostring(tscore) - end - end - UpdateMinimize() -end - ---[[ - consider adding lock with wait for performance - sorts each of the team's player lists induvidually, adds up the team scores. - @Args: - tentries table of team entries ---]] -local function SortTeams(tentries) - for _, val in ipairs(tentries) do - table.sort(val.MyPlayers, PlayerSortFunction) - AddTeamScores(val) - end - table.sort(tentries, TeamSortFunc) -end - ---[[ - base update for team mode, adds up the scores of all teams, sorts them, - then unrolls them into middleframes ---]] -local function TeamListModeUpdate() - RecreateScoreColumns(PlayerFrames) - SortTeams(TeamFrames) - if NeutralTeam then - AddTeamScores(NeutralTeam) - --RecreateScoreColumns(NeutralTeam['MyPlayers']) - end - UnrollTeams(TeamFrames, MiddleFrames) -end - ---[[ - finds previous team this player was on, and if it exists calls removeplayerfromteam - @Args - entry Player entry ---]] -local function FindRemovePlayerFromTeam(entry) - if entry.MyTeam then - for j, oldEntry in ipairs(entry.MyTeam.MyPlayers) do - if oldEntry.Player == entry.Player then - RemovePlayerFromTeam(entry.MyTeam, j) - return - end - end - elseif NeutralTeam then - for j, oldEntry in ipairs(NeutralTeam.MyPlayers) do - if oldEntry.Player == entry.Player then - RemovePlayerFromTeam(NeutralTeam, j) - return - end - end - end -end - ---[[ - removes a single player from a given team (not usually called directly) - @Args: - teamEntry team entry to remove player from - index index of player in 'MyPlayers' list to remove ---]] -function RemovePlayerFromTeam(teamEntry, index) - table.remove(teamEntry.MyPlayers, index) - --if teamEntry.AutoHide and #teamEntry.MyPlayers == 0 then - if teamEntry == NeutralTeam and #teamEntry.MyPlayers == 0 then - RemoveNeutralTeam() - end -end - ---[[ - adds player entry entry to teamentry - removes them from any previous team - @Args: - teamEntry entry of team to add player to - entry player entry to add to this team ---]] -function AddPlayerToTeam(teamEntry, entry) - FindRemovePlayerFromTeam(entry) - table.insert(teamEntry.MyPlayers, entry) - entry.MyTeam = teamEntry - if teamEntry.IsHidden then - teamEntry.Frame.Parent = ListFrame - AddMiddleBGFrame() - end - teamEntry.IsHidden = false -end - -local function SetPlayerToTeam(entry) - FindRemovePlayerFromTeam(entry) - -- check to see if team exists, if it does add to that team - local setToTeam = false - for _, tframe in ipairs(TeamFrames) do - -- add my entry on the new team - if tframe.MyTeam.TeamColor == entry.Player.TeamColor then - AddPlayerToTeam(tframe, entry) - setToTeam = true - end - end - -- if player was set to an invalid team, then set it back to neutral - if not setToTeam and #(game.Teams:GetTeams()) > 0 then - debugprint(`{entry.Player.Name} could not find team`) - entry.MyTeam = nil - if not NeutralTeam then - AddNeutralTeam() - else - AddPlayerToTeam(NeutralTeam, entry) - end - end -end - ---[[ - Note:another big one, consiter breaking up - called when any children of player changes - handles 'Neutral', teamColor, Name and MembershipType changes - @Args - entry Player entry changed - property name of property changed ---]] -function PlayerChanged(entry, property) - while PlayerChangedLock do - debugprint "in playerchanged lock" - wait() - end - PlayerChangedLock = true - if property == "Neutral" then - -- if player changing to neutral - if entry.Player.Neutral and #(game.Teams:GetTeams()) > 0 then - debugprint(`{entry.Player.Name} setting to neutral`) - FindRemovePlayerFromTeam(entry) - entry.MyTeam = nil - if not NeutralTeam then - debugprint(`{entry.Player.Name} creating neutral team`) - AddNeutralTeam() - else - debugprint(`{entry.Player.Name} adding to neutral team`) - AddPlayerToTeam(NeutralTeam, entry) - end - elseif #(game.Teams:GetTeams()) > 0 then -- else player switching to a team, or a weird edgecase - debugprint(`{entry.Player.Name} has been set non-neutral`) - SetPlayerToTeam(entry) - end - BaseUpdate() - elseif - property == "TeamColor" - and not entry.Player.Neutral - and entry.Player ~= entry.MyTeam - then - debugprint(`{entry.Player.Name} setting to new team`) - SetPlayerToTeam(entry) - BaseUpdate() - elseif property == "Name" or property == "MembershipType" then - entry.Frame:FindFirstChild("BCLabel").Image = getMembershipTypeIcon( - entry.Player.MembershipType, - entry.Player.Name - ) - entry.Frame.Name = entry.Player.Name - entry.Frame.TitleFrame.Title.Text = entry.Player.Name - if entry.Frame.BCLabel.Image ~= "" then - entry.Frame.TitleFrame.Title.Position = UDim2.new(0.01, 30, 0.1, 0) - end - if entry.Player == LocalPlayer then - entry.Frame.TitleFrame.DropShadow.Text = entry.Player.Name - ChangeHeaderName(entry.Player.Name) - end - BaseUpdate() - end - PlayerChangedLock = false -end - -function OnFriendshipChanged(player, friendStatus) +local function OnFriendshipChanged(player, friendStatus) Delay(0.5, function() debugprint( `friend status changed for {player.Name} {friendStatus} vs {GetFriendStatus(player)}` @@ -3133,83 +3131,11 @@ end LocalPlayer.FriendStatusChanged:connect(OnFriendshipChanged) ---[[ - adds a neutral team if nessisary - Note: a lot of redundant code here, might want to refactor to share a function with insertteamframe ---]] -function AddNeutralTeam() - while NeutralTeamLock do - debugprint "in neutral team 2 lock" - wait() - end - NeutralTeamLock = true - - local defaultTeam = Instance.new "Team" - defaultTeam.TeamColor = BrickColor.new "White" - defaultTeam.Name = "Neutral" - local nentry = {} - nentry.MyTeam = defaultTeam - nentry.MyPlayers = {} - nentry.Frame = MiddleTemplate:Clone() - WaitForChild(WaitForChild(nentry.Frame, "TitleFrame"), "Title").Text = - defaultTeam.Name - nentry.Frame.TitleFrame.Position = UDim2.new( - nentry.Frame.TitleFrame.Position.X.Scale, - nentry.Frame.TitleFrame.Position.X.Offset, - 0.1, - 0 - ) - nentry.Frame.TitleFrame.Size = UDim2.new( - nentry.Frame.TitleFrame.Size.X.Scale, - nentry.Frame.TitleFrame.Size.X.Offset, - 0.8, - 0 - ) - nentry.Frame.TitleFrame.Title.Font = "ArialBold" - nentry.Frame.Position = - UDim2.new(1, 0, (#MiddleFrames * nentry.Frame.Size.Y.Scale), 0) - WaitForChild(nentry.Frame, "ClickListener").MouseButton1Down:connect( - function(nx, ny) - StartDrag(nentry, nx, ny) - end - ) - nentry.Frame.ClickListener.BackgroundColor3 = Color3.new(1, 1, 1) - nentry.Frame.ClickListener.BackgroundTransparency = 0.7 - nentry.Frame.ClickListener.AutoButtonColor = false - nentry.AutoHide = true - nentry.IsHidden = true - for _, i in pairs(PlayerFrames) do - if i.Player.Neutral or not i.MyTeam then - AddPlayerToTeam(nentry, i) - end - end - if #nentry.MyPlayers > 0 then - NeutralTeam = nentry - UpdateMinimize() - BaseUpdate() - end - NeutralTeamLock = false -end - -function RemoveNeutralTeam() - while NeutralTeamLock do - debugprint "in neutral team lock" - wait() - end - NeutralTeamLock = true - NeutralTeam.Frame:Destroy() - NeutralTeam = nil - RemoveMiddleBGFrame() - NeutralTeamLock = false -end - ---[[ - ---]] local function TeamScoreChanged(entry, nscore) WaitForChild(entry.Frame, "PlayerScore").Text = tostring(nscore) entry.TeamScore = nscore end + --[[ called when child added to a team, used for autohide functionality Note: still has teamscore, consiter removing @@ -3238,6 +3164,42 @@ local function TeamChildRemoved(entry, nchild) end end +--[[ + removes team from team list + @Args: + nteam Teamobject to remove +--]] +local function RemoveTeamFrame(nteam) + while AddingFrameLock do + debugprint "in removing team frame lock" + wait() + end + AddingFrameLock = true + -- if IsMinimized.Value then + -- end + local myEntry + for i, key in ipairs(TeamFrames) do + if nteam == key.MyTeam then + myEntry = key + key.Frame:Destroy() + table.remove(TeamFrames, i) + end + end + if #TeamFrames == 0 then + debugprint "removeteamframe, remove neutral" + if NeutralTeam then + RemoveNeutralTeam() + end + end + for i, key in ipairs(myEntry.MyPlayers) do + RemovePlayerFromTeam(myEntry, i) + PlayerChanged(key, "TeamColor") + end + RemoveMiddleBGFrame() + BaseUpdate() + AddingFrameLock = false +end + local function TeamChanged(entry, property) if property == "Name" then WaitForChild(WaitForChild(entry.Frame, "TitleFrame"), "Title").Text = @@ -3354,92 +3316,15 @@ local function InsertTeamFrame(nteam) end AddingFrameLock = false end ---[[ - removes team from team list - @Args: - nteam Teamobject to remove ---]] -function RemoveTeamFrame(nteam) - while AddingFrameLock do - debugprint "in removing team frame lock" - wait() - end - AddingFrameLock = true - -- if IsMinimized.Value then - -- end - local myEntry - for i, key in ipairs(TeamFrames) do - if nteam == key.MyTeam then - myEntry = key - key.Frame:Destroy() - table.remove(TeamFrames, i) - end - end - if #TeamFrames == 0 then - debugprint "removeteamframe, remove neutral" - if NeutralTeam then - RemoveNeutralTeam() - end - end - for i, key in ipairs(myEntry.MyPlayers) do - RemovePlayerFromTeam(myEntry, i) - PlayerChanged(key, "TeamColor") - end - RemoveMiddleBGFrame() - BaseUpdate() - AddingFrameLock = false -end -function TeamAdded(nteam) +local function TeamAdded(nteam) InsertTeamFrame(nteam) end -function TeamRemoved(nteam) +local function TeamRemoved(nteam) RemoveTeamFrame(nteam) end --------------------------------- ---[[ - called when ANYTHING changes the state of the playerlist - re-sorts everything,assures correct positions of all elements ---]] -function BaseUpdate() - while BaseUpdateLock do - debugprint "in baseupdate lock" - wait() - end - BaseUpdateLock = true - --print ('baseupdate') - UpdateStatNames() - - if #TeamFrames == 0 and not NeutralTeam then - PlayerListModeUpdate() - else - TeamListModeUpdate() - end - for i, key in ipairs(MiddleFrames) do - if key.Parent ~= nil then - key:TweenPosition( - UDim2.new(0.5, 0, ((#MiddleFrames - i) * key.Size.Y.Scale), 0), - "Out", - "Linear", - BASE_TWEEN, - true - ) - end - end - if not IsMinimized.Value and #MiddleFrames > DefaultEntriesOnScreen then - UpdateScrollPosition() - end - - UpdateMinimize() - - UpdateScrollBarSize() - UpdateScrollPosition() - - UpdateScrollBarVisibility() - --debugprint('EndBaseUpdate') - BaseUpdateLock = false -end --[[ code for attaching tab key to maximizing player list @@ -3489,14 +3374,8 @@ game.GuiService.KeyPressed:connect(function(key) end end) -local function PlayersChildAdded(tplayer) - if tplayer:IsA "Player" then - Spawn(function() - debugPlayerAdd(tplayer) - end) - else - BlowThisPopsicleStand() - end +local function debugPlayerAdd(p) + InsertPlayerFrame(p) end local function coreGuiChanged(coreGuiType, enabled) @@ -3508,29 +3387,6 @@ local function coreGuiChanged(coreGuiType, enabled) end end -local function TeamsChildAdded(nteam) - if nteam:IsA "Team" then - TeamAdded(nteam) - else - BlowThisPopsicleStand() - end -end - -local function TeamsChildRemoved(nteam) - if nteam:IsA "Team" then - TeamRemoved(nteam) - else - BlowThisPopsicleStand() - end -end - ----------------------------- --- Hookups and initialization ----------------------------- -function debugPlayerAdd(p) - InsertPlayerFrame(p) -end - pcall(function() coreGuiChanged( Enum.CoreGuiType.PlayerList, @@ -3552,6 +3408,36 @@ for _, i in pairs(Players:GetPlayers()) do end) end +local function PlayersChildAdded(tplayer) + if tplayer:IsA "Player" then + Spawn(function() + debugPlayerAdd(tplayer) + end) + else + BlowThisPopsicleStand() + end +end + +local function TeamsChildAdded(nteam) + if nteam:IsA "Team" then + TeamAdded(nteam) + else + BlowThisPopsicleStand() + end +end + +local function TeamsChildRemoved(nteam) + if nteam:IsA "Team" then + TeamRemoved(nteam) + else + BlowThisPopsicleStand() + end +end + +---------------------------- +-- Hookups and initialization +---------------------------- + game.Teams.ChildAdded:connect(TeamsChildAdded) game.Teams.ChildRemoved:connect(TeamsChildRemoved) Players.ChildAdded:connect(PlayersChildAdded) @@ -3563,25 +3449,3 @@ BaseUpdate() --UGGGLY,find a better way later wait(2) IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable" - ----------------------------- --- Running Logic ----------------------------- - ---debug stuffs, will only run for 'newplayerlistisbad' --- if --- LocalPlayer.Name == "newplayerlistisbad" --- or LocalPlayer.Name == "imtotallyadmin" --- then --- debugFrame.Parent = ScreenGui --- Spawn(function() --- while true do --- local str_players = "" --- for _, i in pairs(game.Players:GetPlayers()) do --- str_players ..= ` {i.Name}` --- end --- debugplayers.Text = str_players --- wait(0.5) --- end --- end) --- end diff --git a/luau/48488398.luau b/luau/48488398.luau index 3245ae4..6dc42bd 100644 --- a/luau/48488398.luau +++ b/luau/48488398.luau @@ -46,7 +46,7 @@ function makeFriend(fromPlayer, toPlayer) popup.PopupText.Text = `Accept Friend Request from {fromPlayer.Name}?` popup.PopupImage.Image = - `http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=352&y=352` + `https://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=352&y=352` showTwoButtons() popup.Visible = true @@ -114,7 +114,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event) game:GetService("GuiService"):SendNotification( "You are Friends", `With {toPlayer.Name}!`, - `http://banland.xyz/thumbs/avatar.ashx?userId={toPlayer.userId}&x=48&y=48`, + `https://banland.xyz/thumbs/avatar.ashx?userId={toPlayer.userId}&x=48&y=48`, 5, function() end ) @@ -127,7 +127,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event) game:GetService("GuiService"):SendNotification( "Friend Request", `From {fromPlayer.Name}`, - `http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`, + `https://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`, 8, function() makeFriend(fromPlayer, toPlayer) @@ -137,7 +137,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event) game:GetService("GuiService"):SendNotification( "You are Friends", `With {fromPlayer.Name}!`, - `http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`, + `https://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`, 5, function() end ) diff --git a/luau/48488451.luau b/luau/48488451.luau index f97f1fa..f5d4a2e 100644 --- a/luau/48488451.luau +++ b/luau/48488451.luau @@ -55,7 +55,7 @@ popupImage.Parent = popupFrame local backing = Instance.new "ImageLabel" backing.BackgroundTransparency = 1 backing.Size = UDim2.new(1, 0, 1, 0) -backing.Image = "http://banland.xyz/asset/?id=47574181" +backing.Image = "https://banland.xyz/asset/?id=47574181" backing.Name = "Backing" backing.ZIndex = 2 backing.Parent = popupImage diff --git a/luau/53878047.luau b/luau/53878047.luau index c3cbc4a..b45dfb9 100644 --- a/luau/53878047.luau +++ b/luau/53878047.luau @@ -55,7 +55,7 @@ CurrentLoadout.Parent = gui local CLBackground = Instance.new "ImageLabel" CLBackground.Name = "Background" CLBackground.Size = UDim2.new(1.2, 0, 1.2, 0) -CLBackground.Image = "http://banland.xyz/asset/?id=96536002" +CLBackground.Image = "https://banland.xyz/asset/?id=96536002" CLBackground.BackgroundTransparency = 1 CLBackground.Position = UDim2.new(-0.1, 0, -0.1, 0) CLBackground.ZIndex = 0.0 @@ -65,7 +65,7 @@ CLBackground.Visible = false local BackgroundUp = Instance.new "ImageLabel" BackgroundUp.Size = UDim2.new(1, 0, 0.025, 1) BackgroundUp.Position = UDim2.new(0, 0, 0, 0) -BackgroundUp.Image = "http://banland.xyz/asset/?id=97662207" +BackgroundUp.Image = "https://banland.xyz/asset/?id=97662207" BackgroundUp.BackgroundTransparency = 1 BackgroundUp.Parent = CLBackground @@ -79,7 +79,7 @@ BackpackButton.RobloxLocked = true BackpackButton.Visible = false BackpackButton.Name = "BackpackButton" BackpackButton.BackgroundTransparency = 1 -BackpackButton.Image = "http://banland.xyz/asset/?id=97617958" +BackpackButton.Image = "https://banland.xyz/asset/?id=97617958" BackpackButton.Position = UDim2.new(0.5, -60, 1, -108) BackpackButton.Size = UDim2.new(0, 120, 0, 18) waitForChild(gui, "ControlFrame") @@ -138,14 +138,14 @@ TempSlot.ZIndex = 3.0 local slotBackground = Instance.new "ImageLabel" slotBackground.Name = "Background" slotBackground.BackgroundTransparency = 1 -slotBackground.Image = "http://banland.xyz/asset/?id=97613075" +slotBackground.Image = "https://banland.xyz/asset/?id=97613075" slotBackground.Size = UDim2.new(1, 0, 1, 0) slotBackground.Parent = TempSlot local HighLight = Instance.new "ImageLabel" HighLight.Name = "Highlight" HighLight.BackgroundTransparency = 1 -HighLight.Image = "http://banland.xyz/asset/?id=97643886" +HighLight.Image = "https://banland.xyz/asset/?id=97643886" HighLight.Size = UDim2.new(1, 0, 1, 0) --HighLight.Parent = TempSlot HighLight.Visible = false @@ -339,8 +339,8 @@ closeButton.Modal = true local XImage = Instance.new "ImageLabel" XImage.RobloxLocked = true XImage.Name = "XImage" -ContentProvider:Preload "http://banland.xyz/asset/?id=75547445" -XImage.Image = "http://banland.xyz/asset/?id=75547445" --TODO: move to rbxasset +ContentProvider:Preload "https://banland.xyz/asset/?id=75547445" +XImage.Image = "https://banland.xyz/asset/?id=75547445" --TODO: move to rbxasset XImage.BackgroundTransparency = 1 XImage.Position = UDim2.new(-0.25, -1, -0.25, -1) XImage.Size = UDim2.new(1.5, 2, 1.5, 2) @@ -430,7 +430,7 @@ GearGrid.Size = UDim2.new(0.95, 0, 1, 0) GearGrid.BackgroundTransparency = 1 GearGrid.Parent = Gear -local GearButton = Instance.new "ImageButton" +GearButton = Instance.new "ImageButton" GearButton.RobloxLocked = true GearButton.Visible = false GearButton.Name = "GearButton" @@ -439,15 +439,15 @@ GearButton.Style = "Custom" GearButton.BackgroundTransparency = 1 GearButton.Parent = GearGrid -local slotBackground = Instance.new "ImageLabel" +slotBackground = Instance.new "ImageLabel" slotBackground.Name = "Background" slotBackground.BackgroundTransparency = 1 -slotBackground.Image = "http://banland.xyz/asset/?id=97613075" +slotBackground.Image = "https://banland.xyz/asset/?id=97613075" slotBackground.Size = UDim2.new(1, 0, 1, 0) slotBackground.Parent = GearButton -- GearButton Children -local GearReference = Instance.new "ObjectValue" +GearReference = Instance.new "ObjectValue" GearReference.RobloxLocked = true GearReference.Name = "GearReference" GearReference.Parent = GearButton @@ -462,7 +462,7 @@ GreyOutButton.Visible = false GreyOutButton.ZIndex = 3 GreyOutButton.Parent = GearButton -local GearText = Instance.new "TextLabel" +GearText = Instance.new "TextLabel" GearText.RobloxLocked = true GearText.Name = "GearText" GearText.BackgroundTransparency = 1 @@ -564,7 +564,7 @@ GearName.TextWrap = true GearName.ZIndex = 9 GearName.Parent = GearStats -local GearImage = Instance.new "ImageLabel" +GearImage = Instance.new "ImageLabel" GearImage.RobloxLocked = true GearImage.Name = "GearImage" GearImage.Image = "" @@ -771,10 +771,10 @@ CharacterPane.Parent = Wardrobe --CharacterPane Children local FaceFrame = makeCharFrame("FacesFrame", CharacterPane) -ContentProvider:Preload "http://banland.xyz/asset/?id=75460621" +ContentProvider:Preload "https://banland.xyz/asset/?id=75460621" makeZone( "FaceZone", - "http://banland.xyz/asset/?id=75460621", + "https://banland.xyz/asset/?id=75460621", UDim2.new(0, 157, 0, 137), UDim2.new(0.5, -78, 0.5, -68), FaceFrame @@ -789,7 +789,7 @@ makeStyledButton( local HeadFrame = makeCharFrame("HeadsFrame", CharacterPane) makeZone( "FaceZone", - "http://banland.xyz/asset/?id=75460621", + "https://banland.xyz/asset/?id=75460621", UDim2.new(0, 157, 0, 137), UDim2.new(0.5, -78, 0.5, -68), HeadFrame @@ -802,10 +802,10 @@ makeStyledButton( ) local HatsFrame = makeCharFrame("HatsFrame", CharacterPane) -ContentProvider:Preload "http://banland.xyz/asset/?id=75457888" +ContentProvider:Preload "https://banland.xyz/asset/?id=75457888" local HatsZone = makeZone( "HatsZone", - "http://banland.xyz/asset/?id=75457888", + "https://banland.xyz/asset/?id=75457888", UDim2.new(0, 186, 0, 184), UDim2.new(0.5, -93, 0.5, -100), HatsFrame @@ -833,10 +833,10 @@ makeStyledButton( ) local PantsFrame = makeCharFrame("PantsFrame", CharacterPane) -ContentProvider:Preload "http://banland.xyz/asset/?id=75457920" +ContentProvider:Preload "https://banland.xyz/asset/?id=75457920" makeZone( "PantsZone", - "http://banland.xyz/asset/?id=75457920", + "https://banland.xyz/asset/?id=75457920", UDim2.new(0, 121, 0, 99), UDim2.new(0.5, -60, 0.5, -100), PantsFrame @@ -928,10 +928,10 @@ makeTextLabel( ) local TShirtFrame = makeCharFrame("T-ShirtsFrame", CharacterPane) -ContentProvider:Preload "http://banland.xyz/asset/?id=75460642" +ContentProvider:Preload "https://banland.xyz/asset/?id=75460642" makeZone( "TShirtZone", - "http://banland.xyz/asset/?id=75460642", + "https://banland.xyz/asset/?id=75460642", UDim2.new(0, 121, 0, 154), UDim2.new(0.5, -60, 0.5, -100), TShirtFrame @@ -946,7 +946,7 @@ makeStyledButton( local ShirtFrame = makeCharFrame("ShirtsFrame", CharacterPane) makeZone( "ShirtZone", - "http://banland.xyz/asset/?id=75460642", + "https://banland.xyz/asset/?id=75460642", UDim2.new(0, 121, 0, 154), UDim2.new(0.5, -60, 0.5, -100), ShirtFrame @@ -959,10 +959,10 @@ makeStyledButton( ) local ColorFrame = makeCharFrame("ColorFrame", CharacterPane) -ContentProvider:Preload "http://banland.xyz/asset/?id=76049888" +ContentProvider:Preload "https://banland.xyz/asset/?id=76049888" local ColorZone = makeZone( "ColorZone", - "http://banland.xyz/asset/?id=76049888", + "https://banland.xyz/asset/?id=76049888", UDim2.new(0, 120, 0, 150), UDim2.new(0.5, -60, 0.5, -100), ColorFrame diff --git a/luau/53878057.luau b/luau/53878057.luau index 7baf571..398b0e2 100644 --- a/luau/53878057.luau +++ b/luau/53878057.luau @@ -116,6 +116,8 @@ for i = 1, maxNumLoadoutItems do end local backpackWasOpened = false + +local dragBeginPos --- End Locals -- Begin Functions @@ -135,13 +137,13 @@ local function kill(prop, con, gear) end end -function registerNumberKeys() +local function registerNumberKeys() for i = 0, 9 do GuiService:AddKey(tostring(i)) end end -function unregisterNumberKeys() +local function unregisterNumberKeys() pcall(function() for i = 0, 9 do GuiService:RemoveKey(tostring(i)) @@ -149,7 +151,7 @@ function unregisterNumberKeys() end) end -function characterInWorkspace() +local function characterInWorkspace() if game.Players.LocalPlayer then if game.Players.LocalPlayer.Character then if game.Players.LocalPlayer.Character ~= nil then @@ -163,7 +165,7 @@ function characterInWorkspace() return false end -function removeGear(gear) +local function removeGear(gear) local emptySlot for i = 1, #gearSlots do if gearSlots[i] == gear and gear.Parent ~= nil then @@ -225,7 +227,7 @@ function removeGear(gear) end end -function insertGear(gear, addToSlot) +local function insertGear(gear, addToSlot) local pos if not addToSlot then for i = 1, #gearSlots do @@ -284,7 +286,7 @@ function insertGear(gear, addToSlot) end) end -function reorganizeLoadout(gear, inserting, _, addToSlot) +local function reorganizeLoadout(gear, inserting, _, addToSlot) if inserting then -- add in gear insertGear(gear, addToSlot) else @@ -295,7 +297,7 @@ function reorganizeLoadout(gear, inserting, _, addToSlot) end end -function checkToolAncestry(child, parent) +local function checkToolAncestry(child, parent) if child:FindFirstChild "RobloxBuildTool" then return end -- don't show roblox build tools @@ -325,7 +327,7 @@ function checkToolAncestry(child, parent) end end -function removeAllEquippedGear(physGear) +local function removeAllEquippedGear(physGear) local stuff = player.Character:GetChildren() for i = 1, #stuff do if @@ -342,159 +344,7 @@ function removeAllEquippedGear(physGear) end end -function hopperBinSwitcher(numKey, physGear) - if not physGear then - return - end - - physGear:ToggleSelect() - - if gearSlots[numKey] == "empty" then - return - end - - if not physGear.Active then - gearSlots[numKey].Selected = false - normalizeButton(gearSlots[numKey]) - else - gearSlots[numKey].Selected = true - enlargeButton(gearSlots[numKey]) - end -end - -function toolSwitcher(numKey) - if not gearSlots[numKey] then - return - end - local physGear = gearSlots[numKey].GearReference.Value - if physGear == nil then - return - end - - removeAllEquippedGear(physGear) -- we don't remove this gear, as then we get a double switcheroo - - local key = numKey - if numKey == 0 then - key = 10 - end - - for i = 1, #gearSlots do - if gearSlots[i] and gearSlots[i] ~= "empty" and i ~= key then - normalizeButton(gearSlots[i]) - gearSlots[i].Selected = false - if - gearSlots[i].GearReference - and gearSlots[i].GearReference.Value - and gearSlots[i].GearReference.Value:IsA "HopperBin" - and gearSlots[i].GearReference.Value.Active - then - gearSlots[i].GearReference.Value:ToggleSelect() - end - end - end - - if physGear:IsA "HopperBin" then - hopperBinSwitcher(numKey, physGear) - else - if physGear.Parent == player.Character then - physGear.Parent = player.Backpack - - if gearSlots[numKey] ~= "empty" then - gearSlots[numKey].Selected = false - normalizeButton(gearSlots[numKey]) - end - else - --player.Character.Humanoid:EquipTool(physGear) - - physGear.Parent = player.Character - gearSlots[numKey].Selected = true - - enlargeButton(gearSlots[numKey]) - end - end -end - -function activateGear(num) - local numKey - if num == "0" then - numKey = 10 -- why do lua indexes have to start at 1? :( - else - numKey = tonumber(num) - end - - if numKey == nil then - return - end - - if gearSlots[numKey] ~= "empty" then - toolSwitcher(numKey) - end -end - -enlargeButton = function(button) - if button.Size.Y.Scale > 1 then - return - end - if not button.Parent then - return - end - if not button.Selected then - return - end - - for i = 1, #gearSlots do - if gearSlots[i] == "empty" then - break - end - if gearSlots[i] ~= button then - normalizeButton(gearSlots[i]) - end - end - - if not enlargeOverride then - return - end - - if button:FindFirstChild "Highlight" then - button.Highlight.Visible = true - end - - if button:IsA "ImageButton" or button:IsA "TextButton" then - button.ZIndex = 5 - local centerizeX = -( - buttonSizeEnlarge.X.Scale - button.Size.X.Scale - ) / 2 - local centerizeY = -( - buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale - ) / 2 - button:TweenSizeAndPosition( - buttonSizeEnlarge, - UDim2.new( - button.Position.X.Scale + centerizeX, - button.Position.X.Offset, - button.Position.Y.Scale + centerizeY, - button.Position.Y.Offset - ), - Enum.EasingDirection.Out, - Enum.EasingStyle.Quad, - guiTweenSpeed / 5, - enlargeOverride - ) - end -end - -normalizeAllButtons = function() - for i = 1, #gearSlots do - if gearSlots[i] == "empty" then - break - end - if gearSlots[i] ~= button then - normalizeButton(gearSlots[i], 0.1) - end - end -end - -normalizeButton = function(button, speed) +local function normaliseButton(button, speed) if not button then return end @@ -537,13 +387,154 @@ normalizeButton = function(button, speed) end end +local function enlargeButton(button) + if button.Size.Y.Scale > 1 then + return + end + if not button.Parent then + return + end + if not button.Selected then + return + end + + for i = 1, #gearSlots do + if gearSlots[i] == "empty" then + break + end + if gearSlots[i] ~= button then + normaliseButton(gearSlots[i]) + end + end + + if not enlargeOverride then + return + end + + if button:FindFirstChild "Highlight" then + button.Highlight.Visible = true + end + + if button:IsA "ImageButton" or button:IsA "TextButton" then + button.ZIndex = 5 + local centerizeX = -( + buttonSizeEnlarge.X.Scale - button.Size.X.Scale + ) / 2 + local centerizeY = -( + buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale + ) / 2 + button:TweenSizeAndPosition( + buttonSizeEnlarge, + UDim2.new( + button.Position.X.Scale + centerizeX, + button.Position.X.Offset, + button.Position.Y.Scale + centerizeY, + button.Position.Y.Offset + ), + Enum.EasingDirection.Out, + Enum.EasingStyle.Quad, + guiTweenSpeed / 5, + enlargeOverride + ) + end +end + +local function hopperBinSwitcher(numKey, physGear) + if not physGear then + return + end + + physGear:ToggleSelect() + + if gearSlots[numKey] == "empty" then + return + end + + if not physGear.Active then + gearSlots[numKey].Selected = false + normaliseButton(gearSlots[numKey]) + else + gearSlots[numKey].Selected = true + enlargeButton(gearSlots[numKey]) + end +end + +local function toolSwitcher(numKey) + if not gearSlots[numKey] then + return + end + local physGear = gearSlots[numKey].GearReference.Value + if physGear == nil then + return + end + + removeAllEquippedGear(physGear) -- we don't remove this gear, as then we get a double switcheroo + + local key = numKey + if numKey == 0 then + key = 10 + end + + for i = 1, #gearSlots do + if gearSlots[i] and gearSlots[i] ~= "empty" and i ~= key then + normaliseButton(gearSlots[i]) + gearSlots[i].Selected = false + if + gearSlots[i].GearReference + and gearSlots[i].GearReference.Value + and gearSlots[i].GearReference.Value:IsA "HopperBin" + and gearSlots[i].GearReference.Value.Active + then + gearSlots[i].GearReference.Value:ToggleSelect() + end + end + end + + if physGear:IsA "HopperBin" then + hopperBinSwitcher(numKey, physGear) + else + if physGear.Parent == player.Character then + physGear.Parent = player.Backpack + + if gearSlots[numKey] ~= "empty" then + gearSlots[numKey].Selected = false + normaliseButton(gearSlots[numKey]) + end + else + --player.Character.Humanoid:EquipTool(physGear) + + physGear.Parent = player.Character + gearSlots[numKey].Selected = true + + enlargeButton(gearSlots[numKey]) + end + end +end + +local function activateGear(num) + local numKey + if num == "0" then + numKey = 10 -- why do lua indexes have to start at 1? :( + else + numKey = tonumber(num) + end + + if numKey == nil then + return + end + + if gearSlots[numKey] ~= "empty" then + toolSwitcher(numKey) + end +end + local waitForDebounce = function() while debounce do wait() end end -function pointInRectangle(point, rectTopLeft, rectSize) +local function pointInRectangle(point, rectTopLeft, rectSize) if point.x > rectTopLeft.x and point.x < (rectTopLeft.x + rectSize.x) then if point.y > rectTopLeft.y @@ -555,7 +546,7 @@ function pointInRectangle(point, rectTopLeft, rectSize) return false end -function swapGear(gearClone, toFrame) +local function swapGear(gearClone, toFrame) local toFrameChildren = toFrame:GetChildren() if #toFrameChildren == 1 then if toFrameChildren[1]:FindFirstChild "SlotNumber" then @@ -625,7 +616,7 @@ function swapGear(gearClone, toFrame) end end -function resolveDrag(gearClone, x, y) +local function resolveDrag(gearClone, x, y) local mousePoint = Vector2.new(x, y) local frame = gearClone.Parent @@ -666,7 +657,7 @@ function resolveDrag(gearClone, x, y) return -1 end -function unequipAllItems(dontEquipThis) +local function unequipAllItems(dontEquipThis) for i = 1, #gearSlots do if gearSlots[i] == "empty" then break @@ -686,7 +677,7 @@ function unequipAllItems(dontEquipThis) end end -function showToolTip(button, tip) +local function showToolTip(button, tip) if button and button:FindFirstChild "ToolTipLabel" @@ -701,7 +692,7 @@ function showToolTip(button, tip) end end -function hideToolTip(button, _) +local function hideToolTip(button, _) if button and button:FindFirstChild "ToolTipLabel" @@ -711,7 +702,16 @@ function hideToolTip(button, _) end end -local addingPlayerChild = function( +local function removeFromInventory(child) + for i = 1, #inventory do + if inventory[i] == child then + table.remove(inventory, i) + inventory[i] = nil + end + end +end + +local function addingPlayerChild( child, equipped, addToSlot, @@ -845,7 +845,6 @@ local addingPlayerChild = function( ) end - local dragBeginPos local clickCon, buttonDeleteCon, mouseEnterCon, mouseLeaveCon, dragStop, dragBegin clickCon = gearClone.MouseButton1Click:connect(function() if characterInWorkspace() then @@ -924,8 +923,8 @@ local addingPlayerChild = function( local childCon local childChangeCon - childCon = child.AncestryChanged:connect(function(newChild, parent) - if not checkToolAncestry(newChild, parent) then + childCon = child.AncestryChanged:connect(function(newChild, newParent) + if not checkToolAncestry(newChild, newParent) then if childCon then childCon:disconnect() end @@ -933,8 +932,8 @@ local addingPlayerChild = function( childChangeCon:disconnect() end removeFromInventory(child) - elseif parent == game.Players.LocalPlayer.Backpack then - normalizeButton(gearClone) + elseif newParent == game.Players.LocalPlayer.Backpack then + normaliseButton(gearClone) end end) @@ -947,7 +946,7 @@ local addingPlayerChild = function( if child and child:IsA "HopperBin" then if not child.Active then gearClone.Selected = false - normalizeButton(gearClone) + normaliseButton(gearClone) end end elseif prop == "TextureId" then @@ -973,7 +972,7 @@ local addingPlayerChild = function( end) end -function addToInventory(child) +local function addToInventory(child) if not child:IsA "Tool" or not child:IsA "HopperBin" then return end @@ -996,17 +995,8 @@ function addToInventory(child) end end -function removeFromInventory(child) - for i = 1, #inventory do - if inventory[i] == child then - table.remove(inventory, i) - inventory[i] = nil - end - end -end - local spreadOutGear = function() - loadoutChildren = currentLoadout:GetChildren() + local loadoutChildren = currentLoadout:GetChildren() for i = 1, #loadoutChildren do if loadoutChildren[i]:IsA "Frame" then @@ -1037,7 +1027,7 @@ local spreadOutGear = function() end local centerGear = function() - loadoutChildren = currentLoadout:GetChildren() + local loadoutChildren = currentLoadout:GetChildren() local gearButtons = {} local lastSlotAdd @@ -1080,20 +1070,20 @@ local centerGear = function() end end -function editLoadout() +local function editLoadout() backpackWasOpened = true if inGearTab then spreadOutGear() end end -function readonlyLoadout() +local function readonlyLoadout() if not inGearTab then centerGear() end end -function setupBackpackListener() +local function setupBackpackListener() if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil @@ -1111,20 +1101,20 @@ function setupBackpackListener() end) end -function playerCharacterChildAdded(child) +local function playerCharacterChildAdded(child) addingPlayerChild(child, true) addToInventory(child) end -function activateLoadout() +local function activateLoadout() currentLoadout.Visible = true end -function deactivateLoadout() +local function deactivateLoadout() currentLoadout.Visible = false end -function tabHandler(inFocus) +local function tabHandler(inFocus) inGearTab = inFocus if inFocus then editLoadout() @@ -1133,7 +1123,7 @@ function tabHandler(inFocus) end end -function coreGuiChanged(coreGuiType, enabled) +local function coreGuiChanged(coreGuiType, enabled) if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All diff --git a/luau/59002209.luau b/luau/59002209.luau deleted file mode 100644 index 369c052..0000000 --- a/luau/59002209.luau +++ /dev/null @@ -1,2 +0,0 @@ --- Script Context.CoreScripts/Sections -print "[Mercury]: Loaded corescript 59002209" diff --git a/luau/60595411.luau b/luau/60595411.luau index eb2e2a3..b577e12 100644 --- a/luau/60595411.luau +++ b/luau/60595411.luau @@ -212,11 +212,11 @@ end local JsonReader = { escapes = { - ["t"] = "\t", - ["n"] = "\n", - ["f"] = "\f", - ["r"] = "\r", - ["b"] = "\b", + t = "\t", + n = "\n", + f = "\f", + r = "\r", + b = "\b", }, } @@ -338,7 +338,7 @@ function JsonReader:ReadBlockComment() done = true end if not done and ch == "/" and self:Peek() == "*" then - error(string.format(`Invalid comment: {self:All()}, '/*' illegal.`)) + error(`Invalid comment: {self:All()}, '/*' illegal.`) end end self:Next() @@ -488,7 +488,7 @@ end t.SelectTerrainRegion = function( regionToSelect, - color, + colour, selectEmptyCells, selectionParent ) @@ -498,7 +498,7 @@ t.SelectTerrainRegion = function( end assert(regionToSelect) - assert(color) + assert(colour) if type(regionToSelect) ~= "Region3" then error( @@ -507,10 +507,10 @@ t.SelectTerrainRegion = function( )}` ) end - if type(color) ~= "BrickColor" then + if type(colour) ~= "BrickColor" then error( `color (second arg), should be of type BrickColor, but is type {type( - color + colour )}` ) end @@ -548,26 +548,8 @@ t.SelectTerrainRegion = function( local selectionBox = Instance.new "SelectionBox" - -- srs translation from region3 to region3int16 - -- local function Region3ToRegion3int16(region3) - -- local theLowVec = region3.CFrame.p - -- - (region3.Size / 2) - -- + Vector3.new(2, 2, 2) - -- local lowCell = WorldToCellPreferSolid(terrain, theLowVec) - - -- local theHighVec = region3.CFrame.p - -- + (region3.Size / 2) - -- - Vector3.new(2, 2, 2) - -- local highCell = WorldToCellPreferSolid(terrain, theHighVec) - - -- local highIntVec = Vector3int16.new(highCell.x, highCell.y, highCell.z) - -- local lowIntVec = Vector3int16.new(lowCell.x, lowCell.y, lowCell.z) - - -- return Region3int16.new(lowIntVec, highIntVec) - -- end - -- helper function that creates the basis for a selection box - local function createAdornment(theColor) + local function createAdornment(theColour) local selectionPartClone local selectionBoxClone @@ -592,8 +574,8 @@ t.SelectTerrainRegion = function( selectionBoxClone.Parent = selectionContainer end - if theColor then - selectionBoxClone.Color = theColor + if theColour then + selectionBoxClone.Color = theColour end return selectionPartClone, selectionBoxClone @@ -623,7 +605,7 @@ t.SelectTerrainRegion = function( end -- finds full cells in region and adorns each cell with a box, with the argument color - local function adornFullCellsInRegion(region, color) + local function adornFullCellsInRegion(region, newColour) local regionBegin = region.CFrame.p - (region.Size / 2) + Vector3.new(2, 2, 2) @@ -648,8 +630,8 @@ t.SelectTerrainRegion = function( for cellPosAdorn, adornTable in pairs(adornments) do if cellPosAdorn == cellPos then adornTable.KeepAlive = currentKeepAliveTag - if color then - adornTable.SelectionBox.Color = color + if newColour then + adornTable.SelectionBox.Color = newColour end updated = true break @@ -657,8 +639,8 @@ t.SelectTerrainRegion = function( end if not updated then - local selectionPart, selectionBox = - createAdornment(color) + selectionPart, selectionBox = + createAdornment(newColour) selectionPart.Size = Vector3.new(4, 4, 4) selectionPart.CFrame = CFrame.new(cframePos) local adornTable = { @@ -679,7 +661,7 @@ t.SelectTerrainRegion = function( lastRegion = regionToSelect if selectEmptyCells then -- use one big selection to represent the area selected - local selectionPart, selectionBox = createAdornment(color) + selectionPart, selectionBox = createAdornment(colour) selectionPart.Size = regionToSelect.Size selectionPart.CFrame = regionToSelect.CFrame @@ -687,22 +669,22 @@ t.SelectTerrainRegion = function( adornments.SelectionPart = selectionPart adornments.SelectionBox = selectionBox - updateSelection = function(newRegion, color) + updateSelection = function(newRegion, newColour) if newRegion and newRegion ~= lastRegion then lastRegion = newRegion selectionPart.Size = newRegion.Size selectionPart.CFrame = newRegion.CFrame end - if color then - selectionBox.Color = color + if newColour then + selectionBox.Color = newColour end end else -- use individual cell adorns to represent the area selected - adornFullCellsInRegion(regionToSelect, color) - updateSelection = function(newRegion, color) + adornFullCellsInRegion(regionToSelect, colour) + updateSelection = function(newRegion, newColour) if newRegion and newRegion ~= lastRegion then lastRegion = newRegion - adornFullCellsInRegion(newRegion, color) + adornFullCellsInRegion(newRegion, newColour) end end end @@ -776,7 +758,7 @@ function t.CreateSignal() local cn = mBindableEvent.Event:connect(func) mAllCns[cn] = true local pubCn = {} - function pubCn:disconnect() + function pubCn.disconnect(_) cn:disconnect() mAllCns[cn] = nil end diff --git a/luau/60595695.luau b/luau/60595695.luau index 398d8ec..c58ef64 100644 --- a/luau/60595695.luau +++ b/luau/60595695.luau @@ -5,7 +5,6 @@ print "[Mercury]: Loaded corescript 60595695" -- This script is used to register RbxLua libraries on game servers, so game scripts have -- access to all of the libraries (otherwise only local scripts do) --- local deepakTestingPlace = 3569749 local sc = game:GetService "ScriptContext" local tries = 0 @@ -20,9 +19,6 @@ if sc then sc:RegisterLibrary("Libraries/RbxRed", "10000002") sc:RegisterLibrary("Libraries/RbxGui", "45284430") sc:RegisterLibrary("Libraries/RbxGear", "45374389") - -- if game.PlaceId == deepakTestingPlace then - -- sc:RegisterLibrary("Libraries/RbxStatus", "52177566") - -- end sc:RegisterLibrary("Libraries/RbxUtility", "60595411") sc:RegisterLibrary("Libraries/RbxStamper", "73157242") sc:LibraryRegistrationComplete() diff --git a/luau/73157242.luau b/luau/73157242.luau index 74ac32e..3c3c913 100644 --- a/luau/73157242.luau +++ b/luau/73157242.luau @@ -3,13 +3,7 @@ print "[Mercury]: Loaded corescript 73157242" local ChangeHistoryService = game:GetService "ChangeHistoryService" -local t = {} - --- function waitForChild(instance, name) --- while not instance:FindFirstChild(name) do --- instance.ChildAdded:wait() --- end --- end +local RbxStamper = {} -- Do a line/plane intersection. The line starts at the camera. The plane is at y == 0, normal(0, 1, 0) -- @@ -743,7 +737,7 @@ local function restoreTheWelds(manualWeldTable, manualWeldParentTable) end end -t.CanEditRegion = function(partOrModel, EditRegion) -- todo: use model and stamper metadata +RbxStamper.CanEditRegion = function(partOrModel, EditRegion) -- todo: use model and stamper metadata if not EditRegion then return true, false end @@ -769,7 +763,7 @@ t.CanEditRegion = function(partOrModel, EditRegion) -- todo: use model and stamp return true, false end -t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) +RbxStamper.GetStampModel = function(assetId, terrainShape, useAssetVersionId) if assetId == 0 then return nil, "No Asset" end @@ -859,7 +853,7 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) local inverseCornerWedgeMesh = Instance.new "SpecialMesh" inverseCornerWedgeMesh.MeshType = "FileMesh" inverseCornerWedgeMesh.MeshId = - "http://banland.xyz/asset?id=66832495" + "https://banland.xyz/asset?id=66832495" inverseCornerWedgeMesh.Scale = Vector3.new(2, 2, 2) inverseCornerWedgeMesh.Parent = newTerrainPiece end @@ -986,7 +980,7 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) return root end -t.SetupStamperDragger = function( +RbxStamper.SetupStamperDragger = function( modelToStamp, Mouse, StampInModel, @@ -1161,7 +1155,7 @@ t.SetupStamperDragger = function( -- take out any component of line2 along line1, so you get perpendicular to line1 component line2 -= line.unit * line.unit:Dot(line2) - tempCFrame = CFrame.new( + local tempCFrame = CFrame.new( HighScalabilityLine.Start, HighScalabilityLine.Start + line ) @@ -1193,7 +1187,7 @@ t.SetupStamperDragger = function( end -- resize the "line" graphic to be the correct size and orientation - tempCFrame = CFrame.new( + local tempCFrame = CFrame.new( HighScalabilityLine.Start, HighScalabilityLine.Start + line ) @@ -1244,21 +1238,21 @@ t.SetupStamperDragger = function( end end - local function DoStamperMouseMove(Mouse) - if not Mouse then + local function DoStamperMouseMove(mouse) + if not mouse then error "Error: RbxStamper.DoStamperMouseMove: Mouse is nil" return end - if not Mouse:IsA "Mouse" then + if not mouse:IsA "Mouse" then error( - `Error: RbxStamper.DoStamperMouseMove: Mouse is of type {Mouse.className} should be of type Mouse` + `Error: RbxStamper.DoStamperMouseMove: Mouse is of type {mouse.className} should be of type Mouse` ) return end -- There wasn't a target (no part or terrain), so check for plane intersection. - if not Mouse.Target then - local cellPos = GetTerrainForMouse(Mouse) + if not mouse.Target then + local cellPos = GetTerrainForMouse(mouse) if nil == cellPos then return end @@ -1271,7 +1265,7 @@ t.SetupStamperDragger = function( -- don't move with dragger - will move in one step on mouse down -- draw ghost at acceptable positions configFound, targetCFrame, targetSurface = - findConfigAtMouseTarget(Mouse, stampData) + findConfigAtMouseTarget(mouse, stampData) if not configFound then error "RbxStamper.DoStamperMouseMove No configFound, returning" return @@ -1405,10 +1399,10 @@ t.SetupStamperDragger = function( end -- auto break joints code - if Mouse and Mouse.Target and Mouse.Target.Parent then - local modelInfo = Mouse.Target:FindFirstChild "RobloxModel" + if mouse and mouse.Target and mouse.Target.Parent then + local modelInfo = mouse.Target:FindFirstChild "RobloxModel" if not modelInfo then - modelInfo = Mouse.Target.Parent:FindFirstChild "RobloxModel" + modelInfo = mouse.Target.Parent:FindFirstChild "RobloxModel" end local myModelInfo = @@ -1433,7 +1427,7 @@ t.SetupStamperDragger = function( hitFace = modelTargetSurface( modelInfo.Parent, game.Workspace.CurrentCamera.CoordinateFrame.p, - Mouse.Hit.p + mouse.Hit.p ) end @@ -1450,7 +1444,7 @@ t.SetupStamperDragger = function( -- now we have to cast the ray back in the other direction to find the surface we're stamping FROM hitFace = modelTargetSurface( stampData.CurrentParts, - Mouse.Hit.p, + mouse.Hit.p, game.Workspace.CurrentCamera.CoordinateFrame.p ) @@ -1476,9 +1470,9 @@ t.SetupStamperDragger = function( if not pcall(function() if - Mouse - and Mouse.Target - and Mouse.Target.Parent:FindFirstChild "RobloxModel" + mouse + and mouse.Target + and mouse.Target.Parent:FindFirstChild "RobloxModel" == nil then return @@ -1488,17 +1482,17 @@ t.SetupStamperDragger = function( end) then game.JointsService:ClearJoinAfterMoveJoints() - Mouse = nil + mouse = nil error "Error: RbxStamper.DoStamperMouseMove Mouse is nil on second check" return end if - Mouse - and Mouse.Target - and Mouse.Target.Parent:FindFirstChild "RobloxModel" == nil + mouse + and mouse.Target + and mouse.Target.Parent:FindFirstChild "RobloxModel" == nil then - game.JointsService:SetJoinAfterMoveTarget(Mouse.Target) + game.JointsService:SetJoinAfterMoveTarget(mouse.Target) else game.JointsService:SetJoinAfterMoveTarget(nil) end @@ -1514,7 +1508,7 @@ t.SetupStamperDragger = function( end end - local function setupKeyListener(key, Mouse) + local function setupKeyListener(key, mouse) if control and control.Paused then return end -- don't do this if we have no stamp @@ -1552,12 +1546,12 @@ t.SetupStamperDragger = function( -- After rotating, update the position configFound, targetCFrame = - findConfigAtMouseTarget(Mouse, stampData) + findConfigAtMouseTarget(mouse, stampData) if configFound then positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts) -- update everything else in MouseMove - DoStamperMouseMove(Mouse) + DoStamperMouseMove(mouse) end elseif key == "c" then -- try to expand our high scalability dragger dimension if @@ -1593,12 +1587,12 @@ t.SetupStamperDragger = function( local function flashRedBox() local gui = game.CoreGui - if game:FindFirstChild "Players" then - if game.Players.LocalPlayer then - if game.Players.LocalPlayer:FindFirstChild "PlayerGui" then - gui = game.Players.LocalPlayer.PlayerGui - end - end + if + game:FindFirstChild "Players" + and game.Players.LocalPlayer + and game.Players.LocalPlayer:FindFirstChild "PlayerGui" + then + gui = game.Players.LocalPlayer.PlayerGui end if not stampData.ErrorBox then return @@ -1624,21 +1618,19 @@ t.SetupStamperDragger = function( end if stampData.ErrorBox then stampData.ErrorBox.Adornee = nil - stampData.ErrorBox.Parent = Tool + stampData.ErrorBox.Parent = Tool -- ? end end) end - local function DoStamperMouseDown(Mouse) - if not Mouse then + local function DoStamperMouseDown(mouse) + if not mouse then error "Error: RbxStamper.DoStamperMouseDown: Mouse is nil" return end - if not Mouse:IsA "Mouse" then + if not mouse:IsA "Mouse" then error( - "Error: RbxStamper.DoStamperMouseDown: Mouse is of type", - Mouse.className, - "should be of type Mouse" + `Error: RbxStamper.DoStamperMouseDown: Mouse is of type {mouse.className}, should be of type Mouse` ) return end @@ -1647,7 +1639,7 @@ t.SetupStamperDragger = function( end if isMegaClusterPart() then - if Mouse and HighScalabilityLine then + if mouse and HighScalabilityLine then local megaCube = stampData.CurrentParts:FindFirstChild( "MegaClusterCube", true @@ -1938,7 +1930,7 @@ t.SetupStamperDragger = function( if checkHighScalabilityStamp then -- check to see if cell is in region, if not we'll skip set if allowedStampRegion then - local cellPos = cellCenterToWorld( + cellPos = cellCenterToWorld( game.Workspace.Terrain, cellPos.X, cellPos.Y, @@ -2231,16 +2223,14 @@ t.SetupStamperDragger = function( return cellSet end - local function DoStamperMouseUp(Mouse) - if not Mouse then + local function DoStamperMouseUp(mouse) + if not mouse then error "Error: RbxStamper.DoStamperMouseUp: Mouse is nil" return false end - if not Mouse:IsA "Mouse" then + if not mouse:IsA "Mouse" then error( - "Error: RbxStamper.DoStamperMouseUp: Mouse is of type", - Mouse.className, - "should be of type Mouse" + `Error: RbxStamper.DoStamperMouseUp: Mouse is of type {mouse.className}, should be of type Mouse` ) return false end @@ -2269,8 +2259,10 @@ t.SetupStamperDragger = function( canStamp = true checkHighScalabilityStamp = true else - canStamp, checkHighScalabilityStamp = - t.CanEditRegion(stampData.CurrentParts, allowedStampRegion) + canStamp, checkHighScalabilityStamp = RbxStamper.CanEditRegion( + stampData.CurrentParts, + allowedStampRegion + ) end if not canStamp then @@ -2288,8 +2280,9 @@ t.SetupStamperDragger = function( end -- recheck if we can stamp, as we just moved part + local canStamp canStamp, checkHighScalabilityStamp = - t.CanEditRegion(stampData.CurrentParts, allowedStampRegion) + RbxStamper.CanEditRegion(stampData.CurrentParts, allowedStampRegion) if not canStamp then if stampFailedFunc then stampFailedFunc() @@ -2305,7 +2298,7 @@ t.SetupStamperDragger = function( -- HotThoth's note: Now that above CurrentParts positioning has been commented out, to be truly correct, we would need to use the -- value of configFound from the previous onStamperMouseMove call which moved the CurrentParts -- Shouldn't this be true when lastTargetCFrame has been set and false otherwise? - configFound, targetCFrame = findConfigAtMouseTarget(Mouse, stampData) + configFound, targetCFrame = findConfigAtMouseTarget(mouse, stampData) if configFound and not HighScalabilityLine.Adorn.Parent then if @@ -2612,9 +2605,9 @@ t.SetupStamperDragger = function( end -- make sure all the joints are activated before restoring anchor states - if not createJoints then - game.JointsService:CreateJoinAfterMoveJoints() - end + -- if not createJoints then + game.JointsService:CreateJoinAfterMoveJoints() + -- end -- Restore the original properties for all parts being stamped for part, transparency in pairs(stampData.TransparencyTable) do @@ -2663,9 +2656,9 @@ t.SetupStamperDragger = function( end -- and make sure we don't delete it, now that it's not a ghost part - if ghostRemovalScript then - ghostRemovalScript.Parent = nil - end + -- if ghostRemovalScript then + -- ghostRemovalScript.Parent = nil + -- end --Re-enable the scripts for _, script in pairs(stampData.DisabledScripts) do @@ -2979,20 +2972,20 @@ t.SetupStamperDragger = function( return control end -t.Help = function(funcNameOrFunc) +RbxStamper.Help = function(funcNameOrFunc) --input argument can be a string or a function. Should return a description (of arguments and expected side effects) if funcNameOrFunc == "GetStampModel" - or funcNameOrFunc == t.GetStampModel + or funcNameOrFunc == RbxStamper.GetStampModel then return "Function GetStampModel. Arguments: assetId, useAssetVersionId. assetId is the asset to load in, define useAssetVersionId as true if assetId is a version id instead of a relative assetId. Side effect: returns a model of the assetId, or a string with error message if something fails" end if funcNameOrFunc == "SetupStamperDragger" - or funcNameOrFunc == t.SetupStamperDragger + or funcNameOrFunc == RbxStamper.SetupStamperDragger then return "Function SetupStamperDragger. Side Effect: Creates 4x4 stamping mechanism for building out parts quickly. Arguments: ModelToStamp, Mouse, LegalStampCheckFunction. ModelToStamp should be a Model or Part, preferrably loaded from RbxStamper.GetStampModel and should have extents that are multiples of 4. Mouse should be a mouse object (obtained from things such as Tool.OnEquipped), used to drag parts around 'stamp' them out. LegalStampCheckFunction is optional, used as a callback with a table argument (table is full of instances about to be stamped). Function should return either true or false, false stopping the stamp action." end end -return t +return RbxStamper diff --git a/luau/89449008.luau b/luau/89449008.luau index 2f046fb..87fb2ee 100644 --- a/luau/89449008.luau +++ b/luau/89449008.luau @@ -158,7 +158,7 @@ end function robloxLock(instance) instance.RobloxLocked = true - children = instance:GetChildren() + local children = instance:GetChildren() if children then for _, child in ipairs(children) do robloxLock(child) @@ -292,6 +292,29 @@ function findEmptySlot() return smallestNum end +function unequipGear(physGear) + physGear.Parent = playerBackpack + updateGridActive() +end + +function highlight(button) + button.TextColor3 = Color3.new(0, 0, 0) + button.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8) +end +function clearHighlight(button) + button.TextColor3 = Color3.new(1, 1, 1) + button.BackgroundColor3 = Color3.new(0, 0, 0) +end + +function swapGearSlot(slot, newGearButton) + if not swapSlot.Value then -- signal loadout to swap a gear out + swapSlot.Slot.Value = slot + swapSlot.GearButton.Value = newGearButton + swapSlot.Value = true + updateGridActive() + end +end + function checkForSwap(button, x, y) local loadoutChildren = currentLoadout:GetChildren() for i = 1, #loadoutChildren do @@ -320,6 +343,163 @@ function checkForSwap(button, x, y) return false end +local UnequipGearMenuClick = function(element, menu) + if type(element.Action) ~= "number" then + return + end + local num = element.Action + if num == 1 then -- remove from loadout + unequipGear(menu.Parent.GearReference.Value) + local inventoryButton = menu.Parent + local gearToUnequip = inventoryButton.GearReference.Value + local loadoutChildren = currentLoadout:GetChildren() + local slot = -1 + for i = 1, #loadoutChildren do + if loadoutChildren[i]:IsA "Frame" then + local button = loadoutChildren[i]:GetChildren() + if + button[1] + and button[1].GearReference.Value == gearToUnequip + then + slot = button[1].SlotNumber.Text + break + end + end + end + swapGearSlot(slot, nil) + end +end + +function getGearContextMenu() + local gearContextMenu = Instance.new "Frame" + gearContextMenu.Active = true + gearContextMenu.Name = "UnequipContextMenu" + gearContextMenu.Size = UDim2.new(0, 115, 0, 70) + gearContextMenu.Position = UDim2.new(0, -16, 0, -16) + gearContextMenu.BackgroundTransparency = 1 + gearContextMenu.Visible = false + + local gearContextMenuButton = Instance.new "TextButton" + gearContextMenuButton.Name = "UnequipContextMenuButton" + gearContextMenuButton.Text = "" + gearContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault + gearContextMenuButton.ZIndex = 8 + gearContextMenuButton.Size = UDim2.new(1, 0, 1, -20) + gearContextMenuButton.Visible = true + gearContextMenuButton.Parent = gearContextMenu + + local elementHeight = 12 + + local contextMenuElements = {} + local contextMenuElementsName = { "Remove Hotkey" } + + for i = 1, #contextMenuElementsName do + local element = {} + element.Type = "Button" + element.Text = contextMenuElementsName[i] + element.Action = i + element.DoIt = UnequipGearMenuClick + table.insert(contextMenuElements, element) + end + + for i, contextElement in ipairs(contextMenuElements) do + local element = contextElement + if element.Type == "Button" then + local button = Instance.new "TextButton" + button.Name = `UnequipContextButton{i}` + button.BackgroundColor3 = Color3.new(0, 0, 0) + button.BorderSizePixel = 0 + button.TextXAlignment = Enum.TextXAlignment.Left + button.Text = ` {contextElement.Text}` + button.Font = Enum.Font.Arial + button.FontSize = Enum.FontSize.Size14 + button.Size = UDim2.new(1, 8, 0, elementHeight) + button.Position = UDim2.new(0, 0, 0, elementHeight * i) + button.TextColor3 = Color3.new(1, 1, 1) + button.ZIndex = 9 + button.Parent = gearContextMenuButton + + if not IsTouchDevice() then + button.MouseButton1Click:connect(function() + if button.Active and not gearContextMenu.Parent.Active then + pcall(function() + element.DoIt(element, gearContextMenu) + end) + browsingMenu = false + gearContextMenu.Visible = false + clearHighlight(button) + clearPreview() + end + end) + + button.MouseEnter:connect(function() + if button.Active and gearContextMenu.Parent.Active then + highlight(button) + end + end) + button.MouseLeave:connect(function() + if button.Active and gearContextMenu.Parent.Active then + clearHighlight(button) + end + end) + end + + contextElement.Button = button + contextElement.Element = button + elseif element.Type == "Label" then + local frame = Instance.new "Frame" + frame.Name = `ContextLabel{i}` + frame.BackgroundTransparency = 1 + frame.Size = UDim2.new(1, 8, 0, elementHeight) + + local label = Instance.new "TextLabel" + label.Name = "Text1" + label.BackgroundTransparency = 1 + label.BackgroundColor3 = Color3.new(1, 1, 1) + label.BorderSizePixel = 0 + label.TextXAlignment = Enum.TextXAlignment.Left + label.Font = Enum.Font.ArialBold + label.FontSize = Enum.FontSize.Size14 + label.Position = UDim2.new(0, 0, 0, 0) + label.Size = UDim2.new(0.5, 0, 1, 0) + label.TextColor3 = Color3.new(1, 1, 1) + label.ZIndex = 9 + label.Parent = frame + element.Label1 = label + + if element.GetText2 then + label = Instance.new "TextLabel" + label.Name = "Text2" + label.BackgroundTransparency = 1 + label.BackgroundColor3 = Color3.new(1, 1, 1) + label.BorderSizePixel = 0 + label.TextXAlignment = Enum.TextXAlignment.Right + label.Font = Enum.Font.Arial + label.FontSize = Enum.FontSize.Size14 + label.Position = UDim2.new(0.5, 0, 0, 0) + label.Size = UDim2.new(0.5, 0, 1, 0) + label.TextColor3 = Color3.new(1, 1, 1) + label.ZIndex = 9 + label.Parent = frame + element.Label2 = label + end + frame.Parent = gearContextMenuButton + element.Label = frame + element.Element = frame + end + end + + gearContextMenu.ZIndex = 4 + gearContextMenu.MouseLeave:connect(function() + browsingMenu = false + gearContextMenu.Visible = false + clearPreview() + end) + robloxLock(gearContextMenu) + + return gearContextMenu +end + function resizeGrid() for _, v in pairs(backpackItems) do if not v:FindFirstChild "RobloxBuildTool" then @@ -565,56 +745,6 @@ end -- updateGridActive() -- end -function unequipGear(physGear) - physGear.Parent = playerBackpack - updateGridActive() -end - -function highlight(button) - button.TextColor3 = Color3.new(0, 0, 0) - button.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8) -end -function clearHighlight(button) - button.TextColor3 = Color3.new(1, 1, 1) - button.BackgroundColor3 = Color3.new(0, 0, 0) -end - -function swapGearSlot(slot, gearButton) - if not swapSlot.Value then -- signal loadout to swap a gear out - swapSlot.Slot.Value = slot - swapSlot.GearButton.Value = gearButton - swapSlot.Value = true - updateGridActive() - end -end - -local UnequipGearMenuClick = function(element, menu) - if type(element.Action) ~= "number" then - return - end - local num = element.Action - if num == 1 then -- remove from loadout - unequipGear(menu.Parent.GearReference.Value) - local inventoryButton = menu.Parent - local gearToUnequip = inventoryButton.GearReference.Value - local loadoutChildren = currentLoadout:GetChildren() - local slot = -1 - for i = 1, #loadoutChildren do - if loadoutChildren[i]:IsA "Frame" then - local button = loadoutChildren[i]:GetChildren() - if - button[1] - and button[1].GearReference.Value == gearToUnequip - then - slot = button[1].SlotNumber.Text - break - end - end - end - swapGearSlot(slot, nil) - end -end - function setupCharacterConnections() if backpackAddCon then backpackAddCon:disconnect() @@ -737,136 +867,6 @@ function nukeBackpack() end end -function getGearContextMenu() - local gearContextMenu = Instance.new "Frame" - gearContextMenu.Active = true - gearContextMenu.Name = "UnequipContextMenu" - gearContextMenu.Size = UDim2.new(0, 115, 0, 70) - gearContextMenu.Position = UDim2.new(0, -16, 0, -16) - gearContextMenu.BackgroundTransparency = 1 - gearContextMenu.Visible = false - - local gearContextMenuButton = Instance.new "TextButton" - gearContextMenuButton.Name = "UnequipContextMenuButton" - gearContextMenuButton.Text = "" - gearContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault - gearContextMenuButton.ZIndex = 8 - gearContextMenuButton.Size = UDim2.new(1, 0, 1, -20) - gearContextMenuButton.Visible = true - gearContextMenuButton.Parent = gearContextMenu - - local elementHeight = 12 - - local contextMenuElements = {} - local contextMenuElementsName = { "Remove Hotkey" } - - for i = 1, #contextMenuElementsName do - local element = {} - element.Type = "Button" - element.Text = contextMenuElementsName[i] - element.Action = i - element.DoIt = UnequipGearMenuClick - table.insert(contextMenuElements, element) - end - - for i, contextElement in ipairs(contextMenuElements) do - local element = contextElement - if element.Type == "Button" then - local button = Instance.new "TextButton" - button.Name = `UnequipContextButton{i}` - button.BackgroundColor3 = Color3.new(0, 0, 0) - button.BorderSizePixel = 0 - button.TextXAlignment = Enum.TextXAlignment.Left - button.Text = ` {contextElement.Text}` - button.Font = Enum.Font.Arial - button.FontSize = Enum.FontSize.Size14 - button.Size = UDim2.new(1, 8, 0, elementHeight) - button.Position = UDim2.new(0, 0, 0, elementHeight * i) - button.TextColor3 = Color3.new(1, 1, 1) - button.ZIndex = 9 - button.Parent = gearContextMenuButton - - if not IsTouchDevice() then - button.MouseButton1Click:connect(function() - if button.Active and not gearContextMenu.Parent.Active then - pcall(function() - element.DoIt(element, gearContextMenu) - end) - browsingMenu = false - gearContextMenu.Visible = false - clearHighlight(button) - clearPreview() - end - end) - - button.MouseEnter:connect(function() - if button.Active and gearContextMenu.Parent.Active then - highlight(button) - end - end) - button.MouseLeave:connect(function() - if button.Active and gearContextMenu.Parent.Active then - clearHighlight(button) - end - end) - end - - contextElement.Button = button - contextElement.Element = button - elseif element.Type == "Label" then - local frame = Instance.new "Frame" - frame.Name = `ContextLabel{i}` - frame.BackgroundTransparency = 1 - frame.Size = UDim2.new(1, 8, 0, elementHeight) - - local label = Instance.new "TextLabel" - label.Name = "Text1" - label.BackgroundTransparency = 1 - label.BackgroundColor3 = Color3.new(1, 1, 1) - label.BorderSizePixel = 0 - label.TextXAlignment = Enum.TextXAlignment.Left - label.Font = Enum.Font.ArialBold - label.FontSize = Enum.FontSize.Size14 - label.Position = UDim2.new(0, 0, 0, 0) - label.Size = UDim2.new(0.5, 0, 1, 0) - label.TextColor3 = Color3.new(1, 1, 1) - label.ZIndex = 9 - label.Parent = frame - element.Label1 = label - - if element.GetText2 then - label = Instance.new "TextLabel" - label.Name = "Text2" - label.BackgroundTransparency = 1 - label.BackgroundColor3 = Color3.new(1, 1, 1) - label.BorderSizePixel = 0 - label.TextXAlignment = Enum.TextXAlignment.Right - label.Font = Enum.Font.Arial - label.FontSize = Enum.FontSize.Size14 - label.Position = UDim2.new(0.5, 0, 0, 0) - label.Size = UDim2.new(0.5, 0, 1, 0) - label.TextColor3 = Color3.new(1, 1, 1) - label.ZIndex = 9 - label.Parent = frame - element.Label2 = label - end - frame.Parent = gearContextMenuButton - element.Label = frame - element.Element = frame - end - end - - gearContextMenu.ZIndex = 4 - gearContextMenu.MouseLeave:connect(function() - browsingMenu = false - gearContextMenu.Visible = false - clearPreview() - end) - robloxLock(gearContextMenu) - - return gearContextMenu -end - function coreGuiChanged(coreGuiType, enabled) if coreGuiType == Enum.CoreGuiType.Backpack @@ -944,8 +944,8 @@ player.ChildAdded:connect(function(child) backpackAddCon:disconnect() end backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect( - function(child) - addToGrid(child) + function(child2) + addToGrid(child2) end ) end @@ -985,7 +985,7 @@ resize() resizeGrid() -- make sure any items in the loadout are accounted for in inventory -local loadoutChildren = currentLoadout:GetChildren() +loadoutChildren = currentLoadout:GetChildren() for i = 1, #loadoutChildren do loadoutCheck(loadoutChildren[i], false) end diff --git a/luau/89449093.luau b/luau/89449093.luau index dce422e..3b57179 100644 --- a/luau/89449093.luau +++ b/luau/89449093.luau @@ -215,7 +215,7 @@ function showBackpack() backpackOpenEvent:Fire(currentTab) canToggle = true readyForNextEvent = true - backpackButton.Image = "http://banland.xyz/asset/?id=97644093" + backpackButton.Image = "https://banland.xyz/asset/?id=97644093" backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103) end) @@ -240,7 +240,7 @@ function toggleBackpack() backpackIsOpen = not backpackIsOpen if backpackIsOpen then - loadoutBackground.Image = "http://banland.xyz/asset/?id=97623721" + loadoutBackground.Image = "https://banland.xyz/asset/?id=97623721" loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0) loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0) loadoutBackground.ZIndex = 2.0 @@ -250,8 +250,8 @@ function toggleBackpack() backpackButton.Position = UDim2.new(0.5, -60, 1, -44) loadoutBackground.Visible = false backpackButton.Selected = false - backpackButton.Image = "http://banland.xyz/asset/?id=97617958" - loadoutBackground.Image = "http://banland.xyz/asset/?id=96536002" + backpackButton.Image = "https://banland.xyz/asset/?id=97617958" + loadoutBackground.Image = "https://banland.xyz/asset/?id=96536002" loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0) loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0) hideBackpack() diff --git a/luau/97188756.luau b/luau/97188756.luau index 2abe453..f45ffda 100644 --- a/luau/97188756.luau +++ b/luau/97188756.luau @@ -179,45 +179,6 @@ local Chat = { Messages_List = {}, MessageThread = nil, - -- Admins_List = { - -- "Sorcus", - -- "Shedletsky", - -- "Telamon", - -- "Tarabyte", - -- "StickMasterLuke", - -- "OnlyTwentyCharacters", - -- "FusRoblox", - -- "SolarCrane", - -- "HotThoth", - -- "JediTkacheff", - -- "Builderman", - -- "Brighteyes", - -- "ReeseMcblox", - -- "GemLocker", - -- "GongfuTiger", - -- "Erik.Cassel", - -- "Matt Dusek", - -- "Keith", - -- "Totbl", - -- "LordRugDump", - -- "David.Baszucki", - -- "Dbapostle", - -- "DaveYorkRBX", - -- "nJay", - -- "OstrichSized", - -- "TobotRobot", - -- "twberg", - -- "Mercury", - -- "RBAdam", - -- "Doughtless", - -- "Anaminus", - -- "Stravant", - -- "Cr3470r", - -- "CodeWriter", - -- "Games", - -- "AcesWayUpHigh", - -- "Phil", - -- }, Admins_List = { "taskmanager", "Heliodex", "tako" }, SafeChat_List = { @@ -1454,7 +1415,7 @@ function Chat:CreateSafeChatGui() Size = UDim2.new(0, 44, 0, 31), Position = UDim2.new(0, 1, 0.35, 0), BackgroundTransparency = 1, - Image = "http://banland.xyz/asset/?id=97080365", + Image = "https://banland.xyz/asset/?id=97080365", }, } @@ -1501,7 +1462,7 @@ function Chat:CreateTouchButton() Size = UDim2.new(1, 0, 1, 0), Position = UDim2.new(0, 0, 0, 0), BackgroundTransparency = 1, - Image = "http://banland.xyz/asset/?id=97078724", + Image = "https://banland.xyz/asset/?id=97078724", }, } self.TapToChatLabel = self.ChatTouchFrame.ChatLabel @@ -1606,7 +1567,7 @@ function Chat:CreateGui() Gui.Create "ImageLabel" { Name = "Background", - Image = "http://banland.xyz/asset/?id=97120937", --96551212'; + Image = "https://banland.xyz/asset/?id=97120937", --96551212'; Size = UDim2.new(1.3, 0, 1.64, 0), Position = UDim2.new(0, 0, 0, 0), BackgroundTransparency = 1, diff --git a/luau/host.luau b/luau/host.luau index 45b584e..f507404 100644 --- a/luau/host.luau +++ b/luau/host.luau @@ -7,6 +7,14 @@ local BadgeService = game:GetService "BadgeService" local FriendService = game:GetService "FriendService" local ScriptContext = game:GetService "ScriptContext" local RunService = game:GetService "RunService" +local ScriptInformationProvider = game:GetService "ScriptInformationProvider" +local ChangeHistoryService = game:GetService "ChangeHistoryService" +local ContentProvider = game:GetService "ContentProvider" +local Players = game:GetService "Players" +local Visit = game:GetService "Visit" + +-- establish this peer as the Server +local NetworkServer = game:GetService "NetworkServer" -- StartGame -- pcall(function() @@ -93,23 +101,20 @@ end) ScriptContext.ScriptsDisabled = true -- game:SetPlaceID(nil, false) -game:GetService("ChangeHistoryService"):SetEnabled(false) - --- establish this peer as the Server -local ns = game:GetService "NetworkServer" +ChangeHistoryService:SetEnabled(false) if url ~= nil then pcall(function() - game:GetService("Players"):SetAbuseReportUrl(`{url}/Report/Games.ashx`) + Players:SetAbuseReportUrl(`{url}/Report/Games.ashx`) end) pcall(function() - game:GetService("ScriptInformationProvider"):SetAssetUrl(`{url}/Asset/`) + ScriptInformationProvider:SetAssetUrl(`{url}/Asset/`) end) pcall(function() - game:GetService("ContentProvider"):SetBaseUrl(`{url}/`) + ContentProvider:SetBaseUrl(`{url}/`) end) -- pcall(function() - -- game:GetService("Players"):SetChatFilterUrl( + -- Players:SetChatFilterUrl( -- `{url}/Game/ChatFilter.ashx` -- ) -- end) @@ -144,7 +149,7 @@ if url ~= nil then `{url}/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d` ) InsertService:SetCollectionUrl(`{url}/Game/Tools/InsertAsset.ashx?sid=%d`) - InsertService:SetAssetUrl(`{url}/Asset/?id=%d`) + InsertService:SetAssetUrl(`{url}/asset?id=%d`) InsertService:SetAssetVersionUrl(`{url}/Asset/?assetversionid=%d`) pcall(function() @@ -161,15 +166,9 @@ if url ~= nil then end pcall(function() - game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) + NetworkServer:SetIsPlayerAuthenticationRequired(true) end) settings().Diagnostics.LuaRamLimit = 0 ---settings().Network:SetThroughputSensitivity(0.08, 0.01) ---settings().Network.SendRate = 35 ---settings().Network.PhysicsSend = 0 -- 1==RoundRobin - ---shared.__time = 0 ---game:GetService("RunService").Stepped:connect(function (time) shared.__time = time end) if placeId ~= nil and killID ~= nil and deathID ~= nil and url ~= nil then -- listen for the death of a Player @@ -184,7 +183,7 @@ if placeId ~= nil and killID ~= nil and deathID ~= nil and url ~= nil then end -- listen to all Players' Characters - game:GetService("Players").ChildAdded:connect(function(player) + Players.ChildAdded:connect(function(player) createDeathMonitor(player) player.Changed:connect(function(property) if property == "Character" then @@ -194,7 +193,7 @@ if placeId ~= nil and killID ~= nil and deathID ~= nil and url ~= nil then end) end -game:GetService("Players").PlayerAdded:connect(function(player) +Players.PlayerAdded:connect(function(player) print(`Player {player.userId} added`) if url and access and placeId and player and player.userId then @@ -207,7 +206,7 @@ game:GetService("Players").PlayerAdded:connect(function(player) end end) -game:GetService("Players").PlayerRemoving:connect(function(player) +Players.PlayerRemoving:connect(function(player) print(`Player {player.userId} leaving`) if url and access and placeId and player and player.userId then @@ -234,9 +233,9 @@ if _MAP_LOCATION_EXISTS then end -- Now start the connection -ns:Start(_SERVER_PORT, sleeptime) +NetworkServer:Start(_SERVER_PORT, sleeptime) -game:GetService("Visit"):SetPing("_SERVER_PRESENCE_URL", 30) +Visit:SetPing("_SERVER_PRESENCE_URL", 30) if timeout then ScriptContext:SetTimeout(timeout) diff --git a/luau/join.luau b/luau/join.luau index e8050cc..3079071 100644 --- a/luau/join.luau +++ b/luau/join.luau @@ -5,7 +5,6 @@ local ContentProvider = game:GetService "ContentProvider" local SocialService = game:GetService "SocialService" local GamePassService = game:GetService "GamePassService" local MarketplaceService = game:GetService "MarketplaceService" --- local UserInputService = game:GetService "UserInputService" local Players = game:GetService "Players" local Client = game:GetService "NetworkClient" local Visit = game:GetService "Visit" @@ -51,29 +50,29 @@ print "! Joining game '_PLACE_ID' place _PLACE_ID at _SERVER_ADDRESS" ChangeHistoryService:SetEnabled(false) ContentProvider:SetThreadPool(16) -InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" -InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" -InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" -InsertService:SetAssetUrl "http://banland.xyz/asset?id=%d" -InsertService:SetAssetVersionUrl "http://banland.xyz/asset?assetversionid=%d" +InsertService:SetBaseSetsUrl "https://banland.xyz/game/tools/insertasset?nsets=10&type=base" +InsertService:SetUserSetsUrl "https://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" +InsertService:SetCollectionUrl "https://banland.xyz/game/tools/insertasset?sid=%d" +InsertService:SetAssetUrl "https://banland.xyz/asset?id=%d" +InsertService:SetAssetVersionUrl "https://banland.xyz/asset?assetversionid=%d" pcall(function() - SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" + SocialService:SetFriendUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" end) pcall(function() - SocialService:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" + SocialService:SetBestFriendUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" end) pcall(function() - SocialService:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" + SocialService:SetGroupUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" end) pcall(function() - SocialService:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" + SocialService:SetGroupRankUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" end) pcall(function() - SocialService:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" + SocialService:SetGroupRoleUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" end) pcall(function() - GamePassService:SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" + GamePassService:SetPlayerHasPassUrl "https://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" end) pcall(function() MarketplaceService:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d" @@ -293,6 +292,6 @@ pcall(function() game:SetScreenshotInfo "" end) pcall(function() - game:SetVideoInfo 'GamesMercury, video, free game, online virtual world' + game:SetVideoInfo 'GamesMercury, video, free game, online virtual world' end) -- use single quotes here because the video info string may have unescaped double quotes diff --git a/luau/studio.luau b/luau/studio.luau index 9a42e39..eb3a791 100644 --- a/luau/studio.luau +++ b/luau/studio.luau @@ -7,37 +7,37 @@ local ScriptInformationProvider = game:GetService "ScriptInformationProvider" local ScriptContext = game:GetService "ScriptContext" -- Setup studio cmd bar & load core scripts pcall(function() - InsertService:SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" + InsertService:SetFreeModelUrl "https://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" end) pcall(function() - InsertService:SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" + InsertService:SetFreeDecalUrl "https://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" end) -ScriptInformationProvider:SetAssetUrl "http://banland.xyz/Asset/" -InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" -InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" -InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" -InsertService:SetAssetUrl "http://banland.xyz/Asset/?id=%d" -InsertService:SetAssetVersionUrl "http://banland.xyz/Asset/?assetversionid=%d" +ScriptInformationProvider:SetAssetUrl "https://banland.xyz/asset/" +InsertService:SetBaseSetsUrl "https://banland.xyz/game/tools/insertasset?nsets=10&type=base" +InsertService:SetUserSetsUrl "https://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" +InsertService:SetCollectionUrl "https://banland.xyz/game/tools/insertasset?sid=%d" +InsertService:SetAssetUrl "https://banland.xyz/asset/?id=%d" +InsertService:SetAssetVersionUrl "https://banland.xyz/asset/?assetversionid=%d" InsertService:SetTrustLevel(0) pcall(function() - SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" + SocialService:SetFriendUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" end) pcall(function() - SocialService:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" + SocialService:SetBestFriendUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" end) pcall(function() - SocialService:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" + SocialService:SetGroupUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" end) pcall(function() - SocialService:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" + SocialService:SetGroupRankUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" end) pcall(function() - SocialService:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" + SocialService:SetGroupRoleUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" end) pcall(function() - GamePassService:SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" + GamePassService:SetPlayerHasPassUrl "https://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" end) pcall(function() MarketplaceService:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d" diff --git a/luau/visit.luau b/luau/visit.luau index 8360b7c..8526528 100644 --- a/luau/visit.luau +++ b/luau/visit.luau @@ -24,40 +24,40 @@ local message = Instance.new "Message" message.Parent = workspace message.archivable = false -ScriptInformationProvider:SetAssetUrl "http://banland.xyz/Asset/" +ScriptInformationProvider:SetAssetUrl "https://banland.xyz/Asset/" ContentProvider:SetThreadPool(16) pcall(function() - InsertService:SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" + InsertService:SetFreeModelUrl "https://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" end) -- Used for free model search (insert tool) pcall(function() - InsertService:SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" + InsertService:SetFreeDecalUrl "https://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" end) -- Used for free decal search (insert tool) settings().Diagnostics:LegacyScriptMode() -InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" -InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" -InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" -InsertService:SetAssetUrl "http://banland.xyz/Asset/?id=%d" -InsertService:SetAssetVersionUrl "http://banland.xyz/Asset/?assetversionid=%d" +InsertService:SetBaseSetsUrl "https://banland.xyz/game/tools/insertasset?nsets=10&type=base" +InsertService:SetUserSetsUrl "https://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" +InsertService:SetCollectionUrl "https://banland.xyz/game/tools/insertasset?sid=%d" +InsertService:SetAssetUrl "https://banland.xyz/Asset/?id=%d" +InsertService:SetAssetVersionUrl "https://banland.xyz/Asset/?assetversionid=%d" pcall(function() - SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" + SocialService:SetFriendUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" end) pcall(function() - SocialService:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" + SocialService:SetBestFriendUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" end) pcall(function() - SocialService:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" + SocialService:SetGroupUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" end) pcall(function() - SocialService:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" + SocialService:SetGroupRankUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" end) pcall(function() - SocialService:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" + SocialService:SetGroupRoleUrl "https://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" end) pcall(function() - GamePassService:SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" + GamePassService:SetPlayerHasPassUrl "https://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" end) pcall(function() game:SetCreatorID(0, Enum.CreatorType.User) @@ -80,7 +80,7 @@ end) ChangeHistoryService:SetEnabled(false) pcall(function() - Players:SetBuildUserPermissionsUrl "http://banland.xyz/Game/BuildActionPermissionCheck.ashx?assetId=0&userId=%d&isSolo=true" + Players:SetBuildUserPermissionsUrl "https://banland.xyz/Game/BuildActionPermissionCheck.ashx?assetId=0&userId=%d&isSolo=true" end) workspace:SetPhysicsThrottleEnabled(true)