This commit is contained in:
listik committed 2026-11-04 15:00:51 +03:00
1 parent 6673d5b90d
commit 0972c05e3d
11 files changed
+24893 -14603

No files matched your search

@@ -20,6 +20,47 @@ local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("Re
remote.Name = "GameEvent"
remote.Parent = ReplicatedStorage
---------------------------------------------------------------- лента активности
-- события для всех игроков (FishingClient показывает их в ленте и крупным баннером для редкого улова);
-- самые редкие уловы уходят и на другие серверы игры через MessagingService (Config.Feed)
local MessagingService = game:GetService("MessagingService")
local FEED_TOPIC = "FishFeed"
local function feed(kind, info)
remote:FireAllClients("Feed", kind, info)
end
pcall(function()
MessagingService:SubscribeAsync(FEED_TOPIC, function(msg)
local d = msg.Data
if type(d) == "table" and d.jobId ~= game.JobId then
d.remote = true -- улов на другом сервере
feed("catch", d)
end
end)
end)
-- улов в ленту; big — крупный баннер со звуком у всех, global — ещё и на другие серверы
local function feedCatch(player, fish, world)
local r = Config.Rarities[fish.rarity]
local F = Config.Feed
local info = {
name = player.DisplayName, userId = player.UserId,
fish = fish.name, rarity = fish.rarity, mutation = fish.mutation, value = fish.value,
world = world and (world.icon .. " " .. world.name) or nil,
big = r.rank >= F.announceRank or F.announceMutations[fish.mutation or ""] == true,
}
feed("catch", info)
if r.rank >= F.globalRank or F.globalMutations[fish.mutation or ""] then
info.jobId = game.JobId
task.spawn(function()
pcall(function()
MessagingService:PublishAsync(FEED_TOPIC, info)
end)
end)
end
end
local rng = Random.new()
local GOLD = Color3.fromRGB(255, 220, 80)
local RED = Color3.fromRGB(255, 120, 120)
@@ -47,6 +88,7 @@ local function defaultData()
boostUntil = 0, boostBonus = 0,
totalCaught = 0, nextUid = 1, receipts = {},
passes = {}, -- купленные пропуска (Developer Products): [key] = true
coinsEarned = 0, robuxSpent = 0, -- для досок лидеров: всего выручено за рыбу и потрачено Robux
settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx },
-- гильдия: жемчуг, печати, отдых (ранг, заказы, наживку, ловушки дополняет Guild.defaults)
pearls = 0, seals = 0, rest = 0,
@@ -277,6 +319,8 @@ local function updateStats(player)
player:SetAttribute("BoostBonus", boostActive(data))
player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time()))
player:SetAttribute("TotalCaught", data.totalCaught)
player:SetAttribute("CoinsEarned", data.coinsEarned)
player:SetAttribute("RobuxSpent", data.robuxSpent)
-- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
player:SetAttribute("Mastery", masteryCount(data))
@@ -301,6 +345,7 @@ local function addXp(player, data, amount)
end
if leveled then
notify(player, "⭐ Уровень " .. data.level .. "!", GOLD)
feed("level", { name = player.DisplayName, userId = player.UserId, level = data.level })
for _, w in ipairs(Config.Worlds) do
if w.level == data.level and not w.soon then
notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color)
@@ -1044,6 +1089,10 @@ grantFish = function(player, data, fish, ctx)
showFishFlight(player, fish, ctx.fromPos)
end
remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = ctx.auto and 0 or streak + 1, auto = ctx.auto })
do
local h = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
feedCatch(player, fish, h and Config.WorldAt(h.Position))
end
local rank = Config.Rarities[fish.rarity].rank
questProgress(player, "catch", 1)
@@ -1259,6 +1308,7 @@ local function sellItems(player, filterUid)
end
data.items = keep
data.coins += total
data.coinsEarned += total
updateStats(player)
sendInventory(player)
remote:FireClient(player, "Sold", total, count)
@@ -1559,6 +1609,8 @@ MarketplaceService.ProcessReceipt = function(info)
warn("ProcessReceipt: неизвестный товар " .. tostring(info.ProductId))
return Enum.ProductPurchaseDecision.NotProcessedYet
end
data.robuxSpent += info.CurrencySpent or product.robux or 0
feed("buy", { name = player.DisplayName, userId = player.UserId, item = product.icon .. " " .. product.name })
if isPass then
data.passes[product.key] = true
passes[player] = passes[player] or {}
@@ -1711,6 +1763,9 @@ end)
---------------------------------------------------------------- игроки
local function onPlayerAdded(player)
-- камеру нельзя отвести так далеко, чтобы заглянуть за скалы и край карты
player.CameraMinZoomDistance = Config.Camera.minZoom
player.CameraMaxZoomDistance = Config.Camera.maxZoom
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
ls.Parent = player