|
|
@@ -144,6 +144,17 @@ local function genRobotRaceShow(robotListIdx, race)
|
|
|
}
|
|
|
end
|
|
|
|
|
|
+-- 按当前 robotList 重算已存在机器人的五族 monsterOutID + racePower(保留 name/head 等展示字段)
|
|
|
+local function syncRobotHeroArr(robotListIdx, pinfo)
|
|
|
+ if not robotListIdx or not pinfo then return end
|
|
|
+ normalizePlayer(pinfo)
|
|
|
+ local heroArr = {}
|
|
|
+ for _, race in ipairs(BaiZhanChengShenDefine.BZCS_RACE_ORDER) do
|
|
|
+ heroArr[race] = genRobotRaceShow(robotListIdx, race)
|
|
|
+ end
|
|
|
+ pinfo.showInfo.heroArr = heroArr
|
|
|
+end
|
|
|
+
|
|
|
local function getRobotScore(robotListIdx)
|
|
|
local cfg = BzcsConfig.robotList[robotListIdx]
|
|
|
return (cfg and cfg.score) or BaiZhanChengShenDefine.BZCS_INIT_SCORE
|
|
|
@@ -176,6 +187,8 @@ function GenerateRobots(cnt)
|
|
|
heroArr = heroArr,
|
|
|
},
|
|
|
}
|
|
|
+ else
|
|
|
+ syncRobotHeroArr(i, BzcsData.playerList[uuid])
|
|
|
end
|
|
|
end
|
|
|
rankDirty = true
|
|
|
@@ -243,13 +256,11 @@ function TakePendingRewards(serverId)
|
|
|
return list
|
|
|
end
|
|
|
|
|
|
--- 跨服启动: 加载数据, 无玩家则生成机器人池, 并向已连接逻辑服同步活动状态
|
|
|
+-- 跨服启动: 加载数据, 同步/补全机器人池, 并向已连接逻辑服同步活动状态
|
|
|
function initAfterStart()
|
|
|
if _G.is_middle ~= true then return end
|
|
|
loadData()
|
|
|
- if not BzcsData.playerList or not next(BzcsData.playerList) then
|
|
|
- GenerateRobots()
|
|
|
- end
|
|
|
+ GenerateRobots()
|
|
|
rebuildServerList()
|
|
|
BzcsLog.logAction("db_init", string.format("playerCnt=%s", Util.getTableCount(BzcsData.playerList or {})))
|
|
|
local BaiZhanChengShenCS = require("baiZhanChengShen.BaiZhanChengShenCS")
|
|
|
@@ -373,7 +384,7 @@ function BuildRankInfoEntry(pinfo, rank)
|
|
|
head = si.head or 0,
|
|
|
headFrame = si.headFrame or 0,
|
|
|
serverId = pinfo.serverId or 0,
|
|
|
- power = BaiZhanChengShenDefine.CalcPlayerPower(si),
|
|
|
+ power = BaiZhanChengShenDefine.CalcPlayerPower(si, pinfo),
|
|
|
score = pinfo.score or BaiZhanChengShenDefine.BZCS_INIT_SCORE,
|
|
|
isRobot = pinfo.isRobot,
|
|
|
}
|
|
|
@@ -405,7 +416,7 @@ function BuildOpponentInfoSnapshot(pinfo)
|
|
|
name = si.name or "",
|
|
|
head = si.head or 0,
|
|
|
headFrame = si.headFrame or 0,
|
|
|
- power = BaiZhanChengShenDefine.CalcPlayerPower(si),
|
|
|
+ power = BaiZhanChengShenDefine.CalcPlayerPower(si, pinfo),
|
|
|
score = pinfo.score or BaiZhanChengShenDefine.BZCS_INIT_SCORE,
|
|
|
}
|
|
|
end
|
|
|
@@ -441,7 +452,7 @@ local function makeMatchOpponentEntry(uuid, pinfo)
|
|
|
serverId = pinfo.serverId or 0,
|
|
|
name = si.name,
|
|
|
body = getOpponentBody(pinfo),
|
|
|
- power = BaiZhanChengShenDefine.CalcPlayerPower(si),
|
|
|
+ power = BaiZhanChengShenDefine.CalcPlayerPower(si, pinfo),
|
|
|
score = score,
|
|
|
isRobot = pinfo.isRobot,
|
|
|
}
|