Revert changes with Fusion to corescripts and add some other improvements

This commit is contained in:
Lewin Kelly 2023-09-30 03:58:36 +01:00
parent 79408d8a57
commit c959501e61
5 changed files with 934 additions and 1261 deletions

View File

@ -4,6 +4,7 @@ print "[Mercury]: Loaded corescript 107893730"
-- this script creates the gui and sends the web requests for in game purchase prompts
local MarketplaceService = game:GetService "MarketplaceService"
local GuiService = game:GetService "GuiService"
-- wait for important items to appear
while not Game do
@ -164,14 +165,13 @@ end
function signalPromptEnded(isSuccess)
closePurchasePrompt()
if purchasingConsumable then
game:GetService("MarketplaceService")
:SignalPromptProductPurchaseFinished(
game.Players.LocalPlayer.userId,
currentProductId,
isSuccess
)
MarketplaceService:SignalPromptProductPurchaseFinished(
game.Players.LocalPlayer.userId,
currentProductId,
isSuccess
)
else
game:GetService("MarketplaceService"):SignalPromptPurchaseFinished(
MarketplaceService:SignalPromptPurchaseFinished(
game.Players.LocalPlayer,
currentAssetId,
isSuccess
@ -514,7 +514,7 @@ function doAcceptPurchase(_)
purchaseFailed()
return
end
Game:GetService("MarketplaceService"):SignalClientPurchaseSuccess(
MarketplaceService:SignalClientPurchaseSuccess(
tostring(response.receipt),
game.Players.LocalPlayer.userId,
currentProductId
@ -533,14 +533,10 @@ end
---------------------------------------------- Currency Functions ---------------------------------------------
-- enums have no implicit conversion to numbers in lua, has to have a function to do this
function currencyEnumToInt(currencyEnum: Enum.CurrencyType)
if
currencyEnum == Enum.CurrencyType.Robux
or currencyEnum == Enum.CurrencyType.Default
then
return 1
elseif currencyEnum == Enum.CurrencyType.Tix then
if currencyEnum == Enum.CurrencyType.Tix then
return 2
end
return 1
end
-- oi, this is ugly
@ -620,7 +616,7 @@ function currencyTypeToString(currencyType)
end
-- figure out what currency to use based on the currency you can actually sell the item in and what the script specified
function setCurrencyAmountAndType(priceInRobux, priceInTix)
local function setCurrencyAmountAndType(priceInRobux, priceInTix)
if
currentCurrencyType == Enum.CurrencyType.Default
or currentCurrencyType == Enum.CurrencyType.Robux
@ -652,7 +648,7 @@ function setCurrencyAmountAndType(priceInRobux, priceInTix)
end
-- will get the player's balance of robux and tix, return in a table
function getPlayerBalance()
local function getPlayerBalance()
local playerBalance
local success, errorCode = ypcall(function()
playerBalance =
@ -660,11 +656,11 @@ function getPlayerBalance()
end)
if not success then
print("Get player balance failed because", errorCode)
return nil
return
end
if playerBalance == "" then
return nil
return
end
playerBalance = getRbxUtility().DecodeJSON(playerBalance)
@ -675,13 +671,13 @@ end
-- should open an external default browser window to this url
function openBuyCurrencyWindow()
checkingPlayerFunds = true
game:GetService("GuiService")
:OpenBrowserWindow(baseUrl .. "Upgrades/Robux.aspx")
GuiService:OpenBrowserWindow(baseUrl .. "Upgrades/Robux.aspx")
end
function openBCUpSellWindow()
Game:GetService("GuiService")
:OpenBrowserWindow(baseUrl .. "Upgrades/BuildersClubMemberships.aspx")
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)
@ -758,7 +754,7 @@ end
---------------------------------------------- Data Functions -----------------------------------------------------
-- more enum to int fun!
function membershipTypeToNumber(membership)
local function membershipTypeToNumber(membership)
if membership == Enum.MembershipType.None then
return 0
elseif membership == Enum.MembershipType.BuildersClub then
@ -795,8 +791,8 @@ function canPurchaseItem()
end
else
success = ypcall(function()
currentProductInfo = game:GetService("MarketplaceService")
:GetProductInfo(currentAssetId)
currentProductInfo =
MarketplaceService:GetProductInfo(currentAssetId)
end)
end
@ -816,7 +812,7 @@ function canPurchaseItem()
return false
end
local success, errorCode = ypcall(function()
local success2, errorCode = ypcall(function()
playerOwnsAsset = game:HttpGetAsync(
getSecureApiBaseUrl()
.. "ownership/hasAsset?userId="
@ -826,7 +822,7 @@ function canPurchaseItem()
)
end)
if not success then
if not success2 then
print("could not tell if player owns asset because", errorCode)
return false
end
@ -1361,12 +1357,11 @@ function userPurchaseProductActionsEnded(userIsClosingDialog)
isPurchased = true
end
Game:GetService("MarketplaceService")
:SignalPromptProductPurchaseFinished(
tonumber(currentServerResponseTable.playerId),
tonumber(currentServerResponseTable.productId),
isPurchased
)
MarketplaceService:SignalPromptProductPurchaseFinished(
tonumber(currentServerResponseTable.playerId),
tonumber(currentServerResponseTable.productId),
isPurchased
)
else
print "Something went wrong, no currentServerResponseTable"
end
@ -1406,23 +1401,26 @@ end
---------------------------------------------- Script Event start/initialization ----------------------------------------------
preloadAssets()
game:GetService("MarketplaceService").PromptProductPurchaseRequested
:connect(function(player, productId, equipIfPurchased, currencyType)
MarketplaceService.PromptProductPurchaseRequested:connect(
function(player, productId, equipIfPurchased, currencyType)
doPurchasePrompt(player, nil, equipIfPurchased, currencyType, productId)
end)
end
)
Game:GetService("MarketplaceService").PromptPurchaseRequested
:connect(function(player, assetId, equipIfPurchased, currencyType)
MarketplaceService.PromptPurchaseRequested:connect(
function(player, assetId, equipIfPurchased, currencyType)
doPurchasePrompt(player, assetId, equipIfPurchased, currencyType, nil)
end)
end
)
Game:GetService("MarketplaceService").ServerPurchaseVerification
:connect(function(serverResponseTable)
MarketplaceService.ServerPurchaseVerification:connect(
function(serverResponseTable)
doProcessServerPurchaseResponse(serverResponseTable)
end)
end
)
if enableBrowserWindowClosedEvent then
Game:GetService("GuiService").BrowserWindowClosed:connect(function()
GuiService.BrowserWindowClosed:connect(function()
doPlayerFundsCheck(false)
end)
end

File diff suppressed because it is too large Load Diff

View File

@ -1044,7 +1044,7 @@ local function TweenProperty(obj, propName, inita, enda, length)
while tick() - startTime < length do
obj[propName] = ((enda - inita) * ((tick() - startTime) / length))
+ inita
wait(1 / 30)
wait()
end
obj[propName] = enda
end
@ -1410,7 +1410,7 @@ function StatAdded(nchild, playerEntry)
-- dont re - add a leaderstat I alreday have
while AddingStatLock do
debugprint "in stat added function lock"
wait(1 / 30)
wait()
end
AddingStatLock = true
if
@ -1486,7 +1486,7 @@ end
function StatRemoved(nchild, playerEntry)
while AddingStatLock do
debugprint "In Adding Stat Lock1"
wait(1 / 30)
wait()
end
AddingStatLock = true
if playerEntry.Frame:FindFirstChild(nchild.Name) then
@ -1604,7 +1604,7 @@ end
function RecreateScoreColumns(ptable)
while AddingStatLock do
debugprint "In Adding Stat Lock2"
wait(1 / 30)
wait()
end
AddingStatLock = true
local Xoffset = 5 --15 --current offset from Right
@ -2440,7 +2440,7 @@ function UpdateHeaderNameSize()
tHeader.FontSize = FONT_SIZES[fSize]
Delay(0.2, function()
while tHeader.TextBounds.x == 0 do
wait(1 / 30)
wait()
end
while tHeader.TextBounds.x - NormalBounds.X.Offset > 1 do
fSize -= 1
@ -2482,7 +2482,7 @@ end
function LeaderstatsRemoved(_, playerEntry)
while AddingFrameLock do
debugprint("waiting to insert " .. playerEntry.Player.Name)
wait(1 / 30)
wait()
end
AddingFrameLock = true
RemoveAllStats(playerEntry)
@ -2656,7 +2656,7 @@ end
@Args:
entry the player entry clicked
--]]
function OnPlayerEntrySelect(entry, startx, starty)
local function OnPlayerEntrySelect(entry, startx, starty)
if not InPopupWaitForClick then
SelectedPlayerEntry = entry
SelectedPlayer = entry.Player
@ -2678,7 +2678,7 @@ end
the basic update for the playerlist mode's state,
assures the order and length of the player frames
--]]
function PlayerListModeUpdate()
local function PlayerListModeUpdate()
RecreateScoreColumns(PlayerFrames)
table.sort(PlayerFrames, PlayerSortFunction)
for i, val in ipairs(PlayerFrames) do
@ -2689,6 +2689,7 @@ function PlayerListModeUpdate()
end
UpdateMinimize()
end
--[[
this one's a doozie, happens when a player is added to the game
inits their player frame and player entry, assigns them to a team if possible,
@ -2696,10 +2697,10 @@ end
@Args:
nplayer new player object to insert
--]]
function InsertPlayerFrame(nplayer)
local function InsertPlayerFrame(nplayer)
while AddingFrameLock do
debugprint("waiting to insert " .. nplayer.Name)
wait(1 / 30)
wait()
end
AddingFrameLock = true
@ -2799,7 +2800,7 @@ function InsertPlayerFrame(nplayer)
if nchild.Name == "leaderstats" then
while AddingFrameLock do
debugprint "in adding leaderstats lock"
wait(1 / 30)
wait()
end
AddingFrameLock = true
LeaderstatsAdded(nentry)
@ -2834,7 +2835,7 @@ end
function RemovePlayerFrame(tplayer)
while AddingFrameLock do
debugprint "in removing player frame lock"
wait(1 / 30)
wait()
end
AddingFrameLock = true
@ -2915,46 +2916,21 @@ function TeamSortFunc(a, b)
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
--]]
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
--]]
function TeamListModeUpdate()
RecreateScoreColumns(PlayerFrames)
SortTeams(TeamFrames)
if NeutralTeam then
AddTeamScores(NeutralTeam)
--RecreateScoreColumns(NeutralTeam['MyPlayers'])
end
UnrollTeams(TeamFrames, MiddleFrames)
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
--]]
function AddTeamScores(team)
local function AddTeamScores(team)
for j = 1, #ScoreNames, 1 do
local i = ScoreNames[j]
local tscore = 0
for _, j in ipairs(team.MyPlayers) do
local tval = j.Player:FindFirstChild "leaderstats"
and j.Player.leaderstats:FindFirstChild(i.Name)
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((j.Player.leaderstats)[i.Name])
tscore += GetScoreValue((k.Player.leaderstats)[i.Name])
end
end
if team.Frame:FindFirstChild(i.Name) then
@ -2970,12 +2946,40 @@ function AddTeamScores(team)
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
--]]
function FindRemovePlayerFromTeam(entry)
local function FindRemovePlayerFromTeam(entry)
if entry.MyTeam then
for j, oldEntry in ipairs(entry.MyTeam.MyPlayers) do
if oldEntry.Player == entry.Player then
@ -2992,6 +2996,7 @@ function FindRemovePlayerFromTeam(entry)
end
end
end
--[[
removes a single player from a given team (not usually called directly)
@Args:
@ -3005,6 +3010,7 @@ function RemovePlayerFromTeam(teamEntry, index)
RemoveNeutralTeam()
end
end
--[[
adds player entry entry to teamentry
removes them from any previous team
@ -3023,7 +3029,7 @@ function AddPlayerToTeam(teamEntry, entry)
teamEntry.IsHidden = false
end
function SetPlayerToTeam(entry)
local function SetPlayerToTeam(entry)
FindRemovePlayerFromTeam(entry)
-- check to see if team exists, if it does add to that team
local setToTeam = false
@ -3057,7 +3063,7 @@ end
function PlayerChanged(entry, property)
while PlayerChangedLock do
debugprint "in playerchanged lock"
wait(1 / 30)
wait()
end
PlayerChangedLock = true
if property == "Neutral" then
@ -3208,7 +3214,7 @@ end
--[[
--]]
function TeamScoreChanged(entry, nscore)
local function TeamScoreChanged(entry, nscore)
WaitForChild(entry.Frame, "PlayerScore").Text = tostring(nscore)
entry.TeamScore = nscore
end
@ -3216,7 +3222,7 @@ end
called when child added to a team, used for autohide functionality
Note: still has teamscore, consiter removing
--]]
function TeamChildAdded(entry, nchild)
local function TeamChildAdded(entry, nchild)
if nchild.Name == "AutoHide" then
entry.AutoHide = true
elseif nchild.Name == "TeamScore" then
@ -3231,7 +3237,7 @@ end
called when child added to a team, used for autohide functionality
Note: still has teamscore, consiter removing
--]]
function TeamChildRemoved(entry, nchild)
local function TeamChildRemoved(entry, nchild)
if nchild.Name == "AutoHide" then
entry.AutoHide = false
elseif nchild.Name == "TeamScore" then
@ -3240,7 +3246,7 @@ function TeamChildRemoved(entry, nchild)
end
end
function TeamChanged(entry, property)
local function TeamChanged(entry, property)
if property == "Name" then
WaitForChild(WaitForChild(entry.Frame, "TitleFrame"), "Title").Text =
entry.MyTeam.Name
@ -3270,10 +3276,10 @@ end
@Args:
nteam new team object added
--]]
function InsertTeamFrame(nteam)
local function InsertTeamFrame(nteam)
while AddingFrameLock do
debugprint "in adding team frame lock"
wait(1 / 30)
wait()
end
AddingFrameLock = true
--for _,i in pairs(TeamFrames) do
@ -3364,7 +3370,7 @@ end
function RemoveTeamFrame(nteam)
while AddingFrameLock do
debugprint "in removing team frame lock"
wait(1 / 30)
wait()
end
AddingFrameLock = true
-- if IsMinimized.Value then
@ -3407,7 +3413,7 @@ end
function BaseUpdate()
while BaseUpdateLock do
debugprint "in baseupdate lock"
wait(1 / 30)
wait()
end
BaseUpdateLock = true
--print ('baseupdate')
@ -3491,7 +3497,7 @@ game.GuiService.KeyPressed:connect(function(key)
end
end)
function PlayersChildAdded(tplayer)
local function PlayersChildAdded(tplayer)
if tplayer:IsA "Player" then
Spawn(function()
debugPlayerAdd(tplayer)
@ -3501,7 +3507,7 @@ function PlayersChildAdded(tplayer)
end
end
function coreGuiChanged(coreGuiType, enabled)
local function coreGuiChanged(coreGuiType, enabled)
if
coreGuiType == Enum.CoreGuiType.All
or coreGuiType == Enum.CoreGuiType.PlayerList
@ -3510,7 +3516,7 @@ function coreGuiChanged(coreGuiType, enabled)
end
end
function TeamsChildAdded(nteam)
local function TeamsChildAdded(nteam)
if nteam:IsA "Team" then
TeamAdded(nteam)
else
@ -3518,7 +3524,7 @@ function TeamsChildAdded(nteam)
end
end
function TeamsChildRemoved(nteam)
local function TeamsChildRemoved(nteam)
if nteam:IsA "Team" then
TeamRemoved(nteam)
else
@ -3542,7 +3548,7 @@ pcall(function()
end)
while not game:GetService "Teams" do
wait(1 / 30)
wait()
debugprint "Waiting For Teams"
end
for _, i in pairs(game.Teams:GetTeams()) do
@ -3571,19 +3577,19 @@ IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable"
----------------------------
--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 = str_players .. " " .. i.Name
end
debugplayers.Text = str_players
wait(0.5)
end
end)
end
-- 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

View File

@ -1,8 +1,6 @@
-- RbxUtility
print "[Mercury]: Loaded corescript 60595411"
local t = {}
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
@ -473,6 +471,8 @@ function Null()
end
-------------------- End JSON Parser ------------------------
local t = {}
t.DecodeJSON = function(jsonString)
pcall(function()
warn "RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead."
@ -614,7 +614,7 @@ t.SelectTerrainRegion = function(
end
-- iterates through all current adornments and deletes any that don't have latest tag
function cleanUpAdornments()
local function cleanUpAdornments()
for cellPos, adornTable in pairs(adornments) do
if adornTable.KeepAlive ~= currentKeepAliveTag then -- old news, we should get rid of this
adornTable.SelectionBox.Visible = false
@ -628,7 +628,7 @@ t.SelectTerrainRegion = function(
end
-- helper function to update tag
function incrementAliveCounter()
local function incrementAliveCounter()
aliveCounter += 1
if aliveCounter > 1000000 then
aliveCounter = 0
@ -637,7 +637,7 @@ t.SelectTerrainRegion = function(
end
-- finds full cells in region and adorns each cell with a box, with the argument color
function adornFullCellsInRegion(region, color)
local function adornFullCellsInRegion(region, color)
local regionBegin = region.CFrame.p
- (region.Size / 2)
+ Vector3.new(2, 2, 2)
@ -1037,26 +1037,6 @@ end
-------------------------------------------------Create function End----------------------------------------------------
-- Lmao time - Heliodex
function t.HttpGet(url: string)
return game:HttpGet(url)
end
function t.HttpGetAsync(url: string)
return game:HttpGetAsync(url)
end
function t.HttpPost(url: string)
return game:HttpPost(url)
end
function t.HttpPostAsync(url: string)
return game:HttpPostAsync(url)
end
-- Lmao time end
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------

View File

@ -57,11 +57,10 @@ function GetTerrainForMouse(mouse)
local cell = game.Workspace.Terrain:WorldToCellPreferSolid(
Vector3.new(mouse.hit.x, mouse.hit.y, mouse.hit.z)
)
local planeLoc
-- If nothing was hit, do the plane intersection.
if 0 == game.Workspace.Terrain:GetCell(cell.X, cell.Y, cell.Z).Value then
cell = nil
planeLoc, hit = PlaneIntersection(
local planeLoc, hit = PlaneIntersection(
Vector3.new(mouse.hit.x, mouse.hit.y, mouse.hit.z)
)
if hit then
@ -110,8 +109,10 @@ local function collectParts(object, baseParts, scripts, decals)
end
end
local cluster
local function clusterPartsInRegion(startVector, endVector)
local cluster = game.Workspace:FindFirstChild "Terrain"
cluster = game.Workspace:FindFirstChild "Terrain"
local startCell = cluster:WorldToCell(startVector)
local endCell = cluster:WorldToCell(endVector)
@ -1009,6 +1010,8 @@ t.SetupStamperDragger = function(
return nil
end
local configFound, targetCFrame, targetSurface
local stampInModel
local allowedStampRegion
local stampFailedFunc
@ -1486,9 +1489,9 @@ t.SetupStamperDragger = function(
end
end)
then
error "Error: RbxStamper.DoStamperMouseMove Mouse is nil on second check"
game.JointsService:ClearJoinAfterMoveJoints()
Mouse = nil
error "Error: RbxStamper.DoStamperMouseMove Mouse is nil on second check"
return
end
@ -1842,7 +1845,7 @@ t.SetupStamperDragger = function(
end
-- After rotating, update the position
local configFound, targetCFrame =
configFound, targetCFrame =
findConfigAtMouseTarget(Mouse, stampData)
if configFound then
stampData.CurrentParts =
@ -1973,7 +1976,7 @@ t.SetupStamperDragger = function(
local function ResolveMegaClusterStamp(checkHighScalabilityStamp)
local cellSet = false
local cluster = game.Workspace.Terrain
cluster = game.Workspace.Terrain
local line = HighScalabilityLine.InternalLine
local cMax = game.Workspace.Terrain.MaxExtents.Max
@ -2418,7 +2421,7 @@ t.SetupStamperDragger = function(
HighScalabilityLine.Start = nil
HighScalabilityLine.Adorn.Parent = nil
local cluster = game.Workspace.Terrain
cluster = game.Workspace.Terrain
-- if target point is in cluster, just use cluster:SetCell
if isMegaClusterPart() then
@ -2563,9 +2566,11 @@ t.SetupStamperDragger = function(
end
-- if it's a model, we also want to fill in the playerID and playerName tags, if it has those (e.g. for the friend-only door)
playerIdTag = stampData.CurrentParts:FindFirstChild "PlayerIdTag"
playerNameTag =
local playerIdTag = stampData.CurrentParts:FindFirstChild "PlayerIdTag"
local playerNameTag =
stampData.CurrentParts:FindFirstChild "PlayerNameTag"
local tempPlayerValue
if playerIdTag ~= nil then
tempPlayerValue = getPlayer()
if tempPlayerValue ~= nil then
@ -2763,7 +2768,7 @@ t.SetupStamperDragger = function(
end
local function resumeStamper()
clone, parts = prepareModel(modelToStamp)
local clone, parts = prepareModel(modelToStamp)
if not clone or not parts then
return
@ -2799,7 +2804,7 @@ t.SetupStamperDragger = function(
end
if clone:FindFirstChild("ClusterMaterial", true) then -- extract all info from vector
clusterMaterial = clone:FindFirstChild("ClusterMaterial", true)
local clusterMaterial = clone:FindFirstChild("ClusterMaterial", true)
if clusterMaterial:IsA "Vector3Value" then
cellInfo.Material = clusterMaterial.Value.X
cellInfo.clusterType = clusterMaterial.Value.Y