Files
2026-05-29 15:11:31 +07:00

59 lines
2.2 KiB
Lua

local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local ____exports = {}
local ____CardSystem = require("cards.CardSystem")
local CardSystem = ____CardSystem.CardSystem
--- Гарантировать CardSystem у контроллера (например до рассвета, если спавн ещё не выставил колоду).
function ____exports.ensurePlayerCardSystem(self, playerId)
local player = PlayerResource:GetPlayer(playerId)
if not player then
return nil
end
if not player.cardSystem then
player.cardSystem = __TS__New(CardSystem, playerId)
end
return player.cardSystem
end
--- Сервер → игрок: золото по карте 22 на рассвете.
function ____exports.sendZiMorningGoldCard(self, playerId, payload)
if not IsServer() then
return
end
local player = PlayerResource:GetPlayer(playerId)
if not player then
return
end
CustomGameEventManager:Send_ServerToPlayer(player, "zi_morning_gold_card", {
playerId = playerId,
cardId = 22,
morningSequence = payload.morningSequence,
nightIndex = payload.nightIndex,
goldAmount = payload.goldAmount
})
end
--- Сервер → игрок: бонус кристаллов по карте 38 на рассвете.
function ____exports.sendZiMorningCrystalsCard(self, playerId, payload)
if not IsServer() then
return
end
local player = PlayerResource:GetPlayer(playerId)
if not player then
return
end
CustomGameEventManager:Send_ServerToPlayer(player, "zi_morning_crystals_card", {
playerId = playerId,
cardId = 38,
morningSequence = payload.morningSequence,
nightIndex = payload.nightIndex,
crystalBonus = payload.crystalBonus
})
end
--- Сервер → все клиенты: фаза дня/ночи + счётчики (для UI/FX поверх day_night_timer_update).
function ____exports.broadcastZiCyclePhase(self, payload)
if not IsServer() then
return
end
CustomGameEventManager:Send_ServerToAllClients("zi_cycle_phase", payload)
end
return ____exports