Merge branch 'dev' into surreal (again)
This commit is contained in:
parent
b780974895
commit
42a2472be2
12
20573078.xml
12
20573078.xml
|
|
@ -1,4 +1,6 @@
|
|||
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||
<External>null</External>
|
||||
<External>nil</External>
|
||||
<Item class="Hat" referent="RBXFEFA1B06A7444E13896169510508F42A">
|
||||
|
|
@ -94,7 +96,9 @@
|
|||
<Properties>
|
||||
<token name="LODX">2</token>
|
||||
<token name="LODY">2</token>
|
||||
<Content name="MeshId"><url>http://banland.xyz/asset?id=19999424</url></Content>
|
||||
<Content name="MeshId">
|
||||
<url>http://banland.xyz/asset?id=19999424</url>
|
||||
</Content>
|
||||
<token name="MeshType">5</token>
|
||||
<string name="Name">Mesh</string>
|
||||
<Vector3 name="Offset">
|
||||
|
|
@ -107,7 +111,9 @@
|
|||
<Y>1.07000005</Y>
|
||||
<Z>1.07000005</Z>
|
||||
</Vector3>
|
||||
<Content name="TextureId"><url>http://banland.xyz/asset?id=20571982</url></Content>
|
||||
<Content name="TextureId">
|
||||
<url>http://banland.xyz/asset?id=20571982</url>
|
||||
</Content>
|
||||
<Vector3 name="VertexColor">
|
||||
<X>1</X>
|
||||
<Y>1</Y>
|
||||
|
|
|
|||
10
38037265.xml
10
38037265.xml
|
|
@ -199,7 +199,7 @@ humanoid.Died:connect(function() HealthChanged(0) end)</ProtectedString>
|
|||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<Content name="Image"><url>http://www.roblox.com/asset/?id=34854607</url></Content>
|
||||
<Content name="Image"><url>http://banland.xyz/asset/?id=34854607</url></Content>
|
||||
<string name="Name">hurtOverlay</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>2</XS>
|
||||
|
|
@ -254,7 +254,7 @@ humanoid.Died:connect(function() HealthChanged(0) end)</ProtectedString>
|
|||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<Content name="Image"><url>http://www.roblox.com/asset/?id=35238000</url></Content>
|
||||
<Content name="Image"><url>http://banland.xyz/asset/?id=35238000</url></Content>
|
||||
<string name="Name">bkg</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0</XS>
|
||||
|
|
@ -282,7 +282,7 @@ humanoid.Died:connect(function() HealthChanged(0) end)</ProtectedString>
|
|||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<Content name="Image"><url>http://www.roblox.com/asset/?id=35238036</url></Content>
|
||||
<Content name="Image"><url>http://banland.xyz/asset/?id=35238036</url></Content>
|
||||
<string name="Name">barRed</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.0189999994</XS>
|
||||
|
|
@ -338,7 +338,7 @@ humanoid.Died:connect(function() HealthChanged(0) end)</ProtectedString>
|
|||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<Content name="Image"><url>http://www.roblox.com/asset/?id=35238053</url></Content>
|
||||
<Content name="Image"><url>http://banland.xyz/asset/?id=35238053</url></Content>
|
||||
<string name="Name">bar</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.0189999994</XS>
|
||||
|
|
@ -366,7 +366,7 @@ humanoid.Died:connect(function() HealthChanged(0) end)</ProtectedString>
|
|||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">0</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<Content name="Image"><url>http://www.roblox.com/asset/?id=34816363</url></Content>
|
||||
<Content name="Image"><url>http://banland.xyz/asset/?id=34816363</url></Content>
|
||||
<string name="Name">label</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.680000007</XS>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# Corescripts
|
||||
|
||||
After installing Aftman and running `aftman install`, run `./compile.sh` to compile the corescripts from ./yue/\*.yue to ./processed/\*.lua.
|
||||
After installing Aftman and running `aftman install`, run `./compile.sh` to compile the corescripts from ./luau/\*.luau to ./processed/\*.lua.
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
[tools]
|
||||
darklua = "seaofvoices/darklua@0.9.0"
|
||||
yue = "pigpigyyy/Yuescript@0.17.8"
|
||||
12
compile.sh
12
compile.sh
|
|
@ -1,13 +1,9 @@
|
|||
yue ./yue
|
||||
|
||||
echo "Processing corescripts..."
|
||||
for file in yue/[0-9]*.lua; do
|
||||
darklua process -c dense.json5 $file processed/$(basename "$file")
|
||||
for file in luau/[0-9]*.luau; do
|
||||
darklua process -c dense.json5 $file processed/$(basename "${file::-1}")
|
||||
done
|
||||
|
||||
echo "Processing other corescripts..."
|
||||
for file in yue/[a-z]*.lua; do
|
||||
darklua process -c lines.json5 $file processed/$(basename "$file")
|
||||
for file in luau/[a-z]*.luau; do
|
||||
darklua process -c lines.json5 $file processed/$(basename "${file::-1}")
|
||||
done
|
||||
|
||||
rm -f ./yue/*.lua
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
19
dense.json5
19
dense.json5
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
generator: "dense",
|
||||
rules: [
|
||||
"remove_comments",
|
||||
"remove_spaces",
|
||||
"group_local_assignment",
|
||||
// "compute_expression",
|
||||
"remove_unused_if_branch",
|
||||
"remove_unused_while",
|
||||
"remove_empty_do",
|
||||
// "remove_method_definition",
|
||||
"remove_function_call_parens",
|
||||
"filter_after_early_return",
|
||||
{
|
||||
rule: "rename_variables",
|
||||
globals: ["$default", "$roblox"],
|
||||
},
|
||||
],
|
||||
}
|
||||
13
lines.json5
13
lines.json5
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
rules: [
|
||||
"remove_spaces",
|
||||
"group_local_assignment",
|
||||
// "compute_expression",
|
||||
"remove_unused_if_branch",
|
||||
"remove_unused_while",
|
||||
"remove_empty_do",
|
||||
// "remove_method_definition",
|
||||
"remove_function_call_parens",
|
||||
"filter_after_early_return",
|
||||
],
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,314 @@
|
|||
-- 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
|
||||
|
|
@ -0,0 +1,773 @@
|
|||
-- 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
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,118 @@
|
|||
-- CoreGui.RobloxGui.CoreScripts/ToolTip
|
||||
print "[Mercury]: Loaded corescript 36868950"
|
||||
|
||||
local controlFrame = script.Parent:FindFirstChild "ControlFrame"
|
||||
|
||||
if not controlFrame then
|
||||
return
|
||||
end
|
||||
|
||||
local bottomLeftControl = controlFrame:FindFirstChild "BottomLeftControl"
|
||||
local bottomRightControl = controlFrame:FindFirstChild "BottomRightControl"
|
||||
|
||||
local frameTip = Instance.new "TextLabel"
|
||||
frameTip.Name = "ToolTip"
|
||||
frameTip.Text = ""
|
||||
frameTip.Font = Enum.Font.ArialBold
|
||||
frameTip.FontSize = Enum.FontSize.Size12
|
||||
frameTip.TextColor3 = Color3.new(1, 1, 1)
|
||||
frameTip.BorderSizePixel = 0
|
||||
frameTip.ZIndex = 10
|
||||
frameTip.Size = UDim2.new(2, 0, 1, 0)
|
||||
frameTip.Position = UDim2.new(1, 0, 0, 0)
|
||||
frameTip.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||
frameTip.BackgroundTransparency = 1
|
||||
frameTip.TextTransparency = 1
|
||||
frameTip.TextWrap = true
|
||||
|
||||
local inside = Instance.new "BoolValue"
|
||||
inside.Name = "inside"
|
||||
inside.Value = false
|
||||
inside.Parent = frameTip
|
||||
|
||||
function setUpListeners(frameToListen)
|
||||
local fadeSpeed = 0.1
|
||||
frameToListen.Parent.MouseEnter:connect(function()
|
||||
if frameToListen:FindFirstChild "inside" then
|
||||
frameToListen.inside.Value = true
|
||||
wait(1.2)
|
||||
if frameToListen.inside.Value then
|
||||
while
|
||||
frameToListen.inside.Value
|
||||
and frameToListen.BackgroundTransparency > 0
|
||||
do
|
||||
frameToListen.BackgroundTransparency = frameToListen.BackgroundTransparency
|
||||
- fadeSpeed
|
||||
frameToListen.TextTransparency = frameToListen.TextTransparency
|
||||
- fadeSpeed
|
||||
wait()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
function killTip(killFrame)
|
||||
killFrame.inside.Value = false
|
||||
killFrame.BackgroundTransparency = 1
|
||||
killFrame.TextTransparency = 1
|
||||
end
|
||||
frameToListen.Parent.MouseLeave:connect(function()
|
||||
killTip(frameToListen)
|
||||
end)
|
||||
frameToListen.Parent.MouseButton1Click:connect(function()
|
||||
killTip(frameToListen)
|
||||
end)
|
||||
end
|
||||
|
||||
function createSettingsButtonTip(parent)
|
||||
if parent == nil then
|
||||
parent = bottomLeftControl:FindFirstChild "SettingsButton"
|
||||
end
|
||||
|
||||
local toolTip = frameTip:clone()
|
||||
toolTip.RobloxLocked = true
|
||||
toolTip.Text = "Settings/Leave Game"
|
||||
toolTip.Position = UDim2.new(0, 0, 0, -18)
|
||||
toolTip.Size = UDim2.new(0, 120, 0, 20)
|
||||
toolTip.Parent = parent
|
||||
setUpListeners(toolTip)
|
||||
end
|
||||
|
||||
wait(5) -- make sure we are loaded in, won't need tool tips for first 5 seconds anyway
|
||||
|
||||
---------------- set up Bottom Left Tool Tips -------------------------
|
||||
|
||||
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
||||
|
||||
for i = 1, #bottomLeftChildren do
|
||||
if bottomLeftChildren[i].Name == "Exit" then
|
||||
local exitTip = frameTip:clone()
|
||||
exitTip.RobloxLocked = true
|
||||
exitTip.Text = "Leave Place"
|
||||
exitTip.Position = UDim2.new(0, 0, -1, 0)
|
||||
exitTip.Size = UDim2.new(1, 0, 1, 0)
|
||||
exitTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(exitTip)
|
||||
elseif bottomLeftChildren[i].Name == "SettingsButton" then
|
||||
createSettingsButtonTip(bottomLeftChildren[i])
|
||||
end
|
||||
end
|
||||
|
||||
---------------- set up Bottom Right Tool Tips -------------------------
|
||||
|
||||
local bottomRightChildren = bottomRightControl:GetChildren()
|
||||
|
||||
for i = 1, #bottomRightChildren do
|
||||
if bottomRightChildren[i].Name:find "Camera" ~= nil then
|
||||
local cameraTip = frameTip:clone()
|
||||
cameraTip.RobloxLocked = true
|
||||
cameraTip.Text = "Camera View"
|
||||
if bottomRightChildren[i].Name:find "Zoom" then
|
||||
cameraTip.Position = UDim2.new(-1, 0, -1.5)
|
||||
else
|
||||
cameraTip.Position = UDim2.new(0, 0, -1.5, 0)
|
||||
end
|
||||
cameraTip.Size = UDim2.new(2, 0, 1.25, 0)
|
||||
cameraTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(cameraTip)
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
-- Script Context.StarterScript
|
||||
print "[Mercury]: Loaded corescript 37801172"
|
||||
|
||||
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,
|
||||
scriptContext,
|
||||
"/Libraries/LibraryRegistration/LibraryRegistration"
|
||||
)
|
||||
|
||||
local function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
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
|
||||
|
||||
-- MainBotChatScript
|
||||
scriptContext:AddCoreScript(
|
||||
39250920,
|
||||
screenGui,
|
||||
"CoreScripts/MainBotChatScript"
|
||||
)
|
||||
|
||||
-- Popup Script
|
||||
scriptContext:AddCoreScript(48488451, screenGui, "CoreScripts/PopupScript")
|
||||
-- Friend Notification Script (probably can use this script to expand out to other notifications)
|
||||
scriptContext:AddCoreScript(
|
||||
48488398,
|
||||
screenGui,
|
||||
"CoreScripts/NotificationScript"
|
||||
)
|
||||
-- Chat script
|
||||
scriptContext:AddCoreScript(97188756, screenGui, "CoreScripts/ChatScript")
|
||||
-- Purchase Prompt Script
|
||||
scriptContext:AddCoreScript(
|
||||
107893730,
|
||||
screenGui,
|
||||
"CoreScripts/PurchasePromptScript"
|
||||
)
|
||||
|
||||
if not touchEnabled or screenGui.AbsoluteSize.Y > 600 then
|
||||
-- New Player List
|
||||
scriptContext:AddCoreScript(
|
||||
48488235,
|
||||
screenGui,
|
||||
"CoreScripts/PlayerListScript"
|
||||
)
|
||||
else
|
||||
delay(5, function()
|
||||
if screenGui.AbsoluteSize.Y >= 600 then
|
||||
-- New Player List
|
||||
scriptContext:AddCoreScript(
|
||||
48488235,
|
||||
screenGui,
|
||||
"CoreScripts/PlayerListScript"
|
||||
)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove placeid hack for halloween
|
||||
-- Backpack Builder, creates most of the backpack gui
|
||||
scriptContext:AddCoreScript(
|
||||
53878047,
|
||||
screenGui,
|
||||
"CoreScripts/BackpackScripts/BackpackBuilder"
|
||||
)
|
||||
|
||||
waitForChild(screenGui, "CurrentLoadout")
|
||||
waitForChild(screenGui, "Backpack")
|
||||
local Backpack = screenGui.Backpack
|
||||
|
||||
-- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly
|
||||
if game.CoreGui.Version >= 7 then
|
||||
scriptContext:AddCoreScript(
|
||||
89449093,
|
||||
Backpack,
|
||||
"CoreScripts/BackpackScripts/BackpackManager"
|
||||
)
|
||||
end
|
||||
|
||||
-- Backpack Gear (handles all backpack gear tab stuff)
|
||||
game:GetService("ScriptContext"):AddCoreScript(
|
||||
89449008,
|
||||
Backpack,
|
||||
"CoreScripts/BackpackScripts/BackpackGear"
|
||||
)
|
||||
-- Loadout Script, used for gear hotkeys
|
||||
scriptContext:AddCoreScript(
|
||||
53878057,
|
||||
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"
|
||||
if IsPersonalServer then
|
||||
game:GetService("ScriptContext")
|
||||
:AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||
end
|
||||
game.Workspace.ChildAdded:connect(function(nchild)
|
||||
if nchild.Name == "PSVariable" and nchild:IsA "BoolValue" then
|
||||
IsPersonalServer = true
|
||||
game:GetService("ScriptContext")
|
||||
:AddCoreScript(
|
||||
64164692,
|
||||
game.Players.LocalPlayer,
|
||||
"BuildToolManager"
|
||||
)
|
||||
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
|
||||
|
|
@ -0,0 +1,279 @@
|
|||
-- Unused by Mercury
|
||||
print "[Mercury]: Loaded corescript 38037565"
|
||||
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
|
||||
|
||||
local damageGuiWidth = 5.0
|
||||
local damageGuiHeight = 5.0
|
||||
|
||||
function waitForChild(parent, childName)
|
||||
local child = parent:findFirstChild(childName)
|
||||
if child then
|
||||
return child
|
||||
end
|
||||
while true do
|
||||
child = parent.ChildAdded:wait()
|
||||
if child.Name == childName then
|
||||
return child
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- declarations
|
||||
local Figure = script.Parent
|
||||
local Humanoid = waitForChild(Figure, "Humanoid")
|
||||
local Torso = waitForChild(Figure, "Torso")
|
||||
|
||||
local config = Figure:FindFirstChild "PlayerStats"
|
||||
|
||||
local inCharTag = Instance.new "BoolValue"
|
||||
inCharTag.Name = "InCharTag"
|
||||
|
||||
local hider = Instance.new "BoolValue"
|
||||
hider.Name = "RobloxBuildTool"
|
||||
|
||||
local currentChildren, backpackTools
|
||||
|
||||
if config == nil then
|
||||
config = Instance.new "Configuration"
|
||||
config.Parent = Figure
|
||||
config.Name = "PlayerStats"
|
||||
end
|
||||
|
||||
local myHealth = config:FindFirstChild "MaxHealth"
|
||||
if myHealth == nil then
|
||||
myHealth = Instance.new "NumberValue"
|
||||
myHealth.Parent = config
|
||||
myHealth.Value = 100
|
||||
myHealth.Name = "MaxHealth"
|
||||
end
|
||||
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
Humanoid.Health = myHealth.Value
|
||||
|
||||
function onMaxHealthChange()
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
Humanoid.Health = myHealth.Value
|
||||
end
|
||||
|
||||
myHealth.Changed:connect(onMaxHealthChange)
|
||||
|
||||
--Humanoid.MaxHealth = myHealth.Value
|
||||
--Humanoid.Health = Humanoid.MaxHealth
|
||||
|
||||
local vPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
|
||||
local dotGui = vPlayer.PlayerGui:FindFirstChild "DamageOverTimeGui"
|
||||
if dotGui == nil then
|
||||
dotGui = Instance.new "BillboardGui"
|
||||
dotGui.Name = "DamageOverTimeGui"
|
||||
dotGui.Parent = vPlayer.PlayerGui
|
||||
dotGui.Adornee = script.Parent:FindFirstChild "Head"
|
||||
dotGui.Active = true
|
||||
dotGui.size = UDim2.new(damageGuiWidth, 0, damageGuiHeight, 0.0)
|
||||
dotGui.StudsOffset = Vector3.new(0, 2.0, 0.0)
|
||||
end
|
||||
|
||||
print "newHealth declarations finished"
|
||||
|
||||
function billboardHealthChange(dmg)
|
||||
local textLabel = Instance.new "TextLabel"
|
||||
if dmg > 0 then
|
||||
textLabel.Text = tostring(dmg)
|
||||
textLabel.TextColor3 = Color3.new(0, 1, 0)
|
||||
else
|
||||
textLabel.Text = tostring(dmg)
|
||||
textLabel.TextColor3 = Color3.new(1, 0, 1)
|
||||
end
|
||||
textLabel.size = UDim2.new(1, 0, 1, 0.0)
|
||||
textLabel.Active = true
|
||||
textLabel.FontSize = 6
|
||||
textLabel.BackgroundTransparency = 1
|
||||
textLabel.Parent = dotGui
|
||||
|
||||
for t = 1, 10 do
|
||||
wait(0.1)
|
||||
textLabel.TextTransparency = t / 10
|
||||
textLabel.Position = UDim2.new(0, 0, 0, -t * 5)
|
||||
textLabel.FontSize = 6 - t * 0.6
|
||||
end
|
||||
|
||||
textLabel:remove()
|
||||
end
|
||||
|
||||
function setMaxHealth()
|
||||
--print(Humanoid.Health)
|
||||
if myHealth.Value >= 0 then
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
print(Humanoid.MaxHealth)
|
||||
if Humanoid.Health > Humanoid.MaxHealth then
|
||||
Humanoid.Health = Humanoid.MaxHealth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
myHealth.Changed:connect(setMaxHealth)
|
||||
|
||||
-- Visual Effects --
|
||||
|
||||
local fireEffect = Instance.new "Fire"
|
||||
fireEffect.Heat = 0.1
|
||||
fireEffect.Size = 3.0
|
||||
fireEffect.Name = "FireEffect"
|
||||
fireEffect.Enabled = false
|
||||
--
|
||||
|
||||
-- regeneration
|
||||
while true do
|
||||
local s = wait(1)
|
||||
local health = Humanoid.Health
|
||||
if health > 0 then -- and health < Humanoid.MaxHealth then
|
||||
local delta = 0
|
||||
if config then
|
||||
local regen = config:FindFirstChild "Regen"
|
||||
local poison = config:FindFirstChild "Poison"
|
||||
local ice = config:FindFirstChild "Ice"
|
||||
local fire = config:FindFirstChild "Fire"
|
||||
local stun = config:FindFirstChild "Stun"
|
||||
if regen then
|
||||
delta += regen.Value.X
|
||||
if regen.Value.Y >= 0 then
|
||||
regen.Value = Vector3.new(
|
||||
regen.Value.X + regen.Value.Z,
|
||||
regen.Value.Y - s,
|
||||
regen.Value.Z
|
||||
) -- maybe have 3rd parameter be an increaser/decreaser?
|
||||
elseif regen.Value.Y == -1 then
|
||||
regen.Value = Vector3.new(
|
||||
regen.Value.X + regen.Value.Z,
|
||||
-1,
|
||||
regen.Value.Z
|
||||
)
|
||||
else
|
||||
regen:remove()
|
||||
end -- infinity is -1
|
||||
end
|
||||
if poison then
|
||||
delta -= poison.Value.X
|
||||
if poison.Value.Y >= 0 then
|
||||
poison.Value = Vector3.new(
|
||||
poison.Value.X + poison.Value.Z,
|
||||
poison.Value.Y - s,
|
||||
poison.Value.Z
|
||||
)
|
||||
elseif poison.Value.Y == -1 then
|
||||
poison.Value = Vector3.new(
|
||||
poison.Value.X + poison.Value.Z,
|
||||
-1,
|
||||
poison.Value.Z
|
||||
)
|
||||
else
|
||||
poison:remove()
|
||||
end -- infinity is -1
|
||||
end
|
||||
|
||||
if ice then
|
||||
--print("IN ICE")
|
||||
delta -= ice.Value.X
|
||||
if ice.Value.Y >= 0 then
|
||||
ice.Value =
|
||||
Vector3.new(ice.Value.X, ice.Value.Y - s, ice.Value.Z)
|
||||
else
|
||||
ice:remove()
|
||||
end
|
||||
end
|
||||
|
||||
if fire then
|
||||
fireEffect.Enabled = true
|
||||
fireEffect.Parent = Figure.Torso
|
||||
delta -= fire.Value.X
|
||||
if fire.Value.Y >= 0 then
|
||||
fire.Value = Vector3.new(
|
||||
fire.Value.X,
|
||||
fire.Value.Y - s,
|
||||
fire.Value.Z
|
||||
)
|
||||
else
|
||||
fire:remove()
|
||||
fireEffect.Enabled = false
|
||||
fireEffect.Parent = nil
|
||||
end
|
||||
end
|
||||
|
||||
if stun then
|
||||
if stun.Value > 0 then
|
||||
Torso.Anchored = true
|
||||
currentChildren = script.Parent:GetChildren()
|
||||
backpackTools = game.Players
|
||||
:GetPlayerFromCharacter(script.Parent).Backpack
|
||||
:GetChildren()
|
||||
for i = 1, #currentChildren do
|
||||
if currentChildren[i].className == "Tool" then
|
||||
inCharTag:Clone().Parent = currentChildren[i]
|
||||
print(backpackTools)
|
||||
table.insert(backpackTools, currentChildren[i])
|
||||
end
|
||||
end
|
||||
for i = 1, #backpackTools do
|
||||
if
|
||||
backpackTools[i]:FindFirstChild "RobloxBuildTool"
|
||||
== nil
|
||||
then
|
||||
hider:Clone().Parent = backpackTools[i]
|
||||
backpackTools[i].Parent = game.Lighting
|
||||
end
|
||||
end
|
||||
wait(0.2)
|
||||
for i = 1, #backpackTools do
|
||||
backpackTools[i].Parent =
|
||||
game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
||||
end
|
||||
stun.Value -= s
|
||||
else
|
||||
Torso.Anchored = false
|
||||
for i = 1, #backpackTools do
|
||||
local rbTool =
|
||||
backpackTools[i]:FindFirstChild "RobloxBuildTool"
|
||||
if rbTool then
|
||||
rbTool:Remove()
|
||||
end
|
||||
backpackTools[i].Parent = game.Lighting
|
||||
end
|
||||
wait(0.2)
|
||||
for i = 1, #backpackTools do
|
||||
local wasInChar =
|
||||
backpackTools[i]:FindFirstChild "InCharTag"
|
||||
if wasInChar then
|
||||
wasInChar:Remove()
|
||||
backpackTools[i].Parent = script.Parent
|
||||
else
|
||||
backpackTools[i].Parent =
|
||||
game.Players:GetPlayerFromCharacter(
|
||||
script.Parent
|
||||
).Backpack
|
||||
end
|
||||
end
|
||||
stun:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
if delta ~= 0 then
|
||||
coroutine.resume(coroutine.create(billboardHealthChange), delta)
|
||||
end
|
||||
--delta *= .01
|
||||
end
|
||||
--health += delta * s * Humanoid.MaxHealth
|
||||
|
||||
health = Humanoid.Health + delta * s
|
||||
if health * 1.01 < Humanoid.MaxHealth then
|
||||
Humanoid.Health = health
|
||||
--myHealth.Value = math.floor(Humanoid.Health)
|
||||
elseif delta > 0 then
|
||||
Humanoid.Health = Humanoid.MaxHealth
|
||||
--myHealth.Value = Humanoid.Health
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,617 @@
|
|||
-- CoreGui.RobloxGui.CoreScripts/MainBotChatScript
|
||||
print "[Mercury]: Loaded corescript 39250920"
|
||||
|
||||
function waitForProperty(instance, name)
|
||||
while not instance[name] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
|
||||
function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
||||
local mainFrame
|
||||
local choices = {}
|
||||
local lastChoice
|
||||
local choiceMap = {}
|
||||
local currentConversationDialog, currentConversationPartner, currentAbortDialogScript
|
||||
|
||||
local tooFarAwayMessage = "You are too far away to chat!"
|
||||
local tooFarAwaySize = 300
|
||||
local characterWanderedOffMessage = "Chat ended because you walked away"
|
||||
local characterWanderedOffSize = 350
|
||||
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||
local conversationTimedOutSize = 350
|
||||
|
||||
local player, chatNotificationGui, messageDialog, timeoutScript, reenableDialogScript
|
||||
local dialogMap = {}
|
||||
local dialogConnections = {}
|
||||
|
||||
local gui
|
||||
waitForChild(game, "CoreGui")
|
||||
waitForChild(game.CoreGui, "RobloxGui")
|
||||
if game.CoreGui.RobloxGui:FindFirstChild "ControlFrame" then
|
||||
gui = game.CoreGui.RobloxGui.ControlFrame
|
||||
else
|
||||
gui = game.CoreGui.RobloxGui
|
||||
end
|
||||
|
||||
function currentTone()
|
||||
if currentConversationDialog then
|
||||
return currentConversationDialog.Tone
|
||||
else
|
||||
return Enum.DialogTone.Neutral
|
||||
end
|
||||
end
|
||||
|
||||
function createChatNotificationGui()
|
||||
chatNotificationGui = Instance.new "BillboardGui"
|
||||
chatNotificationGui.Name = "ChatNotificationGui"
|
||||
chatNotificationGui.ExtentsOffset = Vector3.new(0, 1, 0)
|
||||
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
||||
chatNotificationGui.SizeOffset = Vector2.new(0, 0)
|
||||
chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0)
|
||||
chatNotificationGui.Enabled = true
|
||||
chatNotificationGui.RobloxLocked = true
|
||||
chatNotificationGui.Active = true
|
||||
|
||||
local image = Instance.new "ImageLabel"
|
||||
image.Name = "Image"
|
||||
image.Active = false
|
||||
image.BackgroundTransparency = 1
|
||||
image.Position = UDim2.new(0, 0, 0, 0)
|
||||
image.Size = UDim2.new(1, 0, 1, 0)
|
||||
image.Image = ""
|
||||
image.RobloxLocked = true
|
||||
image.Parent = chatNotificationGui
|
||||
|
||||
local button = Instance.new "ImageButton"
|
||||
button.Name = "Button"
|
||||
button.AutoButtonColor = false
|
||||
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
||||
button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0)
|
||||
button.Image = ""
|
||||
button.BackgroundTransparency = 1
|
||||
button.RobloxLocked = true
|
||||
button.Parent = image
|
||||
end
|
||||
|
||||
function getChatColor(tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
return Enum.ChatColor.Blue
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
return Enum.ChatColor.Green
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
return Enum.ChatColor.Red
|
||||
end
|
||||
end
|
||||
|
||||
function styleChoices(tone)
|
||||
for _, obj in pairs(choices) do
|
||||
resetColor(obj, tone)
|
||||
end
|
||||
resetColor(lastChoice, tone)
|
||||
end
|
||||
|
||||
function styleMainFrame(tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||
mainFrame.Tail.Image =
|
||||
"rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
mainFrame.Style = Enum.FrameStyle.ChatGreen
|
||||
mainFrame.Tail.Image =
|
||||
"rbxasset://textures/chatBubble_botGreen_tailRight.png"
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
mainFrame.Style = Enum.FrameStyle.ChatRed
|
||||
mainFrame.Tail.Image =
|
||||
"rbxasset://textures/chatBubble_botRed_tailRight.png"
|
||||
end
|
||||
|
||||
styleChoices(tone)
|
||||
end
|
||||
function setChatNotificationTone(gui, purpose, tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
gui.Image.Image =
|
||||
"rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
gui.Image.Image =
|
||||
"rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
|
||||
end
|
||||
if purpose == Enum.DialogPurpose.Quest then
|
||||
gui.Image.Button.Image =
|
||||
"rbxasset://textures/chatBubble_bot_notify_bang.png"
|
||||
elseif purpose == Enum.DialogPurpose.Help then
|
||||
gui.Image.Button.Image =
|
||||
"rbxasset://textures/chatBubble_bot_notify_question.png"
|
||||
elseif purpose == Enum.DialogPurpose.Shop then
|
||||
gui.Image.Button.Image =
|
||||
"rbxasset://textures/chatBubble_bot_notify_money.png"
|
||||
end
|
||||
end
|
||||
|
||||
function createMessageDialog()
|
||||
messageDialog = Instance.new "Frame"
|
||||
messageDialog.Name = "DialogScriptMessage"
|
||||
messageDialog.Style = Enum.FrameStyle.RobloxRound
|
||||
messageDialog.Visible = false
|
||||
|
||||
local text = Instance.new "TextLabel"
|
||||
text.Name = "Text"
|
||||
text.Position = UDim2.new(0, 0, 0, -1)
|
||||
text.Size = UDim2.new(1, 0, 1, 0)
|
||||
text.FontSize = Enum.FontSize.Size14
|
||||
text.BackgroundTransparency = 1
|
||||
text.TextColor3 = Color3.new(1, 1, 1)
|
||||
text.RobloxLocked = true
|
||||
text.Parent = messageDialog
|
||||
end
|
||||
|
||||
function showMessage(msg, size)
|
||||
messageDialog.Text.Text = msg
|
||||
messageDialog.Size = UDim2.new(0, size, 0, 40)
|
||||
messageDialog.Position = UDim2.new(0.5, -size / 2, 0.5, -40)
|
||||
messageDialog.Visible = true
|
||||
wait(2)
|
||||
messageDialog.Visible = false
|
||||
end
|
||||
|
||||
function variableDelay(str)
|
||||
local length = math.min(string.len(str), 100)
|
||||
wait(0.75 + ((length / 75) * 1.5))
|
||||
end
|
||||
|
||||
function resetColor(frame, tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
frame.BackgroundColor3 = Color3.new(0 / 255, 0 / 255, 179 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(45 / 255, 142 / 255, 245 / 255)
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
frame.BackgroundColor3 = Color3.new(0 / 255, 77 / 255, 0 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(0 / 255, 190 / 255, 0 / 255)
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
frame.BackgroundColor3 = Color3.new(140 / 255, 0 / 255, 0 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(255 / 255, 88 / 255, 79 / 255)
|
||||
end
|
||||
end
|
||||
|
||||
function highlightColor(frame, tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
frame.BackgroundColor3 = Color3.new(2 / 255, 108 / 255, 255 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
frame.BackgroundColor3 = Color3.new(0 / 255, 128 / 255, 0 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
frame.BackgroundColor3 = Color3.new(204 / 255, 0 / 255, 0 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function endDialog()
|
||||
if currentAbortDialogScript then
|
||||
currentAbortDialogScript:Remove()
|
||||
currentAbortDialogScript = nil
|
||||
end
|
||||
|
||||
local dialog = currentConversationDialog
|
||||
currentConversationDialog = nil
|
||||
if dialog and dialog.InUse then
|
||||
local reenableScript = reenableDialogScript:Clone()
|
||||
reenableScript.archivable = false
|
||||
reenableScript.Disabled = false
|
||||
reenableScript.Parent = dialog
|
||||
end
|
||||
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = not dialog.InUse
|
||||
end
|
||||
end
|
||||
|
||||
currentConversationPartner = nil
|
||||
end
|
||||
|
||||
function wanderDialog()
|
||||
print "Wander"
|
||||
mainFrame.Visible = false
|
||||
endDialog()
|
||||
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||
end
|
||||
|
||||
function timeoutDialog()
|
||||
print "Timeout"
|
||||
mainFrame.Visible = false
|
||||
endDialog()
|
||||
showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||
end
|
||||
function normalEndDialog()
|
||||
print "Done"
|
||||
endDialog()
|
||||
end
|
||||
|
||||
function sanitizeMessage(msg)
|
||||
if string.len(msg) == 0 then
|
||||
return "..."
|
||||
else
|
||||
return msg
|
||||
end
|
||||
end
|
||||
|
||||
function selectChoice(choice)
|
||||
renewKillswitch(currentConversationDialog)
|
||||
|
||||
--First hide the Gui
|
||||
mainFrame.Visible = false
|
||||
if choice == lastChoice then
|
||||
game.Chat:Chat(
|
||||
game.Players.LocalPlayer.Character,
|
||||
"Goodbye!",
|
||||
getChatColor(currentTone())
|
||||
)
|
||||
|
||||
normalEndDialog()
|
||||
else
|
||||
local dialogChoice = choiceMap[choice]
|
||||
|
||||
game.Chat:Chat(
|
||||
game.Players.LocalPlayer.Character,
|
||||
sanitizeMessage(dialogChoice.UserDialog),
|
||||
getChatColor(currentTone())
|
||||
)
|
||||
wait(1)
|
||||
currentConversationDialog:SignalDialogChoiceSelected(
|
||||
player,
|
||||
dialogChoice
|
||||
)
|
||||
game.Chat:Chat(
|
||||
currentConversationPartner,
|
||||
sanitizeMessage(dialogChoice.ResponseDialog),
|
||||
getChatColor(currentTone())
|
||||
)
|
||||
|
||||
variableDelay(dialogChoice.ResponseDialog)
|
||||
presentDialogChoices(
|
||||
currentConversationPartner,
|
||||
dialogChoice:GetChildren()
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function newChoice(numberText)
|
||||
local frame = Instance.new "TextButton"
|
||||
frame.BackgroundColor3 = Color3.new(0 / 255, 0 / 255, 179 / 255)
|
||||
frame.AutoButtonColor = false
|
||||
frame.BorderSizePixel = 0
|
||||
frame.Text = ""
|
||||
frame.MouseEnter:connect(function()
|
||||
highlightColor(frame, currentTone())
|
||||
end)
|
||||
frame.MouseLeave:connect(function()
|
||||
resetColor(frame, currentTone())
|
||||
end)
|
||||
frame.MouseButton1Click:connect(function()
|
||||
selectChoice(frame)
|
||||
end)
|
||||
frame.RobloxLocked = true
|
||||
|
||||
local number = Instance.new "TextLabel"
|
||||
number.Name = "Number"
|
||||
number.TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255)
|
||||
number.Text = numberText
|
||||
number.FontSize = Enum.FontSize.Size14
|
||||
number.BackgroundTransparency = 1
|
||||
number.Position = UDim2.new(0, 4, 0, 2)
|
||||
number.Size = UDim2.new(0, 20, 0, 24)
|
||||
number.TextXAlignment = Enum.TextXAlignment.Left
|
||||
number.TextYAlignment = Enum.TextYAlignment.Top
|
||||
number.RobloxLocked = true
|
||||
number.Parent = frame
|
||||
|
||||
local prompt = Instance.new "TextLabel"
|
||||
prompt.Name = "UserPrompt"
|
||||
prompt.BackgroundTransparency = 1
|
||||
prompt.TextColor3 = Color3.new(1, 1, 1)
|
||||
prompt.FontSize = Enum.FontSize.Size14
|
||||
prompt.Position = UDim2.new(0, 28, 0, 2)
|
||||
prompt.Size = UDim2.new(1, -32, 1, -4)
|
||||
prompt.TextXAlignment = Enum.TextXAlignment.Left
|
||||
prompt.TextYAlignment = Enum.TextYAlignment.Top
|
||||
prompt.TextWrap = true
|
||||
prompt.RobloxLocked = true
|
||||
prompt.Parent = frame
|
||||
|
||||
return frame
|
||||
end
|
||||
function initialize(parent)
|
||||
choices[1] = newChoice "1)"
|
||||
choices[2] = newChoice "2)"
|
||||
choices[3] = newChoice "3)"
|
||||
choices[4] = newChoice "4)"
|
||||
|
||||
lastChoice = newChoice "5)"
|
||||
lastChoice.UserPrompt.Text = "Goodbye!"
|
||||
lastChoice.Size = UDim2.new(1, 0, 0, 28)
|
||||
|
||||
mainFrame = Instance.new "Frame"
|
||||
mainFrame.Name = "UserDialogArea"
|
||||
mainFrame.Size = UDim2.new(0, 350, 0, 200)
|
||||
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||
mainFrame.Visible = false
|
||||
|
||||
local imageLabel = Instance.new "ImageLabel"
|
||||
imageLabel.Name = "Tail"
|
||||
imageLabel.Size = UDim2.new(0, 62, 0, 53)
|
||||
imageLabel.Position = UDim2.new(1, 8, 0.25)
|
||||
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||
imageLabel.BackgroundTransparency = 1
|
||||
imageLabel.RobloxLocked = true
|
||||
imageLabel.Parent = mainFrame
|
||||
|
||||
for _, obj in pairs(choices) do
|
||||
obj.RobloxLocked = true
|
||||
obj.Parent = mainFrame
|
||||
end
|
||||
lastChoice.RobloxLocked = true
|
||||
lastChoice.Parent = mainFrame
|
||||
|
||||
mainFrame.RobloxLocked = true
|
||||
mainFrame.Parent = parent
|
||||
end
|
||||
|
||||
function presentDialogChoices(talkingPart, dialogChoices)
|
||||
if not currentConversationDialog then
|
||||
return
|
||||
end
|
||||
|
||||
currentConversationPartner = talkingPart
|
||||
local sortedDialogChoices = {}
|
||||
for _, obj in pairs(dialogChoices) do
|
||||
if obj:IsA "DialogChoice" then
|
||||
table.insert(sortedDialogChoices, obj)
|
||||
end
|
||||
end
|
||||
table.sort(sortedDialogChoices, function(a, b)
|
||||
return a.Name < b.Name
|
||||
end)
|
||||
|
||||
if #sortedDialogChoices == 0 then
|
||||
normalEndDialog()
|
||||
return
|
||||
end
|
||||
|
||||
local pos = 1
|
||||
local yPosition = 0
|
||||
choiceMap = {}
|
||||
for _, obj in pairs(choices) do
|
||||
obj.Visible = false
|
||||
end
|
||||
|
||||
for _, obj in pairs(sortedDialogChoices) do
|
||||
if pos <= #choices then
|
||||
--3 lines is the maximum, set it to that temporarily
|
||||
choices[pos].Size = UDim2.new(1, 0, 0, 24 * 3)
|
||||
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y / 24)
|
||||
* 24
|
||||
|
||||
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
||||
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
||||
choices[pos].Visible = true
|
||||
|
||||
choiceMap[choices[pos]] = obj
|
||||
|
||||
yPosition += height
|
||||
pos += 1
|
||||
end
|
||||
end
|
||||
|
||||
lastChoice.Position = UDim2.new(0, 0, 0, yPosition)
|
||||
lastChoice.Number.Text = pos .. ")"
|
||||
|
||||
mainFrame.Size = UDim2.new(0, 350, 0, yPosition + 24 + 32)
|
||||
mainFrame.Position = UDim2.new(0, 20, 0, -mainFrame.Size.Y.Offset - 20)
|
||||
styleMainFrame(currentTone())
|
||||
mainFrame.Visible = true
|
||||
end
|
||||
|
||||
function doDialog(dialog)
|
||||
while not Instance.Lock(dialog, player) do
|
||||
wait()
|
||||
end
|
||||
|
||||
if dialog.InUse then
|
||||
Instance.Unlock(dialog)
|
||||
return
|
||||
else
|
||||
dialog.InUse = true
|
||||
Instance.Unlock(dialog)
|
||||
end
|
||||
|
||||
currentConversationDialog = dialog
|
||||
game.Chat:Chat(
|
||||
dialog.Parent,
|
||||
dialog.InitialPrompt,
|
||||
getChatColor(dialog.Tone)
|
||||
)
|
||||
variableDelay(dialog.InitialPrompt)
|
||||
|
||||
presentDialogChoices(dialog.Parent, dialog:GetChildren())
|
||||
end
|
||||
|
||||
function renewKillswitch(dialog)
|
||||
if currentAbortDialogScript then
|
||||
currentAbortDialogScript:Remove()
|
||||
currentAbortDialogScript = nil
|
||||
end
|
||||
|
||||
currentAbortDialogScript = timeoutScript:Clone()
|
||||
currentAbortDialogScript.archivable = false
|
||||
currentAbortDialogScript.Disabled = false
|
||||
currentAbortDialogScript.Parent = dialog
|
||||
end
|
||||
|
||||
function checkForLeaveArea()
|
||||
while currentConversationDialog do
|
||||
if
|
||||
currentConversationDialog.Parent
|
||||
and (
|
||||
player:DistanceFromCharacter(
|
||||
currentConversationDialog.Parent.Position
|
||||
) >= currentConversationDialog.ConversationDistance
|
||||
)
|
||||
then
|
||||
wanderDialog()
|
||||
end
|
||||
wait(1)
|
||||
end
|
||||
end
|
||||
|
||||
function startDialog(dialog)
|
||||
if dialog.Parent and dialog.Parent:IsA "BasePart" then
|
||||
if
|
||||
player:DistanceFromCharacter(dialog.Parent.Position)
|
||||
>= dialog.ConversationDistance
|
||||
then
|
||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||
return
|
||||
end
|
||||
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
renewKillswitch(dialog)
|
||||
|
||||
delay(1, checkForLeaveArea)
|
||||
doDialog(dialog)
|
||||
end
|
||||
end
|
||||
|
||||
function removeDialog(dialog)
|
||||
if dialogMap[dialog] then
|
||||
dialogMap[dialog]:Remove()
|
||||
dialogMap[dialog] = nil
|
||||
end
|
||||
if dialogConnections[dialog] then
|
||||
dialogConnections[dialog]:disconnect()
|
||||
dialogConnections[dialog] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function addDialog(dialog)
|
||||
if dialog.Parent then
|
||||
if dialog.Parent:IsA "BasePart" then
|
||||
local chatGui = chatNotificationGui:clone()
|
||||
chatGui.Enabled = not dialog.InUse
|
||||
chatGui.Adornee = dialog.Parent
|
||||
chatGui.RobloxLocked = true
|
||||
chatGui.Parent = game.CoreGui
|
||||
chatGui.Image.Button.MouseButton1Click:connect(function()
|
||||
startDialog(dialog)
|
||||
end)
|
||||
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||
|
||||
dialogMap[dialog] = chatGui
|
||||
|
||||
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||
if prop == "Parent" and dialog.Parent then
|
||||
--This handles the reparenting case, seperate from removal case
|
||||
removeDialog(dialog)
|
||||
addDialog(dialog)
|
||||
elseif prop == "InUse" then
|
||||
chatGui.Enabled = not currentConversationDialog
|
||||
and not dialog.InUse
|
||||
if dialog == currentConversationDialog then
|
||||
timeoutDialog()
|
||||
end
|
||||
elseif prop == "Tone" or prop == "Purpose" then
|
||||
setChatNotificationTone(
|
||||
chatGui,
|
||||
dialog.Purpose,
|
||||
dialog.Tone
|
||||
)
|
||||
end
|
||||
end)
|
||||
else -- still need to listen to parent changes even if current parent is not a BasePart
|
||||
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||
if prop == "Parent" and dialog.Parent then
|
||||
--This handles the reparenting case, seperate from removal case
|
||||
removeDialog(dialog)
|
||||
addDialog(dialog)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function fetchScripts()
|
||||
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||
if type(model) == "string" then -- load failed, lets try again
|
||||
wait(0.1)
|
||||
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||
end
|
||||
if type(model) == "string" then -- not going to work, lets bail
|
||||
return
|
||||
end
|
||||
|
||||
waitForChild(model, "TimeoutScript")
|
||||
timeoutScript = model.TimeoutScript
|
||||
waitForChild(model, "ReenableDialogScript")
|
||||
reenableDialogScript = model.ReenableDialogScript
|
||||
end
|
||||
|
||||
function onLoad()
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
player = game.Players.LocalPlayer
|
||||
waitForProperty(player, "Character")
|
||||
|
||||
--print("Fetching Scripts")
|
||||
fetchScripts()
|
||||
|
||||
--print("Creating Guis")
|
||||
createChatNotificationGui()
|
||||
|
||||
--print("Creating MessageDialog")
|
||||
createMessageDialog()
|
||||
messageDialog.RobloxLocked = true
|
||||
messageDialog.Parent = gui
|
||||
|
||||
--print("Waiting for BottomLeftControl")
|
||||
waitForChild(gui, "BottomLeftControl")
|
||||
|
||||
--print("Initializing Frame")
|
||||
local frame = Instance.new "Frame"
|
||||
frame.Name = "DialogFrame"
|
||||
frame.Position = UDim2.new(0, 0, 0, 0)
|
||||
frame.Size = UDim2.new(0, 0, 0, 0)
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.RobloxLocked = true
|
||||
frame.Parent = gui.BottomLeftControl
|
||||
initialize(frame)
|
||||
|
||||
--print("Adding Dialogs")
|
||||
game.CollectionService.ItemAdded:connect(function(obj)
|
||||
if obj:IsA "Dialog" then
|
||||
addDialog(obj)
|
||||
end
|
||||
end)
|
||||
game.CollectionService.ItemRemoved:connect(function(obj)
|
||||
if obj:IsA "Dialog" then
|
||||
removeDialog(obj)
|
||||
end
|
||||
end)
|
||||
for _, obj in pairs(game.CollectionService:GetCollection "Dialog") do
|
||||
if obj:IsA "Dialog" then
|
||||
addDialog(obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
onLoad()
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,23 @@
|
|||
-- RbxGear (unused)
|
||||
print "[Mercury]: Loaded corescript 45374389"
|
||||
|
||||
local t = {}
|
||||
|
||||
t.Foo = function()
|
||||
print "foo"
|
||||
end
|
||||
|
||||
t.Bar = function()
|
||||
print "bar"
|
||||
end
|
||||
|
||||
t.Help = function(funcNameOrFunc)
|
||||
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
||||
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo then
|
||||
return "Function Foo. Arguments: None. Side effect: prints foo"
|
||||
elseif funcNameOrFunc == "Bar" or funcNameOrFunc == t.Bar then
|
||||
return "Function Bar. Arguments: None. Side effect: prints bar"
|
||||
end
|
||||
end
|
||||
|
||||
return t
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,394 @@
|
|||
-- CoreGui.RobloxGui.CoreScripts/NotificationScript
|
||||
print "[Mercury]: Loaded corescript 48488398"
|
||||
|
||||
local TeleportService = game:GetService "TeleportService"
|
||||
|
||||
function waitForProperty(instance, property)
|
||||
while not instance[property] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
waitForChild(script.Parent, "Popup")
|
||||
waitForChild(script.Parent.Popup, "AcceptButton")
|
||||
script.Parent.Popup.AcceptButton.Modal = true
|
||||
|
||||
local localPlayer = game.Players.LocalPlayer
|
||||
local teleportUI
|
||||
|
||||
local friendRequestBlacklist = {}
|
||||
|
||||
local teleportEnabled = true
|
||||
|
||||
local makePopupInvisible = function()
|
||||
if script.Parent.Popup then
|
||||
script.Parent.Popup.Visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function makeFriend(fromPlayer, toPlayer)
|
||||
local popup = script.Parent:FindFirstChild "Popup"
|
||||
if popup == nil then
|
||||
return
|
||||
end -- there is no popup!
|
||||
if popup.Visible then
|
||||
return
|
||||
end -- currently popping something, abort!
|
||||
if friendRequestBlacklist[fromPlayer] then
|
||||
return
|
||||
end -- previously cancelled friend request, we don't want it!
|
||||
|
||||
popup.PopupText.Text = "Accept Friend Request from "
|
||||
.. tostring(fromPlayer.Name)
|
||||
.. "?"
|
||||
popup.PopupImage.Image = "http://banland.xyz/thumbs/avatar.ashx?userId="
|
||||
.. tostring(fromPlayer.userId)
|
||||
.. "&x=352&y=352"
|
||||
|
||||
showTwoButtons()
|
||||
popup.Visible = true
|
||||
popup.AcceptButton.Text = "Accept"
|
||||
popup.DeclineButton.Text = "Decline"
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
|
||||
local yesCon, noCon
|
||||
|
||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||
popup.Visible = false
|
||||
toPlayer:RequestFriendship(fromPlayer)
|
||||
if yesCon then
|
||||
yesCon:disconnect()
|
||||
end
|
||||
if noCon then
|
||||
noCon:disconnect()
|
||||
end
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end)
|
||||
|
||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||
popup.Visible = false
|
||||
toPlayer:RevokeFriendship(fromPlayer)
|
||||
friendRequestBlacklist[fromPlayer] = true
|
||||
print "pop up blacklist"
|
||||
if yesCon then
|
||||
yesCon:disconnect()
|
||||
end
|
||||
if noCon then
|
||||
noCon:disconnect()
|
||||
end
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
|
||||
-- if this doesn't involve me, then do nothing
|
||||
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then
|
||||
return
|
||||
end
|
||||
|
||||
if fromPlayer == localPlayer then
|
||||
if event == Enum.FriendRequestEvent.Accept then
|
||||
game:GetService("GuiService"):SendNotification(
|
||||
"You are Friends",
|
||||
"With " .. toPlayer.Name .. "!",
|
||||
"http://banland.xyz/thumbs/avatar.ashx?userId="
|
||||
.. tostring(toPlayer.userId)
|
||||
.. "&x=48&y=48",
|
||||
5,
|
||||
function() end
|
||||
)
|
||||
end
|
||||
elseif toPlayer == localPlayer then
|
||||
if event == Enum.FriendRequestEvent.Issue then
|
||||
if friendRequestBlacklist[fromPlayer] then
|
||||
return
|
||||
end -- previously cancelled friend request, we don't want it!
|
||||
game:GetService("GuiService"):SendNotification(
|
||||
"Friend Request",
|
||||
"From " .. fromPlayer.Name,
|
||||
"http://banland.xyz/thumbs/avatar.ashx?userId="
|
||||
.. tostring(fromPlayer.userId)
|
||||
.. "&x=48&y=48",
|
||||
8,
|
||||
function()
|
||||
makeFriend(fromPlayer, toPlayer)
|
||||
end
|
||||
)
|
||||
elseif event == Enum.FriendRequestEvent.Accept then
|
||||
game:GetService("GuiService"):SendNotification(
|
||||
"You are Friends",
|
||||
"With " .. fromPlayer.Name .. "!",
|
||||
"http://banland.xyz/thumbs/avatar.ashx?userId="
|
||||
.. tostring(fromPlayer.userId)
|
||||
.. "&x=48&y=48",
|
||||
5,
|
||||
function() end
|
||||
)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function showOneButton()
|
||||
local popup = script.Parent:FindFirstChild "Popup"
|
||||
if popup then
|
||||
popup.OKButton.Visible = true
|
||||
popup.DeclineButton.Visible = false
|
||||
popup.AcceptButton.Visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function showTwoButtons()
|
||||
local popup = script.Parent:FindFirstChild "Popup"
|
||||
if popup then
|
||||
popup.OKButton.Visible = false
|
||||
popup.DeclineButton.Visible = true
|
||||
popup.AcceptButton.Visible = true
|
||||
end
|
||||
end
|
||||
|
||||
function showTeleportUI(message, timer)
|
||||
if teleportUI ~= nil then
|
||||
teleportUI:Remove()
|
||||
end
|
||||
waitForChild(localPlayer, "PlayerGui")
|
||||
teleportUI = Instance.new "Message"
|
||||
teleportUI.Text = message
|
||||
teleportUI.Parent = localPlayer.PlayerGui
|
||||
if timer > 0 then
|
||||
wait(timer)
|
||||
teleportUI:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function onTeleport(teleportState, _, _)
|
||||
if TeleportService.CustomizedTeleportUI == false then
|
||||
if teleportState == Enum.TeleportState.Started then
|
||||
showTeleportUI("Teleport started...", 0)
|
||||
elseif teleportState == Enum.TeleportState.WaitingForServer then
|
||||
showTeleportUI("Requesting server...", 0)
|
||||
elseif teleportState == Enum.TeleportState.InProgress then
|
||||
showTeleportUI("Teleporting...", 0)
|
||||
elseif teleportState == Enum.TeleportState.Failed then
|
||||
showTeleportUI(
|
||||
"Teleport failed. Insufficient privileges or target place does not exist.",
|
||||
3
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if teleportEnabled then
|
||||
localPlayer.OnTeleport:connect(onTeleport)
|
||||
|
||||
TeleportService.ErrorCallback = function(message)
|
||||
local popup = script.Parent:FindFirstChild "Popup"
|
||||
showOneButton()
|
||||
popup.PopupText.Text = message
|
||||
local clickCon
|
||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||
TeleportService:TeleportCancel()
|
||||
if clickCon then
|
||||
clickCon:disconnect()
|
||||
end
|
||||
game.GuiService:RemoveCenterDialog(
|
||||
script.Parent:FindFirstChild "Popup"
|
||||
)
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end)
|
||||
game.GuiService:AddCenterDialog(
|
||||
script.Parent:FindFirstChild "Popup",
|
||||
Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
function()
|
||||
showOneButton()
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
end,
|
||||
--HideFunction
|
||||
function()
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end
|
||||
)
|
||||
end
|
||||
TeleportService.ConfirmationCallback = function(message, placeId, spawnName)
|
||||
local popup = script.Parent:FindFirstChild "Popup"
|
||||
popup.PopupText.Text = message
|
||||
popup.PopupImage.Image = ""
|
||||
|
||||
local yesCon, noCon
|
||||
|
||||
local function killCons()
|
||||
if yesCon then
|
||||
yesCon:disconnect()
|
||||
end
|
||||
if noCon then
|
||||
noCon:disconnect()
|
||||
end
|
||||
game.GuiService:RemoveCenterDialog(
|
||||
script.Parent:FindFirstChild "Popup"
|
||||
)
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end
|
||||
|
||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||
killCons()
|
||||
local success, err = pcall(function()
|
||||
TeleportService:TeleportImpl(placeId, spawnName)
|
||||
end)
|
||||
if not success then
|
||||
showOneButton()
|
||||
popup.PopupText.Text = err
|
||||
local clickCon
|
||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||
if clickCon then
|
||||
clickCon:disconnect()
|
||||
end
|
||||
game.GuiService:RemoveCenterDialog(
|
||||
script.Parent:FindFirstChild "Popup"
|
||||
)
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end)
|
||||
game.GuiService:AddCenterDialog(
|
||||
script.Parent:FindFirstChild "Popup",
|
||||
Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
function()
|
||||
showOneButton()
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
end,
|
||||
--HideFunction
|
||||
function()
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end
|
||||
)
|
||||
end
|
||||
end)
|
||||
|
||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||
killCons()
|
||||
pcall(function()
|
||||
TeleportService:TeleportCancel()
|
||||
end)
|
||||
end)
|
||||
|
||||
local centerDialogSuccess = pcall(function()
|
||||
game.GuiService:AddCenterDialog(
|
||||
script.Parent:FindFirstChild "Popup",
|
||||
Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
function()
|
||||
showTwoButtons()
|
||||
popup.AcceptButton.Text = "Leave"
|
||||
popup.DeclineButton.Text = "Stay"
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
end,
|
||||
--HideFunction
|
||||
function()
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible()
|
||||
)
|
||||
end
|
||||
)
|
||||
end)
|
||||
|
||||
if centerDialogSuccess == false then
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
popup.AcceptButton.Text = "Leave"
|
||||
popup.DeclineButton.Text = "Stay"
|
||||
popup:TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
-- CoreGui.RobloxGui.CoreScripts/PopupScript
|
||||
print "[Mercury]: Loaded corescript 48488451"
|
||||
|
||||
--build our gui
|
||||
|
||||
local popupFrame = Instance.new "Frame"
|
||||
popupFrame.Position = UDim2.new(0.5, -165, 0.5, -175)
|
||||
popupFrame.Size = UDim2.new(0, 330, 0, 350)
|
||||
popupFrame.Style = Enum.FrameStyle.RobloxRound
|
||||
popupFrame.ZIndex = 4
|
||||
popupFrame.Name = "Popup"
|
||||
popupFrame.Visible = false
|
||||
popupFrame.Parent = script.Parent
|
||||
|
||||
local darken = popupFrame:clone()
|
||||
darken.Size = UDim2.new(1, 16, 1, 16)
|
||||
darken.Position = UDim2.new(0, -8, 0, -8)
|
||||
darken.Name = "Darken"
|
||||
darken.ZIndex = 1
|
||||
darken.Parent = popupFrame
|
||||
|
||||
local acceptButton = Instance.new "TextButton"
|
||||
acceptButton.Position = UDim2.new(0, 20, 0, 270)
|
||||
acceptButton.Size = UDim2.new(0, 100, 0, 50)
|
||||
acceptButton.Font = Enum.Font.ArialBold
|
||||
acceptButton.FontSize = Enum.FontSize.Size24
|
||||
acceptButton.Style = Enum.ButtonStyle.RobloxButton
|
||||
acceptButton.TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255)
|
||||
acceptButton.Text = "Yes"
|
||||
acceptButton.ZIndex = 5
|
||||
acceptButton.Name = "AcceptButton"
|
||||
acceptButton.Parent = popupFrame
|
||||
|
||||
local declineButton = acceptButton:clone()
|
||||
declineButton.Position = UDim2.new(1, -120, 0, 270)
|
||||
declineButton.Text = "No"
|
||||
declineButton.Name = "DeclineButton"
|
||||
declineButton.Parent = popupFrame
|
||||
|
||||
local okButton = acceptButton:clone()
|
||||
okButton.Name = "OKButton"
|
||||
okButton.Text = "OK"
|
||||
okButton.Position = UDim2.new(0.5, -50, 0, 270)
|
||||
okButton.Visible = false
|
||||
okButton.Parent = popupFrame
|
||||
|
||||
local popupImage = Instance.new "ImageLabel"
|
||||
popupImage.BackgroundTransparency = 1
|
||||
popupImage.Position = UDim2.new(0.5, -140, 0, 0)
|
||||
popupImage.Size = UDim2.new(0, 280, 0, 280)
|
||||
popupImage.ZIndex = 3
|
||||
popupImage.Name = "PopupImage"
|
||||
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.Name = "Backing"
|
||||
backing.ZIndex = 2
|
||||
backing.Parent = popupImage
|
||||
|
||||
local popupText = Instance.new "TextLabel"
|
||||
popupText.Name = "PopupText"
|
||||
popupText.Size = UDim2.new(1, 0, 0.8, 0)
|
||||
popupText.Font = Enum.Font.ArialBold
|
||||
popupText.FontSize = Enum.FontSize.Size36
|
||||
popupText.BackgroundTransparency = 1
|
||||
popupText.Text = "Hello I'm a popup"
|
||||
popupText.TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255)
|
||||
popupText.TextWrap = true
|
||||
popupText.ZIndex = 5
|
||||
popupText.Parent = popupFrame
|
||||
|
||||
script:remove()
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,2 @@
|
|||
-- Script Context.CoreScripts/Sections
|
||||
print "[Mercury]: Loaded corescript 59002209"
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,31 @@
|
|||
-- Script Context./Libraries/LibraryRegistration/LibraryRegist
|
||||
print "[Mercury]: Loaded corescript 60595695"
|
||||
|
||||
-- Library Registration Script
|
||||
-- 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
|
||||
|
||||
while not sc and tries < 3 do
|
||||
tries += 1
|
||||
sc = game:GetService "ScriptContext"
|
||||
wait(0.2)
|
||||
end
|
||||
|
||||
if sc then
|
||||
sc:RegisterLibrary("Libraries/RbxFusion", "10000001")
|
||||
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()
|
||||
else
|
||||
print "failed to find script context, libraries did not load"
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,504 @@
|
|||
-- CoreGui.RobloxGui.Backpack.CoreScripts/BackpackScripts/Back (2?)
|
||||
print "[Mercury]: Loaded corescript 89449093"
|
||||
|
||||
-- This script manages context switches in the backpack (Gear to Wardrobe, etc.) and player state changes. Also manages global functions across different tabs (currently only search)
|
||||
if game.CoreGui.Version < 7 then
|
||||
return
|
||||
end -- peace out if we aren't using the right client
|
||||
|
||||
local GuiService = game:GetService "GuiService"
|
||||
|
||||
-- basic functions
|
||||
local function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
return instance:FindFirstChild(name)
|
||||
end
|
||||
local function waitForProperty(instance, property)
|
||||
while not instance[property] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
|
||||
-- don't do anything if we are in an empty game
|
||||
waitForChild(game, "Players")
|
||||
if #game.Players:GetChildren() < 1 then
|
||||
game.Players.ChildAdded:wait()
|
||||
end
|
||||
-- make sure everything is loaded in before we do anything
|
||||
-- get our local player
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
|
||||
------------------------ Locals ------------------------------
|
||||
local backpack = script.Parent
|
||||
waitForChild(backpack, "Gear")
|
||||
|
||||
local screen = script.Parent.Parent
|
||||
assert(screen:IsA "ScreenGui")
|
||||
|
||||
waitForChild(backpack, "Tabs")
|
||||
waitForChild(backpack.Tabs, "CloseButton")
|
||||
local closeButton = backpack.Tabs.CloseButton
|
||||
|
||||
waitForChild(backpack.Tabs, "InventoryButton")
|
||||
local inventoryButton = backpack.Tabs.InventoryButton
|
||||
|
||||
local wardrobeButton
|
||||
if game.CoreGui.Version >= 8 then
|
||||
waitForChild(backpack.Tabs, "WardrobeButton")
|
||||
wardrobeButton = backpack.Tabs.WardrobeButton
|
||||
end
|
||||
waitForChild(backpack.Parent, "ControlFrame")
|
||||
local backpackButton =
|
||||
waitForChild(backpack.Parent.ControlFrame, "BackpackButton")
|
||||
local currentTab = "gear"
|
||||
|
||||
local searchFrame = waitForChild(backpack, "SearchFrame")
|
||||
waitForChild(backpack.SearchFrame, "SearchBoxFrame")
|
||||
local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame, "SearchBox")
|
||||
local searchButton = waitForChild(backpack.SearchFrame, "SearchButton")
|
||||
local resetButton = waitForChild(backpack.SearchFrame, "ResetButton")
|
||||
|
||||
local robloxGui = waitForChild(Game.CoreGui, "RobloxGui")
|
||||
local currentLoadout = waitForChild(robloxGui, "CurrentLoadout")
|
||||
local loadoutBackground = waitForChild(currentLoadout, "Background")
|
||||
|
||||
local canToggle = true
|
||||
local readyForNextEvent = true
|
||||
local backpackIsOpen = false
|
||||
local active = true
|
||||
local disabledByDeveloper = false
|
||||
|
||||
local humanoidDiedCon
|
||||
|
||||
local guiTweenSpeed = 0.25 -- how quickly we open/close the backpack
|
||||
|
||||
local searchDefaultText = "Search..."
|
||||
local tilde = "~"
|
||||
local backquote = "`"
|
||||
|
||||
local backpackSize = UDim2.new(0, 600, 0, 400)
|
||||
|
||||
if robloxGui.AbsoluteSize.Y <= 320 then
|
||||
backpackSize = UDim2.new(0, 200, 0, 140)
|
||||
end
|
||||
|
||||
------------------------ End Locals ---------------------------
|
||||
|
||||
---------------------------------------- Public Event Setup ----------------------------------------
|
||||
|
||||
function createPublicEvent(eventName)
|
||||
assert(eventName, "eventName is nil")
|
||||
assert(tostring(eventName), "eventName is not a string")
|
||||
|
||||
local newEvent = Instance.new "BindableEvent"
|
||||
newEvent.Name = tostring(eventName)
|
||||
newEvent.Parent = script
|
||||
|
||||
return newEvent
|
||||
end
|
||||
|
||||
function createPublicFunction(funcName, invokeFunc)
|
||||
assert(funcName, "funcName is nil")
|
||||
assert(tostring(funcName), "funcName is not a string")
|
||||
assert(invokeFunc, "invokeFunc is nil")
|
||||
assert(
|
||||
type(invokeFunc) == "function",
|
||||
"invokeFunc should be of type 'function'"
|
||||
)
|
||||
|
||||
local newFunction = Instance.new "BindableFunction"
|
||||
newFunction.Name = tostring(funcName)
|
||||
newFunction.OnInvoke = invokeFunc
|
||||
newFunction.Parent = script
|
||||
|
||||
return newFunction
|
||||
end
|
||||
|
||||
-- Events
|
||||
local resizeEvent = createPublicEvent "ResizeEvent"
|
||||
local backpackOpenEvent = createPublicEvent "BackpackOpenEvent"
|
||||
local backpackCloseEvent = createPublicEvent "BackpackCloseEvent"
|
||||
local tabClickedEvent = createPublicEvent "TabClickedEvent"
|
||||
local searchRequestedEvent = createPublicEvent "SearchRequestedEvent"
|
||||
---------------------------------------- End Public Event Setup ----------------------------------------
|
||||
|
||||
--------------------------- Internal Functions ----------------------------------------
|
||||
|
||||
function deactivateBackpack()
|
||||
backpack.Visible = false
|
||||
active = false
|
||||
end
|
||||
|
||||
function initHumanoidDiedConnections()
|
||||
if humanoidDiedCon then
|
||||
humanoidDiedCon:disconnect()
|
||||
end
|
||||
waitForProperty(game.Players.LocalPlayer, "Character")
|
||||
waitForChild(game.Players.LocalPlayer.Character, "Humanoid")
|
||||
humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died:connect(
|
||||
deactivateBackpack
|
||||
)
|
||||
end
|
||||
|
||||
function activateBackpack()
|
||||
initHumanoidDiedConnections()
|
||||
active = true
|
||||
backpack.Visible = backpackIsOpen
|
||||
if backpackIsOpen then
|
||||
toggleBackpack()
|
||||
end
|
||||
end
|
||||
|
||||
local hideBackpack = function()
|
||||
backpackIsOpen = false
|
||||
readyForNextEvent = false
|
||||
backpackButton.Selected = false
|
||||
resetSearch()
|
||||
backpackCloseEvent:Fire(currentTab)
|
||||
backpack.Tabs.Visible = false
|
||||
searchFrame.Visible = false
|
||||
backpack:TweenSizeAndPosition(
|
||||
UDim2.new(0, backpackSize.X.Offset, 0, 0),
|
||||
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -85),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quad,
|
||||
guiTweenSpeed,
|
||||
true,
|
||||
function()
|
||||
game.GuiService:RemoveCenterDialog(backpack)
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
end
|
||||
)
|
||||
delay(guiTweenSpeed, function()
|
||||
game.GuiService:RemoveCenterDialog(backpack)
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
readyForNextEvent = true
|
||||
canToggle = true
|
||||
end)
|
||||
end
|
||||
|
||||
function showBackpack()
|
||||
game.GuiService:AddCenterDialog(
|
||||
backpack,
|
||||
Enum.CenterDialogType.PlayerInitiatedDialog,
|
||||
function()
|
||||
backpack.Visible = true
|
||||
backpackButton.Selected = true
|
||||
end,
|
||||
function()
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
end
|
||||
)
|
||||
backpack.Visible = true
|
||||
backpackButton.Selected = true
|
||||
backpack:TweenSizeAndPosition(
|
||||
backpackSize,
|
||||
UDim2.new(
|
||||
0.5,
|
||||
-backpackSize.X.Offset / 2,
|
||||
1,
|
||||
-backpackSize.Y.Offset - 88
|
||||
),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quad,
|
||||
guiTweenSpeed,
|
||||
true
|
||||
)
|
||||
delay(guiTweenSpeed, function()
|
||||
backpack.Tabs.Visible = false
|
||||
searchFrame.Visible = true
|
||||
backpackOpenEvent:Fire(currentTab)
|
||||
canToggle = true
|
||||
readyForNextEvent = true
|
||||
backpackButton.Image = "http://banland.xyz/asset/?id=97644093"
|
||||
backpackButton.Position =
|
||||
UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
|
||||
end)
|
||||
end
|
||||
|
||||
function toggleBackpack()
|
||||
if not game.Players.LocalPlayer then
|
||||
return
|
||||
end
|
||||
if not game.Players.LocalPlayer.Character then
|
||||
return
|
||||
end
|
||||
if not canToggle then
|
||||
return
|
||||
end
|
||||
if not readyForNextEvent then
|
||||
return
|
||||
end
|
||||
readyForNextEvent = false
|
||||
canToggle = false
|
||||
|
||||
backpackIsOpen = not backpackIsOpen
|
||||
|
||||
if backpackIsOpen then
|
||||
loadoutBackground.Image = "http://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
|
||||
loadoutBackground.Visible = true
|
||||
showBackpack()
|
||||
else
|
||||
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"
|
||||
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
||||
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
||||
hideBackpack()
|
||||
|
||||
local clChildren = currentLoadout:GetChildren()
|
||||
for i = 1, #clChildren do
|
||||
if clChildren[i] and clChildren[i]:IsA "Frame" then
|
||||
local frame = clChildren[i]
|
||||
if #frame:GetChildren() > 0 then
|
||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
||||
backpackButton.Visible = true
|
||||
loadoutBackground.Visible = true
|
||||
if frame:GetChildren()[1]:IsA "ImageButton" then
|
||||
local imgButton = frame:GetChildren()[1]
|
||||
imgButton.Active = true
|
||||
imgButton.Draggable = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function closeBackpack()
|
||||
if backpackIsOpen then
|
||||
toggleBackpack()
|
||||
end
|
||||
end
|
||||
|
||||
function setSelected(tab)
|
||||
assert(tab)
|
||||
assert(tab:IsA "TextButton")
|
||||
|
||||
tab.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||
tab.TextColor3 = Color3.new(0, 0, 0)
|
||||
tab.Selected = true
|
||||
tab.ZIndex = 3
|
||||
end
|
||||
|
||||
function setUnselected(tab)
|
||||
assert(tab)
|
||||
assert(tab:IsA "TextButton")
|
||||
|
||||
tab.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||
tab.TextColor3 = Color3.new(1, 1, 1)
|
||||
tab.Selected = false
|
||||
tab.ZIndex = 1
|
||||
end
|
||||
|
||||
function updateTabGui(selectedTab)
|
||||
assert(selectedTab)
|
||||
|
||||
if selectedTab == "gear" then
|
||||
setSelected(inventoryButton)
|
||||
setUnselected(wardrobeButton)
|
||||
elseif selectedTab == "wardrobe" then
|
||||
setSelected(wardrobeButton)
|
||||
setUnselected(inventoryButton)
|
||||
end
|
||||
end
|
||||
|
||||
function mouseLeaveTab(button)
|
||||
assert(button)
|
||||
assert(button:IsA "TextButton")
|
||||
|
||||
if button.Selected then
|
||||
return
|
||||
end
|
||||
|
||||
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||
end
|
||||
|
||||
function mouseOverTab(button)
|
||||
assert(button)
|
||||
assert(button:IsA "TextButton")
|
||||
|
||||
if button.Selected then
|
||||
return
|
||||
end
|
||||
|
||||
button.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255)
|
||||
end
|
||||
|
||||
function newTabClicked(tabName)
|
||||
assert(tabName)
|
||||
tabName = string.lower(tabName)
|
||||
currentTab = tabName
|
||||
|
||||
updateTabGui(tabName)
|
||||
tabClickedEvent:Fire(tabName)
|
||||
resetSearch()
|
||||
end
|
||||
|
||||
function trim(s)
|
||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
-- function splitByWhitespace(text)
|
||||
-- if type(text) ~= "string" then
|
||||
-- return nil
|
||||
-- end
|
||||
|
||||
-- local terms = {}
|
||||
-- for token in string.gmatch(text, "[^%s]+") do
|
||||
-- if string.len(token) > 0 then
|
||||
-- table.insert(terms, token)
|
||||
-- end
|
||||
-- end
|
||||
-- return terms
|
||||
-- end
|
||||
|
||||
function resetSearchBoxGui()
|
||||
resetButton.Visible = false
|
||||
searchBox.Text = searchDefaultText
|
||||
end
|
||||
|
||||
function doSearch()
|
||||
local searchText = searchBox.Text
|
||||
if searchText == "" then
|
||||
resetSearch()
|
||||
return
|
||||
end
|
||||
searchText = trim(searchText)
|
||||
resetButton.Visible = true
|
||||
-- termTable = splitByWhitespace(searchText)
|
||||
searchRequestedEvent:Fire(searchText) -- todo: replace this with termtable when table passing is possible
|
||||
end
|
||||
|
||||
function resetSearch()
|
||||
resetSearchBoxGui()
|
||||
searchRequestedEvent:Fire()
|
||||
end
|
||||
|
||||
local backpackReady = function()
|
||||
readyForNextEvent = true
|
||||
end
|
||||
|
||||
function coreGuiChanged(coreGuiType, enabled)
|
||||
if
|
||||
coreGuiType == Enum.CoreGuiType.Backpack
|
||||
or coreGuiType == Enum.CoreGuiType.All
|
||||
then
|
||||
active = enabled
|
||||
disabledByDeveloper = not enabled
|
||||
|
||||
if disabledByDeveloper then
|
||||
pcall(function()
|
||||
GuiService:RemoveKey(tilde)
|
||||
GuiService:RemoveKey(backquote)
|
||||
end)
|
||||
else
|
||||
GuiService:AddKey(tilde)
|
||||
GuiService:AddKey(backquote)
|
||||
end
|
||||
|
||||
resetSearch()
|
||||
searchFrame.Visible = enabled and backpackIsOpen
|
||||
|
||||
currentLoadout.Visible = enabled
|
||||
backpack.Visible = enabled
|
||||
backpackButton.Visible = enabled
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------- End Internal Functions -------------------------------------
|
||||
|
||||
------------------------------ Public Functions Setup -------------------------------------
|
||||
createPublicFunction("CloseBackpack", hideBackpack)
|
||||
createPublicFunction("BackpackReady", backpackReady)
|
||||
------------------------------ End Public Functions Setup ---------------------------------
|
||||
|
||||
------------------------ Connections/Script Main -------------------------------------------
|
||||
|
||||
pcall(function()
|
||||
coreGuiChanged(
|
||||
Enum.CoreGuiType.Backpack,
|
||||
Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack)
|
||||
)
|
||||
Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
|
||||
end)
|
||||
|
||||
inventoryButton.MouseButton1Click:connect(function()
|
||||
newTabClicked "gear"
|
||||
end)
|
||||
inventoryButton.MouseEnter:connect(function()
|
||||
mouseOverTab(inventoryButton)
|
||||
end)
|
||||
inventoryButton.MouseLeave:connect(function()
|
||||
mouseLeaveTab(inventoryButton)
|
||||
end)
|
||||
|
||||
if game.CoreGui.Version >= 8 then
|
||||
wardrobeButton.MouseButton1Click:connect(function()
|
||||
newTabClicked "wardrobe"
|
||||
end)
|
||||
wardrobeButton.MouseEnter:connect(function()
|
||||
mouseOverTab(wardrobeButton)
|
||||
end)
|
||||
wardrobeButton.MouseLeave:connect(function()
|
||||
mouseLeaveTab(wardrobeButton)
|
||||
end)
|
||||
end
|
||||
|
||||
closeButton.MouseButton1Click:connect(closeBackpack)
|
||||
|
||||
screen.Changed:connect(function(prop)
|
||||
if prop == "AbsoluteSize" then
|
||||
resizeEvent:Fire(screen.AbsoluteSize)
|
||||
end
|
||||
end)
|
||||
|
||||
-- GuiService key setup
|
||||
GuiService:AddKey(tilde)
|
||||
GuiService:AddKey(backquote)
|
||||
GuiService.KeyPressed:connect(function(key)
|
||||
if not active or disabledByDeveloper then
|
||||
return
|
||||
end
|
||||
if key == tilde or key == backquote then
|
||||
toggleBackpack()
|
||||
end
|
||||
end)
|
||||
backpackButton.MouseButton1Click:connect(function()
|
||||
if not active or disabledByDeveloper then
|
||||
return
|
||||
end
|
||||
toggleBackpack()
|
||||
end)
|
||||
|
||||
if game.Players.LocalPlayer.Character then
|
||||
activateBackpack()
|
||||
end
|
||||
|
||||
game.Players.LocalPlayer.CharacterAdded:connect(activateBackpack)
|
||||
|
||||
-- search functions
|
||||
searchBox.FocusLost:connect(function(enterPressed)
|
||||
if enterPressed or searchBox.Text ~= "" then
|
||||
doSearch()
|
||||
elseif searchBox.Text == "" then
|
||||
resetSearch()
|
||||
end
|
||||
end)
|
||||
searchButton.MouseButton1Click:connect(doSearch)
|
||||
resetButton.MouseButton1Click:connect(resetSearch)
|
||||
|
||||
if searchFrame and robloxGui.AbsoluteSize.Y <= 320 then
|
||||
searchFrame.RobloxLocked = false
|
||||
searchFrame:Destroy()
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,294 @@
|
|||
print "[Mercury]: Loaded Host corescript"
|
||||
-- Start Game Script Arguments
|
||||
local placeId, sleeptime, access, url, killID, deathID, timeout, injectScriptAssetID, servicesUrl, libraryRegistrationScriptAssetID
|
||||
|
||||
local InsertService = game:GetService "InsertService"
|
||||
local BadgeService = game:GetService "BadgeService"
|
||||
local FriendService = game:GetService "FriendService"
|
||||
|
||||
-- StartGame --
|
||||
pcall(function()
|
||||
game:GetService("ScriptContext"):AddStarterScript(injectScriptAssetID)
|
||||
end)
|
||||
game:GetService("RunService"):Run()
|
||||
|
||||
-- REQUIRES: StartGanmeSharedArgs.txt
|
||||
-- REQUIRES: MonitorGameStatus.txt
|
||||
|
||||
------------------- UTILITY FUNCTIONS --------------------------
|
||||
|
||||
function waitForChild(parent, childName)
|
||||
while true do
|
||||
local child = parent:findFirstChild(childName)
|
||||
if child then
|
||||
return child
|
||||
end
|
||||
parent.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
||||
-- returns the player object that killed this humanoid
|
||||
-- returns nil if the killer is no longer in the game
|
||||
function getKillerOfHumanoidIfStillInGame(humanoid)
|
||||
-- check for kill tag on humanoid - may be more than one - todo: deal with this
|
||||
local tag = humanoid:findFirstChild "creator"
|
||||
|
||||
-- find player with name on tag
|
||||
if tag then
|
||||
local killer = tag.Value
|
||||
if killer.Parent then -- killer still in game
|
||||
return killer
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- send kill and death stats when a player dies
|
||||
function onDied(victim, humanoid)
|
||||
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
|
||||
local victorId = 0
|
||||
if killer then
|
||||
victorId = killer.userId
|
||||
print("STAT: kill by " .. victorId .. " of " .. victim.userId)
|
||||
game:HttpGet(
|
||||
url .. "/Game/Knockouts.ashx?UserID=" .. victorId .. "&" .. access
|
||||
)
|
||||
end
|
||||
print("STAT: death of " .. victim.userId .. " by " .. victorId)
|
||||
game:HttpGet(
|
||||
url .. "/Game/Wipeouts.ashx?UserID=" .. victim.userId .. "&" .. access
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------END UTILITY FUNCTIONS -------------------------
|
||||
|
||||
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
|
||||
|
||||
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.ExperimentalPhysicsEnabled = true
|
||||
settings().Network.WaitingForCharacterLogRate = 100
|
||||
pcall(function()
|
||||
settings().Diagnostics:LegacyScriptMode()
|
||||
end)
|
||||
|
||||
-----------------------------------START GAME SHARED SCRIPT------------------------------
|
||||
|
||||
url = "_BASE_URL"
|
||||
|
||||
local scriptContext = game:GetService "ScriptContext"
|
||||
pcall(function()
|
||||
scriptContext:AddStarterScript(libraryRegistrationScriptAssetID)
|
||||
end)
|
||||
scriptContext.ScriptsDisabled = true
|
||||
|
||||
-- game:SetPlaceID(nil, false)
|
||||
game:GetService("ChangeHistoryService"):SetEnabled(false)
|
||||
|
||||
-- establish this peer as the Server
|
||||
local ns = game:GetService "NetworkServer"
|
||||
|
||||
if url ~= nil then
|
||||
pcall(function()
|
||||
game:GetService("Players"):SetAbuseReportUrl(
|
||||
url .. "/Report/Games.ashx"
|
||||
)
|
||||
end)
|
||||
pcall(function()
|
||||
game:GetService("ScriptInformationProvider")
|
||||
:SetAssetUrl(url .. "/Asset/")
|
||||
end)
|
||||
pcall(function()
|
||||
game:GetService("ContentProvider"):SetBaseUrl(url .. "/")
|
||||
end)
|
||||
-- pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end)
|
||||
|
||||
-- BadgeService:SetPlaceId(placeId)
|
||||
if access ~= nil then
|
||||
BadgeService:SetAwardBadgeUrl(
|
||||
url
|
||||
.. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&"
|
||||
.. access
|
||||
)
|
||||
BadgeService:SetHasBadgeUrl(
|
||||
url .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&" .. access
|
||||
)
|
||||
BadgeService:SetIsBadgeDisabledUrl(
|
||||
url
|
||||
.. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&"
|
||||
.. access
|
||||
)
|
||||
|
||||
FriendService:SetMakeFriendUrl(
|
||||
servicesUrl
|
||||
.. "/Friend/CreateFriend?firstUserId=%d&secondUserId=%d&"
|
||||
.. access
|
||||
)
|
||||
FriendService:SetBreakFriendUrl(
|
||||
servicesUrl
|
||||
.. "/Friend/BreakFriend?firstUserId=%d&secondUserId=%d&"
|
||||
.. access
|
||||
)
|
||||
FriendService:SetGetFriendsUrl(
|
||||
servicesUrl .. "/Friend/AreFriends?userId=%d&" .. access
|
||||
)
|
||||
end
|
||||
BadgeService:SetIsBadgeLegalUrl ""
|
||||
InsertService
|
||||
:SetBaseSetsUrl(
|
||||
url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base"
|
||||
)
|
||||
InsertService:SetUserSetsUrl(
|
||||
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
|
||||
:SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d")
|
||||
|
||||
pcall(function()
|
||||
loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)()
|
||||
end)
|
||||
|
||||
pcall(function()
|
||||
if access then
|
||||
loadfile(
|
||||
url
|
||||
.. "/Game/PlaceSpecificScript.ashx?PlaceId="
|
||||
.. placeId
|
||||
.. "&"
|
||||
.. access
|
||||
)()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
pcall(function()
|
||||
game:GetService("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
|
||||
function createDeathMonitor(player)
|
||||
-- we don't need to clean up old monitors or connections since the Character will be destroyed soon
|
||||
if player.Character then
|
||||
local humanoid = waitForChild(player.Character, "Humanoid")
|
||||
humanoid.Died:connect(function()
|
||||
onDied(player, humanoid)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- listen to all Players' Characters
|
||||
game:GetService("Players").ChildAdded:connect(function(player)
|
||||
createDeathMonitor(player)
|
||||
player.Changed:connect(function(property)
|
||||
if property == "Character" then
|
||||
createDeathMonitor(player)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
game:GetService("Players").PlayerAdded:connect(function(player)
|
||||
print("Player " .. player.userId .. " added")
|
||||
|
||||
if url and access and placeId and player and player.userId then
|
||||
game:HttpGet(
|
||||
url
|
||||
.. "/Game/ClientPresence.ashx?action=connect&"
|
||||
.. access
|
||||
.. "&PlaceID="
|
||||
.. placeId
|
||||
.. "&UserID="
|
||||
.. player.userId
|
||||
)
|
||||
game:HttpGet(
|
||||
url
|
||||
.. "/Game/PlaceVisit.ashx?UserID="
|
||||
.. player.userId
|
||||
.. "&AssociatedPlaceID="
|
||||
.. placeId
|
||||
.. "&"
|
||||
.. access
|
||||
)
|
||||
end
|
||||
end)
|
||||
|
||||
game:GetService("Players").PlayerRemoving:connect(function(player)
|
||||
print("Player " .. player.userId .. " leaving")
|
||||
|
||||
if url and access and placeId and player and player.userId then
|
||||
game:HttpGet(
|
||||
url
|
||||
.. "/Game/ClientPresence.ashx?action=disconnect&"
|
||||
.. access
|
||||
.. "&PlaceID="
|
||||
.. placeId
|
||||
.. "&UserID="
|
||||
.. player.userId
|
||||
)
|
||||
end
|
||||
end)
|
||||
|
||||
if placeId ~= nil and url ~= nil then
|
||||
-- yield so that file load happens in the heartbeat thread
|
||||
wait()
|
||||
|
||||
-- load the game
|
||||
game:Load(url .. "/asset/?id=" .. placeId)
|
||||
end
|
||||
|
||||
if _MAP_LOCATION_EXISTS then
|
||||
-- yield so that file load happens in the heartbeat thread
|
||||
wait()
|
||||
|
||||
-- load the game
|
||||
game:Load "_MAP_LOCATION"
|
||||
end
|
||||
|
||||
-- Now start the connection
|
||||
ns:Start(_SERVER_PORT, sleeptime)
|
||||
|
||||
game:GetService("Visit"):SetPing("_SERVER_PRESENCE_URL", 30)
|
||||
|
||||
if timeout then
|
||||
scriptContext:SetTimeout(timeout)
|
||||
end
|
||||
scriptContext.ScriptsDisabled = false
|
||||
|
||||
--delay(1, function()
|
||||
-- loadfile(url .. "/analytics/GamePerfMonitor.ashx")(game.JobId, placeId)
|
||||
--end)
|
||||
|
||||
local reset = ";mc"
|
||||
game.Players.PlayerAdded:connect(function(player)
|
||||
player.Chatted:connect(function(msg)
|
||||
if msg == reset then
|
||||
if player.Character then
|
||||
player.Character.Humanoid.Health = 0
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -0,0 +1,298 @@
|
|||
print "[Mercury]: Loaded Join corescript"
|
||||
local InsertService = game:GetService "InsertService"
|
||||
local ChangeHistoryService = game:GetService "ChangeHistoryService"
|
||||
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"
|
||||
|
||||
local player, connectionFailed
|
||||
|
||||
-- MultiplayerSharedScript.lua inserted here ------ Prepended to Join.lua --
|
||||
|
||||
pcall(function()
|
||||
game:SetPlaceID(_PLACE_ID, false)
|
||||
end)
|
||||
|
||||
-- if we are on a touch device, no blocking http calls allowed! This can cause a crash on iOS
|
||||
-- In general we need a long term strategy to remove blocking http calls from all platforms
|
||||
-- local isTouchDevice = UserInputService.TouchEnabled
|
||||
|
||||
settings()["Game Options"].CollisionSoundEnabled = true
|
||||
pcall(function()
|
||||
settings().Rendering.EnableFRM = true
|
||||
end)
|
||||
pcall(function()
|
||||
settings().Physics.Is30FpsThrottleEnabled = false
|
||||
end)
|
||||
pcall(function()
|
||||
settings()["Task Scheduler"].PriorityMethod =
|
||||
Enum.PriorityMethod.AccumulatedError
|
||||
end)
|
||||
pcall(function()
|
||||
settings().Physics.PhysicsEnvironmentalThrottle =
|
||||
Enum.EnviromentalPhysicsThrottle.DefaultAuto
|
||||
end)
|
||||
|
||||
-- arguments ---------------------------------------
|
||||
local threadSleepTime = ...
|
||||
|
||||
if threadSleepTime == nil then
|
||||
threadSleepTime = 15
|
||||
end
|
||||
|
||||
local test = _IS_STUDIO_JOIN
|
||||
|
||||
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"
|
||||
|
||||
pcall(function()
|
||||
SocialService:SetFriendUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
SocialService:SetGroupUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
SocialService:SetGroupRoleUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
MarketplaceService:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d"
|
||||
end)
|
||||
pcall(function()
|
||||
MarketplaceService:SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d"
|
||||
end)
|
||||
pcall(function()
|
||||
game:SetCreatorID(_CREATOR_ID, Enum.CreatorType.User)
|
||||
end)
|
||||
|
||||
-- Bubble chat. This is all-encapsulated to allow us to turn it off with a config setting
|
||||
pcall(function()
|
||||
Players:SetChatStyle(Enum.ChatStyle.ClassicAndBubble)
|
||||
end)
|
||||
|
||||
waitingForCharacter = false
|
||||
pcall(function()
|
||||
if settings().Network.MtuOverride == 0 then
|
||||
settings().Network.MtuOverride = 1400
|
||||
end
|
||||
end)
|
||||
|
||||
-- functions ---------------------------------------
|
||||
function setMessage(message: string)
|
||||
-- todo: animated "..."
|
||||
game:SetMessage(message)
|
||||
end
|
||||
|
||||
function showErrorWindow(message, _, _)
|
||||
game:SetMessage(message)
|
||||
end
|
||||
|
||||
function reportError(err, message)
|
||||
print("***ERROR*** " .. err)
|
||||
if not test then
|
||||
Visit:SetUploadUrl ""
|
||||
end
|
||||
Client:Disconnect()
|
||||
wait(4)
|
||||
showErrorWindow("Error: " .. err, message, "Other")
|
||||
end
|
||||
|
||||
-- called when the client connection closes
|
||||
function onDisconnection(_, lostConnection)
|
||||
if lostConnection then
|
||||
showErrorWindow(
|
||||
"You have lost the connection to the game",
|
||||
"LostConnection",
|
||||
"LostConnection"
|
||||
)
|
||||
else
|
||||
showErrorWindow("This game has shut down", "Kick", "Kick")
|
||||
end
|
||||
end
|
||||
|
||||
function requestCharacter(replicator)
|
||||
-- prepare code for when the Character appears
|
||||
local connection
|
||||
connection = player.Changed:connect(function(property)
|
||||
if property == "Character" then
|
||||
game:ClearMessage()
|
||||
waitingForCharacter = false
|
||||
connection:disconnect()
|
||||
end
|
||||
end)
|
||||
|
||||
setMessage "Requesting character"
|
||||
|
||||
local success, err = pcall(function()
|
||||
replicator:RequestCharacter()
|
||||
setMessage "Waiting for character"
|
||||
waitingForCharacter = true
|
||||
end)
|
||||
|
||||
if not success then
|
||||
reportError(err, "W4C")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- called when the client connection is established
|
||||
function onConnectionAccepted(_, replicator)
|
||||
connectResolved = true
|
||||
|
||||
local waitingForMarker = true
|
||||
|
||||
local success, err = pcall(function()
|
||||
if not test then
|
||||
Visit:SetPing("_PING_URL", 30)
|
||||
end
|
||||
|
||||
game:SetMessageBrickCount()
|
||||
|
||||
replicator.Disconnection:connect(onDisconnection)
|
||||
|
||||
-- Wait for a marker to return before creating the Player
|
||||
local marker = replicator:SendMarker()
|
||||
|
||||
marker.Received:connect(function()
|
||||
waitingForMarker = false
|
||||
requestCharacter(replicator)
|
||||
end)
|
||||
end)
|
||||
|
||||
if not success then
|
||||
reportError(err, "ConnectionAccepted")
|
||||
return
|
||||
end
|
||||
|
||||
-- TODO: report marker progress
|
||||
|
||||
while waitingForMarker do
|
||||
workspace:ZoomToExtents()
|
||||
wait(0.5)
|
||||
end
|
||||
end
|
||||
|
||||
-- called when the client connection fails
|
||||
function onConnectionFailed(_, error)
|
||||
showErrorWindow(
|
||||
"Failed to connect to the Game. (ID=" .. error .. ")",
|
||||
"ID" .. error,
|
||||
"Other"
|
||||
)
|
||||
end
|
||||
|
||||
-- called when the client connection is rejected
|
||||
function onConnectionRejected()
|
||||
connectionFailed:disconnect()
|
||||
showErrorWindow(
|
||||
"This game is not available. Please try another",
|
||||
"WrongVersion",
|
||||
"WrongVersion"
|
||||
)
|
||||
end
|
||||
|
||||
local idled = false
|
||||
function onPlayerIdled(time)
|
||||
if time > 20 * 60 then
|
||||
showErrorWindow(
|
||||
string.format(
|
||||
"You were disconnected for being idle %d minutes",
|
||||
time / 60
|
||||
),
|
||||
"Idle",
|
||||
"Idle"
|
||||
)
|
||||
Client:disconnect()
|
||||
if not idled then
|
||||
idled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- main ------------------------------------------------------------
|
||||
|
||||
pcall(function()
|
||||
settings().Diagnostics:LegacyScriptMode()
|
||||
end)
|
||||
local success, err = pcall(function()
|
||||
game:SetRemoteBuildMode(true)
|
||||
|
||||
setMessage "Connecting to Server"
|
||||
Client.ConnectionAccepted:connect(onConnectionAccepted)
|
||||
Client.ConnectionRejected:connect(onConnectionRejected)
|
||||
connectionFailed = Client.ConnectionFailed:connect(onConnectionFailed)
|
||||
Client.Ticket = ""
|
||||
|
||||
local playerConnectSuccess
|
||||
playerConnectSuccess, player = pcall(function()
|
||||
return Client:PlayerConnect(
|
||||
_USER_ID,
|
||||
"_SERVER_ADDRESS",
|
||||
_SERVER_PORT,
|
||||
0,
|
||||
threadSleepTime
|
||||
)
|
||||
end)
|
||||
if not playerConnectSuccess then
|
||||
--Old player connection scheme
|
||||
player = Players:CreateLocalPlayer(_USER_ID)
|
||||
Client:Connect("_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime)
|
||||
end
|
||||
|
||||
player:SetSuperSafeChat(false)
|
||||
pcall(function()
|
||||
player:SetUnder13(false)
|
||||
end)
|
||||
pcall(function()
|
||||
player:SetMembershipType(Enum.MembershipType._MEMBERSHIP_TYPE)
|
||||
end)
|
||||
pcall(function()
|
||||
player:SetAccountAge(1)
|
||||
end)
|
||||
player.Idled:connect(onPlayerIdled)
|
||||
|
||||
pcall(function()
|
||||
player.Name = [========[_USER_NAME]========]
|
||||
end)
|
||||
player.CharacterAppearance = "_CHAR_APPEARANCE"
|
||||
if not test then
|
||||
Visit:SetUploadUrl ""
|
||||
end
|
||||
end)
|
||||
|
||||
if not success then
|
||||
reportError(err, "CreatePlayer")
|
||||
end
|
||||
|
||||
if not test then
|
||||
-- TODO: Async get?
|
||||
loadfile ""("", -1, 0)
|
||||
end
|
||||
|
||||
pcall(function()
|
||||
game:SetScreenshotInfo ""
|
||||
end)
|
||||
pcall(function()
|
||||
game:SetVideoInfo '<?xml version="1.0"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"><media:group><media:title type="plain"><![CDATA[Mercury Place]]></media:title><media:description type="plain"><![CDATA[ For more games visit http://banland.xyz]]></media:description><media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Games</media:category><media:keywords>Mercury, video, free game, online virtual world</media:keywords></media:group></entry>'
|
||||
end)
|
||||
-- use single quotes here because the video info string may have unescaped double quotes
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
print "[Mercury]: Loaded Studio corescript"
|
||||
local MarketplaceService = game:GetService "MarketplaceService"
|
||||
local InsertService = game:GetService "InsertService"
|
||||
local SocialService = game:GetService "SocialService"
|
||||
local GamePassService = game:GetService "GamePassService"
|
||||
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"
|
||||
end)
|
||||
pcall(function()
|
||||
InsertService:SetFreeDecalUrl "http://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"
|
||||
InsertService:SetTrustLevel(0)
|
||||
|
||||
pcall(function()
|
||||
SocialService:SetFriendUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
SocialService:SetGroupUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
SocialService:SetGroupRoleUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
MarketplaceService:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d"
|
||||
end)
|
||||
pcall(function()
|
||||
MarketplaceService:SetDevProductInfoUrl "https://banland.xyz/marketplace/productDetails?productId=%d"
|
||||
end)
|
||||
pcall(function()
|
||||
MarketplaceService:SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d"
|
||||
end)
|
||||
|
||||
local result, _ = pcall(function()
|
||||
ScriptContext:AddStarterScript(37801172)
|
||||
end)
|
||||
if not result then
|
||||
pcall(function()
|
||||
ScriptContext:AddCoreScript(
|
||||
37801172,
|
||||
game:GetService "ScriptContext",
|
||||
"StarterScript"
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
print "[Mercury]: Loaded Visit corescript"
|
||||
local ChangeHistoryService = game:GetService "ChangeHistoryService"
|
||||
local InsertService = game:GetService "InsertService"
|
||||
local Players = game:GetService "Players"
|
||||
local RunService = game:GetService "RunService"
|
||||
local ScriptInformationProvider = game:GetService "ScriptInformationProvider"
|
||||
local SocialService = game:GetService "SocialService"
|
||||
local CoreGui = game:GetService "CoreGui"
|
||||
local ContentProvider = game:GetService "ContentProvider"
|
||||
local GamePassService = game:GetService "GamePassService"
|
||||
local Visit = game:GetService "Visit"
|
||||
local ScriptContext = game:GetService "ScriptContext"
|
||||
|
||||
local player
|
||||
|
||||
-- Prepended to Edit.lua and Visit.lua and Studio.lua and PlaySolo.lua--
|
||||
|
||||
pcall(function()
|
||||
return game:SetPlaceID(_PLACE_ID)
|
||||
end)
|
||||
|
||||
local message = Instance.new "Message"
|
||||
|
||||
message.Parent = workspace
|
||||
message.archivable = false
|
||||
|
||||
ScriptInformationProvider:SetAssetUrl "http://banland.xyz/Asset/"
|
||||
ContentProvider:SetThreadPool(16)
|
||||
pcall(function()
|
||||
InsertService:SetFreeModelUrl "http://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"
|
||||
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"
|
||||
|
||||
pcall(function()
|
||||
SocialService:SetFriendUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
SocialService:SetGroupUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
SocialService:SetGroupRoleUrl "http://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"
|
||||
end)
|
||||
pcall(function()
|
||||
game:SetCreatorID(0, Enum.CreatorType.User)
|
||||
end)
|
||||
|
||||
pcall(function()
|
||||
game:SetScreenshotInfo ""
|
||||
end)
|
||||
pcall(function()
|
||||
game:SetVideoInfo ""
|
||||
end)
|
||||
|
||||
pcall(function()
|
||||
settings().Rendering.EnableFRM = true
|
||||
end)
|
||||
pcall(function()
|
||||
settings()["Task Scheduler"].PriorityMethod =
|
||||
Enum.PriorityMethod.AccumulatedError
|
||||
end)
|
||||
|
||||
ChangeHistoryService:SetEnabled(false)
|
||||
pcall(function()
|
||||
Players:SetBuildUserPermissionsUrl "http://banland.xyz/Game/BuildActionPermissionCheck.ashx?assetId=0&userId=%d&isSolo=true"
|
||||
end)
|
||||
|
||||
workspace:SetPhysicsThrottleEnabled(true)
|
||||
|
||||
local addedBuildTools = false
|
||||
local screenGui = CoreGui:FindFirstChild "RobloxGui"
|
||||
|
||||
function doVisit()
|
||||
message.Text = "Loading Game"
|
||||
|
||||
pcall(function()
|
||||
Visit:SetUploadUrl ""
|
||||
end)
|
||||
|
||||
message.Text = "Running"
|
||||
RunService:Run()
|
||||
|
||||
message.Text = "Creating Player"
|
||||
|
||||
player = game:GetService("Players"):CreateLocalPlayer(0)
|
||||
|
||||
player.CharacterAppearance = ""
|
||||
local propExists, canAutoLoadChar = false, false
|
||||
propExists = pcall(function()
|
||||
canAutoLoadChar = game.Players.CharacterAutoLoads
|
||||
end)
|
||||
|
||||
if (propExists and canAutoLoadChar) or not propExists then
|
||||
player:LoadCharacter()
|
||||
end
|
||||
|
||||
message.Text = "Setting GUI"
|
||||
player:SetSuperSafeChat(true)
|
||||
pcall(function()
|
||||
player:SetMembershipType(Enum.MembershipType.None)
|
||||
end)
|
||||
pcall(function()
|
||||
player:SetAccountAge(0)
|
||||
end)
|
||||
end
|
||||
|
||||
local success, err = pcall(doVisit)
|
||||
|
||||
if not addedBuildTools then
|
||||
local playerName = Instance.new "StringValue"
|
||||
playerName.Name = "PlayerName"
|
||||
playerName.Value = player.Name
|
||||
playerName.RobloxLocked = true
|
||||
playerName.Parent = screenGui
|
||||
|
||||
pcall(function()
|
||||
ScriptContext:AddCoreScript(59431535, screenGui, "BuildToolsScript")
|
||||
end)
|
||||
addedBuildTools = true
|
||||
end
|
||||
|
||||
if success then
|
||||
message.Parent = nil
|
||||
else
|
||||
print(err)
|
||||
|
||||
wait(5)
|
||||
message.Text = "Error on visit: " .. err
|
||||
end
|
||||
9571
mercury.yml
9571
mercury.yml
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +0,0 @@
|
|||
std = "mercury"
|
||||
|
||||
[lints]
|
||||
multiple_statements = "allow"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Tabs"
|
||||
indent_width = 4
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "None"
|
||||
1142
yue/107893730.yue
1142
yue/107893730.yue
File diff suppressed because it is too large
Load Diff
|
|
@ -1,247 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- ContextActionTouch.lua
|
||||
-- Created by Ben Tkacheff
|
||||
-- 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
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
-- Variables
|
||||
contextActionService = Game\GetService "ContextActionService"
|
||||
isTouchDevice = Game\GetService"UserInputService".TouchEnabled
|
||||
functionTable = {}
|
||||
buttonVector = {}
|
||||
local buttonScreenGui
|
||||
local buttonFrame
|
||||
|
||||
ContextDownImage = "http://www.banland.xyz/asset/?id=97166756"
|
||||
ContextUpImage = "http://www.banland.xyz/asset/?id=97166444"
|
||||
|
||||
oldTouches = {}
|
||||
|
||||
buttonPositionTable =
|
||||
* UDim2.new 0, 123, 0, 70
|
||||
* UDim2.new 0, 30, 0, 60
|
||||
* UDim2.new 0, 180, 0, 160
|
||||
* UDim2.new 0, 85, 0, -25
|
||||
* UDim2.new 0, 185, 0, -25
|
||||
* UDim2.new 0, 185, 0, 260
|
||||
* UDim2.new 0, 216, 0, 65
|
||||
|
||||
maxButtons = #buttonPositionTable
|
||||
|
||||
-- Preload images
|
||||
with Game\GetService"ContentProvider"
|
||||
\Preload ContextDownImage
|
||||
\Preload ContextUpImage
|
||||
|
||||
wait! until Game.Players
|
||||
wait! until Game.Players.LocalPlayer
|
||||
|
||||
createContextActionGui = ->
|
||||
if not buttonScreenGui and isTouchDevice
|
||||
buttonScreenGui = New "ScreenGui", "ContextActionGui"
|
||||
* New "Frame", "ContextButtonFrame"
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 0.3, 0, 0.5, 0
|
||||
Position: UDim2.new 0.7, 0, 0.5, 0
|
||||
|
||||
-- functions
|
||||
-- setButtonSizeAndPosition = (object) ->
|
||||
-- buttonSize = 55
|
||||
-- xOffset = 10
|
||||
-- yOffset = 95
|
||||
|
||||
-- -- todo: better way to determine mobile sized screens
|
||||
-- onSmallScreen = game.CoreGui.RobloxGui.AbsoluteSize.X < 600
|
||||
-- if not onSmallScreen
|
||||
-- buttonSize = 85
|
||||
-- xOffset = 40
|
||||
|
||||
-- object.Size = UDim2.new 0, buttonSize, 0, buttonSize
|
||||
|
||||
contextButtonDown = (button, inputObject, actionName) ->
|
||||
if inputObject.UserInputType == Enum.UserInputType.Touch
|
||||
button.Image = ContextDownImage
|
||||
contextActionService\CallFunction actionName, Enum.UserInputState.Begin
|
||||
|
||||
contextButtonMoved = (button, inputObject, actionName) ->
|
||||
if inputObject.UserInputType == Enum.UserInputType.Touch
|
||||
button.Image = ContextDownImage
|
||||
contextActionService\CallFunction actionName, Enum.UserInputState.Change
|
||||
|
||||
contextButtonUp = (button, inputObject, actionName) ->
|
||||
button.Image = ContextUpImage
|
||||
if inputObject.UserInputType == Enum.UserInputType.Touch and
|
||||
inputObject.UserInputState == Enum.UserInputState.End
|
||||
|
||||
contextActionService\CallFunction actionName, Enum.UserInputState.End, inputObject
|
||||
|
||||
isSmallScreenDevice = ->
|
||||
Game\GetService"GuiService"\GetScreenResolution!.y <= 320
|
||||
|
||||
createNewButton = (actionName, functionInfoTable) ->
|
||||
contextButton = New "ImageButton", "ContextActionButton"
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new if isSmallScreenDevice!
|
||||
0, 90, 0, 90
|
||||
else
|
||||
0, 70, 0, 70
|
||||
Active: true
|
||||
Image: ContextUpImage
|
||||
Parent: buttonFrame
|
||||
|
||||
local currentButtonTouch
|
||||
|
||||
Game\GetService"UserInputService".InputEnded\connect (inputObject) ->
|
||||
oldTouches[inputObject] = nil
|
||||
|
||||
contextButton.InputBegan\connect (inputObject) ->
|
||||
return if oldTouches[inputObject]
|
||||
|
||||
if inputObject.UserInputState == Enum.UserInputState.Begin and not currentButtonTouch?
|
||||
currentButtonTouch = inputObject
|
||||
contextButtonDown contextButton, inputObject, actionName
|
||||
|
||||
contextButton.InputChanged\connect (inputObject) ->
|
||||
return if oldTouches[inputObject] or
|
||||
currentButtonTouch ~= inputObject
|
||||
|
||||
contextButtonMoved contextButton, inputObject, actionName
|
||||
|
||||
contextButton.InputEnded\connect (inputObject) ->
|
||||
return if oldTouches[inputObject] or
|
||||
currentButtonTouch ~= inputObject
|
||||
|
||||
currentButtonTouch = nil
|
||||
oldTouches[inputObject] = true
|
||||
contextButtonUp contextButton, inputObject, actionName
|
||||
|
||||
actionIcon = New "ImageLabel", "ActionIcon"
|
||||
Position: UDim2.new 0.175, 0, 0.175, 0
|
||||
Size: UDim2.new 0.65, 0, 0.65, 0
|
||||
BackgroundTransparency: 1
|
||||
|
||||
if functionInfoTable["image"] and type(functionInfoTable["image"]) == "string"
|
||||
actionIcon.Image = functionInfoTable["image"]
|
||||
|
||||
actionIcon.Parent = contextButton
|
||||
|
||||
actionTitle = New "TextLabel", "ActionTitle"
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.SourceSansBold
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextStrokeTransparency: 0
|
||||
FontSize: Enum.FontSize.Size18
|
||||
TextWrapped: true
|
||||
Text: ""
|
||||
|
||||
if functionInfoTable["title"] and type(functionInfoTable["title"]) == "string"
|
||||
actionTitle.Text = functionInfoTable["title"]
|
||||
|
||||
actionTitle.Parent = contextButton
|
||||
|
||||
contextButton
|
||||
|
||||
createButton = (actionName, functionInfoTable) ->
|
||||
button = createNewButton actionName, functionInfoTable
|
||||
|
||||
local position
|
||||
for i = 1, #buttonVector
|
||||
if buttonVector[i] == "empty"
|
||||
position = i
|
||||
break
|
||||
|
||||
if not position
|
||||
position = #buttonVector + 1
|
||||
|
||||
-- todo: let user know we have too many buttons already?
|
||||
return if position > maxButtons
|
||||
|
||||
buttonVector[position] = button
|
||||
functionTable[actionName]["button"] = button
|
||||
|
||||
button.Position = buttonPositionTable[position]
|
||||
button.Parent = buttonFrame
|
||||
|
||||
if buttonScreenGui and not buttonScreenGui.Parent?
|
||||
buttonScreenGui.Parent = Game.Players.LocalPlayer.PlayerGui
|
||||
|
||||
removeAction = (actionName) ->
|
||||
return if not functionTable[actionName]
|
||||
|
||||
actionButton = functionTable[actionName]["button"]
|
||||
|
||||
if actionButton
|
||||
actionButton.Parent = nil
|
||||
|
||||
for i in *buttonVector
|
||||
if i == actionButton
|
||||
i = "empty"
|
||||
break
|
||||
|
||||
actionButton\Destroy!
|
||||
|
||||
functionTable[actionName] = nil
|
||||
|
||||
addAction = (actionName, createTouchButton, functionInfoTable) ->
|
||||
if functionTable[actionName]
|
||||
removeAction actionName
|
||||
|
||||
functionTable[actionName] = { functionInfoTable }
|
||||
if createTouchButton and isTouchDevice
|
||||
createContextActionGui!
|
||||
createButton actionName, functionInfoTable
|
||||
|
||||
-- Connections
|
||||
contextActionService.BoundActionChanged\connect (actionName, changeName, changeTable) ->
|
||||
if functionTable[actionName] and changeTable
|
||||
if button = functionTable[actionName]["button"]
|
||||
if changeName == "image"
|
||||
button.ActionIcon.Image = changeTable[changeName]
|
||||
elseif changeName == "title"
|
||||
button.ActionTitle.Text = changeTable[changeName]
|
||||
-- elseif changeName == "description"
|
||||
-- -- todo: add description to menu
|
||||
elseif changeName == "position"
|
||||
button.Position = changeTable[changeName]
|
||||
|
||||
contextActionService.BoundActionAdded\connect (actionName, createTouchButton, functionInfoTable) ->
|
||||
addAction actionName, createTouchButton, functionInfoTable
|
||||
|
||||
contextActionService.BoundActionRemoved\connect (actionName, _) ->
|
||||
removeAction actionName
|
||||
|
||||
contextActionService.GetActionButtonEvent\connect (actionName) ->
|
||||
if functionTable[actionName]
|
||||
contextActionService\FireActionButtonFoundSignal actionName, functionTable[actionName]["button"]
|
||||
|
||||
-- make sure any bound data before we setup connections is handled
|
||||
boundActions = contextActionService\GetAllBoundActionInfo!
|
||||
for actionName, actionData in pairs boundActions
|
||||
addAction actionName, actionData["createTouchButton"], actionData
|
||||
|
|
@ -1,578 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- 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.
|
||||
-- Written by Ben Tkacheff, Roblox 2013
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
-- obligatory stuff to make sure we don't access nil data
|
||||
wait! until Game
|
||||
wait! until Game\FindFirstChild "Players"
|
||||
wait! until Game.Players.LocalPlayer
|
||||
wait! until Game\FindFirstChild "CoreGui"
|
||||
wait! until Game.CoreGui\FindFirstChild "RobloxGui"
|
||||
|
||||
userInputService = Game\GetService "UserInputService"
|
||||
success = try
|
||||
userInputService\IsLuaTouchControls!
|
||||
|
||||
if not success
|
||||
script\Destroy!
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
screenResolution = Game\GetService"GuiService"\GetScreenResolution!
|
||||
isSmallScreenDevice = ->
|
||||
return screenResolution.y <= 320
|
||||
|
||||
|
||||
localPlayer = Game.Players.LocalPlayer
|
||||
thumbstickSize = 120
|
||||
if isSmallScreenDevice!
|
||||
thumbstickSize = 70
|
||||
|
||||
|
||||
touchControlsSheet = "rbxasset://textures/ui/TouchControlsSheet.png"
|
||||
ThumbstickDeadZone = 5
|
||||
ThumbstickMaxPercentGive = 0.92
|
||||
thumbstickTouches = {}
|
||||
|
||||
jumpButtonSize = 90
|
||||
if isSmallScreenDevice!
|
||||
jumpButtonSize = 70
|
||||
|
||||
oldJumpTouches = {}
|
||||
local currentJumpTouch
|
||||
|
||||
CameraRotateSensitivity = 0.007
|
||||
CameraRotateDeadZone = CameraRotateSensitivity * 16
|
||||
CameraZoomSensitivity = 0.03
|
||||
PinchZoomDelay = 0.2
|
||||
local cameraTouch
|
||||
|
||||
-- make sure all of our images are good to go
|
||||
Game\GetService"ContentProvider"\Preload touchControlsSheet
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
|
||||
DistanceBetweenTwoPoints = (point1, point2) ->
|
||||
dx = point2.x - point1.x
|
||||
dy = point2.y - point1.y
|
||||
math.sqrt dx * dx + dy * dy
|
||||
|
||||
|
||||
transformFromCenterToTopLeft = (pointToTranslate, guiObject) ->
|
||||
UDim2.new(
|
||||
0,
|
||||
pointToTranslate.x - guiObject.AbsoluteSize.x / 2,
|
||||
0,
|
||||
pointToTranslate.y - guiObject.AbsoluteSize.y / 2
|
||||
)
|
||||
|
||||
|
||||
rotatePointAboutLocation = (pointToRotate, pointToRotateAbout, radians) ->
|
||||
sinAnglePercent = math.sin radians
|
||||
cosAnglePercent = math.cos radians
|
||||
|
||||
transformedPoint = pointToRotate
|
||||
|
||||
-- translate point back to origin:
|
||||
transformedPoint = Vector2.new transformedPoint.x - pointToRotateAbout.x, transformedPoint.y - pointToRotateAbout.y
|
||||
|
||||
-- rotate point
|
||||
xNew = transformedPoint.x * cosAnglePercent - transformedPoint.y * sinAnglePercent
|
||||
yNew = transformedPoint.x * sinAnglePercent + transformedPoint.y * cosAnglePercent
|
||||
|
||||
-- translate point back:
|
||||
transformedPoint = Vector2.new xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y
|
||||
|
||||
transformedPoint
|
||||
|
||||
|
||||
dotProduct = (v1, v2) -> v1.x * v2.x + v1.y * v2.y
|
||||
|
||||
|
||||
stationaryThumbstickTouchMove = (thumbstickFrame, thumbstickOuter, touchLocation) ->
|
||||
thumbstickOuterCenterPosition = Vector2.new(
|
||||
thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2,
|
||||
thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2
|
||||
)
|
||||
centerDiff = DistanceBetweenTwoPoints touchLocation, thumbstickOuterCenterPosition
|
||||
|
||||
-- thumbstick is moving outside our region, need to cap its distance
|
||||
if centerDiff > (thumbstickSize / 2)
|
||||
thumbVector = Vector2.new(
|
||||
touchLocation.x - thumbstickOuterCenterPosition.x,
|
||||
touchLocation.y - thumbstickOuterCenterPosition.y
|
||||
)
|
||||
normal = thumbVector.unit
|
||||
if normal.x == math.nan or normal.x == math.inf
|
||||
normal = Vector2.new 0, normal.y
|
||||
|
||||
if normal.y == math.nan or normal.y == math.inf
|
||||
normal = Vector2.new normal.x, 0
|
||||
|
||||
|
||||
newThumbstickInnerPosition = thumbstickOuterCenterPosition + (normal * (thumbstickSize / 2))
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft newThumbstickInnerPosition, thumbstickFrame
|
||||
else
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft touchLocation, thumbstickFrame
|
||||
|
||||
|
||||
Vector2.new(
|
||||
thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,
|
||||
thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset
|
||||
)
|
||||
|
||||
|
||||
followThumbstickTouchMove = (thumbstickFrame, thumbstickOuter, touchLocation) ->
|
||||
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
|
||||
thumbstickInnerCenter = Vector2.new(
|
||||
thumbstickFrame.Position.X.Offset + thumbstickFrame.AbsoluteSize.x / 2,
|
||||
thumbstickFrame.Position.Y.Offset + thumbstickFrame.AbsoluteSize.y / 2
|
||||
)
|
||||
movementVectorUnit = Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y).unit
|
||||
|
||||
outerToInnerVectorCurrent = Vector2.new(
|
||||
thumbstickInnerCenter.x - thumbstickOuterCenter.x,
|
||||
thumbstickInnerCenter.y - thumbstickOuterCenter.y
|
||||
)
|
||||
outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit
|
||||
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
|
||||
crossOuterToInnerWithMovement = (outerToInnerVectorCurrentUnit.x * movementVectorUnit.y) -
|
||||
(outerToInnerVectorCurrentUnit.y * movementVectorUnit.x)
|
||||
angle = math.atan2 crossOuterToInnerWithMovement, dotProduct outerToInnerVectorCurrentUnit, movementVectorUnit
|
||||
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
|
||||
outerThumbCenter = rotatePointAboutLocation thumbstickOuterCenter, thumbstickInnerCenter, anglePercent
|
||||
thumbstickOuter.Position = transformFromCenterToTopLeft Vector2.new(outerThumbCenter.x, outerThumbCenter.y), thumbstickOuter
|
||||
|
||||
|
||||
-- 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
|
||||
)
|
||||
|
||||
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft touchLocation, thumbstickFrame
|
||||
|
||||
-- a bit of error checking to make sure thumbsticks stay close to eachother
|
||||
thumbstickFramePosition = Vector2.new thumbstickFrame.Position.X.Offset, thumbstickFrame.Position.Y.Offset
|
||||
thumbstickOuterPosition = Vector2.new thumbstickOuter.Position.X.Offset, thumbstickOuter.Position.Y.Offset
|
||||
if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize / 2
|
||||
vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize / 2
|
||||
thumbstickOuter.Position = UDim2.new(
|
||||
0,
|
||||
thumbstickFramePosition.x + vectorWithLength.x,
|
||||
0,
|
||||
thumbstickFramePosition.y + vectorWithLength.y
|
||||
)
|
||||
|
||||
|
||||
Vector2.new(
|
||||
thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,
|
||||
thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset
|
||||
)
|
||||
|
||||
|
||||
movementOutsideDeadZone = (movementVector) ->
|
||||
(math.abs(movementVector.x) > ThumbstickDeadZone) or (math.abs(movementVector.y) > ThumbstickDeadZone)
|
||||
|
||||
|
||||
constructThumbstick = (defaultThumbstickPos, updateFunction, stationaryThumbstick) ->
|
||||
thumbstickFrame = New "Frame", "ThumbstickFrame"
|
||||
Active: true
|
||||
Size: UDim2.new 0, thumbstickSize, 0, thumbstickSize
|
||||
Position: defaultThumbstickPos
|
||||
BackgroundTransparency: 1
|
||||
|
||||
New "ImageLabel", "InnerThumbstick"
|
||||
Image: touchControlsSheet
|
||||
ImageRectOffset: Vector2.new 220, 0
|
||||
ImageRectSize: Vector2.new 111, 111
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 0, thumbstickSize / 2, 0, thumbstickSize / 2
|
||||
Position: UDim2.new(
|
||||
0,
|
||||
thumbstickFrame.Size.X.Offset / 2 - thumbstickSize / 4,
|
||||
0,
|
||||
thumbstickFrame.Size.Y.Offset / 2 - thumbstickSize / 4
|
||||
)
|
||||
ZIndex: 2
|
||||
Parent: thumbstickFrame
|
||||
|
||||
outerThumbstick = New "ImageLabel", "OuterThumbstick"
|
||||
Image: touchControlsSheet
|
||||
ImageRectOffset: Vector2.new 0, 0
|
||||
ImageRectSize: Vector2.new 220, 220
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 0, thumbstickSize, 0, thumbstickSize
|
||||
Position: defaultThumbstickPos
|
||||
Parent: Game.CoreGui.RobloxGui
|
||||
|
||||
|
||||
local thumbstickTouch
|
||||
local userInputServiceTouchMovedCon
|
||||
local userInputSeviceTouchEndedCon
|
||||
|
||||
startInputTracking = (inputObject) ->
|
||||
return if thumbstickTouch
|
||||
return if inputObject == cameraTouch
|
||||
return if inputObject == currentJumpTouch
|
||||
return if inputObject.UserInputType ~= Enum.UserInputType.Touch
|
||||
|
||||
thumbstickTouch = inputObject
|
||||
table.insert thumbstickTouches, thumbstickTouch
|
||||
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft thumbstickTouch.Position, thumbstickFrame
|
||||
outerThumbstick.Position = thumbstickFrame.Position
|
||||
|
||||
userInputServiceTouchMovedCon = userInputService.TouchMoved\connect (movedInput) ->
|
||||
if movedInput == thumbstickTouch
|
||||
local movementVector
|
||||
if stationaryThumbstick
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
if updateFunction
|
||||
updateFunction movementVector, outerThumbstick.Size.X.Offset / 2
|
||||
|
||||
|
||||
userInputSeviceTouchEndedCon = userInputService.TouchEnded\connect (endedInput) ->
|
||||
if endedInput == thumbstickTouch
|
||||
if updateFunction
|
||||
updateFunction Vector2.new(0, 0), 1
|
||||
|
||||
|
||||
userInputSeviceTouchEndedCon\disconnect!
|
||||
userInputServiceTouchMovedCon\disconnect!
|
||||
|
||||
thumbstickFrame.Position = defaultThumbstickPos
|
||||
outerThumbstick.Position = defaultThumbstickPos
|
||||
|
||||
for i, object in pairs thumbstickTouches
|
||||
if object == thumbstickTouch
|
||||
table.remove thumbstickTouches, i
|
||||
break
|
||||
|
||||
thumbstickTouch = nil
|
||||
|
||||
userInputService.Changed\connect (prop) ->
|
||||
if prop == "ModalEnabled"
|
||||
thumbstickFrame.Visible = outerThumbstick.Visible = not userInputService.ModalEnabled
|
||||
|
||||
thumbstickFrame.InputBegan\connect startInputTracking
|
||||
thumbstickFrame
|
||||
|
||||
setupCharacterMovement = (parentFrame) ->
|
||||
local lastMovementVector, lastMaxMovement
|
||||
moveCharacterFunc = localPlayer.MoveCharacter
|
||||
moveCharacterFunction = (movementVector, maxMovement) ->
|
||||
if localPlayer
|
||||
if movementOutsideDeadZone movementVector
|
||||
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
|
||||
maxMovement = movementVector.magnitude - 1
|
||||
|
||||
moveCharacterFunc localPlayer, movementVector, maxMovement
|
||||
else
|
||||
lastMovementVector = Vector2.new 0, 0
|
||||
lastMaxMovement = 1
|
||||
moveCharacterFunc localPlayer, lastMovementVector, lastMaxMovement
|
||||
|
||||
thumbstickPos = UDim2.new 0, thumbstickSize / 2, 1, -thumbstickSize * 1.75
|
||||
if isSmallScreenDevice!
|
||||
thumbstickPos = UDim2.new 0, (thumbstickSize / 2) - 10, 1, -thumbstickSize - 20
|
||||
|
||||
characterThumbstick = constructThumbstick thumbstickPos, moveCharacterFunction, false
|
||||
characterThumbstick.Name = "CharacterThumbstick"
|
||||
characterThumbstick.Parent = parentFrame
|
||||
|
||||
refreshCharacterMovement = ->
|
||||
if localPlayer and moveCharacterFunc and lastMovementVector and lastMaxMovement
|
||||
moveCharacterFunc localPlayer, lastMovementVector, lastMaxMovement
|
||||
|
||||
refreshCharacterMovement
|
||||
|
||||
setupJumpButton = (parentFrame) ->
|
||||
jumpButton = New "ImageButton", "JumpButton"
|
||||
BackgroundTransparency: 1
|
||||
Image: touchControlsSheet
|
||||
ImageRectOffset: Vector2.new 176, 222
|
||||
ImageRectSize: Vector2.new 174, 174
|
||||
Size: UDim2.new 0, jumpButtonSize, 0, jumpButtonSize
|
||||
Position: UDim2.new 1, if isSmallScreenDevice!
|
||||
-(jumpButtonSize * 2.25), 1, -jumpButtonSize - 20
|
||||
else
|
||||
-(jumpButtonSize * 2.75), 1, -jumpButtonSize - 120
|
||||
|
||||
|
||||
playerJumpFunc = localPlayer.JumpCharacter
|
||||
|
||||
doJumpLoop = ->
|
||||
while currentJumpTouch
|
||||
if localPlayer
|
||||
playerJumpFunc localPlayer
|
||||
|
||||
wait 1 / 60
|
||||
|
||||
|
||||
jumpButton.InputBegan\connect (inputObject) ->
|
||||
return if inputObject.UserInputType ~= Enum.UserInputType.Touch
|
||||
return if currentJumpTouch
|
||||
return if inputObject == cameraTouch
|
||||
for _, touch in pairs oldJumpTouches
|
||||
return if touch == inputObject
|
||||
|
||||
currentJumpTouch = inputObject
|
||||
jumpButton.ImageRectOffset = Vector2.new 0, 222
|
||||
jumpButton.ImageRectSize = Vector2.new 174, 174
|
||||
doJumpLoop!
|
||||
|
||||
jumpButton.InputEnded\connect (inputObject) ->
|
||||
return if inputObject.UserInputType ~= Enum.UserInputType.Touch
|
||||
|
||||
jumpButton.ImageRectOffset = Vector2.new 176, 222
|
||||
jumpButton.ImageRectSize = Vector2.new 174, 174
|
||||
|
||||
if inputObject == currentJumpTouch
|
||||
table.insert oldJumpTouches, currentJumpTouch
|
||||
currentJumpTouch = nil
|
||||
|
||||
|
||||
userInputService.InputEnded\connect (globalInputObject) ->
|
||||
for i, touch in pairs oldJumpTouches
|
||||
if touch == globalInputObject
|
||||
table.remove oldJumpTouches, i
|
||||
break
|
||||
|
||||
userInputService.Changed\connect (prop) ->
|
||||
if prop == "ModalEnabled"
|
||||
jumpButton.Visible = not userInputService.ModalEnabled
|
||||
|
||||
jumpButton.Parent = parentFrame
|
||||
|
||||
|
||||
isTouchUsedByJumpButton = (touch) ->
|
||||
if touch == currentJumpTouch
|
||||
return true
|
||||
|
||||
for _, touchToCompare in pairs oldJumpTouches
|
||||
if touch == touchToCompare
|
||||
return true
|
||||
false
|
||||
|
||||
isTouchUsedByThumbstick = (touch) ->
|
||||
for _, touchToCompare in pairs thumbstickTouches
|
||||
if touch == touchToCompare
|
||||
return true
|
||||
false
|
||||
|
||||
|
||||
setupCameraControl = (parentFrame, refreshCharacterMoveFunc) ->
|
||||
local lastPos
|
||||
hasRotatedCamera = false
|
||||
rotateCameraFunc = userInputService.RotateCamera
|
||||
|
||||
pinchTime = -1
|
||||
shouldPinch = false
|
||||
local lastPinchScale
|
||||
zoomCameraFunc = userInputService.ZoomCamera
|
||||
pinchTouches = {}
|
||||
local pinchFrame
|
||||
|
||||
resetCameraRotateState = ->
|
||||
cameraTouch = nil
|
||||
hasRotatedCamera = false
|
||||
lastPos = nil
|
||||
|
||||
resetPinchState = ->
|
||||
pinchTouches = {}
|
||||
lastPinchScale = nil
|
||||
shouldPinch = false
|
||||
pinchFrame\Destroy!
|
||||
pinchFrame = nil
|
||||
|
||||
startPinch = (firstTouch, secondTouch) ->
|
||||
-- track pinching in new frame
|
||||
pinchFrame?\Destroy!
|
||||
-- make sure we didn't track in any mud
|
||||
pinchFrame = New "Frame", "PinchFrame"
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Parent: parentFrame
|
||||
|
||||
pinchFrame.InputChanged\connect (inputObject) ->
|
||||
if not shouldPinch
|
||||
resetPinchState!
|
||||
return
|
||||
|
||||
resetCameraRotateState!
|
||||
|
||||
if lastPinchScale == nil -- first pinch move, just set up scale
|
||||
if inputObject == firstTouch
|
||||
lastPinchScale = (inputObject.Position - secondTouch.Position).magnitude
|
||||
firstTouch = inputObject
|
||||
elseif inputObject == secondTouch
|
||||
lastPinchScale = (inputObject.Position - firstTouch.Position).magnitude
|
||||
secondTouch = inputObject
|
||||
|
||||
else -- we are now actually pinching, do comparison to last pinch size
|
||||
newPinchDistance = 0
|
||||
if inputObject == firstTouch
|
||||
newPinchDistance = (inputObject.Position - secondTouch.Position).magnitude
|
||||
firstTouch = inputObject
|
||||
elseif inputObject == secondTouch
|
||||
newPinchDistance = (inputObject.Position - firstTouch.Position).magnitude
|
||||
secondTouch = inputObject
|
||||
|
||||
if newPinchDistance ~= 0
|
||||
pinchDiff = newPinchDistance - lastPinchScale
|
||||
if pinchDiff ~= 0
|
||||
zoomCameraFunc userInputService, (pinchDiff * CameraZoomSensitivity)
|
||||
|
||||
lastPinchScale = newPinchDistance
|
||||
|
||||
pinchFrame.InputEnded\connect (inputObject) -> -- pinch is over, destroy all
|
||||
if inputObject == firstTouch or inputObject == secondTouch
|
||||
resetPinchState!
|
||||
|
||||
|
||||
pinchGestureReceivedTouch = (inputObject) ->
|
||||
if #pinchTouches < 1
|
||||
table.insert pinchTouches, inputObject
|
||||
pinchTime = tick!
|
||||
shouldPinch = false
|
||||
elseif #pinchTouches == 1
|
||||
shouldPinch = ((tick! - pinchTime) <= PinchZoomDelay)
|
||||
|
||||
if shouldPinch
|
||||
table.insert pinchTouches, inputObject
|
||||
startPinch pinchTouches[1], pinchTouches[2]
|
||||
else -- shouldn't ever get here, but just in case
|
||||
pinchTouches = {}
|
||||
|
||||
parentFrame.InputBegan\connect (inputObject) ->
|
||||
return if inputObject.UserInputType ~= Enum.UserInputType.Touch
|
||||
return if isTouchUsedByJumpButton inputObject
|
||||
|
||||
usedByThumbstick = isTouchUsedByThumbstick inputObject
|
||||
if not usedByThumbstick
|
||||
pinchGestureReceivedTouch inputObject
|
||||
|
||||
|
||||
if cameraTouch == nil and not usedByThumbstick
|
||||
cameraTouch = inputObject
|
||||
lastPos = Vector2.new cameraTouch.Position.x, cameraTouch.Position.y
|
||||
-- lastTick = tick!
|
||||
|
||||
userInputService.InputChanged\connect (inputObject) ->
|
||||
return if inputObject.UserInputType ~= Enum.UserInputType.Touch
|
||||
return if cameraTouch ~= inputObject
|
||||
|
||||
newPos = Vector2.new cameraTouch.Position.x, cameraTouch.Position.y
|
||||
touchDiff = (lastPos - newPos) * CameraRotateSensitivity
|
||||
|
||||
-- first time rotating outside deadzone, just setup for next changed event
|
||||
if not hasRotatedCamera and (touchDiff.magnitude > CameraRotateDeadZone)
|
||||
hasRotatedCamera = true
|
||||
lastPos = newPos
|
||||
|
||||
|
||||
-- fire everytime after we have rotated out of deadzone
|
||||
if hasRotatedCamera and (lastPos ~= newPos)
|
||||
rotateCameraFunc userInputService, touchDiff
|
||||
refreshCharacterMoveFunc!
|
||||
lastPos = newPos
|
||||
|
||||
|
||||
userInputService.InputEnded\connect (inputObject) ->
|
||||
if cameraTouch == inputObject or not cameraTouch?
|
||||
resetCameraRotateState!
|
||||
|
||||
for i, touch in pairs pinchTouches
|
||||
if touch == inputObject
|
||||
table.remove pinchTouches, i
|
||||
|
||||
setupTouchControls = ->
|
||||
touchControlFrame = New "Frame", "TouchControlFrame"
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
BackgroundTransparency: 1
|
||||
Parent: Game.CoreGui.RobloxGui
|
||||
|
||||
refreshCharacterMoveFunc = setupCharacterMovement touchControlFrame
|
||||
setupJumpButton touchControlFrame
|
||||
setupCameraControl touchControlFrame, refreshCharacterMoveFunc
|
||||
|
||||
userInputService.ProcessedEvent\connect (inputObject, processed) ->
|
||||
return if not processed
|
||||
|
||||
-- kill camera pan if the touch is used by some user controls
|
||||
if inputObject == cameraTouch and inputObject.UserInputState == Enum.UserInputState.Begin
|
||||
cameraTouch = nil
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------
|
||||
-- Start of Script
|
||||
|
||||
-- if true --userInputService\IsLuaTouchControls!
|
||||
setupTouchControls!
|
||||
-- else
|
||||
-- script\Destroy!
|
||||
|
||||
|
|
@ -1,875 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
-- A Few Script Globals
|
||||
gui = script.Parent\FindFirstChild"ControlFrame" or script.Parent
|
||||
|
||||
-- Dev-Console Root
|
||||
|
||||
Dev_Container = New "Frame", "DevConsoleContainer"
|
||||
Parent: gui
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.9
|
||||
Position: UDim2.new 0, 100, 0, 10
|
||||
Size: UDim2.new 0.5, 20, 0.5, 20
|
||||
Visible: false
|
||||
|
||||
ToggleConsole = New "BindableFunction", "ToggleDevConsole"
|
||||
Parent: gui
|
||||
|
||||
devConsoleInitialized = false
|
||||
initializeDeveloperConsole = ->
|
||||
return if devConsoleInitialized
|
||||
devConsoleInitialized = true
|
||||
|
||||
---Dev-Console Variables
|
||||
LOCAL_CONSOLE = 1
|
||||
SERVER_CONSOLE = 2
|
||||
|
||||
MAX_LIST_SIZE = 1000
|
||||
|
||||
minimumSize = Vector2.new 245, 180
|
||||
currentConsole = LOCAL_CONSOLE
|
||||
|
||||
localMessageList = {}
|
||||
serverMessageList = {}
|
||||
|
||||
localOffset = 0
|
||||
serverOffset = 0
|
||||
|
||||
errorToggleOn = true
|
||||
warningToggleOn = true
|
||||
infoToggleOn = true
|
||||
outputToggleOn = true
|
||||
wordWrapToggleOn = false
|
||||
|
||||
textHolderSize = 0
|
||||
|
||||
frameNumber = 0
|
||||
|
||||
--Create Dev-Console
|
||||
|
||||
Dev_Body = New "Frame", "Body"
|
||||
Parent: Dev_Container
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 0, 0, 0, 21
|
||||
Size: UDim2.new 1, 0, 1, -25
|
||||
|
||||
* New "ImageButton", "ResizeButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 1, -20, 1, -20
|
||||
Size: UDim2.new 0, 20, 0, 20
|
||||
|
||||
* New "ImageLabel", "ImageLabel"
|
||||
BackgroundTransparency: 1
|
||||
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"
|
||||
|
||||
* New "TextButton", "LocalConsole"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.6
|
||||
Position: UDim2.new 0, 7, 0, 5
|
||||
Size: UDim2.new 0, 90, 0, 20
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: "Local Console"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextYAlignment: Enum.TextYAlignment.Center
|
||||
|
||||
* New "TextButton", "ServerConsole"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.8
|
||||
Position: UDim2.new 0, 102, 0, 5
|
||||
Size: UDim2.new 0, 90, 0, 17
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: "Server Console"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextYAlignment: Enum.TextYAlignment.Center
|
||||
|
||||
Dev_OptionsHolder = New "Frame", "OptionsHolder"
|
||||
Parent: Dev_Body
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 220, 0, 0
|
||||
Size: UDim2.new 1, -255, 0, 24
|
||||
ClipsDescendants: true
|
||||
|
||||
Dev_OptionsBar = New "Frame", "OptionsBar"
|
||||
Parent: Dev_OptionsHolder
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, -250, 0, 4
|
||||
Size: UDim2.new 0, 234, 0, 18
|
||||
|
||||
* New "TextButton", "ErrorToggleButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 1, 0, 0
|
||||
Position: UDim2.new 0, 115, 0, 0
|
||||
Size: UDim2.new 0, 18, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 0, 0
|
||||
|
||||
* New "Frame", "CheckFrame"
|
||||
BackgroundColor3: Color3.new 1, 0, 0
|
||||
BorderColor3: Color3.new 1, 0, 0
|
||||
Position: UDim2.new 0, 4, 0, 4
|
||||
Size: UDim2.new 0, 10, 0, 10
|
||||
|
||||
* New "TextButton", "InfoToggleButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 0.4, 0.5, 1.0
|
||||
Position: UDim2.new 0, 65, 0, 0
|
||||
Size: UDim2.new 0, 18, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: ""
|
||||
TextColor3: Color3.new 0.4, 0.5, 1.0
|
||||
|
||||
* New "Frame", "CheckFrame"
|
||||
BackgroundColor3: Color3.new 0.4, 0.5, 1.0
|
||||
BorderColor3: Color3.new 0.4, 0.5, 1.0
|
||||
Position: UDim2.new 0, 4, 0, 4
|
||||
Size: UDim2.new 0, 10, 0, 10
|
||||
|
||||
* New "TextButton", "OutputToggleButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 1, 1, 1.0
|
||||
Position: UDim2.new 0, 40, 0, 0
|
||||
Size: UDim2.new 0, 18, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 1, 1.0
|
||||
|
||||
* New "Frame", "CheckFrame"
|
||||
BackgroundColor3: Color3.new 1, 1, 1.0
|
||||
BorderColor3: Color3.new 1, 1, 1.0
|
||||
Position: UDim2.new 0, 4, 0, 4
|
||||
Size: UDim2.new 0, 10, 0, 10
|
||||
|
||||
* New "TextButton", "WarningToggleButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 1, 0.6, 0.4
|
||||
Position: UDim2.new 0, 90, 0, 0
|
||||
Size: UDim2.new 0, 18, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 0.6, 0.4
|
||||
|
||||
* New "Frame", "CheckFrame"
|
||||
BackgroundColor3: Color3.new 1, 0.6, 0.4
|
||||
BorderColor3: Color3.new 1, 0.6, 0.4
|
||||
Position: UDim2.new 0, 4, 0, 4
|
||||
Size: UDim2.new 0, 10, 0, 10
|
||||
|
||||
* New "TextButton", "WordWrapToggleButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 0.8, 0.8, 0.8
|
||||
Position: UDim2.new 0, 215, 0, 0
|
||||
Size: UDim2.new 0, 18, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: ""
|
||||
TextColor3: Color3.new 0.8, 0.8, 0.8
|
||||
|
||||
* New "Frame", "CheckFrame"
|
||||
BackgroundColor3: Color3.new 0.8, 0.8, 0.8
|
||||
BorderColor3: Color3.new 0.8, 0.8, 0.8
|
||||
Position: UDim2.new 0, 4, 0, 4
|
||||
Size: UDim2.new 0, 10, 0, 10
|
||||
Visible: false
|
||||
|
||||
* New "TextLabel", "Filter"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 0, 40, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: "Filter"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
|
||||
* New "TextLabel", "WordWrap"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 150, 0, 0
|
||||
Size: UDim2.new 0, 50, 0, 18
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: "Word Wrap"
|
||||
TextColor3: Color3.new 1, 1, 1,
|
||||
|
||||
Dev_ScrollBar = New "Frame", "ScrollBar"
|
||||
Parent: Dev_Body
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.9
|
||||
Position: UDim2.new 1, -20, 0, 26
|
||||
Size: UDim2.new 0, 20, 1, -50
|
||||
Visible: false
|
||||
|
||||
* New "ImageButton", "Down"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 0, 0, 1, -20
|
||||
Size: UDim2.new 0, 20, 0, 20
|
||||
|
||||
* New "ImageLabel", "ImageLabel"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 3, 0, 3
|
||||
Size: UDim2.new 0, 14, 0, 14
|
||||
Rotation: 180
|
||||
Image: "http://banland.xyz/asset?id=151205813"
|
||||
|
||||
* New "ImageButton", "Up"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 0, 20, 0, 20
|
||||
|
||||
* New "ImageLabel", "ImageLabel"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 3, 0, 3
|
||||
Size: UDim2.new 0, 14, 0, 14
|
||||
Image: "http://banland.xyz/asset?id=151205813"
|
||||
|
||||
Dev_ScrollArea = New "Frame", "ScrollArea"
|
||||
Parent: Dev_ScrollBar
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 23
|
||||
Size: UDim2.new 1, 0, 1, -46
|
||||
|
||||
* New "ImageButton", "Handle"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 0, 0, 0.2, 0
|
||||
Size: UDim2.new 0, 20, 0, 40
|
||||
|
||||
* New "ImageLabel", "ImageLabel"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0.5, -8
|
||||
Rotation: 180
|
||||
Size: UDim2.new 1, 0, 0, 16
|
||||
Image: "http://banland.xyz/asset?id=151205881"
|
||||
|
||||
|
||||
Dev_TextBox = New "Frame", "TextBox"
|
||||
Parent: Dev_Body
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.6
|
||||
Position: UDim2.new 0, 2, 0, 26
|
||||
Size: UDim2.new 1, -4, 1, -28
|
||||
ClipsDescendants: true
|
||||
|
||||
Dev_TextHolder = New "Frame", "TextHolder"
|
||||
Parent: Dev_TextBox
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
|
||||
Dev_OptionsButton = New "ImageButton", "OptionsButton"
|
||||
Parent: Dev_Body
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 200, 0, 2
|
||||
Size: UDim2.new 0, 20, 0, 20
|
||||
|
||||
* New "ImageLabel", "ImageLabel"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Rotation: 0
|
||||
Image: "http://banland.xyz/asset?id=152093917"
|
||||
|
||||
Dev_TitleBar = New "Frame", "TitleBar"
|
||||
Parent: Dev_Container
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, 0, 0, 20
|
||||
|
||||
* New "ImageButton", "CloseButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 1, -20, 0, 0
|
||||
Size: UDim2.new 0, 20, 0, 20
|
||||
|
||||
* New "ImageLabel"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 3, 0, 3
|
||||
Size: UDim2.new 0, 14, 0, 14
|
||||
Image: "http://banland.xyz/asset?id=151205852"
|
||||
|
||||
* New "TextButton", "TextButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, -23, 1, 0
|
||||
Text: ""
|
||||
|
||||
* New "TextLabel", "TitleText"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 0, 185, 0, 20
|
||||
Font: "SourceSansBold"
|
||||
FontSize: Enum.FontSize.Size18
|
||||
-- Text: "Server Console"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
Text: "Roblox Developer Console"
|
||||
TextYAlignment: Enum.TextYAlignment.Top
|
||||
|
||||
---Saved Mouse Information
|
||||
local previousMousePos, pPos
|
||||
local previousMousePosResize, pSize
|
||||
local previousMousePosScroll
|
||||
|
||||
-- local pScrollHandle
|
||||
|
||||
local pOffset
|
||||
|
||||
scrollUpIsDown = false
|
||||
scrollDownIsDown = false
|
||||
|
||||
clean = ->
|
||||
previousMousePos \
|
||||
= pPos \
|
||||
= previousMousePosResize \
|
||||
= pSize \
|
||||
= previousMousePosScroll \
|
||||
= pOffset \
|
||||
= nil
|
||||
-- pScrollHandle = nil
|
||||
scrollUpIsDown = scrollDownIsDown = false
|
||||
|
||||
|
||||
---Handle Dev-Console Position
|
||||
refreshConsolePosition = (x, y) ->
|
||||
return if not previousMousePos
|
||||
|
||||
delta = Vector2.new x, y - previousMousePos
|
||||
Dev_Container.Position = UDim2.new 0, pPos.X + delta.X, 0, pPos.Y + delta.Y
|
||||
|
||||
|
||||
Dev_TitleBar.TextButton.MouseButton1Down\connect (x, y) ->
|
||||
previousMousePos = Vector2.new x, y
|
||||
pPos = Dev_Container.AbsolutePosition
|
||||
|
||||
|
||||
Dev_TitleBar.TextButton.MouseButton1Up\connect clean
|
||||
|
||||
|
||||
---Handle Dev-Console Size
|
||||
refreshConsoleSize = (x, y) ->
|
||||
return if not previousMousePosResize
|
||||
|
||||
delta = Vector2.new x, y - previousMousePosResize
|
||||
Dev_Container.Size = UDim2.new 0, math.max(pSize.X + delta.X, minimumSize.X), 0, math.max pSize.Y + delta.Y, minimumSize.Y
|
||||
|
||||
Dev_Container.Body.ResizeButton.MouseButton1Down\connect (x, y) ->
|
||||
previousMousePosResize = Vector2.new x, y
|
||||
pSize = Dev_Container.AbsoluteSize
|
||||
|
||||
|
||||
Dev_Container.Body.ResizeButton.MouseButton1Up\connect clean
|
||||
|
||||
|
||||
---Handle Dev-Console Close Button
|
||||
Dev_TitleBar.CloseButton.MouseButton1Down\connect ->
|
||||
Dev_Container.Visible = false
|
||||
|
||||
|
||||
Dev_Container.TitleBar.CloseButton.MouseButton1Up\connect clean
|
||||
|
||||
|
||||
optionsHidden = true
|
||||
animating = false
|
||||
--Options
|
||||
startAnimation = ->
|
||||
return if animating
|
||||
animating = true
|
||||
|
||||
repeat
|
||||
frameNumber += if optionsHidden
|
||||
-1
|
||||
else
|
||||
1
|
||||
|
||||
|
||||
x = frameNumber / 5
|
||||
smoothStep = x * x * (3 - (2 * x))
|
||||
Dev_OptionsButton.ImageLabel.Rotation = smoothStep * 5 * 9
|
||||
Dev_OptionsBar.Position = UDim2.new(0, (smoothStep * 5 * 50) - 250, 0, 4)
|
||||
|
||||
wait!
|
||||
if (frameNumber <= 0 and optionsHidden) or (frameNumber >= 5 and not optionsHidden)
|
||||
animating = false
|
||||
|
||||
until not animating
|
||||
|
||||
|
||||
Dev_OptionsButton.MouseButton1Down\connect ->
|
||||
optionsHidden = not optionsHidden
|
||||
startAnimation!
|
||||
|
||||
--Refresh Dev-Console Message Positions
|
||||
repositionList = ->
|
||||
if currentConsole == LOCAL_CONSOLE
|
||||
localOffset = math.min math.max(localOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y
|
||||
Dev_TextHolder.Size = UDim2.new 1, 0, 0, textHolderSize
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverOffset = math.min math.max(serverOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y
|
||||
Dev_TextHolder.Size = UDim2.new 1, 0, 0, textHolderSize
|
||||
|
||||
|
||||
ratio = Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y
|
||||
|
||||
if ratio >= 1
|
||||
Dev_Container.Body.ScrollBar.Visible = false
|
||||
Dev_Container.Body.TextBox.Size = UDim2.new 1, -4, 1, -28
|
||||
|
||||
if currentConsole == LOCAL_CONSOLE or currentConsole == SERVER_CONSOLE
|
||||
Dev_TextHolder.Position = UDim2.new 0, 0, 1, 0 - textHolderSize
|
||||
|
||||
else
|
||||
Dev_Container.Body.ScrollBar.Visible = true
|
||||
Dev_Container.Body.TextBox.Size = UDim2.new 1, -25, 1, -28
|
||||
|
||||
backRatio = 1 - ratio
|
||||
local offsetRatio
|
||||
|
||||
offsetRatio = if currentConsole == LOCAL_CONSOLE
|
||||
localOffset / Dev_TextHolder.AbsoluteSize.Y
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverOffset / Dev_TextHolder.AbsoluteSize.Y
|
||||
|
||||
|
||||
topRatio = math.max 0, backRatio - offsetRatio
|
||||
|
||||
scrollHandleSize = math.max Dev_ScrollArea.AbsoluteSize.Y * ratio, 21
|
||||
|
||||
scrollRatio = scrollHandleSize / Dev_ScrollArea.AbsoluteSize.Y
|
||||
ratioConversion = (1 - scrollRatio) / (1 - ratio)
|
||||
|
||||
topScrollRatio = topRatio * ratioConversion
|
||||
|
||||
sPos = math.min(
|
||||
Dev_ScrollArea.AbsoluteSize.Y * topScrollRatio,
|
||||
Dev_ScrollArea.AbsoluteSize.Y - scrollHandleSize
|
||||
)
|
||||
|
||||
Dev_ScrollArea.Handle.Size = UDim2.new 1, 0, 0, scrollHandleSize
|
||||
Dev_ScrollArea.Handle.Position = UDim2.new 0, 0, 0, sPos
|
||||
|
||||
Dev_TextHolder.Position = UDim2.new 0, 0, 1, 0 - textHolderSize + if currentConsole == LOCAL_CONSOLE
|
||||
localOffset
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverOffset
|
||||
|
||||
|
||||
--Scroll Position
|
||||
|
||||
changeOffset = (value) ->
|
||||
if currentConsole == LOCAL_CONSOLE
|
||||
localOffset += value
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverOffset += value
|
||||
|
||||
repositionList!
|
||||
|
||||
|
||||
--Refresh Dev-Console Text
|
||||
refreshTextHolderForReal = ->
|
||||
childMessages = Dev_TextHolder\GetChildren!
|
||||
|
||||
local messageList
|
||||
|
||||
messageList = if currentConsole == LOCAL_CONSOLE
|
||||
localMessageList
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverMessageList
|
||||
|
||||
posOffset = 0
|
||||
|
||||
for i in *childMessages
|
||||
i.Visible = false
|
||||
|
||||
for i = 1, #messageList
|
||||
local message
|
||||
|
||||
movePosition = false
|
||||
|
||||
if i > #childMessages
|
||||
message = New "TextLabel", "Message"
|
||||
Parent: Dev_TextHolder
|
||||
BackgroundTransparency: 1
|
||||
TextXAlignment: "Left"
|
||||
Size: UDim2.new 1, 0, 0, 14
|
||||
FontSize: "Size10"
|
||||
ZIndex: 1
|
||||
movePosition = true
|
||||
else
|
||||
message = childMessages[i]
|
||||
|
||||
|
||||
if (outputToggleOn or messageList[i].Type ~= Enum.MessageType.MessageOutput) and
|
||||
(infoToggleOn or messageList[i].Type ~= Enum.MessageType.MessageInfo) and
|
||||
(warningToggleOn or messageList[i].Type ~= Enum.MessageType.MessageWarning) and
|
||||
(errorToggleOn or messageList[i].Type ~= Enum.MessageType.MessageError)
|
||||
|
||||
with message
|
||||
.TextWrapped = wordWrapToggleOn
|
||||
.Size = UDim2.new 0.98, 0, 0, 2000
|
||||
.Parent = Dev_Container
|
||||
.Text = "#{messageList[i].Time} -- #{messageList[i].Message}"
|
||||
.Size = UDim2.new 0.98, 0, 0, .TextBounds.Y
|
||||
.Position = UDim2.new 0, 5, 0, posOffset
|
||||
.Parent = Dev_TextHolder
|
||||
posOffset += .TextBounds.Y
|
||||
|
||||
if movePosition
|
||||
if (currentConsole == LOCAL_CONSOLE and localOffset > 0) or
|
||||
(currentConsole == SERVER_CONSOLE and serverOffset > 0)
|
||||
|
||||
changeOffset message.TextBounds.Y
|
||||
|
||||
message.Visible = true
|
||||
|
||||
message.TextColor3 = Color3.new if messageList[i].Type == Enum.MessageType.MessageError
|
||||
1, 0, 0
|
||||
elseif messageList[i].Type == Enum.MessageType.MessageInfo
|
||||
0.4, 0.5, 1
|
||||
elseif messageList[i].Type == Enum.MessageType.MessageWarning
|
||||
1, 0.6, 0.4
|
||||
else
|
||||
1, 1, 1
|
||||
|
||||
textHolderSize = posOffset
|
||||
|
||||
|
||||
-- Refreshing the textholder every 0.1 (if needed) is good enough, surely fast enough
|
||||
-- We don't want it to update 50x in a tick because there are 50 messages in that tick
|
||||
-- (Whenever for one reason or another a lot of output comes in, it can lag
|
||||
-- This will make it behave better in a situation of a lot of output comming in)
|
||||
refreshQueued = false
|
||||
refreshTextHolder = ->
|
||||
return if refreshQueued
|
||||
|
||||
Delay 0.1, ->
|
||||
refreshQueued = false
|
||||
refreshTextHolderForReal!
|
||||
|
||||
refreshQueued = true
|
||||
|
||||
|
||||
--Handle Dev-Console Scrollbar
|
||||
|
||||
inside = 0
|
||||
holdingUpButton = ->
|
||||
return if scrollUpIsDown
|
||||
|
||||
scrollUpIsDown = true
|
||||
wait 0.6
|
||||
inside += 1
|
||||
while scrollUpIsDown and inside < 2
|
||||
wait!
|
||||
changeOffset 12
|
||||
|
||||
inside -= 1
|
||||
|
||||
|
||||
holdingDownButton = ->
|
||||
return if scrollDownIsDown
|
||||
|
||||
scrollDownIsDown = true
|
||||
wait 0.6
|
||||
inside += 1
|
||||
while scrollDownIsDown and inside < 2
|
||||
wait!
|
||||
changeOffset -12
|
||||
|
||||
inside -= 1
|
||||
|
||||
|
||||
Dev_Container.Body.ScrollBar.Up.MouseButton1Click\connect ->
|
||||
changeOffset 10
|
||||
|
||||
Dev_Container.Body.ScrollBar.Up.MouseButton1Down\connect ->
|
||||
changeOffset 10
|
||||
holdingUpButton!
|
||||
|
||||
Dev_Container.Body.ScrollBar.Up.MouseButton1Up\connect clean
|
||||
|
||||
Dev_Container.Body.ScrollBar.Down.MouseButton1Down\connect ->
|
||||
changeOffset -10
|
||||
holdingDownButton!
|
||||
|
||||
Dev_Container.Body.ScrollBar.Down.MouseButton1Up\connect clean
|
||||
|
||||
handleScroll = (x, y) ->
|
||||
return if not previousMousePosScroll
|
||||
|
||||
delta = (Vector2.new x, y - previousMousePosScroll).Y
|
||||
|
||||
backRatio = 1 - (Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y)
|
||||
|
||||
movementSize = Dev_ScrollArea.AbsoluteSize.Y - Dev_ScrollArea.Handle.AbsoluteSize.Y
|
||||
normalDelta = math.max(math.min(delta, movementSize), 0 - movementSize)
|
||||
normalRatio = normalDelta / movementSize
|
||||
|
||||
textMovementSize = (backRatio * Dev_TextHolder.AbsoluteSize.Y)
|
||||
offsetChange = textMovementSize * normalRatio
|
||||
|
||||
if currentConsole == LOCAL_CONSOLE
|
||||
localOffset = pOffset - offsetChange
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverOffset = pOffset - offsetChange
|
||||
|
||||
|
||||
Dev_ScrollArea.Handle.MouseButton1Down\connect (x, y) ->
|
||||
previousMousePosScroll = Vector2.new x, y
|
||||
-- pScrollHandle = Dev_ScrollArea.Handle.AbsolutePosition
|
||||
pOffset = if currentConsole == LOCAL_CONSOLE
|
||||
localOffset
|
||||
elseif currentConsole == SERVER_CONSOLE
|
||||
serverOffset
|
||||
|
||||
|
||||
Dev_ScrollArea.Handle.MouseButton1Up\connect clean
|
||||
|
||||
existsInsideContainer = (container, x, y) ->
|
||||
pos = container.AbsolutePosition
|
||||
size = container.AbsoluteSize
|
||||
if x < pos.X or x > pos.X + size.X or y < pos.y or y > pos.y + size.y
|
||||
return false
|
||||
true
|
||||
|
||||
|
||||
-- Easy, fast, and working nicely
|
||||
numberWithZero = (num) ->
|
||||
if num < 10
|
||||
"0#{num}"
|
||||
else
|
||||
num
|
||||
|
||||
|
||||
timestr = "%s:%s:%s"
|
||||
|
||||
ConvertTimeStamp = (timeStamp) ->
|
||||
localTime = timeStamp - os.time! + math.floor tick!
|
||||
dayTime = localTime % 86400
|
||||
|
||||
hour = math.floor dayTime / 3600
|
||||
|
||||
dayTime -= hour * 3600
|
||||
minute = math.floor dayTime / 60
|
||||
|
||||
dayTime -= minute * 60
|
||||
|
||||
h = numberWithZero hour
|
||||
m = numberWithZero minute
|
||||
s = numberWithZero dayTime
|
||||
|
||||
timestr\format h, m, s
|
||||
|
||||
|
||||
--Filter
|
||||
|
||||
Dev_OptionsBar.ErrorToggleButton.MouseButton1Down\connect ->
|
||||
errorToggleOn = not errorToggleOn
|
||||
Dev_OptionsBar.ErrorToggleButton.CheckFrame.Visible = errorToggleOn
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
Dev_OptionsBar.WarningToggleButton.MouseButton1Down\connect ->
|
||||
warningToggleOn = not warningToggleOn
|
||||
Dev_OptionsBar.WarningToggleButton.CheckFrame.Visible = warningToggleOn
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
Dev_OptionsBar.InfoToggleButton.MouseButton1Down\connect ->
|
||||
infoToggleOn = not infoToggleOn
|
||||
Dev_OptionsBar.InfoToggleButton.CheckFrame.Visible = infoToggleOn
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
Dev_OptionsBar.OutputToggleButton.MouseButton1Down\connect ->
|
||||
outputToggleOn = not outputToggleOn
|
||||
Dev_OptionsBar.OutputToggleButton.CheckFrame.Visible = outputToggleOn
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
Dev_OptionsBar.WordWrapToggleButton.MouseButton1Down\connect ->
|
||||
wordWrapToggleOn = not wordWrapToggleOn
|
||||
Dev_OptionsBar.WordWrapToggleButton.CheckFrame.Visible = wordWrapToggleOn
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
---Dev-Console Message Functionality
|
||||
AddLocalMessage = (str, messageType, timeStamp) ->
|
||||
localMessageList[] =
|
||||
Message: str
|
||||
Time: ConvertTimeStamp timeStamp
|
||||
Type: messageType
|
||||
|
||||
while #localMessageList > MAX_LIST_SIZE
|
||||
table.remove localMessageList, 1
|
||||
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
AddServerMessage = (str, messageType, timeStamp) ->
|
||||
serverMessageList[] =
|
||||
Message: str
|
||||
Time: ConvertTimeStamp timeStamp
|
||||
Type: messageType
|
||||
|
||||
while #serverMessageList > MAX_LIST_SIZE
|
||||
table.remove serverMessageList, 1
|
||||
|
||||
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
--Handle Dev-Console Local/Server Buttons
|
||||
Dev_Container.Body.LocalConsole.MouseButton1Click\connect ->
|
||||
if currentConsole == SERVER_CONSOLE
|
||||
currentConsole = LOCAL_CONSOLE
|
||||
localConsole = Dev_Container.Body.LocalConsole
|
||||
serverConsole = Dev_Container.Body.ServerConsole
|
||||
|
||||
localConsole.Size = UDim2.new 0, 90, 0, 20
|
||||
serverConsole.Size = UDim2.new 0, 90, 0, 17
|
||||
localConsole.BackgroundTransparency = 0.6
|
||||
serverConsole.BackgroundTransparency = 0.8
|
||||
|
||||
if game\FindFirstChild"Players" and game.Players["LocalPlayer"]
|
||||
mouse = game.Players.LocalPlayer\GetMouse!
|
||||
refreshConsolePosition mouse.X, mouse.Y
|
||||
refreshConsoleSize mouse.X, mouse.Y
|
||||
handleScroll mouse.X, mouse.Y
|
||||
|
||||
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
Dev_Container.Body.LocalConsole.MouseButton1Up\connect clean
|
||||
|
||||
|
||||
serverHistoryRequested = false
|
||||
|
||||
Dev_Container.Body.ServerConsole.MouseButton1Click\connect ->
|
||||
if not serverHistoryRequested
|
||||
serverHistoryRequested = true
|
||||
game\GetService"LogService"\RequestServerOutput!
|
||||
|
||||
|
||||
if currentConsole == LOCAL_CONSOLE
|
||||
currentConsole = SERVER_CONSOLE
|
||||
localConsole = Dev_Container.Body.LocalConsole
|
||||
serverConsole = Dev_Container.Body.ServerConsole
|
||||
|
||||
serverConsole.Size = UDim2.new 0, 90, 0, 20
|
||||
localConsole.Size = UDim2.new 0, 90, 0, 17
|
||||
serverConsole.BackgroundTransparency = 0.6
|
||||
localConsole.BackgroundTransparency = 0.8
|
||||
|
||||
if game\FindFirstChild"Players" and game.Players["LocalPlayer"]
|
||||
mouse = game.Players.LocalPlayer\GetMouse!
|
||||
refreshConsolePosition mouse.X, mouse.Y
|
||||
refreshConsoleSize mouse.X, mouse.Y
|
||||
handleScroll mouse.X, mouse.Y
|
||||
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
|
||||
---Extra Mouse Handlers for Dev-Console
|
||||
Dev_Container.Body.ServerConsole.MouseButton1Up\connect clean
|
||||
|
||||
|
||||
if game\FindFirstChild"Players" and game.Players["LocalPlayer"]
|
||||
LocalMouse = game.Players.LocalPlayer\GetMouse!
|
||||
LocalMouse.Move\connect ->
|
||||
return if not Dev_Container.Visible
|
||||
|
||||
mouse = game.Players.LocalPlayer\GetMouse!
|
||||
refreshConsolePosition mouse.X, mouse.Y
|
||||
refreshConsoleSize mouse.X, mouse.Y
|
||||
handleScroll mouse.X, mouse.Y
|
||||
|
||||
refreshTextHolder!
|
||||
repositionList!
|
||||
|
||||
LocalMouse.Button1Up\connect clean
|
||||
|
||||
LocalMouse.WheelForward\connect ->
|
||||
return if not Dev_Container.Visible
|
||||
if existsInsideContainer Dev_Container, LocalMouse.X, LocalMouse.Y
|
||||
changeOffset 10
|
||||
|
||||
LocalMouse.WheelBackward\connect ->
|
||||
return if not Dev_Container.Visible
|
||||
if existsInsideContainer Dev_Container, LocalMouse.X, LocalMouse.Y
|
||||
changeOffset -10
|
||||
|
||||
|
||||
Dev_ScrollArea.Handle.MouseButton1Down\connect ->
|
||||
repositionList!
|
||||
|
||||
|
||||
---Populate Dev-Console with dummy messages
|
||||
|
||||
history = game\GetService"LogService"\GetLogHistory!
|
||||
|
||||
for i in *history
|
||||
AddLocalMessage i.message, i.messageType, i.timestamp
|
||||
|
||||
with game\GetService"LogService"
|
||||
.MessageOut\connect (message, messageType) ->
|
||||
AddLocalMessage message, messageType, os.time!
|
||||
.ServerMessageOut\connect AddServerMessage
|
||||
|
||||
currentlyToggling = false
|
||||
ToggleConsole.OnInvoke = ->
|
||||
return if currentlyToggling
|
||||
|
||||
currentlyToggling = true
|
||||
initializeDeveloperConsole!
|
||||
Dev_Container.Visible = not Dev_Container.Visible
|
||||
currentlyToggling = false
|
||||
125
yue/36868950.yue
125
yue/36868950.yue
|
|
@ -1,125 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
controlFrame = script.Parent\FindFirstChild "ControlFrame"
|
||||
|
||||
return if not controlFrame
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
bottomLeftControl = controlFrame\FindFirstChild "BottomLeftControl"
|
||||
bottomRightControl = controlFrame\FindFirstChild "BottomRightControl"
|
||||
|
||||
frameTip = New "TextLabel", "ToolTip"
|
||||
Text: ""
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size12
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
BorderSizePixel: 0
|
||||
ZIndex: 10
|
||||
Size: UDim2.new 2, 0, 1, 0
|
||||
Position: UDim2.new 1, 0, 0, 0
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
TextTransparency: 1
|
||||
TextWrap: true
|
||||
|
||||
* New "BoolValue", "inside"
|
||||
Value: false
|
||||
|
||||
setUpListeners = (frameToListen) ->
|
||||
fadeSpeed = 0.1
|
||||
frameToListen.Parent.MouseEnter\connect ->
|
||||
if frameToListen\FindFirstChild "inside"
|
||||
frameToListen.inside.Value = true
|
||||
wait 1.2
|
||||
if frameToListen.inside.Value
|
||||
while frameToListen.inside.Value and frameToListen.BackgroundTransparency > 0
|
||||
frameToListen.BackgroundTransparency -= fadeSpeed
|
||||
frameToListen.TextTransparency -= fadeSpeed
|
||||
wait!
|
||||
|
||||
killTip = (killFrame) ->
|
||||
killFrame.inside.Value = false
|
||||
killFrame.BackgroundTransparency = 1
|
||||
killFrame.TextTransparency = 1
|
||||
|
||||
frameToListen.Parent.MouseLeave\connect ->
|
||||
killTip frameToListen
|
||||
|
||||
frameToListen.Parent.MouseButton1Click\connect ->
|
||||
killTip frameToListen
|
||||
|
||||
createSettingsButtonTip = (parent) ->
|
||||
if parent == nil
|
||||
parent = bottomLeftControl\FindFirstChild "SettingsButton"
|
||||
|
||||
|
||||
with toolTip = frameTip\clone!
|
||||
.RobloxLocked = true
|
||||
.Text = "Settings/Leave Game"
|
||||
.Position = UDim2.new 0, 0, 0, -18
|
||||
.Size = UDim2.new 0, 120, 0, 20
|
||||
.Parent = parent
|
||||
setUpListeners toolTip
|
||||
|
||||
wait 5 -- make sure we are loaded in, won't need tool tips for first 5 seconds anyway
|
||||
|
||||
---------------- set up Bottom Left Tool Tips -------------------------
|
||||
|
||||
bottomLeftChildren = bottomLeftControl\GetChildren!
|
||||
|
||||
for i in *bottomLeftChildren
|
||||
if i.Name == "Exit"
|
||||
|
||||
with exitTip = frameTip\clone!
|
||||
.RobloxLocked = true
|
||||
.Text = "Leave Place"
|
||||
.Position = UDim2.new 0, 0, -1, 0
|
||||
.Size = UDim2.new 1, 0, 1, 0
|
||||
.Parent = i
|
||||
setUpListeners exitTip
|
||||
|
||||
elseif i.Name == "SettingsButton"
|
||||
createSettingsButtonTip i
|
||||
|
||||
---------------- set up Bottom Right Tool Tips -------------------------
|
||||
|
||||
bottomRightChildren = bottomRightControl\GetChildren!
|
||||
|
||||
for i in *bottomRightChildren
|
||||
if i.Name\find"Camera"?
|
||||
with cameraTip = frameTip\clone!
|
||||
.RobloxLocked = true
|
||||
.Text = "Camera View"
|
||||
|
||||
.Position = if i.Name\find "Zoom"
|
||||
UDim2.new -1, 0, -1.5
|
||||
else
|
||||
UDim2.new 0, 0, -1.5, 0
|
||||
|
||||
.Size = UDim2.new 2, 0, 1.25, 0
|
||||
.Parent = i
|
||||
setUpListeners cameraTip
|
||||
101
yue/37801172.yue
101
yue/37801172.yue
|
|
@ -1,101 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||
-- Created by Ben T. 10/29/10
|
||||
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||
|
||||
scriptContext = game\GetService "ScriptContext"
|
||||
touchEnabled = false
|
||||
|
||||
try
|
||||
touchEnabled = game\GetService"UserInputService".TouchEnabled
|
||||
|
||||
-- library registration
|
||||
scriptContext\AddCoreScript 60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration"
|
||||
|
||||
waitForChild = (instance, name) ->
|
||||
until instance\FindFirstChild name
|
||||
instance.ChildAdded\wait!
|
||||
|
||||
-- waitForProperty = (instance, property) ->
|
||||
-- until instance[property]
|
||||
-- instance.Changed\wait!
|
||||
|
||||
-- Responsible for tracking logging items
|
||||
scriptContext = game\GetService "ScriptContext"
|
||||
scriptContext\AddCoreScript 59002209, scriptContext, "CoreScripts/Sections"
|
||||
|
||||
waitForChild game\GetService"CoreGui", "RobloxGui"
|
||||
screenGui = game\GetService"CoreGui"\FindFirstChild "RobloxGui"
|
||||
|
||||
if not touchEnabled
|
||||
-- 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"
|
||||
|
||||
-- MainBotChatScript
|
||||
scriptContext\AddCoreScript 39250920, screenGui, "CoreScripts/MainBotChatScript"
|
||||
|
||||
-- Popup Script
|
||||
scriptContext\AddCoreScript 48488451, screenGui, "CoreScripts/PopupScript"
|
||||
-- Friend Notification Script (probably can use this script to expand out to other notifications)
|
||||
scriptContext\AddCoreScript 48488398, screenGui, "CoreScripts/NotificationScript"
|
||||
-- Chat script
|
||||
scriptContext\AddCoreScript 97188756, screenGui, "CoreScripts/ChatScript"
|
||||
-- Purchase Prompt Script
|
||||
scriptContext\AddCoreScript 107893730, screenGui, "CoreScripts/PurchasePromptScript"
|
||||
|
||||
if not touchEnabled or screenGui.AbsoluteSize.Y > 600
|
||||
-- New Player List
|
||||
scriptContext\AddCoreScript 48488235, screenGui, "CoreScripts/PlayerListScript"
|
||||
else
|
||||
delay 5, ->
|
||||
if screenGui.AbsoluteSize.Y >= 600
|
||||
-- New Player List
|
||||
scriptContext\AddCoreScript 48488235, screenGui, "CoreScripts/PlayerListScript"
|
||||
|
||||
if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 --todo: remove placeid hack for halloween
|
||||
-- Backpack Builder, creates most of the backpack gui
|
||||
scriptContext\AddCoreScript 53878047, screenGui, "CoreScripts/BackpackScripts/BackpackBuilder"
|
||||
|
||||
waitForChild screenGui, "CurrentLoadout"
|
||||
waitForChild screenGui, "Backpack"
|
||||
Backpack = screenGui.Backpack
|
||||
|
||||
-- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly
|
||||
if game.CoreGui.Version >= 7
|
||||
scriptContext\AddCoreScript 89449093, Backpack, "CoreScripts/BackpackScripts/BackpackManager"
|
||||
|
||||
|
||||
-- Backpack Gear (handles all backpack gear tab stuff)
|
||||
scriptContext\AddCoreScript 89449008, Backpack, "CoreScripts/BackpackScripts/BackpackGear"
|
||||
-- Loadout Script, used for gear hotkeys
|
||||
scriptContext\AddCoreScript 53878057, screenGui.CurrentLoadout, "CoreScripts/BackpackScripts/LoadoutScript"
|
||||
if game.CoreGui.Version >= 8
|
||||
-- Wardrobe script handles all character dressing operations
|
||||
scriptContext\AddCoreScript -1, Backpack, "CoreScripts/BackpackScripts/BackpackWardrobe"
|
||||
|
||||
IsPersonalServer = not not game.Workspace\FindFirstChild "PSVariable"
|
||||
|
||||
if IsPersonalServer
|
||||
scriptContext\AddCoreScript 64164692, game.Players.LocalPlayer, "BuildToolManager"
|
||||
|
||||
game.Workspace.ChildAdded\connect (nchild) ->
|
||||
if nchild.Name == "PSVariable" and nchild\IsA "BoolValue"
|
||||
IsPersonalServer = true
|
||||
scriptContext\AddCoreScript 64164692, game.Players.LocalPlayer, "BuildToolManager"
|
||||
|
||||
if touchEnabled -- 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
|
||||
230
yue/38037565.yue
230
yue/38037565.yue
|
|
@ -1,230 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
damageGuiWidth = 5.0
|
||||
damageGuiHeight = 5.0
|
||||
|
||||
waitForChild = (parent, childName) ->
|
||||
child = parent\findFirstChild childName
|
||||
if child
|
||||
return child
|
||||
|
||||
while true
|
||||
child = parent.ChildAdded\wait!
|
||||
if child.Name == childName
|
||||
return child
|
||||
|
||||
-- declarations
|
||||
Figure = script.Parent
|
||||
Humanoid = waitForChild Figure, "Humanoid"
|
||||
Torso = waitForChild Figure, "Torso"
|
||||
|
||||
config = Figure\FindFirstChild "PlayerStats"
|
||||
|
||||
inCharTag = New "BoolValue"
|
||||
Name: "InCharTag"
|
||||
|
||||
hider = New "BoolValue"
|
||||
Name: "RobloxBuildTool"
|
||||
|
||||
if config == nil
|
||||
config = New "Configuration", "PlayerStats"
|
||||
Parent: Figure
|
||||
|
||||
myHealth = config\FindFirstChild "MaxHealth"
|
||||
if myHealth == nil
|
||||
myHealth = New "NumberValue", "MaxHealth"
|
||||
Value: 100
|
||||
Parent: config
|
||||
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
Humanoid.Health = myHealth.Value
|
||||
|
||||
onMaxHealthChange = ->
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
Humanoid.Health = myHealth.Value
|
||||
|
||||
myHealth.Changed\connect onMaxHealthChange
|
||||
|
||||
--Humanoid.MaxHealth = myHealth.Value
|
||||
--Humanoid.Health = Humanoid.MaxHealth
|
||||
|
||||
vPlayer = game.Players\GetPlayerFromCharacter script.Parent
|
||||
dotGui = vPlayer.PlayerGui\FindFirstChild "DamageOverTimeGui"
|
||||
if dotGui == nil
|
||||
dotGui = New "BillboardGui", "DamageOverTimeGui"
|
||||
Parent: vPlayer.PlayerGui
|
||||
Adornee: script.Parent\FindFirstChild "Head"
|
||||
Active: true
|
||||
size: UDim2.new damageGuiWidth, 0, damageGuiHeight, 0.0
|
||||
StudsOffset: Vector3.new 0, 2.0, 0.0
|
||||
|
||||
|
||||
print "newHealth declarations finished"
|
||||
|
||||
billboardHealthChange = (dmg) ->
|
||||
with New "TextLabel",
|
||||
Text: "#{dmg}"
|
||||
TextColor3: Color3.new if dmg > 0
|
||||
0, 1, 0
|
||||
else
|
||||
1, 0, 1
|
||||
size: UDim2.new 1, 0, 1, 0.0
|
||||
Active: true
|
||||
FontSize: 6
|
||||
BackgroundTransparency: 1
|
||||
Parent: dotGui
|
||||
|
||||
for t = 1, 10
|
||||
wait 0.1
|
||||
.TextTransparency = t / 10
|
||||
.Position = UDim2.new 0, 0, 0, -t * 5
|
||||
.FontSize = 6 - t * 0.6
|
||||
|
||||
\remove!
|
||||
|
||||
setMaxHealth = ->
|
||||
--print Humanoid.Health
|
||||
if myHealth.Value >= 0
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
print Humanoid.MaxHealth
|
||||
if Humanoid.Health > Humanoid.MaxHealth
|
||||
Humanoid.Health = Humanoid.MaxHealth
|
||||
|
||||
myHealth.Changed\connect setMaxHealth
|
||||
|
||||
-- Visual Effects --
|
||||
|
||||
fireEffect = New "Fire", "FireEffect"
|
||||
Heat: 0.1
|
||||
Size: 3.0
|
||||
Enabled: false
|
||||
--
|
||||
|
||||
-- regeneration
|
||||
while true
|
||||
s = wait 1
|
||||
health = Humanoid.Health
|
||||
if health > 0 -- and health < Humanoid.MaxHealth
|
||||
delta = 0
|
||||
if config
|
||||
regen = config\FindFirstChild "Regen"
|
||||
poison = config\FindFirstChild "Poison"
|
||||
ice = config\FindFirstChild "Ice"
|
||||
fire = config\FindFirstChild "Fire"
|
||||
stun = config\FindFirstChild "Stun"
|
||||
with regen do if regen
|
||||
delta += .Value.X
|
||||
if .Value.Y >= 0
|
||||
.Value = Vector3.new .Value.X + .Value.Z, .Value.Y - s, .Value.Z -- maybe have 3rd parameter be an increaser/decreaser?
|
||||
elseif .Value.Y == -1
|
||||
.Value = Vector3.new .Value.X + .Value.Z, -1, .Value.Z
|
||||
else
|
||||
\remove!
|
||||
-- infinity is -1
|
||||
|
||||
with poison do if poison
|
||||
delta -= .Value.X
|
||||
if .Value.Y >= 0
|
||||
.Value = Vector3.new .Value.X + .Value.Z, .Value.Y - s, .Value.Z
|
||||
elseif .Value.Y == -1
|
||||
.Value = Vector3.new .Value.X + .Value.Z, -1, .Value.Z
|
||||
else
|
||||
\remove!
|
||||
-- infinity is -1
|
||||
|
||||
with ice do if ice
|
||||
--print "IN ICE"
|
||||
delta -= .Value.X
|
||||
if .Value.Y >= 0
|
||||
.Value = Vector3.new .Value.X, .Value.Y - s, .Value.Z
|
||||
else
|
||||
\remove!
|
||||
|
||||
with fire do if fire
|
||||
fireEffect.Enabled = true
|
||||
fireEffect.Parent = Figure.Torso
|
||||
delta -= .Value.X
|
||||
if .Value.Y >= 0
|
||||
.Value = Vector3.new .Value.X, .Value.Y - s, .Value.Z
|
||||
else
|
||||
\remove!
|
||||
fireEffect.Enabled = false
|
||||
fireEffect.Parent = nil
|
||||
|
||||
if stun
|
||||
local backpackTools
|
||||
if stun.Value > 0
|
||||
Torso.Anchored = true
|
||||
currentChildren = script.Parent\GetChildren!
|
||||
backpackTools = game.Players\GetPlayerFromCharacter(script.Parent).Backpack\GetChildren!
|
||||
for i in *currentChildren
|
||||
if i.className == "Tool"
|
||||
inCharTag\Clone!.Parent = i
|
||||
print backpackTools
|
||||
table.insert backpackTools, i
|
||||
|
||||
for i in *backpackTools
|
||||
if not i\FindFirstChild"RobloxBuildTool"?
|
||||
hider\Clone!.Parent = i
|
||||
i.Parent = game.Lighting
|
||||
|
||||
wait 0.2
|
||||
for i in *backpackTools
|
||||
i.Parent = game.Players\GetPlayerFromCharacter(script.Parent).Backpack
|
||||
|
||||
stun.Value = stun.Value - s
|
||||
else
|
||||
Torso.Anchored = false
|
||||
for i in *backpackTools
|
||||
i\FindFirstChild"RobloxBuildTool"?\Remove!
|
||||
|
||||
i.Parent = game.Lighting
|
||||
|
||||
wait 0.2
|
||||
for i in *backpackTools
|
||||
wasInChar = i\FindFirstChild "InCharTag"
|
||||
i.Parent = if wasInChar
|
||||
wasInChar\Remove!
|
||||
script.Parent
|
||||
else
|
||||
game.Players\GetPlayerFromCharacter(script.Parent).Backpack
|
||||
|
||||
stun\Remove!
|
||||
|
||||
if delta ~= 0
|
||||
coroutine.resume coroutine.create(billboardHealthChange), delta
|
||||
--delta *= 0.01
|
||||
--health += delta * s * Humanoid.MaxHealth
|
||||
|
||||
health = Humanoid.Health + delta * s
|
||||
Humanoid.Health = if health * 1.01 < Humanoid.MaxHealth
|
||||
health
|
||||
--myHealth.Value = math.floor Humanoid.Health
|
||||
elseif delta > 0
|
||||
Humanoid.MaxHealth
|
||||
--myHealth.Value = Humanoid.Health
|
||||
519
yue/39250920.yue
519
yue/39250920.yue
|
|
@ -1,519 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
waitForProperty = (instance, name) ->
|
||||
until instance[name]
|
||||
instance.Changed\wait!
|
||||
|
||||
waitForChild = (instance, name) ->
|
||||
until instance\FindFirstChild name
|
||||
instance.ChildAdded\wait!
|
||||
|
||||
local mainFrame
|
||||
choices = {}
|
||||
local lastChoice
|
||||
choiceMap = {}
|
||||
local currentConversationDialog
|
||||
local currentConversationPartner
|
||||
local currentAbortDialogScript
|
||||
|
||||
tooFarAwayMessage = "You are too far away to chat!"
|
||||
tooFarAwaySize = 300
|
||||
characterWanderedOffMessage = "Chat ended because you walked away"
|
||||
characterWanderedOffSize = 350
|
||||
conversationTimedOut = "Chat ended because you didn't reply"
|
||||
conversationTimedOutSize = 350
|
||||
|
||||
local player
|
||||
local chatNotificationGui
|
||||
local messageDialog
|
||||
local timeoutScript
|
||||
local reenableDialogScript
|
||||
dialogMap = {}
|
||||
dialogConnections = {}
|
||||
|
||||
local gui
|
||||
waitForChild game, "CoreGui"
|
||||
waitForChild game.CoreGui, "RobloxGui"
|
||||
|
||||
gui = if game.CoreGui.RobloxGui\FindFirstChild "ControlFrame"
|
||||
game.CoreGui.RobloxGui.ControlFrame
|
||||
else
|
||||
game.CoreGui.RobloxGui
|
||||
|
||||
currentTone = ->
|
||||
if currentConversationDialog
|
||||
currentConversationDialog.Tone
|
||||
else
|
||||
Enum.DialogTone.Neutral
|
||||
|
||||
createChatNotificationGui = ->
|
||||
chatNotificationGui = New "BillboardGui", "ChatNotificationGui"
|
||||
ExtentsOffset: Vector3.new 0, 1, 0
|
||||
Size: UDim2.new 4, 0, 5.42857122, 0
|
||||
SizeOffset: Vector2.new 0, 0
|
||||
StudsOffset: Vector3.new 0.4, 4.3, 0
|
||||
Enabled: true
|
||||
RobloxLocked: true
|
||||
Active: true
|
||||
|
||||
* New "ImageLabel", "Image"
|
||||
Active: false
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Image: ""
|
||||
RobloxLocked: true
|
||||
|
||||
* New "ImageButton", "Button"
|
||||
AutoButtonColor: false
|
||||
Position: UDim2.new 0.088, 0, 0.053, 0
|
||||
Size: UDim2.new 0.83, 0, 0.46, 0
|
||||
Image: ""
|
||||
BackgroundTransparency: 1
|
||||
RobloxLocked: true
|
||||
|
||||
getChatColor = (tone) ->
|
||||
if tone == Enum.DialogTone.Neutral
|
||||
Enum.ChatColor.Blue
|
||||
elseif tone == Enum.DialogTone.Friendly
|
||||
Enum.ChatColor.Green
|
||||
elseif tone == Enum.DialogTone.Enemy
|
||||
Enum.ChatColor.Red
|
||||
|
||||
resetColor = (frame, tone) ->
|
||||
if tone == Enum.DialogTone.Neutral
|
||||
frame.BackgroundColor3 = Color3.new 0, 0, 179 / 255
|
||||
frame.Number.TextColor3 = Color3.new 45 / 255, 142 / 255, 245 / 255
|
||||
elseif tone == Enum.DialogTone.Friendly
|
||||
frame.BackgroundColor3 = Color3.new 0, 77 / 255, 0
|
||||
frame.Number.TextColor3 = Color3.new 0, 190 / 255, 0
|
||||
elseif tone == Enum.DialogTone.Enemy
|
||||
frame.BackgroundColor3 = Color3.new 140 / 255, 0, 0
|
||||
frame.Number.TextColor3 = Color3.new 255 / 255, 88 / 255, 79 / 255
|
||||
|
||||
styleChoices = (tone) ->
|
||||
for _, obj in pairs choices
|
||||
resetColor obj, tone
|
||||
resetColor lastChoice, tone
|
||||
|
||||
styleMainFrame = (tone) ->
|
||||
if tone == Enum.DialogTone.Neutral
|
||||
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||
elseif tone == Enum.DialogTone.Friendly
|
||||
mainFrame.Style = Enum.FrameStyle.ChatGreen
|
||||
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png"
|
||||
elseif tone == Enum.DialogTone.Enemy
|
||||
mainFrame.Style = Enum.FrameStyle.ChatRed
|
||||
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png"
|
||||
|
||||
styleChoices tone
|
||||
|
||||
setChatNotificationTone = (gui, purpose, tone) ->
|
||||
gui.Image.Image = if tone == Enum.DialogTone.Neutral
|
||||
"rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
|
||||
elseif tone == Enum.DialogTone.Friendly
|
||||
"rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
|
||||
elseif tone == Enum.DialogTone.Enemy
|
||||
"rbxasset://textures/chatBubble_botRed_notify_bkg.png"
|
||||
|
||||
gui.Image.Button.Image = if purpose == Enum.DialogPurpose.Quest
|
||||
"rbxasset://textures/chatBubble_bot_notify_bang.png"
|
||||
elseif purpose == Enum.DialogPurpose.Help
|
||||
"rbxasset://textures/chatBubble_bot_notify_question.png"
|
||||
elseif purpose == Enum.DialogPurpose.Shop
|
||||
"rbxasset://textures/chatBubble_bot_notify_money.png"
|
||||
|
||||
createMessageDialog = ->
|
||||
messageDialog = New "Frame", "DialogScriptMessage"
|
||||
Style: Enum.FrameStyle.RobloxRound
|
||||
Visible: false
|
||||
|
||||
* New "TextLabel", "Text"
|
||||
Position: UDim2.new 0, 0, 0, -1
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
FontSize: Enum.FontSize.Size14
|
||||
BackgroundTransparency: 1
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
RobloxLocked: true
|
||||
|
||||
showMessage = (msg, size) ->
|
||||
with messageDialog
|
||||
.Text.Text = msg
|
||||
.Size = UDim2.new 0, size, 0, 40
|
||||
.Position = UDim2.new 0.5, -size / 2, 0.5, -40
|
||||
.Visible = true
|
||||
wait 2
|
||||
.Visible = false
|
||||
|
||||
variableDelay = (str) ->
|
||||
length = math.min string.len(str), 100
|
||||
wait 0.75 + (length / 75) * 1.5
|
||||
|
||||
highlightColor = (frame, tone) ->
|
||||
if tone == Enum.DialogTone.Neutral
|
||||
frame.BackgroundColor3 = Color3.new 2 / 255, 108 / 255, 255 / 255
|
||||
frame.Number.TextColor3 = Color3.new 1, 1, 1
|
||||
elseif tone == Enum.DialogTone.Friendly
|
||||
frame.BackgroundColor3 = Color3.new 0, 128 / 255, 0
|
||||
frame.Number.TextColor3 = Color3.new 1, 1, 1
|
||||
elseif tone == Enum.DialogTone.Enemy
|
||||
frame.BackgroundColor3 = Color3.new 204 / 255, 0, 0
|
||||
frame.Number.TextColor3 = Color3.new 1, 1, 1
|
||||
|
||||
endDialog = ->
|
||||
if currentAbortDialogScript
|
||||
currentAbortDialogScript\Remove!
|
||||
currentAbortDialogScript = nil
|
||||
|
||||
dialog = currentConversationDialog
|
||||
currentConversationDialog = nil
|
||||
if dialog and dialog.InUse
|
||||
with reenableDialogScript\Clone!
|
||||
.archivable = false
|
||||
.Disabled = false
|
||||
.Parent = dialog
|
||||
|
||||
for dialog, gui in pairs dialogMap
|
||||
if dialog and gui
|
||||
gui.Enabled = not dialog.InUse
|
||||
|
||||
currentConversationPartner = nil
|
||||
|
||||
wanderDialog = ->
|
||||
print "Wander"
|
||||
mainFrame.Visible = false
|
||||
endDialog!
|
||||
showMessage characterWanderedOffMessage, characterWanderedOffSize
|
||||
|
||||
timeoutDialog = ->
|
||||
print "Timeout"
|
||||
mainFrame.Visible = false
|
||||
endDialog!
|
||||
showMessage conversationTimedOut, conversationTimedOutSize
|
||||
normalEndDialog = ->
|
||||
print "Done"
|
||||
endDialog!
|
||||
|
||||
sanitizeMessage = (msg) ->
|
||||
if string.len(msg) == 0
|
||||
"..."
|
||||
else
|
||||
msg
|
||||
|
||||
renewKillswitch = (dialog) ->
|
||||
with currentAbortDialogScript
|
||||
if currentAbortDialogScript
|
||||
\Remove!
|
||||
currentAbortDialogScript = nil
|
||||
|
||||
currentAbortDialogScript = timeoutScript\Clone!
|
||||
.archivable = false
|
||||
.Disabled = false
|
||||
.Parent = dialog
|
||||
|
||||
presentDialogChoices = (talkingPart, dialogChoices) ->
|
||||
return if not currentConversationDialog
|
||||
|
||||
currentConversationPartner = talkingPart
|
||||
|
||||
sortedDialogChoices = [obj \
|
||||
for _, obj in pairs sortedDialogChoices \
|
||||
when obj\IsA "DialogChoice"]
|
||||
|
||||
table.sort sortedDialogChoices, (a, b) -> a.Name < b.Name
|
||||
|
||||
if #sortedDialogChoices == 0
|
||||
normalEndDialog!
|
||||
return
|
||||
|
||||
pos = 1
|
||||
yPosition = 0
|
||||
choiceMap = {}
|
||||
for _, obj in pairs choices
|
||||
obj.Visible = false
|
||||
|
||||
for _, obj in pairs sortedDialogChoices
|
||||
if pos <= #choices
|
||||
--3 lines is the maximum, set it to that temporarily
|
||||
choices[pos].Size = UDim2.new 1, 0, 0, 24 * 3
|
||||
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||
height = math.ceil(choices[pos].UserPrompt.TextBounds.Y / 24) * 24
|
||||
|
||||
choices[pos].Position = UDim2.new 0, 0, 0, yPosition
|
||||
choices[pos].Size = UDim2.new 1, 0, 0, height
|
||||
choices[pos].Visible = true
|
||||
|
||||
choiceMap[choices[pos]] = obj
|
||||
|
||||
yPosition += height
|
||||
pos += 1
|
||||
|
||||
lastChoice.Position = UDim2.new 0, 0, 0, yPosition
|
||||
lastChoice.Number.Text = pos .. ")"
|
||||
|
||||
mainFrame.Size = UDim2.new 0, 350, 0, yPosition + 24 + 32
|
||||
mainFrame.Position = UDim2.new 0, 20, 0, -mainFrame.Size.Y.Offset - 20
|
||||
styleMainFrame currentTone!
|
||||
mainFrame.Visible = true
|
||||
|
||||
selectChoice = (choice) ->
|
||||
renewKillswitch currentConversationDialog
|
||||
|
||||
--First hide the Gui
|
||||
mainFrame.Visible = false
|
||||
if choice == lastChoice
|
||||
game.Chat\Chat game.Players.LocalPlayer.Character, "Goodbye!", getChatColor currentTone!
|
||||
|
||||
normalEndDialog!
|
||||
else
|
||||
dialogChoice = choiceMap[choice]
|
||||
|
||||
game.Chat\Chat(
|
||||
game.Players.LocalPlayer.Character,
|
||||
sanitizeMessage(dialogChoice.UserDialog),
|
||||
getChatColor currentTone!
|
||||
)
|
||||
|
||||
wait 1
|
||||
currentConversationDialog\SignalDialogChoiceSelected player, dialogChoice
|
||||
game.Chat\Chat(
|
||||
currentConversationPartner,
|
||||
sanitizeMessage(dialogChoice.ResponseDialog),
|
||||
getChatColor currentTone!
|
||||
)
|
||||
|
||||
variableDelay dialogChoice.ResponseDialog
|
||||
presentDialogChoices currentConversationPartner, dialogChoice\GetChildren!
|
||||
|
||||
newChoice = (numberText) ->
|
||||
frame = New "TextButton"
|
||||
BackgroundColor3: Color3.new 0, 0, 179 / 255
|
||||
AutoButtonColor: false
|
||||
BorderSizePixel: 0
|
||||
Text: ""
|
||||
RobloxLocked: true
|
||||
|
||||
* New "TextLabel", "Number"
|
||||
TextColor3: Color3.new 127 / 255, 212 / 255, 255 / 255
|
||||
Text: numberText
|
||||
FontSize: Enum.FontSize.Size14
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 4, 0, 2
|
||||
Size: UDim2.new 0, 20, 0, 24
|
||||
TextXAlignment: Enum.TextXAlignment.Left
|
||||
TextYAlignment: Enum.TextYAlignment.Top
|
||||
RobloxLocked: true
|
||||
|
||||
* New "TextLabel", "UserPrompt"
|
||||
BackgroundTransparency: 1
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Position: UDim2.new 0, 28, 0, 2
|
||||
Size: UDim2.new 1, -32, 1, -4
|
||||
TextXAlignment: Enum.TextXAlignment.Left
|
||||
TextYAlignment: Enum.TextYAlignment.Top
|
||||
TextWrap: true
|
||||
RobloxLocked: true
|
||||
|
||||
frame.MouseEnter\connect -> highlightColor frame, currentTone!
|
||||
frame.MouseLeave\connect -> resetColor frame, currentTone!
|
||||
frame.MouseButton1Click\connect -> selectChoice frame
|
||||
frame
|
||||
|
||||
initialize = (parent) ->
|
||||
choices[1] = newChoice "1)"
|
||||
choices[2] = newChoice "2)"
|
||||
choices[3] = newChoice "3)"
|
||||
choices[4] = newChoice "4)"
|
||||
|
||||
lastChoice = newChoice "5)"
|
||||
lastChoice.UserPrompt.Text = "Goodbye!"
|
||||
lastChoice.Size = UDim2.new 1, 0, 0, 28
|
||||
|
||||
mainFrame = New "Frame", "UserDialogArea"
|
||||
Size: UDim2.new 0, 350, 0, 200
|
||||
Style: Enum.FrameStyle.ChatBlue
|
||||
Visible: false
|
||||
|
||||
* New "ImageLabel", "Tail"
|
||||
Size: UDim2.new 0, 62, 0, 53
|
||||
Position: UDim2.new 1, 8, 0.25
|
||||
Image: "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||
BackgroundTransparency: 1
|
||||
RobloxLocked: true
|
||||
|
||||
for _, obj in pairs choices
|
||||
obj.RobloxLocked = true
|
||||
obj.Parent = mainFrame
|
||||
lastChoice.RobloxLocked = true
|
||||
lastChoice.Parent = mainFrame
|
||||
|
||||
mainFrame.RobloxLocked = true
|
||||
mainFrame.Parent = parent
|
||||
|
||||
doDialog = (dialog) ->
|
||||
until Instance.Lock dialog, player
|
||||
wait!
|
||||
|
||||
if dialog.InUse
|
||||
Instance.Unlock dialog
|
||||
return
|
||||
else
|
||||
dialog.InUse = true
|
||||
Instance.Unlock dialog
|
||||
|
||||
currentConversationDialog = dialog
|
||||
game.Chat\Chat dialog.Parent, dialog.InitialPrompt, getChatColor dialog.Tone
|
||||
variableDelay dialog.InitialPrompt
|
||||
|
||||
presentDialogChoices dialog.Parent, dialog\GetChildren!
|
||||
|
||||
checkForLeaveArea = ->
|
||||
while currentConversationDialog
|
||||
if currentConversationDialog.Parent and (
|
||||
player\DistanceFromCharacter currentConversationDialog.Parent.Position >= currentConversationDialog.ConversationDistance
|
||||
)
|
||||
wanderDialog!
|
||||
|
||||
wait 1
|
||||
|
||||
startDialog = (dialog) ->
|
||||
if dialog.Parent and dialog.Parent\IsA "BasePart"
|
||||
if player\DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance
|
||||
showMessage tooFarAwayMessage, tooFarAwaySize
|
||||
return
|
||||
|
||||
for dialog, gui in pairs dialogMap
|
||||
if dialog and gui
|
||||
gui.Enabled = false
|
||||
|
||||
renewKillswitch dialog
|
||||
|
||||
delay 1, checkForLeaveArea
|
||||
doDialog dialog
|
||||
|
||||
removeDialog = (dialog) ->
|
||||
if dialogMap[dialog]
|
||||
dialogMap[dialog]\Remove!
|
||||
dialogMap[dialog] = nil
|
||||
if dialogConnections[dialog]
|
||||
dialogConnections[dialog]\disconnect!
|
||||
dialogConnections[dialog] = nil
|
||||
|
||||
addDialog = (dialog) ->
|
||||
if dialog.Parent
|
||||
if dialog.Parent\IsA "BasePart"
|
||||
chatGui = chatNotificationGui\clone!
|
||||
with chatGui
|
||||
.Enabled = not dialog.InUse
|
||||
.Adornee = dialog.Parent
|
||||
.RobloxLocked = true
|
||||
.Parent = game.CoreGui
|
||||
.Image.Button.MouseButton1Click\connect ->
|
||||
startDialog dialog
|
||||
|
||||
setChatNotificationTone chatGui, dialog.Purpose, dialog.Tone
|
||||
|
||||
dialogMap[dialog] = chatGui
|
||||
|
||||
dialogConnections[dialog] = dialog.Changed\connect (prop) ->
|
||||
if prop == "Parent" and dialog.Parent
|
||||
--This handles the reparenting case, seperate from removal case
|
||||
removeDialog dialog
|
||||
addDialog dialog
|
||||
elseif prop == "InUse"
|
||||
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
||||
if dialog == currentConversationDialog
|
||||
timeoutDialog!
|
||||
|
||||
elseif prop == "Tone" or prop == "Purpose"
|
||||
setChatNotificationTone chatGui, dialog.Purpose, dialog.Tone
|
||||
|
||||
else -- still need to listen to parent changes even if current parent is not a BasePart
|
||||
dialogConnections[dialog] = dialog.Changed\connect (prop) ->
|
||||
if prop == "Parent" and dialog.Parent
|
||||
--This handles the reparenting case, seperate from removal case
|
||||
removeDialog dialog
|
||||
addDialog dialog
|
||||
|
||||
fetchScripts = ->
|
||||
model = game\GetService"InsertService"\LoadAsset 39226062
|
||||
if type(model) == "string" -- load failed, lets try again
|
||||
wait 0.1
|
||||
model = game\GetService"InsertService"\LoadAsset 39226062
|
||||
return if type(model) == "string" -- not going to work, lets bail
|
||||
|
||||
waitForChild model, "TimeoutScript"
|
||||
timeoutScript = model.TimeoutScript
|
||||
waitForChild model, "ReenableDialogScript"
|
||||
reenableDialogScript = model.ReenableDialogScript
|
||||
|
||||
onLoad = ->
|
||||
waitForProperty game.Players, "LocalPlayer"
|
||||
player = game.Players.LocalPlayer
|
||||
waitForProperty player, "Character"
|
||||
|
||||
--print "Fetching Scripts"
|
||||
fetchScripts!
|
||||
|
||||
--print "Creating Guis"
|
||||
createChatNotificationGui!
|
||||
|
||||
--print "Creating MessageDialog"
|
||||
createMessageDialog!
|
||||
messageDialog.RobloxLocked = true
|
||||
messageDialog.Parent = gui
|
||||
|
||||
--print "Waiting for BottomLeftControl"
|
||||
waitForChild gui, "BottomLeftControl"
|
||||
|
||||
--print "Initializing Frame"
|
||||
frame = New "Frame", "DialogFrame"
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 0, 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
RobloxLocked: true
|
||||
Parent: gui.BottomLeftControl
|
||||
|
||||
initialize frame
|
||||
|
||||
--print "Adding Dialogs"
|
||||
game.CollectionService.ItemAdded\connect (obj) ->
|
||||
if obj\IsA "Dialog"
|
||||
addDialog obj
|
||||
|
||||
game.CollectionService.ItemRemoved\connect (obj) ->
|
||||
if obj\IsA "Dialog"
|
||||
removeDialog obj
|
||||
|
||||
for _, obj in pairs game.CollectionService\GetCollection "Dialog"
|
||||
if obj\IsA "Dialog"
|
||||
addDialog obj
|
||||
|
||||
onLoad!
|
||||
3636
yue/45284430.yue
3636
yue/45284430.yue
File diff suppressed because it is too large
Load Diff
|
|
@ -1,17 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
t = {}
|
||||
|
||||
t.Foo = -> print "foo"
|
||||
t.Bar = -> print "bar"
|
||||
|
||||
t.Help = (funcNameOrFunc) ->
|
||||
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
||||
switch funcNameOrFunc
|
||||
when "Foo", t.Foo
|
||||
"Function Foo. Arguments: None. Side effect: prints foo"
|
||||
when "Bar", t.Bar
|
||||
"Function Bar. Arguments: None. Side effect: prints bar"
|
||||
|
||||
t
|
||||
2257
yue/46295863.yue
2257
yue/46295863.yue
File diff suppressed because it is too large
Load Diff
3083
yue/48488235.yue
3083
yue/48488235.yue
File diff suppressed because it is too large
Load Diff
295
yue/48488398.yue
295
yue/48488398.yue
|
|
@ -1,295 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
waitForProperty = (instance, property) ->
|
||||
until instance[property]
|
||||
instance.Changed\wait!
|
||||
|
||||
waitForChild = (instance, name) ->
|
||||
until instance\FindFirstChild name
|
||||
instance.ChildAdded\wait!
|
||||
|
||||
waitForProperty game.Players, "LocalPlayer"
|
||||
waitForChild script.Parent, "Popup"
|
||||
waitForChild script.Parent.Popup, "AcceptButton"
|
||||
script.Parent.Popup.AcceptButton.Modal = true
|
||||
|
||||
localPlayer = game.Players.LocalPlayer
|
||||
local teleportUI
|
||||
|
||||
friendRequestBlacklist = {}
|
||||
|
||||
teleportEnabled = true
|
||||
|
||||
showOneButton = ->
|
||||
with popup = script.Parent\FindFirstChild "Popup"
|
||||
if popup
|
||||
.OKButton.Visible = true
|
||||
.DeclineButton.Visible = false
|
||||
.AcceptButton.Visible = false
|
||||
|
||||
showTwoButtons = ->
|
||||
with popup = script.Parent\FindFirstChild "Popup"
|
||||
if popup
|
||||
.OKButton.Visible = false
|
||||
.DeclineButton.Visible = true
|
||||
.AcceptButton.Visible = true
|
||||
|
||||
makePopupInvisible = ->
|
||||
if script.Parent.Popup
|
||||
script.Parent.Popup.Visible = false
|
||||
|
||||
makeFriend = (fromPlayer, toPlayer) ->
|
||||
popup = script.Parent\FindFirstChild "Popup"
|
||||
return if popup == nil -- there is no popup!
|
||||
return if popup.Visible -- currently popping something, abort!
|
||||
return if friendRequestBlacklist[fromPlayer] -- previously cancelled friend request, we don't want it!
|
||||
|
||||
with popup
|
||||
.PopupText.Text = "Accept Friend Request from #{fromPlayer.Name}?"
|
||||
.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId=#{fromPlayer.userId}&x=352&y=352"
|
||||
|
||||
showTwoButtons!
|
||||
.Visible = true
|
||||
.AcceptButton.Text = "Accept"
|
||||
.DeclineButton.Text = "Decline"
|
||||
\TweenSize UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true
|
||||
|
||||
local yesCon, noCon
|
||||
|
||||
yesCon = popup.AcceptButton.MouseButton1Click\connect ->
|
||||
popup.Visible = false
|
||||
toPlayer\RequestFriendship fromPlayer
|
||||
|
||||
yesCon?\disconnect!
|
||||
noCon?\disconnect!
|
||||
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
|
||||
noCon = popup.DeclineButton.MouseButton1Click\connect ->
|
||||
popup.Visible = false
|
||||
toPlayer\RevokeFriendship fromPlayer
|
||||
friendRequestBlacklist[fromPlayer] = true
|
||||
print "pop up blacklist"
|
||||
|
||||
yesCon?\disconnect!
|
||||
noCon?\disconnect!
|
||||
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
|
||||
game.Players.FriendRequestEvent\connect (fromPlayer, toPlayer, event) ->
|
||||
-- if this doesn't involve me, then do nothing
|
||||
return if fromPlayer ~= localPlayer and toPlayer ~= localPlayer
|
||||
|
||||
if fromPlayer == localPlayer
|
||||
if event == Enum.FriendRequestEvent.Accept
|
||||
game\GetService"GuiService"\SendNotification(
|
||||
"You are Friends",
|
||||
"With #{toPlayer.Name}!",
|
||||
"http://www.roblox.com/thumbs/avatar.ashx?userId=#{toPlayer.userId}&x=48&y=48",
|
||||
5,
|
||||
->
|
||||
)
|
||||
elseif toPlayer == localPlayer
|
||||
if event == Enum.FriendRequestEvent.Issue
|
||||
return if friendRequestBlacklist[fromPlayer]
|
||||
-- previously cancelled friend request, we don't want it!
|
||||
game\GetService"GuiService"\SendNotification(
|
||||
"Friend Request",
|
||||
"From #{fromPlayer.Name}",
|
||||
"http://www.roblox.com/thumbs/avatar.ashx?userId=#{fromPlayer.userId}&x=48&y=48",
|
||||
8,
|
||||
-> makeFriend fromPlayer, toPlayer
|
||||
)
|
||||
elseif event == Enum.FriendRequestEvent.Accept
|
||||
game\GetService"GuiService"\SendNotification(
|
||||
"You are Friends",
|
||||
"With #{fromPlayer.Name}!",
|
||||
"http://www.roblox.com/thumbs/avatar.ashx?userId=#{fromPlayer.userId}&x=48&y=48",
|
||||
5,
|
||||
->
|
||||
)
|
||||
|
||||
showTeleportUI = (message, timer) ->
|
||||
|
||||
teleportUI?\Remove!
|
||||
waitForChild localPlayer, "PlayerGui"
|
||||
|
||||
with Instance.new "Message"
|
||||
.Text = message
|
||||
.Parent = localPlayer.PlayerGui
|
||||
if timer > 0
|
||||
wait timer
|
||||
\Remove!
|
||||
|
||||
onTeleport = (teleportState, _, _) ->
|
||||
if game\GetService"TeleportService".CustomizedTeleportUI == false
|
||||
showTeleportUI switch teleportState
|
||||
when Enum.TeleportState.Started
|
||||
"Teleport started...", 0
|
||||
when Enum.TeleportState.WaitingForServer
|
||||
"Requesting server...", 0
|
||||
when Enum.TeleportState.InProgress
|
||||
"Teleporting...", 0
|
||||
when Enum.TeleportState.Failed
|
||||
"Teleport failed. Insufficient privileges or target place does not exist.", 3
|
||||
|
||||
if teleportEnabled
|
||||
localPlayer.OnTeleport\connect onTeleport
|
||||
|
||||
game\GetService"TeleportService".ErrorCallback = (message) ->
|
||||
popup = script.Parent\FindFirstChild "Popup"
|
||||
showOneButton!
|
||||
popup.PopupText.Text = message
|
||||
local clickCon
|
||||
clickCon = popup.OKButton.MouseButton1Click\connect ->
|
||||
game\GetService"TeleportService"\TeleportCancel!
|
||||
clickCon?\disconnect!
|
||||
game.GuiService\RemoveCenterDialog script.Parent\FindFirstChild "Popup"
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
game.GuiService\AddCenterDialog(
|
||||
script.Parent\FindFirstChild "Popup",
|
||||
Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
->
|
||||
showOneButton!
|
||||
script.Parent\FindFirstChild"Popup".Visible = true
|
||||
popup\TweenSize UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true
|
||||
--HideFunction
|
||||
->
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
)
|
||||
game\GetService"TeleportService".ConfirmationCallback = (message, placeId, spawnName) ->
|
||||
popup = script.Parent\FindFirstChild "Popup"
|
||||
popup.PopupText.Text = message
|
||||
popup.PopupImage.Image = ""
|
||||
|
||||
local yesCon, noCon
|
||||
|
||||
killCons = ->
|
||||
yesCon?\disconnect!
|
||||
noCon?\disconnect!
|
||||
|
||||
game.GuiService\RemoveCenterDialog script.Parent\FindFirstChild "Popup"
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
|
||||
yesCon = popup.AcceptButton.MouseButton1Click\connect ->
|
||||
killCons!
|
||||
success, err = try
|
||||
game\GetService"TeleportService"\TeleportImpl placeId, spawnName
|
||||
if not success
|
||||
showOneButton!
|
||||
popup.PopupText.Text = err
|
||||
clickCon = popup.OKButton.MouseButton1Click\connect ->
|
||||
clickCon?\disconnect!
|
||||
game.GuiService\RemoveCenterDialog script.Parent\FindFirstChild "Popup"
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
game.GuiService\AddCenterDialog(
|
||||
script.Parent\FindFirstChild "Popup",
|
||||
Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
->
|
||||
showOneButton!
|
||||
script.Parent\FindFirstChild"Popup".Visible = true
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
--HideFunction
|
||||
->
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
)
|
||||
|
||||
noCon = popup.DeclineButton.MouseButton1Click\connect ->
|
||||
killCons!
|
||||
try
|
||||
game\GetService"TeleportService"\TeleportCancel!
|
||||
|
||||
centerDialogSuccess = try
|
||||
game.GuiService\AddCenterDialog(
|
||||
script.Parent\FindFirstChild "Popup",
|
||||
Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
->
|
||||
showTwoButtons!
|
||||
popup.AcceptButton.Text = "Leave"
|
||||
popup.DeclineButton.Text = "Stay"
|
||||
script.Parent\FindFirstChild"Popup".Visible = true
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 330, 0, 350),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true
|
||||
)
|
||||
--HideFunction
|
||||
->
|
||||
popup\TweenSize(
|
||||
UDim2.new(0, 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,
|
||||
1,
|
||||
true,
|
||||
makePopupInvisible!
|
||||
)
|
||||
)
|
||||
|
||||
if centerDialogSuccess == false
|
||||
script.Parent\FindFirstChild"Popup".Visible = true
|
||||
popup.AcceptButton.Text = "Leave"
|
||||
popup.DeclineButton.Text = "Stay"
|
||||
popup\TweenSize UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true
|
||||
|
||||
true
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
popupFrame = New "Frame", "Popup"
|
||||
Position: UDim2.new 0.5, -165, 0.5, -175
|
||||
Size: UDim2.new 0, 330, 0, 350
|
||||
Style: Enum.FrameStyle.RobloxRound
|
||||
ZIndex: 4
|
||||
Visible: false
|
||||
Parent: script.Parent
|
||||
|
||||
* New "TextLabel", "PopupText"
|
||||
Size: UDim2.new 1, 0, 0.8, 0
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size36
|
||||
BackgroundTransparency: 1
|
||||
Text: "Hello I'm a popup"
|
||||
TextColor3: Color3.new 248 / 255, 248 / 255, 248 / 255
|
||||
TextWrap: true
|
||||
ZIndex: 5
|
||||
|
||||
* New "TextButton", "AcceptButton"
|
||||
Position: UDim2.new 0, 20, 0, 270
|
||||
Size: UDim2.new 0, 100, 0, 50
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size24
|
||||
Style: Enum.ButtonStyle.RobloxButton
|
||||
TextColor3: Color3.new 248 / 255, 248 / 255, 248 / 255
|
||||
Text: "Yes"
|
||||
ZIndex: 5
|
||||
|
||||
* New "ImageLabel", "PopupImage"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0.5, -140, 0, 0
|
||||
Size: UDim2.new 0, 280, 0, 280
|
||||
ZIndex: 3
|
||||
|
||||
* New "ImageLabel", "Backing"
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Image: "http://banland.xyz/asset/?id=47574181"
|
||||
ZIndex: 2
|
||||
|
||||
:AcceptButton = popupFrame
|
||||
|
||||
with popupFrame\clone!
|
||||
.Name = "Darken"
|
||||
.Size = UDim2.new 1, 16, 1, 16
|
||||
.Position = UDim2.new 0, -8, 0, -8
|
||||
.ZIndex = 1
|
||||
.Parent = popupFrame
|
||||
|
||||
with AcceptButton\clone!
|
||||
.Name = "DeclineButton"
|
||||
.Position = UDim2.new 1, -120, 0, 270
|
||||
.Text = "No"
|
||||
.Parent = popupFrame
|
||||
|
||||
with AcceptButton\clone!
|
||||
.Name = "OKButton"
|
||||
.Text = "OK"
|
||||
.Position = UDim2.new 0.5, -50, 0, 270
|
||||
.Visible = false
|
||||
.Parent = popupFrame
|
||||
|
||||
script\remove!
|
||||
859
yue/53878047.yue
859
yue/53878047.yue
|
|
@ -1,859 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- This script creates almost all gui elements found in the backpack (warning: there are a lot!)
|
||||
-- TODO: automate this process
|
||||
|
||||
return if game.CoreGui.Version < 3
|
||||
-- peace out if we aren't using the right client
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
gui = script.Parent
|
||||
|
||||
-- A couple of necessary functions
|
||||
waitForChild = (instance, name) ->
|
||||
until instance\FindFirstChild name
|
||||
instance.ChildAdded\wait!
|
||||
|
||||
waitForProperty = (instance, property) ->
|
||||
until instance[property]
|
||||
instance.Changed\wait!
|
||||
|
||||
IsTouchDevice = ->
|
||||
touchEnabled = false
|
||||
try
|
||||
touchEnabled = Game\GetService"UserInputService".TouchEnabled
|
||||
touchEnabled
|
||||
|
||||
IsPhone = ->
|
||||
if gui.AbsoluteSize.Y <= 320
|
||||
true
|
||||
else false
|
||||
|
||||
waitForChild game, "Players"
|
||||
waitForProperty game.Players, "LocalPlayer"
|
||||
|
||||
-- First up is the current loadout
|
||||
CurrentLoadout = New "Frame", "CurrentLoadout"
|
||||
Position: UDim2.new 0.5, -300, 1, -85
|
||||
Size: UDim2.new 0, 600, 0, 54
|
||||
BackgroundTransparency: 1
|
||||
RobloxLocked: true
|
||||
Parent: gui
|
||||
|
||||
* New "BoolValue", "Debounce"
|
||||
RobloxLocked: true
|
||||
|
||||
* New "ImageLabel", "Background"
|
||||
Size: UDim2.new 1.2, 0, 1.2, 0
|
||||
Image: "http://banland.xyz/asset/?id=96536002"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new -0.1, 0, -0.1, 0
|
||||
ZIndex: 0.0
|
||||
Visible: false
|
||||
|
||||
* New "ImageLabel"
|
||||
Size: UDim2.new 1, 0, 0.025, 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Image: "http://banland.xyz/asset/?id=97662207"
|
||||
BackgroundTransparency: 1
|
||||
|
||||
waitForChild gui, "ControlFrame"
|
||||
New "ImageButton", "BackpackButton"
|
||||
RobloxLocked: true
|
||||
Visible: false
|
||||
BackgroundTransparency: 1
|
||||
Image: "http://banland.xyz/asset/?id=97617958"
|
||||
Position: UDim2.new 0.5, -60, 1, -108
|
||||
Size: UDim2.new 0, 120, 0, 18
|
||||
Parent: gui.ControlFrame
|
||||
|
||||
NumSlots = 9
|
||||
|
||||
if IsPhone!
|
||||
NumSlots = 3
|
||||
CurrentLoadout.Size = UDim2.new 0, 180, 0, 54
|
||||
CurrentLoadout.Position = UDim2.new 0.5, -90, 1, -85
|
||||
|
||||
for i = 0, NumSlots
|
||||
slotFrame = New "Frame", "Slot#{i}"
|
||||
RobloxLocked: true
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 1
|
||||
BorderColor3: Color3.new 1, 1, 1
|
||||
ZIndex: 4.0
|
||||
Position: UDim2.new if i == 0
|
||||
0.9, 0, 0, 0
|
||||
else
|
||||
(i - 1) * 0.1, (i - 1) * 6, 0, 0
|
||||
Size: UDim2.new 0, 54, 1, 0
|
||||
Parent: CurrentLoadout
|
||||
|
||||
if gui.AbsoluteSize.Y <= 320
|
||||
slotFrame.Position = UDim2.new 0, (i - 1) * 60, 0, -50
|
||||
print "Well got here", slotFrame, slotFrame.Position.X.Scale, slotFrame.Position.X.Offset
|
||||
|
||||
if i == 0
|
||||
slotFrame\Destroy!
|
||||
|
||||
TempSlot = New "ImageButton", "TempSlot"
|
||||
Active: true
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
BackgroundTransparency: 1
|
||||
Style: "Custom"
|
||||
Visible: false
|
||||
RobloxLocked: true
|
||||
ZIndex: 3.0
|
||||
Parent: CurrentLoadout
|
||||
|
||||
* New "ImageLabel", "Background"
|
||||
BackgroundTransparency: 1
|
||||
Image: "http://banland.xyz/asset/?id=97613075"
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
|
||||
* New "ObjectValue", "GearReference"
|
||||
RobloxLocked: true
|
||||
|
||||
-- * New "ImageLabel", "Highlight"
|
||||
-- BackgroundTransparency: 1
|
||||
-- Image: "http://banland.xyz/asset/?id=97643886"
|
||||
-- Size: UDim2.new 1, 0, 1, 0
|
||||
-- Visible: false
|
||||
|
||||
* New "TextLabel", "ToolTipLabel"
|
||||
RobloxLocked: true
|
||||
Text: ""
|
||||
BackgroundTransparency: 0.5
|
||||
BorderSizePixel: 0
|
||||
Visible: false
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
TextStrokeTransparency: 0
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Size: UDim2.new 1, 60, 0, 20
|
||||
Position: UDim2.new 0, -30, 0, -30
|
||||
--TextWrap: true
|
||||
|
||||
* New "BoolValue", "Kill"
|
||||
RobloxLocked: true
|
||||
|
||||
* New "TextLabel", "GearText"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.Arial
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Position: UDim2.new 0, -8, 0, -8
|
||||
Size: UDim2.new 1, 16, 1, 16
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextWrap: true
|
||||
ZIndex: 5.0
|
||||
|
||||
* New "ImageLabel", "GearImage"
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
ZIndex: 5.0
|
||||
RobloxLocked: true
|
||||
|
||||
SlotNumber = New "TextLabel", "SlotNumber"
|
||||
BackgroundTransparency: 1
|
||||
BorderSizePixel: 0
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 0, 10, 0, 15
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextTransparency: 0
|
||||
TextXAlignment: Enum.TextXAlignment.Left
|
||||
TextYAlignment: Enum.TextYAlignment.Bottom
|
||||
RobloxLocked: true
|
||||
Parent: TempSlot
|
||||
ZIndex: 5
|
||||
|
||||
if IsTouchDevice!
|
||||
SlotNumber.Visible = false
|
||||
|
||||
SlotNumberDownShadow = with SlotNumber\Clone!
|
||||
.Name = "SlotNumberDownShadow"
|
||||
.TextColor3 = Color3.new 0, 0, 0
|
||||
.Position = UDim2.new 0, 1, 0, -1
|
||||
.Parent = TempSlot
|
||||
.ZIndex = 2
|
||||
|
||||
with SlotNumberDownShadow\Clone!
|
||||
.Name = "SlotNumberUpShadow"
|
||||
.Position = UDim2.new 0, -1, 0, -1
|
||||
.Parent = TempSlot
|
||||
|
||||
--- Great, now lets make the inventory!
|
||||
|
||||
Backpack = New "Frame", "Backpack"
|
||||
RobloxLocked: true
|
||||
Visible: false
|
||||
Position: UDim2.new 0.5, 0, 0.5, 0
|
||||
BackgroundColor3: Color3.new 32 / 255, 32 / 255, 32 / 255
|
||||
BackgroundTransparency: 0.0
|
||||
BorderSizePixel: 0
|
||||
Parent: gui
|
||||
Active: true
|
||||
|
||||
* New "BoolValue", "SwapSlot"
|
||||
RobloxLocked: true
|
||||
|
||||
* New "IntValue", "Slot"
|
||||
RobloxLocked: true
|
||||
|
||||
* New "ObjectValue", "GearButton"
|
||||
RobloxLocked: true
|
||||
|
||||
-- Generic Search gui used across backpack
|
||||
* New "Frame", "SearchFrame"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 1, -220, 0, 2
|
||||
Size: UDim2.new 0, 220, 0, 24
|
||||
|
||||
* New "ImageButton", "SearchButton"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 0, 25, 0, 25
|
||||
BackgroundTransparency: 1
|
||||
Image: "rbxasset://textures/ui/SearchIcon.png"
|
||||
|
||||
* New "TextButton", "ResetButton"
|
||||
RobloxLocked: true
|
||||
Visible: false
|
||||
Position: UDim2.new 1, -26, 0, 3
|
||||
Size: UDim2.new 0, 20, 0, 20
|
||||
Style: Enum.ButtonStyle.RobloxButtonDefault
|
||||
Text: "X"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
ZIndex: 3
|
||||
|
||||
* New "TextButton", "SearchBoxFrame"
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 0, 25, 0, 0
|
||||
Size: UDim2.new 1, -28, 0, 26
|
||||
Text: ""
|
||||
Style: Enum.ButtonStyle.RobloxButton
|
||||
|
||||
* New "TextBox", "SearchBox"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size12
|
||||
Position: UDim2.new 0, -5, 0, -5
|
||||
Size: UDim2.new 1, 10, 1, 10
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextXAlignment: Enum.TextXAlignment.Left
|
||||
ZIndex: 2
|
||||
TextWrap: true
|
||||
Text: "Search..."
|
||||
|
||||
Tabs = New "Frame", "Tabs"
|
||||
Visible: false
|
||||
Active: false
|
||||
RobloxLocked: true
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.08
|
||||
BorderSizePixel: 0
|
||||
Position: UDim2.new 0, 0, -0.1, -4
|
||||
Size: UDim2.new 1, 0, 0.1, 4
|
||||
Parent: Backpack
|
||||
|
||||
* New "Frame", "TabLine"
|
||||
RobloxLocked: true
|
||||
BackgroundColor3: Color3.new 53 / 255, 53 / 255, 53 / 255
|
||||
BorderSizePixel: 0
|
||||
Position: UDim2.new 0, 5, 1, -4
|
||||
Size: UDim2.new 1, -10, 0, 4
|
||||
ZIndex: 2
|
||||
|
||||
* New "TextButton", "InventoryButton"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 0, 60, 0, 30
|
||||
Position: UDim2.new 0, 7, 1, -31
|
||||
BackgroundColor3: Color3.new 1, 1, 1
|
||||
BorderColor3: Color3.new 1, 1, 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Text: "Gear"
|
||||
AutoButtonColor: false
|
||||
TextColor3: Color3.new 0, 0, 0
|
||||
Selected: true
|
||||
Active: true
|
||||
ZIndex: 3
|
||||
|
||||
* New "TextButton", "CloseButton"
|
||||
RobloxLocked: true
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size24
|
||||
Position: UDim2.new 1, -33, 0, 4
|
||||
Size: UDim2.new 0, 30, 0, 30
|
||||
Style: Enum.ButtonStyle.RobloxButton
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
Modal: true
|
||||
|
||||
* New "ImageLabel", "XImage"
|
||||
RobloxLocked: true
|
||||
Image: (->
|
||||
game\GetService"ContentProvider"\Preload "http://banland.xyz/asset/?id=75547445"
|
||||
"http://banland.xyz/asset/?id=75547445"
|
||||
)! --TODO: move to rbxasset
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new -0.25, -1, -0.25, -1
|
||||
Size: UDim2.new 1.5, 2, 1.5, 2
|
||||
ZIndex: 2
|
||||
|
||||
if game.CoreGui.Version >= 8
|
||||
New "TextButton", "WardrobeButton"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 0, 90, 0, 30
|
||||
Position: UDim2.new 0, 77, 1, -31
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 1, 1, 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Text: "Wardrobe"
|
||||
AutoButtonColor: false
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
Selected: false
|
||||
Active: true
|
||||
Parent: Tabs
|
||||
|
||||
------------------------------- GEAR -------------------------------------------------------
|
||||
Gear = New "Frame", "Gear"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
ClipsDescendants: true
|
||||
Parent: Backpack
|
||||
|
||||
* New "Frame", "AssetsList"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 0.2, 0, 1, 0
|
||||
Style: Enum.FrameStyle.RobloxSquare
|
||||
Visible: false
|
||||
|
||||
* New "Frame", "GearGrid"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 0.95, 0, 1, 0
|
||||
BackgroundTransparency: 1
|
||||
|
||||
* New "ImageButton", "GearButton"
|
||||
RobloxLocked: true
|
||||
Visible: false
|
||||
Size: UDim2.new 0, 54, 0, 54
|
||||
Style: "Custom"
|
||||
BackgroundTransparency: 1
|
||||
|
||||
* New "ImageLabel", "Background"
|
||||
BackgroundTransparency: 1
|
||||
Image: "http://banland.xyz/asset/?id=97613075"
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
|
||||
* New "ObjectValue", "GearReference"
|
||||
RobloxLocked: true
|
||||
|
||||
* New "Frame", "GreyOutButton"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 0.5
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Active: true
|
||||
Visible: false
|
||||
ZIndex: 3
|
||||
|
||||
* New "TextLabel", "GearText"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.Arial
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Position: UDim2.new 0, -8, 0, -8
|
||||
Size: UDim2.new 1, 16, 1, 16
|
||||
Text: ""
|
||||
ZIndex: 2
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextWrap: true
|
||||
|
||||
GearGridScrollingArea = New "Frame", "GearGridScrollingArea"
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 1, -19, 0, 35
|
||||
Size: UDim2.new 0, 17, 1, -45
|
||||
BackgroundTransparency: 1
|
||||
Parent: Gear
|
||||
|
||||
GearLoadouts = New "Frame", "GearLoadouts"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0.7, 23, 0.5, 1
|
||||
Size: UDim2.new 0.3, -23, 0.5, -1
|
||||
Parent: Gear
|
||||
Visible: false
|
||||
|
||||
* New "Frame", "LoadoutsList"
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 0, 0, 0.15, 2
|
||||
Size: UDim2.new 1, -17, 0.85, -2
|
||||
Style: Enum.FrameStyle.RobloxSquare
|
||||
|
||||
* New "Frame", "GearLoadoutsHeader"
|
||||
RobloxLocked: true
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.2
|
||||
BorderColor3: Color3.new 1, 0, 0
|
||||
Size: UDim2.new 1, 2, 0.15, -1
|
||||
|
||||
* New "TextLabel", "LoadoutsHeaderText"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Text: "Loadouts"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
|
||||
|
||||
with GearGridScrollingArea\Clone!
|
||||
.Name = "GearLoadoutsScrollingArea"
|
||||
.RobloxLocked = true
|
||||
.Position = UDim2.new 1, -15, 0.15, 2
|
||||
.Size = UDim2.new 0, 17, 0.85, -2
|
||||
.Parent = GearLoadouts
|
||||
|
||||
|
||||
GearPreview = New "Frame", "GearPreview"
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 0.7, 23, 0, 0
|
||||
Size: UDim2.new 0.3, -28, 0.5, -1
|
||||
BackgroundTransparency: 1
|
||||
ZIndex: 7
|
||||
Parent: Gear
|
||||
|
||||
* New "Frame", "GearStats"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 0.75, 0
|
||||
Size: UDim2.new 1, 0, 0.25, 0
|
||||
ZIndex: 8
|
||||
|
||||
* New "TextLabel", "GearName"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Position: UDim2.new 0, -3, 0, 0
|
||||
Size: UDim2.new 1, 6, 1, 5
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextWrap: true
|
||||
ZIndex: 9
|
||||
|
||||
* New "ImageLabel", "GearImage"
|
||||
RobloxLocked: true
|
||||
Image: ""
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0.125, 0, 0, 0
|
||||
Size: UDim2.new 0.75, 0, 0.75, 0
|
||||
ZIndex: 8
|
||||
|
||||
* New "Frame", "GearIcons"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
BorderSizePixel: 0
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 0.4, 2, 0.85, -2
|
||||
Size: UDim2.new 0.6, 0, 0.15, 0
|
||||
Visible: false
|
||||
ZIndex: 9
|
||||
|
||||
* New "ImageLabel", "GenreImage"
|
||||
RobloxLocked: true
|
||||
BackgroundColor3: Color3.new 102 / 255, 153 / 255, 1
|
||||
BackgroundTransparency: 0.5
|
||||
BorderSizePixel: 0
|
||||
Size: UDim2.new 0.25, 0, 1, 0
|
||||
|
||||
{ -- Destructure
|
||||
:GearIcons
|
||||
GearIcons:
|
||||
:GenreImage
|
||||
} = GearPreview.GearImage
|
||||
|
||||
with GenreImage\Clone!
|
||||
.Name = "AttributeOneImage"
|
||||
.RobloxLocked = true
|
||||
.BackgroundColor3 = Color3.new 1, 51 / 255, 0
|
||||
.Position = UDim2.new 0.25, 0, 0, 0
|
||||
.Parent = GearIcons
|
||||
|
||||
with GenreImage\Clone!
|
||||
.Name = "AttributeTwoImage"
|
||||
.RobloxLocked = true
|
||||
.BackgroundColor3 = Color3.new 153 / 255, 1, 153 / 255
|
||||
.Position = UDim2.new 0.5, 0, 0, 0
|
||||
.Parent = GearIcons
|
||||
|
||||
with GenreImage\Clone!
|
||||
.Name = "AttributeThreeImage"
|
||||
.RobloxLocked = true
|
||||
.BackgroundColor3 = Color3.new 0, 0.5, 0.5
|
||||
.Position = UDim2.new 0.75, 0, 0, 0
|
||||
.Parent = GearIcons
|
||||
|
||||
------------------------------- WARDROBE -------------------------------------------------------
|
||||
if game.CoreGui.Version < 8
|
||||
-- no need for this to stick around, we aren't ready for wardrobe
|
||||
script\remove!
|
||||
return
|
||||
|
||||
makeCharFrame = (frameName, parent) ->
|
||||
New "Frame", "#{frameName}"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 1, 0, 1, -70
|
||||
Position: UDim2.new 0, 0, 0, 20
|
||||
BackgroundTransparency: 1
|
||||
Parent: parent
|
||||
Visible: false
|
||||
|
||||
makeZone = (zoneName, image, size, position, parent) ->
|
||||
New "ImageLabel", "#{zoneName}"
|
||||
RobloxLocked: true
|
||||
Image: image
|
||||
Size: size
|
||||
BackgroundTransparency: 1
|
||||
Position: position
|
||||
Parent: parent
|
||||
|
||||
makeStyledButton = (buttonName, size, position, parent, buttonStyle) ->
|
||||
button = New "ImageButton", "#{buttonName}"
|
||||
RobloxLocked: true
|
||||
Size: size
|
||||
Position: position
|
||||
if buttonStyle
|
||||
button.Style = buttonStyle
|
||||
else
|
||||
button.BackgroundColor3 = Color3.new 0, 0, 0
|
||||
button.BorderColor3 = Color3.new 1, 1, 1
|
||||
|
||||
button.Parent = parent
|
||||
button
|
||||
|
||||
makeTextLabel = (TextLabelName, text, position, parent) ->
|
||||
New "TextLabel", TextLabelName,
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 0, 32, 0, 14
|
||||
Font: Enum.Font.Arial
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Text: text
|
||||
Position: position
|
||||
Parent: parent
|
||||
|
||||
Wardrobe = New "Frame", "Wardrobe"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Visible: false
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Parent: Backpack
|
||||
|
||||
* New "Frame", "AssetList"
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 0, 4, 0, 5
|
||||
Size: UDim2.new 0, 85, 1, -5
|
||||
BackgroundTransparency: 1
|
||||
Visible: true
|
||||
|
||||
* New "TextButton", "PreviewButton"
|
||||
RobloxLocked: true
|
||||
Text: "Rotate"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BackgroundTransparency: 0.5
|
||||
BorderColor3: Color3.new 1, 1, 1
|
||||
Position: UDim2.new 1.2, -62, 1, -50
|
||||
Size: UDim2.new 0, 125, 0, 50
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size24
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextWrapped: true
|
||||
TextStrokeTransparency: 0
|
||||
|
||||
PreviewAssetFrame = New "Frame", "PreviewAssetFrame"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 1, -240, 0, 30
|
||||
Size: UDim2.new 0, 250, 0, 250
|
||||
Parent: Wardrobe
|
||||
|
||||
PreviewAssetBacking = New "TextButton", "PreviewAssetBacking"
|
||||
RobloxLocked: true
|
||||
Active: false
|
||||
Text: ""
|
||||
AutoButtonColor: false
|
||||
Size: UDim2.new 1, 0, 1, 0
|
||||
Style: Enum.ButtonStyle.RobloxButton
|
||||
Visible: false
|
||||
ZIndex: 9
|
||||
Parent: PreviewAssetFrame
|
||||
|
||||
* New "ImageLabel", "PreviewAssetImage"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 0.8
|
||||
Position: UDim2.new 0.5, -100, 0, 0
|
||||
Size: UDim2.new 0, 200, 0, 200
|
||||
BorderSizePixel: 0
|
||||
ZIndex: 10
|
||||
|
||||
AssetNameLabel = New "TextLabel", "AssetNameLabel"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Position: UDim2.new 0, 0, 1, -20
|
||||
Size: UDim2.new 0.5, 0, 0, 24
|
||||
ZIndex: 10
|
||||
Font: Enum.Font.Arial
|
||||
Text: ""
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
TextScaled: true
|
||||
Parent: PreviewAssetBacking
|
||||
|
||||
with AssetNameLabel\Clone!
|
||||
.Name = "AssetTypeLabel"
|
||||
.RobloxLocked = true
|
||||
.TextScaled = false
|
||||
.FontSize = Enum.FontSize.Size18
|
||||
.Position = UDim2.new 0.5, 3, 1, -20
|
||||
.Parent = PreviewAssetBacking
|
||||
|
||||
CharacterPane = New "Frame", "CharacterPane"
|
||||
RobloxLocked: true
|
||||
Position: UDim2.new 1, -220, 0, 32
|
||||
Size: UDim2.new 0, 220, 1, -40
|
||||
BackgroundTransparency: 1
|
||||
Visible: true
|
||||
Parent: Wardrobe
|
||||
|
||||
-- Character Panel label (shows what category we are currently browsing)
|
||||
* New "TextLabel", "CategoryLabel"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Position: UDim2.new 0, 0, 0, -7
|
||||
Size: UDim2.new 1, 0, 0, 20
|
||||
TextXAlignment: Enum.TextXAlignment.Center
|
||||
Text: "All"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
|
||||
--Save Button
|
||||
* New "TextButton", "SaveButton"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 0.6, 0, 0, 50
|
||||
Position: UDim2.new 0.2, 0, 1, -50
|
||||
Style: Enum.ButtonStyle.RobloxButton
|
||||
Selected: false
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size18
|
||||
Text: "Save"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
|
||||
--CharacterPane Children
|
||||
FaceFrame = makeCharFrame "FacesFrame", CharacterPane
|
||||
game\GetService"ContentProvider"\Preload "http://banland.xyz/asset/?id=75460621"
|
||||
makeZone(
|
||||
"FaceZone",
|
||||
"http://banland.xyz/asset/?id=75460621",
|
||||
UDim2.new(0, 157, 0, 137),
|
||||
UDim2.new(0.5, -78, 0.5, -68),
|
||||
FaceFrame
|
||||
)
|
||||
makeStyledButton "Face", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -135), FaceFrame
|
||||
|
||||
HeadFrame = makeCharFrame "HeadsFrame", CharacterPane
|
||||
makeZone(
|
||||
"FaceZone",
|
||||
"http://banland.xyz/asset/?id=75460621",
|
||||
UDim2.new(0, 157, 0, 137),
|
||||
UDim2.new(0.5, -78, 0.5, -68),
|
||||
HeadFrame
|
||||
)
|
||||
makeStyledButton "Head", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -135), HeadFrame
|
||||
|
||||
HatsFrame = makeCharFrame "HatsFrame", CharacterPane
|
||||
game\GetService"ContentProvider"\Preload "http://banland.xyz/asset/?id=75457888"
|
||||
HatsZone = makeZone(
|
||||
"HatsZone",
|
||||
"http://banland.xyz/asset/?id=75457888",
|
||||
UDim2.new(0, 186, 0, 184),
|
||||
UDim2.new(0.5, -93, 0.5, -100),
|
||||
HatsFrame
|
||||
)
|
||||
makeStyledButton(
|
||||
"Hat1Button",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0, -1, 0, -1),
|
||||
HatsZone,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeStyledButton(
|
||||
"Hat2Button",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0, 63, 0, -1),
|
||||
HatsZone,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeStyledButton(
|
||||
"Hat3Button",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0, 127, 0, -1),
|
||||
HatsZone,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
|
||||
PantsFrame = makeCharFrame "PantsFrame", CharacterPane
|
||||
game\GetService"ContentProvider"\Preload "http://banland.xyz/asset/?id=75457920"
|
||||
makeZone(
|
||||
"PantsZone",
|
||||
"http://banland.xyz/asset/?id=75457920",
|
||||
UDim2.new(0, 121, 0, 99),
|
||||
UDim2.new(0.5, -60, 0.5, -100),
|
||||
PantsFrame
|
||||
)
|
||||
|
||||
pantFrame = New "Frame", "PantFrame"
|
||||
RobloxLocked: true
|
||||
Size: UDim2.new 0, 25, 0, 56
|
||||
Position: UDim2.new 0.5, -26, 0.5, 0
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderColor3: Color3.new 1, 1, 1
|
||||
Parent: PantsFrame
|
||||
|
||||
with pantFrame\Clone!
|
||||
.Position = UDim2.new 0.5, 3, 0.5, 0
|
||||
.RobloxLocked = true
|
||||
.Parent = PantsFrame
|
||||
|
||||
New "ImageButton", "CurrentPants"
|
||||
RobloxLocked: true
|
||||
BackgroundTransparency: 1
|
||||
ZIndex: 2
|
||||
Position: UDim2.new 0.5, -31, 0.5, -4
|
||||
Size: UDim2.new 0, 54, 0, 59
|
||||
Parent: PantsFrame
|
||||
|
||||
MeshFrame = makeCharFrame "PackagesFrame", CharacterPane
|
||||
torsoButton = makeStyledButton(
|
||||
"TorsoMeshButton",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0.5, -32, 0.5, -110),
|
||||
MeshFrame,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeTextLabel "TorsoLabel", "Torso", UDim2.new(0.5, -16, 0, -25), torsoButton
|
||||
leftLegButton = makeStyledButton(
|
||||
"LeftLegMeshButton",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0.5, 0, 0.5, -25),
|
||||
MeshFrame,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeTextLabel "LeftLegLabel", "Left Leg", UDim2.new(0.5, -16, 0, -25), leftLegButton
|
||||
rightLegButton = makeStyledButton(
|
||||
"RightLegMeshButton",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0.5, -64, 0.5, -25),
|
||||
MeshFrame,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeTextLabel "RightLegLabel", "Right Leg", UDim2.new(0.5, -16, 0, -25), rightLegButton
|
||||
rightArmButton = makeStyledButton(
|
||||
"RightArmMeshButton",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0.5, -96, 0.5, -110),
|
||||
MeshFrame,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeTextLabel "RightArmLabel", "Right Arm", UDim2.new(0.5, -16, 0, -25), rightArmButton
|
||||
leftArmButton = makeStyledButton(
|
||||
"LeftArmMeshButton",
|
||||
UDim2.new(0, 64, 0, 64),
|
||||
UDim2.new(0.5, 32, 0.5, -110),
|
||||
MeshFrame,
|
||||
Enum.ButtonStyle.RobloxButton
|
||||
)
|
||||
makeTextLabel "LeftArmLabel", "Left Arm", UDim2.new(0.5, -16, 0, -25), leftArmButton
|
||||
|
||||
TShirtFrame = makeCharFrame "T-ShirtsFrame", CharacterPane
|
||||
game\GetService"ContentProvider"\Preload "http://banland.xyz/asset/?id=75460642"
|
||||
makeZone(
|
||||
"TShirtZone",
|
||||
"http://banland.xyz/asset/?id=75460642",
|
||||
UDim2.new(0, 121, 0, 154),
|
||||
UDim2.new(0.5, -60, 0.5, -100),
|
||||
TShirtFrame
|
||||
)
|
||||
makeStyledButton "TShirtButton", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -64), TShirtFrame
|
||||
|
||||
ShirtFrame = makeCharFrame "ShirtsFrame", CharacterPane
|
||||
makeZone(
|
||||
"ShirtZone",
|
||||
"http://banland.xyz/asset/?id=75460642",
|
||||
UDim2.new(0, 121, 0, 154),
|
||||
UDim2.new(0.5, -60, 0.5, -100),
|
||||
ShirtFrame
|
||||
)
|
||||
makeStyledButton "ShirtButton", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -64), ShirtFrame
|
||||
|
||||
ColorFrame = makeCharFrame "ColorFrame", CharacterPane
|
||||
game\GetService"ContentProvider"\Preload "http://banland.xyz/asset/?id=76049888"
|
||||
ColorZone = makeZone(
|
||||
"ColorZone",
|
||||
"http://banland.xyz/asset/?id=76049888",
|
||||
UDim2.new(0, 120, 0, 150),
|
||||
UDim2.new(0.5, -60, 0.5, -100),
|
||||
ColorFrame
|
||||
)
|
||||
makeStyledButton("Head", UDim2.new(0.26, 0, 0.19, 0), UDim2.new(0.37, 0, 0.02, 0), ColorZone).AutoButtonColor \
|
||||
= makeStyledButton("LeftArm", UDim2.new(0.19, 0, 0.36, 0), UDim2.new(0.78, 0, 0.26, 0), ColorZone).AutoButtonColor \
|
||||
= makeStyledButton("RightArm", UDim2.new(0.19, 0, 0.36, 0), UDim2.new(0.025, 0, 0.26, 0), ColorZone).AutoButtonColor \
|
||||
= makeStyledButton("Torso", UDim2.new(0.43, 0, 0.36, 0), UDim2.new(0.28, 0, 0.26, 0), ColorZone).AutoButtonColor \
|
||||
= makeStyledButton("RightLeg", UDim2.new(0.19, 0, 0.31, 0), UDim2.new(0.275, 0, 0.67, 0), ColorZone).AutoButtonColor \
|
||||
= makeStyledButton("LeftLeg", UDim2.new(0.19, 0, 0.31, 0), UDim2.new(0.525, 0, 0.67, 0), ColorZone).AutoButtonColor \
|
||||
= false
|
||||
|
||||
-- no need for this to stick around
|
||||
|
||||
script\Destroy!
|
||||
|
||||
-- I could probably make this entire thing into one massive
|
||||
-- fuckoff instance tree like the Typing Tester codebase,
|
||||
-- but it would probably break a lot of things
|
||||
|
||||
-- Heliodex
|
||||
1068
yue/53878057.yue
1068
yue/53878057.yue
File diff suppressed because it is too large
Load Diff
|
|
@ -1,2 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
965
yue/60595411.yue
965
yue/60595411.yue
|
|
@ -1,965 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
t = {}
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
-- if a bit redundant due to the Create function at the bottom
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------JSON Functions Begin----------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--JSON Encoder and Parser for Lua 5.1
|
||||
--
|
||||
--2007 Shaun Brown (http://www.chipmunkav.com)
|
||||
|
||||
assert = assert
|
||||
Null = -> Null
|
||||
|
||||
StringBuilder =
|
||||
buffer: {}
|
||||
|
||||
StringBuilder.New ==>
|
||||
o = <>: @
|
||||
@__index = @
|
||||
o.buffer = {}
|
||||
o
|
||||
|
||||
|
||||
StringBuilder.Append = (s) =>
|
||||
@buffer[] = s
|
||||
|
||||
|
||||
StringBuilder.ToString ==> table.concat @buffer
|
||||
|
||||
|
||||
JsonWriter =
|
||||
backslashes:
|
||||
["\b"]: "\\b",
|
||||
["\t"]: "\\t",
|
||||
["\n"]: "\\n",
|
||||
["\f"]: "\\f",
|
||||
["\r"]: "\\r",
|
||||
['"']: '\\"',
|
||||
["\\"]: "\\\\",
|
||||
["/"]: "\\/",
|
||||
|
||||
JsonWriter.New ==>
|
||||
o = <>: @
|
||||
o.writer = StringBuilder\New!
|
||||
@__index = @
|
||||
o
|
||||
|
||||
|
||||
JsonWriter.Append = (s) =>
|
||||
@writer\Append s
|
||||
|
||||
|
||||
JsonWriter.ToString ==> @writer\ToString!
|
||||
|
||||
|
||||
JsonWriter.Write = (o) =>
|
||||
switch type o
|
||||
when "nil"
|
||||
@\WriteNil!
|
||||
when "boolean", "number"
|
||||
@\WriteString o
|
||||
when "string"
|
||||
@\ParseString o
|
||||
when "table"
|
||||
@\WriteTable o
|
||||
when "function"
|
||||
@\WriteFunction o
|
||||
when "thread", "userdata"
|
||||
@\WriteError o
|
||||
|
||||
JsonWriter.WriteNil ==> @\Append "null"
|
||||
JsonWriter.WriteString = (o) => @\Append "#{o}"
|
||||
|
||||
|
||||
JsonWriter.ParseString = (s) =>
|
||||
@\Append '"'
|
||||
@\Append string.gsub s, '[%z%c\\"/]', (n) ->
|
||||
if c = @backslashes[n]
|
||||
return c
|
||||
|
||||
string.format "\\u%.4X", string.byte n
|
||||
|
||||
@\Append '"'
|
||||
|
||||
|
||||
JsonWriter.IsArray = (t) =>
|
||||
count = 0
|
||||
isindex = (k) ->
|
||||
if type(k) == "number" and
|
||||
k > 0 and
|
||||
math.floor(k) == k
|
||||
|
||||
return true
|
||||
false
|
||||
|
||||
for k, _ in pairs t
|
||||
if not isindex k
|
||||
return false, "{", "}"
|
||||
else
|
||||
count = math.max count, k
|
||||
|
||||
true, "[", "]", count
|
||||
|
||||
|
||||
JsonWriter.WriteTable = (t) =>
|
||||
ba, st, et, n = @\IsArray t
|
||||
@\Append st
|
||||
if ba
|
||||
for i = 1, n
|
||||
@\Write t[i]
|
||||
if i < n
|
||||
@\Append ","
|
||||
|
||||
else
|
||||
first = true
|
||||
for k, v in pairs t
|
||||
if not first
|
||||
@\Append ","
|
||||
|
||||
first = false
|
||||
@\ParseString k
|
||||
@\Append ":"
|
||||
@\Write v
|
||||
|
||||
|
||||
@\Append et
|
||||
|
||||
|
||||
JsonWriter.WriteError = (o) =>
|
||||
error string.format "Encoding of %s unsupported", "#{o}"
|
||||
|
||||
|
||||
JsonWriter.WriteFunction = (o) =>
|
||||
if o == Null
|
||||
@\WriteNil!
|
||||
else
|
||||
@\WriteError o
|
||||
|
||||
|
||||
StringReader =
|
||||
s: "",
|
||||
i: 0,
|
||||
|
||||
StringReader.New = (s) =>
|
||||
o = <>: @
|
||||
@__index = @
|
||||
o.s = s or o.s
|
||||
o
|
||||
|
||||
|
||||
StringReader.Peek ==>
|
||||
i = @i + 1
|
||||
if i <= #@s
|
||||
return string.sub @s, i, i
|
||||
nil
|
||||
|
||||
StringReader.Next ==>
|
||||
@i = @i + 1
|
||||
if @i <= #@s
|
||||
return string.sub @s, @i, @i
|
||||
nil
|
||||
|
||||
|
||||
StringReader.All ==> @s
|
||||
|
||||
|
||||
JsonReader =
|
||||
escapes:
|
||||
["t"]: "\t",
|
||||
["n"]: "\n",
|
||||
["f"]: "\f",
|
||||
["r"]: "\r",
|
||||
["b"]: "\b",
|
||||
|
||||
JsonReader.New = (s) =>
|
||||
o = <>: @
|
||||
o.reader = StringReader\New s
|
||||
@__index = @
|
||||
o
|
||||
|
||||
|
||||
JsonReader.Read ==>
|
||||
@\SkipWhiteSpace!
|
||||
peek = @\Peek!
|
||||
return if peek == nil
|
||||
error string.format "Nil string: '%s'", @\All!
|
||||
elseif peek == "{"
|
||||
@\ReadObject!
|
||||
elseif peek == "["
|
||||
@\ReadArray!
|
||||
elseif peek == '"'
|
||||
@\ReadString!
|
||||
elseif string.find peek, "[%+%-%d]"
|
||||
@\ReadNumber!
|
||||
elseif peek == "t"
|
||||
@\ReadTrue!
|
||||
elseif peek == "f"
|
||||
@\ReadFalse!
|
||||
elseif peek == "n"
|
||||
@\ReadNull!
|
||||
elseif peek == "/"
|
||||
@\ReadComment!
|
||||
@\Read!
|
||||
else
|
||||
nil
|
||||
|
||||
JsonReader.ReadTrue ==>
|
||||
@\TestReservedWord { 't', 'r', 'u', 'e' }
|
||||
true
|
||||
|
||||
JsonReader.ReadFalse ==>
|
||||
@\TestReservedWord { 'f', 'a', 'l', 's', 'e' }
|
||||
false
|
||||
|
||||
JsonReader.ReadNull ==>
|
||||
@\TestReservedWord { 'n', 'u', 'l', 'l' }
|
||||
nil
|
||||
|
||||
JsonReader.TestReservedWord = (t) =>
|
||||
for _, v in ipairs t
|
||||
if @\Next! ~= v
|
||||
error string.format "Error reading '%s': %s", table.concat(t), @\All!
|
||||
|
||||
|
||||
JsonReader.ReadNumber ==>
|
||||
result = @\Next!
|
||||
peek = @\Peek!
|
||||
while peek? and string.find peek, "[%+%-%d%.eE]"
|
||||
result ..= @\Next!
|
||||
peek = @\Peek!
|
||||
|
||||
result = tonumber result
|
||||
if result == nil
|
||||
error string.format "Invalid number: '%s'", result
|
||||
else
|
||||
return result
|
||||
|
||||
|
||||
JsonReader.ReadString ==>
|
||||
result = ""
|
||||
assert @\Next! == '"'
|
||||
while @\Peek! ~= '"'
|
||||
ch = @\Next!
|
||||
if ch == "\\"
|
||||
ch = @\Next!
|
||||
if @escapes[ch]
|
||||
ch = @escapes[ch]
|
||||
|
||||
result ..= ch
|
||||
|
||||
assert @\Next! == '"'
|
||||
fromunicode = (m) -> string.char tonumber m, 16
|
||||
|
||||
string.gsub result, "u%x%x(%x%x)", fromunicode
|
||||
|
||||
|
||||
JsonReader.ReadComment ==>
|
||||
assert @\Next! == "/"
|
||||
second = @\Next!
|
||||
if second == "/"
|
||||
@\ReadSingleLineComment!
|
||||
elseif second == "*"
|
||||
@\ReadBlockComment!
|
||||
else
|
||||
error string.format "Invalid comment: %s", @\All!
|
||||
|
||||
|
||||
JsonReader.ReadBlockComment ==>
|
||||
done = false
|
||||
until done
|
||||
ch = @\Next!
|
||||
if ch == "*" and @\Peek! == "/"
|
||||
done = true
|
||||
|
||||
if not done and ch == "/" and @\Peek! == "*"
|
||||
error string.format "Invalid comment: %s, '/*' illegal.", @\All!
|
||||
|
||||
@\Next!
|
||||
|
||||
|
||||
JsonReader.ReadSingleLineComment ==>
|
||||
ch = @\Next!
|
||||
while ch ~= "\r" and ch ~= "\n"
|
||||
ch = @\Next!
|
||||
|
||||
|
||||
JsonReader.ReadArray ==>
|
||||
result = {}
|
||||
assert @\Next! == "["
|
||||
done = false
|
||||
if @\Peek! == "]"
|
||||
done = true
|
||||
|
||||
until done
|
||||
item = @\Read!
|
||||
result[] = item
|
||||
@\SkipWhiteSpace!
|
||||
if @\Peek! == "]"
|
||||
done = true
|
||||
|
||||
if not done
|
||||
ch = @\Next!
|
||||
if ch ~= ","
|
||||
error string.format "Invalid array: '%s' due to: '%s'", @\All!, ch
|
||||
|
||||
assert "]" == @\Next!
|
||||
result
|
||||
|
||||
|
||||
JsonReader.ReadObject ==>
|
||||
result = {}
|
||||
assert @\Next! == "{"
|
||||
done = false
|
||||
if @\Peek! == "}"
|
||||
done = true
|
||||
|
||||
until done
|
||||
key = @\Read!
|
||||
if type(key) ~= "string"
|
||||
error string.format "Invalid non-string object key: %s", key
|
||||
|
||||
@\SkipWhiteSpace!
|
||||
ch = @\Next!
|
||||
if ch ~= ":"
|
||||
error string.format "Invalid object: '%s' due to: '%s'", @\All!, ch
|
||||
|
||||
@\SkipWhiteSpace!
|
||||
val = @\Read!
|
||||
result[key] = val
|
||||
@\SkipWhiteSpace!
|
||||
if @\Peek! == "}"
|
||||
done = true
|
||||
|
||||
if not done
|
||||
ch = @\Next!
|
||||
if ch ~= ","
|
||||
error string.format "Invalid array: '%s' near: '%s'", @\All!, ch
|
||||
|
||||
|
||||
assert @\Next! == "}"
|
||||
result
|
||||
|
||||
|
||||
JsonReader.SkipWhiteSpace ==>
|
||||
p = @\Peek!
|
||||
while p? and string.find p, "[%s/]"
|
||||
if p == "/"
|
||||
@\ReadComment!
|
||||
else
|
||||
@\Next!
|
||||
|
||||
p = @\Peek!
|
||||
|
||||
|
||||
JsonReader.Peek ==> @reader\Peek!
|
||||
JsonReader.Next ==> @reader\Next!
|
||||
JsonReader.All ==> @reader\All!
|
||||
|
||||
Encode = (o) ->
|
||||
with JsonWriter\New!
|
||||
\Write o
|
||||
\ToString!
|
||||
|
||||
|
||||
Decode = (s) ->
|
||||
with JsonReader\New s
|
||||
\Read!
|
||||
|
||||
-------------------- End JSON Parser ------------------------
|
||||
|
||||
t.DecodeJSON = (jsonString) ->
|
||||
try
|
||||
warn 'RbxUtility.DecodeJSON is deprecated, please use Game:GetService("HttpService"):JSONDecode() instead.'
|
||||
|
||||
if type(jsonString) == "string"
|
||||
return Decode jsonString
|
||||
|
||||
print "RbxUtil.DecodeJSON expects string argument!"
|
||||
nil
|
||||
|
||||
t.EncodeJSON = (jsonTable) ->
|
||||
try
|
||||
warn 'RbxUtility.EncodeJSON is deprecated, please use Game:GetService("HttpService"):JSONEncode() instead.'
|
||||
|
||||
Encode jsonTable
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
--------------------------------------------Terrain Utilities Begin-----------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
--makes a wedge at location x, y, z
|
||||
--sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously w
|
||||
--returns true if made a wedge, false if the cell remains a block
|
||||
t.MakeWedge = (x, y, z, _) -> game\GetService"Terrain"\AutoWedgeCell x, y, z
|
||||
|
||||
|
||||
t.SelectTerrainRegion = (regionToSelect, color, selectEmptyCells, selectionParent) ->
|
||||
terrain = game.Workspace\FindFirstChild "Terrain"
|
||||
return if not terrain
|
||||
|
||||
assert regionToSelect
|
||||
assert color
|
||||
|
||||
if not type(regionToSelect) == "Region3"
|
||||
error "regionToSelect (first arg), should be of type Region3, but is type", type regionToSelect
|
||||
|
||||
if not type(color) == "BrickColor"
|
||||
error "color (second arg), should be of type BrickColor, but is type", type color
|
||||
|
||||
|
||||
-- frequently used terrain calls (speeds up call, no lookup necessary)
|
||||
GetCell = terrain.GetCell
|
||||
WorldToCellPreferSolid = terrain.WorldToCellPreferSolid
|
||||
CellCenterToWorld = terrain.CellCenterToWorld
|
||||
emptyMaterial = Enum.CellMaterial.Empty
|
||||
|
||||
-- container for all adornments, passed back to user
|
||||
selectionContainer = New "Model", "SelectionContainer"
|
||||
Archivable: false
|
||||
Parent: selectiorParent or game.Workspace
|
||||
|
||||
local updateSelection -- function we return to allow user to update selection
|
||||
local currentKeepAliveTag -- a tag that determines whether adorns should be destroyed
|
||||
aliveCounter = 0 -- helper for currentKeepAliveTag
|
||||
local lastRegion -- used to stop updates that do nothing
|
||||
adornments = {} -- contains all adornments
|
||||
reusableAdorns = {}
|
||||
|
||||
selectionPart = New "Part", "SelectionPart"
|
||||
Transparency: 1
|
||||
Anchored: true
|
||||
Locked: true
|
||||
CanCollide: false
|
||||
Size: Vector3.new 4.2, 4.2, 4.2
|
||||
|
||||
selectionBox = Instance.new "SelectionBox"
|
||||
|
||||
-- srs translation from region3 to region3int16
|
||||
-- Region3ToRegion3int16 = (region3) ->
|
||||
-- theLowVec = region3.CFrame.p - region3.Size / 2 + Vector3.new 2, 2, 2
|
||||
-- lowCell = WorldToCellPreferSolid terrain, theLowVec
|
||||
|
||||
-- theHighVec = region3.CFrame.p + region3.Size / 2 - Vector3.new 2, 2, 2
|
||||
-- highCell = WorldToCellPreferSolid terrain, theHighVec
|
||||
|
||||
-- highIntVec = Vector3int16.new highCell.x, highCell.y, highCell.z
|
||||
-- lowIntVec = Vector3int16.new lowCell.x, lowCell.y, lowCell.z
|
||||
|
||||
-- Region3int16.new lowIntVec, highIntVec
|
||||
|
||||
-- helper function that creates the basis for a selection box
|
||||
createAdornment = (theColor) ->
|
||||
local selectionPartClone
|
||||
local selectionBoxClone
|
||||
|
||||
if #reusableAdorns > 0
|
||||
selectionPartClone = reusableAdorns[1]["part"]
|
||||
selectionBoxClone = reusableAdorns[1]["box"]
|
||||
table.remove reusableAdorns, 1
|
||||
|
||||
selectionBoxClone.Visible = true
|
||||
else
|
||||
selectionPartClone = selectionPart\Clone!
|
||||
selectionPartClone.Archivable = false
|
||||
|
||||
selectionBoxClone = selectionBox\Clone!
|
||||
|
||||
with selectionBoxClone
|
||||
.Archivable = false
|
||||
.Adornee = selectionPartClone
|
||||
.Parent = selectionContainer
|
||||
.Adornee = selectionPartClone
|
||||
.Parent = selectionContainer
|
||||
|
||||
|
||||
if theColor
|
||||
selectionBoxClone.Color = theColor
|
||||
|
||||
selectionPartClone, selectionBoxClone
|
||||
|
||||
-- iterates through all current adornments and deletes any that don't have latest tag
|
||||
cleanUpAdornments = ->
|
||||
for cellPos, adornTable in pairs adornments
|
||||
if adornTable.KeepAlive ~= currentKeepAliveTag -- old news, we should get rid of this
|
||||
adornTable.SelectionBox.Visible = false
|
||||
table.insert reusableAdorns, part: adornTable.SelectionPart, box: adornTable.SelectionBox
|
||||
adornments[cellPos] = nil
|
||||
|
||||
|
||||
-- helper function to update tag
|
||||
incrementAliveCounter = ->
|
||||
aliveCounter += 1
|
||||
if aliveCounter > 1000000
|
||||
aliveCounter = 0
|
||||
|
||||
aliveCounter
|
||||
|
||||
-- finds full cells in region and adorns each cell with a box, with the argument color
|
||||
adornFullCellsInRegion = (region, color) ->
|
||||
regionBegin = region.CFrame.p - region.Size / 2 + Vector3.new 2, 2, 2
|
||||
regionEnd = region.CFrame.p + region.Size / 2 - Vector3.new 2, 2, 2
|
||||
|
||||
cellPosBegin = WorldToCellPreferSolid terrain, regionBegin
|
||||
cellPosEnd = WorldToCellPreferSolid terrain, regionEnd
|
||||
|
||||
currentKeepAliveTag = incrementAliveCounter!
|
||||
for y = cellPosBegin.y, cellPosEnd.y
|
||||
for z = cellPosBegin.z, cellPosEnd.z
|
||||
for x = cellPosBegin.x, cellPosEnd.x
|
||||
cellMaterial = GetCell terrain, x, y, z
|
||||
|
||||
if cellMaterial ~= emptyMaterial
|
||||
cframePos = CellCenterToWorld terrain, x, y, z
|
||||
cellPos = Vector3int16.new x, y, z
|
||||
|
||||
updated = false
|
||||
for cellPosAdorn, adornTable in pairs adornments
|
||||
if cellPosAdorn == cellPos
|
||||
adornTable.KeepAlive = currentKeepAliveTag
|
||||
if color
|
||||
adornTable.SelectionBox.Color = color
|
||||
|
||||
updated = true
|
||||
break
|
||||
|
||||
|
||||
if not updated
|
||||
selectionPart2, selectionBox2 = createAdornment color
|
||||
selectionPart2.Size = Vector3.new 4, 4, 4
|
||||
selectionPart2.CFrame = CFrame.new cframePos
|
||||
adornTable =
|
||||
SelectionPart: selectionPart2
|
||||
SelectionBox: selectionBox2
|
||||
KeepAlive: currentKeepAliveTag
|
||||
|
||||
adornments[cellPos] = adornTable
|
||||
|
||||
cleanUpAdornments!
|
||||
|
||||
|
||||
------------------------------------- setup code ------------------------------
|
||||
lastRegion = regionToSelect
|
||||
|
||||
if selectEmptyCells -- use one big selection to represent the area selected
|
||||
selectionPart, selectionBox = createAdornment color
|
||||
|
||||
selectionPart.Size = regionToSelect.Size
|
||||
selectionPart.CFrame = regionToSelect.CFrame
|
||||
|
||||
adornments.SelectionPart = selectionPart
|
||||
adornments.SelectionBox = selectionBox
|
||||
|
||||
updateSelection = (newRegion, color) ->
|
||||
if newRegion and newRegion ~= lastRegion
|
||||
lastRegion = newRegion
|
||||
selectionPart.Size = newRegion.Size
|
||||
selectionPart.CFrame = newRegion.CFrame
|
||||
|
||||
if color
|
||||
selectionBox.Color = color
|
||||
|
||||
|
||||
else -- use individual cell adorns to represent the area selected
|
||||
adornFullCellsInRegion regionToSelect, color
|
||||
updateSelection = (newRegion, color) ->
|
||||
if newRegion and newRegion ~= lastRegion
|
||||
lastRegion = newRegion
|
||||
adornFullCellsInRegion newRegion, color
|
||||
|
||||
|
||||
destroyFunc = ->
|
||||
updateSelection = nil
|
||||
selectionContainer?\Destroy!
|
||||
|
||||
adornments = nil
|
||||
|
||||
updateSelection, destroyFunc
|
||||
|
||||
|
||||
-----------------------------Terrain Utilities End-----------------------------
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------Signal class begin------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
--[[
|
||||
A 'Signal' object identical to the internal RBXScriptSignal object in it's public API and semantics. This function
|
||||
can be used to create "custom events" for user-made code.
|
||||
API:
|
||||
Method \connect function handler
|
||||
Arguments: The function to connect to.
|
||||
Returns: A new connection object which can be used to disconnect the connection
|
||||
Description: Connects this signal to the function specified by |handler|. That is, when |fire ...| is called for
|
||||
the signal the |handler| will be called with the arguments given to |fire ...|. Note, the functions
|
||||
connected to a signal are called in NO PARTICULAR ORDER, so connecting one function after another does
|
||||
NOT mean that the first will be called before the second as a result of a call to |fire|.
|
||||
|
||||
Method \disconnect!
|
||||
Arguments: None
|
||||
Returns: None
|
||||
Description: Disconnects all of the functions connected to this signal.
|
||||
|
||||
Method \fire ...
|
||||
Arguments: Any arguments are accepted
|
||||
Returns: None
|
||||
Description: Calls all of the currently connected functions with the given arguments.
|
||||
|
||||
Method \wait!
|
||||
Arguments: None
|
||||
Returns: The arguments given to fire
|
||||
Description: This call blocks until
|
||||
]]
|
||||
|
||||
t.CreateSignal = ->
|
||||
this = {}
|
||||
|
||||
mBindableEvent = Instance.new "BindableEvent"
|
||||
mAllCns = {} --all connection objects returned by mBindableEvent::connect
|
||||
|
||||
--main functions
|
||||
this.connect = (func) =>
|
||||
if @ ~= this
|
||||
error "connect must be called with `:`, not `.`", 2
|
||||
|
||||
if type(func) ~= "function"
|
||||
error "Argument #1 of connect must be a function, got a #{type func}" , 2
|
||||
|
||||
cn = mBindableEvent.Event\connect func
|
||||
mAllCns[cn] = true
|
||||
pubCn = {}
|
||||
pubCn.disconnect ==>
|
||||
cn\disconnect!
|
||||
mAllCns[cn] = nil
|
||||
|
||||
pubCn.Disconnect = pubCn.disconnect
|
||||
pubCn
|
||||
|
||||
this.disconnect ==>
|
||||
if @ ~= this
|
||||
error "disconnect must be called with `:`, not `.`", 2
|
||||
|
||||
for cn, _ in pairs mAllCns
|
||||
cn\disconnect!
|
||||
mAllCns[cn] = nil
|
||||
|
||||
this.wait ==>
|
||||
if @ ~= this
|
||||
error "wait must be called with `:`, not `.`", 2
|
||||
|
||||
mBindableEvent.Event\wait!
|
||||
|
||||
|
||||
this.fire = (...) =>
|
||||
if @ ~= this
|
||||
error "fire must be called with `:`, not `.`", 2
|
||||
|
||||
mBindableEvent\Fire ...
|
||||
|
||||
this.Connect = this.connect
|
||||
this.Disconnect = this.disconnect
|
||||
this.Wait = this.wait
|
||||
this.Fire = this.fire
|
||||
this
|
||||
|
||||
|
||||
------------------------------------------------- Signal class End ------------------------------------------------------
|
||||
|
||||
-- this 1s my favourite (heliodex)
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
-----------------------------------------------Create Function Begins---------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
--[[
|
||||
A "Create" function for easy creation of Roblox instances. The function accepts a string which is the classname of
|
||||
the object to be created. The function then returns another function which either accepts accepts no arguments, in
|
||||
which case it simply creates an object of the given type, or a table argument that may contain several types of data,
|
||||
in which case it mutates the object in varying ways depending on the nature of the aggregate data. These are the
|
||||
type of data and what operation each will perform:
|
||||
1) A string key mapping to some value:
|
||||
Key-Value pairs in this form will be treated as properties of the object, and will be assigned in NO PARTICULAR
|
||||
ORDER. If the order in which properties is assigned matter, then they must be assigned somewhere else than the
|
||||
|Create| call's body.
|
||||
|
||||
2) An integral key mapping to another Instance:
|
||||
Normal numeric keys mapping to Instances will be treated as children if the object being created, and will be
|
||||
parented to it. This allows nice recursive calls to Create to create a whole hierarchy of objects without a
|
||||
need for temporary variables to store references to those objects.
|
||||
|
||||
3) A key which is a value returned from Create.Event( eventname ), and a value which is a function function
|
||||
The Create.E( string ) function provides a limited way to connect to signals inside of a Create hierarchy
|
||||
for those who really want such a functionality. The name of the event whose name is passed to
|
||||
Create.E( string )
|
||||
|
||||
4) A key which is the Create function itself, and a value which is a function
|
||||
The function will be run with the argument of the object itself after all other initialization of the object is
|
||||
done by create. This provides a way to do arbitrary things involving the object from withing the create
|
||||
hierarchy.
|
||||
Note: This function is called SYNCHRONOUSLY, that means that you should only so initialization in
|
||||
it, not stuff which requires waiting, as the Create call will block until it returns. While waiting in the
|
||||
constructor callback function is possible, it is probably not a good design choice.
|
||||
Note: Since the constructor function is called after all other initialization, a Create block cannot have two
|
||||
constructor functions, as it would not be possible to call both of them last, also, this would be unnecessary.
|
||||
|
||||
|
||||
Some example usages:
|
||||
|
||||
A simple example which uses the Create function to create a model object and assign two of it's properties.
|
||||
model = Create'Model'{
|
||||
Name = 'A New model',
|
||||
Parent = game.Workspace,
|
||||
}
|
||||
|
||||
|
||||
An example where a larger hierarchy of object is made. After the call the hierarchy will look like this:
|
||||
Model_Container
|
||||
|-ObjectValue
|
||||
| |
|
||||
| `-BoolValueChild
|
||||
`-IntValue
|
||||
|
||||
model = Create'Model'{
|
||||
Name = 'Model_Container',
|
||||
Create'ObjectValue'{
|
||||
Create'BoolValue'{
|
||||
Name = 'BoolValueChild',
|
||||
},
|
||||
},
|
||||
Create'IntValue'{},
|
||||
}
|
||||
|
||||
|
||||
An example using the event syntax:
|
||||
|
||||
part = Create'Part'{
|
||||
[Create.E'Touched'] = function(part)
|
||||
print("I was touched by "..part.Name)
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
An example using the general constructor syntax:
|
||||
|
||||
model = Create'Part'{
|
||||
[Create] = function this
|
||||
print("Constructor running!")
|
||||
this.Name = GetGlobalFoosAndBars(this)
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
Note: It is also perfectly legal to save a reference to the function returned by a call Create, this will not cause
|
||||
any unexpected behavior. EG:
|
||||
partCreatingFunction = Create'Part'
|
||||
part = partCreatingFunction()
|
||||
]]
|
||||
|
||||
--the Create function need to be created as a functor, not a function, in order to support the Create.E syntax, so it
|
||||
--will be created in several steps rather than as a single function declaration.
|
||||
Create_PrivImpl = (objectType) ->
|
||||
if type(objectType) ~= "string"
|
||||
error "Argument of Create must be a string", 2
|
||||
|
||||
--return the proxy function that gives us the nice Create'string'{data} syntax
|
||||
--The first function call is a function call using Lua's single-string-argument syntax
|
||||
--The second function call is using Lua's single-table-argument syntax
|
||||
--Both can be chained together for the nice effect.
|
||||
(dat) ->
|
||||
--default to nothing, to handle the no argument given case
|
||||
dat or= {}
|
||||
|
||||
--make the object to mutate
|
||||
obj = Instance.new objectType
|
||||
local parent
|
||||
|
||||
--stored constructor function to be called after other initialization
|
||||
local ctor
|
||||
|
||||
for k, v in pairs dat
|
||||
--add property
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
-- Parent should always be set last, setting the Parent of a new object
|
||||
-- immediately makes performance worse for all subsequent property updates.
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
--add child
|
||||
elseif type(k) == "number"
|
||||
if type(v) ~= "userdata"
|
||||
error "Bad entry in Create body: Numeric keys must be paired with children, got a: #{type v}", 2
|
||||
|
||||
v.Parent = obj
|
||||
|
||||
--event connect
|
||||
elseif type(k) == "table" and k.__eventname
|
||||
if type(v) ~= "function"
|
||||
error "Bad entry in Create body: Key `[Create.E'#{k.__eventname}']` must have a function value, got: #{v}", 2
|
||||
|
||||
obj[k.__eventname]\connect v
|
||||
|
||||
--define constructor function
|
||||
elseif k == t.Create
|
||||
if type(v) ~= "function"
|
||||
error "Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: #{v}", 2
|
||||
|
||||
elseif ctor
|
||||
--ctor already exists, only one allowed
|
||||
error "Bad entry in Create body: Only one constructor function is allowed", 2
|
||||
|
||||
ctor = v
|
||||
else
|
||||
error "Bad entry (#{k} => #{v}) in Create body", 2
|
||||
|
||||
|
||||
--apply constructor function if it exists
|
||||
ctor? obj
|
||||
|
||||
if parent
|
||||
obj.Parent = parent
|
||||
|
||||
--return the completed object
|
||||
obj
|
||||
|
||||
|
||||
--now, create the functor:
|
||||
t.Create = <"__call">: (_, ...) -> Create_PrivImpl ...
|
||||
|
||||
--and create the "Event.E" syntax stub. Really it's just a stub to construct a table which our Create
|
||||
--function can recognize as special.
|
||||
t.Create.E = (eventName) -> __eventname: eventName
|
||||
|
||||
-------------------------------------------------Create function End----------------------------------------------------
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------Documentation Begin-----------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
t.Help = (funcNameOrFunc) ->
|
||||
switch funcNameOrFunc
|
||||
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
||||
when "DecodeJSON", t.DecodeJSON
|
||||
"Function DecodeJSON. " ..
|
||||
"Arguments: (string). " ..
|
||||
"Side effect: returns a table with all parsed JSON values"
|
||||
|
||||
when "EncodeJSON", t.EncodeJSON
|
||||
"Function EncodeJSON. " ..
|
||||
"Arguments: (table). " ..
|
||||
"Side effect: returns a string composed of argument table in JSON data format"
|
||||
|
||||
when "MakeWedge", t.MakeWedge
|
||||
"Function MakeWedge. " ..
|
||||
"Arguments: (x, y, z, [default material]). " ..
|
||||
"Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if " ..
|
||||
"parameter is provided, if not sets cell x, y, z to be whatever material it previously was. " ..
|
||||
"Returns true if made a wedge, false if the cell remains a block "
|
||||
|
||||
when "SelectTerrainRegion", t.SelectTerrainRegion
|
||||
"Function SelectTerrainRegion. " ..
|
||||
"Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). " ..
|
||||
"Description: Selects all terrain via a series of selection boxes within the regionToSelect " ..
|
||||
"(this should be a region3 value). The selection box color is detemined by the color argument " ..
|
||||
"(should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional)." ..
|
||||
"SelectEmptyCells is bool, when true will select all cells in the " ..
|
||||
"region, otherwise we only select non-empty cells. Returns a function that can update the selection," ..
|
||||
"arguments to said function are a new region3 to select, and the adornment color (color arg is optional). " ..
|
||||
"Also returns a second function that takes no arguments and destroys the selection"
|
||||
|
||||
when "CreateSignal", t.CreateSignal
|
||||
"Function CreateSignal. " ..
|
||||
"Arguments: None. " ..
|
||||
"Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class " ..
|
||||
"used for events in Objects, but is a Lua-side object so it can be used to create custom events in" ..
|
||||
"Lua code. " ..
|
||||
"Methods of the Signal object: :connect, :wait, :fire, :disconnect. " ..
|
||||
"For more info you can pass the method name to the Help function, or view the wiki page " ..
|
||||
"for this library. EG: Help('Signal:connect')."
|
||||
|
||||
when "Signal:connect"
|
||||
"Method Signal:connect. " ..
|
||||
"Arguments: (function handler). " ..
|
||||
"Return: A connection object which can be used to disconnect the connection to this handler. " ..
|
||||
"Description: Connectes a handler function to this Signal, so that when |fire| is called the " ..
|
||||
"handler function will be called with the arguments passed to |fire|."
|
||||
|
||||
when "Signal:wait"
|
||||
"Method Signal:wait. " ..
|
||||
"Arguments: None. " ..
|
||||
"Returns: The arguments passed to the next call to |fire|. " ..
|
||||
"Description: This call does not return until the next call to |fire| is made, at which point it " ..
|
||||
"will return the values which were passed as arguments to that |fire| call."
|
||||
|
||||
when "Signal:fire"
|
||||
"Method Signal:fire. " ..
|
||||
"Arguments: Any number of arguments of any type. " ..
|
||||
"Returns: None. " ..
|
||||
"Description: This call will invoke any connected handler functions, and notify any waiting code " ..
|
||||
"attached to this Signal to continue, with the arguments passed to this function. Note: The calls " ..
|
||||
"to handlers are made asynchronously, so this call will return immediately regardless of how long " ..
|
||||
"it takes the connected handler functions to complete."
|
||||
|
||||
when "Signal:disconnect"
|
||||
"Method Signal:disconnect. " ..
|
||||
"Arguments: None. " ..
|
||||
"Returns: None. " ..
|
||||
"Description: This call disconnects all handlers attacched to this function, note however, it " ..
|
||||
"does NOT make waiting code continue, as is the behavior of normal Roblox events. This method " ..
|
||||
"can also be called on the connection object which is returned from Signal:connect to only " ..
|
||||
"disconnect a single handler, as opposed to this method, which will disconnect all handlers."
|
||||
|
||||
when "Create"
|
||||
"Function Create. " ..
|
||||
"Arguments: A table containing information about how to construct a collection of objects. " ..
|
||||
"Returns: The constructed objects. " ..
|
||||
"Descrition: Create is a very powerfull function, whose description is too long to fit here, and " ..
|
||||
"is best described via example, please see the wiki page for a description of how to use it."
|
||||
|
||||
--------------------------------------------Documentation Ends----------------------------------------------------------
|
||||
|
||||
t
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Library Registration Script
|
||||
-- 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)
|
||||
|
||||
deepakTestingPlace = 3569749
|
||||
sc = game\GetService "ScriptContext"
|
||||
tries = 0
|
||||
|
||||
until sc or tries > 2
|
||||
tries += 1
|
||||
sc = game\GetService "ScriptContext"
|
||||
wait 0.2
|
||||
|
||||
with sc do if sc
|
||||
\RegisterLibrary "Libraries/RbxGui", "45284430"
|
||||
\RegisterLibrary "Libraries/RbxGear", "45374389"
|
||||
|
||||
if game.PlaceId == deepakTestingPlace
|
||||
\RegisterLibrary "Libraries/RbxStatus", "52177566"
|
||||
|
||||
\RegisterLibrary "Libraries/RbxUtility", "60595411"
|
||||
\RegisterLibrary "Libraries/RbxStamper", "73157242"
|
||||
\LibraryRegistrationComplete!
|
||||
|
||||
else
|
||||
print "failed to find script context, libraries did not load"
|
||||
2338
yue/73157242.yue
2338
yue/73157242.yue
File diff suppressed because it is too large
Load Diff
821
yue/89449008.yue
821
yue/89449008.yue
|
|
@ -1,821 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- Heliodex's basic New function (basically a simplified version of melt)
|
||||
New = (className, name, props) ->
|
||||
if props == nil -- no name was provided
|
||||
props = name
|
||||
name = nil
|
||||
|
||||
obj = Instance.new className
|
||||
obj.Name = name if name
|
||||
local parent
|
||||
|
||||
for k, v in pairs props
|
||||
if type(k) == "string"
|
||||
if k == "Parent"
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
|
||||
elseif type(k) == "number" and type(v) == "userdata"
|
||||
v.Parent = obj
|
||||
|
||||
obj.Parent = parent
|
||||
obj
|
||||
--
|
||||
|
||||
-- A couple of necessary functions
|
||||
waitForChild = (instance, name) ->
|
||||
assert instance
|
||||
assert name
|
||||
while not instance\FindFirstChild name
|
||||
print "Waiting for ...", instance, name
|
||||
instance.ChildAdded\wait!
|
||||
|
||||
instance\FindFirstChild name
|
||||
|
||||
waitForProperty = (instance, property) ->
|
||||
assert instance
|
||||
assert property
|
||||
while not instance[property]
|
||||
instance.Changed\wait!
|
||||
|
||||
|
||||
IsTouchDevice = ->
|
||||
touchEnabled = false
|
||||
try
|
||||
touchEnabled = Game\GetService"UserInputService".TouchEnabled
|
||||
touchEnabled
|
||||
|
||||
|
||||
waitForChild game, "Players"
|
||||
waitForProperty game.Players, "LocalPlayer"
|
||||
player = game.Players.LocalPlayer
|
||||
|
||||
RbxGui, _ = LoadLibrary "RbxGui"
|
||||
if not RbxGui
|
||||
print "could not find RbxGui!"
|
||||
return
|
||||
|
||||
--- Begin Locals
|
||||
StaticTabName = "gear"
|
||||
|
||||
backpack = script.Parent
|
||||
|
||||
backpackItems = {}
|
||||
buttons = {}
|
||||
|
||||
debounce = false
|
||||
browsingMenu = false
|
||||
|
||||
mouseEnterCons = {}
|
||||
mouseClickCons = {}
|
||||
|
||||
local characterChildAddedCon
|
||||
local characterChildRemovedCon
|
||||
local backpackAddCon
|
||||
|
||||
playerBackpack = waitForChild player, "Backpack"
|
||||
|
||||
waitForChild backpack, "Tabs"
|
||||
|
||||
waitForChild backpack, "Gear"
|
||||
gearPreview = waitForChild backpack.Gear, "GearPreview"
|
||||
|
||||
scroller = waitForChild backpack.Gear, "GearGridScrollingArea"
|
||||
|
||||
currentLoadout = waitForChild backpack.Parent, "CurrentLoadout"
|
||||
|
||||
grid = waitForChild backpack.Gear, "GearGrid"
|
||||
gearButton = waitForChild grid, "GearButton"
|
||||
|
||||
swapSlot = waitForChild script.Parent, "SwapSlot"
|
||||
|
||||
backpackManager = waitForChild script.Parent, "CoreScripts/BackpackScripts/BackpackManager"
|
||||
backpackOpenEvent = waitForChild backpackManager, "BackpackOpenEvent"
|
||||
backpackCloseEvent = waitForChild backpackManager, "BackpackCloseEvent"
|
||||
tabClickedEvent = waitForChild backpackManager, "TabClickedEvent"
|
||||
resizeEvent = waitForChild backpackManager, "ResizeEvent"
|
||||
searchRequestedEvent = waitForChild backpackManager, "SearchRequestedEvent"
|
||||
tellBackpackReadyFunc = waitForChild backpackManager, "BackpackReady"
|
||||
|
||||
-- creating scroll bar early as to make sure items get placed correctly
|
||||
scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame nil, "grid", Vector2.new 6, 6
|
||||
|
||||
scrollFrame.Position = UDim2.new 0, 0, 0, 30
|
||||
scrollFrame.Size = UDim2.new 1, 0, 1, -30
|
||||
scrollFrame.Parent = backpack.Gear.GearGrid
|
||||
|
||||
scrollBar = New "Frame", "ScrollBar"
|
||||
BackgroundTransparency: 0.9
|
||||
BackgroundColor3: Color3.new 1, 1, 1
|
||||
BorderSizePixel: 0
|
||||
Size: UDim2.new 0, 17, 1, -36
|
||||
Position: UDim2.new 0, 0, 0, 18
|
||||
Parent: scroller
|
||||
|
||||
scrollDown.Position = UDim2.new 0, 0, 1, -17
|
||||
|
||||
scrollUp.Parent = scroller
|
||||
scrollDown.Parent = scroller
|
||||
|
||||
scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout = RbxGui.CreateScrollingFrame!
|
||||
|
||||
scrollFrameLoadout.Position = UDim2.new 0, 0, 0, 0
|
||||
scrollFrameLoadout.Size = UDim2.new 1, 0, 1, 0
|
||||
scrollFrameLoadout.Parent = backpack.Gear.GearLoadouts.LoadoutsList
|
||||
|
||||
LoadoutButton = New "TextButton", "LoadoutButton"
|
||||
RobloxLocked: true
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 1, 0, 0, 32
|
||||
Style: Enum.ButtonStyle.RobloxButton
|
||||
Text: "Loadout #1"
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
Parent: scrollFrameLoadout
|
||||
|
||||
with LoadoutButton\clone!
|
||||
.Text = "Loadout #2"
|
||||
.Parent = scrollFrameLoadout
|
||||
|
||||
with LoadoutButton\clone!
|
||||
.Text = "Loadout #3"
|
||||
.Parent = scrollFrameLoadout
|
||||
|
||||
with LoadoutButton\clone!
|
||||
.Text = "Loadout #4"
|
||||
.Parent = scrollFrameLoadout
|
||||
|
||||
New "Frame", "ScrollBarLoadout"
|
||||
BackgroundTransparency: 0.9
|
||||
BackgroundColor3: Color3.new 1, 1, 1
|
||||
BorderSizePixel: 0
|
||||
Size: UDim2.new 0, 17, 1, -36
|
||||
Position: UDim2.new 0, 0, 0, 18
|
||||
Parent: backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||
|
||||
scrollDownLoadout.Position = UDim2.new 0, 0, 1, -17
|
||||
|
||||
scrollUpLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||
scrollDownLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||
|
||||
-- Begin Functions
|
||||
removeFromMap = (map, object) ->
|
||||
for i = 1, #map
|
||||
if map[i] == object
|
||||
table.remove map, i
|
||||
break
|
||||
|
||||
robloxLock = (instance) ->
|
||||
instance.RobloxLocked = true
|
||||
children = instance\GetChildren!
|
||||
if children
|
||||
for _, child in ipairs children
|
||||
robloxLock child
|
||||
|
||||
|
||||
clearPreview = ->
|
||||
gearPreview.GearImage.Image = ""
|
||||
gearPreview.GearStats.GearName.Text = ""
|
||||
|
||||
clearHighlight = (button) ->
|
||||
button.TextColor3 = Color3.new 1, 1, 1
|
||||
button.BackgroundColor3 = Color3.new 0, 0, 0
|
||||
|
||||
inLoadout = (gear) ->
|
||||
children = currentLoadout\GetChildren!
|
||||
for i in *children
|
||||
if i\IsA "Frame"
|
||||
button = i\GetChildren!
|
||||
if #button > 0 and
|
||||
button[1].GearReference.Value and
|
||||
button[1].GearReference.Value == gear
|
||||
|
||||
return true
|
||||
|
||||
false
|
||||
|
||||
updateGridActive = ->
|
||||
for _, v in pairs backpackItems
|
||||
if buttons[v]
|
||||
gearRef = buttons[v]\FindFirstChild "GearReference"
|
||||
|
||||
gear = gearRef?.Value
|
||||
|
||||
buttons[v].Active = if (not gear) or inLoadout gear
|
||||
false
|
||||
else
|
||||
true
|
||||
|
||||
swapGearSlot = (slot, gearButton) ->
|
||||
if not swapSlot.Value -- signal loadout to swap a gear out
|
||||
swapSlot.Slot.Value = slot
|
||||
swapSlot.GearButton.Value = gearButton
|
||||
swapSlot.Value = true
|
||||
updateGridActive!
|
||||
|
||||
unequipGear = (physGear) ->
|
||||
physGear.Parent = playerBackpack
|
||||
updateGridActive!
|
||||
|
||||
UnequipGearMenuClick = (element, menu) ->
|
||||
return if type(element.Action) ~= "number"
|
||||
|
||||
num = element.Action
|
||||
if num == 1 -- remove from loadout
|
||||
unequipGear menu.Parent.GearReference.Value
|
||||
inventoryButton = menu.Parent
|
||||
gearToUnequip = inventoryButton.GearReference.Value
|
||||
loadoutChildren = currentLoadout\GetChildren!
|
||||
slot = -1
|
||||
for i in *loadoutChildren
|
||||
if i\IsA "Frame"
|
||||
button = i\GetChildren!
|
||||
if button[1] and button[1].GearReference.Value == gearToUnequip
|
||||
slot = button[1].SlotNumber.Text
|
||||
break
|
||||
|
||||
swapGearSlot slot, nil
|
||||
|
||||
|
||||
highlight = (button) ->
|
||||
button.TextColor3 = Color3.new 0, 0, 0
|
||||
button.BackgroundColor3 = Color3.new 0.8, 0.8, 0.8
|
||||
|
||||
getGearContextMenu = ->
|
||||
gearContextMenu = New "Frame", "UnequipContextMenu"
|
||||
Active: true
|
||||
Size: UDim2.new 0, 115, 0, 70
|
||||
Position: UDim2.new 0, -16, 0, -16
|
||||
BackgroundTransparency: 1
|
||||
Visible: false
|
||||
|
||||
gearContextMenuButton = New "TextButton", "UnequipContextMenuButton"
|
||||
Text: ""
|
||||
Style: Enum.ButtonStyle.RobloxButtonDefault
|
||||
ZIndex: 8
|
||||
Size: UDim2.new 1, 0, 1, -20
|
||||
Visible: true
|
||||
Parent: gearContextMenu
|
||||
|
||||
elementHeight = 12
|
||||
|
||||
contextMenuElements = {}
|
||||
contextMenuElementsName = { "Remove Hotkey" }
|
||||
|
||||
for i = 1, #contextMenuElementsName
|
||||
element = {}
|
||||
element.Type = "Button"
|
||||
element.Text = contextMenuElementsName[i]
|
||||
element.Action = i
|
||||
element.DoIt = UnequipGearMenuClick
|
||||
table.insert contextMenuElements, element
|
||||
|
||||
|
||||
for i, contextElement in ipairs contextMenuElements
|
||||
element = contextElement
|
||||
if element.Type == "Button"
|
||||
button = New "TextButton", "UnequipContextButton#{i}"
|
||||
BackgroundColor3: Color3.new 0, 0, 0
|
||||
BorderSizePixel: 0
|
||||
TextXAlignment: Enum.TextXAlignment.Left
|
||||
Text: " #{contextElement.Text}"
|
||||
Font: Enum.Font.Arial
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Size: UDim2.new 1, 8, 0, elementHeight
|
||||
Position: UDim2.new 0, 0, 0, elementHeight * i
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
ZIndex: 9
|
||||
Parent: gearContextMenuButton
|
||||
|
||||
if not IsTouchDevice!
|
||||
button.MouseButton1Click\connect ->
|
||||
if button.Active and not gearContextMenu.Parent.Active
|
||||
try
|
||||
element.DoIt element, gearContextMenu
|
||||
|
||||
browsingMenu = false
|
||||
gearContextMenu.Visible = false
|
||||
clearHighlight button
|
||||
clearPreview!
|
||||
|
||||
|
||||
button.MouseEnter\connect ->
|
||||
if button.Active and gearContextMenu.Parent.Active
|
||||
highlight button
|
||||
|
||||
|
||||
button.MouseLeave\connect ->
|
||||
if button.Active and gearContextMenu.Parent.Active
|
||||
clearHighlight button
|
||||
|
||||
|
||||
contextElement.Button = button
|
||||
contextElement.Element = button
|
||||
elseif element.Type == "Label"
|
||||
frame = New "Frame", "ContextLabel#{i}"
|
||||
BackgroundTransparency: 1
|
||||
Size: UDim2.new 1, 8, 0, elementHeight
|
||||
|
||||
* New "TextLabel", "Text1"
|
||||
BackgroundTransparency: 1
|
||||
BackgroundColor3: Color3.new 1, 1, 1
|
||||
BorderSizePixel: 0
|
||||
TextXAlignment: Enum.TextXAlignment.Left
|
||||
Font: Enum.Font.ArialBold
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Position: UDim2.new 0, 0, 0, 0
|
||||
Size: UDim2.new 0.5, 0, 1, 0
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
ZIndex: 9
|
||||
|
||||
element.Label1 = frame.Text1
|
||||
|
||||
if element.GetText2
|
||||
element.Label2 = New "TextLabel", "Text2"
|
||||
BackgroundTransparency: 1
|
||||
BackgroundColor3: Color3.new 1, 1, 1
|
||||
BorderSizePixel: 0
|
||||
TextXAlignment: Enum.TextXAlignment.Right
|
||||
Font: Enum.Font.Arial
|
||||
FontSize: Enum.FontSize.Size14
|
||||
Position: UDim2.new 0.5, 0, 0, 0
|
||||
Size: UDim2.new 0.5, 0, 1, 0
|
||||
TextColor3: Color3.new 1, 1, 1
|
||||
ZIndex: 9
|
||||
Parent: frame
|
||||
|
||||
frame.Parent = gearContextMenuButton
|
||||
element.Label = frame
|
||||
element.Element = frame
|
||||
|
||||
|
||||
gearContextMenu.ZIndex = 4
|
||||
gearContextMenu.MouseLeave\connect ->
|
||||
browsingMenu = false
|
||||
gearContextMenu.Visible = false
|
||||
clearPreview!
|
||||
|
||||
robloxLock gearContextMenu
|
||||
|
||||
gearContextMenu
|
||||
|
||||
findEmptySlot = ->
|
||||
local smallestNum
|
||||
loadout = currentLoadout\GetChildren!
|
||||
for i in *loadout
|
||||
if i\IsA"Frame" and #i\GetChildren! <= 0
|
||||
frameNum = tonumber string.sub i.Name, 5
|
||||
if frameNum == 0
|
||||
frameNum = 10
|
||||
|
||||
if not smallestNum or (smallestNum > frameNum)
|
||||
smallestNum = frameNum
|
||||
|
||||
if smallestNum == 10
|
||||
smallestNum = 0
|
||||
|
||||
smallestNum
|
||||
|
||||
checkForSwap = (button, x, y) ->
|
||||
loadoutChildren = currentLoadout\GetChildren!
|
||||
for i in *loadoutChildren
|
||||
if i\IsA"Frame" and string.find i.Name, "Slot"
|
||||
if x >= i.AbsolutePosition.x and
|
||||
x <= (i.AbsolutePosition.x + i.AbsoluteSize.x)
|
||||
|
||||
if y >= i.AbsolutePosition.y and
|
||||
y <= (i.AbsolutePosition.y + i.AbsoluteSize.y)
|
||||
|
||||
slot = tonumber string.sub i.Name, 5
|
||||
swapGearSlot slot, button
|
||||
return true
|
||||
false
|
||||
|
||||
|
||||
previewGear = (button) ->
|
||||
if not browsingMenu
|
||||
gearPreview.Visible = false
|
||||
gearPreview.GearImage.Image = button.Image
|
||||
gearPreview.GearStats.GearName.Text = button.GearReference.Value.Name
|
||||
|
||||
buttonClick = (button) ->
|
||||
if button\FindFirstChild "UnequipContextMenu" and not button.Active
|
||||
button.UnequipContextMenu.Visible = true
|
||||
browsingMenu = true
|
||||
|
||||
resizeGrid = ->
|
||||
for _, v in pairs backpackItems
|
||||
if not v\FindFirstChild "RobloxBuildTool"
|
||||
if not buttons[v]
|
||||
buttonClone = gearButton\clone!
|
||||
|
||||
with buttonClone
|
||||
.Parent = grid.ScrollingFrame
|
||||
.Visible = true
|
||||
.Image = v.TextureId
|
||||
if .Image == ""
|
||||
.GearText.Text = v.Name
|
||||
.GearReference.Value = v
|
||||
.Draggable = true
|
||||
buttons[v] = buttonClone
|
||||
|
||||
if not IsTouchDevice!
|
||||
unequipMenu = getGearContextMenu!
|
||||
|
||||
unequipMenu.Visible = false
|
||||
unequipMenu.Parent = buttonClone
|
||||
|
||||
|
||||
local beginPos
|
||||
buttonClone.DragBegin\connect (value) ->
|
||||
waitForChild buttonClone, "Background"
|
||||
buttonClone["Background"].ZIndex = 10
|
||||
buttonClone.ZIndex = 10
|
||||
beginPos = value
|
||||
|
||||
buttonClone.DragStopped\connect (x, y) ->
|
||||
waitForChild buttonClone, "Background"
|
||||
buttonClone["Background"].ZIndex = 1
|
||||
buttonClone.ZIndex = 2
|
||||
if beginPos ~= buttonClone.Position
|
||||
if not checkForSwap buttonClone, x, y
|
||||
buttonClone\TweenPosition(
|
||||
beginPos,
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quad,
|
||||
0.5,
|
||||
true
|
||||
)
|
||||
buttonClone.Draggable = false
|
||||
delay 0.5, ->
|
||||
buttonClone.Draggable = true
|
||||
|
||||
else
|
||||
buttonClone.Position = beginPos
|
||||
|
||||
|
||||
clickTime = tick!
|
||||
mouseEnterCons[buttonClone] = buttonClone.MouseEnter\connect ->
|
||||
previewGear buttonClone
|
||||
|
||||
mouseClickCons[buttonClone] = buttonClone.MouseButton1Click\connect ->
|
||||
newClickTime = tick!
|
||||
if buttonClone.Active and (newClickTime - clickTime) < 0.5
|
||||
slot = findEmptySlot!
|
||||
if slot
|
||||
buttonClone.ZIndex = 1
|
||||
swapGearSlot slot, buttonClone
|
||||
|
||||
else
|
||||
buttonClick buttonClone
|
||||
|
||||
clickTime = newClickTime
|
||||
|
||||
recalculateScroll!
|
||||
|
||||
resize = ->
|
||||
size = 0.75 * if gearPreview.AbsoluteSize.Y > gearPreview.AbsoluteSize.X
|
||||
gearPreview.AbsoluteSize.X
|
||||
else
|
||||
gearPreview.AbsoluteSize.Y
|
||||
|
||||
|
||||
waitForChild gearPreview, "GearImage"
|
||||
gearPreview.GearImage.Size = UDim2.new 0, size, 0, size
|
||||
gearPreview.GearImage.Position = UDim2.new 0, gearPreview.AbsoluteSize.X / 2 - size / 2, 0.75, -size
|
||||
|
||||
resizeGrid!
|
||||
|
||||
|
||||
addToGrid = (child) ->
|
||||
return if not child\IsA"Tool" and
|
||||
not child\IsA "HopperBin"
|
||||
|
||||
return if child\FindFirstChild "RobloxBuildTool"
|
||||
|
||||
|
||||
for _, v in pairs backpackItems -- check to see if we already have this gear registered
|
||||
return if v == child
|
||||
|
||||
table.insert backpackItems, child
|
||||
|
||||
changeCon = child.Changed\connect (prop) ->
|
||||
if prop == "Name" and
|
||||
buttons[child] and
|
||||
buttons[child].Image == ""
|
||||
|
||||
buttons[child].GearText.Text = child.Name
|
||||
|
||||
ancestryCon = child.AncestryChanged\connect (_, _) ->
|
||||
local thisObject
|
||||
for _, v in pairs backpackItems
|
||||
if v == child
|
||||
thisObject = v
|
||||
break
|
||||
|
||||
waitForProperty player, "Character"
|
||||
waitForChild player, "Backpack"
|
||||
if child.Parent ~= player.Backpack and child.Parent ~= player.Character
|
||||
|
||||
ancestryCon?\disconnect!
|
||||
changeCon?\disconnect!
|
||||
|
||||
for _, v in pairs backpackItems
|
||||
if v == thisObject
|
||||
mouseEnterCons[buttons[v]]?\disconnect!
|
||||
mouseClickCons[buttons[v]]?\disconnect!
|
||||
|
||||
buttons[v].Parent = nil
|
||||
buttons[v] = nil
|
||||
break
|
||||
|
||||
removeFromMap backpackItems, thisObject
|
||||
|
||||
resizeGrid!
|
||||
else
|
||||
resizeGrid!
|
||||
updateGridActive!
|
||||
resizeGrid!
|
||||
|
||||
showPartialGrid = (subset) ->
|
||||
for _, v in pairs buttons
|
||||
v.Parent = nil
|
||||
|
||||
if subset
|
||||
for _, v in pairs subset
|
||||
v.Parent = grid.ScrollingFrame
|
||||
|
||||
|
||||
recalculateScroll!
|
||||
|
||||
|
||||
showEntireGrid = ->
|
||||
for _, v in pairs buttons
|
||||
v.Parent = grid.ScrollingFrame
|
||||
|
||||
recalculateScroll!
|
||||
|
||||
centerGear = (loadoutChildren) ->
|
||||
gearButtons = {}
|
||||
local lastSlotAdd
|
||||
for i in *loadoutChildren
|
||||
if i\IsA"Frame" and #i\GetChildren! > 0
|
||||
if i.Name == "Slot0"
|
||||
lastSlotAdd = i
|
||||
else
|
||||
table.insert gearButtons, i
|
||||
|
||||
if lastSlotAdd
|
||||
table.insert gearButtons, lastSlotAdd
|
||||
|
||||
|
||||
startPos = (1 - (#gearButtons * 0.1)) / 2
|
||||
for i = 1, #gearButtons
|
||||
gearButtons[i]\TweenPosition(
|
||||
UDim2.new(startPos + ((i - 1) * 0.1), 0, 0, 0),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quad,
|
||||
0.25,
|
||||
true
|
||||
)
|
||||
|
||||
backpackOpenHandler = (currentTab) ->
|
||||
if currentTab and currentTab ~= StaticTabName
|
||||
backpack.Gear.Visible = false
|
||||
return
|
||||
|
||||
backpack.Gear.Visible = true
|
||||
updateGridActive!
|
||||
|
||||
resizeGrid!
|
||||
resize!
|
||||
tellBackpackReadyFunc\Invoke!
|
||||
|
||||
backpackCloseHandler = (currentTab) ->
|
||||
if currentTab and currentTab ~= StaticTabName
|
||||
backpack.Gear.Visible = false
|
||||
return
|
||||
|
||||
|
||||
backpack.Gear.Visible = false
|
||||
|
||||
resizeGrid!
|
||||
resize!
|
||||
tellBackpackReadyFunc\Invoke!
|
||||
|
||||
tabClickHandler = (tabName) ->
|
||||
if tabName == StaticTabName
|
||||
backpackOpenHandler tabName
|
||||
else
|
||||
backpackCloseHandler tabName
|
||||
|
||||
loadoutCheck = (child, selectState) ->
|
||||
return if not child\IsA "ImageButton"
|
||||
|
||||
for _, v in pairs backpackItems
|
||||
if buttons[v]
|
||||
if child\FindFirstChild "GearReference" and buttons[v]\FindFirstChild "GearReference"
|
||||
if buttons[v].GearReference.Value == child.GearReference.Value
|
||||
buttons[v].Active = selectState
|
||||
break
|
||||
|
||||
|
||||
-- removeAllEquippedGear = (physGear) ->
|
||||
-- stuff = player.Character\GetChildren!
|
||||
-- for i in *stuff
|
||||
-- if (i\IsA"Tool" or stuff[i]\IsA"HopperBin") and i ~= physGear
|
||||
-- i.Parent = playerBackpack
|
||||
|
||||
-- equipGear = (physGear) ->
|
||||
-- removeAllEquippedGear physGear
|
||||
-- physGear.Parent = player.Character
|
||||
-- updateGridActive!
|
||||
|
||||
setupCharacterConnections = ->
|
||||
backpackAddCon?\disconnect!
|
||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded\connect (child) ->
|
||||
addToGrid child
|
||||
|
||||
|
||||
-- make sure we get all the children
|
||||
backpackChildren = game.Players.LocalPlayer.Backpack\GetChildren!
|
||||
for i in *backpackChildren
|
||||
addToGrid i
|
||||
|
||||
|
||||
characterChildAddedCon?\disconnect!
|
||||
characterChildAddedCon = game.Players.LocalPlayer.Character.ChildAdded\connect (child) ->
|
||||
addToGrid child
|
||||
updateGridActive!
|
||||
|
||||
characterChildRemovedCon?\disconnect!
|
||||
characterChildRemovedCon = game.Players.LocalPlayer.Character.ChildRemoved\connect (_) ->
|
||||
updateGridActive!
|
||||
|
||||
wait!
|
||||
centerGear currentLoadout\GetChildren!
|
||||
|
||||
removeCharacterConnections = ->
|
||||
characterChildAddedCon?\disconnect!
|
||||
characterChildRemovedCon?\disconnect!
|
||||
backpackAddCon?\disconnect!
|
||||
|
||||
trim = (s) -> s\gsub "^%s*(.-)%s*$", "%1"
|
||||
|
||||
filterGear = (terms) ->
|
||||
filteredGear = {}
|
||||
for _, v in pairs backpackItems
|
||||
if buttons[v]
|
||||
gearString = trim string.lower buttons[v].GearReference.Value.Name
|
||||
for i in *terms
|
||||
if string.match gearString, i
|
||||
table.insert filteredGear, buttons[v]
|
||||
break
|
||||
|
||||
filteredGear
|
||||
|
||||
splitByWhitespace = (text) ->
|
||||
return if type(text) ~= "string"
|
||||
|
||||
[token for token in string.gmatch text,
|
||||
"[^%s]+" when string.len(token) > 0]
|
||||
|
||||
showSearchGear = (searchTerms) ->
|
||||
return if not backpack.Gear.Visible
|
||||
|
||||
-- currently not active tab
|
||||
|
||||
searchTermTable = splitByWhitespace searchTerms
|
||||
local currSearchTerms
|
||||
currSearchTerms = if searchTermTable and (#searchTermTable > 0)
|
||||
searchTermTable
|
||||
else
|
||||
nil
|
||||
|
||||
if searchTermTable == nil
|
||||
showEntireGrid!
|
||||
return
|
||||
|
||||
filteredButtons = filterGear currSearchTerms
|
||||
showPartialGrid filteredButtons
|
||||
|
||||
|
||||
nukeBackpack = ->
|
||||
while #buttons > 0
|
||||
table.remove buttons
|
||||
|
||||
buttons = {}
|
||||
while #backpackItems > 0
|
||||
table.remove backpackItems
|
||||
|
||||
backpackItems = {}
|
||||
scrollingFrameChildren = grid.ScrollingFrame\GetChildren!
|
||||
for i in *scrollingFrameChildren
|
||||
i\remove!
|
||||
|
||||
coreGuiChanged = (coreGuiType, enabled) ->
|
||||
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All
|
||||
if not enabled
|
||||
backpack.Gear.Visible = false
|
||||
|
||||
|
||||
backpackChildren = player.Backpack\GetChildren!
|
||||
for i in *backpackChildren
|
||||
addToGrid i
|
||||
|
||||
|
||||
------------------------- Start Lifelong Connections -----------------------
|
||||
|
||||
resizeEvent.Event\connect (_) ->
|
||||
return if debounce
|
||||
|
||||
debounce = true
|
||||
wait!
|
||||
resize!
|
||||
resizeGrid!
|
||||
debounce = false
|
||||
|
||||
|
||||
currentLoadout.ChildAdded\connect (child) -> loadoutCheck child, false
|
||||
currentLoadout.ChildRemoved\connect (child) -> loadoutCheck child, true
|
||||
|
||||
|
||||
currentLoadout.DescendantAdded\connect (descendant) ->
|
||||
if not backpack.Visible and (descendant\IsA"ImageButton" or descendant\IsA "TextButton")
|
||||
centerGear currentLoadout\GetChildren!
|
||||
|
||||
|
||||
currentLoadout.DescendantRemoving\connect (descendant) ->
|
||||
if not backpack.Visible and (descendant\IsA"ImageButton" or descendant\IsA "TextButton")
|
||||
wait!
|
||||
centerGear currentLoadout\GetChildren!
|
||||
|
||||
|
||||
grid.MouseEnter\connect -> clearPreview!
|
||||
grid.MouseLeave\connect -> clearPreview!
|
||||
|
||||
|
||||
player.CharacterRemoving\connect ->
|
||||
removeCharacterConnections!
|
||||
nukeBackpack!
|
||||
|
||||
player.CharacterAdded\connect ->
|
||||
setupCharacterConnections!
|
||||
|
||||
|
||||
player.ChildAdded\connect (child) ->
|
||||
if child\IsA "Backpack"
|
||||
playerBackpack = child
|
||||
backpackAddCon?\disconnect!
|
||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded\connect (child) ->
|
||||
addToGrid child
|
||||
|
||||
|
||||
swapSlot.Changed\connect ->
|
||||
if not swapSlot.Value
|
||||
updateGridActive!
|
||||
|
||||
loadoutChildren = currentLoadout\GetChildren!
|
||||
for i in *loadoutChildren
|
||||
if i\IsA"Frame" and string.find i.Name, "Slot"
|
||||
i.ChildRemoved\connect -> updateGridActive!
|
||||
i.ChildAdded\connect -> updateGridActive!
|
||||
|
||||
|
||||
------------------------- End Lifelong Connections -----------------------
|
||||
|
||||
try
|
||||
coreGuiChanged Enum.CoreGuiType.Backpack, Game.StarterGui\GetCoreGuiEnabled Enum.CoreGuiType.Backpack
|
||||
Game.StarterGui.CoreGuiChangedSignal\connect coreGuiChanged
|
||||
|
||||
|
||||
resize!
|
||||
resizeGrid!
|
||||
|
||||
-- make sure any items in the loadout are accounted for in inventory
|
||||
loadoutChildren = currentLoadout\GetChildren!
|
||||
for i in *loadoutChildren
|
||||
loadoutCheck i, false
|
||||
|
||||
if not backpack.Visible
|
||||
centerGear currentLoadout\GetChildren!
|
||||
|
||||
|
||||
-- make sure that inventory is listening to gear reparenting
|
||||
if characterChildAddedCon == nil and game.Players.LocalPlayer["Character"]
|
||||
setupCharacterConnections!
|
||||
|
||||
if not backpackAddCon
|
||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded\connect (child) ->
|
||||
addToGrid child
|
||||
|
||||
backpackOpenEvent.Event\connect backpackOpenHandler
|
||||
backpackCloseEvent.Event\connect backpackCloseHandler
|
||||
tabClickedEvent.Event\connect tabClickHandler
|
||||
searchRequestedEvent.Event\connect showSearchGear
|
||||
|
||||
recalculateScrollLoadout!
|
||||
412
yue/89449093.yue
412
yue/89449093.yue
|
|
@ -1,412 +0,0 @@
|
|||
import "macros" as { $ }
|
||||
$load $FILE
|
||||
|
||||
-- This script manages context switches in the backpack (Gear to Wardrobe, etc.) and player state changes. Also manages global functions across different tabs (currently only search)
|
||||
return if game.CoreGui.Version < 7
|
||||
-- peace out if we aren't using the right client
|
||||
|
||||
-- basic functions
|
||||
waitForChild = (instance, name) ->
|
||||
until instance\FindFirstChild name
|
||||
instance.ChildAdded\wait!
|
||||
|
||||
instance\FindFirstChild name
|
||||
|
||||
waitForProperty = (instance, property) ->
|
||||
until instance[property]
|
||||
instance.Changed\wait!
|
||||
|
||||
-- don't do anything if we are in an empty game
|
||||
waitForChild game, "Players"
|
||||
if #game.Players\GetChildren! < 1
|
||||
game.Players.ChildAdded\wait!
|
||||
|
||||
-- make sure everything is loaded in before we do anything
|
||||
-- get our local player
|
||||
waitForProperty game.Players, "LocalPlayer"
|
||||
|
||||
------------------------ Locals ------------------------------
|
||||
backpack = script.Parent
|
||||
waitForChild backpack, "Gear"
|
||||
|
||||
screen = script.Parent.Parent
|
||||
assert screen\IsA "ScreenGui"
|
||||
|
||||
waitForChild backpack, "Tabs"
|
||||
waitForChild backpack.Tabs, "CloseButton"
|
||||
closeButton = backpack.Tabs.CloseButton
|
||||
|
||||
waitForChild backpack.Tabs, "InventoryButton"
|
||||
inventoryButton = backpack.Tabs.InventoryButton
|
||||
|
||||
local wardrobeButton
|
||||
if game.CoreGui.Version >= 8
|
||||
waitForChild backpack.Tabs, "WardrobeButton"
|
||||
wardrobeButton = backpack.Tabs.WardrobeButton
|
||||
|
||||
waitForChild backpack.Parent, "ControlFrame"
|
||||
backpackButton = waitForChild backpack.Parent.ControlFrame, "BackpackButton"
|
||||
currentTab = "gear"
|
||||
|
||||
searchFrame = waitForChild backpack, "SearchFrame"
|
||||
waitForChild backpack.SearchFrame, "SearchBoxFrame"
|
||||
searchBox = waitForChild backpack.SearchFrame.SearchBoxFrame, "SearchBox"
|
||||
searchButton = waitForChild backpack.SearchFrame, "SearchButton"
|
||||
resetButton = waitForChild backpack.SearchFrame, "ResetButton"
|
||||
|
||||
robloxGui = waitForChild Game.CoreGui, "RobloxGui"
|
||||
currentLoadout = waitForChild robloxGui, "CurrentLoadout"
|
||||
loadoutBackground = waitForChild currentLoadout, "Background"
|
||||
|
||||
canToggle = true
|
||||
readyForNextEvent = true
|
||||
backpackIsOpen = false
|
||||
active = true
|
||||
disabledByDeveloper = false
|
||||
|
||||
local humanoidDiedCon
|
||||
|
||||
guiTweenSpeed = 0.25 -- how quickly we open/close the backpack
|
||||
|
||||
searchDefaultText = "Search..."
|
||||
tilde = "~"
|
||||
backquote = "`"
|
||||
|
||||
backpackSize = UDim2.new 0, 600, 0, 400
|
||||
|
||||
if robloxGui.AbsoluteSize.Y <= 320
|
||||
backpackSize = UDim2.new 0, 200, 0, 140
|
||||
|
||||
|
||||
------------------------ End Locals ---------------------------
|
||||
|
||||
---------------------------------------- Public Event Setup ----------------------------------------
|
||||
|
||||
createPublicEvent = (eventName) ->
|
||||
assert eventName, "eventName is nil"
|
||||
assert "#{eventName}", "eventName is not a string"
|
||||
|
||||
with Instance.new "BindableEvent"
|
||||
.Name = "#{eventName}"
|
||||
.Parent = script
|
||||
|
||||
createPublicFunction = (funcName, invokeFunc) ->
|
||||
assert funcName, "funcName is nil"
|
||||
assert "#{funcName}", "funcName is not a string"
|
||||
assert invokeFunc, "invokeFunc is nil"
|
||||
assert type(invokeFunc) == "function", "invokeFunc should be of type 'function'"
|
||||
|
||||
with Instance.new "BindableFunction"
|
||||
.Name = "#{funcName}"
|
||||
.OnInvoke = invokeFunc
|
||||
.Parent = script
|
||||
|
||||
-- Events
|
||||
resizeEvent = createPublicEvent "ResizeEvent"
|
||||
backpackOpenEvent = createPublicEvent "BackpackOpenEvent"
|
||||
backpackCloseEvent = createPublicEvent "BackpackCloseEvent"
|
||||
tabClickedEvent = createPublicEvent "TabClickedEvent"
|
||||
searchRequestedEvent = createPublicEvent "SearchRequestedEvent"
|
||||
---------------------------------------- End Public Event Setup ----------------------------------------
|
||||
|
||||
--------------------------- Internal Functions ----------------------------------------
|
||||
|
||||
resetSearchBoxGui = ->
|
||||
resetButton.Visible = false
|
||||
searchBox.Text = searchDefaultText
|
||||
|
||||
resetSearch = ->
|
||||
resetSearchBoxGui!
|
||||
searchRequestedEvent\Fire!
|
||||
|
||||
deactivateBackpack = ->
|
||||
backpack.Visible = false
|
||||
active = false
|
||||
|
||||
initHumanoidDiedConnections = ->
|
||||
humanoidDiedCon?\disconnect!
|
||||
|
||||
waitForProperty game.Players.LocalPlayer, "Character"
|
||||
waitForChild game.Players.LocalPlayer.Character, "Humanoid"
|
||||
humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died\connect deactivateBackpack
|
||||
|
||||
hideBackpack = ->
|
||||
backpackIsOpen = false
|
||||
readyForNextEvent = false
|
||||
backpackButton.Selected = false
|
||||
resetSearch!
|
||||
backpackCloseEvent\Fire currentTab
|
||||
backpack.Tabs.Visible = false
|
||||
searchFrame.Visible = false
|
||||
backpack\TweenSizeAndPosition(
|
||||
UDim2.new(0, backpackSize.X.Offset, 0, 0),
|
||||
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -85),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quad,
|
||||
guiTweenSpeed,
|
||||
true,
|
||||
->
|
||||
game.GuiService\RemoveCenterDialog backpack
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
)
|
||||
delay guiTweenSpeed, ->
|
||||
game.GuiService\RemoveCenterDialog backpack
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
readyForNextEvent = true
|
||||
canToggle = true
|
||||
|
||||
showBackpack = ->
|
||||
game.GuiService\AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog, ->
|
||||
backpack.Visible = true
|
||||
backpackButton.Selected = true
|
||||
->
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
)
|
||||
backpack.Visible = true
|
||||
backpackButton.Selected = true
|
||||
backpack\TweenSizeAndPosition(
|
||||
backpackSize,
|
||||
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -backpackSize.Y.Offset - 88),
|
||||
Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quad,
|
||||
guiTweenSpeed,
|
||||
true
|
||||
)
|
||||
delay guiTweenSpeed, ->
|
||||
backpack.Tabs.Visible = false
|
||||
searchFrame.Visible = true
|
||||
backpackOpenEvent\Fire currentTab
|
||||
canToggle = true
|
||||
readyForNextEvent = true
|
||||
backpackButton.Image = "http://banland.xyz/asset/?id=97644093"
|
||||
backpackButton.Position = UDim2.new 0.5, -60, 1, -backpackSize.Y.Offset - 103
|
||||
|
||||
toggleBackpack = ->
|
||||
return if not game.Players.LocalPlayer
|
||||
return if not game.Players.LocalPlayer["Character"]
|
||||
return if not canToggle
|
||||
return if not readyForNextEvent
|
||||
|
||||
readyForNextEvent = false
|
||||
canToggle = false
|
||||
|
||||
backpackIsOpen = not backpackIsOpen
|
||||
|
||||
if backpackIsOpen
|
||||
with loadoutBackground
|
||||
.Image = "http://banland.xyz/asset/?id=97623721"
|
||||
.Position = UDim2.new -0.03, 0, -0.17, 0
|
||||
.Size = UDim2.new 1.05, 0, 1.25, 0
|
||||
.ZIndex = 2.0
|
||||
.Visible = true
|
||||
showBackpack!
|
||||
else
|
||||
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"
|
||||
loadoutBackground.Position = UDim2.new -0.1, 0, -0.1, 0
|
||||
loadoutBackground.Size = UDim2.new 1.2, 0, 1.2, 0
|
||||
hideBackpack!
|
||||
|
||||
clChildren = currentLoadout\GetChildren!
|
||||
for i in *clChildren
|
||||
if i and i\IsA "Frame"
|
||||
frame = i
|
||||
if #frame\GetChildren! > 0
|
||||
backpackButton.Position = UDim2.new 0.5, -60, 1, -108
|
||||
backpackButton.Visible = true
|
||||
loadoutBackground.Visible = true
|
||||
if frame\GetChildren![1]\IsA "ImageButton"
|
||||
with frame\GetChildren![1]
|
||||
.Active = true
|
||||
.Draggable = false
|
||||
|
||||
|
||||
activateBackpack = ->
|
||||
initHumanoidDiedConnections!
|
||||
active = true
|
||||
backpack.Visible = backpackIsOpen
|
||||
if backpackIsOpen
|
||||
toggleBackpack!
|
||||
|
||||
closeBackpack = ->
|
||||
if backpackIsOpen
|
||||
toggleBackpack!
|
||||
|
||||
setSelected = (tab) ->
|
||||
assert tab
|
||||
with tab
|
||||
assert \IsA "TextButton"
|
||||
.BackgroundColor3 = Color3.new 1, 1, 1
|
||||
.TextColor3 = Color3.new 0, 0, 0
|
||||
.Selected = true
|
||||
.ZIndex = 3
|
||||
|
||||
setUnselected = (tab) ->
|
||||
assert tab
|
||||
with tab
|
||||
assert \IsA "TextButton"
|
||||
.BackgroundColor3 = Color3.new 0, 0, 0
|
||||
.TextColor3 = Color3.new 1, 1, 1
|
||||
.Selected = false
|
||||
.ZIndex = 1
|
||||
|
||||
updateTabGui = (selectedTab) ->
|
||||
assert selectedTab
|
||||
|
||||
if selectedTab == "gear"
|
||||
setSelected inventoryButton
|
||||
setUnselected wardrobeButton
|
||||
elseif selectedTab == "wardrobe"
|
||||
setSelected wardrobeButton
|
||||
setUnselected inventoryButton
|
||||
|
||||
mouseLeaveTab = (button) ->
|
||||
assert button
|
||||
assert button\IsA "TextButton"
|
||||
|
||||
return if button.Selected
|
||||
|
||||
button.BackgroundColor3 = Color3.new 0, 0, 0
|
||||
|
||||
mouseOverTab = (button) ->
|
||||
assert button
|
||||
assert button\IsA "TextButton"
|
||||
|
||||
return if button.Selected
|
||||
|
||||
button.BackgroundColor3 = Color3.new 39 / 255, 39 / 255, 39 / 255
|
||||
|
||||
|
||||
newTabClicked = (tabName) ->
|
||||
assert tabName
|
||||
tabName = string.lower tabName
|
||||
currentTab = tabName
|
||||
|
||||
updateTabGui tabName
|
||||
tabClickedEvent\Fire tabName
|
||||
resetSearch!
|
||||
|
||||
|
||||
trim = (s) -> s\gsub "^%s*(.-)%s*$", "%1"
|
||||
|
||||
|
||||
-- splitByWhitespace = (text) ->
|
||||
-- return if type(text) ~= "string"
|
||||
|
||||
-- terms = {}
|
||||
-- for token in string.gmatch text, "[^%s]+"
|
||||
-- if string.len(token) > 0
|
||||
-- table.insert terms, token
|
||||
|
||||
-- terms
|
||||
|
||||
doSearch = ->
|
||||
searchText = searchBox.Text
|
||||
if searchText == ""
|
||||
resetSearch!
|
||||
return
|
||||
|
||||
searchText = trim searchText
|
||||
resetButton.Visible = true
|
||||
-- termTable = splitByWhitespace searchText
|
||||
searchRequestedEvent\Fire searchText -- todo: replace this with termtable when table passing is possible
|
||||
|
||||
backpackReady = ->
|
||||
readyForNextEvent = true
|
||||
|
||||
coreGuiChanged = (coreGuiType, enabled) ->
|
||||
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All
|
||||
active = enabled
|
||||
disabledByDeveloper = not enabled
|
||||
|
||||
with game\GetService "GuiService"
|
||||
if disabledByDeveloper
|
||||
try
|
||||
\RemoveKey tilde
|
||||
\RemoveKey backquote
|
||||
else
|
||||
\AddKey tilde
|
||||
\AddKey backquote
|
||||
|
||||
|
||||
resetSearch!
|
||||
searchFrame.Visible = enabled and backpackIsOpen
|
||||
|
||||
currentLoadout.Visible = enabled
|
||||
backpack.Visible = enabled
|
||||
backpackButton.Visible = enabled
|
||||
|
||||
|
||||
--------------------------- End Internal Functions -------------------------------------
|
||||
|
||||
------------------------------ Public Functions Setup -------------------------------------
|
||||
createPublicFunction "CloseBackpack", hideBackpack
|
||||
createPublicFunction "BackpackReady", backpackReady
|
||||
------------------------------ End Public Functions Setup ---------------------------------
|
||||
|
||||
------------------------ Connections/Script Main -------------------------------------------
|
||||
|
||||
try
|
||||
coreGuiChanged Enum.CoreGuiType.Backpack, Game.StarterGui\GetCoreGuiEnabled Enum.CoreGuiType.Backpack
|
||||
Game.StarterGui.CoreGuiChangedSignal\connect coreGuiChanged
|
||||
|
||||
with inventoryButton
|
||||
.MouseButton1Click\connect -> newTabClicked "gear"
|
||||
.MouseEnter\connect -> mouseOverTab inventoryButton
|
||||
.MouseLeave\connect -> mouseLeaveTab inventoryButton
|
||||
|
||||
if game.CoreGui.Version >= 8
|
||||
with wardrobeButton
|
||||
.MouseButton1Click\connect -> newTabClicked "wardrobe"
|
||||
.MouseEnter\connect -> mouseOverTab wardrobeButton
|
||||
.MouseLeave\connect -> mouseLeaveTab wardrobeButton
|
||||
|
||||
closeButton.MouseButton1Click\connect closeBackpack
|
||||
|
||||
screen.Changed\connect (prop) ->
|
||||
if prop == "AbsoluteSize"
|
||||
resizeEvent\Fire screen.AbsoluteSize
|
||||
|
||||
|
||||
-- GuiService key setup
|
||||
with game\GetService "GuiService"
|
||||
\AddKey tilde
|
||||
\AddKey backquote
|
||||
.KeyPressed\connect (key) ->
|
||||
return if not active or disabledByDeveloper
|
||||
|
||||
if key == tilde or key == backquote
|
||||
toggleBackpack!
|
||||
|
||||
|
||||
backpackButton.MouseButton1Click\connect ->
|
||||
return if not active or disabledByDeveloper
|
||||
|
||||
toggleBackpack!
|
||||
|
||||
if game.Players.LocalPlayer["Character"]
|
||||
activateBackpack!
|
||||
|
||||
|
||||
game.Players.LocalPlayer.CharacterAdded\connect activateBackpack
|
||||
|
||||
-- search functions
|
||||
searchBox.FocusLost\connect (enterPressed) ->
|
||||
if enterPressed or searchBox.Text ~= ""
|
||||
doSearch!
|
||||
elseif searchBox.Text == ""
|
||||
resetSearch!
|
||||
|
||||
|
||||
searchButton.MouseButton1Click\connect doSearch
|
||||
resetButton.MouseButton1Click\connect resetSearch
|
||||
|
||||
if searchFrame and robloxGui.AbsoluteSize.Y <= 320
|
||||
searchFrame.RobloxLocked = false
|
||||
searchFrame\Destroy!
|
||||
1690
yue/97188756.yue
1690
yue/97188756.yue
File diff suppressed because it is too large
Load Diff
221
yue/host.yue
221
yue/host.yue
|
|
@ -1,221 +0,0 @@
|
|||
print "[Mercury]: Loaded Host corescript"
|
||||
-- Start Game Script Arguments
|
||||
local placeId, sleeptime, access, url, killID, deathID, timeout, injectScriptAssetID, servicesUrl, libraryRegistrationScriptAssetID
|
||||
|
||||
-- StartGame --
|
||||
try
|
||||
game\GetService"ScriptContext"\AddStarterScript injectScriptAssetID
|
||||
|
||||
game\GetService"RunService"\Run!
|
||||
|
||||
-- REQUIRES: StartGanmeSharedArgs.txt
|
||||
-- REQUIRES: MonitorGameStatus.txt
|
||||
|
||||
------------------- UTILITY FUNCTIONS --------------------------
|
||||
|
||||
waitForChild = (parent, childName) ->
|
||||
while true
|
||||
child = parent\findFirstChild childName
|
||||
if child
|
||||
return child
|
||||
|
||||
parent.ChildAdded\wait!
|
||||
|
||||
|
||||
-- returns the player object that killed this humanoid
|
||||
-- returns nil if the killer is no longer in the game
|
||||
getKillerOfHumanoidIfStillInGame = (humanoid) ->
|
||||
-- check for kill tag on humanoid - may be more than one - todo: deal with this
|
||||
tag = humanoid\findFirstChild "creator"
|
||||
|
||||
-- find player with name on tag
|
||||
if tag and tag.Value.Parent -- killer still in game
|
||||
return tag.Value
|
||||
|
||||
|
||||
-- send kill and death stats when a player dies
|
||||
onDied = (victim, humanoid) ->
|
||||
killer = getKillerOfHumanoidIfStillInGame humanoid
|
||||
victorId = 0
|
||||
if killer
|
||||
victorId = killer.userId
|
||||
print "STAT: kill by #{victorId} of #{victim.userId}"
|
||||
game\HttpGet "#{url}/Game/Knockouts.ashx?UserID=#{victorId}&#{access}"
|
||||
|
||||
print "STAT: death of #{victim.userId} by #{victorId}"
|
||||
game\HttpGet "#{url}/Game/Wipeouts.ashx?UserID=#{victim.userId}&#{access}"
|
||||
|
||||
|
||||
-----------------------------------END UTILITY FUNCTIONS -------------------------
|
||||
|
||||
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
|
||||
|
||||
try
|
||||
settings!.Network.UseInstancePacketCache = true
|
||||
|
||||
try
|
||||
settings!.Network.UsePhysicsPacketCache = true
|
||||
|
||||
--try settings!["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.FIFO end)
|
||||
try
|
||||
settings!["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError
|
||||
|
||||
|
||||
--settings!.Network.PhysicsSend = 1 -- 1==RoundRobin
|
||||
settings!.Network.PhysicsSend = Enum.PhysicsSendMethod.ErrorComputation2
|
||||
settings!.Network.ExperimentalPhysicsEnabled = true
|
||||
settings!.Network.WaitingForCharacterLogRate = 100
|
||||
try
|
||||
settings!.Diagnostics\LegacyScriptMode!
|
||||
|
||||
|
||||
-----------------------------------START GAME SHARED SCRIPT------------------------------
|
||||
|
||||
url = "_BASE_URL"
|
||||
-- assetId = placeId -- might be able to remove this now
|
||||
|
||||
scriptContext = game\GetService "ScriptContext"
|
||||
try
|
||||
scriptContext\AddStarterScript libraryRegistrationScriptAssetID
|
||||
|
||||
scriptContext.ScriptsDisabled = true
|
||||
|
||||
-- game\SetPlaceID nil, false
|
||||
game\GetService"ChangeHistoryService"\SetEnabled false
|
||||
|
||||
-- establish this peer as the Server
|
||||
ns = game\GetService "NetworkServer"
|
||||
|
||||
if url?
|
||||
try
|
||||
game\GetService"Players"\SetAbuseReportUrl "#{url}/Report/Games.ashx"
|
||||
|
||||
try
|
||||
game\GetService"ScriptInformationProvider"\SetAssetUrl "#{url}/Asset/"
|
||||
|
||||
try
|
||||
game\GetService"ContentProvider"\SetBaseUrl "#{url}/"
|
||||
|
||||
-- try
|
||||
-- game\GetService"Players"\SetChatFilterUrl url .. "/Game/ChatFilter.ashx"
|
||||
|
||||
-- game\GetService"BadgeService"\SetPlaceId placeId
|
||||
if access?
|
||||
with game\GetService "BadgeService"
|
||||
\SetAwardBadgeUrl "#{url}/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&#{access}"
|
||||
\SetHasBadgeUrl "#{url}/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&#{access}"
|
||||
\SetIsBadgeDisabledUrl "#{url}/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&#{access}"
|
||||
|
||||
with game\GetService "FriendService"
|
||||
\SetMakeFriendUrl "#{servicesUrl}/Friend/CreateFriend?firstUserId=%d&secondUserId=%d&#{access}"
|
||||
\SetBreakFriendUrl "#{servicesUrl}/Friend/BreakFriend?firstUserId=%d&secondUserId=%d&#{access}"
|
||||
\SetGetFriendsUrl "#{servicesUrl}/Friend/AreFriends?userId=%d&#{access}"
|
||||
|
||||
game\GetService"BadgeService"\SetIsBadgeLegalUrl ""
|
||||
|
||||
with game\GetService "InsertService"
|
||||
\SetBaseSetsUrl "#{url}/game/tools/insertasset?nsets=10&type=base"
|
||||
\SetUserSetsUrl "#{url}/game/tools/insertasset?nsets=20&type=user&userid=%d"
|
||||
\SetCollectionUrl "#{url}/game/tools/insertasset?sid=%d"
|
||||
\SetAssetUrl "#{url}/Asset/?id=%d"
|
||||
\SetAssetVersionUrl "#{url}/Asset/?assetversionid=%d"
|
||||
|
||||
try
|
||||
loadfile"#{url}/Game/LoadPlaceInfo.ashx?PlaceId=#{placeId}"!
|
||||
|
||||
try
|
||||
if access
|
||||
loadfile"#{url}/Game/PlaceSpecificScript.ashx?PlaceId=#{placeId}&#{access}"!
|
||||
|
||||
|
||||
try
|
||||
game\GetService"NetworkServer"\SetIsPlayerAuthenticationRequired true
|
||||
|
||||
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? and killID? and deathID? and url?
|
||||
-- listen for the death of a Player
|
||||
createDeathMonitor = (player) ->
|
||||
-- we don't need to clean up old monitors or connections since the Character will be destroyed soon
|
||||
if player.Character
|
||||
humanoid = waitForChild player.Character, "Humanoid"
|
||||
humanoid.Died\connect ->
|
||||
onDied player, humanoid
|
||||
|
||||
|
||||
-- listen to all Players' Characters
|
||||
game\GetService"Players".ChildAdded\connect (player) ->
|
||||
createDeathMonitor player
|
||||
player.Changed\connect (property) ->
|
||||
if property == "Character"
|
||||
createDeathMonitor player
|
||||
|
||||
|
||||
game\GetService"Players".PlayerAdded\connect (player) ->
|
||||
print "Player #{player.userId} added"
|
||||
|
||||
if url and access and placeId and player and player.userId
|
||||
game\HttpGet(
|
||||
"#{url}/Game/ClientPresence.ashx?action=connect&#{access}" ..
|
||||
"&PlaceID=#{placeId}" ..
|
||||
"&UserID=#{player.userId}"
|
||||
)
|
||||
game\HttpGet "#{url}/Game/PlaceVisit.ashx?UserID=#{player.userId}&AssociatedPlaceID=#{placeId}&#{access}"
|
||||
|
||||
|
||||
game\GetService"Players".PlayerRemoving\connect (player) ->
|
||||
print "Player #{player.userId} leaving"
|
||||
|
||||
if url and access and placeId and player and player.userId
|
||||
game\HttpGet(
|
||||
"#{url}/Game/ClientPresence.ashx?action=disconnect&" ..
|
||||
"#{access}&PlaceID=#{placeId}"..
|
||||
"&UserID=#{player.userId}"
|
||||
)
|
||||
|
||||
|
||||
if placeId? and url?
|
||||
-- yield so that file load happens in the heartbeat thread
|
||||
wait!
|
||||
|
||||
-- load the game
|
||||
game\Load "#{url}/asset/?id=#{placeId}"
|
||||
|
||||
|
||||
if _MAP_LOCATION_EXISTS
|
||||
-- yield so that file load happens in the heartbeat thread
|
||||
wait!
|
||||
|
||||
-- load the game
|
||||
game\Load "_MAP_LOCATION"
|
||||
|
||||
|
||||
-- Now start the connection
|
||||
ns\Start _SERVER_PORT, sleeptime
|
||||
|
||||
game\GetService"Visit"\SetPing "_SERVER_PRESENCE_URL", 30
|
||||
|
||||
if timeout
|
||||
scriptContext\SetTimeout timeout
|
||||
|
||||
scriptContext.ScriptsDisabled = false
|
||||
|
||||
--delay(1, function!
|
||||
-- loadfile(url .. "/analytics/GamePerfMonitor.ashx")(game.JobId, placeId)
|
||||
--end)
|
||||
|
||||
reset = ";mc"
|
||||
game.Players.PlayerAdded\connect (player) ->
|
||||
player.Chatted\connect (msg) ->
|
||||
if msg == reset
|
||||
if player.Character
|
||||
player.Character.Humanoid.Health = 0
|
||||
|
||||
|
||||
------------------------------END START GAME SHARED SCRIPT--------------------------
|
||||
269
yue/join.yue
269
yue/join.yue
|
|
@ -1,269 +0,0 @@
|
|||
print "[Mercury]: Loaded Join corescript"
|
||||
import "macros" as { $ }
|
||||
|
||||
-- functions --------------------------
|
||||
-- onPlayerAdded = (player) ->
|
||||
-- -- override
|
||||
|
||||
$lua[[-- MultiplayerSharedScript.lua inserted here ------ Prepended to Join.lua --]]
|
||||
|
||||
try
|
||||
game\SetPlaceID _PLACE_ID, false
|
||||
|
||||
|
||||
-- if we are on a touch device, no blocking http calls allowed! This can cause a crash on iOS
|
||||
-- In general we need a long term strategy to remove blocking http calls from all platforms
|
||||
isTouchDevice = Game\GetService"UserInputService".TouchEnabled
|
||||
|
||||
settings!["Game Options"].CollisionSoundEnabled = true
|
||||
try
|
||||
settings!.Rendering.EnableFRM = true
|
||||
try
|
||||
settings!.Physics.Is30FpsThrottleEnabled = false
|
||||
try
|
||||
settings!["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError
|
||||
try
|
||||
settings!.Physics.PhysicsEnvironmentalThrottle = Enum.EnviromentalPhysicsThrottle.DefaultAuto
|
||||
|
||||
|
||||
-- arguments ---------------------------------------
|
||||
threadSleepTime = ...
|
||||
|
||||
if threadSleepTime == nil
|
||||
threadSleepTime = 15
|
||||
|
||||
|
||||
test = _IS_STUDIO_JOIN
|
||||
|
||||
print "! Joining game '_PLACE_ID' place _PLACE_ID at _SERVER_ADDRESS"
|
||||
|
||||
game\GetService"ChangeHistoryService"\SetEnabled false
|
||||
game\GetService"ContentProvider"\SetThreadPool 16
|
||||
|
||||
with game\GetService "InsertService"
|
||||
\SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base"
|
||||
\SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d"
|
||||
\SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d"
|
||||
\SetAssetUrl "http://banland.xyz/Asset/?id=%d"
|
||||
\SetAssetVersionUrl "http://banland.xyz/asset/?assetversionid=%d"
|
||||
|
||||
with game\GetService "SocialService"
|
||||
try
|
||||
\SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d"
|
||||
try
|
||||
\SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d"
|
||||
try
|
||||
\SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d"
|
||||
try
|
||||
\SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d"
|
||||
try
|
||||
\SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d"
|
||||
|
||||
try
|
||||
game\GetService"GamePassService"\SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d"
|
||||
try
|
||||
game\GetService"MarketplaceService"\SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d"
|
||||
try
|
||||
game\GetService"MarketplaceService"\SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d"
|
||||
try
|
||||
game\SetCreatorID _CREATOR_ID, Enum.CreatorType.User
|
||||
|
||||
-- Bubble chat. This is all-encapsulated to allow us to turn it off with a config setting
|
||||
try
|
||||
game\GetService"Players"\SetChatStyle Enum.ChatStyle.ClassicAndBubble
|
||||
|
||||
|
||||
waitingForCharacter = false
|
||||
try
|
||||
if settings!.Network.MtuOverride == 0
|
||||
settings!.Network.MtuOverride = 1400
|
||||
|
||||
|
||||
-- globals -----------------------------------------
|
||||
|
||||
global client = game\GetService "NetworkClient"
|
||||
global visit = game\GetService "Visit"
|
||||
|
||||
-- functions ---------------------------------------
|
||||
global setMessage = (message) ->
|
||||
-- todo: animated "..."
|
||||
game\SetMessage if not false
|
||||
message
|
||||
else
|
||||
-- hack, good enought for now
|
||||
"Teleporting ..."
|
||||
|
||||
|
||||
global showErrorWindow = (message, _, _) ->
|
||||
game\SetMessage message
|
||||
|
||||
|
||||
global reportError = (err, message) ->
|
||||
print "***ERROR*** #{err}"
|
||||
if not test
|
||||
visit\SetUploadUrl ""
|
||||
|
||||
client\disconnect!
|
||||
wait 4
|
||||
showErrorWindow "Error: #{err}", message, "Other"
|
||||
|
||||
|
||||
-- called when the client connection closes
|
||||
global onDisconnection = (_, lostConnection) ->
|
||||
if lostConnection
|
||||
showErrorWindow "You have lost the connection to the game", "LostConnection", "LostConnection"
|
||||
else
|
||||
showErrorWindow "This game has shut down", "Kick", "Kick"
|
||||
|
||||
|
||||
global requestCharacter = (replicator) ->
|
||||
-- prepare code for when the Character appears
|
||||
local connection
|
||||
connection = player.Changed\connect (property) ->
|
||||
if property == "Character"
|
||||
game\ClearMessage!
|
||||
waitingForCharacter = false
|
||||
connection\disconnect!
|
||||
|
||||
|
||||
setMessage "Requesting character"
|
||||
|
||||
success, err = try
|
||||
replicator\RequestCharacter!
|
||||
setMessage "Waiting for character"
|
||||
waitingForCharacter = true
|
||||
|
||||
|
||||
if not success
|
||||
reportError err, "W4C"
|
||||
return
|
||||
|
||||
|
||||
-- called when the client connection is established
|
||||
global onConnectionAccepted = (url, replicator) ->
|
||||
connectResolved = true
|
||||
|
||||
waitingForMarker = true
|
||||
|
||||
success, err = try
|
||||
if not test
|
||||
visit\SetPing "_PING_URL", 30
|
||||
|
||||
|
||||
if not false
|
||||
game\SetMessageBrickCount!
|
||||
else
|
||||
setMessage "Teleporting ..."
|
||||
|
||||
|
||||
replicator.Disconnection\connect onDisconnection
|
||||
|
||||
-- Wait for a marker to return before creating the Player
|
||||
marker = replicator\SendMarker!
|
||||
|
||||
marker.Received\connect ->
|
||||
waitingForMarker = false
|
||||
requestCharacter replicator
|
||||
|
||||
|
||||
if not success
|
||||
reportError err, "ConnectionAccepted"
|
||||
return
|
||||
|
||||
|
||||
-- TODO: report marker progress
|
||||
|
||||
while waitingForMarker
|
||||
workspace\ZoomToExtents!
|
||||
wait 0.5
|
||||
|
||||
|
||||
-- called when the client connection fails
|
||||
global onConnectionFailed = (_, err) ->
|
||||
showErrorWindow "Failed to connect to the Game. (ID=#{err})", "ID#{err}", "Other"
|
||||
|
||||
|
||||
-- called when the client connection is rejected
|
||||
global onConnectionRejected = ->
|
||||
connectionFailed\disconnect!
|
||||
showErrorWindow "This game is not available. Please try another", "WrongVersion", "WrongVersion"
|
||||
|
||||
|
||||
idled = false
|
||||
global onPlayerIdled = (time) ->
|
||||
if time > 20 * 60
|
||||
showErrorWindow string.format("You were disconnected for being idle %d minutes", time / 60), "Idle", "Idle"
|
||||
client\disconnect!
|
||||
if not idled
|
||||
idled = true
|
||||
|
||||
|
||||
-- main ------------------------------------------------------------
|
||||
|
||||
try
|
||||
settings!.Diagnostics\LegacyScriptMode!
|
||||
|
||||
success, err = try
|
||||
game\SetRemoteBuildMode true
|
||||
|
||||
setMessage "Connecting to Server"
|
||||
client.ConnectionAccepted\connect onConnectionAccepted
|
||||
client.ConnectionRejected\connect onConnectionRejected
|
||||
global connectionFailed = client.ConnectionFailed\connect onConnectionFailed
|
||||
client.Ticket = ""
|
||||
|
||||
global playerConnectSucces, player = try
|
||||
client\PlayerConnect _USER_ID, "_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime
|
||||
|
||||
if not playerConnectSucces
|
||||
--Old player connection scheme
|
||||
player = game\GetService"Players"\CreateLocalPlayer _USER_ID
|
||||
client\Connect "_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime
|
||||
|
||||
|
||||
-- negotiate an auth token
|
||||
if not test
|
||||
delay 300, ->
|
||||
while false
|
||||
try
|
||||
game\HttpPost "https://banland.xyz/auth/renew", "renew"
|
||||
|
||||
wait 300
|
||||
|
||||
with player
|
||||
\SetSuperSafeChat false
|
||||
try
|
||||
\SetUnder13 false
|
||||
try
|
||||
\SetMembershipType Enum.MembershipType._MEMBERSHIP_TYPE
|
||||
try
|
||||
\SetAccountAge 1
|
||||
|
||||
player.Idled\connect onPlayerIdled
|
||||
|
||||
-- Overriden
|
||||
-- onPlayerAdded player
|
||||
|
||||
try
|
||||
player.Name = [========[_USER_NAME]========]
|
||||
|
||||
player.CharacterAppearance = "_CHAR_APPEARANCE"
|
||||
if not test
|
||||
visit\SetUploadUrl ""
|
||||
|
||||
|
||||
if not success
|
||||
reportError err, "CreatePlayer"
|
||||
|
||||
|
||||
if not test
|
||||
-- TODO: Async get?
|
||||
loadfile""("", -1, 0)
|
||||
|
||||
|
||||
try
|
||||
game\SetScreenshotInfo ""
|
||||
try
|
||||
game\SetVideoInfo '<?xml version="1.0"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"><media:group><media:title type="plain"><![CDATA[ROBLOX Place]]></media:title><media:description type="plain"><![CDATA[ For more games visit http://banland.xyz]]></media:description><media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Games</media:category><media:keywords>ROBLOX, video, free game, online virtual world</media:keywords></media:group></entry>'
|
||||
|
||||
-- use single quotes here because the video info string may have unescaped double quotes
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
export macro load = (file) ->
|
||||
"print \"[Mercury]: Loaded corescript #{file\sub 8, -6}\""
|
||||
|
||||
export macro lua = (code) -> :code, type: "lua"
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
print "[Mercury]: Loaded Studio corescript"
|
||||
-- Setup studio cmd bar & load core scripts
|
||||
|
||||
with game\GetService "InsertService"
|
||||
try
|
||||
\SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d"
|
||||
try
|
||||
\SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d"
|
||||
|
||||
game\GetService"ScriptInformationProvider"\SetAssetUrl "http://banland.xyz/Asset/"
|
||||
\SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base"
|
||||
\SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d"
|
||||
\SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d"
|
||||
\SetAssetUrl "http://banland.xyz/Asset/?id=%d"
|
||||
\SetAssetVersionUrl "http://banland.xyz/asset/?assetversionid=%d"
|
||||
\SetTrustLevel 0
|
||||
|
||||
with game\GetService "SocialService"
|
||||
try
|
||||
\SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d"
|
||||
try
|
||||
\SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d"
|
||||
try
|
||||
\SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d"
|
||||
try
|
||||
\SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d"
|
||||
try
|
||||
\SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d"
|
||||
|
||||
try
|
||||
game\GetService"GamePassService"\SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d"
|
||||
|
||||
with game\GetService "MarketplaceService"
|
||||
try
|
||||
\SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d"
|
||||
try
|
||||
\SetDevProductInfoUrl "https://banland.xyz/marketplace/productDetails?productId=%d"
|
||||
try
|
||||
\SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d"
|
||||
|
||||
|
||||
result, _ = try
|
||||
game\GetService"ScriptContext"\AddStarterScript 37801172
|
||||
|
||||
if not result
|
||||
try
|
||||
game\GetService"ScriptContext"\AddCoreScript 37801172, game\GetService "ScriptContext", "StarterScript"
|
||||
|
||||
|
||||
147
yue/visit.yue
147
yue/visit.yue
|
|
@ -1,147 +0,0 @@
|
|||
print "[Mercury]: Loaded Visit corescript"
|
||||
-- Prepended to Edit.lua and Visit.lua and Studio.lua and PlaySolo.lua--
|
||||
|
||||
if true
|
||||
try
|
||||
game\SetPlaceID _PLACE_ID
|
||||
-- else
|
||||
-- if false
|
||||
-- try
|
||||
-- game\SetPlaceID _PLACE_ID
|
||||
|
||||
visit = game\GetService "Visit"
|
||||
|
||||
message = Instance.new "Message"
|
||||
message.Parent = workspace
|
||||
message.archivable = false
|
||||
|
||||
game\GetService"ScriptInformationProvider"\SetAssetUrl "http://banland.xyz/Asset/"
|
||||
game\GetService"ContentProvider"\SetThreadPool 16
|
||||
try
|
||||
game\GetService"InsertService"\SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d"
|
||||
-- Used for free model search (insert tool)
|
||||
try
|
||||
game\GetService"InsertService"\SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d"
|
||||
-- Used for free decal search (insert tool)
|
||||
|
||||
settings!.Diagnostics\LegacyScriptMode!
|
||||
|
||||
with game\GetService "InsertService"
|
||||
\SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base"
|
||||
\SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d"
|
||||
\SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d"
|
||||
\SetAssetUrl "http://banland.xyz/Asset/?id=%d"
|
||||
\SetAssetVersionUrl "http://banland.xyz/asset/?assetversionid=%d"
|
||||
|
||||
with game\GetService "SocialService"
|
||||
try
|
||||
\SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d"
|
||||
try
|
||||
\SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d"
|
||||
try
|
||||
\SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d"
|
||||
try
|
||||
\SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d"
|
||||
try
|
||||
\SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d"
|
||||
|
||||
try
|
||||
game\GetService"GamePassService"\SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d"
|
||||
try
|
||||
game\SetCreatorID 0, Enum.CreatorType.User
|
||||
try
|
||||
game\SetScreenshotInfo ""
|
||||
try
|
||||
game\SetVideoInfo ""
|
||||
|
||||
try
|
||||
settings!.Rendering.EnableFRM = true
|
||||
try
|
||||
settings!["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError
|
||||
|
||||
|
||||
game\GetService"ChangeHistoryService"\SetEnabled false
|
||||
try
|
||||
game\GetService"Players"\SetBuildUserPermissionsUrl "http://banland.xyz/Game/BuildActionPermissionCheck.ashx?assetId=0&userId=%d&isSolo=true"
|
||||
|
||||
|
||||
workspace\SetPhysicsThrottleEnabled true
|
||||
|
||||
addedBuildTools = false
|
||||
screenGui = game\GetService"CoreGui"\FindFirstChild "RobloxGui"
|
||||
|
||||
doVisit = ->
|
||||
message.Text = "Loading Game"
|
||||
if false
|
||||
game\Load ""
|
||||
try
|
||||
visit\SetUploadUrl ""
|
||||
else
|
||||
try
|
||||
visit\SetUploadUrl ""
|
||||
|
||||
|
||||
message.Text = "Running"
|
||||
game\GetService"RunService"\Run!
|
||||
|
||||
message.Text = "Creating Player"
|
||||
if false
|
||||
global player = game\GetService"Players"\CreateLocalPlayer 1
|
||||
player.Name = [====[Guest _GUEST_NUMBER]====]
|
||||
else
|
||||
global player = game\GetService"Players"\CreateLocalPlayer 0
|
||||
|
||||
player.CharacterAppearance = ""
|
||||
propExists = canAutoLoadChar = false
|
||||
propExists = try
|
||||
canAutoLoadChar = game.Players.CharacterAutoLoads
|
||||
|
||||
|
||||
if (propExists and canAutoLoadChar) or not propExists
|
||||
player\LoadCharacter!
|
||||
|
||||
|
||||
message.Text = "Setting GUI"
|
||||
player\SetSuperSafeChat true
|
||||
try
|
||||
player\SetMembershipType Enum.MembershipType.None
|
||||
try
|
||||
player\SetAccountAge 0
|
||||
|
||||
|
||||
if false
|
||||
message.Text = "Setting Ping"
|
||||
visit\SetPing "http://banland.xyz/game/clientpresence?version=old&PlaceID=_PLACE_ID", 300
|
||||
|
||||
message.Text = "Sending Stats"
|
||||
game\HttpGet ""
|
||||
|
||||
|
||||
success, err = pcall doVisit
|
||||
|
||||
if not addedBuildTools
|
||||
with Instance.new "StringValue"
|
||||
.Name = "PlayerName"
|
||||
.Value = player.Name
|
||||
.RobloxLocked = true
|
||||
.Parent = screenGui
|
||||
|
||||
try
|
||||
game\GetService"ScriptContext"\AddCoreScript 59431535, screenGui, "BuildToolsScript"
|
||||
|
||||
addedBuildTools = true
|
||||
|
||||
|
||||
if success
|
||||
message.Parent = nil
|
||||
else
|
||||
print err
|
||||
if false
|
||||
try
|
||||
visit\SetUploadUrl ""
|
||||
|
||||
|
||||
wait 5
|
||||
message.Text = "Error on visit: #{err}"
|
||||
if false
|
||||
game\HttpPost "http://banland.xyz/Error/Lua.ashx?", "Visit.lua: #{err}"
|
||||
Loading…
Reference in New Issue