Files
Fishing/install/5_FishingClient_StarterPlayerScripts.rbxmx
T

2828 lines
127 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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 Audio = require(script.Parent:WaitForChild("Audio"))
local remote = ReplicatedStorage:WaitForChild("GameEvent")
local reelSound = Audio.loop("reel", "sfx") -- трещотка катушки, пока идёт вываживание
---------------------------------------------------------------- стиль
-- палитра, шрифты и украшения — в модуле UiTheme («средневековая гильдия»)
local Theme = require(script.Parent:WaitForChild("UiTheme"))
local C = Theme.C
local TITLE = Enum.Font.FredokaOne -- в new() подменяется на шрифт с кириллицей (Theme.FACES)
local BODY = Enum.Font.GothamBold
local BODY2 = Enum.Font.GothamMedium
local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0)
---------------------------------------------------------------- помощники 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
elseif k == "Font" and Theme.FACES[v] then
obj.FontFace = Theme.FACES[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)
-- дерево/сургуч с золотой окантовкой; цвет кнопки задаёт BackgroundColor3, градиент даёт объём
local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.55 }
for k, v in pairs(props) do
d[k] = v
end
local b = new("TextButton", d, {
corner(8), new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 240, 215), Color3.fromRGB(165, 150, 135)), Rotation = 90 }),
new("UIStroke", { Color = C.gold, Thickness = 1.5, Transparency = 0.15, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }),
})
if onClick then
b.MouseButton1Click:Connect(function(...)
Audio.play("click")
onClick(...)
end)
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 VIEW = { fish = Vector3.new(0.12, 0.15, 1), rod = Vector3.new(1, 0.1, 0.05), bag = 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"),
})
-- холст с масштабом под экран: всё ниже кладём в него, а не прямо в ScreenGui
local screen = Theme.scaleRoot(gui)
---------------------------------------------------------------- HUD
-- hud — содержимое; его родитель — деревянная панель с рамкой и заклёпками (её двигает раскладка)
local hud = new("Frame", {
Size = UDim2.new(1, -28, 1, -10), Position = UDim2.fromOffset(14, 10), BackgroundTransparency = 1,
Parent = new("Frame", {
Name = "Hud", Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = screen,
}, { corner(10), stroke(C.goldDark, 2.5, 0), Theme.woodGradient(C.wood, C.woodDark) }),
})
Theme.innerBorder(hud.Parent, 5, 7, C.gold, 0.5)
Theme.rivets(hud.Parent, 8, 6)
local H = {} -- элементы HUD (в таблице: у скрипта лимит 200 локальных переменных)
H.coins = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 28, TextColor3 = C.silver, Text = "⚪ 0", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = hud })
H.lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Rotation = 45, Parent = hud },
{ corner(6), gradient(C.goldBright, C.goldDark, 90), stroke(C.ink, 2, 0.1) })
H.lvl = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 17, Rotation = -45, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.ink, Text = "1", Parent = H.lvlBadge })
H.xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = C.dark, Parent = hud }, { corner(4), stroke(C.goldDark, 1.5, 0.2) })
H.xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = H.xpBack }, { corner(4), gradient(C.goldBright, Color3.fromRGB(196, 128, 48), 0) })
H.xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = H.xpBack })
H.luck = 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 })
H.bag = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud })
H.rod = 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 = screen,
}, { 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 })
-- кнопки слева
-- столбик на компьютере, сетка 2×N на телефоне (раскладка — в applyLayout ниже)
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 = screen,
}, { new("UIGridLayout", { CellSize = UDim2.fromOffset(68, 68), CellPadding = UDim2.fromOffset(8, 8), FillDirectionMaxCells = 1, SortOrder = Enum.SortOrder.LayoutOrder }) })
local sideDots = {}
local function sideButton(order, icon, label, key, color, onClick)
-- деревянная плитка; цвет раздела — полоска-лента снизу
local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = C.woodLight, LayoutOrder = order, Parent = side }, onClick)
b:FindFirstChildOfClass("UIStroke").Color = C.goldDark
b:FindFirstChildOfClass("UIStroke").Thickness = 2.5
new("Frame", { Size = UDim2.new(1, -10, 0, 4), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -4), BackgroundColor3 = color, BorderSizePixel = 0, Parent = b }, { corner(2) })
text({ Size = UDim2.fromScale(1, 0.5), Position = UDim2.fromScale(0, 0.06), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b })
text({ Size = UDim2.fromScale(1, 0.24), Position = UDim2.fromScale(0, 0.6), Font = TITLE, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, 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 SOFT_EDGES = NumberSequence.new({
NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.18, 0.62),
NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1),
})
-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт)
local HINT_FONT = Theme.HINT_FACE
-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует.
-- Цвет — тёмное дерево
local function softPlate(props, textProps)
local plate = new("Frame", props)
plate.BackgroundColor3 = C.woodDark
plate.BackgroundTransparency = 0
corner(30).Parent = plate
new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate })
new("UIPadding", { PaddingLeft = UDim.new(0, 48), PaddingRight = UDim.new(0, 48), Parent = plate })
local d = { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, TextXAlignment = Enum.TextXAlignment.Center, Parent = plate }
for k, v in pairs(textProps) do
d[k] = v
end
local label = text(d)
label.FontFace = HINT_FONT
return plate, label
end
local function popIn(obj, from)
local sc = obj:FindFirstChildOfClass("UIScale") or new("UIScale", { Parent = obj })
sc.Scale = from or 0.4
TweenService:Create(sc, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
end
local function wobble(obj, deg, period)
obj.Rotation = -deg
TweenService:Create(obj, TweenInfo.new(period, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Rotation = deg }):Play()
end
-- уведомления — под подсказкой обучения, которая стоит в самом верху
local toasts = new("Frame", {
Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84),
BackgroundTransparency = 1, ZIndex = 30, Parent = screen,
}, { 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, l = softPlate(
{ Size = UDim2.new(0, 0, 0, 44), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts },
{ TextSize = 24, TextColor3 = color or C.text, Text = msg }
)
popIn(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, ZIndex = 25, Parent = screen,
}, { corner(10) })
Theme.innerBorder(catchCard, 6, 6, C.gold, 0.5)
Theme.rivets(catchCard, 8, 6)
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
-- уведомления и карточка улова — в одной колонке сверху: пока карточка видна, уведомления уходят под неё
H.toastBaseY = 84
function H.placeToasts(cardShown)
local y = H.toastBaseY
if cardShown then
local sc = catchCard:FindFirstChildOfClass("UIScale")
y = 120 + catchCard.Size.Y.Offset * (sc and sc.Scale or 1) + 10
end
TweenService:Create(toasts, TweenInfo.new(0.3, Enum.EasingStyle.Quad), { Position = UDim2.new(0.5, 0, 0, y) }):Play()
end
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), VIEW.fish, 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%s"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1),
(extra and extra.combo and extra.combo > 1.001) and (" 🔥 x%.1f"):format(extra.combo) or "")
catchCard.Visible = true
H.placeToasts(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()
H.placeToasts(false)
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 = screen,
})
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 = softPlate(
{ Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = screen },
{ TextSize = 36, Text = "🎣 Ждём клёв…" }
)
wobble(statusLabel, 1.2, 1.4)
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 = screen,
}, { corner(10), stroke(C.goldDark, 3, 0), Theme.woodGradient(C.wood, C.woodDark) })
Theme.innerBorder(mgFrame, 5, 7, C.gold, 0.4)
Theme.rivets(mgFrame, 9, 6)
text({
Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 22,
TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.goldBright, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3,
Text = UserInputService.TouchEnabled and "❗ КЛЮЁТ! Жми, когда метка в зелёной зоне" or "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame,
})
local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = C.dark, ClipsDescendants = true, Parent = mgFrame }, { corner(5), stroke(C.goldDark, 2, 0) })
local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(150, 220, 110), Color3.fromRGB(56, 116, 52), 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 = C.parchment, ZIndex = 3, Parent = bar }, { corner(3), stroke(C.ink, 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 }
-- деревянная панель, золотая рамка в 2 слоя, ромбики-заклёпки, заголовок на багровой ленте,
-- закрытие — круглая багровая печать. accent — цвет раздела: тонкая полоска под лентой
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, ZIndex = 20, Parent = screen, -- поверх HUD, целей и подсказок
}, { corner(12), stroke(C.goldDark, 4, 0), Theme.woodGradient(C.wood, C.woodDark), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) })
Theme.innerBorder(frame, 7, 8, C.gold, 0.2)
Theme.rivets(frame, 12, 8)
local scale = new("UIScale", { Parent = frame })
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundTransparency = 1, Parent = frame })
-- багровая лента по центру, ширина — по тексту
local ribbon = new("Frame", {
Size = UDim2.new(0, 0, 0, 44), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8),
BackgroundColor3 = WHITE, ZIndex = 3, Parent = header,
}, { corner(4), gradient(Color3.fromRGB(184, 58, 48), Color3.fromRGB(118, 28, 26), 90), stroke(C.gold, 2, 0),
new("UIListLayout", { HorizontalAlignment = Enum.HorizontalAlignment.Center, VerticalAlignment = Enum.VerticalAlignment.Center }),
new("UIPadding", { PaddingLeft = UDim.new(0, 36), PaddingRight = UDim.new(0, 36) }) })
text({ Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 24, TextXAlignment = Enum.TextXAlignment.Center,
TextColor3 = C.goldBright, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.2, Text = title, ZIndex = 4, Parent = ribbon })
new("Frame", { Size = UDim2.new(0, 120, 0, 3), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 1, 2), BackgroundColor3 = accent, BorderSizePixel = 0, Parent = header }, { corner(2) })
local closeB = btn({ Size = UDim2.fromOffset(44, 44), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -24, 0, 22), BackgroundColor3 = C.crimson, Text = "×", TextSize = 30, TextColor3 = C.goldBright, ZIndex = 7, Parent = frame }, function()
w.close()
end)
closeB:FindFirstChildOfClass("UICorner").CornerRadius = UDim.new(1, 0)
closeB:FindFirstChildOfClass("UIStroke").Thickness = 2.5
local hasTabs = #tabs > 1
local tabBar = new("Frame", { Size = UDim2.new(1, -36, 0, 40), Position = UDim2.fromOffset(18, 68), 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 118 or 70
local body = new("Frame", { Size = UDim2.new(1, -36, 1, -(top + 16)), Position = UDim2.fromOffset(18, top), BackgroundTransparency = 1, Parent = frame })
w.frame = frame
-- на телефоне окно почти на весь экран
Theme.onLayout(function(compact)
frame.Size = compact and UDim2.new(1, -16, 1, -12) or UDim2.fromScale(0.92, 0.82)
frame.UISizeConstraint.MaxSize = compact and Vector2.new(1100, 640) or Vector2.new(760, 540)
frame.Position = compact and UDim2.fromScale(0.5, 0.5) or UDim2.fromScale(0.5, 0.53)
end)
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 C.gold or C.woodLight
b.TextColor3 = (k == id) and C.ink or C.text
b.TextStrokeTransparency = (k == id) and 1 or 0.55
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
if not frame.Visible then
Audio.play("open")
end
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 = C.dark, Parent = parent }, { corner(7) })
new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) })
return back
end
-- помощники интерфейса для других скриптов (GuildClient): тот же стиль окон, кнопок и уведомлений
Theme.kit = {
new = new, text = text, btn = btn, corner = corner, stroke = stroke, gradient = gradient, clear = clear,
makeWindow = makeWindow, scrollArea = scrollArea, itemRow = itemRow, progressBar = progressBar,
sideButton = sideButton, notify = notify, popIn = popIn, fmt = fmt, timeStr = timeStr,
screen = screen, hud = hud, TITLE = TITLE, BODY = BODY, BODY2 = BODY2,
}
---------------------------------------------------------------- данные с сервера
local inventory, discovered, claimed = {}, {}, {}
local chain, daily = nil, { 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 = VIEW.rod, 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 = VIEW.rod, 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 = VIEW.bag, 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\" 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)
-- тёмное дерево; редкость — цветная полоса сверху и камень в углу, мутация — цвет рамки
local card = new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent },
{ corner(8), stroke(strokeColor or C.goldDark, strokeColor and 2.5 or 2, 0), gradient(rarityColor:Lerp(C.woodDark, 0.78), C.woodDark, 90) })
new("Frame", { Size = UDim2.new(1, -16, 0, 4), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 3), BackgroundColor3 = rarityColor, BorderSizePixel = 0, Parent = card }, { corner(2) })
new("Frame", { Size = UDim2.fromOffset(12, 12), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -11, 0, 13), Rotation = 45, BackgroundColor3 = rarityColor, ZIndex = 5, Parent = card },
{ stroke(C.ink, 1.5), gradient(WHITE, Color3.fromRGB(150, 150, 150), 90) })
return card
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=\"#C0AC88\">Собери всех: +%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=\"#C0AC88\">+%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), VIEW.fish, 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), VIEW.fish, 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 (Config.Guild.worldRank[w.id] or 1) > (player:GetAttribute("RankIdx") or 1) then
bText, bColor, active = "🔒 Ранг " .. Config.Guild.ranks[Config.Guild.worldRank[w.id]].id, 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%s · Рыб поймано: %d / %d · Награды x%d"):format(w.level,
Config.Guild.worldRank[w.id] and (", ранг " .. Config.Guild.ranks[Config.Guild.worldRank[w.id]].id) or "", 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(kind, goal)
local t = Config.QuestKinds[kind]
if not t then
return kind
end
if t.forms then
local m10, m100 = goal % 10, goal % 100
local i = (m10 == 1 and m100 ~= 11) and 1 or ((m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14)) and 2 or 3)
return t.text:format(goal, t.forms[i])
end
return string.find(t.text, "%%d") and t.text:format(goal) or t.text
end
questWin.render = function(tab)
if tab == "quests" then
clear(questList)
if not chain then
return
end
text({
Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = TITLE, TextSize = 22, RichText = true,
Text = ("%s <font color=\"#C0AC88\" size=\"15\">круг %d · награда сразу, следующее задание — тоже</font>"):format(chain.name, chain.round), Parent = questList,
})
for i, st in ipairs(chain.steps) do
local done, cur = i < chain.step, i == chain.step
local row = new("Frame", { Size = UDim2.new(1, -4, 0, cur and 84 or 56), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList },
{ corner(14), stroke(cur and C.gold or (done and C.green or C.line), cur and 3 or 2, (cur or done) and 0 or 0.5), gradient(cur and Color3.fromRGB(70, 60, 30) or C.panel2, C.panel, 90) })
text({
Size = UDim2.new(1, -200, 0, 28), Position = UDim2.fromOffset(16, cur and 8 or 14), Font = TITLE, TextSize = 19,
TextColor3 = (done or cur) and C.text or C.muted, Text = (done and "✅ " or (cur and "▶ " or "🔒 ")) .. questText(st.kind, st.goal),
TextTruncate = Enum.TextTruncate.AtEnd, Parent = row,
})
text({
Size = UDim2.fromOffset(180, 28), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, cur and 8 or 14), Font = TITLE, TextSize = 17,
TextXAlignment = Enum.TextXAlignment.Right, TextColor3 = done and C.muted or C.gold, Text = ("+%s ⚪ +%s XP"):format(fmt(st.coins), fmt(st.xp)), Parent = row,
})
if cur then
progressBar(row, UDim2.fromOffset(16, 44), UDim2.new(1, -110, 0, 16), chain.progress / st.goal, C.gold)
text({ Size = UDim2.fromOffset(80, 20), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, 42), Font = TITLE, TextSize = 16,
TextXAlignment = Enum.TextXAlignment.Right, Text = ("%s / %s"):format(fmt(chain.progress), fmt(st.goal)), Parent = row })
end
end
local b = chain.bonus
local row = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 100, Parent = questList },
{ corner(14), stroke(C.purple, 2, 0.2), gradient(Color3.fromRGB(70, 40, 100), C.panel, 90) })
text({
Size = UDim2.new(1, -32, 1, 0), Position = UDim2.fromOffset(16, 0), Font = TITLE, TextSize = 18, RichText = true,
Text = ("🎁 За всю цепочку: <font color=\"#FFD45A\">+%s ⚪ +%s XP</font>%s"):format(fmt(b.coins), fmt(b.xp), b.potion and (" + " .. b.potion) or ""), Parent = row,
})
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("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120))
return
end
-- и наборы, и пропуска — Developer Products; пропуск сервер запоминает навсегда
MarketplaceService:PromptProductPurchase(player, it.id)
end,
})
end
end
---------------------------------------------------------------- настройки звука
local settingsWin = makeWindow("⚙ Настройки", Color3.fromRGB(150, 120, 80), { { id = "sound", label = "Звук" } })
local settingsPage = settingsWin.pages.sound
local volumes = {
music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music,
sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx,
}
local function setVolume(key, value)
volumes[key] = math.clamp(math.floor(value * 10 + 0.5) / 10, 0, 1)
-- сразу у себя (слышно без задержки), сервер сохранит и подтвердит
player:SetAttribute(key == "music" and "VolMusic" or "VolSfx", volumes[key])
remote:FireServer("Settings", volumes.music, volumes.sfx)
settingsWin.refresh()
end
settingsWin.render = function()
clear(settingsPage)
for i, row in ipairs({ { "music", "🎵 Музыка" }, { "sfx", "🔊 Звуки и окружение" } }) do
local key, label = row[1], row[2]
local f = new("Frame", { Size = UDim2.new(1, -4, 0, 70), Position = UDim2.fromOffset(0, (i - 1) * 82), BackgroundColor3 = WHITE, Parent = settingsPage },
{ corner(14), stroke(C.line, 2, 0.45), gradient(C.panel2, C.panel, 90) })
text({ Size = UDim2.new(1, -260, 1, 0), Position = UDim2.fromOffset(18, 0), Font = TITLE, TextSize = 21, Text = label, Parent = f })
btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -170, 0.5, 0), BackgroundColor3 = C.grey, Text = "−", TextSize = 26, Parent = f }, function()
setVolume(key, volumes[key] - 0.1)
end)
text({ Size = UDim2.fromOffset(90, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -74, 0.5, 0), Font = TITLE, TextSize = 22,
TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = math.floor(volumes[key] * 100 + 0.5) .. "%", Parent = f })
btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, Text = "+", TextSize = 26, Parent = f }, function()
setVolume(key, volumes[key] + 0.1)
end)
end
end
-- сервер прислал сохранённую громкость
player:GetAttributeChangedSignal("VolMusic"):Connect(function()
volumes.music = player:GetAttribute("VolMusic") or volumes.music
settingsWin.refresh()
end)
player:GetAttributeChangedSignal("VolSfx"):Connect(function()
volumes.sfx = player:GetAttribute("VolSfx") or volumes.sfx
settingsWin.refresh()
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)
sideButton(6, "⚙", "Звук", nil, Color3.fromRGB(150, 120, 80), function()
settingsWin.toggle()
end)
-- раскладка: компьютер — как раньше; телефон — HUD и кнопки компактнее, кнопки сеткой 3×N под HUD
-- (левый низ свободен под джойстик, правый низ — под кнопку прыжка)
do
local function scaleOf(obj)
local sc = obj:FindFirstChild("LayoutScale") or new("UIScale", { Name = "LayoutScale", Parent = obj })
return sc
end
local grid = side:FindFirstChildOfClass("UIGridLayout")
Theme.onLayout(function(compact)
scaleOf(hud.Parent).Scale = compact and 0.82 or 1
hud.Parent.Position = compact and UDim2.fromOffset(8, 6) or UDim2.fromOffset(12, 10)
grid.CellSize = compact and UDim2.fromOffset(52, 52) or UDim2.fromOffset(62, 62)
grid.CellPadding = compact and UDim2.fromOffset(6, 6) or UDim2.fromOffset(6, 6)
grid.FillDirectionMaxCells = compact and 3 or 1
side.AnchorPoint = Vector2.zero
-- под HUD (он выше на строку гильдии — её добавляет GuildClient)
side.Position = compact and UDim2.fromOffset(8, 172) or UDim2.fromOffset(12, 216)
side.Size = compact and UDim2.fromOffset(170, 240) or UDim2.fromOffset(70, 480)
toasts.Size = compact and UDim2.fromOffset(640, 200) or UDim2.fromOffset(900, 200)
H.toastBaseY = compact and 66 or 84
toasts.Position = UDim2.new(0.5, 0, 0, H.toastBaseY)
scaleOf(toasts).Scale = compact and 0.75 or 1
scaleOf(catchCard).Scale = compact and 0.8 or 1
scaleOf(mgFrame).Scale = compact and 0.85 or 1
mgFrame.Position = compact and UDim2.new(0.5, 0, 1, -60) or UDim2.new(0.5, 0, 1, -100)
scaleOf(eventBanner).Scale = compact and 0.8 or 1
statusLabel:FindFirstChildOfClass("TextLabel").TextSize = compact and 28 or 36
end)
end
local function refreshDots()
-- задания цепочки награждаются сами, точка — только для ежедневной награды
sideDots["Задания"].Visible = 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
H.coins.Text = "⚪ " .. fmt(player:GetAttribute("Coins") or 0)
H.lvl.Text = tostring(player:GetAttribute("Level") or 1)
H.xpText.Text = ("%d / %d XP"):format(xp, need)
TweenService:Create(H.xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play()
local boost = player:GetAttribute("BoostBonus") or 0
H.luck.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
H.bag.Text = ("🎒 %d / %d · ≈ %s ⚪"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0))
H.bag.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
H.rod.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 ContextActionService = game:GetService("ContextActionService")
local MOVE_KEYS = {
Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space,
Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right,
Enum.KeyCode.Thumbstick1, Enum.KeyCode.ButtonA,
}
local controls
local movementLocked = false
local function setMovementLocked(locked)
if not controls then
local pm = player:FindFirstChild("PlayerScripts") and player.PlayerScripts:FindFirstChild("PlayerModule")
local ok, mod = pcall(require, pm)
controls = ok and mod and mod:GetControls() or nil
end
if controls then
if locked then
controls:Disable()
else
controls:Enable()
end
end
if locked ~= movementLocked then
movementLocked = locked
if locked then
ContextActionService:BindActionAtPriority("FishingLock", function()
return Enum.ContextActionResult.Sink
end, false, Enum.ContextActionPriority.High.Value + 100, table.unpack(MOVE_KEYS))
else
ContextActionService:UnbindAction("FishingLock")
end
end
local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
if hum then
hum.AutoRotate = not locked
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, not locked)
if locked then
hum:Move(Vector3.zero)
end
end
end
local function easeInOut(a)
return a < 0.5 and 4 * a * a * a or 1 - (-2 * a + 2) ^ 3 / 2
end
local function easeOut(a)
return 1 - (1 - a) ^ 3
end
---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки
-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе
local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе
local function gripCF(angle)
return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse()
end
local charge = nil -- { t0, tool }
local castTool = nil -- удочка последнего броска: вернуть её в покой, если бросок не удался
-- сила ездит туда-сюда: 0 → 1 за CastChargeTime, потом обратно к 0 и снова вверх, пока держишь ЛКМ
local function chargePower()
if not charge then
return 0
end
local t = ((os.clock() - charge.t0) / Config.CastChargeTime) % 2
return t <= 1 and t or 2 - t
end
local function inPerfect(v)
return v >= Config.CastPerfect[1] and v <= Config.CastPerfect[2]
end
-- шкала-дуга справа от персонажа: внизу слабый бросок, вверху сильный, зелёная зона — бонус удачи
local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32
local gauge = new("Frame", {
Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0),
BackgroundTransparency = 1, Visible = false, Parent = screen,
})
local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо
local function arcPoint(v, r)
local th = math.rad(-GAUGE_DEG / 2 + GAUGE_DEG * v)
return GAUGE_C + Vector2.new(math.cos(th) * r, -math.sin(th) * r), -math.deg(th)
end
do
local segLen = 2 * math.pi * GAUGE_R * (GAUGE_DEG / 360) / GAUGE_N
for _, layer in ipairs({ { 46, 4, BLACK }, { 34, 1 } }) do -- чёрная обводка, потом цветные секции
for i = 0, GAUGE_N - 1 do
local v = (i + 0.5) / GAUGE_N
local pos, rot = arcPoint(v, GAUGE_R)
local color = layer[3]
or ((v < 0.12 or v > 0.94) and C.red)
or (inPerfect(v) and Color3.fromRGB(110, 235, 60))
or Color3.fromRGB(40, 70, 95)
new("Frame", {
Size = UDim2.fromOffset(layer[1], segLen + layer[2]), AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.fromOffset(pos.X, pos.Y), Rotation = rot, BorderSizePixel = 0,
BackgroundColor3 = color, Parent = gauge,
})
end
end
end
local needle = new("Frame", {
Size = UDim2.fromOffset(64, 8), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = WHITE,
BorderSizePixel = 0, ZIndex = 3, Parent = gauge,
}, { corner(4), stroke(BLACK, 2) })
local multLabel = text({
Size = UDim2.fromOffset(110, 40), AnchorPoint = Vector2.new(0.5, 1), Font = TITLE, TextSize = 34,
Text = "×" .. Config.CastPerfectLuck, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4,
Visible = false, Parent = gauge,
})
new("UIStroke", { Color = BLACK, Thickness = 3, Parent = multLabel })
do
local top = arcPoint(1, GAUGE_R)
multLabel.Position = UDim2.fromOffset(top.X + 10, top.Y - 18)
end
local function updateCharge()
local p = chargePower()
local pos, rot = arcPoint(p, GAUGE_R)
needle.Position = UDim2.fromOffset(pos.X, pos.Y)
needle.Rotation = rot
local good = inPerfect(p)
multLabel.Visible = good
needle.BackgroundColor3 = good and Color3.fromRGB(190, 255, 150) or WHITE
if charge.tool and charge.tool.Parent then
charge.tool.Grip = gripCF(REST_ANGLE + (BACK_ANGLE - REST_ANGLE) * easeOut(p))
end
end
---------------------------------------------------------------- камера при забросе
-- зарядка: камера уходит в сторону от персонажа и отъезжает тем дальше, чем сильнее замах;
-- бросок: камера сбоку разгоняется за поплавком; потом сверху-сбоку держит в кадре игрока и поплавок
local CAM_IN, CAM_SETTLE, CAM_RETURN = 0.35, 0.8, 0.6
local UP = Vector3.new(0, 1, 0)
local fishCam = nil
local function sideCF(fc, p)
return CFrame.lookAt(fc.hrp + fc.r * (9 + 3 * p) - fc.f * (3 + 2 * p) + UP * (3 + 1.5 * p), fc.hrp + fc.f * 6 + UP)
end
local function chaseCF(fc, p)
return CFrame.lookAt(p + fc.r * 9 - fc.f * 5 + UP * 3, p + fc.f * 3)
end
local function restCF(fc)
local d = ((fc.target - fc.hrp) * Vector3.new(1, 0, 1)).Magnitude
local mid = fc.hrp:Lerp(fc.target, 0.5)
return CFrame.lookAt(mid + fc.r * (8 + d * 0.55) - fc.f * 4 + UP * (6 + d * 0.25), fc.hrp:Lerp(fc.target, 0.6))
end
local function fishCamStep()
local fc = fishCam
local cam = workspace.CurrentCamera
if not fc or not cam then
return
end
if fc.returning then
local a = math.min(1, (os.clock() - fc.returning) / CAM_RETURN)
local e = easeInOut(a)
cam.CFrame = fc.leaveCF:Lerp(fc.origCF, e)
cam.FieldOfView = fc.leaveFov + (fc.origFov - fc.leaveFov) * e
if a >= 1 then
RunService:UnbindFromRenderStep("FishCam")
cam.CameraType = Enum.CameraType.Custom
fishCam = nil
end
return
end
local now = os.clock()
local cf, fov
if not fc.castT0 then
-- зарядка: плавно уходим в вид сбоку; чем сильнее замах, тем дальше камера и шире обзор
-- после отпускания ЛКМ, пока ждём ответ сервера, держим набранную силу
local p = charge and chargePower() or (fc.power or 0)
fc.power = p
local e = easeOut(math.min(1, (now - fc.t0) / CAM_IN))
cf = fc.origCF:Lerp(sideCF(fc, p), e)
fov = fc.origFov + 12 * p * e
else
local th = fc.throw
local t = now - fc.castT0
local lunge = fc.fromCF + fc.f * 1.5
if t < th.windup then
-- рывок удочки вперёд: камера подаётся следом
local e = easeOut(t / th.windup)
cf = fc.fromCF:Lerp(lunge, e)
fov = fc.fromFov + 4 * e
elseif t < th.windup + th.flight then
if not fc.start then
fc.start = (fc.tip and fc.tip.Parent and fc.tip.WorldPosition) or (fc.hrp + fc.f * 2 + UP * 4)
end
local a = (t - th.windup) / th.flight
local p = fc.start:Lerp(fc.target, a) + UP * (math.sin(a * math.pi) * th.arc) -- та же дуга, что у поплавка
local e = easeInOut(a)
cf = lunge:Lerp(chaseCF(fc, p), e)
fov = (fc.fromFov + 4) + ((fc.origFov - 6) - (fc.fromFov + 4)) * e
else
local e = easeOut(math.min(1, (t - th.windup - th.flight) / CAM_SETTLE))
local sway = Vector3.new(math.sin(now * 0.7) * 0.5, math.sin(now * 1.1) * 0.25, 0)
if state == "bite" then
sway += Vector3.new(math.random() - 0.5, math.random() - 0.5, 0) * 0.15
end
cf = chaseCF(fc, fc.target):Lerp(restCF(fc) + sway, e)
fov = fc.origFov - 6 + 6 * e
end
end
cam.CFrame = cf
cam.FieldOfView = fov
end
-- начало зарядки: dir — куда полетит поплавок (к центру озера)
local function startChargeCam(tool, dir)
local cam = workspace.CurrentCamera
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if not cam or not hrp then
return
end
fishCam = {
t0 = os.clock(), hrp = hrp.Position, f = dir, r = dir:Cross(UP),
tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip"),
-- если камера ещё возвращалась с прошлого заброса, возвращаться будем туда же
origCF = fishCam and fishCam.origCF or cam.CFrame,
origFov = fishCam and fishCam.origFov or cam.FieldOfView,
}
cam.CameraType = Enum.CameraType.Scriptable
RunService:UnbindFromRenderStep("FishCam")
RunService:BindToRenderStep("FishCam", Enum.RenderPriority.Camera.Value + 1, fishCamStep)
end
-- сервер принял бросок: target — куда упадёт поплавок, throw — тайминги и высота дуги
local function startCastCam(target, throw)
local cam = workspace.CurrentCamera
if not fishCam or fishCam.returning or not cam or typeof(target) ~= "Vector3" or type(throw) ~= "table" then
return
end
fishCam.castT0 = os.clock()
fishCam.target = target
fishCam.throw = throw
fishCam.fromCF = cam.CFrame
fishCam.fromFov = cam.FieldOfView
end
local function stopFishCam()
local cam = workspace.CurrentCamera
if not fishCam or fishCam.returning or not cam then
return
end
fishCam.returning = os.clock()
fishCam.leaveCF = cam.CFrame
fishCam.leaveFov = cam.FieldOfView
end
local reelToken
local function setState(s)
if s ~= "charging" and charge then
-- зарядку прервали (убрал удочку и т.п.): удочку обратно в покой
if charge.tool.Parent then
charge.tool.Grip = gripCF(REST_ANGLE)
end
charge = nil
end
state = s
Audio.fade(reelSound, s == "bite" and 1 or 0, s == "bite" and 0.2 or 0.4)
statusLabel.Visible = (s == "waiting")
mgFrame.Visible = (s == "bite")
gauge.Visible = (s == "charging")
setMovementLocked(s ~= "idle")
if s == "idle" then
stopFishCam()
elseif s == "reeling" then
-- на случай, если сервер не ответит на вытаскивание: не оставляем игрока замороженным
local token = {}
reelToken = token
task.delay(4, function()
if state == "reeling" and reelToken == token then
setState("idle")
end
end)
end
end
local function updatePips()
pipsText.Text = "🎯 " .. string.rep("<font color=\"#7CFF9A\">●</font>", mg.hits) .. string.rep("<font color=\"#6E5A44\">●</font>", mg.need - mg.hits)
missText.Text = string.rep("<font color=\"#6E5A44\">✖</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 = C.dark }):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 startCharge(tool)
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if not hrp then
return
end
local world = Config.WorldAt(hrp.Position)
-- из воды и издалека не заряжаем вовсе: сразу подсказка
local can = Config.CanCastFrom(world, hrp.Position, player.Character:FindFirstChildOfClass("Humanoid"))
if can ~= true then
notify(can, Color3.fromRGB(255, 200, 120))
return
end
local dir = Config.CastDirection(world, hrp.Position)
if not dir then
dir = hrp.CFrame.LookVector * Vector3.new(1, 0, 1)
dir = dir.Magnitude > 0.01 and dir.Unit or Vector3.new(0, 0, -1)
end
hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + dir)
charge = { t0 = os.clock(), tool = tool }
setState("charging")
startChargeCam(tool, dir)
updateCharge()
end
-- ЛКМ отпущена: бросок с набранной силой
local function releaseCast()
if state ~= "charging" or not charge then
return
end
local power = chargePower()
castTool = charge.tool
charge = nil -- удочку не возвращаем: сервер сам сделает рывок вперёд
setState("casting")
remote:FireServer("Cast", power)
end
local function onActivate()
if 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(function()
if state == "idle" then
startCharge(tool)
else
onActivate()
end
end)
tool.Deactivated:Connect(releaseCast)
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()
if state == "charging" and charge then
updateCharge()
end
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
-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств Terrain
local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) }
local defaultTerrainColors = nil
-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа
local lookTargets = {
lighting = function() return Lighting end,
atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end,
color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end,
bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end,
sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end,
dof = function()
return Lighting:FindFirstChildOfClass("DepthOfFieldEffect")
or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting })
end,
grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end,
}
local lookDefaults = {}
-- лобби настраивается так же, как миры
local lookSources = table.clone(Config.Worlds)
table.insert(lookSources, Config.Lobby)
-- смена света: плавно или сразу (за экраном загрузки)
local lookTweens = {}
local function setLook(obj, goal, instant)
if instant then
for prop, v in pairs(goal) do
obj[prop] = v
end
else
local tw = TweenService:Create(obj, TweenInfo.new(2), goal)
table.insert(lookTweens, tw)
tw:Play()
end
end
-- погода сгущает дымку поверх настроек локации (туман — сильно, дождь и гроза — слегка)
local WEATHER_ATMO = {
Fog = { Density = 0.22, Haze = 1.5 },
Rain = { Density = 0.06, Haze = 0.4 },
Storm = { Density = 0.12, Haze = 0.8 },
}
local function weatherAtmo(prop)
local add = WEATHER_ATMO[workspace:GetAttribute("Weather") or ""]
return (add and add[prop]) or 0
end
local function applyLook(world, instant)
-- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз
for _, w in ipairs(lookSources) do
for section, props in pairs(w.look or {}) do
local obj = lookTargets[section] and lookTargets[section]()
if obj then
lookDefaults[section] = lookDefaults[section] or {}
for prop in pairs(props) do
if lookDefaults[section][prop] == nil then
lookDefaults[section][prop] = obj[prop]
end
end
end
end
end
local look = (world and world.look) or {}
for section, defaults in pairs(lookDefaults) do
local obj = lookTargets[section]()
if obj then
local goal = {}
for prop, def in pairs(defaults) do
local v = look[section] and look[section][prop]
if v == nil then v = def end
if section == "atmosphere" and typeof(v) == "number" then
v += weatherAtmo(prop)
end
-- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу
local kind = typeof(v)
if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end
end
setLook(obj, goal, instant)
end
end
end
local function applyAmbience(world, instant)
-- прошлая плавная смена ещё может идти — она перебила бы новые значения
for _, tw in ipairs(lookTweens) do
tw:Cancel()
end
table.clear(lookTweens)
world = world or Config.Lobby
-- при смене суток часы двигает Ambience; иначе у каждой локации своё время
if not Config.DayNight.enabled then
setLook(Lighting, { ClockTime = (world and world.clock) or 14.5 }, instant)
end
local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
if cc then
setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant)
end
-- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе
if not defaultTerrainColors then
defaultTerrainColors = {}
for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do
defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name])
end
end
local colors = (world and world.terrainColors) or {}
for name, def in pairs(defaultTerrainColors) do
terrain:SetMaterialColor(Enum.Material[name], colors[name] or def)
end
local atm = Lighting:FindFirstChildOfClass("Atmosphere")
if atm then
local frost = world and world.id == "World3"
setLook(atm, {
Density = frost and 0.38 or 0.25,
Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232),
}, instant)
end
applyLook(world, instant)
snow.Rate = (world and world.id == "World3") and 140 or 0
end
-- тёмные силуэты рыб под прозрачной водой «Тихого озера», медленно плавают по кругу (только у этого игрока)
do
local w1 = Config.Worlds[1]
local fishList = Config.Zones.World1.fish
local frng = Random.new(11)
local folder = new("Folder", { Name = "FishShadows", Parent = workspace })
local swimmers = {}
for i = 1, 10 do
local l = w1.lakes[(i - 1) % #w1.lakes + 1]
local ok, model = pcall(Models.buildFish, fishList[(i - 1) % #fishList + 1].id, nil, frng:NextNumber(1.3, 2), true)
if ok and model then
for _, d in ipairs(model:GetDescendants()) do
if d:IsA("BasePart") then
d.Color = Color3.fromRGB(22, 70, 74)
d.Material = Enum.Material.SmoothPlastic
d.Transparency = 0.5
d.CanCollide, d.CanQuery, d.CanTouch, d.CastShadow = false, false, false, false
elseif d:IsA("Decal") or d:IsA("ParticleEmitter") or d:IsA("Light") then
d:Destroy()
end
end
model.Parent = folder
table.insert(swimmers, {
model = model,
c = w1.center + Vector3.new(l[1] + frng:NextNumber(-l[3], l[3]) * 0.25, w1.waterY - frng:NextNumber(1.4, 2.4), l[2] + frng:NextNumber(-l[3], l[3]) * 0.25),
r = l[3] * frng:NextNumber(0.25, 0.55), a = frng:NextNumber(0, math.pi * 2),
w = frng:NextNumber(0.08, 0.18) * (frng:NextNumber() < 0.5 and -1 or 1),
})
end
end
local acc = 0
RunService.Heartbeat:Connect(function(dt)
acc += dt
if acc < 1 / 30 then
return
end
local step = acc
acc = 0
local w = currentWorld()
if not (w and w.id == "World1") then
return
end
for _, s in ipairs(swimmers) do
s.a += s.w * step
local pos = s.c + Vector3.new(math.cos(s.a) * s.r, math.sin(s.a * 3) * 0.2, math.sin(s.a) * s.r)
local dir = Vector3.new(-math.sin(s.a), 0, math.cos(s.a)) * math.sign(s.w)
-- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90°
s.model:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0))
end
end)
end
-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку
local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10)
local function loadingVisible()
return loadingGui ~= nil and loadingGui.Enabled
end
local function placeTitle(w)
return w and (w.icon .. " " .. w.name) or "🏠 Лобби"
end
local function enterWorld(w, instant)
lastWorldId = w and w.id or "lobby"
applyAmbience(w, instant)
if w then
-- название локации — когда экран загрузки уже ушёл
task.spawn(function()
while loadingVisible() do
task.wait(0.1)
end
notify(w.icon .. " " .. w.name, w.color)
end)
end
end
-- погода сменилась: плавно пересчитываем дымку текущей локации
workspace:GetAttributeChangedSignal("Weather"):Connect(function()
if lastWorldId ~= "none" and not loadingVisible() then
applyAmbience(currentWorld(), false)
end
end)
-- новый уровень — арфа
do
local lastLevel = player:GetAttribute("Level")
player:GetAttributeChangedSignal("Level"):Connect(function()
local lv = player:GetAttribute("Level")
if lastLevel and lv and lv > lastLevel then
Audio.play("levelUp")
end
lastLevel = lv
end)
end
-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки
task.spawn(function()
local char = player.Character or player.CharacterAdded:Wait()
char:WaitForChild("HumanoidRootPart", 30)
local w = currentWorld()
enterWorld(w, true)
if loadingGui then
loadingGui:SetAttribute("Title", placeTitle(w))
loadingGui:SetAttribute("Ready", true)
end
end)
-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу
local teleportToken = 0
local function teleportLoading(targetId, delay)
teleportToken += 1
local token = teleportToken
local target = Config.Find(Config.Worlds, targetId)
if loadingGui then
local now = os.clock()
loadingGui:SetAttribute("Ready", false)
loadingGui:SetAttribute("StartAt", now)
loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport)
loadingGui:SetAttribute("Title", placeTitle(target))
loadingGui:SetAttribute("Visible", true)
end
task.spawn(function()
-- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд)
local deadline = os.clock() + delay + 3
local w
repeat
task.wait()
w = currentWorld()
until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken
if token ~= teleportToken then
return
end
enterWorld(w, true)
if loadingGui then
loadingGui:SetAttribute("Ready", true)
end
end)
end
task.spawn(function()
while true do
local w = currentWorld()
local id = w and w.id or "lobby"
if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then
enterWorld(w, false) -- без телепорта (например, после возрождения): плавно
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)
---------------------------------------------------------------- обучение: линия-подсказка
-- белые «стрелки» бегут по земле от игрока к цели текущего шага (см. Config.TutorialDone)
local GUIDE_N, GUIDE_GAP, GUIDE_SPEED = 32, 3, 7 -- сколько стрелок, шаг между ними, скорость бега
local guideStep = 0 -- шаг, отправленный на сервер (атрибут Tutorial может прийти чуть позже)
-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает»
local guideHint, guideHintText = softPlate(
{ Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = screen },
{ TextSize = 42, Text = "" }
)
wobble(guideHint, 1.2, 1.6)
Theme.onLayout(function(compact)
guideHintText.TextSize = compact and 30 or 42
end)
local lastHint = nil
local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace })
local chevrons = {}
for i = 1, GUIDE_N do
local arms = {}
for k = 1, 2 do
arms[k] = new("Part", {
Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false,
Material = Enum.Material.Neon, Color = Color3.fromRGB(70, 195, 255), Size = Vector3.new(0.5, 0.5, 2), Transparency = 1,
Parent = guideFolder,
})
end
chevrons[i] = arms
end
-- два объёмных бруска стрелки «>» острием вперёд (по -Z)
local GUIDE_HEIGHT = 2.2 -- стрелки висят в воздухе над землёй
local ARM_CF = {}
for k, s in ipairs({ -1, 1 }) do
local center = Vector3.new(s * 0.65, 0, -0.15)
ARM_CF[k] = CFrame.lookAt(center, center + Vector3.new(s * 1.3, 0, 1.5))
end
local function hideChevrons(from)
for i = from, GUIDE_N do
chevrons[i][1].Transparency = 1
chevrons[i][2].Transparency = 1
end
end
local guideRay = RaycastParams.new()
guideRay.FilterType = Enum.RaycastFilterType.Exclude
guideRay.RespectCanCollide = true
guideRay.IgnoreWater = false
local function tutorialStep()
return math.max(player:GetAttribute("Tutorial") or 0, guideStep)
end
local function advanceTutorial(step)
if step > tutorialStep() then
guideStep = step
remote:FireServer("Tutorial", step)
if step >= Config.TutorialDone then
notify("🎓 Обучение пройдено!", C.gold)
end
end
end
local function guideMarker(name)
local map = workspace:FindFirstChild("FishingMap")
local m = map and map:FindFirstChild(name, true) -- маркеры могут лежать в папках уровня (World1Map)
return m and m.Position
end
-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder);
-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается
local guideHighlight = new("Highlight", {
FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255),
DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder,
})
local guideObjects, guideScanAt = {}, {}
local function guideObject(key)
local obj = guideObjects[key]
if obj and obj.Parent then
return obj
end
-- карта большая: если объекта нет (ещё не загрузился), ищем заново не чаще раза в 2 секунды
if guideScanAt[key] and os.clock() - guideScanAt[key] < 2 then
return nil
end
guideScanAt[key] = os.clock()
local map = workspace:FindFirstChild("FishingMap")
if not map then
return nil
end
for _, d in ipairs(map:GetDescendants()) do
if d:GetAttribute("GuideTarget") == key then
guideObjects[key] = d
return d
end
end
return nil
end
-- первый подход к табличке: камера крупно на табличку, управление и весь интерфейс убраны;
-- кнопка «Далее» плавно возвращает камеру, интерфейс и управление
local StarterGui = game:GetService("StarterGui")
local BOARD_CAM_TIME, BOARD_FOV = 0.8, 70
local boardView = nil
local closeBoardView
-- кнопка в отдельном ScreenGui: основной интерфейс на это время выключается целиком
local boardGui = new("ScreenGui", { Name = "BoardView", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, Enabled = false, Parent = player:WaitForChild("PlayerGui") })
btn({
Size = UDim2.fromOffset(240, 60), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -40),
BackgroundColor3 = C.green, Text = "Далее ▶", TextSize = 26, Parent = boardGui,
}, function()
closeBoardView()
end)
local function setInterfaceHidden(hidden)
gui.Enabled = not hidden
boardGui.Enabled = hidden
pcall(function()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden)
end)
-- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было
if hidden then
boardView.billboards = {}
local map = workspace:FindFirstChild("FishingMap")
for _, d in ipairs(map and map:GetDescendants() or {}) do
if d:IsA("BillboardGui") and d.Enabled then
d.Enabled = false
table.insert(boardView.billboards, d)
end
end
elseif boardView and boardView.billboards then
for _, d in ipairs(boardView.billboards) do
d.Enabled = true
end
boardView.billboards = nil
end
end
local function boardCamStep()
local bv, cam = boardView, workspace.CurrentCamera
if not bv or not cam then
return
end
local e = easeInOut(math.min(1, (os.clock() - bv.t0) / BOARD_CAM_TIME))
cam.CFrame = bv.fromCF:Lerp(bv.toCF, e)
cam.FieldOfView = bv.fromFov + (bv.toFov - bv.fromFov) * e
if bv.returning and e >= 1 then
RunService:UnbindFromRenderStep("BoardCam")
cam.CameraType = Enum.CameraType.Custom
setInterfaceHidden(false)
boardView = nil
setMovementLocked(false)
end
end
local function openBoardView(board)
local cam = workspace.CurrentCamera
-- отходим ровно настолько, чтобы табличка целиком влезла в кадр (по высоте и по ширине) с небольшим запасом
local half = math.tan(math.rad(BOARD_FOV / 2))
local aspect = cam.ViewportSize.X / math.max(1, cam.ViewportSize.Y)
local dist = math.max((board.Size.Y / 2) / half, (board.Size.X / 2) / (half * aspect)) * 1.15
boardView = {
t0 = os.clock(), origCF = cam.CFrame, origFov = cam.FieldOfView,
fromCF = cam.CFrame, fromFov = cam.FieldOfView,
-- надписи на лицевой стороне (Front), она смотрит по LookVector
toCF = CFrame.lookAt(board.Position + board.CFrame.LookVector * dist, board.Position), toFov = BOARD_FOV,
}
setMovementLocked(true)
setInterfaceHidden(true)
cam.CameraType = Enum.CameraType.Scriptable
RunService:UnbindFromRenderStep("BoardCam")
RunService:BindToRenderStep("BoardCam", Enum.RenderPriority.Camera.Value + 1, boardCamStep)
end
closeBoardView = function()
local cam = workspace.CurrentCamera
if not boardView or boardView.returning or not cam then
return
end
boardGui.Enabled = false -- кнопка пропадает сразу, остальной интерфейс — когда камера вернётся
boardView.returning = true
boardView.t0 = os.clock()
boardView.fromCF, boardView.fromFov = cam.CFrame, cam.FieldOfView
boardView.toCF, boardView.toFov = boardView.origCF, boardView.origFov
advanceTutorial(1)
end
-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"),
-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант
local function sellTargetW1()
local shop = guideObject("Sell")
if shop then
for _, d in ipairs(shop:GetDescendants()) do
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then
local p = d.Parent
local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition)
if at then
return at
end
end
end
return shop:IsA("Model") and shop:GetPivot().Position or shop.Position
end
return guideMarker("GuideSell")
end
-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем
local function guideRoute(step, pos, world)
local inW1 = world and world.id == "World1"
if step == 0 and not world then
return { guideMarker("GuideBoard") }, "📋 Прочитай табличку", "Board"
elseif not world then -- шаги 1–3 из лобби: сначала в портал
return { guideMarker("GuidePortal") }, "🌊 Иди в портал", "Portal"
elseif step == 2 and inW1 then
return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier"
elseif step == 3 and inW1 then
return { sellTargetW1() }, "⚪ Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую
end
return nil
end
-- ближайшая скупка в этом мире (или в лобби): прилавки с ProximityPrompt Action = "Sell"
local nearestSell
do
local sellSpots, sellScanAt = {}, -math.huge
nearestSell = function(pos, world)
if #sellSpots == 0 and os.clock() - sellScanAt > 3 then
sellScanAt = os.clock()
local map = workspace:FindFirstChild("FishingMap")
for _, d in ipairs(map and map:GetDescendants() or {}) do
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then
local p = d.Parent
local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) or (p:IsA("Model") and p:GetPivot().Position)
if at then
table.insert(sellSpots, at)
end
end
end
end
local best, bestD = nil, nil
for _, at in ipairs(sellSpots) do
if Config.WorldAt(at) == world then
local d = (at - pos).Magnitude
if not bestD or d < bestD then
best, bestD = at, d
end
end
end
return best
end
end
RunService.RenderStepped:Connect(function()
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
local step = tutorialStep()
-- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем;
-- после обучения линия ведёт к скупщику, когда сумка полна
local tutorialOn = player:GetAttribute("Tutorial") ~= nil and step < Config.TutorialDone
local bagFull = (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge)
if not hrp or not (tutorialOn or bagFull) then
guideHint.Visible = false
guideHighlight.Enabled = false
hideChevrons(1)
return
end
if boardView then -- смотрим на табличку: ни линии, ни подсказок
guideHint.Visible = false
guideHighlight.Enabled = false
hideChevrons(1)
return
end
local pos = hrp.Position
local world = Config.WorldAt(pos)
-- переходы между шагами
if not tutorialOn then
-- обучение пройдено, остаётся только дорога к скупщику
elseif step <= 1 and world and world.id == "World1" then
advanceTutorial(2)
elseif step == 0 then
local board = guideMarker("GuideBoard")
if board and (board - pos).Magnitude < 9 and state == "idle" then
local obj = guideObject("Board")
if obj then
openBoardView(obj) -- шаг засчитается по кнопке «Далее»
return
end
advanceTutorial(1)
end
elseif step == 2 and (player:GetAttribute("TotalCaught") or 0) > 0 then
advanceTutorial(3)
end
step = tutorialStep()
local route, hint, key
if tutorialOn then
route, hint, key = guideRoute(step, pos, world)
end
if not route and bagFull then
local inW1 = world and world.id == "World1"
local at = (inW1 and sellTargetW1()) or nearestSell(pos, world)
route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil
end
guideHintText.Text = hint or ""
local showHint = hint ~= nil and state == "idle"
if showHint and (hint ~= lastHint or not guideHint.Visible) then
popIn(guideHint, 0.5)
end
lastHint = hint
guideHint.Visible = showHint
local target = (key and state == "idle") and guideObject(key) or nil
guideHighlight.Adornee = target or nil
guideHighlight.Enabled = target ~= nil
if target then
local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание
guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден
guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse
end
if not route or #route == 0 or state ~= "idle" then
hideChevrons(1)
return
end
-- ломаная от ног игрока через точки маршрута
local pts = { pos - Vector3.new(0, 3, 0) }
for _, p in ipairs(route) do
table.insert(pts, p)
end
local lens, total = {}, 0
for i = 2, #pts do
local d = ((pts[i] - pts[i - 1]) * Vector3.new(1, 0, 1)).Magnitude
lens[i] = math.max(d, 0.001)
total += d
end
if total < 4 then
hideChevrons(1) -- уже на месте
return
end
guideRay.FilterDescendantsInstances = { player.Character, guideFolder }
local phase = (os.clock() * GUIDE_SPEED) % GUIDE_GAP
local seg, segStart = 2, 0
for i = 1, GUIDE_N do
local d = 2 + phase + (i - 1) * GUIDE_GAP
if d > total - 1 then
hideChevrons(i)
break
end
while seg < #pts and d > segStart + lens[seg] do
segStart += lens[seg]
seg += 1
end
local a, b = pts[seg - 1], pts[seg]
local p = a:Lerp(b, (d - segStart) / lens[seg])
local dir = (b - a) * Vector3.new(1, 0, 1)
local hit = workspace:Raycast(p + Vector3.new(0, 4, 0), Vector3.new(0, -12, 0), guideRay)
-- висят в воздухе и слегка покачиваются волной
local y = (hit and hit.Position.Y or p.Y) + GUIDE_HEIGHT + math.sin(os.clock() * 4 - d * 0.5) * 0.25
local base = CFrame.lookAt(Vector3.new(p.X, y, p.Z), Vector3.new(p.X, y, p.Z) + dir)
-- у игрока и у цели стрелки плавно проявляются и гаснут
local fade = math.max(0, 1 - math.min(d - 2, total - 1 - d) / 2.5)
local tr = 0.05 + 0.95 * fade
for k = 1, 2 do
chevrons[i][k].CFrame = base * ARM_CF[k]
chevrons[i][k].Transparency = tr
end
end
end)
---------------------------------------------------------------- цели на экране: серия, трекер, босс, покупка у скупщика
-- в отдельной функции: у основного скрипта почти исчерпан лимит в 200 локальных переменных
local refreshTracker, bestOffer, showOffer
local offerState = { bagWasFull = false } -- была ли сумка полной перед продажей (тогда первым предлагаем сумку побольше)
;(function()
local CENTER = Enum.TextXAlignment.Center
local RIGHT = Enum.TextXAlignment.Right
local FIRE = Color3.fromRGB(255, 150, 60)
-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит
local comboBox = new("Frame", {
Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = screen,
}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) })
local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox })
local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox })
local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = C.dark, Parent = comboBox }, { corner(3) })
local comboFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = FIRE, BorderSizePixel = 0, Parent = comboBack }, { corner(3) })
local function refreshCombo(pop)
local n = player:GetAttribute("Combo") or 0
comboBox.Visible = n > 0
if n > 0 then
-- множитель следующей рыбы (сервер считает так же)
comboMultText.Text = ("🔥 x%.1f"):format(math.min(Config.Combo.max, 1 + Config.Combo.step * n))
comboSub.Text = ("серия %d · не упусти!"):format(n)
if pop then
popIn(comboBox, 0.6)
end
end
end
player:GetAttributeChangedSignal("Combo"):Connect(function()
refreshCombo(true)
end)
refreshCombo(false)
-- правая колонка: босс и цели
local rightCol = new("Frame", {
Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 10),
BackgroundTransparency = 1, Parent = screen,
}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
-- на телефоне колонка выше и мельче, чтобы не заходить на кнопку прыжка; серия — правее компактного HUD
local rightScale = new("UIScale", { Parent = rightCol })
Theme.onLayout(function(compact)
rightScale.Scale = compact and 0.8 or 1
rightCol.AnchorPoint = compact and Vector2.new(1, 0) or Vector2.new(1, 0.5)
rightCol.Position = compact and UDim2.new(1, -8, 0, 128) or UDim2.new(1, -12, 0.5, 10)
comboBox.Position = compact and UDim2.fromOffset(254, 6) or UDim2.fromOffset(310, 10)
end)
local bossBox = new("Frame", { Size = UDim2.fromOffset(300, 78), BackgroundColor3 = WHITE, Visible = false, LayoutOrder = 1, Parent = rightCol },
{ corner(14), stroke(C.red, 2.5, 0.05), gradient(Color3.fromRGB(110, 30, 40), C.bg, 90) })
local bossTitle = text({ Size = UDim2.new(1, -80, 0, 24), Position = UDim2.fromOffset(12, 5), Font = TITLE, TextSize = 18, TextColor3 = Color3.fromRGB(255, 205, 120), TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = bossBox })
local bossTime = text({ Size = UDim2.fromOffset(60, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 5), Font = TITLE, TextSize = 17, TextXAlignment = RIGHT, Text = "", Parent = bossBox })
local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = C.dark, Parent = bossBox }, { corner(9) })
local bossFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, Parent = bossBack }, { corner(9), gradient(Color3.fromRGB(255, 120, 90), Color3.fromRGB(190, 30, 50), 0) })
local bossHpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, ZIndex = 2, TextStrokeTransparency = 0.5, Text = "", Parent = bossBack })
local bossHint = text({ Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 54), Font = BODY2, TextSize = 12, TextColor3 = C.muted, Text = "", Parent = bossBox })
local tracker = new("Frame", { Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundColor3 = WHITE, LayoutOrder = 2, Parent = rightCol }, {
corner(14), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90),
new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 10) }),
new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }),
})
text({ Size = UDim2.new(1, 0, 0, 20), LayoutOrder = 0, Font = TITLE, TextSize = 16, TextColor3 = C.muted, Text = "🎯 Цели", Parent = tracker })
local function trackerLine(order, onClick)
local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker })
local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = root })
local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = C.dark, Parent = root }, { corner(4) })
local fill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = back }, { corner(4) })
if onClick then
root.MouseButton1Click:Connect(onClick)
end
return { root = root, label = label, back = back, fill = fill }
end
local function setLine(line, txt, frac, color)
line.root.Visible = txt ~= nil
if not txt then
return
end
line.label.Text = txt
line.back.Visible = frac ~= nil
line.root.Size = UDim2.new(1, 0, 0, frac and 38 or 22)
if frac then
line.fill.Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1)
line.fill.BackgroundColor3 = color or C.gold
end
end
local questLine = trackerLine(1, function()
questWin.open("quests")
end)
local buyLine = trackerLine(2, function()
shopWin.open("rods")
end)
local dexLine = trackerLine(3, function()
bagWin.open("dex")
end)
local bagLine = trackerLine(4, function()
bagWin.open("fish")
end)
local function plural(n, one, few, many)
local m10, m100 = n % 10, n % 100
if m10 == 1 and m100 ~= 11 then
return one
elseif m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14) then
return few
end
return many
end
-- ближайшая покупка: следующая удочка, а когда все куплены — улучшение текущей
local function buyGoal()
local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1
local owned = attrSet("OwnedRods")
for _, r in ipairs(Config.Rods) do
if not owned[r.id] then
if lvl < r.level then
return ("🎣 %s · 🔒 нужен ур. %d"):format(r.name, r.level), lvl / r.level, C.blue
elseif coins >= r.price then
return ("🎣 <b>%s</b> — можно купить!"):format(r.name), 1, C.green
end
return ("🎣 До «%s»: ещё <b>%s</b> ⚪"):format(r.name, fmt(r.price - coins)), coins / r.price, C.gold
end
end
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
local rl = player:GetAttribute("RodLevel") or 0
if rod and rl < Config.RodUpgrade.maxLevel then
local cost = Config.UpgradeCost(rod, rl)
if coins >= cost then
return ("✨ Улучшение до +%d — можно купить!"):format(rl + 1), 1, C.green
end
return ("✨ До улучшения +%d: ещё <b>%s</b> ⚪"):format(rl + 1, fmt(cost - coins)), coins / cost, C.gold
end
return nil
end
-- коллекция текущего мира: ближайшая незакрытая редкость
local function dexGoal()
local w = currentWorld() or Config.Worlds[1]
local zone = Config.Zones[w.id]
if not zone then
return nil
end
for _, rarity in ipairs(Config.RarityOrder) do
local total, found, missing = 0, 0, {}
for _, f in ipairs(zone.fish) do
if f.rarity == rarity then
total += 1
if discovered[f.id] then
found += 1
else
table.insert(missing, f.name)
end
end
end
if total > 0 and not claimed[w.id .. ":" .. rarity] then
local r = Config.Rarities[rarity]
if found >= total then
return ("📖 Награда за «%s» ждёт! (C)"):format(r.name), 1, C.green
end
local left = total - found
local what = left == 1 and ("осталась <b>%s</b>"):format(missing[1]) or ("ещё %d %s"):format(left, plural(left, "вид", "вида", "видов"))
return ("📖 «%s»: %s"):format(r.name, what), found / total, r.color
end
end
return nil
end
local lastQuestKey = nil
refreshTracker = function()
if chain and chain.steps[chain.step] then
local st = chain.steps[chain.step]
setLine(questLine, ("📜 %s · <b>%s/%s</b>"):format(questText(st.kind, st.goal), fmt(chain.progress), fmt(st.goal)), chain.progress / st.goal, C.gold)
local key = chain.name .. chain.step
if key ~= lastQuestKey then
if lastQuestKey then
popIn(questLine.root, 0.6)
end
lastQuestKey = key
end
else
setLine(questLine, nil)
end
setLine(buyLine, buyGoal())
setLine(dexLine, dexGoal())
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
if count >= cap then
setLine(bagLine, ("<font color=\"#FF8080\">🎒 Сумка полна — продай рыбу!</font>"), 1, C.red)
elseif count >= cap * 0.75 then
setLine(bagLine, ("🎒 Сумка почти полна: %d / %d"):format(count, cap), count / cap, Color3.fromRGB(255, 170, 80))
else
setLine(bagLine, nil)
end
end
task.spawn(function()
while true do
refreshTracker()
task.wait(0.5)
end
end)
-- босс: полоска здоровья и таймер
local function bossWorld()
local id = workspace:GetAttribute("BossWorld")
return id and Config.Find(Config.Worlds, id)
end
RunService.RenderStepped:Connect(function()
if comboBox.Visible then
local ends = player:GetAttribute("ComboEnds")
local left = ends and (ends - workspace:GetServerTimeNow()) or 0
comboFill.Size = UDim2.fromScale(math.clamp(left / Config.Combo.timeout, 0, 1), 1)
comboFill.BackgroundColor3 = left < 15 and C.red or FIRE
end
local bw = bossWorld()
bossBox.Visible = bw ~= nil
if bw then
local hp, max = workspace:GetAttribute("BossHP") or 0, math.max(1, workspace:GetAttribute("BossMax") or 1)
bossTitle.Text = "👑 " .. (workspace:GetAttribute("BossName") or "Босс")
bossTime.Text = timeStr((workspace:GetAttribute("BossEnds") or 0) - workspace:GetServerTimeNow())
bossFill.Size = UDim2.fromScale(math.clamp(hp / max, 0, 1), 1)
bossHpText.Text = ("%d / %d"):format(hp, max)
local here = currentWorld()
bossHint.Text = (here and here.id == bw.id) and "Лови рыбу — каждая бьёт босса! Редкие сильнее" or ("Он в мире «%s» — жми M"):format(bw.name)
end
end)
-- босс в воде: огромная рыба кружит по озеру и выпрыгивает (у каждого игрока своя копия, только для вида)
local bossModel, bossModelWorld = nil, nil
local function bossPath(world)
if world.lakes and not world.holes then
local l = world.lakes[1]
return world.center + Vector3.new(l[1], 0, l[2]), l[3] * 0.5
elseif world.sea then
return world.center, world.sea + 35
end
return nil -- Мир 3: босс подо льдом, его не видно
end
RunService.Heartbeat:Connect(function()
local bw = bossWorld()
local id = bw and bw.id
if id ~= bossModelWorld then
if bossModel then
bossModel:Destroy()
bossModel = nil
end
bossModelWorld = id
local def = id and Config.Boss.worlds[id]
if def and bossPath(bw) then
bossModel = Models.buildFish(def.fish, def.mutation, def.scale, true)
for _, p in ipairs(bossModel:GetDescendants()) do
if p:IsA("BasePart") then
p.CanCollide, p.CanQuery, p.CanTouch = false, false, false
end
end
bossModel.Name = "LakeBoss"
bossModel.Parent = workspace
end
end
if bossModel then
local center, r = bossPath(bw)
local a = os.clock() * 0.35
local pos = center + Vector3.new(math.cos(a) * r, (bw.waterY or 0) - 0.8, math.sin(a) * r)
local jump = os.clock() % 7
if jump < 1.4 then
pos += Vector3.new(0, math.sin(jump / 1.4 * math.pi) * 9, 0)
end
local dir = Vector3.new(-math.sin(a), 0, math.cos(a))
-- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90°
bossModel:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0))
end
end)
-- у скупщика после продажи: предложение купить то, на что уже хватает
local offerCard = new("Frame", {
Size = UDim2.fromOffset(440, 96), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110),
BackgroundColor3 = WHITE, Visible = false, Parent = screen,
}, { corner(16), stroke(C.green, 2.5, 0.05), gradient(Color3.fromRGB(30, 85, 55), C.bg, 90) })
local offerIcon = text({ Size = UDim2.fromOffset(70, 70), Position = UDim2.fromOffset(12, 13), TextSize = 46, TextXAlignment = CENTER, Text = "", Parent = offerCard })
local offerTitle = text({ Size = UDim2.new(1, -250, 0, 26), Position = UDim2.fromOffset(90, 12), Font = TITLE, TextSize = 19, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = offerCard })
local offerDesc = text({ Size = UDim2.new(1, -250, 0, 44), Position = UDim2.fromOffset(90, 40), Font = BODY2, TextSize = 13, TextColor3 = C.muted, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = "", Parent = offerCard })
local offerItem, offerToken = nil, 0
local function hideOffer()
offerCard.Visible = false
offerItem = nil
end
local offerBuy = btn({ Size = UDim2.fromOffset(146, 52), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, TextSize = 18, Text = "", Parent = offerCard }, function()
if offerItem then
remote:FireServer("Buy", offerItem.kind, offerItem.id)
Audio.play("coins")
end
hideOffer()
end)
btn({ Size = UDim2.fromOffset(26, 26), Position = UDim2.new(1, -18, 0, -8), BackgroundColor3 = C.red, Text = "×", TextSize = 22, Parent = offerCard }, hideOffer)
bestOffer = function(bagWasFull)
local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1
local options = {}
local bag = Config.Find(Config.Bags, player:GetAttribute("Bag") or "Pouch")
local ownedBags = attrSet("OwnedBags")
for _, b in ipairs(Config.Bags) do
if not ownedBags[b.id] and b.capacity > (bag and bag.capacity or 0) and lvl >= b.level and coins >= b.price then
table.insert(options, { kind = "Bag", id = b.id, icon = "🎒", title = b.name, price = b.price, prio = bagWasFull and 3 or 1,
desc = ("%d мест вместо %d — реже бегать к скупщику"):format(b.capacity, bag and bag.capacity or 0) })
break
end
end
local ownedRods = attrSet("OwnedRods")
local bestRod = nil
for _, r in ipairs(Config.Rods) do
if not ownedRods[r.id] and lvl >= r.level and coins >= r.price then
bestRod = r -- удочки по возрастанию цены: берём самую сильную из доступных
end
end
if bestRod then
table.insert(options, { kind = "Rod", id = bestRod.id, icon = "🎣", title = bestRod.name, price = bestRod.price, prio = 2,
desc = ("Удача +%d%%, клюёт быстрее, шире зелёная зона"):format(bestRod.luck * 100) })
end
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
local rl = player:GetAttribute("RodLevel") or 0
if rod and rl < Config.RodUpgrade.maxLevel then
local cost = Config.UpgradeCost(rod, rl)
if coins >= cost then
table.insert(options, { kind = "Upgrade", id = rod.id, icon = "✨", title = ("%s +%d"):format(rod.name, rl + 1), price = cost, prio = 1.5,
desc = "Больше удачи и шире зелёная зона" })
end
end
local potion = Config.Potions[1]
if coins >= potion.price and (player:GetAttribute("BoostBonus") or 0) == 0 then
table.insert(options, { kind = "Potion", id = potion.id, icon = "🧪", title = potion.name, price = potion.price, prio = 0.5,
desc = ("+%d%% удачи на %d мин"):format(potion.bonus * 100, potion.duration / 60) })
end
table.sort(options, function(x, y)
return x.prio > y.prio
end)
return options[1]
end
showOffer = function(o)
offerToken += 1
local my = offerToken
offerItem = o
offerIcon.Text = o.icon
offerTitle.Text = o.title
offerDesc.Text = o.desc
offerBuy.Text = ("Купить · %s ⚪"):format(fmt(o.price))
offerCard.Visible = true
popIn(offerCard, 0.6)
task.delay(9, function()
if my == offerToken then
hideOffer()
end
end)
end
player:GetAttributeChangedSignal("BagCount"):Connect(function()
if (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) then
offerState.bagWasFull = true
end
end)
end)()
---------------------------------------------------------------- события от сервера
remote.OnClientEvent:Connect(function(action, a, b, c, d)
if action == "Notify" then
notify(a, b)
elseif action == "TeleportFade" then
teleportLoading(a, b)
elseif action == "Cast" then
Audio.play("cast")
setState("waiting")
startCastCam(a, b)
elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then
if action == "Escaped" then
Audio.play("escape")
end
if action == "CastFail" and castTool and castTool.Parent then
castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе
end
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()
Audio.play("bite")
setState("bite")
elseif action == "Caught" then
setState("idle")
showCatch(a, b)
Audio.play("catchSplash")
local r = Config.Rarities[a.rarity]
Audio.play((r and r.rank >= 4) and "fanfare" or "catch")
if a.mutation then
Audio.play("sparkle")
end
elseif action == "Sold" then
Audio.play("coins")
if tutorialStep() == 3 then
advanceTutorial(Config.TutorialDone)
end
floatText("+" .. fmt(a) .. " ⚪", C.gold)
notify(("⚪ +%s"):format(fmt(a)), Color3.fromRGB(120, 255, 140))
-- монеты приходят атрибутом чуть позже события, поэтому предложение — с задержкой
local wasFull = offerState.bagWasFull
offerState.bagWasFull = false
-- продать можно и с заброшенной удочкой; не мешаем только мини-игре поклёвки (она тоже внизу экрана)
task.delay(0.5, function()
local t0 = os.clock()
while state == "bite" and os.clock() - t0 < 10 do
task.wait(0.3)
end
local o = state ~= "bite" and bestOffer(wasFull)
if o then
showOffer(o)
end
end)
elseif action == "Inventory" then
inventory = a or {}
discovered = b or {}
claimed = c or {}
bagWin.refresh()
refreshDots()
refreshTracker()
elseif action == "Quests" then
chain = a
daily = b or daily
questWin.refresh()
refreshDots()
refreshTracker()
elseif action == "QuestDone" then
notify(("✅ %s +%s ⚪ +%s XP"):format(questText(a, b), fmt(c), fmt(d or 0)), Color3.fromRGB(120, 255, 140))
Audio.play("quest")
elseif action == "ChainDone" then
floatText("🏆 Цепочка пройдена!", C.gold)
notify(("🎁 %s: +%s ⚪ +%s XP%s"):format(a, fmt(b), fmt(c), d and (" + " .. d) or ""), C.gold)
Audio.play("fanfare")
elseif action == "ComboLost" then
notify(("💔 Серия из %d прервана"):format(a), Color3.fromRGB(255, 130, 110))
elseif action == "BossStart" then
notify(("👑 %s в мире «%s»! Ловите всем сервером"):format(a, b), C.gold)
Audio.play("quest")
elseif action == "BossHit" then
floatText(("⚔ -%d боссу"):format(a), Color3.fromRGB(255, 130, 100))
elseif action == "BossDone" then
if a then
notify(("🏆 %s пойман всем сервером!%s"):format(b, c and (" Лучший: " .. c) or ""), C.gold)
else
notify(("🌊 %s ушёл на глубину…"):format(b), C.muted)
end
elseif action == "BossReward" then
notify(("🎁 За босса: +%s ⚪ +%s XP%s"):format(fmt(a), fmt(b), c and (" + " .. c) or ""), Color3.fromRGB(120, 255, 140))
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>