Procházet zdrojové kódy

跨服战报和英雄分享

SCFC před 1 rokem
rodič
revize
51bac2ae4a

+ 55 - 0
script/common/InnerHandler.lua

@@ -17,6 +17,7 @@ local YunYingLogic = require("yunying.YunYingLogic")
 local MoZhuLogic = require("mozhu.MoZhuLogic")
 local MoZhuMiddleLogic = require("mozhu.MoZhuMiddleLogic")
 local ChatLogic = require("chat.ChatLogic")
+local HeroMiddleLogic = require("hero.HeroMiddleLogic")
 
 function LW_HELLO(fd, msg)
 	if _G.is_middle ~= true then return end
@@ -74,4 +75,58 @@ end
 
 function WL_MIDDLE_CHAT(fd, msg)
     ChatLogic.WL_MIDDLE_CHAT(fd, msg)
+end
+
+-- 聊天查看分享英雄数据(请求的服务器->中心)
+function LW_MIDDLE_CHAT_QUERY_HERO_DATA(fd, msg)
+    if _G.is_middle ~= true then return end
+    print("[LW_MIDDLE_CHAT_QUERY_HERO_DATA] 请求的服务器->中心 获取到消息")
+    MiddleConnect.LW_MIDDLE_CHAT_QUERY_HERO_DATA(fd, msg)
+end
+
+-- 发送到对应服务器信息(中心->目标服务器)
+function WL_MIDDLE_CHAT_QUERY_HERO_DATA(fd, msg)
+    print("[WL_MIDDLE_CHAT_QUERY_HERO_DATA] 中心->目标服务器 获取到消息")
+    HeroMiddleLogic.HeroMiddleLogic_QueryHeroData_WL(fd, msg)
+end
+
+-- 英雄信息回复(目标->中心)
+function LW_MIDDLE_CHAT_GET_HERO_DATA(fd, msg)
+    if _G.is_middle ~= true then return end
+    print("[LW_MIDDLE_CHAT_GET_HERO_DATA] 目标->中心 获取到消息")
+
+    MiddleConnect.LW_MIDDLE_CHAT_GET_HERO_DATA(fd, msg)
+end
+
+-- 英雄信息回复(中心->请求)
+function WL_MIDDLE_CHAT_GET_HERO_DATA(fd, msg)
+    print("[WL_MIDDLE_CHAT_GET_HERO_DATA] 中心->请求 获取到消息")
+
+    HeroMiddleLogic.HeroMiddleLogic_GetHeroData_WL(fd, msg)
+end
+
+function LW_WARREPORT_GET_COMBATINFO(fd, msg)
+    if _G.is_middle ~= true then return end
+    print("[LW_WARREPORT_GET_COMBATINFO] 目标->中心 获取到战报录像信息")
+
+    MiddleConnect.LW_WARREPORT_GET_COMBATINFO(fd, msg)
+end
+
+function WL_WARREPORT_GET_COMBATINFO(fd, msg)
+    print("[WL_WARREPORT_GET_COMBATINFO] 获取到中心消息 请求获取到战报录像信息")
+    
+    WarReportMiddle.WL_WARREPORT_GET_COMBATINFO_NEW(fd, msg)
+end
+
+function LW_WARREPORT_SEND_COMBATINFO(fd, msg)
+    if _G.is_middle ~= true then return end
+
+    print("[LW_WARREPORT_SEND_COMBATINFO] 回复中心服 获取到战报录像信息")
+    MiddleConnect.LW_WARREPORT_SEND_COMBATINFO(fd, msg)
+end
+
+function WL_WARREPORT_SEND_COMBATINFO(fd, msg)
+    print("[WL_WARREPORT_GET_COMBATINFO] 获取到其他服消息 获取到战报录像信息回包")
+
+    WarReportMiddle.WL_WARREPORT_SEND_COMBATINFO(fd, msg)
 end

+ 74 - 0
script/common/InnerProto.lua

@@ -38,4 +38,78 @@ LW_MIDDLE_CHAT =
 WL_MIDDLE_CHAT = 
 {
   {"tChatMsg",               "table"}
+}
+
+-- 聊天查看分享英雄数据(请求的服务器->中心)
+LW_MIDDLE_CHAT_QUERY_HERO_DATA = 
+{
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+    {"nDesServerID",        "int"},     -- 目标服务器ID
+    {"nSrcUID",             "string"},  -- 请求的玩家UID
+    {"nDesUID",             "string"},  -- 查询的玩家UID
+    {"nHeroIndex",          "int"},     -- 查看的英雄下表
+    {"nChatType",           "int"},     -- 聊天频道
+}
+
+-- 发送到对应服务器信息(中心->目标服务器)
+WL_MIDDLE_CHAT_QUERY_HERO_DATA = 
+{
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+    {"nSrcUID",             "string"},  -- 请求的玩家UID
+    {"nDesUID",             "string"},  -- 查询的玩家UID
+    {"nHeroIndex",          "int"},     -- 查看的英雄下表
+    {"nChatType",           "int"},     -- 聊天频道
+}
+
+-- 英雄信息回复(目标->中心)
+LW_MIDDLE_CHAT_GET_HERO_DATA = 
+{ 
+    -- {"nResult",             "int"},     -- 结果 1 获取成功,0 获取不到数据  
+    {"nSrcUID",             "string"},  -- 请求的玩家UID
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+    {"tHeroData",           "table"},   -- 英雄数据
+}
+
+-- 英雄信息回复(目标->中心)
+WL_MIDDLE_CHAT_GET_HERO_DATA = 
+{ 
+    -- {"nResult",             "int"},     -- 结果 1 获取成功,0 获取不到数据  
+    {"nSrcUID",             "string"},  -- 请求的玩家UID
+    {"tHeroData",           "table"},   -- 英雄数据
+}
+
+-- 请求战报录像
+LW_WARREPORT_GET_COMBATINFO =
+{
+    {"nSrcUID",           "string"},
+    {"type",              "int"},
+    {"id",                "string"},
+    {"mode",                "int"},
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+    {"nDesServerID",        "int"},     -- 目标服务器ID
+}
+
+WL_WARREPORT_GET_COMBATINFO =
+{
+    {"nSrcUID",           "string"},
+    {"type",              "int"},
+    {"id",                "string"},
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+    {"mode",                "int"},
+}
+
+-- 发送战报数据
+LW_WARREPORT_SEND_COMBATINFO = 
+{
+    {"nSrcUID",           "string"},
+    {"mode",                "int"},
+    {"combatInfo",        "table"},
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+}
+
+WL_WARREPORT_SEND_COMBATINFO = 
+{
+    {"nSrcUID",           "string"},
+    {"mode",                "int"},
+    {"combatInfo",        "table"},
 }

+ 10 - 1
script/common/InnerProtoID.lua

@@ -6,4 +6,13 @@ _ENV[5] = 'WL_MOZHU_QUERY'
 _ENV[6] = 'WL_HELLO'
 _ENV[7] = 'WL_HEARTBEAT'
 _ENV[8] = 'LW_MIDDLE_CHAT'
-_ENV[9] = 'WL_MIDDLE_CHAT'
+_ENV[9] = 'WL_MIDDLE_CHAT'
+_ENV[10] = 'LW_MIDDLE_CHAT_QUERY_HERO_DATA'
+_ENV[11] = 'WL_MIDDLE_CHAT_QUERY_HERO_DATA'
+_ENV[12] = 'LW_MIDDLE_CHAT_GET_HERO_DATA'
+_ENV[13] = 'WL_MIDDLE_CHAT_GET_HERO_DATA'
+_ENV[14] = 'LW_WARREPORT_GET_COMBATINFO'
+_ENV[15] = 'WL_WARREPORT_GET_COMBATINFO'
+_ENV[16] = 'LW_WARREPORT_SEND_COMBATINFO'
+_ENV[17] = 'WL_WARREPORT_SEND_COMBATINFO'
+

+ 1 - 0
script/core/ObjHuman.lua

@@ -655,6 +655,7 @@ function sendHumanInfo(human,isNew)
 		mm.nSpeed[3] = human.db.nSpeed[3] and human.db.nSpeed[3] or 0
 	end
 	
+	mm.nServerIndex = Config.SVR_INDEX
 
 	Msg.send(mm, human.fd)
 end

+ 6 - 1
script/module/chat/Handler.lua

@@ -101,7 +101,12 @@ function CG_CHAT_HERO_SHARE(human,msg)
         return 		
 	end
     msg.videoUuid = ""
-	ChatLogic.chat(human, msg,CHAT_HERO_SHARE)
+	local flag = ChatLogic.chat(human, msg,CHAT_HERO_SHARE)
+    if flag == true then
+        Broadcast.sendErr(human, Lang.SHARE_SUCCESS)
+    else
+        Broadcast.sendErr(human, Lang.SHARE_ERROR)
+    end
 end
 
 --战斗界面 战斗记录分享

+ 1 - 1
script/module/hero/Handler.lua

@@ -143,7 +143,7 @@ end
 
 -- 查看分享英雄的信息
 function CG_HERO_SHARE_DATA(human, msg)
-	HeroLogic.shareData(human, msg.uuid, msg.heroIndex)
+	HeroLogic.shareData(human, msg.uuid, msg.heroIndex, msg.nChatType, msg.nServerIndex)
 end
 
 

+ 17 - 11
script/module/hero/HeroLogic.lua

@@ -67,7 +67,7 @@ local BingshuLogic = require("fuwen.BingshuLogic")
 local YunYingLogic = require("yunying.YunYingLogic")
 local BingshuLogic = require("fuwen.BingshuLogic")
 local GiftLogic = require("topup.GiftLogic")
-
+local HeroMiddleLogic = require("hero.HeroMiddleLogic")
 
 HERO_MAX_STAR    =        15    -- 目前英雄最大星级
 
@@ -1570,19 +1570,25 @@ function getHeroShareGrid(uuid, heroIndex)
 	return heroGrid, bagIndex, fakeHuman
 end
 
-function shareData(human, uuid, heroIndex)
-	local msgRet = Msg.gc.GC_HERO_SHARE_DATA
-	local heroGrid, bagIndex, fakeHuman = getHeroShareGrid(uuid, heroIndex) 
-	if heroGrid then
-		if not makeHeroShare(msgRet.data, heroGrid, bagIndex, fakeHuman) then
-			return
+function shareData(human, uuid, heroIndex, nChatType, nServerIndex)
+	print("[shareData] 获取跨服数据开始 uuid = "..uuid.." heroIndex = "..heroIndex.." nChatType = "..nChatType.." nServerIndex = "..nServerIndex)
+	if -1 >= nChatType or -1 >= nServerIndex then
+		local msgRet = Msg.gc.GC_HERO_SHARE_DATA
+		local heroGrid, bagIndex, fakeHuman = getHeroShareGrid(uuid, heroIndex) 
+		if heroGrid then
+			if not makeHeroShare(msgRet.data, heroGrid, bagIndex, fakeHuman) then
+				return
+			end
+		else
+			local monsterID, mosnterLv = JjcLogic.getHeroShareMonster(uuid, heroIndex)
+			if not monsterID then return end
+			makeHeroShareMonster(msgRet.data, monsterID, mosnterLv)
 		end
+		Msg.send(msgRet, human.fd)
 	else
-		local monsterID, mosnterLv = JjcLogic.getHeroShareMonster(uuid, heroIndex)
-		if not monsterID then return end
-		makeHeroShareMonster(msgRet.data, monsterID, mosnterLv)
+		print("[shareData] 获取跨服数据开始 uuid = "..uuid.." heroIndex = "..heroIndex.." nChatType = "..nChatType.." nServerIndex = "..nServerIndex)
+		HeroMiddleLogic.HeroMiddleLogic_QueryHeroData_LW(human, uuid, heroIndex, nChatType, nServerIndex)
 	end
-	Msg.send(msgRet, human.fd)
 end
 
 -- 获取英雄背包中 最大等级的英雄

+ 90 - 0
script/module/hero/HeroMiddleLogic.lua

@@ -0,0 +1,90 @@
+--------------------------------
+-- 文件名       :  HeroMiddleLogic.lua
+-- 文件说明     :  中心服获取玩家信息, 处理其他服务器获取跨服玩家信息
+-- 创建时间     :   2025/02/18
+-- 创建人       :   FC
+--------------------------------
+
+local Util = require("common.Util")
+local ObjHuman = require("core.ObjHuman")
+local InnerMsg = require("core.InnerMsg")
+local ChatHandler = require("chat.Handler")
+local Config = require("Config")
+local Msg = require("core.Msg")
+local HeroLogic = require("hero.HeroLogic")
+local JjcLogic = require("jjc.JjcLogic")
+
+-- 请求聊天分享的英雄数据
+function HeroMiddleLogic_QueryHeroData_LW(human, uuid, heroIndex, nChatType, nServerIndex)
+    if ChatHandler.CHAT_TYPE_MIDDLE ~= nChatType and ChatHandler.CHAT_TYPE_WARZONE ~= nChatType then
+        return
+    end
+
+    local lwMsgRet = InnerMsg.lw.LW_MIDDLE_CHAT_QUERY_HERO_DATA
+    lwMsgRet.nSrcServerID = Config.SVR_INDEX
+    lwMsgRet.nDesServerID = nServerIndex
+    lwMsgRet.nSrcUID = human.db._id
+    lwMsgRet.nDesUID = uuid
+    lwMsgRet.nHeroIndex = heroIndex
+    lwMsgRet.nChatType = nChatType
+
+    print("[HeroMiddleLogic_QueryHeroData_LW] 发送数据到中心服 nSrcServerID = "..lwMsgRet.nSrcServerID.." nDesServerID = "..lwMsgRet.nDesServerID)
+    InnerMsg.sendMsg(0, lwMsgRet)
+end
+
+-- 获取玩家分享的英雄数据
+function HeroMiddleLogic_QueryHeroData_WL(fd, tMsgData)
+    local sFindUID = tMsgData.nDesUID
+    local nHeroIndex = tMsgData.nHeroIndex
+
+    local tHeroData = Msg.gc.GC_HERO_SHARE_DATA
+    local heroGrid, bagIndex, fakeHuman = HeroLogic.getHeroShareGrid(sFindUID, nHeroIndex)
+    if heroGrid then
+        if not HeroLogic.makeHeroShare(tHeroData.data, heroGrid, bagIndex, fakeHuman) then
+            print("[HeroMiddleLogic_QueryHeroData_WL] 获取玩家数据失败")
+            return
+        end
+    else
+        local monsterID, mosnterLv = JjcLogic.getHeroShareMonster(sFindUID, nHeroIndex)
+        if not monsterID then return end
+        HeroLogic.makeHeroShareMonster(tHeroData.data, monsterID, mosnterLv)
+    end
+
+    local lwMsgRet = InnerMsg.lw.LW_MIDDLE_CHAT_GET_HERO_DATA
+    lwMsgRet.nSrcUID = tMsgData.nSrcUID
+    lwMsgRet.nSrcServerID = tMsgData.nSrcServerID
+    lwMsgRet.tHeroData = tHeroData
+
+    print("[HeroMiddleLogic_QueryHeroData_WL] 发送数据到中心服 nSrcServerID = "..lwMsgRet.nSrcServerID)
+    InnerMsg.sendMsg(0, lwMsgRet)
+end
+
+function HeroMiddleLogic_GetHeroData_WL(fd, tMsgData)
+    local nSrcUID = tMsgData.nSrcUID
+    local human = ObjHuman.onlineUuid[nSrcUID]
+    if not human then
+        print("[HeroMiddleLogic_GetHeroData_WL] 玩家不在线直接返回")
+        return
+    end
+
+    -- print("[HeroMiddleLogic_GetHeroData_WL] 获取到数据 nSrcServerID = ")
+
+    -- table.print_lua_table(tMsgData)
+    -- print("\n")
+
+    local msgRet = Msg.gc.GC_HERO_SHARE_DATA
+    msgRet.data = tMsgData.tHeroData.data
+    -- if nil == _G.next(tMsgData.tHeroData.data.equips) then
+    --     msgRet.data.equips[0] = 0
+    -- end
+
+    -- if nil == _G.next(tMsgData.tHeroData.data.fuWens) then
+    --     msgRet.data.fuWens[0] = 0
+    -- end
+
+    -- if nil == _G.next(tMsgData.tHeroData.data.heroSimple.gemData) then
+    --     msgRet.data.heroSimple.gemData[0] = 0
+    -- end
+
+    Msg.send(msgRet, human.fd)
+end

+ 2 - 0
script/module/hero/Proto.lua

@@ -582,6 +582,8 @@ GC_SHENQI_UPLV_DO = {
 CG_HERO_SHARE_DATA = {
 	{"uuid",           1,         "string"},
 	{"heroIndex",      1,         "int"},
+	{"nChatType",		1,			"int"},
+	{"nServerIndex",	1,			"int"},
 }
 HeroShareData = {
 	{"uuid",           		1,      "string"},

+ 72 - 0
script/module/middle/MiddleConnect.lua

@@ -245,4 +245,76 @@ function LW_MIDDLE_CHAT(fd, msg)
         print("[LW_MIDDLE_CHAT] 未处理的发送消息结束")
     end
 
+end
+
+-- 获取聊天英雄信息
+function LW_MIDDLE_CHAT_QUERY_HERO_DATA(fd, msg)
+    local nDesServerID = msg.nDesServerID
+    local nDesFD = MiddleManager.getFDBySvrIndex(nDesServerID)
+    if not nDesFD then
+        print("[LW_MIDDLE_CHAT_QUERY_HERO_DATA] 不存在对应的fd nDesServerID = "..nDesServerID)
+        return
+    end
+    print("[LW_MIDDLE_CHAT_QUERY_HERO_DATA] nDesServerID = "..nDesServerID.." nDesFD = "..nDesFD)
+
+    local szMsgData = InnerMsg.wl.WL_MIDDLE_CHAT_QUERY_HERO_DATA
+    szMsgData.nSrcServerID = msg.nSrcServerID
+    szMsgData.nSrcUID = msg.nSrcUID
+    szMsgData.nDesUID = msg.nDesUID
+    szMsgData.nHeroIndex = msg.nHeroIndex
+    szMsgData.nChatType = msg.nChatType
+
+    InnerMsg.sendMsg(nDesFD, szMsgData)
+end
+
+function LW_MIDDLE_CHAT_GET_HERO_DATA(fd, msg)
+    local nSrcServerID = msg.nSrcServerID
+    local nSrcFD =  MiddleManager.getFDBySvrIndex(nSrcServerID)
+    if not nSrcFD then
+        print("[LW_MIDDLE_CHAT_GET_HERO_DATA] 不存在对应的fd nSrcServerID = "..nSrcServerID)
+        return
+    end
+
+    print("[LW_MIDDLE_CHAT_GET_HERO_DATA] nSrcServerID = "..nSrcServerID.." nSrcFD = "..nSrcFD)
+
+    local szMsgData = InnerMsg.wl.WL_MIDDLE_CHAT_GET_HERO_DATA
+    szMsgData.nSrcUID = msg.nSrcUID
+    szMsgData.tHeroData = msg.tHeroData
+
+    InnerMsg.sendMsg(nSrcFD, szMsgData)
+end
+
+function LW_WARREPORT_GET_COMBATINFO(fd, msg)
+    local nDesServerID = msg.nDesServerID
+    local nDesFD = MiddleManager.getFDBySvrIndex(nDesServerID)
+    --local nSrcFD = MiddleManager.getFDBySvrIndex(msg.nSrcServerID)
+    if not nDesFD then
+        print("[LW_WARREPORT_GET_COMBATINFO] 不存在对应的fd nDesServerID = "..nDesServerID.." nSrcServerID = "..msg.nSrcServerID)
+        return
+    end
+
+    local tMsgData = InnerMsg.wl.WL_WARREPORT_GET_COMBATINFO
+    tMsgData.nSrcUID = msg.nSrcUID
+    tMsgData.type = msg.type
+    tMsgData.id = msg.id
+    tMsgData.nSrcServerID = msg.nSrcServerID
+    tMsgData.mode = msg.mode
+
+    InnerMsg.sendMsg(nDesFD, tMsgData)
+end
+
+function LW_WARREPORT_SEND_COMBATINFO(fd, msg)
+    local nSrcServerID = msg.nSrcServerID
+    local nSrcFD =  MiddleManager.getFDBySvrIndex(nSrcServerID)
+    if not nSrcFD then
+        print("[LW_MIDDLE_CHAT_GET_HERO_DATA] 不存在对应的fd nSrcServerID = "..nSrcServerID)
+        return
+    end
+
+    local tMsgData = InnerMsg.wl.WL_WARREPORT_SEND_COMBATINFO
+    tMsgData.nSrcUID = msg.nSrcUID
+    tMsgData.combatInfo = msg.combatInfo
+    tMsgData.mode = msg.mode
+
+    InnerMsg.sendMsg(nSrcFD, tMsgData)
 end

+ 1 - 0
script/module/scene/Proto.lua

@@ -56,6 +56,7 @@ GC_ZZ_HUMAN_INFO = {
     {"drawCardRateList",      1, "string"}, -- 抽奖等级概率列表
 	{"warOrder" ,       4, WarOrder},         -- 战令信息
 	{"nSpeed",			5,	"short"},		-- 速度
+	{"nServerIndex",	1,	"int"},			-- 服务器Index
 }
 GC_ENTER_CITY = {}
 

+ 37 - 23
script/module/warReport/WarReportLogic.lua

@@ -1,5 +1,5 @@
 -------------------------------------------------------
--- ս��
+-- 战报
 
 -- 
 -------------------------------------------------------
@@ -28,22 +28,23 @@ local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
 local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
 local ItemDefine = require("bag.ItemDefine")
 local HeroGrowUp = require("absAct.HeroGrowUp")
+local Config = require("Config")
 
-WAR_REPORT_1 = 1 -- �ھ�����
-WAR_REPORT_2 = 2 -- ��������
-WAR_REPORT_3 = 3 -- ����
-WAR_REPORT_4 = 4 -- �д�
+WAR_REPORT_1 = 1 -- 冠军联赛
+WAR_REPORT_2 = 2 -- 王者争霸
+WAR_REPORT_3 = 3 -- 天梯
+WAR_REPORT_4 = 4 -- 切磋
 WAR_COUNT_MAX  = 30    
 WAR_COUNT_MAX1 = 20
 WAR_JJC_RANK   = 20
 WAR_FRIEND_RANK  = 30
-WAR_ADMIRE = 3   -- ���޴���
-WAR_COMBATINFO_PLAYBACK = 1  -- ����ս���������ڻط�
-WAR_COMBATINFO_HARM     = 2  -- ����ս�����������˺��б�
-WAR_OP_CONFIRM = 1  --ȷ��
-WAR_OP_CANCEL = 0  --ȡ��
-WAP_OP_TYPE1 = 1 --����
-WAP_OP_TYPE2 = 2 --�ղ�
+WAR_ADMIRE = 3   -- 点赞次数
+WAR_COMBATINFO_PLAYBACK = 1  -- 请求战斗数据用于回方
+WAR_COMBATINFO_HARM     = 2  -- 请求战斗数据用于伤害列表
+WAR_OP_CONFIRM = 1  --确认
+WAR_OP_CANCEL = 0  --取消
+WAP_OP_TYPE1 = 1 --点赞
+WAP_OP_TYPE2 = 2 --收藏
 WAP_REWARD_GOD = 3000
 
 local war_report_count = {
@@ -362,20 +363,33 @@ function sendFinish(human, combatInfo)
 	Msg.send(msgRet,human.fd)
 end
 
--- �ط�
-function playBack(human, type, id)
-   -- �������������ķ�
-   local msgInner = {} --InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
-   msgInner.uuid = human.db._id
-   msgInner.type = type
-   msgInner.id = id
-   msgInner.mode = WAR_COMBATINFO_PLAYBACK
-   --InnerMsg.sendMsg(0, msgInner)
-   WarReportMiddle.LW_WARREPORT_GET_COMBATINFO(0,msgInner)
+-- 回放
+function playBack(human, type, id, nDesServerID)
+   print("[playBack] type = "..type.. " id = "..id.." nDesServerID = "..nDesServerID)
+   -- 本服
+   if -1 >= nDesServerID then
+      local msgInner = {} --InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
+      msgInner.uuid = human.db._id
+      msgInner.type = type
+      msgInner.id = id
+      msgInner.mode = WAR_COMBATINFO_PLAYBACK
+      --InnerMsg.sendMsg(0, msgInner)
+      WarReportMiddle.LW_WARREPORT_GET_COMBATINFO(0,msgInner)
+   else
+      -- 天梯赛请求中心服
+      local tMsgData = InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
+      tMsgData.nSrcUID = human.db._id
+      tMsgData.type = type
+      tMsgData.id = id
+      tMsgData.nSrcServerID = Config.SVR_INDEX
+      tMsgData.nDesServerID = nDesServerID
+      tMsgData.mode = WAR_COMBATINFO_PLAYBACK
+      InnerMsg.sendMsg(0, tMsgData)
+   end
 end
 
 
--- �������
+-- 操作结果
 function opResult(human, opType, id, result)
    local msgRet = Msg.gc.GC_WAR_REPORT_OP_RESULT
    msgRet.opType = opType

+ 58 - 22
script/module/warReport/WarReportMiddle.lua

@@ -1,5 +1,5 @@
 -------------------------------------------------------
--- ս��
+-- 战报
 
 --
 -------------------------------------------------------
@@ -15,7 +15,7 @@ local war_count_query = { war = 1 }
 local war_report_id = { _id = nil }
 local war_report_query = { war_index = nil, type = nil }
 
--- ��ȡս������
+-- 获取战报数据
 local function getWarReport(id)
     war_report_id._id = id
     local war_report_data = { }
@@ -26,7 +26,7 @@ local function getWarReport(id)
     return war_report_data
 end
 
--- �ղ�
+-- 收藏
 local function collectDo(type, id, op)
     if op ~= WarReportLogic.WAR_OP_CONFIRM and op ~= WarReportLogic.WAR_OP_CANCEL then
         return
@@ -46,13 +46,13 @@ local function collectDo(type, id, op)
     return true
 end
 
--- ����ȷ��
+-- 点赞确认
 local function admire(id, uuid)
 
     local war_report_data = getWarReport(id)
     if not war_report_data then return end
 
-    -- �Ѿ�����
+    -- 已经点赞
     if war_report_data.admireList and
         war_report_data.admireList[uuid] then
         return
@@ -65,10 +65,10 @@ local function admire(id, uuid)
     return true
 end
 
--- ��������
+-- 添加数据
 function LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
     
-    -- û������ ����
+    -- 没有索引 返回
     local war_data = { }
     LuaMongo.find(DB.db_war_report, war_count_query)
     if not LuaMongo.next(war_data) then
@@ -93,25 +93,25 @@ function LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
     warReport.defRank = defRank
     warReport.time = os.time()
 
-    -- ���ǵ����һ�� ����¼������
+    -- 覆盖掉最后一场 减少录像数据
     if LuaMongo.next(war_report_data) then
         if war_report_data.collect and war_report_data.collect > 0 then
-           -- ���ղص� ɾ������
+           -- 有收藏的 删掉索引
            LuaMongo.update(DB.db_war_report, war_report_query, { ["$unset"] = { ["war_index"] = 1 } })
 
-           -- �����µ�����
+           -- 插入新的数据
            LuaMongo.insert(DB.db_war_report, warReport)
 
         else
 
-           -- û���ղصĸ��ǵ�
+            -- 没有收藏的覆盖掉
            LuaMongo.update(DB.db_war_report, war_report_query, warReport)
         end
     else
         LuaMongo.insert(DB.db_war_report, warReport)
     end
 
-    -- ��������
+     -- 更新索引
     if war_index >= WarReportLogic.WAR_COUNT_MAX then
         war_index = 1
     else
@@ -122,7 +122,7 @@ function LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
 end
 
 
--- [ս��] ��������
+-- [战报] 请求数据
 function LW_WARREPORT_QUERY(fd, type, uuid, warReport, questType)
     local war_data_list = nil
     if questType == 1 then
@@ -144,7 +144,7 @@ function LW_WARREPORT_QUERY(fd, type, uuid, warReport, questType)
     WL_WARREPORT_QUERY(_,msgInner)
 end
 
--- [ս��] ���ݷ���
+-- [战报] 数据返回
 function WL_WARREPORT_QUERY(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -152,7 +152,7 @@ function WL_WARREPORT_QUERY(fd, msg)
     WarReportLogic.sendReport(human, msg.warReport, msg.questType)
 end
 
--- [ս��] ս���˺���¼
+-- [战报] 战斗伤害记录
 function LW_WARREPORT_GET_COMBATINFO(fd, msg)
     local war_report_data = getWarReport(msg.id)
     if not war_report_data then return end
@@ -165,7 +165,7 @@ function LW_WARREPORT_GET_COMBATINFO(fd, msg)
     WL_WARREPORT_GET_COMBATINFO(fd,msgInner)
 end
 
--- [ս��] ս���˺���¼ �ط�
+-- [战报] 战斗伤害记录 回放
 function WL_WARREPORT_GET_COMBATINFO(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -179,7 +179,7 @@ function WL_WARREPORT_GET_COMBATINFO(fd, msg)
     end
 end
 
--- [ս��] �ղ�
+-- [战报] 收藏
 function LW_WARREPORT_COLLECT(fd, msg)
     local war_report_data = getWarReport(msg.id)
     if not war_report_data then return end
@@ -197,7 +197,7 @@ function LW_WARREPORT_COLLECT(fd, msg)
     WL_WARREPORT_COLLECT(fd,msgInner)
 end
 
--- [ս��] �ղ�
+-- [战报] 收藏
 function WL_WARREPORT_COLLECT(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -205,7 +205,7 @@ function WL_WARREPORT_COLLECT(fd, msg)
     WarReportLogic.collectHumanDo(human, msg.type, msg.id, msg.op)
 end
 
--- [ս��] ����
+-- [战报] 点赞
 function LW_WARREPORT_ADMIRE(fd, msg)
     if not admire(msg.id, msg.uuid) then
        return
@@ -218,7 +218,7 @@ function LW_WARREPORT_ADMIRE(fd, msg)
     WL_WARREPORT_ADMIRE(fd,msgInner)
 end 
 
--- [ս��] ����
+-- [战报] 点赞
 function WL_WARREPORT_ADMIRE(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -227,12 +227,48 @@ function WL_WARREPORT_ADMIRE(fd, msg)
 end 
 
 
--- ս�����
+-- 战报清除
 local delQuery = {war = { ["$exists"] = 0}, war_index = { ["$exists"] = 0}, ["$or"] = {{collect = {["$exists"]=0}}, {collect = 0}}}
 function onZero()
    if _G.is_middle ~= true then 
       return 
    end
-   -- 0����� û������ ��û���ղص� ����
+   -- 0点清除 没有索引 且没有收藏的 数据
    LuaMongo.remove(DB.db_war_report, delQuery)
+end
+
+--------------------------- 以下是新的跨服获取战报相关数据 --------------------------------
+-- TODO : 理论上应该将这个地方代码重写,但是策划只管完成,也没给多的时间改就先这样吧
+
+-- 获取战报信息(中心->目标服)
+function WL_WARREPORT_GET_COMBATINFO_NEW(fd, msg)
+    -- 先获取数据
+    local war_report_data = getWarReport(msg.id)
+    if not war_report_data then
+        print("[WL_WARREPORT_GET_COMBATINFO_NEW] 跨服获取战报失败 id = "..msg.id)
+        return
+    end
+
+    local tMsgData = InnerMsg.lw.LW_WARREPORT_SEND_COMBATINFO
+    tMsgData.nSrcUID = msg.nSrcUID
+    tMsgData.mode = msg.mode
+    tMsgData.combatInfo = war_report_data.combatInfo
+    tMsgData.nSrcServerID = msg.nSrcServerID
+
+    InnerMsg.sendMsg(0, tMsgData)
+    print("[WL_WARREPORT_GET_COMBATINFO_NEW] 发送数据到指定的服务器完成")
+end
+
+function WL_WARREPORT_SEND_COMBATINFO(fd, msg)
+    local human = ObjHuman.onlineUuid[msg.nSrcUID]
+    if not human then 
+        return
+    end
+    
+    if msg.mode == WarReportLogic.WAR_COMBATINFO_PLAYBACK then
+        msg.combatInfo.panelID = PanelDefine.PANEL_ID_1018
+        CombatLogic.repeatCombat(human, msg.combatInfo)
+    elseif msg.mode == WarReportLogic.WAR_COMBATINFO_HARM then
+        WarReportLogic.sendFinish(human, msg.combatInfo)
+    end
 end