экономика
This commit is contained in:
1 parent
296988b199
commit
58ae93f9e6
28 files changed
+6503
-299
No files matched your search
@@ -272,11 +272,12 @@ local side = new("Frame", {
|
||||
})
|
||||
|
||||
-- старые вызовы передают эмодзи — переводим в имя рисованной иконки
|
||||
H.MENU_ICON = { ["🎒"] = "bag", ["📖"] = "book", ["🌍"] = "map", ["📜"] = "scroll", ["💎"] = "crystal", ["⚙"] = "horn", ["⚔"] = "guild" }
|
||||
H.MENU_ICON = { ["🎒"] = "bag", ["📖"] = "book", ["🌍"] = "map", ["📜"] = "scroll", ["💎"] = "crystal", ["⚙"] = "horn", ["⚔"] = "guild", ["🏪"] = "coin" }
|
||||
H.MENU_TIP = {
|
||||
["Сумка"] = "Улов и продажа рыбы", ["Рыбы"] = "Коллекция и награды за неё", ["Миры"] = "Острова для рыбалки",
|
||||
["Задания"] = "Задания и ежедневная награда", ["Донат"] = "Наборы и усиления", ["Звук"] = "Громкость музыки и звуков",
|
||||
["Гильдия"] = "Ранг, заказы, наживка и ловушки",
|
||||
["Рынок"] = "Ценная рыба от других игроков этого сервера (с 8 уровня)",
|
||||
}
|
||||
local sideDots = {}
|
||||
local function sideButton(order, icon, label, key, color, onClick)
|
||||
@@ -463,14 +464,16 @@ local function showCatch(fish, extra)
|
||||
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.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! В коллекцию" 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 "")
|
||||
-- опыт карьеры фиксированный за мир; серия и отдых — надбавка к серебру
|
||||
catchValue.Text = ("⚪ %s%s%s%s"):format(fmt(fish.value), (fish.xp or 0) > 0 and (" ⭐ +%d XP"):format(fish.xp) or "",
|
||||
(extra and extra.combo and extra.combo > 1.001) and (" 🔥 +%d%%"):format(math.floor((extra.combo - 1) * 100 + 0.5)) or "",
|
||||
(extra and extra.rest) and " 🛌 +" .. math.floor(Config.Economy.restSilver * 100) .. "%" 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()
|
||||
@@ -826,8 +829,55 @@ local function progressBar(parent, pos, size, frac, color)
|
||||
return back
|
||||
end
|
||||
|
||||
-- окно подтверждения поверх всего: заголовок, текст (RichText), «Отмена» и кнопка действия.
|
||||
-- extra = { okColor, cancelText } (необязательно)
|
||||
do
|
||||
local dim = new("TextButton", { Name = "ConfirmDim", Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.45,
|
||||
AutoButtonColor = false, Text = "", Visible = false, ZIndex = 60, Modal = true, Parent = screen })
|
||||
local box = new("Frame", { Size = UDim2.new(1, -24, 0, 230), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), BackgroundColor3 = WHITE, ZIndex = 61, Parent = dim },
|
||||
{ corner(12), stroke(C.gold, 3, 0), Theme.woodGradient(C.wood, C.woodDark), new("UISizeConstraint", { MaxSize = Vector2.new(520, 300) }) })
|
||||
Theme.rivets(box, 9, 6)
|
||||
local title = text({ Size = UDim2.new(1, -32, 0, 34), Position = UDim2.fromOffset(16, 12), Font = TITLE, TextSize = 24, TextXAlignment = Enum.TextXAlignment.Center,
|
||||
TextColor3 = C.goldBright, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, ZIndex = 62, Parent = box })
|
||||
local body = text({ Size = UDim2.new(1, -36, 1, -122), Position = UDim2.fromOffset(18, 52), Font = BODY2, TextSize = 16, RichText = true, TextWrapped = true,
|
||||
TextYAlignment = Enum.TextYAlignment.Top, ZIndex = 62, Parent = box })
|
||||
local onOk = nil
|
||||
local cancel = btn({ Size = UDim2.new(0.5, -24, 0, 48), AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, 16, 1, -14), BackgroundColor3 = C.grey, Text = "Отмена", TextSize = 19, ZIndex = 62, Parent = box }, function()
|
||||
dim.Visible = false
|
||||
onOk = nil
|
||||
end)
|
||||
local ok = btn({ Size = UDim2.new(0.5, -24, 0, 48), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -16, 1, -14), BackgroundColor3 = C.green, Text = "OK", TextSize = 19, ZIndex = 62, Parent = box }, function()
|
||||
dim.Visible = false
|
||||
local f = onOk
|
||||
onOk = nil
|
||||
if f then
|
||||
f()
|
||||
end
|
||||
end)
|
||||
for _, b in ipairs({ cancel, ok }) do
|
||||
for _, d in ipairs(b:GetDescendants()) do
|
||||
if d:IsA("GuiObject") then
|
||||
d.ZIndex = 63
|
||||
end
|
||||
end
|
||||
end
|
||||
function H.confirm(titleText, bodyText, okText, fn, extra)
|
||||
title.Text = titleText
|
||||
body.Text = bodyText
|
||||
ok.Text = okText or "OK"
|
||||
ok.BackgroundColor3 = (extra and extra.okColor) or C.green
|
||||
cancel.Text = (extra and extra.cancelText) or "Отмена"
|
||||
onOk = fn
|
||||
dim.Visible = true
|
||||
popIn(box, 0.8)
|
||||
end
|
||||
end
|
||||
|
||||
-- помощники интерфейса для других скриптов (GuildClient): тот же стиль окон, кнопок и уведомлений
|
||||
Theme.kit = {
|
||||
confirm = function(...)
|
||||
H.confirm(...)
|
||||
end,
|
||||
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,
|
||||
@@ -846,7 +896,7 @@ local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRG
|
||||
{ id = "rods", label = "🎣 Удочки" },
|
||||
{ id = "upgrade", label = "✨ Улучшение" },
|
||||
{ id = "bags", label = "🎒 Сумки" },
|
||||
{ id = "luck", label = "🍀 Удача" },
|
||||
{ id = "luck", label = "🍀 Зелья" },
|
||||
})
|
||||
local shopLists = {
|
||||
rods = scrollArea(shopWin.pages.rods),
|
||||
@@ -962,6 +1012,77 @@ shopWin.render = function(tab)
|
||||
})
|
||||
end
|
||||
elseif tab == "luck" then
|
||||
-- зелья: действующее, сумка зелий (выпить), лавка (купить в сумку); внизу — из чего складывается удача
|
||||
local inv = {}
|
||||
for id, n in string.gmatch(player:GetAttribute("PotionInv") or "", "([^,:]+):(%d+)") do
|
||||
inv[id] = tonumber(n)
|
||||
end
|
||||
local activeId = player:GetAttribute("PotionActive")
|
||||
local active = activeId and Config.Find(Config.Potions, activeId)
|
||||
local left = player:GetAttribute("PotionLeft") or 0
|
||||
local function leftText(p, n)
|
||||
return p.charges and (n .. " попыток") or (timeStr(n) .. " игры")
|
||||
end
|
||||
local function drink(p)
|
||||
if active and active.id ~= p.id then
|
||||
-- замена: сервер всё равно спросит, но сразу показываем, что пропадёт
|
||||
H.confirm("🧪 Заменить зелье?", ("Сейчас действует <b>%s %s</b> — осталось <b>%s</b>.\nЕсли выпить <b>%s %s</b>, остаток прежнего зелья <font color=\"#FF8A7A\">пропадёт</font>.")
|
||||
:format(active.icon, active.name, leftText(active, left), p.icon, p.name), "Заменить", function()
|
||||
remote:FireServer("DrinkPotion", p.id, true)
|
||||
end)
|
||||
else
|
||||
remote:FireServer("DrinkPotion", p.id, false)
|
||||
end
|
||||
end
|
||||
local order = 0
|
||||
local function nextOrder()
|
||||
order += 1
|
||||
return order
|
||||
end
|
||||
Theme.section(list, nextOrder(), "Действует сейчас", "clover", "одно зелье за раз")
|
||||
if active then
|
||||
itemRow(list, nextOrder(), {
|
||||
icon = active.icon, iconBg = active.color:Lerp(C.bg, 0.6), title = active.name, titleColor = active.color,
|
||||
lines = active.desc .. ("\nОсталось: <b>%s</b>"):format(leftText(active, left)),
|
||||
strokeColor = C.gold, buttonText = "Действует", buttonColor = C.grey, active = false,
|
||||
})
|
||||
else
|
||||
text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = nextOrder(), Font = BODY2, TextSize = 15, TextColor3 = C.muted, TextWrapped = true,
|
||||
Text = "Ничего не действует. Попытка зелья тратится, когда рыба клюнула; отмена до поклёвки и автоловля зелья не тратят.", Parent = list })
|
||||
end
|
||||
local any = false
|
||||
for _, p in ipairs(Config.Potions) do
|
||||
if (inv[p.id] or 0) > 0 then
|
||||
if not any then
|
||||
Theme.section(list, nextOrder(), "Сумка зелий", "gift", "выпей, когда нужно")
|
||||
any = true
|
||||
end
|
||||
local same = active and active.id == p.id
|
||||
itemRow(list, nextOrder(), {
|
||||
icon = p.icon, iconBg = p.color:Lerp(C.bg, 0.6), title = ("%s <font color=\"#FFD45A\">×%d</font>"):format(p.name, inv[p.id]), titleColor = p.color,
|
||||
lines = p.desc .. "\n" .. (p.charges and (p.charges .. " попыток") or (math.floor(p.duration / 60) .. " минут игры")),
|
||||
buttonText = same and "Добавить" or "Выпить", buttonColor = same and C.blue or C.green, active = true,
|
||||
onClick = function()
|
||||
drink(p)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
Theme.section(list, nextOrder(), "Лавка зелий", "coin", "покупка — в сумку зелий")
|
||||
for _, p in ipairs(Config.Potions) do
|
||||
if p.price and not p.paid and not p.legacy then
|
||||
local bText, bColor, okBuy = buyButton(p.price, p.level or 1, myLevel, coins)
|
||||
itemRow(list, nextOrder(), {
|
||||
icon = p.icon, iconBg = p.color:Lerp(C.bg, 0.6), title = p.name, titleColor = p.color,
|
||||
lines = p.desc .. ("\n%d попыток · не даёт опыта, не обязательно для прогресса"):format(p.charges),
|
||||
buttonText = bText, buttonColor = bColor, active = okBuy,
|
||||
onClick = function()
|
||||
remote:FireServer("Buy", "Potion", p.id)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
-- из чего складывается удача
|
||||
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
|
||||
@@ -969,33 +1090,24 @@ shopWin.render = function(tab)
|
||||
local ps = attrSet("Passes")
|
||||
local evId = workspace:GetAttribute("Event")
|
||||
local event = evId and Config.Find(Config.Events, evId)
|
||||
local beff = Config.EffectiveLuck(total / 100)
|
||||
local mm = Config.MutationMult(beff, (event and event.mutation) or 1)
|
||||
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)))
|
||||
table.insert(mutLine, ("<font color=\"%s\">%s %.1f%%</font>"):format(hex(m.color), m.name, math.min(100, m.chance * mm * 100)))
|
||||
end
|
||||
local lines = {
|
||||
("<font size=\"24\" color=\"#7CFF9A\">🍀 Твоя удача: %d%%</font>"):format(total),
|
||||
("<font size=\"22\" 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 "",
|
||||
("🧪 Зелье +%d%% · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5),
|
||||
(ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""),
|
||||
"Шанс мутаций: " .. table.concat(mutLine, " · "),
|
||||
"<font color=\"#BBA98A\">Каждые следующие +100% удачи действуют слабее предыдущих.</font>",
|
||||
}
|
||||
local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list },
|
||||
local info = new("Frame", { Size = UDim2.new(1, -4, 0, 176), BackgroundColor3 = WHITE, LayoutOrder = nextOrder(), 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
|
||||
|
||||
@@ -1118,7 +1230,7 @@ local function renderDex()
|
||||
})
|
||||
text({
|
||||
Size = UDim2.new(1, -250, 0, 16), Position = UDim2.fromOffset(70, 34), Font = BODY2, TextSize = 13, TextColor3 = C.muted,
|
||||
Text = ("Собери всех: +%s серебра и +%d%% удачи навсегда"):format(fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)), Parent = head,
|
||||
Text = ("Собери всех: +%s серебра и +%d%% удачи навсегда"):format(fmt(Config.MasteryCoins * (world.tier or 1)), math.floor(Config.MasteryLuck * 100 + 0.5)), Parent = head,
|
||||
})
|
||||
local _, setHeadBar = Theme.bar(head, { Size = UDim2.new(1, -250, 0, 10), Position = UDim2.fromOffset(70, 54) }, C.gold)
|
||||
setHeadBar(found / math.max(1, #all))
|
||||
@@ -1150,7 +1262,7 @@ local function renderDex()
|
||||
local hdr = Theme.section(section, 0, ("<font color=\"%s\">%s</font> %d/%d"):format(hex(r.color:Lerp(WHITE, 0.25)), r.name, have, #group), "fish")
|
||||
hdr.Size = UDim2.new(1, 0, 0, 40)
|
||||
text({ Size = UDim2.new(0, 170, 1, 0), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -166, 0, 0), Font = BODY2, TextSize = 13, TextColor3 = C.muted,
|
||||
TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = ("+%s серебра · +%s XP"):format(fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)), Parent = hdr })
|
||||
TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = ("+%s серебра"):format(fmt(reward.coins * (world.tier or 1))), Parent = hdr })
|
||||
local _, setRB = Theme.bar(hdr, { Size = UDim2.new(0, 120, 0, 8), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -166, 1, -1) }, r.color)
|
||||
setRB(have / #group)
|
||||
local key = dexWorld .. ":" .. rarity
|
||||
@@ -1297,7 +1409,14 @@ bagWin.render = function(tab)
|
||||
new("UIPadding", { PaddingLeft = UDim.new(0, 20), Parent = price })
|
||||
Theme.icon(new("Frame", { Size = UDim2.fromOffset(20, 20), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, -14, 0.5, 0), BackgroundTransparency = 1, ZIndex = 6, Parent = price }), "coin")
|
||||
Theme.pressFx(price)
|
||||
Theme.tooltip(cell, ("<b>%s</b> · %s · %.2f кг%s"):format(it.name, r.name, it.weight, mut and (" · " .. mut.name) or ""))
|
||||
if it.bought then
|
||||
-- купленная на рынке: не свой улов (не идёт в коллекцию, заказы и испытания)
|
||||
local tag = new("Frame", { Size = UDim2.fromOffset(0, 18), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -24, 0, 6),
|
||||
BackgroundColor3 = C.blue, ZIndex = 6, Parent = cell }, { corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 4), PaddingRight = UDim.new(0, 4) }) })
|
||||
text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 12, Text = "🛒 куплена", ZIndex = 7, Parent = tag })
|
||||
end
|
||||
Theme.tooltip(cell, ("<b>%s</b> · %s · %.2f кг%s%s"):format(it.name, r.name, it.weight, mut and (" · " .. mut.name) or "",
|
||||
it.bought and ("<br/>🛒 Куплена у %s за %s ⚪ — не твой улов: не в коллекцию, заказы и испытания; скупщик даёт базовую цену"):format(it.bought.fromName or "?", fmt(it.bought.price or 0)) or ""))
|
||||
end
|
||||
end
|
||||
elseif tab == "dex" then
|
||||
@@ -1356,8 +1475,8 @@ worldsWin.render = function()
|
||||
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)),
|
||||
lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d%s · Рыб поймано: %d / %d · Опыт: %d за рыбу"):format(w.level,
|
||||
Config.Guild.worldRank[w.id] and (", ранг " .. Config.Guild.ranks[Config.Guild.worldRank[w.id]].id) or "", found, total, Config.CareerXP(w.id))),
|
||||
strokeColor = (here and here.id == w.id) and C.gold or nil,
|
||||
buttonText = bText, buttonColor = bColor, active = active,
|
||||
onClick = function()
|
||||
@@ -1475,7 +1594,7 @@ questWin.render = function(tab)
|
||||
end
|
||||
text({
|
||||
Size = UDim2.new(1, -6, 0, 40), Position = UDim2.fromOffset(3, 90), Font = TITLE, TextSize = 14, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.goldBright,
|
||||
Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. (r.potion and "\n+ зелье" or ""), ZIndex = 2, Parent = cell,
|
||||
Text = fmt(r.coins * Config.TierFor(myLevel)) .. (r.potion and ("\n+ " .. ((Config.Find(Config.Potions, r.potion) or {}).icon or "🧪")) or ""), ZIndex = 2, Parent = cell,
|
||||
})
|
||||
if isNext then
|
||||
popIn(cell, 0.8)
|
||||
@@ -1674,10 +1793,14 @@ local function refreshHud()
|
||||
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>"):format(player:GetAttribute("Luck") or 100)
|
||||
H.boostChip.Visible = boost > 0
|
||||
H.boost.Text = ("+%d%% %s"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0))
|
||||
-- действующее зелье: значок и остаток (попытки или время игры)
|
||||
local potion = Config.Find(Config.Potions, player:GetAttribute("PotionActive") or "")
|
||||
H.boostChip.Visible = potion ~= nil
|
||||
if potion then
|
||||
local left = player:GetAttribute("PotionLeft") or 0
|
||||
H.boost.Text = potion.icon .. " " .. (player:GetAttribute("PotionKind") == "charges" and (left .. " поп.") or timeStr(left))
|
||||
end
|
||||
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
|
||||
H.bag.Text = ("%d / %d"):format(count, cap)
|
||||
H.bag.TextColor3 = count >= cap and Color3.fromRGB(255, 130, 120) or C.text
|
||||
@@ -1688,7 +1811,7 @@ end
|
||||
local pending = false
|
||||
player.AttributeChanged:Connect(function(name)
|
||||
refreshHud()
|
||||
if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then
|
||||
if (name == "BoostLeft" or name == "PotionLeft") and not (shopWin.isOpen() and shopWin.current == "luck") then
|
||||
return
|
||||
end
|
||||
if not pending then
|
||||
@@ -3211,10 +3334,11 @@ bestOffer = function(bagWasFull)
|
||||
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) })
|
||||
if coins >= potion.price * 3 and lvl >= (potion.level or 1) and (player:GetAttribute("PotionInv") or "") == "" and not player:GetAttribute("PotionActive") then
|
||||
table.insert(options, { kind = "Potion", id = potion.id, icon = potion.icon, title = potion.name, price = potion.price, prio = 0.5,
|
||||
desc = potion.desc .. " · " .. potion.charges .. " попыток" })
|
||||
end
|
||||
table.sort(options, function(x, y)
|
||||
return x.prio > y.prio
|
||||
@@ -3325,11 +3449,11 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
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))
|
||||
notify(("✅ %s +%s ⚪"):format(questText(a, b), fmt(c)), 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)
|
||||
notify(("🎁 %s: +%s ⚪%s"):format(a, fmt(b), d and (" + " .. d) or ""), C.gold)
|
||||
Audio.play("fanfare")
|
||||
elseif action == "ComboLost" then
|
||||
notify(("💔 Серия из %d прервана"):format(a), Color3.fromRGB(255, 130, 110))
|
||||
@@ -3345,7 +3469,17 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
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))
|
||||
notify(("🎁 За босса: +%s ⚪%s"):format(fmt(a), c and (" + " .. c .. " (в сумку зелий)") or ""), Color3.fromRGB(120, 255, 140))
|
||||
elseif action == "PotionConfirm" then
|
||||
-- a — что хотим выпить, b — что действует сейчас, c — его остаток
|
||||
local want, cur = Config.Find(Config.Potions, a), Config.Find(Config.Potions, b)
|
||||
if want and cur then
|
||||
local leftText = cur.charges and (c .. " попыток") or timeStr(c)
|
||||
H.confirm("🧪 Заменить зелье?", ("Сейчас действует <b>%s %s</b> — осталось <b>%s</b>.\nЕсли выпить <b>%s %s</b>, остаток прежнего зелья <font color=\"#FF8A7A\">пропадёт</font>.")
|
||||
:format(cur.icon, cur.name, leftText, want.icon, want.name), "Заменить", function()
|
||||
remote:FireServer("DrinkPotion", a, true)
|
||||
end)
|
||||
end
|
||||
elseif action == "OpenShop" then
|
||||
shopWin.open("rods")
|
||||
elseif action == "OpenQuests" then
|
||||
|
||||
@@ -279,7 +279,7 @@ end)
|
||||
|
||||
---------------------------------------------------------------- HUD: жемчуг, печати, ранг, отдых
|
||||
|
||||
-- ряд «фишек» в панели игрока: ранг, печати, жемчуг; ниже — отдых (только пока есть двойной опыт)
|
||||
-- ряд «фишек» в панели игрока: ранг, печати, жемчуг; ниже — отдых (только пока есть бонус к серебру)
|
||||
local guildRow = K.hudRow(3)
|
||||
local rankChip, rankText = Theme.chip(guildRow, "guild", 1)
|
||||
local sealChip, sealText = Theme.chip(guildRow, "seal", 2)
|
||||
@@ -304,7 +304,7 @@ local function refreshHud()
|
||||
pearlText.Text = fmt(player:GetAttribute("Pearls") or 0)
|
||||
local rest = player:GetAttribute("RestLeft") or 0
|
||||
restPlate.Visible = rest > 0
|
||||
restText.Text = ("🛌 Отдых: опыт ×2 ещё %d мин"):format(math.ceil(rest / 60))
|
||||
restText.Text = ("🛌 Отдых: +%d%% серебра за рыбу ещё %d мин"):format(math.floor(Config.Economy.restSilver * 100 + 0.5), math.ceil(rest / 60))
|
||||
-- значок на кнопке «Гильдия»: в ловушках есть рыба или хватает печатей на новый ранг
|
||||
if K.sideDots and K.sideDots["Гильдия"] then
|
||||
K.sideDots["Гильдия"].Visible = (player:GetAttribute("TrapFish") or 0) > 0 or (nextSeals ~= nil and seals >= nextSeals)
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
-- MarketClient (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Окно рынка игроков: витрина лотов этого сервера, продажа своей ценной рыбы, посылки (купленная и
|
||||
-- вернувшаяся рыба, если сумка была полна). Все проверки — на сервере (Market.lua); клиент только
|
||||
-- показывает и спрашивает подтверждение. Стиль — Theme.kit из FishingClient.
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local UserInputService = game:GetService("UserInputService")
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||||
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||||
|
||||
while not Theme.kit or not Theme.kit.confirm do
|
||||
task.wait(0.1)
|
||||
end
|
||||
local K = Theme.kit
|
||||
local C = Theme.C
|
||||
local new, text, btn, corner, stroke = K.new, K.text, K.btn, K.corner, K.stroke
|
||||
local fmt = K.fmt
|
||||
local M = Config.Market
|
||||
local WHITE = Color3.new(1, 1, 1)
|
||||
|
||||
local state = nil -- последний снимок рынка от сервера
|
||||
local myItems = {} -- сумка (для вкладки «Продать»)
|
||||
|
||||
local win = K.makeWindow("🏪 Рынок рыбаков", C.gold, {
|
||||
{ id = "shop", label = "🏪 Витрина" },
|
||||
{ id = "sell", label = "⚪ Продать" },
|
||||
{ id = "inbox", label = "🎁 Посылки" },
|
||||
})
|
||||
local lists = {
|
||||
shop = K.scrollArea(win.pages.shop),
|
||||
sell = K.scrollArea(win.pages.sell),
|
||||
inbox = K.scrollArea(win.pages.inbox),
|
||||
}
|
||||
|
||||
local function hex(c)
|
||||
return "#" .. c:ToHex()
|
||||
end
|
||||
|
||||
local function fishLine(it)
|
||||
local r = Config.Rarities[it.rarity] or Config.Rarities.Common
|
||||
local mut = it.mutation and Config.Find(Config.Mutations, it.mutation)
|
||||
return ("<font color=\"%s\">%s</font>%s · %.2f кг"):format(hex(r.color), r.name, mut and (" · <font color=\"" .. hex(mut.color) .. "\">" .. mut.name .. "</font>") or "", it.weight or 0)
|
||||
end
|
||||
|
||||
local function eligible(it)
|
||||
local r = Config.Rarities[it.rarity]
|
||||
return (r and r.rank >= M.minRank) or (it.mutation and M.mutations[it.mutation]) or false
|
||||
end
|
||||
|
||||
local function bounds(it)
|
||||
local v = math.max(1, math.floor(it.value or 1))
|
||||
return math.ceil(v * M.minPriceMult), math.floor(v * M.maxPriceMult)
|
||||
end
|
||||
|
||||
local function fee(price)
|
||||
return math.max(1, math.floor(price * M.fee + 0.5))
|
||||
end
|
||||
|
||||
local function note(list, order, msg)
|
||||
text({ Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = order, Font = K.BODY2, TextSize = 15, TextColor3 = C.muted,
|
||||
TextWrapped = true, RichText = true, Text = msg, Parent = list })
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- выставление: выбор цены
|
||||
|
||||
local pricer = {}
|
||||
do
|
||||
local dim = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.45, Visible = false, ZIndex = 55, Parent = K.screen })
|
||||
local box = new("Frame", { Size = UDim2.new(1, -24, 0, 280), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), BackgroundColor3 = WHITE, ZIndex = 56, Parent = dim },
|
||||
{ corner(12), stroke(C.gold, 3, 0), Theme.woodGradient(C.wood, C.woodDark), new("UISizeConstraint", { MaxSize = Vector2.new(520, 300) }) })
|
||||
Theme.rivets(box, 9, 6)
|
||||
pricer.title = text({ Size = UDim2.new(1, -32, 0, 32), Position = UDim2.fromOffset(16, 12), Font = K.TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center,
|
||||
TextColor3 = C.goldBright, ZIndex = 57, Parent = box })
|
||||
pricer.info = text({ Size = UDim2.new(1, -32, 0, 44), Position = UDim2.fromOffset(16, 46), Font = K.BODY2, TextSize = 15, RichText = true, TextWrapped = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 57, Parent = box })
|
||||
pricer.box = new("TextBox", { Size = UDim2.fromOffset(200, 44), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 96), BackgroundColor3 = C.dark,
|
||||
TextColor3 = C.goldBright, Font = K.TITLE, TextSize = 24, ClearTextOnFocus = false, Text = "", ZIndex = 57, Parent = box }, { corner(8), stroke(C.gold, 2, 0) })
|
||||
local function step(mult)
|
||||
local v = tonumber(pricer.box.Text) or pricer.lo
|
||||
pricer.box.Text = tostring(math.clamp(math.floor(v * mult + 0.5), pricer.lo, pricer.hi))
|
||||
end
|
||||
btn({ Size = UDim2.fromOffset(56, 44), Position = UDim2.new(0.5, -168, 0, 96), BackgroundColor3 = C.wood, Text = "−", TextSize = 26, ZIndex = 57, Parent = box }, function()
|
||||
step(0.9)
|
||||
end)
|
||||
btn({ Size = UDim2.fromOffset(56, 44), Position = UDim2.new(0.5, 112, 0, 96), BackgroundColor3 = C.wood, Text = "+", TextSize = 26, ZIndex = 57, Parent = box }, function()
|
||||
step(1.1)
|
||||
end)
|
||||
pricer.sum = text({ Size = UDim2.new(1, -32, 0, 48), Position = UDim2.fromOffset(16, 146), Font = K.BODY2, TextSize = 15, RichText = true, TextWrapped = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 57, Parent = box })
|
||||
btn({ Size = UDim2.new(0.5, -24, 0, 46), AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, 16, 1, -14), BackgroundColor3 = C.grey, Text = "Отмена", TextSize = 19, ZIndex = 57, Parent = box }, function()
|
||||
dim.Visible = false
|
||||
end)
|
||||
btn({ Size = UDim2.new(0.5, -24, 0, 46), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -16, 1, -14), BackgroundColor3 = C.green, Text = "Выставить", TextSize = 19, ZIndex = 57, Parent = box }, function()
|
||||
local price = tonumber(pricer.box.Text)
|
||||
if price and price % 1 == 0 and price >= pricer.lo and price <= pricer.hi then
|
||||
dim.Visible = false
|
||||
remote:FireServer("MarketList", pricer.item.uid, price)
|
||||
else
|
||||
pricer.box.Text = tostring(pricer.lo)
|
||||
end
|
||||
end)
|
||||
local function refreshSum()
|
||||
local price = tonumber(pricer.box.Text)
|
||||
if not price or not pricer.item then
|
||||
pricer.sum.Text = ("Цена — целое число от %s до %s ⚪"):format(fmt(pricer.lo or 0), fmt(pricer.hi or 0))
|
||||
return
|
||||
end
|
||||
local f = fee(price)
|
||||
pricer.sum.Text = ("Комиссия рынка %d%%: <b>%s ⚪</b> · ты получишь <b><font color=\"#7CFF9A\">%s ⚪</font></b>\nЛот висит %d мин, снять можно в любой момент")
|
||||
:format(math.floor(M.fee * 100 + 0.5), fmt(f), fmt(price - f), math.floor(M.duration / 60))
|
||||
end
|
||||
pricer.box:GetPropertyChangedSignal("Text"):Connect(refreshSum)
|
||||
function pricer.open(it)
|
||||
pricer.item = it
|
||||
pricer.lo, pricer.hi = bounds(it)
|
||||
pricer.title.Text = "Выставить: " .. it.name
|
||||
pricer.info.Text = fishLine(it) .. ("\nСкупщик даёт за неё ≈ %s ⚪ · цена на рынке: %s – %s ⚪"):format(fmt(it.value or 0), fmt(pricer.lo), fmt(pricer.hi))
|
||||
pricer.box.Text = tostring(math.max(pricer.lo, math.floor((it.value or 1) * 2)))
|
||||
refreshSum()
|
||||
dim.Visible = true
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- вкладки
|
||||
|
||||
local function closedNote(list)
|
||||
if not state then
|
||||
note(list, 1, "Загрузка…")
|
||||
return true
|
||||
end
|
||||
if not state.enabled then
|
||||
note(list, 1, "🏪 Рынок сейчас закрыт.")
|
||||
return true
|
||||
end
|
||||
if not state.access then
|
||||
note(list, 1, ("🔒 Рынок открывается с <b>%d уровня</b> (вместе с Миром 2). Сейчас у тебя %d.\nНа рынке игроки продают друг другу ценную рыбу за серебро.")
|
||||
:format(M.minLevel, state.level or 1))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function renderShop(list)
|
||||
if closedNote(list) then
|
||||
return
|
||||
end
|
||||
note(list, 0, "Лоты игроков этого сервера. Цену назначает продавец — это не оценка стоимости рыбы. "
|
||||
.. "Купленная рыба — не твой улов: не открывает вид в коллекции, не даёт опыт, рекорды и заказы.")
|
||||
local n = 0
|
||||
for _, L in ipairs(state.listings) do
|
||||
if not L.mine and L.state == "open" then
|
||||
n += 1
|
||||
local it = L.item
|
||||
local locked = (L.worldLevel or 0) > (state.level or 1)
|
||||
local coins = player:GetAttribute("Coins") or 0
|
||||
local left = math.max(0, L.expires - (state.now or os.time()))
|
||||
K.itemRow(list, n, {
|
||||
model = Models.buildFish(it.id, it.mutation, 1, true), dir = K.VIEW.fish, zoom = 0.72,
|
||||
title = it.name, titleColor = (Config.Rarities[it.rarity] or Config.Rarities.Common).color,
|
||||
lines = fishLine(it) .. ("\nПродаёт <b>%s</b>%s · ещё %d мин"):format(L.sellerName or "?", it.caughtBy and (" · поймал " .. it.caughtBy) or "", math.ceil(left / 60)),
|
||||
buttonText = locked and "🔒 Мир закрыт" or ("⚪ " .. fmt(L.price)),
|
||||
buttonColor = locked and C.grey or (coins >= L.price and C.green or Color3.fromRGB(150, 95, 60)),
|
||||
active = not locked,
|
||||
onClick = function()
|
||||
K.confirm("🏪 Купить рыбу?", ("<b>%s</b> — %s\nПродавец: <b>%s</b>\nЦена: <b>%s ⚪</b> (продавец платит комиссию %s ⚪ и получит %s ⚪)\n"
|
||||
.. "<font color=\"#BBA98A\">Цена — решение продавца. Скупщик даст за эту рыбу ≈ %s ⚪. Купленная рыба придёт в «Посылки».</font>")
|
||||
:format(it.name, fishLine(it), L.sellerName or "?", fmt(L.price), fmt(L.fee), fmt(L.proceeds), fmt(it.value or 0)), "Купить за " .. fmt(L.price), function()
|
||||
remote:FireServer("MarketBuy", L.id, L.price)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
if n == 0 then
|
||||
note(list, 1, "Пока никто ничего не продаёт. Выставь свою рыбу во вкладке «Продать».")
|
||||
end
|
||||
end
|
||||
|
||||
local function renderSell(list)
|
||||
if closedNote(list) then
|
||||
return
|
||||
end
|
||||
local order = 0
|
||||
local function o()
|
||||
order += 1
|
||||
return order
|
||||
end
|
||||
local mine = {}
|
||||
for _, L in ipairs(state.listings) do
|
||||
if L.mine then
|
||||
table.insert(mine, L)
|
||||
end
|
||||
end
|
||||
Theme.section(list, o(), ("Мои лоты: %d / %d"):format(#mine, M.maxListings), "coin", ("комиссия %d%%"):format(math.floor(M.fee * 100 + 0.5)))
|
||||
for _, L in ipairs(mine) do
|
||||
local it = L.item
|
||||
local left = math.max(0, L.expires - (state.now or os.time()))
|
||||
K.itemRow(list, o(), {
|
||||
model = Models.buildFish(it.id, it.mutation, 1, true), dir = K.VIEW.fish, zoom = 0.72,
|
||||
title = it.name .. " <font color=\"#FFD45A\">" .. fmt(L.price) .. " ⚪</font>", titleColor = (Config.Rarities[it.rarity] or Config.Rarities.Common).color,
|
||||
lines = fishLine(it) .. ("\nПолучишь %s ⚪ после комиссии · ещё %d мин"):format(fmt(L.proceeds), math.ceil(left / 60)),
|
||||
buttonText = L.state == "open" and "Снять" or "Идёт сделка…", buttonColor = L.state == "open" and C.crimson or C.grey, active = L.state == "open",
|
||||
onClick = function()
|
||||
remote:FireServer("MarketCancel", L.id)
|
||||
end,
|
||||
})
|
||||
end
|
||||
Theme.section(list, o(), "Рыба из сумки", "bag", "«Эпическая» и реже или золотая/радужная")
|
||||
local any = false
|
||||
for _, it in ipairs(myItems) do
|
||||
if eligible(it) then
|
||||
any = true
|
||||
local lo = bounds(it)
|
||||
K.itemRow(list, o(), {
|
||||
model = Models.buildFish(it.id, it.mutation, 1, true), dir = K.VIEW.fish, zoom = 0.72,
|
||||
title = it.name, titleColor = (Config.Rarities[it.rarity] or Config.Rarities.Common).color,
|
||||
lines = fishLine(it) .. ("\nСкупщик: ≈ %s ⚪ · на рынке от %s ⚪%s"):format(fmt(it.value or 0), fmt(lo), it.bought and " · 🛒 куплена" or ""),
|
||||
buttonText = #mine >= M.maxListings and "Лимит лотов" or "Выставить", buttonColor = #mine >= M.maxListings and C.grey or C.green,
|
||||
active = #mine < M.maxListings,
|
||||
onClick = function()
|
||||
pricer.open(it)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
if not any then
|
||||
note(list, o(), "В сумке нет рыбы для рынка. Подходит «Эпическая» и реже или рыба с золотой/радужной мутацией.")
|
||||
end
|
||||
end
|
||||
|
||||
local function renderInbox(list)
|
||||
if not state then
|
||||
note(list, 1, "Загрузка…")
|
||||
return
|
||||
end
|
||||
note(list, 0, ("Сюда приходит купленная рыба и рыба с полной сумкой. Она не пропадёт.%s")
|
||||
:format(state.pending > 0 and ("\n⏳ Подтверждаются сделки: " .. state.pending) or ""))
|
||||
for i, it in ipairs(state.inbox) do
|
||||
K.itemRow(list, i, {
|
||||
model = Models.buildFish(it.id, it.mutation, 1, true), dir = K.VIEW.fish, zoom = 0.72,
|
||||
title = it.name, titleColor = (Config.Rarities[it.rarity] or Config.Rarities.Common).color,
|
||||
lines = fishLine(it) .. (it.bought and ("\n🛒 Куплена у %s за %s ⚪"):format(it.bought.fromName or "?", fmt(it.bought.price or 0)) or "\nВернулась с рынка"),
|
||||
buttonText = "В сумку", buttonColor = C.green, active = true,
|
||||
onClick = function()
|
||||
remote:FireServer("MarketClaim")
|
||||
end,
|
||||
})
|
||||
end
|
||||
if #state.inbox == 0 then
|
||||
note(list, 1, "Посылок нет.")
|
||||
end
|
||||
end
|
||||
|
||||
win.render = function(tab)
|
||||
local list = lists[tab]
|
||||
if not list then
|
||||
return
|
||||
end
|
||||
K.clear(list)
|
||||
if tab == "shop" then
|
||||
renderShop(list)
|
||||
elseif tab == "sell" then
|
||||
renderSell(list)
|
||||
else
|
||||
renderInbox(list)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- кнопка и события
|
||||
|
||||
local function open()
|
||||
remote:FireServer("MarketState")
|
||||
remote:FireServer("RequestInventory") -- сумка для вкладки «Продать»
|
||||
win.toggle("shop")
|
||||
end
|
||||
K.sideButton(8, "🏪", "Рынок", "K", C.gold, open)
|
||||
Theme.kit.windows = Theme.kit.windows or {}
|
||||
Theme.kit.windows.market = win
|
||||
|
||||
UserInputService.InputBegan:Connect(function(input, processed)
|
||||
if not processed and input.KeyCode == Enum.KeyCode.K then
|
||||
open()
|
||||
end
|
||||
end)
|
||||
|
||||
remote.OnClientEvent:Connect(function(action, a, b)
|
||||
if action == "Market" then
|
||||
state = a
|
||||
win.refresh()
|
||||
elseif action == "Inventory" then
|
||||
myItems = a or {}
|
||||
if win.isOpen() and win.current == "sell" then
|
||||
win.refresh()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- значок «!» на кнопке, пока в посылках что-то лежит
|
||||
local function inboxDot()
|
||||
local dot = K.sideDots and K.sideDots["Рынок"]
|
||||
if dot then
|
||||
dot.Visible = (player:GetAttribute("MarketInbox") or 0) > 0
|
||||
end
|
||||
end
|
||||
player:GetAttributeChangedSignal("MarketInbox"):Connect(inboxDot)
|
||||
inboxDot()
|
||||
|
||||
remote:FireServer("MarketState")
|
||||
Reference in new issue
Block a user