add gs
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
local assetId, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
local InsertService = game:GetService("InsertService")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
local asset = nil
|
||||
local success,errormsg = pcall(function()
|
||||
asset = game:GetObjects(baseUrl.."/asset/?id="..tostring(assetId))[1]
|
||||
asset.Parent = game.Workspace
|
||||
end)
|
||||
if not success then
|
||||
warn(errormsg)
|
||||
local ErrorScreenGui = Instance.new("ScreenGui", game.StarterGui)
|
||||
ErrorScreenGui.Name = "ErrorScreenGui"
|
||||
local ErrorTextLabel = Instance.new("TextLabel", ErrorScreenGui)
|
||||
ErrorTextLabel.Text = "Error occured during asset render: "..errormsg
|
||||
ErrorTextLabel.BackgroundTransparency = 1
|
||||
ErrorTextLabel.TextColor3 = Color3.new(1, 1, 1)
|
||||
ErrorTextLabel.TextStrokeTransparency = 0
|
||||
ErrorTextLabel.Font = Enum.Font.SourceSansBold
|
||||
ErrorTextLabel.TextSize = 40
|
||||
ErrorTextLabel.Size = UDim2.new(1, 0, 1, 0)
|
||||
ErrorTextLabel.Position = UDim2.new(0, 10, 0, 10)
|
||||
ErrorTextLabel.TextXAlignment = Enum.TextXAlignment.Left
|
||||
ErrorTextLabel.TextYAlignment = Enum.TextYAlignment.Top
|
||||
ErrorTextLabel.TextWrapped = true
|
||||
|
||||
local renderSuccess, message = pcall(function()
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
end)
|
||||
|
||||
if not renderSuccess then
|
||||
game:HttpPost(UploadURL, "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAQAAABecRxxAAAEnklEQVR42u3UMQEAAAjDMOZf9JCAABIJPZp2gKdiAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYABiAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAAIoABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYABiAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAABgAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAYABiAAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAGAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABwW1Dy|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- Check for thumbnailcamera
|
||||
local UsingThumbnailCamera = false
|
||||
for _, child in pairs(asset:GetDescendants()) do
|
||||
if child.Name == "ThumbnailCamera" then
|
||||
UsingThumbnailCamera = true
|
||||
workspace.CurrentCamera = child
|
||||
end
|
||||
if child.Name == "ThumbnailConfiguration" and child:IsA("Configuration") then
|
||||
if child:FindFirstChild("ThumbnailCameraTarget") and child:FindFirstChild("ThumbnailCameraValue") then
|
||||
local NewThumbnailCamera = Instance.new("Camera", workspace)
|
||||
NewThumbnailCamera.Name = "ThumbnailCamera"
|
||||
NewThumbnailCamera.CameraType = Enum.CameraType.Fixed
|
||||
pcall(function()
|
||||
NewThumbnailCamera.CFrame = child:FindFirstChild("ThumbnailCameraValue").Value
|
||||
NewThumbnailCamera.Focus = child:FindFirstChild("ThumbnailCameraTarget").Value.CFrame
|
||||
|
||||
UsingThumbnailCamera = true
|
||||
workspace.CurrentCamera = NewThumbnailCamera
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
wait(0.05)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true, true)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
@@ -0,0 +1,30 @@
|
||||
local assetId, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local player = game:GetService("Players"):CreateLocalPlayer(0)
|
||||
player.CharacterAppearance = baseUrl.."/Asset/SpecialCharacterFetch?assetId="..tostring(assetId)
|
||||
player:LoadCharacter(false)
|
||||
|
||||
wait(0.05)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
|
||||
if #player.Backpack:GetChildren() > 0 then
|
||||
for _, tool in pairs(player.Backpack:GetChildren()) do
|
||||
tool.Parent = player.Character
|
||||
player.Character.Torso["Right Shoulder"].CurrentAngle = math.rad(90)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
@@ -0,0 +1,213 @@
|
||||
local PlaceId, Port, BaseURL, AuthToken, CreatorId, CreatorType, DownloadAuthorizationToken, UniverseId = ...
|
||||
|
||||
local RunService = game:GetService("RunService")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
local Players = game:GetService("Players")
|
||||
local HttpService = game:GetService("HttpService")
|
||||
local ScriptContext = game:GetService('ScriptContext')
|
||||
local RobloxReplicatedStorage = game:GetService('RobloxReplicatedStorage')
|
||||
HttpService.HttpEnabled = false -- Disable HttpService for security reasons
|
||||
|
||||
if CreatorType == 1 then
|
||||
CreatorType = Enum.CreatorType.User
|
||||
elseif CreatorType == 2 then
|
||||
CreatorType = Enum.CreatorType.Group
|
||||
else
|
||||
CreatorType = Enum.CreatorType.User
|
||||
end
|
||||
pcall(function() game:SetCreatorID(CreatorId, CreatorType) end)
|
||||
|
||||
pcall(function() settings().Network.UseInstancePacketCache = true end)
|
||||
pcall(function() settings().Network.UsePhysicsPacketCache = true end)
|
||||
--pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.FIFO end)
|
||||
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end)
|
||||
|
||||
--settings().Network.PhysicsSend = 1 -- 1==RoundRobin
|
||||
--settings().Network.PhysicsSend = Enum.PhysicsSendMethod.ErrorComputation2
|
||||
settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors
|
||||
settings().Network.ExperimentalPhysicsEnabled = true
|
||||
settings().Network.WaitingForCharacterLogRate = 100
|
||||
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
||||
|
||||
pcall(function() ScriptContext:AddStarterScript(37801172) end)
|
||||
ScriptContext.ScriptsDisabled = true
|
||||
|
||||
game:SetPlaceID(PlaceId, false)
|
||||
pcall(function() game:SetUniverseId(UniverseId) end)
|
||||
game:GetService("ChangeHistoryService"):SetEnabled(false)
|
||||
local NetworkServer = game:GetService("NetworkServer")
|
||||
|
||||
if BaseURL~=nil then
|
||||
pcall(function() game:GetService("Players"):SetAbuseReportUrl(BaseURL .. "/AbuseReport/InGameChatHandler.ashx") end)
|
||||
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(BaseURL .. "/Asset/") end)
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(BaseURL .. "/") end)
|
||||
pcall(function() game:GetService("Players"):SetChatFilterUrl(BaseURL .. "/Game/ChatFilter.ashx") end)
|
||||
|
||||
game:GetService("BadgeService"):SetPlaceId(PlaceId)
|
||||
game:GetService("BadgeService"):SetIsBadgeLegalUrl("")
|
||||
game:GetService("BadgeService"):SetAwardBadgeUrl(BaseURL .. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d")
|
||||
game:GetService("BadgeService"):SetHasBadgeUrl(BaseURL .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d")
|
||||
game:GetService("BadgeService"):SetIsBadgeDisabledUrl(BaseURL .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d")
|
||||
|
||||
game:GetService("InsertService"):SetBaseSetsUrl(BaseURL .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base")
|
||||
game:GetService("InsertService"):SetUserSetsUrl(BaseURL .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d")
|
||||
game:GetService("InsertService"):SetCollectionUrl(BaseURL .. "/Game/Tools/InsertAsset.ashx?sid=%d")
|
||||
game:GetService("InsertService"):SetAssetUrl(BaseURL .. "/Asset/?id=%d")
|
||||
game:GetService("InsertService"):SetAssetVersionUrl(BaseURL .. "/Asset/?assetversionid=%d")
|
||||
|
||||
game:GetService("Players"):SetSaveDataUrl(BaseURL .. "/persistence/legacy/save?userId=%d")
|
||||
game:GetService("Players"):SetLoadDataUrl(BaseURL .. "/persistence/legacy/load?userId=%d")
|
||||
|
||||
game:GetService("FriendService"):SetMakeFriendUrl(BaseURL .. "/Friend/CreateFriend?firstUserId=%d&secondUserId=%d")
|
||||
game:GetService("FriendService"):SetBreakFriendUrl(BaseURL .. "/Friend/BreakFriend?firstUserId=%d&secondUserId=%d")
|
||||
game:GetService("FriendService"):SetGetFriendsUrl(BaseURL .. "/Friend/AreFriends?userId=%d")
|
||||
game:GetService("FriendService"):SetCreateFriendRequestUrl(BaseURL .. "/Friend/CreateFriendRequest?requesterUserId=%d&requestedUserId=%d")
|
||||
game:GetService("FriendService"):SetDeleteFriendRequestUrl(BaseURL .. "/Friend/DeleteFriendRequest?requesterUserId=%d&requestedUserId=%d")
|
||||
|
||||
--pcall(function() loadfile(BaseURL .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. PlaceId)() end) idk what this is suppose to return
|
||||
end
|
||||
|
||||
pcall(function()
|
||||
game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(false)
|
||||
end)
|
||||
settings().Diagnostics.LuaRamLimit = 0
|
||||
|
||||
local StartTime = tick()
|
||||
local StoppingServer = false
|
||||
local function ReportServerPlayers(IgnoreThisPlayer)
|
||||
--if StoppingServer then return end
|
||||
local success, message = pcall(function()
|
||||
local PlayerList = {}
|
||||
for _, player in pairs(Players:GetChildren()) do
|
||||
if player:IsA("Player") and player ~= IgnoreThisPlayer then
|
||||
table.insert(PlayerList, {
|
||||
["UserId"] = player.UserId,
|
||||
["Name"] = player.Name
|
||||
})
|
||||
end
|
||||
end
|
||||
local MessagePayload = HttpService:JSONEncode({
|
||||
["AuthToken"] = AuthToken,
|
||||
["JobId"] = game.JobId,
|
||||
["Players"] = PlayerList
|
||||
})
|
||||
local ResponseData = game:HttpPost(BaseURL.."/internal/gameserver/reportplayers", MessagePayload, true, "application/json")
|
||||
local ResponseJSON = HttpService:JSONDecode(ResponseData)
|
||||
for _, player in pairs(ResponseJSON["bad"]) do -- This is a list of players that need to be kicked from the server
|
||||
local TargetPlayer = Players:GetPlayerByUserId(player)
|
||||
if TargetPlayer ~= nil then
|
||||
TargetPlayer:Kick("There was an issue authenticating you, please contact support.")
|
||||
TargetPlayer:Destroy()
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
local function ReportServerStats()
|
||||
if StoppingServer then return end
|
||||
local success, message = pcall(function()
|
||||
local MessagePayload = HttpService:JSONEncode({
|
||||
["AuthToken"] = AuthToken,
|
||||
["JobId"] = game.JobId,
|
||||
["PlaceId"] = PlaceId,
|
||||
["ServerAliveTime"] = (tick() - StartTime) + 1
|
||||
})
|
||||
game:HttpPost(BaseURL.."/internal/gameserver/reportstats", MessagePayload, false, "application/json")
|
||||
end)
|
||||
end
|
||||
|
||||
local function ReportServerShutdown()
|
||||
local success, message = pcall(function()
|
||||
local MessagePayload = HttpService:JSONEncode({
|
||||
["AuthToken"] = AuthToken,
|
||||
["JobId"] = game.JobId,
|
||||
["PlaceId"] = PlaceId,
|
||||
["ServerAliveTime"] = tick() - StartTime
|
||||
})
|
||||
game:HttpPost(BaseURL.."/internal/gameserver/reportshutdown", MessagePayload, false, "application/json")
|
||||
end)
|
||||
end
|
||||
|
||||
local function ShutdownServer()
|
||||
StoppingServer = true
|
||||
ReportServerShutdown()
|
||||
ScriptContext.ScriptsDisabled = true
|
||||
--[[game:HttpPost("http://127.0.0.1:3000/CloseJob?RCCReturnAuth="..AuthToken, HttpService:JSONEncode({
|
||||
["jobid"] = game.JobId
|
||||
}), false, "application/json")]]
|
||||
end
|
||||
|
||||
if PlaceId ~= nil and BaseURL ~= nil then
|
||||
wait()
|
||||
local success, message = pcall(function()
|
||||
game:Load(BaseURL.."/asset/?id="..tostring(PlaceId).."&access="..DownloadAuthorizationToken)
|
||||
end)
|
||||
if not success then
|
||||
-- Report error
|
||||
local MessagePayload = HttpService:JSONEncode({
|
||||
["AuthToken"] = AuthToken,
|
||||
["JobId"] = game.JobId,
|
||||
["PlaceId"] = PlaceId,
|
||||
["Error"] = message
|
||||
})
|
||||
game:HttpPost(BaseURL.."/internal/gameserver/reportfailure", MessagePayload, false, "application/json")
|
||||
-- Lets start the server but with an empty place and a error message
|
||||
local NewMessage = Instance.new("Message", workspace)
|
||||
NewMessage.Text = "There was an error loading this place file, Error Message: "..message..", PlaceId: "..tostring(PlaceId)..", JobId: "..tostring(game.JobId)
|
||||
end
|
||||
end
|
||||
|
||||
NetworkServer:Start(Port)
|
||||
ScriptContext:SetTimeout(10)
|
||||
ScriptContext.ScriptsDisabled = false
|
||||
|
||||
local TotalPlayersJoined = 0
|
||||
|
||||
Players.PlayerAdded:connect(function(player)
|
||||
ReportServerPlayers()
|
||||
TotalPlayersJoined = TotalPlayersJoined + 1
|
||||
player.DataComplexityLimit = 1024 * 1024 * 1
|
||||
player:LoadData()
|
||||
|
||||
coroutine.wrap(function()
|
||||
while true do
|
||||
wait(120)
|
||||
if StoppingServer then break end
|
||||
if player.Parent == nil then break end
|
||||
player:SaveData()
|
||||
end
|
||||
end)()
|
||||
end)
|
||||
Players.PlayerRemoving:connect(function(player)
|
||||
ReportServerPlayers(player)
|
||||
player:SaveData()
|
||||
local PlayerCount = #Players:GetPlayers()
|
||||
if PlayerCount == 0 then
|
||||
wait(10) -- Wait 10 seconds to see if anyone rejoins
|
||||
PlayerCount = #Players:GetPlayers()
|
||||
if PlayerCount == 0 then
|
||||
ShutdownServer()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
game:GetService("RunService"):Run()
|
||||
ReportServerStats()
|
||||
|
||||
coroutine.wrap(function()
|
||||
while true do
|
||||
wait(20)
|
||||
if StoppingServer then break end
|
||||
ReportServerStats()
|
||||
ReportServerPlayers()
|
||||
end
|
||||
end)()
|
||||
|
||||
coroutine.wrap(function()
|
||||
wait(120) -- Wait 2 minutes to check if anyone has joined
|
||||
if TotalPlayersJoined == 0 then
|
||||
warn("Stopping server, no players joined past 2 minutes.")
|
||||
ShutdownServer()
|
||||
end
|
||||
end)()
|
||||
@@ -0,0 +1,30 @@
|
||||
local assetId, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local player = game:GetService("Players"):CreateLocalPlayer(0)
|
||||
player.CharacterAppearance = baseUrl.."/Asset/SpecialCharacterFetch?assetId="..tostring(assetId)
|
||||
player:LoadCharacter(false)
|
||||
local FakeCharacter = player.Character
|
||||
pcall(function()
|
||||
FakeCharacter.Torso:Destroy()
|
||||
FakeCharacter["Left Arm"]:Destroy()
|
||||
FakeCharacter["Right Arm"]:Destroy()
|
||||
FakeCharacter["Left Leg"]:Destroy()
|
||||
FakeCharacter["Right Leg"]:Destroy()
|
||||
end)
|
||||
|
||||
wait(0.05)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true, true)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
@@ -0,0 +1,36 @@
|
||||
local imageId, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local IsSuccess, actualImageId = pcall(function()
|
||||
local Asset = game:GetObjects(baseUrl.."/asset/?id="..tostring(imageId))[1]
|
||||
if Asset:IsA("Decal") then
|
||||
return Asset.Texture
|
||||
end
|
||||
for _, child in pairs(Asset:GetDescendants()) do
|
||||
if child:IsA("Decal") then
|
||||
return child.Texture
|
||||
end
|
||||
end
|
||||
end)
|
||||
local AssetURL
|
||||
if not IsSuccess then
|
||||
actualImageId = imageId
|
||||
AssetURL = baseUrl.."/asset/?id="..tostring(imageId)
|
||||
else
|
||||
AssetURL = actualImageId
|
||||
end
|
||||
|
||||
local success, result = pcall(function()
|
||||
return ThumbnailGenerator:ClickTexture(AssetURL, fileExtension, x, y)
|
||||
end)
|
||||
if not success then
|
||||
result = "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAQAAABecRxxAAAEnklEQVR42u3UMQEAAAjDMOZf9JCAABIJPZp2gKdiAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYABiAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAAIoABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYABiAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAGAABgAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAYABiAAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAEABgAYAGAAgAGAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAQAGABgAYACAAYABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABgAIABAAYAGABwW1Dy/i5f+lAuAAAAAElFTkSuQmCC" -- 1x1 transparent pixel
|
||||
end
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
local meshId, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local MeshPartHolder = Instance.new("Part")
|
||||
MeshPartHolder.Transparency = 0
|
||||
MeshPartHolder.Anchored = true
|
||||
|
||||
local MeshPart = Instance.new("FileMesh", MeshPartHolder)
|
||||
MeshPart.MeshId = baseUrl.."/asset/?id="..tostring(meshId)
|
||||
|
||||
local charModel = Instance.new("Model", game.Workspace);
|
||||
MeshPartHolder.Parent = charModel;
|
||||
wait(0.05)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true, true)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
@@ -0,0 +1,43 @@
|
||||
local PlaceId, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime, placeDownloadToken = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
local HttpService = game:GetService("HttpService")
|
||||
HttpService.HttpEnabled = true
|
||||
|
||||
local LoadSuccess, ErrorMessage = pcall(function()
|
||||
game:Load(baseUrl .. "/asset/?id=" .. tostring(PlaceId) .. "&access=" .. placeDownloadToken)
|
||||
end)
|
||||
if not LoadSuccess then
|
||||
warn("Failed to load place: " .. tostring(PlaceId) .. " (" .. tostring(ErrorMessage) .. ")")
|
||||
HttpService.HttpEnabled = true
|
||||
HttpService:PostAsync(
|
||||
baseUrl.."/internal/gameserver/reportfailure",
|
||||
HttpService:JSONEncode({
|
||||
["placeId"] = PlaceId,
|
||||
["reason"] = "LoadFailed",
|
||||
["message"] = ErrorMessage,
|
||||
["reqid"] = reqid,
|
||||
["reqstarttime"] = reqstarttime,
|
||||
})
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
for _, obj in pairs(game.StarterGui:GetChildren()) do
|
||||
obj:Destroy()
|
||||
end
|
||||
|
||||
wait(0.05)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] false)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
@@ -0,0 +1,15 @@
|
||||
local PlaceId, baseUrl, authToken = ...
|
||||
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local LoadSuccess, ErrorMessage = pcall(function()
|
||||
game:Load(baseUrl .. "/asset/?id=" .. tostring(PlaceId) .. "&access=" .. authToken)
|
||||
end)
|
||||
if not LoadSuccess then
|
||||
return ErrorMessage
|
||||
end
|
||||
return true
|
||||
@@ -0,0 +1,58 @@
|
||||
local characterAppearanceUrl, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local player = game:GetService("Players"):CreateLocalPlayer(0)
|
||||
player.CharacterAppearance = characterAppearanceUrl
|
||||
player:LoadCharacter(false)
|
||||
wait(0.2)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
|
||||
local quadratic = true
|
||||
local baseHatZoom = 30
|
||||
local maxHatZoom = 100
|
||||
local cameraOffsetX = 0
|
||||
local cameraOffsetY = 0
|
||||
local maxDimension = 0
|
||||
local maxHatOffset = 0.5 -- Maximum amount to move camera upward to accomodate large hats
|
||||
-- Remove gear
|
||||
for _, child in pairs(player.Character:GetChildren()) do
|
||||
if child:IsA("Tool") then
|
||||
child:Destroy()
|
||||
elseif child:IsA("Accoutrement") then
|
||||
local size = child.Handle.Size / 2 + child.Handle.Position - player.Character.Head.Position
|
||||
local xy = Vector2.new(size.x, size.y)
|
||||
if xy.magnitude > maxDimension then
|
||||
maxDimension = xy.magnitude
|
||||
end
|
||||
end
|
||||
end
|
||||
maxDimension = math.min(1, maxDimension / 3) -- Confine maxdimension to specific bounds
|
||||
|
||||
if quadratic then
|
||||
maxDimension = maxDimension * maxDimension -- Zoom out on quadratic interpolation
|
||||
end
|
||||
|
||||
local viewOffset = player.Character.Head.CFrame * CFrame.new(cameraOffsetX, cameraOffsetY + maxHatOffset * maxDimension, 0.1) -- View vector offset from head
|
||||
local yAngle = -math.pi / 16
|
||||
local positionOffset = player.Character.Head.CFrame + (CFrame.Angles(0, yAngle, 0).lookVector.unit * 3) -- Position vector offset from head
|
||||
|
||||
local camera = Instance.new("Camera", player.Character)
|
||||
camera.Name = "ThumbnailCamera"
|
||||
camera.CameraType = Enum.CameraType.Scriptable
|
||||
camera.CoordinateFrame = CFrame.new(positionOffset.p, viewOffset.p)
|
||||
camera.FieldOfView = baseHatZoom + (maxHatZoom - baseHatZoom) * maxDimension
|
||||
workspace.CurrentCamera = camera
|
||||
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
@@ -0,0 +1,38 @@
|
||||
local characterAppearanceUrl, baseUrl, fileExtension, x, y, UploadURL, reqid, reqstarttime = ...
|
||||
|
||||
local ThumbnailGenerator = game:GetService("ThumbnailGenerator")
|
||||
local ContentProvider = game:GetService("ContentProvider")
|
||||
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false);
|
||||
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local player = game:GetService("Players"):CreateLocalPlayer(0)
|
||||
player.CharacterAppearance = characterAppearanceUrl
|
||||
player:LoadCharacter(false)
|
||||
wait(0.2)
|
||||
local StartTime = tick()
|
||||
repeat wait(0.02) until ContentProvider.RequestQueueSize == 0 or tick() - StartTime > 3
|
||||
if tick() - StartTime > 3 then
|
||||
print("Timeout reached to wait for content to load")
|
||||
end
|
||||
local UsingTools = false
|
||||
if #player.Backpack:GetChildren() > 0 then
|
||||
for _, tool in pairs(player.Backpack:GetChildren()) do
|
||||
tool.Parent = player.Character
|
||||
UsingTools = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Raise up the character's arm if they have gear.
|
||||
if player.Character then
|
||||
for _, child in pairs(player.Character:GetChildren()) do
|
||||
if child:IsA("Tool") then
|
||||
player.Character.Torso["Right Shoulder"].CurrentAngle = math.rad(90)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local result = ThumbnailGenerator:Click(fileExtension, x, y, --[[hideSky = ]] true) --, not UsingTools)
|
||||
game:HttpPost(UploadURL, result.."|"..reqid.."|"..tostring(reqstarttime), false, "text/plain")
|
||||
Reference in New Issue
Block a user