Parcourir la source

跨服战报和分享英雄

SCFC il y a 1 an
Parent
commit
8f7e1dc2f0

+ 7 - 0
script/common/InnerHandler.lua

@@ -118,6 +118,13 @@ function WL_WARREPORT_GET_COMBATINFO(fd, msg)
     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] 获取到其他服消息 获取到战报录像信息回包")
 

+ 10 - 2
script/common/InnerProto.lua

@@ -94,9 +94,17 @@ WL_WARREPORT_GET_COMBATINFO =
     {"nSrcUID",           "string"},
     {"type",              "int"},
     {"id",                "string"},
-    -- {"nSrcServerID",        "int"},     -- 源服务器ID
-    {"nSrcFD",              "int"},
+    {"nSrcServerID",        "int"},     -- 源服务器ID
+    {"mode",                "int"},
+}
+
+-- 发送战报数据
+LW_WARREPORT_SEND_COMBATINFO = 
+{
+    {"nSrcUID",           "string"},
     {"mode",                "int"},
+    {"combatInfo",        "table"},
+    {"nSrcServerID",        "int"},     -- 源服务器ID
 }
 
 WL_WARREPORT_SEND_COMBATINFO = 

+ 2 - 1
script/common/InnerProtoID.lua

@@ -13,5 +13,6 @@ _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] = 'WL_WARREPORT_SEND_COMBATINFO'
+_ENV[16] = 'LW_WARREPORT_SEND_COMBATINFO'
+_ENV[17] = 'WL_WARREPORT_SEND_COMBATINFO'
 

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

@@ -98,7 +98,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
 
 --战斗界面 战斗记录分享

+ 21 - 5
script/module/middle/MiddleConnect.lua

@@ -140,7 +140,7 @@ function stopConnectMiddle()
 end
 
 function LW_HELLO(fd, msg)
-    --print("LW Hello fd = "..fd)
+    print("LW Hello fd = "..fd)
     --table.print_lua_table(msg)
     --local stackTrace = debug.traceback("", 2)
 	--print("[LW_HELLO] 堆栈信息 "..stackTrace)
@@ -164,7 +164,7 @@ function LW_HELLO(fd, msg)
 end
 
 function WL_HELLO(fd, msg)
-    print("WL hello")
+    print("WL hello fd = "..fd)
     Log.write(Log.LOGID_INNER_CLOSE, "WL_HELLO")
 
     if not IS_MIDDLE_CONNECT then
@@ -287,8 +287,8 @@ 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 or not nSrcFD then
+    --local nSrcFD = MiddleManager.getFDBySvrIndex(msg.nSrcServerID)
+    if not nDesFD then
         print("[LW_WARREPORT_GET_COMBATINFO] 不存在对应的fd nDesServerID = "..nDesServerID.." nSrcServerID = "..msg.nSrcServerID)
         return
     end
@@ -297,7 +297,23 @@ function LW_WARREPORT_GET_COMBATINFO(fd, msg)
     tMsgData.nSrcUID = msg.nSrcUID
     tMsgData.type = msg.type
     tMsgData.id = msg.id
-    tMsgData.nSrcFD = nSrcFD
+    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)

+ 5 - 2
script/module/warReport/WarReportMiddle.lua

@@ -249,11 +249,14 @@ function WL_WARREPORT_GET_COMBATINFO_NEW(fd, msg)
         return
     end
 
-    local tMsgData = InnerMsg.wl.WL_WARREPORT_SEND_COMBATINFO
+    local tMsgData = InnerMsg.lw.LW_WARREPORT_SEND_COMBATINFO
     tMsgData.nSrcUID = msg.nSrcUID
     tMsgData.mode = msg.mode
     tMsgData.combatInfo = war_report_data.combatInfo
-    InnerMsg.sendMsg(msg.nSrcFD, tMsgData)
+    tMsgData.nSrcServerID = msg.nSrcServerID
+
+    InnerMsg.sendMsg(0, tMsgData)
+    print("[WL_WARREPORT_GET_COMBATINFO_NEW] 发送数据到指定的服务器完成")
 end
 
 function WL_WARREPORT_SEND_COMBATINFO(fd, msg)