Add esc+r/l hotkeys in settings menu, remove unused corescripts, other corescript formatting improvements
This commit is contained in:
parent
717e87254b
commit
6f48e7f584
|
|
@ -7309,7 +7309,6 @@ declare class ServiceProvider extends Instance
|
|||
LoadingGuiService: any
|
||||
ScriptInformationProvider: ScriptInformationProvider
|
||||
JointsService: JointsService
|
||||
LogService: any
|
||||
ThumbnailGenerator: ThumbnailGenerator
|
||||
|
||||
function FindService(self, className: string): Instance
|
||||
|
|
@ -7487,7 +7486,6 @@ declare class ServiceProvider extends Instance
|
|||
function GetService(self, service: "LoadingGuiService"): any
|
||||
function GetService(self, service: "PersonalServerService"): PersonalServerService
|
||||
function GetService(self, service: "Terrain"): Terrain
|
||||
function GetService(self, service: "LogService"): any
|
||||
function GetService(self, service: "ThumbnailGenerator"): ThumbnailGenerator
|
||||
end
|
||||
|
||||
|
|
|
|||
1035
luau/157877000.luau
1035
luau/157877000.luau
File diff suppressed because it is too large
Load Diff
|
|
@ -1,272 +0,0 @@
|
|||
-- Unused by Mercury
|
||||
print "[Mercury]: Loaded corescript 38037565"
|
||||
for _ = 1, 8 do
|
||||
print "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS"
|
||||
end
|
||||
|
||||
local damageGuiWidth = 5
|
||||
local damageGuiHeight = 5
|
||||
|
||||
local 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
|
||||
|
||||
local 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"
|
||||
|
||||
local function billboardHealthChange(dmg)
|
||||
local textLabel = Instance.new "TextLabel"
|
||||
textLabel.TextColor3 = dmg > 0 and Color3.new(0, 1, 0)
|
||||
or Color3.new(1, 0, 1)
|
||||
textLabel.Text = tostring(dmg)
|
||||
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
|
||||
|
||||
local 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
|
||||
|
|
@ -312,13 +312,11 @@ local function setDisabledState(guiObject)
|
|||
elseif guiObject:IsA "TextButton" then
|
||||
guiObject.TextTransparency = 0.9
|
||||
guiObject.Active = false
|
||||
else
|
||||
if guiObject.ClassName then
|
||||
print(
|
||||
"setDisabledState() got object of unsupported type. object type is ",
|
||||
guiObject.ClassName
|
||||
)
|
||||
end
|
||||
elseif guiObject.ClassName then
|
||||
print(
|
||||
"setDisabledState() got object of unsupported type. object type is ",
|
||||
guiObject.ClassName
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1369,20 +1367,13 @@ local function createGameSettingsMenu(baseZIndex, _)
|
|||
if hasGraphicsSlider then
|
||||
UserSettings().GameSettings.FullscreenChanged:connect(
|
||||
function(isFullscreen)
|
||||
if isFullscreen then
|
||||
fullscreenCheckbox.Text = "X"
|
||||
else
|
||||
fullscreenCheckbox.Text = ""
|
||||
end
|
||||
fullscreenCheckbox.Text = isFullscreen and "X" or ""
|
||||
end
|
||||
)
|
||||
else
|
||||
fullscreenCheckbox.MouseButton1Click:connect(function()
|
||||
if fullscreenCheckbox.Text == "" then
|
||||
fullscreenCheckbox.Text = "X"
|
||||
else
|
||||
fullscreenCheckbox.Text = ""
|
||||
end
|
||||
fullscreenCheckbox.Text = fullscreenCheckbox.Text == "" and "X"
|
||||
or ""
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -1535,6 +1526,9 @@ end
|
|||
|
||||
RbxGui = LoadLibrary "RbxGui"
|
||||
|
||||
GuiService:AddKey "l"
|
||||
GuiService:AddKey "r"
|
||||
|
||||
local baseZIndex = 0
|
||||
if UserSettings then
|
||||
local createSettingsDialog = function()
|
||||
|
|
@ -1657,82 +1651,109 @@ if UserSettings then
|
|||
end)
|
||||
end
|
||||
|
||||
gameMainMenu.ResetButton.MouseButton1Click:connect(function()
|
||||
local function confirmReset()
|
||||
goToMenu(
|
||||
settingsFrame,
|
||||
"ResetConfirmationMenu",
|
||||
"up",
|
||||
UDim2.new(0, 525, 0, 370)
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
gameMainMenu.LeaveGameButton.MouseButton1Click:connect(function()
|
||||
local function confirmLeave()
|
||||
goToMenu(
|
||||
settingsFrame,
|
||||
"LeaveConfirmationMenu",
|
||||
"down",
|
||||
UDim2.new(0, 525, 0, 300)
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
local hotkeysConn
|
||||
local function leaveResetHotkeys(key) -- esc, r, not enter (unfortunately)
|
||||
if hotkeysConn then
|
||||
hotkeysConn:disconnect()
|
||||
end
|
||||
if key == "r" then
|
||||
confirmReset()
|
||||
elseif key == "l" then
|
||||
confirmLeave()
|
||||
end
|
||||
end
|
||||
|
||||
local function showFunction()
|
||||
settingsButton.Active = false
|
||||
updateCameraDropDownSelection(
|
||||
UserSettings().GameSettings.ControlMode.Name
|
||||
)
|
||||
|
||||
if syncVideoCaptureSetting then
|
||||
syncVideoCaptureSetting()
|
||||
end
|
||||
|
||||
goToMenu(
|
||||
settingsFrame,
|
||||
"GameMainMenu",
|
||||
"right",
|
||||
UDim2.new(0, 525, 0, 430)
|
||||
)
|
||||
shield.Visible = true
|
||||
shield.Active = true
|
||||
settingsFrame.Parent:TweenPosition(
|
||||
UDim2.new(0.5, -262, 0.5, -200),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
settingsFrame.Parent:TweenSize(
|
||||
UDim2.new(0, 525, 0, 430),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local function hideFunction()
|
||||
settingsFrame.Parent:TweenPosition(
|
||||
UDim2.new(0.5, -262, -0.5, -200),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
settingsFrame.Parent:TweenSize(
|
||||
UDim2.new(0, 525, 0, 430),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
shield.Visible = false
|
||||
settingsButton.Active = true
|
||||
end
|
||||
|
||||
gameMainMenu.ResetButton.MouseButton1Click:connect(confirmReset)
|
||||
gameMainMenu.LeaveGameButton.MouseButton1Click:connect(confirmLeave)
|
||||
|
||||
GuiService.EscapeKeyPressed:connect(function()
|
||||
if hotkeysConn then
|
||||
hotkeysConn:disconnect()
|
||||
end
|
||||
-- Prevent mysterious missing settings menu bugs
|
||||
delay(tweenTime, function()
|
||||
if hotkeysConn then
|
||||
hotkeysConn:disconnect()
|
||||
end
|
||||
hotkeysConn = GuiService.KeyPressed:connect(leaveResetHotkeys)
|
||||
end)
|
||||
if currentMenuSelection == nil then
|
||||
game.GuiService:AddCenterDialog(
|
||||
shield,
|
||||
Enum.CenterDialogType.ModalDialog,
|
||||
--showFunction
|
||||
function()
|
||||
settingsButton.Active = false
|
||||
updateCameraDropDownSelection(
|
||||
UserSettings().GameSettings.ControlMode.Name
|
||||
)
|
||||
|
||||
if syncVideoCaptureSetting then
|
||||
syncVideoCaptureSetting()
|
||||
end
|
||||
|
||||
goToMenu(
|
||||
settingsFrame,
|
||||
"GameMainMenu",
|
||||
"right",
|
||||
UDim2.new(0, 525, 0, 430)
|
||||
)
|
||||
shield.Visible = true
|
||||
shield.Active = true
|
||||
settingsFrame.Parent:TweenPosition(
|
||||
UDim2.new(0.5, -262, 0.5, -200),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
settingsFrame.Parent:TweenSize(
|
||||
UDim2.new(0, 525, 0, 430),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
end,
|
||||
--hideFunction
|
||||
function()
|
||||
settingsFrame.Parent:TweenPosition(
|
||||
UDim2.new(0.5, -262, -0.5, -200),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
settingsFrame.Parent:TweenSize(
|
||||
UDim2.new(0, 525, 0, 430),
|
||||
Enum.EasingDirection.InOut,
|
||||
Enum.EasingStyle.Sine,
|
||||
tweenTime,
|
||||
true
|
||||
)
|
||||
shield.Visible = false
|
||||
settingsButton.Active = true
|
||||
end
|
||||
showFunction,
|
||||
hideFunction
|
||||
)
|
||||
elseif #lastMenuSelection > 0 then
|
||||
if #centerDialogs > 0 then
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ print "[Mercury]: Loaded corescript 48488398"
|
|||
|
||||
local TeleportService = game:GetService "TeleportService"
|
||||
|
||||
function waitForProperty(instance, property)
|
||||
local function waitForProperty(instance, property)
|
||||
while not instance[property] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
function waitForChild(instance, name)
|
||||
local function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
|
|
@ -26,13 +26,31 @@ local friendRequestBlacklist = {}
|
|||
|
||||
local teleportEnabled = true
|
||||
|
||||
local makePopupInvisible = function()
|
||||
local function makePopupInvisible()
|
||||
if script.Parent.Popup then
|
||||
script.Parent.Popup.Visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function makeFriend(fromPlayer, toPlayer)
|
||||
local 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
|
||||
|
||||
local 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
|
||||
|
||||
local function makeFriend(fromPlayer, toPlayer)
|
||||
local popup = script.Parent:FindFirstChild "Popup"
|
||||
if popup == nil then
|
||||
return
|
||||
|
|
@ -145,25 +163,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
|
|||
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)
|
||||
local function showTeleportUI(message, timer)
|
||||
if teleportUI ~= nil then
|
||||
teleportUI:Remove()
|
||||
end
|
||||
|
|
@ -177,7 +177,7 @@ function showTeleportUI(message, timer)
|
|||
end
|
||||
end
|
||||
|
||||
function onTeleport(teleportState, _, _)
|
||||
local function onTeleport(teleportState)
|
||||
if TeleportService.CustomizedTeleportUI == false then
|
||||
if teleportState == Enum.TeleportState.Started then
|
||||
showTeleportUI("Teleport started...", 0)
|
||||
|
|
|
|||
|
|
@ -21,29 +21,10 @@ local function WaitForChild(parent, childName)
|
|||
return parent[childName]
|
||||
end
|
||||
|
||||
-- wtf
|
||||
-- local function typedef(obj)
|
||||
-- return obj
|
||||
-- end
|
||||
|
||||
local function IsPhone()
|
||||
local cGui = Game:GetService "CoreGui"
|
||||
local rGui = WaitForChild(cGui, "RobloxGui")
|
||||
if rGui.AbsoluteSize.Y < 600 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Users can use enough white spaces to spoof chatting as other players
|
||||
-- This function removes trailing and leading white spaces
|
||||
-- AFAIK, there is no reason for spam white spaces
|
||||
local function StringTrim(str)
|
||||
-- %S is whitespaces
|
||||
-- When we find the first non space character defined by ^%s
|
||||
-- we yank out anything in between that and the end of the string
|
||||
-- Everything else is replaced with %1 which is essentially nothing
|
||||
return (str:gsub("^%s*(.-)%s*$", "%1"))
|
||||
return rGui.AbsoluteSize.Y < 600
|
||||
end
|
||||
|
||||
while Game.Players.LocalPlayer == nil do
|
||||
|
|
@ -60,59 +41,53 @@ local Camera = Game.Workspace.CurrentCamera
|
|||
local CoreGuiService = Game:GetService "CoreGui"
|
||||
local PlayersService = Game:GetService "Players"
|
||||
local GuiService = Game:GetService "GuiService"
|
||||
local UserInputService = Game:GetService "UserInputService"
|
||||
|
||||
-- Lua Enums
|
||||
local Enums, CreateEnum
|
||||
do
|
||||
Enums = {}
|
||||
local EnumName = {} -- used as unique key for enum name
|
||||
local enum_mt = {
|
||||
__call = function(self, value)
|
||||
return self[value] or self[tonumber(value)]
|
||||
end,
|
||||
__index = {
|
||||
GetEnumItems = function(self)
|
||||
local t = {}
|
||||
for i, item in pairs(self) do
|
||||
if type(i) == "number" then
|
||||
t[#t + 1] = item
|
||||
end
|
||||
local Enums = {}
|
||||
local EnumName = {} -- used as unique key for enum name
|
||||
local enum_mt = {
|
||||
__call = function(self, value)
|
||||
return self[value] or self[tonumber(value)]
|
||||
end,
|
||||
__index = {
|
||||
GetEnumItems = function(self)
|
||||
local t = {}
|
||||
for i, item in pairs(self) do
|
||||
if type(i) == "number" then
|
||||
t[#t + 1] = item
|
||||
end
|
||||
table.sort(t, function(a, b)
|
||||
return a.Value < b.Value
|
||||
end)
|
||||
return t
|
||||
end,
|
||||
},
|
||||
__tostring = function(self)
|
||||
return `Enum.{self[EnumName]}`
|
||||
end,
|
||||
}
|
||||
local item_mt = {
|
||||
__call = function(self, value)
|
||||
return value == self or value == self.Name or value == self.Value
|
||||
end,
|
||||
__tostring = function(self)
|
||||
return `Enum.{self[EnumName]}.{self.Name}`
|
||||
end,
|
||||
}
|
||||
CreateEnum = function(enumName)
|
||||
return function(t)
|
||||
local e = { [EnumName] = enumName }
|
||||
for i, name in pairs(t) do
|
||||
local item = setmetatable(
|
||||
{ Name = name, Value = i, Enum = e, [EnumName] = enumName },
|
||||
item_mt
|
||||
)
|
||||
e[i] = item
|
||||
e[name] = item
|
||||
e[item] = item
|
||||
end
|
||||
Enums[enumName] = e
|
||||
return setmetatable(e, enum_mt)
|
||||
end
|
||||
table.sort(t, function(a, b)
|
||||
return a.Value < b.Value
|
||||
end)
|
||||
return t
|
||||
end,
|
||||
},
|
||||
__tostring = function(self)
|
||||
return `Enum.{self[EnumName]}`
|
||||
end,
|
||||
}
|
||||
local item_mt = {
|
||||
__call = function(self, value)
|
||||
return value == self or value == self.Name or value == self.Value
|
||||
end,
|
||||
__tostring = function(self)
|
||||
return `Enum.{self[EnumName]}.{self.Name}`
|
||||
end,
|
||||
}
|
||||
local function CreateEnum(enumName, t)
|
||||
local e = { [EnumName] = enumName }
|
||||
for i, name in pairs(t) do
|
||||
local item = setmetatable(
|
||||
{ Name = name, Value = i, Enum = e, [EnumName] = enumName },
|
||||
item_mt
|
||||
)
|
||||
e[i] = item
|
||||
e[name] = item
|
||||
e[item] = item
|
||||
end
|
||||
Enums[enumName] = e
|
||||
return setmetatable(e, enum_mt)
|
||||
end
|
||||
---------------------------------------------------
|
||||
------------------ Input class --------------------
|
||||
|
|
@ -183,7 +158,7 @@ local Chat = {
|
|||
Admins_List = { "taskmanager", "Heliodex", "tako" },
|
||||
|
||||
SafeChat_List = SafeChat,
|
||||
CreateEnum "SafeChat" { "Level1", "Level2", "Level3" },
|
||||
CreateEnum("SafeChat", { "Level1", "Level2", "Level3" }),
|
||||
SafeChatTree = {},
|
||||
TempSpaceLabel = nil,
|
||||
}
|
||||
|
|
@ -462,7 +437,13 @@ function Chat:CreateMessage(cPlayer, message)
|
|||
else
|
||||
pName = cPlayer.Name
|
||||
end
|
||||
message = StringTrim(message)
|
||||
-- Users can use enough white spaces to spoof chatting as other players
|
||||
-- This removes trailing and leading white spaces
|
||||
-- AFAIK, there is no reason for spam white spaces
|
||||
-- %S is whitespaces
|
||||
-- When we find the first non space character defined by ^%s we yank out anything in between that and the end of the string
|
||||
-- Everything else is replaced with %1 which is essentially nothing
|
||||
message = string.gsub(message, "^%s*(.-)%s*$", "%1")
|
||||
local pLabel
|
||||
local mLabel
|
||||
-- Our history stores upto 50 messages that is 100 textlabels
|
||||
|
|
@ -610,103 +591,6 @@ function Chat:FindButtonTree(scButton, rootList)
|
|||
return list
|
||||
end
|
||||
|
||||
function Chat:ToggleSafeChatMenu(scButton)
|
||||
local list = Chat:FindButtonTree(scButton, self.SafeChatTree)
|
||||
if list then
|
||||
for button, _ in pairs(list) do
|
||||
if button:IsA "TextButton" or button:IsA "ImageButton" then
|
||||
button.Visible = not button.Visible
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function Chat:CreateSafeChatOptions(list, rootButton)
|
||||
local text_List = {}
|
||||
local count = 0
|
||||
text_List[rootButton] = {}
|
||||
text_List[rootButton][1] = list[1]
|
||||
rootButton = rootButton or self.SafeChatButton
|
||||
for msg, _ in pairs(list) do
|
||||
if type(msg) == "string" then
|
||||
local chatText = New "TextButton" {
|
||||
Name = msg,
|
||||
Text = msg,
|
||||
Size = UDim2.new(0, 100, 0, 20),
|
||||
TextXAlignment = Enum.TextXAlignment.Center,
|
||||
TextColor3 = Color3.new(0.2, 0.1, 0.1),
|
||||
BackgroundTransparency = 0.5,
|
||||
BackgroundColor3 = Color3.new(1, 1, 1),
|
||||
Parent = self.SafeChatFrame,
|
||||
Visible = false,
|
||||
Position = UDim2.new(
|
||||
0,
|
||||
rootButton.Position.X.Scale + 105,
|
||||
0,
|
||||
rootButton.Position.Y.Scale - ((count - 3) * 100)
|
||||
),
|
||||
}
|
||||
|
||||
count += 1
|
||||
|
||||
if type(list[msg]) == "table" then
|
||||
text_List[rootButton][chatText] =
|
||||
Chat:CreateSafeChatOptions(list[msg], chatText)
|
||||
-- else
|
||||
-- --table.insert(text_List[chatText], true)
|
||||
end
|
||||
chatText.MouseEnter:connect(function()
|
||||
Chat:ToggleSafeChatMenu(chatText)
|
||||
end)
|
||||
|
||||
chatText.MouseLeave:connect(function()
|
||||
Chat:ToggleSafeChatMenu(chatText)
|
||||
end)
|
||||
|
||||
chatText.MouseButton1Click:connect(function()
|
||||
local lList = Chat:FindButtonTree(chatText)
|
||||
-- if lList then
|
||||
-- for i, v in pairs(lList) do
|
||||
-- end
|
||||
-- else
|
||||
-- end
|
||||
pcall(function()
|
||||
PlayersService:Chat(lList[1])
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
return text_List
|
||||
end
|
||||
|
||||
function Chat:CreateSafeChatGui()
|
||||
self.SafeChatFrame = New "Frame" {
|
||||
Name = "SafeChatFrame",
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
Parent = self.Gui,
|
||||
BackgroundTransparency = 1,
|
||||
|
||||
New "ImageButton" {
|
||||
Name = "SafeChatButton",
|
||||
Size = UDim2.new(0, 44, 0, 31),
|
||||
Position = UDim2.new(0, 1, 0.35, 0),
|
||||
BackgroundTransparency = 1,
|
||||
Image = "http://banland.xyz/asset/?id=97080365",
|
||||
},
|
||||
}
|
||||
|
||||
self.SafeChatButton = self.SafeChatFrame.SafeChatButton
|
||||
-- safe chat button is the root of this tree
|
||||
self.SafeChatTree[self.SafeChatButton] =
|
||||
Chat:CreateSafeChatOptions(self.SafeChat_List, self.SafeChatButton)
|
||||
|
||||
self.SafeChatButton.MouseButton1Click:connect(function()
|
||||
Chat:ToggleSafeChatMenu(self.SafeChatButton)
|
||||
end)
|
||||
end
|
||||
|
||||
function Chat:FocusOnChatBar()
|
||||
if self.ClickToChatButton then
|
||||
self.ClickToChatButton.Visible = false
|
||||
|
|
@ -719,58 +603,6 @@ function Chat:FocusOnChatBar()
|
|||
self.ChatBar:CaptureFocus()
|
||||
end
|
||||
|
||||
-- For touch devices we create a button instead
|
||||
function Chat:CreateTouchButton()
|
||||
self.ChatTouchFrame = New "Frame" {
|
||||
Name = "ChatTouchFrame",
|
||||
Size = UDim2.new(0, 128, 0, 32),
|
||||
Position = UDim2.new(0, 88, 0, 0),
|
||||
BackgroundTransparency = 1,
|
||||
Parent = self.Gui,
|
||||
|
||||
New "ImageButton" {
|
||||
Name = "ChatLabel",
|
||||
Size = UDim2.new(0, 74, 0, 28),
|
||||
Position = UDim2.new(0, 0, 0, 0),
|
||||
BackgroundTransparency = 1,
|
||||
ZIndex = 2.0,
|
||||
},
|
||||
New "ImageLabel" {
|
||||
Name = "Background",
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
Position = UDim2.new(0, 0, 0, 0),
|
||||
BackgroundTransparency = 1,
|
||||
Image = "http://banland.xyz/asset/?id=97078724",
|
||||
},
|
||||
}
|
||||
self.TapToChatLabel = self.ChatTouchFrame.ChatLabel
|
||||
self.TouchLabelBackground = self.ChatTouchFrame.Background
|
||||
|
||||
self.ChatBar = New "TextBox" {
|
||||
Name = "ChatBar",
|
||||
Size = UDim2.new(1, 0, 0.2, 0),
|
||||
Position = UDim2.new(0, 0, 0.8, 800),
|
||||
Text = "",
|
||||
ZIndex = 1,
|
||||
BackgroundTransparency = 1,
|
||||
Parent = self.Frame,
|
||||
TextXAlignment = Enum.TextXAlignment.Left,
|
||||
TextColor3 = Color3.new(1, 1, 1),
|
||||
ClearTextOnFocus = false,
|
||||
}
|
||||
|
||||
self.TapToChatLabel.MouseButton1Click:connect(function()
|
||||
self.TapToChatLabel.Visible = false
|
||||
--self.ChatBar.Visible = true
|
||||
--self.Frame.Background.Visible = true
|
||||
self.ChatBar:CaptureFocus()
|
||||
self.GotFocus = true
|
||||
if self.TouchLabelBackground then
|
||||
self.TouchLabelBackground.Visible = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Non touch devices, create the bottom chat bar
|
||||
function Chat:CreateChatBar()
|
||||
-- okay now we do
|
||||
|
|
@ -893,7 +725,6 @@ function Chat:CreateGui()
|
|||
|
||||
if forceChatGUI or Player.ChatMode == Enum.ChatMode.TextAndMenu then
|
||||
Chat:CreateChatBar()
|
||||
-- Chat:CreateSafeChatGui()
|
||||
|
||||
if self.ChatBar then
|
||||
self.ChatBar.FocusLost:connect(function(enterPressed)
|
||||
|
|
@ -965,19 +796,16 @@ function Input:Initialize()
|
|||
end
|
||||
|
||||
function Chat:FindMessageInSafeChat(message, list)
|
||||
local foundMessage = false
|
||||
for msg, _ in pairs(list) do
|
||||
if msg == message then
|
||||
if
|
||||
msg == message
|
||||
or type(list[msg]) == "table"
|
||||
and Chat:FindMessageInSafeChat(message, list[msg])
|
||||
then
|
||||
return true
|
||||
end
|
||||
if type(list[msg]) == "table" then
|
||||
foundMessage = Chat:FindMessageInSafeChat(message, list[msg])
|
||||
if foundMessage then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return foundMessage
|
||||
return false
|
||||
end
|
||||
|
||||
-- Just a wrapper around our PlayerChatted event
|
||||
|
|
@ -997,22 +825,20 @@ function Chat:PlayerChatted(...)
|
|||
end
|
||||
end
|
||||
|
||||
if PlayersService.ClassicChat then
|
||||
if
|
||||
not (
|
||||
string.sub(message, 1, 3) == "/e "
|
||||
or string.sub(message, 1, 7) == "/emote "
|
||||
)
|
||||
and (forceChatGUI or Player.ChatMode == Enum.ChatMode.TextAndMenu)
|
||||
or (Player.ChatMode == Enum.ChatMode.Menu and string.sub(
|
||||
if
|
||||
PlayersService.ClassicChat
|
||||
and (not (string.sub(message, 1, 3) == "/e " or string.sub(
|
||||
message,
|
||||
1,
|
||||
7
|
||||
) == "/emote ") and (forceChatGUI or Player.ChatMode == Enum.ChatMode.TextAndMenu) or (Player.ChatMode == Enum.ChatMode.Menu and string.sub(
|
||||
message,
|
||||
1,
|
||||
3
|
||||
) == "/sc")
|
||||
or (Chat:FindMessageInSafeChat(message, self.SafeChat_List))
|
||||
then
|
||||
Chat:UpdateChat(player, message)
|
||||
end
|
||||
) == "/sc"))
|
||||
or (Chat:FindMessageInSafeChat(message, self.SafeChat_List))
|
||||
then
|
||||
Chat:UpdateChat(player, message)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1061,11 +887,7 @@ function Chat:CoreGuiChanged(coreGuiType, enabled)
|
|||
|
||||
if self.ChatBar then
|
||||
self.ChatBar.Visible = enabled
|
||||
if enabled then
|
||||
GuiService:SetGlobalGuiInset(0, 0, 0, 20)
|
||||
else
|
||||
GuiService:SetGlobalGuiInset(0, 0, 0, 0)
|
||||
end
|
||||
GuiService:SetGlobalGuiInset(0, 0, 0, enabled and 20 or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1087,11 +909,13 @@ function Chat:Initialize()
|
|||
)
|
||||
end)
|
||||
|
||||
self.EventListener = PlayersService.PlayerChatted:connect(function(...)
|
||||
local function chatted(...)
|
||||
-- This event has 4 callback arguments
|
||||
-- Enum.PlayerChatType.All, chatPlayer, message, targetPlayer
|
||||
Chat:PlayerChatted(...)
|
||||
end)
|
||||
end
|
||||
|
||||
self.EventListener = PlayersService.PlayerChatted:connect(chatted)
|
||||
|
||||
self.MessageThread = coroutine.create(function() end)
|
||||
coroutine.resume(self.MessageThread)
|
||||
|
|
@ -1103,11 +927,7 @@ function Chat:Initialize()
|
|||
-- NOTE: PlayerAdded only fires on the server, hence ChildAdded is used here
|
||||
PlayersService.ChildAdded:connect(function()
|
||||
Chat.EventListener:disconnect()
|
||||
self.EventListener = PlayersService.PlayerChatted:connect(function(...)
|
||||
-- This event has 4 callback arguments
|
||||
-- Enum.PlayerChatType.All, chatPlayer, message, targetPlayer
|
||||
Chat:PlayerChatted(...)
|
||||
end)
|
||||
self.EventListener = PlayersService.PlayerChatted:connect(chatted)
|
||||
end)
|
||||
|
||||
Spawn(function()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
print "[Mercury]: Loaded Studio corescript"
|
||||
|
||||
local MarketplaceService = game:GetService "MarketplaceService"
|
||||
local InsertService = game:GetService "InsertService"
|
||||
local SocialService = game:GetService "SocialService"
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
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
|
||||
|
||||
|
|
@ -85,9 +84,6 @@ end)
|
|||
|
||||
workspace:SetPhysicsThrottleEnabled(true)
|
||||
|
||||
local addedBuildTools = false
|
||||
local screenGui = CoreGui:FindFirstChild "RobloxGui"
|
||||
|
||||
function doVisit()
|
||||
message.Text = "Loading Game"
|
||||
|
||||
|
|
@ -124,19 +120,6 @@ 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue