|
|
@@ -32,6 +32,8 @@ local Log = require("common.Log")
|
|
|
local Timer = require("core.Timer")
|
|
|
local CommonDB = require("common.CommonDB")
|
|
|
local RoleSystemExcel = require("excel.roleSystem")
|
|
|
+local Grid = require("bag.Grid")
|
|
|
+local MonsterGrid = require("monster.MonsterGrid")
|
|
|
|
|
|
-- 战败通知邮件Id
|
|
|
local DEFAULT_MIAL_ID = 7021
|
|
|
@@ -40,15 +42,19 @@ local REWARD_MAIL_ID = 7020
|
|
|
|
|
|
local REWARD_MAIL_ID2 = 7022
|
|
|
|
|
|
-
|
|
|
-
|
|
|
local FAIL_TAG = "fail"
|
|
|
local SUCC_TAG = "succ"
|
|
|
|
|
|
+
|
|
|
+local MONSTER_SRV_NAME = "1服"
|
|
|
+local SRV_BASE_NUM = 810537
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
MailQueue = {
|
|
|
uidArray = {},
|
|
|
- insertMaxNum = 100, --一次最多插入数据库数量
|
|
|
- repeatMaxTimes = 3,
|
|
|
+ insertMaxNum = 100, -- 一次最多插入数据库的邮件数量
|
|
|
+ repeatMaxTimes = 3, -- 第一次失败后重试次数
|
|
|
repeatTb = {}
|
|
|
}
|
|
|
|
|
|
@@ -122,6 +128,7 @@ local function generateShowInfo(human)
|
|
|
level = human.db.lv,
|
|
|
uid = human.db._id,
|
|
|
serverId = Config.SVR_INDEX,
|
|
|
+ power = human.attr[RoleDefine.ZHANDOULI],
|
|
|
}
|
|
|
|
|
|
showInfo.head = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_1)
|
|
|
@@ -133,6 +140,25 @@ local function generateShowInfo(human)
|
|
|
return showInfo
|
|
|
end
|
|
|
|
|
|
+local function calcMOnsterPower(monsterOutID)
|
|
|
+ local power = 0
|
|
|
+ local objList = MonsterGrid.createMonsterObjListByMonsterOutID(monsterOutID)
|
|
|
+ if not objList then
|
|
|
+ return power
|
|
|
+ end
|
|
|
+
|
|
|
+ for _, monster in ipairs(objList) do
|
|
|
+ power = power + (monster.power or 0)
|
|
|
+ end
|
|
|
+
|
|
|
+ return power
|
|
|
+end
|
|
|
+
|
|
|
+local function getPlayerSrvIdx(human)
|
|
|
+ local newUniqueTag = human.db.newUniqueTag
|
|
|
+ local tbl = Util.split(newUniqueTag, "|")
|
|
|
+ return tbl[2]
|
|
|
+end
|
|
|
|
|
|
local function getRankReward(rank)
|
|
|
local rewardCfg = GodsAreaConfig.reward
|
|
|
@@ -176,7 +202,6 @@ local function getCorrectUuidArray(uid2RankTb)
|
|
|
return uidArray
|
|
|
end
|
|
|
|
|
|
-
|
|
|
local function writeLog(logStr)
|
|
|
Log.write(Log.LOGID_OSS_GODSAREA_MAIL, logStr)
|
|
|
end
|
|
|
@@ -195,6 +220,20 @@ local function sendMail(mailId, receiverUuid, itemArray, arg)
|
|
|
end
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+-- local function timed_clear_videoCache(playerUid)
|
|
|
+-- local human = ObjHuman.onlineUuid[playerUid]
|
|
|
+-- if not human then
|
|
|
+-- return
|
|
|
+-- end
|
|
|
+
|
|
|
+-- human.GodsAreaVideoArray = nil
|
|
|
+-- end
|
|
|
+
|
|
|
+
|
|
|
-- GM,清理所有诸神圣域的称号
|
|
|
function GM_ClearChenghao(human)
|
|
|
for _, rankCfg in ipairs(GodsAreaConfig.rankList) do
|
|
|
@@ -253,7 +292,7 @@ end
|
|
|
|
|
|
-- 更新玩家英雄数据
|
|
|
-- 参数heroUuid, opType 都没有时标识更新全部英雄数据
|
|
|
--- opType 表示更新类型, 0-删除, 1-更新
|
|
|
+-- opType: 操作类型, 0-删除, 1-更新单个英雄数据, 2- 更新所有英雄数据
|
|
|
function UpdateHeroData(human, heroUuid, opType)
|
|
|
if not isOpen(human) then
|
|
|
return
|
|
|
@@ -266,8 +305,12 @@ function UpdateHeroData(human, heroUuid, opType)
|
|
|
local heroInfoList = {opType = 1}
|
|
|
if opType and opType == 0 then
|
|
|
heroInfoList.opType = 0
|
|
|
- heroInfoList.heroUuid = heroUuid
|
|
|
+ heroInfoList.removeHeroUuid = heroUuid
|
|
|
else
|
|
|
+ if not opType and not heroUuid then
|
|
|
+ heroInfoList.opType = 2
|
|
|
+ end
|
|
|
+
|
|
|
heroInfoList.heroList = getHeroListInfo(human, heroUuid)
|
|
|
if not heroInfoList.heroList then
|
|
|
return
|
|
|
@@ -326,8 +369,6 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-- 查询排行榜信息
|
|
|
function Query_RankList(human)
|
|
|
if not isOpen(human) then
|
|
|
@@ -416,13 +457,40 @@ function UpdatePlayerBaseInfo(human, newPlayerInfo)
|
|
|
local msgData = InnerMsg.lw.LW_GODSATREA_UPDATE_PLAYER_BASE_INFO
|
|
|
msgData.playerUid = human.db._id
|
|
|
msgData.playerInfo = newPlayerInfo or {}
|
|
|
+
|
|
|
+ InnerMsg.sendMsg(0, msgData)
|
|
|
end
|
|
|
|
|
|
-- 通知跨服, 更新玩家英雄数据
|
|
|
function UpdatePlayerHeroInfo(human, newPlayerInfo)
|
|
|
local msgData = InnerMsg.lw.LW_GODSATREA_UPDATE_PLAYER_HERO_INFO
|
|
|
msgData.playerUid = human.db._id
|
|
|
- msgData.playerInfo = newPlayerInfo or {}
|
|
|
+ msgData.power = human.attr[RoleDefine.ZHANDOULI]
|
|
|
+ msgData.heroInfo = newPlayerInfo or {}
|
|
|
+
|
|
|
+ InnerMsg.sendMsg(0, msgData)
|
|
|
+end
|
|
|
+
|
|
|
+-- 客户端请求排行榜奖励
|
|
|
+function Query_RankReward(human)
|
|
|
+ local msgRet = Msg.gc.GC_GODSAREA_GET_RANK_REWARD
|
|
|
+ local rewardList = msgRet.rewardList
|
|
|
+ rewardList[0] = 0
|
|
|
+
|
|
|
+ for k,v in ipairs(GodsAreaConfig.reward) do
|
|
|
+ rewardList[0] = k
|
|
|
+ rewardList[k].rankLeft = v.rankArea[1]
|
|
|
+ rewardList[k].rankRight = v.rankArea[2]
|
|
|
+
|
|
|
+ local itemList = rewardList[k].itemList
|
|
|
+ itemList[0] = 0
|
|
|
+ for idx, itemCfg in ipairs(v.awardList) do
|
|
|
+ itemList[0] = idx
|
|
|
+ Grid.makeItem(itemList[idx], itemCfg[1], itemCfg[2])
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ Msg.send(msgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -436,22 +504,52 @@ function NS_Send_RankList(playerUid, myRank, rankList)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+ local srvIdx = getPlayerSrvIdx(human)
|
|
|
local msgRet = Msg.gc.GC_GODSAREA_QUERY_RANKLIST
|
|
|
- msgRet.myRank = myRank
|
|
|
- local msgRankList = msgRet.rankList
|
|
|
+ msgRet.myRank.body = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_3)
|
|
|
+ msgRet.myRank.name = human.db.name
|
|
|
+ msgRet.myRank.uid = playerUid
|
|
|
+ msgRet.myRank.rank = myRank
|
|
|
+ msgRet.myRank.power = human.attr[RoleDefine.ZHANDOULI] or 0
|
|
|
+ msgRet.myRank.serverName = srvIdx .. "服"
|
|
|
+ msgRet.myRank.head = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_1)
|
|
|
+ msgRet.myRank.headFrame = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_2)
|
|
|
|
|
|
+ msgRet.attrs[0] = 0
|
|
|
+ if myRank ~= 0 then
|
|
|
+ local rankCfg = GodsAreaConfig.rankList[myRank]
|
|
|
+ local chenghaoCfg = RoleExcel.chenghao[rankCfg.chenghaoID]
|
|
|
+
|
|
|
+ for k, v in ipairs(chenghaoCfg.attrs) do
|
|
|
+ msgRet.attrs[0] = k
|
|
|
+ msgRet.attrs[k].key = v[1]
|
|
|
+ msgRet.attrs[k].value = v[2]
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ local msgRankList = msgRet.rankList
|
|
|
msgRankList[0] = 0
|
|
|
+
|
|
|
for rank, playerInfo in ipairs(rankList) do
|
|
|
msgRankList[0] = rank
|
|
|
msgRankList[rank].body = playerInfo.body
|
|
|
msgRankList[rank].name = playerInfo.name
|
|
|
msgRankList[rank].rank = rank
|
|
|
+ msgRankList[rank].head = playerInfo.head
|
|
|
+ msgRankList[rank].headFrame = playerInfo.headFrame
|
|
|
|
|
|
if playerInfo.uid then -- 真实玩家
|
|
|
msgRankList[rank].uid = playerInfo.uid
|
|
|
+ msgRankList[rank].power = playerInfo.power or 999999
|
|
|
+ local playerServerIdx = math.max((playerInfo.serverId or 0) - SRV_BASE_NUM, 1)
|
|
|
+ msgRankList[rank].serverName = playerServerIdx .. "服"
|
|
|
else
|
|
|
local npcCfg = GodsAreaConfig.rankList[rank]
|
|
|
- msgRankList[rank].uid = tostring(npcCfg.monsterOutID)
|
|
|
+ local monsterOutID = npcCfg.monsterOutID
|
|
|
+ msgRankList[rank].uid = tostring(monsterOutID)
|
|
|
+ msgRankList[rank].power = calcMOnsterPower(monsterOutID)
|
|
|
+ msgRankList[rank].serverName = MONSTER_SRV_NAME
|
|
|
end
|
|
|
end
|
|
|
|
|
|
@@ -616,20 +714,35 @@ function NS_Change_Chenghao(playerUid, newRank, isWinner, enemyName)
|
|
|
end
|
|
|
|
|
|
-- 跨服返回录像数据
|
|
|
-function NS_Query_CombatVideo(playerUid, videoData)
|
|
|
+function NS_Query_CombatVideo(isFinish, playerUid, videoData)
|
|
|
local human = ObjHuman.onlineUuid[playerUid]
|
|
|
if not human then
|
|
|
return
|
|
|
end
|
|
|
|
|
|
|
|
|
+ if next(videoData) then
|
|
|
+ if not human.GodsAreaVideoArray then
|
|
|
+ human.GodsAreaVideoArray = {}
|
|
|
+ -- Timer.addLater(3, timed_clear_videoCache, playerUid)
|
|
|
+ end
|
|
|
+
|
|
|
+ human.GodsAreaVideoArray[#human.GodsAreaVideoArray+1] = videoData
|
|
|
+
|
|
|
+ if isFinish == 0 then
|
|
|
+ return
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
local msgRet = Msg.gc.GC_GODSAREA_QUERY_COMBATVIDEO
|
|
|
msgRet.videoList[0] = 0
|
|
|
+ local videoCnt = human.GodsAreaVideoArray and #human.GodsAreaVideoArray or 0
|
|
|
|
|
|
- for i = 1, #videoData do
|
|
|
+ for i = 1, videoCnt do
|
|
|
if msgRet.videoList[0] < #msgRet.videoList then
|
|
|
msgRet.videoList[0] = i
|
|
|
- local combatVideo = videoData[i]
|
|
|
+ local combatVideo = human.GodsAreaVideoArray[i]
|
|
|
local combatInfo = combatVideo.combatInfo
|
|
|
local net = msgRet.videoList[i]
|
|
|
RoleLogic.makeRoleBase(combatInfo.attacker, net.atkData)
|
|
|
@@ -652,6 +765,8 @@ function NS_Query_CombatVideo(playerUid, videoData)
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+ human.GodsAreaVideoArray = nil
|
|
|
+
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
@@ -676,6 +791,27 @@ function NS_SendReward(uid2RankTb)
|
|
|
MailQueue:insertDB()
|
|
|
end
|
|
|
|
|
|
+-- 收到跨服通知,更新玩家基础数据
|
|
|
+function NS_UpdatePlayerBaseInfo(playerUid)
|
|
|
+ local human = ObjHuman.onlineUuid[playerUid]
|
|
|
+ if not human then
|
|
|
+ local db = RoleDBLogic.getDb(playerUid)
|
|
|
+ if not db then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ human = {}
|
|
|
+ human.db = db
|
|
|
+ end
|
|
|
+
|
|
|
+ local msgData = InnerMsg.lw.LW_GODSATREA_UPDATE_PLAYER_BASE_INFO
|
|
|
+ msgData.playerUid = human.db._id
|
|
|
+ msgData.playerInfo = generateShowInfo(human)
|
|
|
+ msgData.playerInfo.heroList = nil
|
|
|
+
|
|
|
+ InnerMsg.sendMsg(0, msgData)
|
|
|
+end
|
|
|
+
|
|
|
|
|
|
|
|
|
|