From 830efeafd25e0f6425fe8029ecf83c191c9639e1 Mon Sep 17 00:00:00 2001 From: Thomas G <62822072+Thomasluigi07@users.noreply.github.com> Date: Mon, 11 Jul 2022 04:05:08 +1000 Subject: [PATCH] Update gameserver.php --- public/game/gameserver.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/public/game/gameserver.php b/public/game/gameserver.php index 64b361c..082e12d 100644 --- a/public/game/gameserver.php +++ b/public/game/gameserver.php @@ -166,6 +166,42 @@ end) -- Now start the connection game:Load("rbxasset://") +-- fix asset ids +local assetPropertyNames = {"Texture", "TextureId", "SoundId", "MeshId", "SkyboxUp", "SkyboxLf", "SkyboxBk", "SkyboxRt", "SkyboxFt", "SkyboxDn", "PantsTemplate", "ShirtTemplate", "Graphic", "Frame", "ImageLabel", "GuiMain", "Image", "LinkedSource", "AnimationId"} +local variations = {"http://www%.roblox%.com/asset/%?id=", "http://www%.roblox%.com/asset%?id=", "http://%.roblox%.com/asset/%?id=", "http://%.roblox%.com/asset%?id="} + +function GetDescendants(o) + local allObjects = {} + function FindChildren(Object) + for _,v in pairs(Object:GetChildren()) do + table.insert(allObjects,v) + FindChildren(v) + end + end + FindChildren(o) + return allObjects +end + +local replacedProperties = 0--Amount of properties changed + +for i, v in pairs(GetDescendants(game)) do + for _, property in pairs(assetPropertyNames) do + pcall(function() + if v[property] and not v:FindFirstChild(property) then --Check for property, make sure we're not getting a child instead of a property + assetText = string.lower(v[property]) + for _, variation in pairs(variations) do + v[property], matches = string.gsub(assetText, variation, "http://www%.morblox%.us/asset/%?id=") + if matches > 0 then + replacedProperties = replacedProperties + 1 + print("Replaced " .. property .. " asset link for " .. v.Name) + break + end + end + end + end) + end +end +-- other stuff ns:Start(, sleeptime) pcall(function() game.LocalSaveEnabled = true end)