1283 lines
58 KiB
Plaintext
1283 lines
58 KiB
Plaintext
<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">
|
||
<Item class="LocalScript" referent="RBX1"><Properties><string name="Name">FishingClient</string><ProtectedString name="Source"><![CDATA[-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||
-- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда,
|
||
-- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров.
|
||
|
||
local Players = game:GetService("Players")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local RunService = game:GetService("RunService")
|
||
local TweenService = game:GetService("TweenService")
|
||
local UserInputService = game:GetService("UserInputService")
|
||
local MarketplaceService = game:GetService("MarketplaceService")
|
||
local Lighting = game:GetService("Lighting")
|
||
|
||
local player = Players.LocalPlayer
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||
|
||
---------------------------------------------------------------- стиль
|
||
|
||
local C = {
|
||
bg = Color3.fromRGB(18, 24, 40),
|
||
panel = Color3.fromRGB(30, 38, 62),
|
||
panel2 = Color3.fromRGB(44, 56, 90),
|
||
gold = Color3.fromRGB(255, 200, 70),
|
||
green = Color3.fromRGB(60, 190, 95),
|
||
blue = Color3.fromRGB(60, 135, 230),
|
||
red = Color3.fromRGB(215, 65, 65),
|
||
purple = Color3.fromRGB(150, 90, 220),
|
||
grey = Color3.fromRGB(75, 82, 102),
|
||
text = Color3.new(1, 1, 1),
|
||
muted = Color3.fromRGB(170, 180, 205),
|
||
line = Color3.fromRGB(90, 110, 165),
|
||
}
|
||
local TITLE = Enum.Font.FredokaOne
|
||
local BODY = Enum.Font.GothamBold
|
||
local BODY2 = Enum.Font.GothamMedium
|
||
local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0)
|
||
local DING = "rbxasset://sounds/electronicpingshort.wav"
|
||
|
||
---------------------------------------------------------------- помощники UI
|
||
|
||
local function new(class, props, children)
|
||
local obj = Instance.new(class)
|
||
local parent
|
||
for k, v in pairs(props or {}) do
|
||
if k == "Parent" then
|
||
parent = v
|
||
else
|
||
obj[k] = v
|
||
end
|
||
end
|
||
for _, c in ipairs(children or {}) do
|
||
c.Parent = obj
|
||
end
|
||
if parent then
|
||
obj.Parent = parent
|
||
end
|
||
return obj
|
||
end
|
||
local function corner(r)
|
||
return new("UICorner", { CornerRadius = UDim.new(0, r or 10) })
|
||
end
|
||
local function stroke(color, th, tr)
|
||
return new("UIStroke", { Color = color, Thickness = th or 2, Transparency = tr or 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border })
|
||
end
|
||
local function gradient(a, b, rot)
|
||
return new("UIGradient", { Color = ColorSequence.new(a, b), Rotation = rot or 90 })
|
||
end
|
||
local function text(props)
|
||
local d = {
|
||
BackgroundTransparency = 1, Font = BODY, TextColor3 = C.text, TextSize = 16,
|
||
TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center,
|
||
}
|
||
for k, v in pairs(props) do
|
||
d[k] = v
|
||
end
|
||
return new("TextLabel", d)
|
||
end
|
||
local function btn(props, onClick)
|
||
local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" }
|
||
for k, v in pairs(props) do
|
||
d[k] = v
|
||
end
|
||
local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) })
|
||
if onClick then
|
||
b.MouseButton1Click:Connect(onClick)
|
||
end
|
||
return b
|
||
end
|
||
local function clear(container)
|
||
for _, c in ipairs(container:GetChildren()) do
|
||
if c:IsA("GuiObject") then
|
||
c:Destroy()
|
||
end
|
||
end
|
||
end
|
||
local function fmt(n)
|
||
local s = tostring(math.floor(n))
|
||
local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse()
|
||
return (out:gsub("^ ", ""))
|
||
end
|
||
local function stars(n)
|
||
return string.rep("★", n) .. string.rep("☆", Config.RodUpgrade.maxLevel - n)
|
||
end
|
||
local function hex(c)
|
||
return "#" .. c:ToHex()
|
||
end
|
||
local function timeStr(sec)
|
||
sec = math.max(0, math.floor(sec))
|
||
return ("%d:%02d"):format(math.floor(sec / 60), sec % 60)
|
||
end
|
||
local function attrSet(name)
|
||
local set = {}
|
||
for id in string.gmatch(player:GetAttribute(name) or "", "[^,]+") do
|
||
set[id] = true
|
||
end
|
||
return set
|
||
end
|
||
local function rodLevels()
|
||
local t = {}
|
||
for id, lv in string.gmatch(player:GetAttribute("RodLevels") or "", "([^,:]+):(%d+)") do
|
||
t[id] = tonumber(lv)
|
||
end
|
||
return t
|
||
end
|
||
local function playUiSound(id, vol)
|
||
local s = Instance.new("Sound")
|
||
s.SoundId = id
|
||
s.Volume = vol or 0.5
|
||
s.Parent = workspace.CurrentCamera
|
||
s:Play()
|
||
game:GetService("Debris"):AddItem(s, 3)
|
||
end
|
||
|
||
local function viewport(parent, model, dir, zoom)
|
||
local vf = new("ViewportFrame", {
|
||
Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1,
|
||
Ambient = Color3.fromRGB(175, 175, 185), LightColor = WHITE, LightDirection = Vector3.new(-0.4, -1, -0.6),
|
||
Parent = parent,
|
||
})
|
||
model.Parent = vf
|
||
local cf, size = model:GetBoundingBox()
|
||
local cam = Instance.new("Camera")
|
||
cam.FieldOfView = 30
|
||
local dist = (size.Magnitude / 2) / math.tan(math.rad(15)) * (zoom or 0.9)
|
||
cam.CFrame = CFrame.lookAt(cf.Position + dir.Unit * dist, cf.Position)
|
||
cam.Parent = vf
|
||
vf.CurrentCamera = cam
|
||
return vf
|
||
end
|
||
local FISH_VIEW = Vector3.new(0.12, 0.15, 1)
|
||
local ROD_VIEW = Vector3.new(1, 0.1, 0.05)
|
||
local BAG_VIEW = Vector3.new(0.6, 0.25, 1)
|
||
|
||
local function silhouette(model)
|
||
for _, p in ipairs(model:GetDescendants()) do
|
||
if p:IsA("BasePart") then
|
||
p.Color = Color3.fromRGB(10, 12, 20)
|
||
p.Material = Enum.Material.SmoothPlastic
|
||
elseif p:IsA("ParticleEmitter") or p:IsA("PointLight") then
|
||
p:Destroy()
|
||
end
|
||
end
|
||
return model
|
||
end
|
||
|
||
---------------------------------------------------------------- корень
|
||
|
||
local gui = new("ScreenGui", {
|
||
Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false,
|
||
ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"),
|
||
})
|
||
|
||
---------------------------------------------------------------- HUD
|
||
|
||
local hud = new("Frame", {
|
||
Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui,
|
||
}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90),
|
||
new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) })
|
||
local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud })
|
||
local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud },
|
||
{ corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) })
|
||
local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge })
|
||
local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) })
|
||
local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) })
|
||
local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack })
|
||
local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud })
|
||
local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud })
|
||
local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud })
|
||
|
||
-- баннер события (справа сверху)
|
||
local eventBanner = new("Frame", {
|
||
Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) })
|
||
local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner })
|
||
local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner })
|
||
|
||
-- кнопки слева
|
||
local side = new("Frame", {
|
||
Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60),
|
||
BackgroundTransparency = 1, Parent = gui,
|
||
}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
|
||
local sideDots = {}
|
||
local function sideButton(order, icon, label, key, color, onClick)
|
||
local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick)
|
||
stroke(color:Lerp(BLACK, 0.45), 3).Parent = b
|
||
text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b })
|
||
text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b })
|
||
if key and not UserInputService.TouchEnabled then
|
||
local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) })
|
||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag })
|
||
end
|
||
local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) })
|
||
sideDots[label] = dot
|
||
return b
|
||
end
|
||
|
||
---------------------------------------------------------------- уведомления
|
||
|
||
local toasts = new("Frame", {
|
||
Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8),
|
||
BackgroundTransparency = 1, Parent = gui,
|
||
}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
local toastOrder = 0
|
||
local toastTimers = {}
|
||
|
||
local function notify(msg, color)
|
||
-- такое же сообщение уже на экране — не дублируем, а продлеваем его
|
||
for _, c in ipairs(toasts:GetChildren()) do
|
||
if c:IsA("Frame") and c:GetAttribute("Msg") == msg then
|
||
toastTimers[c] = (toastTimers[c] or 0) + 1
|
||
local my = toastTimers[c]
|
||
task.delay(3.2, function()
|
||
if c.Parent and toastTimers[c] == my then
|
||
c:Destroy()
|
||
end
|
||
end)
|
||
return
|
||
end
|
||
end
|
||
toastOrder += 1
|
||
local items = {}
|
||
for _, c in ipairs(toasts:GetChildren()) do
|
||
if c:IsA("Frame") then
|
||
table.insert(items, c)
|
||
end
|
||
end
|
||
if #items >= 3 then
|
||
items[1]:Destroy()
|
||
end
|
||
local t = new("Frame", {
|
||
Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg,
|
||
BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts,
|
||
}, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) })
|
||
local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t })
|
||
t:SetAttribute("Msg", msg)
|
||
toastTimers[t] = 0
|
||
task.delay(3.2, function()
|
||
if t.Parent and toastTimers[t] == 0 then
|
||
TweenService:Create(t, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play()
|
||
TweenService:Create(l, TweenInfo.new(0.4), { TextTransparency = 1 }):Play()
|
||
task.wait(0.45)
|
||
t:Destroy()
|
||
end
|
||
end)
|
||
end
|
||
|
||
-- карточка пойманной рыбы
|
||
local catchCard = new("Frame", {
|
||
Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(18) })
|
||
local catchStroke = stroke(WHITE, 3)
|
||
catchStroke.Parent = catchCard
|
||
local catchGrad = gradient(C.panel2, C.bg, 90)
|
||
catchGrad.Parent = catchCard
|
||
local catchView = new("Frame", { Size = UDim2.fromOffset(130, 108), Position = UDim2.fromOffset(10, 10), BackgroundColor3 = C.bg, BackgroundTransparency = 0.3, Parent = catchCard }, { corner(14) })
|
||
local catchHeader = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 10), Font = TITLE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = catchCard })
|
||
local catchName = text({ Size = UDim2.new(1, -160, 0, 30), Position = UDim2.fromOffset(152, 30), Font = TITLE, TextSize = 26, Text = "", TextStrokeTransparency = 0.6, Parent = catchCard })
|
||
local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 64), TextSize = 15, RichText = true, Text = "", Parent = catchCard })
|
||
local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard })
|
||
local catchToken = 0
|
||
|
||
local function showCatch(fish, extra)
|
||
catchToken += 1
|
||
local my = catchToken
|
||
local r = Config.Rarities[fish.rarity]
|
||
local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation)
|
||
clear(catchView)
|
||
viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75)
|
||
catchStroke.Color = mut and mut.color or r.color
|
||
catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg)
|
||
catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА")
|
||
catchHeader.TextColor3 = (extra and (extra.new or extra.record)) and C.gold or C.muted
|
||
catchName.Text = fish.name
|
||
catchName.TextColor3 = r.color
|
||
catchInfo.Text = ("<font color=\"%s\">%s</font>%s · %.2f кг"):format(
|
||
hex(r.color), r.name, mut and (" · <font color=\"" .. hex(mut.color) .. "\">" .. mut.name .. " x" .. mut.mult .. "</font>") or "", fish.weight)
|
||
catchValue.Text = ("💰 %s ⭐ +%d XP"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1))
|
||
catchCard.Visible = true
|
||
TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play()
|
||
task.delay(3.4, function()
|
||
if my == catchToken then
|
||
local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) })
|
||
tw:Play()
|
||
tw.Completed:Wait()
|
||
if my == catchToken then
|
||
catchCard.Visible = false
|
||
end
|
||
end
|
||
end)
|
||
end
|
||
|
||
local function floatText(msg, color)
|
||
local l = text({
|
||
Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42),
|
||
Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color,
|
||
TextStrokeTransparency = 0.2, Text = msg, Parent = gui,
|
||
})
|
||
TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
|
||
task.delay(1.5, function()
|
||
l:Destroy()
|
||
end)
|
||
end
|
||
|
||
---------------------------------------------------------------- статус и мини-игра
|
||
|
||
local statusLabel = text({
|
||
Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110),
|
||
Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3,
|
||
Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui,
|
||
})
|
||
local mgFrame = new("Frame", {
|
||
Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) })
|
||
text({
|
||
Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24,
|
||
TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5,
|
||
Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame,
|
||
})
|
||
local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) })
|
||
local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) })
|
||
local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) })
|
||
local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame })
|
||
local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame })
|
||
local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) })
|
||
|
||
---------------------------------------------------------------- окна
|
||
|
||
local openWindow = nil
|
||
|
||
local function makeWindow(title, accent, tabs)
|
||
local w = { pages = {}, tabButtons = {}, current = nil }
|
||
local frame = new("Frame", {
|
||
Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) })
|
||
local scale = new("UIScale", { Parent = frame })
|
||
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) })
|
||
new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header })
|
||
text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header })
|
||
btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function()
|
||
w.close()
|
||
end)
|
||
local hasTabs = #tabs > 1
|
||
local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame },
|
||
{ new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
local top = hasTabs and 116 or 68
|
||
local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame })
|
||
w.frame = frame
|
||
|
||
function w.setTab(id)
|
||
w.current = id
|
||
for k, page in pairs(w.pages) do
|
||
page.Visible = (k == id)
|
||
end
|
||
for k, b in pairs(w.tabButtons) do
|
||
b.BackgroundColor3 = (k == id) and accent or C.panel2
|
||
end
|
||
if w.render then
|
||
w.render(id)
|
||
end
|
||
end
|
||
for i, t in ipairs(tabs) do
|
||
w.pages[t.id] = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Visible = false, Parent = body })
|
||
w.tabButtons[t.id] = btn({ Size = UDim2.new(1 / #tabs, -8, 1, 0), Text = t.label, TextSize = 18, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = tabBar }, function()
|
||
w.setTab(t.id)
|
||
end)
|
||
end
|
||
function w.open(tab)
|
||
if openWindow and openWindow ~= w then
|
||
openWindow.close()
|
||
end
|
||
openWindow = w
|
||
frame.Visible = true
|
||
scale.Scale = 0.85
|
||
TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
|
||
w.setTab(tab or w.current or tabs[1].id)
|
||
end
|
||
function w.close()
|
||
frame.Visible = false
|
||
if openWindow == w then
|
||
openWindow = nil
|
||
end
|
||
end
|
||
function w.isOpen()
|
||
return frame.Visible
|
||
end
|
||
function w.toggle(tab)
|
||
if frame.Visible and (tab == nil or w.current == tab) then
|
||
w.close()
|
||
else
|
||
w.open(tab)
|
||
end
|
||
end
|
||
function w.refresh()
|
||
if frame.Visible and w.render then
|
||
w.render(w.current)
|
||
end
|
||
end
|
||
return w
|
||
end
|
||
|
||
local function scrollArea(parent, cell, topOffset)
|
||
local sf = new("ScrollingFrame", {
|
||
Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0),
|
||
BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 6, ScrollBarImageColor3 = C.muted,
|
||
AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), Parent = parent,
|
||
}, { new("UIPadding", { PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 4), PaddingLeft = UDim.new(0, 2), PaddingBottom = UDim.new(0, 8) }) })
|
||
if cell then
|
||
new("UIGridLayout", { CellSize = cell, CellPadding = UDim2.fromOffset(10, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf })
|
||
else
|
||
new("UIListLayout", { Padding = UDim.new(0, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf })
|
||
end
|
||
return sf
|
||
end
|
||
|
||
local function itemRow(parent, order, o)
|
||
local row = new("Frame", { Size = UDim2.new(1, -4, 0, 100), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent },
|
||
{ corner(14), stroke(o.strokeColor or C.line, 2, o.strokeColor and 0 or 0.45), gradient(C.panel2, C.panel, 90) })
|
||
local view = new("Frame", { Size = UDim2.fromOffset(124, 84), Position = UDim2.fromOffset(8, 8), BackgroundColor3 = o.iconBg or C.bg, Parent = row }, { corner(10) })
|
||
if o.model then
|
||
viewport(view, o.model, o.dir, o.zoom)
|
||
elseif o.icon then
|
||
text({ Size = UDim2.fromScale(1, 1), TextSize = 48, TextXAlignment = Enum.TextXAlignment.Center, Text = o.icon, Parent = view })
|
||
end
|
||
text({ Size = UDim2.new(1, -300, 0, 28), Position = UDim2.fromOffset(144, 8), Font = TITLE, TextSize = 22, Text = o.title, TextColor3 = o.titleColor or C.text, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Parent = row })
|
||
text({
|
||
Size = UDim2.new(1, -300, 0, 56), Position = UDim2.fromOffset(144, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted,
|
||
RichText = true, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = o.lines, Parent = row,
|
||
})
|
||
btn({
|
||
Size = UDim2.fromOffset(140, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0),
|
||
Text = o.buttonText, BackgroundColor3 = o.buttonColor, AutoButtonColor = o.active, TextSize = 19, Parent = row,
|
||
}, o.active and o.onClick or nil)
|
||
return row
|
||
end
|
||
|
||
local function progressBar(parent, pos, size, frac, color)
|
||
local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) })
|
||
new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) })
|
||
return back
|
||
end
|
||
|
||
---------------------------------------------------------------- данные с сервера
|
||
|
||
local inventory, discovered, claimed = {}, {}, {}
|
||
local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 }
|
||
|
||
---------------------------------------------------------------- магазин
|
||
|
||
local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRGB(215, 120, 40), {
|
||
{ id = "rods", label = "🎣 Удочки" },
|
||
{ id = "upgrade", label = "✨ Улучшение" },
|
||
{ id = "bags", label = "🎒 Сумки" },
|
||
{ id = "luck", label = "🍀 Удача" },
|
||
})
|
||
local shopLists = {
|
||
rods = scrollArea(shopWin.pages.rods),
|
||
upgrade = scrollArea(shopWin.pages.upgrade),
|
||
bags = scrollArea(shopWin.pages.bags),
|
||
luck = scrollArea(shopWin.pages.luck),
|
||
}
|
||
|
||
local function statLine(s)
|
||
return ("🍀 Удача <b>+%d%%</b> ⏱ Клёв <b>x%.2f</b> 🎯 Зона <b>%d%%</b>"):format(math.floor(s.luck * 100 + 0.5), s.speed, math.floor(s.zone * 100 + 0.5))
|
||
end
|
||
local function buyButton(price, level, myLevel, coins)
|
||
if myLevel < level then
|
||
return "🔒 Ур. " .. level, C.grey, false
|
||
end
|
||
return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true
|
||
end
|
||
|
||
shopWin.render = function(tab)
|
||
local list = shopLists[tab]
|
||
if not list then
|
||
return
|
||
end
|
||
clear(list)
|
||
local myLevel = player:GetAttribute("Level") or 1
|
||
local coins = player:GetAttribute("Coins") or 0
|
||
local levels = rodLevels()
|
||
|
||
if tab == "rods" then
|
||
local owned = attrSet("OwnedRods")
|
||
for i, rod in ipairs(Config.Rods) do
|
||
local lv = levels[rod.id] or 0
|
||
local equipped = player:GetAttribute("Rod") == rod.id
|
||
local bText, bColor, active
|
||
if equipped then
|
||
bText, bColor, active = "Надето ✓", C.grey, false
|
||
elseif owned[rod.id] then
|
||
bText, bColor, active = "Надеть", C.blue, true
|
||
else
|
||
bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins)
|
||
end
|
||
itemRow(list, i, {
|
||
model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6,
|
||
title = rod.name .. (owned[rod.id] and (" <font color=\"#FFD45A\">" .. stars(lv) .. "</font>") or ""),
|
||
lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)),
|
||
strokeColor = equipped and C.gold or nil,
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Rod", rod.id)
|
||
end,
|
||
})
|
||
end
|
||
elseif tab == "upgrade" then
|
||
text({
|
||
Size = UDim2.new(1, -4, 0, 40), LayoutOrder = 0, TextSize = 14, Font = BODY2, TextColor3 = C.muted, TextWrapped = true,
|
||
Text = "Каждое улучшение даёт +" .. math.floor(Config.RodUpgrade.luckPerLevel * 100) .. "% удачи, ускоряет клёв и расширяет зелёную зону. Максимум — " .. stars(Config.RodUpgrade.maxLevel),
|
||
Parent = list,
|
||
})
|
||
local owned = attrSet("OwnedRods")
|
||
local order = 0
|
||
for _, rod in ipairs(Config.Rods) do
|
||
if owned[rod.id] then
|
||
order += 1
|
||
local lv = levels[rod.id] or 0
|
||
local now = Config.RodStats(rod.id, lv)
|
||
local maxed = lv >= Config.RodUpgrade.maxLevel
|
||
local lines
|
||
if maxed then
|
||
lines = statLine(now) .. "\n<font color=\"#FFD45A\">Максимальное улучшение!</font>"
|
||
else
|
||
local nxt = Config.RodStats(rod.id, lv + 1)
|
||
lines = ("🍀 +%d%% → <font color=\"#7CFF9A\"><b>+%d%%</b></font> ⏱ x%.2f → <font color=\"#7CFF9A\"><b>x%.2f</b></font>\n🎯 %d%% → <font color=\"#7CFF9A\"><b>%d%%</b></font>"):format(
|
||
math.floor(now.luck * 100 + 0.5), math.floor(nxt.luck * 100 + 0.5), now.speed, nxt.speed,
|
||
math.floor(now.zone * 100 + 0.5), math.floor(nxt.zone * 100 + 0.5))
|
||
end
|
||
local cost = Config.UpgradeCost(rod, lv)
|
||
itemRow(list, order, {
|
||
model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6,
|
||
title = rod.name .. " <font color=\"#FFD45A\">" .. stars(lv) .. "</font>",
|
||
lines = lines,
|
||
strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil,
|
||
buttonText = maxed and "MAX ★" or ("✨ " .. fmt(cost)),
|
||
buttonColor = maxed and C.grey or (coins >= cost and Color3.fromRGB(190, 120, 255) or Color3.fromRGB(110, 80, 140)),
|
||
active = not maxed,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Upgrade", rod.id)
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
elseif tab == "bags" then
|
||
local owned = attrSet("OwnedBags")
|
||
local bonus = attrSet("Passes").BigBag and 100 or 0
|
||
for i, bag in ipairs(Config.Bags) do
|
||
local equipped = player:GetAttribute("Bag") == bag.id
|
||
local bText, bColor, active
|
||
if equipped then
|
||
bText, bColor, active = "Надето ✓", C.grey, false
|
||
elseif owned[bag.id] then
|
||
bText, bColor, active = "Надеть", C.blue, true
|
||
else
|
||
bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins)
|
||
end
|
||
itemRow(list, i, {
|
||
model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8,
|
||
title = bag.name,
|
||
lines = ("🎒 Вмещает <b>%d</b> рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)),
|
||
strokeColor = equipped and C.gold or nil,
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Bag", bag.id)
|
||
end,
|
||
})
|
||
end
|
||
elseif tab == "luck" then
|
||
local lv = levels[player:GetAttribute("Rod") or "Basic"] or 0
|
||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") or Config.Rods[1]
|
||
local boost = player:GetAttribute("BoostBonus") or 0
|
||
local total = player:GetAttribute("Luck") or 100
|
||
local ps = attrSet("Passes")
|
||
local evId = workspace:GetAttribute("Event")
|
||
local event = evId and Config.Find(Config.Events, evId)
|
||
local mutLine = {}
|
||
for _, m in ipairs(Config.Mutations) do
|
||
table.insert(mutLine, ("<font color=\"%s\">%s %.1f%%</font>"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100)))
|
||
end
|
||
local lines = {
|
||
("<font size=\"24\" face=\"FredokaOne\" color=\"#7CFF9A\">🍀 Твоя удача: %d%%</font>"):format(total),
|
||
("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)),
|
||
("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)),
|
||
("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "",
|
||
(ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""),
|
||
"Шанс мутаций: " .. table.concat(mutLine, " · "),
|
||
}
|
||
local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list },
|
||
{ corner(14), stroke(Color3.fromRGB(90, 220, 120), 2, 0.2), gradient(Color3.fromRGB(35, 70, 55), C.panel, 90), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingTop = UDim.new(0, 10), PaddingRight = UDim.new(0, 16) }) })
|
||
text({ Size = UDim2.fromScale(1, 1), TextSize = 15, RichText = true, TextYAlignment = Enum.TextYAlignment.Top, TextWrapped = true, Text = table.concat(lines, "\n"), Parent = info })
|
||
for i, p in ipairs(Config.Potions) do
|
||
local bText, bColor, active = buyButton(p.price, p.level or 1, myLevel, coins)
|
||
itemRow(list, i, {
|
||
icon = "🧪", iconBg = p.color:Lerp(C.bg, 0.6),
|
||
title = p.name, titleColor = p.color,
|
||
lines = ("Удача <b>+%d%%</b> на <b>%d мин</b>.\nРедкая рыба и мутации попадаются чаще!"):format(p.bonus * 100, p.duration / 60),
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Potion", p.id)
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- сумка и коллекция
|
||
|
||
local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), {
|
||
{ id = "fish", label = "🐟 Улов" },
|
||
{ id = "dex", label = "📖 Коллекция" },
|
||
})
|
||
|
||
local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) })
|
||
local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader })
|
||
btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function()
|
||
remote:FireServer("SellAll")
|
||
end)
|
||
local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60)
|
||
|
||
local dexWorld = "World1"
|
||
local dexTabs = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, Parent = bagWin.pages.dex },
|
||
{ new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8) }) })
|
||
local dexList = scrollArea(bagWin.pages.dex, nil, 46)
|
||
local dexTabButtons = {}
|
||
|
||
local function fishCard(parent, order, rarityColor, strokeColor)
|
||
return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent },
|
||
{ corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) })
|
||
end
|
||
|
||
local function rewardButton(parent, state, label, onClick)
|
||
local color = (state == "ready") and C.green or C.grey
|
||
return btn({
|
||
Size = UDim2.fromOffset(150, 34), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0),
|
||
BackgroundColor3 = color, AutoButtonColor = state == "ready", Text = label, TextSize = 16, Parent = parent,
|
||
}, state == "ready" and onClick or nil)
|
||
end
|
||
|
||
local function renderDex()
|
||
clear(dexList)
|
||
for id, b in pairs(dexTabButtons) do
|
||
b.BackgroundColor3 = (id == dexWorld) and C.purple or C.panel2
|
||
end
|
||
local world = Config.Find(Config.Worlds, dexWorld)
|
||
local all = Config.Zones[dexWorld].fish
|
||
local found = 0
|
||
for _, f in ipairs(all) do
|
||
if discovered[f.id] then
|
||
found += 1
|
||
end
|
||
end
|
||
|
||
-- мастерство мира
|
||
local head = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = dexList },
|
||
{ corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) })
|
||
text({
|
||
Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true,
|
||
Text = ("%s %s — <font color=\"#FFD45A\">%d / %d</font>\n<font size=\"13\" color=\"#AAB4CD\">Собери всех: +%s 💰 и +%d%% удачи навсегда</font>"):format(
|
||
world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)),
|
||
Parent = head,
|
||
})
|
||
local mKey = dexWorld .. ":Master"
|
||
rewardButton(head, claimed[mKey] and "done" or (found == #all and "ready" or "locked"),
|
||
claimed[mKey] and "Получено ✓" or (found == #all and "🏆 Забрать" or "🔒 Не собрано"), function()
|
||
remote:FireServer("ClaimCollection", dexWorld, "Master")
|
||
end)
|
||
|
||
for ri, rarity in ipairs(Config.RarityOrder) do
|
||
local group = {}
|
||
for _, f in ipairs(all) do
|
||
if f.rarity == rarity then
|
||
table.insert(group, f)
|
||
end
|
||
end
|
||
if #group > 0 then
|
||
local r = Config.Rarities[rarity]
|
||
local have = 0
|
||
for _, f in ipairs(group) do
|
||
if discovered[f.id] then
|
||
have += 1
|
||
end
|
||
end
|
||
local section = new("Frame", { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = ri, Parent = dexList },
|
||
{ new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
local hdr = new("Frame", { Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = section },
|
||
{ corner(10), gradient(r.color:Lerp(C.bg, 0.5), C.panel, 0) })
|
||
local reward = Config.CollectionRewards[rarity]
|
||
text({
|
||
Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true,
|
||
Text = ("<font color=\"%s\">%s</font> %d/%d <font size=\"13\" color=\"#AAB4CD\">+%s 💰 +%s XP</font>"):format(
|
||
hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)),
|
||
Parent = hdr,
|
||
})
|
||
local key = dexWorld .. ":" .. rarity
|
||
rewardButton(hdr, claimed[key] and "done" or (have == #group and "ready" or "locked"),
|
||
claimed[key] and "Получено ✓" or (have == #group and "🎁 Забрать" or ("🔒 " .. have .. "/" .. #group)), function()
|
||
remote:FireServer("ClaimCollection", dexWorld, rarity)
|
||
end)
|
||
local grid = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 1, Parent = section },
|
||
{ new("UIGridLayout", { CellSize = UDim2.fromOffset(124, 150), CellPadding = UDim2.fromOffset(8, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
for i, f in ipairs(group) do
|
||
local rec = discovered[f.id]
|
||
local card = fishCard(grid, i, rec and r.color or C.grey)
|
||
local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card })
|
||
local model = Models.buildFish(f.id, nil, 1, true)
|
||
viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72)
|
||
text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card })
|
||
text({
|
||
Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true,
|
||
TextYAlignment = Enum.TextYAlignment.Top,
|
||
Text = rec and ("Поймано: %d\nРекорд: %.2f кг"):format(rec.count, rec.best) or "Ещё не поймана", Parent = card,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
for i, w in ipairs(Config.Worlds) do
|
||
if not w.soon then
|
||
dexTabButtons[w.id] = btn({ Size = UDim2.new(0, 170, 1, 0), Text = w.icon .. " " .. w.name, TextSize = 15, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = dexTabs }, function()
|
||
dexWorld = w.id
|
||
renderDex()
|
||
end)
|
||
end
|
||
end
|
||
|
||
bagWin.render = function(tab)
|
||
if tab == "fish" then
|
||
clear(fishGrid)
|
||
local total = 0
|
||
for _, it in ipairs(inventory) do
|
||
total += it.value
|
||
end
|
||
fishSummary.Text = ("🐟 %d / %d · <font color=\"#FFD45A\">💰 ≈%s</font>"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total))
|
||
if #inventory == 0 then
|
||
text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid })
|
||
return
|
||
end
|
||
local sorted = table.clone(inventory)
|
||
table.sort(sorted, function(a, b)
|
||
return a.value > b.value
|
||
end)
|
||
for i, it in ipairs(sorted) do
|
||
local r = Config.Rarities[it.rarity] or Config.Rarities.Common
|
||
local mut = it.mutation and Config.Find(Config.Mutations, it.mutation)
|
||
local card = fishCard(fishGrid, i, r.color, mut and mut.color)
|
||
local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card })
|
||
viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72)
|
||
if mut then
|
||
local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card },
|
||
{ corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) })
|
||
text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 13, TextColor3 = C.bg, Text = mut.name, ZIndex = 4, Parent = tag })
|
||
end
|
||
text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card })
|
||
text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card })
|
||
btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function()
|
||
remote:FireServer("SellOne", it.uid)
|
||
end)
|
||
end
|
||
elseif tab == "dex" then
|
||
renderDex()
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- миры
|
||
|
||
local worldsWin = makeWindow("🌍 Миры", Color3.fromRGB(40, 160, 200), { { id = "list", label = "Миры" } })
|
||
local worldsList = scrollArea(worldsWin.pages.list)
|
||
|
||
local function currentWorld()
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
return hrp and Config.WorldAt(hrp.Position)
|
||
end
|
||
|
||
worldsWin.render = function()
|
||
clear(worldsList)
|
||
local myLevel = player:GetAttribute("Level") or 1
|
||
local here = currentWorld()
|
||
itemRow(worldsList, 0, {
|
||
icon = "🏠", iconBg = Color3.fromRGB(90, 70, 30),
|
||
title = "Лобби", titleColor = C.gold,
|
||
lines = "Магазин удочек, скупка, донат-лавки и ежедневный сундук.",
|
||
buttonText = here == nil and "Вы здесь" or "🌀 Телепорт", buttonColor = here == nil and C.grey or C.blue, active = here ~= nil,
|
||
onClick = function()
|
||
remote:FireServer("Teleport", "Lobby")
|
||
worldsWin.close()
|
||
end,
|
||
})
|
||
for i, w in ipairs(Config.Worlds) do
|
||
local zone = Config.Zones[w.id]
|
||
local total, found = 0, 0
|
||
if zone then
|
||
for _, f in ipairs(zone.fish) do
|
||
total += 1
|
||
if discovered[f.id] then
|
||
found += 1
|
||
end
|
||
end
|
||
end
|
||
local bText, bColor, active
|
||
if w.soon then
|
||
bText, bColor, active = "Скоро…", C.grey, false
|
||
elseif myLevel < w.level then
|
||
bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false
|
||
elseif here and here.id == w.id then
|
||
bText, bColor, active = "Вы здесь", C.grey, false
|
||
else
|
||
bText, bColor, active = "🌀 Телепорт", C.blue, true
|
||
end
|
||
itemRow(worldsList, i, {
|
||
icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6),
|
||
title = w.name, titleColor = w.color,
|
||
lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)),
|
||
strokeColor = (here and here.id == w.id) and C.gold or nil,
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Teleport", w.id)
|
||
worldsWin.close()
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- задания и ежедневная награда
|
||
|
||
local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), {
|
||
{ id = "quests", label = "📜 Задания" },
|
||
{ id = "daily", label = "🎁 Ежедневно" },
|
||
})
|
||
local questList = scrollArea(questWin.pages.quests)
|
||
local dailyPage = questWin.pages.daily
|
||
|
||
local function questText(q)
|
||
local t = Config.Quests[1]
|
||
for _, def in ipairs(Config.Quests) do
|
||
if def.kind == q.kind then
|
||
t = def
|
||
end
|
||
end
|
||
return string.find(t.text, "%%d") and t.text:format(q.goal) or t.text
|
||
end
|
||
|
||
questWin.render = function(tab)
|
||
if tab == "quests" then
|
||
clear(questList)
|
||
text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "Выполняй задания — после награды появится новое.", Parent = questList })
|
||
for i, q in ipairs(quests) do
|
||
local done = q.progress >= q.goal
|
||
local row = new("Frame", { Size = UDim2.new(1, -4, 0, 92), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList },
|
||
{ corner(14), stroke(done and C.green or C.line, 2, done and 0 or 0.45), gradient(C.panel2, C.panel, 90) })
|
||
text({ Size = UDim2.new(1, -190, 0, 28), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 19, Text = questText(q), TextTruncate = Enum.TextTruncate.AtEnd, Parent = row })
|
||
progressBar(row, UDim2.fromOffset(16, 42), UDim2.new(1, -200, 0, 14), q.progress / q.goal, done and C.green or C.gold)
|
||
text({ Size = UDim2.new(1, -190, 0, 20), Position = UDim2.fromOffset(16, 62), Font = BODY2, TextSize = 13, TextColor3 = C.muted, RichText = true,
|
||
Text = ("%s / %s · <font color=\"#FFD45A\">+%s 💰 +%s XP</font>"):format(fmt(q.progress), fmt(q.goal), fmt(q.coins), fmt(q.xp)), Parent = row })
|
||
btn({
|
||
Size = UDim2.fromOffset(150, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0),
|
||
BackgroundColor3 = done and C.green or C.grey, AutoButtonColor = done, Text = done and "🎁 Забрать" or "В процессе", TextSize = 18, Parent = row,
|
||
}, done and function()
|
||
remote:FireServer("ClaimQuest", i)
|
||
end or nil)
|
||
end
|
||
elseif tab == "daily" then
|
||
clear(dailyPage)
|
||
local myLevel = player:GetAttribute("Level") or 1
|
||
text({
|
||
Size = UDim2.new(1, 0, 0, 30), Font = TITLE, TextSize = 20, RichText = true,
|
||
Text = ("🔥 Серия: <font color=\"#FFD45A\">%d</font> дн. Заходи каждый день — награда растёт!"):format(daily.streak), Parent = dailyPage,
|
||
})
|
||
local row = new("Frame", { Size = UDim2.new(1, 0, 0, 150), Position = UDim2.fromOffset(0, 40), BackgroundTransparency = 1, Parent = dailyPage },
|
||
{ new("UIGridLayout", { CellSize = UDim2.new(1 / 7, -8, 1, 0), CellPadding = UDim2.fromOffset(8, 0) }) })
|
||
for d, r in ipairs(Config.DailyRewards) do
|
||
local isNext = d == daily.nextStreak and daily.available
|
||
local passed = d <= daily.streak and not (daily.available and daily.nextStreak == 1)
|
||
local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row },
|
||
{ corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) })
|
||
text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell })
|
||
text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell })
|
||
text({
|
||
Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold,
|
||
Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell,
|
||
})
|
||
end
|
||
btn({
|
||
Size = UDim2.fromOffset(260, 54), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 210),
|
||
BackgroundColor3 = daily.available and C.green or C.grey, AutoButtonColor = daily.available,
|
||
Text = daily.available and "🎁 Забрать награду" or "Приходи завтра!", TextSize = 22, Parent = dailyPage,
|
||
}, daily.available and function()
|
||
remote:FireServer("ClaimDaily")
|
||
end or nil)
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- донат
|
||
|
||
local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), {
|
||
{ id = "passes", label = "👑 Пропуска" },
|
||
{ id = "products", label = "🪙 Наборы" },
|
||
})
|
||
local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) }
|
||
|
||
robuxWin.render = function(tab)
|
||
local list = robuxLists[tab]
|
||
clear(list)
|
||
local owned = attrSet("Passes")
|
||
local items = tab == "passes" and Config.GamePasses or Config.Products
|
||
for i, it in ipairs(items) do
|
||
local has = tab == "passes" and owned[it.key]
|
||
itemRow(list, i, {
|
||
icon = it.icon, iconBg = Color3.fromRGB(70, 40, 100),
|
||
title = it.name, titleColor = C.gold,
|
||
lines = it.desc .. (tab == "passes" and "\nДействует навсегда" or ""),
|
||
strokeColor = has and C.gold or nil,
|
||
buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has,
|
||
onClick = function()
|
||
if not it.id or it.id == 0 then
|
||
notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120))
|
||
return
|
||
end
|
||
if tab == "passes" then
|
||
MarketplaceService:PromptGamePassPurchase(player, it.id)
|
||
else
|
||
MarketplaceService:PromptProductPurchase(player, it.id)
|
||
end
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- боковые кнопки
|
||
|
||
sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function()
|
||
bagWin.toggle("fish")
|
||
end)
|
||
sideButton(2, "📖", "Рыбы", "C", Color3.fromRGB(150, 90, 220), function()
|
||
bagWin.toggle("dex")
|
||
end)
|
||
sideButton(3, "🌍", "Миры", "M", Color3.fromRGB(40, 160, 200), function()
|
||
worldsWin.toggle()
|
||
end)
|
||
sideButton(4, "📜", "Задания", "Q", Color3.fromRGB(210, 150, 40), function()
|
||
questWin.toggle()
|
||
end)
|
||
sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function()
|
||
robuxWin.toggle()
|
||
end)
|
||
|
||
local function refreshDots()
|
||
local q = false
|
||
for _, quest in ipairs(quests) do
|
||
if quest.progress >= quest.goal then
|
||
q = true
|
||
end
|
||
end
|
||
sideDots["Задания"].Visible = q or daily.available
|
||
local c = false
|
||
for _, w in ipairs(Config.Worlds) do
|
||
local zone = Config.Zones[w.id]
|
||
if zone then
|
||
for _, rarity in ipairs(Config.RarityOrder) do
|
||
local any, all = false, true
|
||
for _, f in ipairs(zone.fish) do
|
||
if f.rarity == rarity then
|
||
any = true
|
||
if not discovered[f.id] then
|
||
all = false
|
||
end
|
||
end
|
||
end
|
||
if any and all and not claimed[w.id .. ":" .. rarity] then
|
||
c = true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
sideDots["Рыбы"].Visible = c
|
||
end
|
||
|
||
---------------------------------------------------------------- HUD: обновление
|
||
|
||
local function refreshHud()
|
||
local xp = player:GetAttribute("XP") or 0
|
||
local need = player:GetAttribute("XPNeed") or 100
|
||
coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0)
|
||
lvlText.Text = tostring(player:GetAttribute("Level") or 1)
|
||
xpText.Text = ("%d / %d XP"):format(xp, need)
|
||
TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play()
|
||
local boost = player:GetAttribute("BoostBonus") or 0
|
||
luckText.Text = ("🍀 Удача <b>%d%%</b>%s"):format(player:GetAttribute("Luck") or 100,
|
||
boost > 0 and (" <font color=\"#FFD45A\">🧪 +%d%% %s</font>"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "")
|
||
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
|
||
bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0))
|
||
bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text
|
||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
|
||
rodText.Text = ("🎣 %s <font color=\"#FFD45A\">%s</font>"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0))
|
||
end
|
||
|
||
local pending = false
|
||
player.AttributeChanged:Connect(function(name)
|
||
refreshHud()
|
||
if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then
|
||
return
|
||
end
|
||
if not pending then
|
||
pending = true
|
||
task.defer(function()
|
||
pending = false
|
||
shopWin.refresh()
|
||
robuxWin.refresh()
|
||
if worldsWin.isOpen() then
|
||
worldsWin.refresh()
|
||
end
|
||
end)
|
||
end
|
||
end)
|
||
refreshHud()
|
||
|
||
---------------------------------------------------------------- рыбалка
|
||
|
||
local state = "idle"
|
||
local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 }
|
||
|
||
local function setState(s)
|
||
state = s
|
||
statusLabel.Visible = (s == "waiting")
|
||
mgFrame.Visible = (s == "bite")
|
||
end
|
||
local function updatePips()
|
||
pipsText.Text = "🎯 " .. string.rep("<font color=\"#7CFF9A\">●</font>", mg.hits) .. string.rep("<font color=\"#5A6480\">●</font>", mg.need - mg.hits)
|
||
missText.Text = string.rep("<font color=\"#5A6480\">✖</font>", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses)
|
||
end
|
||
local function flash(color)
|
||
bar.BackgroundColor3 = color
|
||
TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play()
|
||
end
|
||
local function placeZone()
|
||
mg.zoneStart = math.random() * (1 - mg.zoneWidth)
|
||
zoneF.Size = UDim2.fromScale(mg.zoneWidth, 1)
|
||
zoneF.Position = UDim2.fromScale(mg.zoneStart, 0)
|
||
end
|
||
|
||
local function onActivate()
|
||
if state == "idle" then
|
||
setState("casting")
|
||
remote:FireServer("Cast")
|
||
elseif state == "waiting" then
|
||
remote:FireServer("Cancel")
|
||
setState("idle")
|
||
elseif state == "bite" then
|
||
local inZone = mg.pos >= mg.zoneStart and mg.pos <= mg.zoneStart + mg.zoneWidth
|
||
if inZone then
|
||
mg.hits += 1
|
||
flash(Color3.fromRGB(60, 160, 80))
|
||
if mg.hits >= mg.need then
|
||
setState("reeling")
|
||
remote:FireServer("Catch", true, mg.misses)
|
||
return
|
||
end
|
||
mg.speed *= 1.12
|
||
placeZone()
|
||
else
|
||
mg.misses += 1
|
||
flash(Color3.fromRGB(170, 50, 50))
|
||
if mg.misses >= mg.maxMisses then
|
||
setState("reeling")
|
||
remote:FireServer("Catch", false, mg.misses)
|
||
return
|
||
end
|
||
end
|
||
updatePips()
|
||
end
|
||
end
|
||
|
||
local hooked = setmetatable({}, { __mode = "k" })
|
||
local function hookTool(tool)
|
||
if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then
|
||
return
|
||
end
|
||
hooked[tool] = true
|
||
tool.Activated:Connect(onActivate)
|
||
tool.Unequipped:Connect(function()
|
||
if state == "waiting" or state == "bite" or state == "casting" then
|
||
remote:FireServer("Cancel")
|
||
end
|
||
setState("idle")
|
||
end)
|
||
end
|
||
local function watch(container)
|
||
for _, c in ipairs(container:GetChildren()) do
|
||
hookTool(c)
|
||
end
|
||
container.ChildAdded:Connect(hookTool)
|
||
end
|
||
player.ChildAdded:Connect(function(c)
|
||
if c:IsA("Backpack") then
|
||
watch(c)
|
||
end
|
||
end)
|
||
if player:FindFirstChild("Backpack") then
|
||
watch(player.Backpack)
|
||
end
|
||
player.CharacterAdded:Connect(function(char)
|
||
setState("idle")
|
||
watch(char)
|
||
end)
|
||
if player.Character then
|
||
watch(player.Character)
|
||
end
|
||
|
||
RunService.RenderStepped:Connect(function(dt)
|
||
if state ~= "bite" then
|
||
return
|
||
end
|
||
mg.pos += mg.dir * mg.speed * dt
|
||
if mg.pos >= 1 then
|
||
mg.pos, mg.dir = 1, -1
|
||
elseif mg.pos <= 0 then
|
||
mg.pos, mg.dir = 0, 1
|
||
end
|
||
markerF.Position = UDim2.fromScale(mg.pos, 0.5)
|
||
local left = math.max(0, mg.deadline - os.clock())
|
||
timeBar.Size = UDim2.new(left / mg.timeout, -30 * left / mg.timeout, 0, 5)
|
||
if left <= 0 then
|
||
setState("reeling")
|
||
remote:FireServer("Catch", false, mg.misses)
|
||
end
|
||
end)
|
||
|
||
UserInputService.InputBegan:Connect(function(input, processed)
|
||
if processed then
|
||
return
|
||
end
|
||
local k = input.KeyCode
|
||
if k == Enum.KeyCode.B then
|
||
bagWin.toggle("fish")
|
||
elseif k == Enum.KeyCode.C then
|
||
bagWin.toggle("dex")
|
||
elseif k == Enum.KeyCode.M then
|
||
worldsWin.toggle()
|
||
elseif k == Enum.KeyCode.Q then
|
||
questWin.toggle()
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- атмосфера миров (только у этого игрока)
|
||
|
||
local snowPart = new("Part", {
|
||
Name = "SnowFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false,
|
||
Transparency = 1, Size = Vector3.new(90, 1, 90), Parent = workspace,
|
||
})
|
||
local snow = new("ParticleEmitter", {
|
||
Rate = 0, Lifetime = NumberRange.new(5, 7), Speed = NumberRange.new(4, 7),
|
||
EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(15, 15),
|
||
Size = NumberSequence.new(0.25), Color = ColorSequence.new(WHITE), LightEmission = 0.3,
|
||
Parent = snowPart,
|
||
})
|
||
local lastWorldId = "none"
|
||
local terrain = workspace.Terrain
|
||
local defaultWater = Color3.fromRGB(20, 95, 115)
|
||
|
||
local function applyAmbience(world)
|
||
local clock = (world and world.clock) or 14.5
|
||
TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play()
|
||
terrain.WaterColor = (world and world.water) or defaultWater
|
||
local atm = Lighting:FindFirstChildOfClass("Atmosphere")
|
||
if atm then
|
||
local frost = world and world.id == "World3"
|
||
TweenService:Create(atm, TweenInfo.new(2), {
|
||
Density = frost and 0.38 or 0.25,
|
||
Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232),
|
||
}):Play()
|
||
end
|
||
snow.Rate = (world and world.id == "World3") and 140 or 0
|
||
end
|
||
|
||
task.spawn(function()
|
||
while true do
|
||
local w = currentWorld()
|
||
local id = w and w.id or "lobby"
|
||
if id ~= lastWorldId then
|
||
lastWorldId = id
|
||
applyAmbience(w)
|
||
if w then
|
||
notify(w.icon .. " " .. w.name, w.color)
|
||
end
|
||
end
|
||
local cam = workspace.CurrentCamera
|
||
if cam then
|
||
snowPart.CFrame = CFrame.new(cam.CFrame.Position + Vector3.new(0, 25, 0))
|
||
end
|
||
-- баннер события
|
||
local evId = workspace:GetAttribute("Event")
|
||
local event = evId and Config.Find(Config.Events, evId)
|
||
if event then
|
||
eventBanner.Visible = true
|
||
eventTitle.Text = event.name .. " " .. timeStr((workspace:GetAttribute("EventEnds") or 0) - workspace:GetServerTimeNow())
|
||
eventDesc.Text = event.desc
|
||
else
|
||
eventBanner.Visible = false
|
||
end
|
||
task.wait(0.5)
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- события от сервера
|
||
|
||
remote.OnClientEvent:Connect(function(action, a, b, c)
|
||
if action == "Notify" then
|
||
notify(a, b)
|
||
elseif action == "Cast" then
|
||
setState("waiting")
|
||
elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then
|
||
setState("idle")
|
||
elseif action == "Bite" then
|
||
mg.speed = a.speed
|
||
mg.zoneWidth = a.zoneWidth
|
||
mg.need = a.hits
|
||
mg.hits = 0
|
||
mg.misses = 0
|
||
mg.maxMisses = a.misses
|
||
mg.timeout = a.timeout
|
||
mg.deadline = os.clock() + a.timeout
|
||
mg.pos, mg.dir = 0, 1
|
||
placeZone()
|
||
updatePips()
|
||
setState("bite")
|
||
elseif action == "Caught" then
|
||
setState("idle")
|
||
showCatch(a, b)
|
||
playUiSound(DING, 0.5)
|
||
elseif action == "Sold" then
|
||
floatText("+" .. fmt(a) .. " 💰", C.gold)
|
||
notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140))
|
||
elseif action == "Inventory" then
|
||
inventory = a or {}
|
||
discovered = b or {}
|
||
claimed = c or {}
|
||
bagWin.refresh()
|
||
refreshDots()
|
||
elseif action == "Quests" then
|
||
quests = a or {}
|
||
daily = b or daily
|
||
questWin.refresh()
|
||
refreshDots()
|
||
elseif action == "OpenShop" then
|
||
shopWin.open("rods")
|
||
elseif action == "OpenQuests" then
|
||
questWin.open("daily")
|
||
elseif action == "OpenRobux" then
|
||
robuxWin.open(a)
|
||
end
|
||
end)
|
||
|
||
remote:FireServer("RequestInventory")
|
||
]]></ProtectedString></Properties></Item>
|
||
</roblox>
|