-- 用于跨服通知普通服上传玩家战斗数据及收到数据后的处理

local InnerMsg = require("core.InnerMsg")
local MiddleManager = require("middle.MiddleManager")
local AreaBattleCS = require("areaBattle.AreaBattleCS")


AREABTTLE_TAG = 1





function NotifyNormalSrv(fd, playerUuid, moduleTag, combatType, extraArgs)
    local msgData = InnerMsg.wl.WL_COMBAT_DATA
    msgData.playerUuid = playerUuid
    msgData.moduleTag = moduleTag
    msgData.combatType = combatType
    msgData.extraArgs = extraArgs
    InnerMsg.sendMsg(fd, msgData)
end

-- 其他模块调用，用于请求所需战斗数据
function GetPlayerCombatData(serverId, playerUuid, moduleTag, combatType, extraArgs)
    if not serverId or not playerUuid or not moduleTag then
        return
    end

    -- 后续再扩展
    if moduleTag ~= AREABTTLE_TAG then
        return
    end

    local fd = MiddleManager.getFDBySvrIndex(serverId)
    if not fd then
        return
    end

    NotifyNormalSrv(fd, playerUuid, moduleTag, combatType, extraArgs)
end

-- 收到普通服上传的战斗数据
function BattleDataHandleManager(fd, msg)
    if msg.moduleTag == AREABTTLE_TAG then
        AreaBattleCS.BattleDataHanle(msg)
    end
end