|
|
@@ -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
|