|
|
@@ -238,18 +238,21 @@ local function genUnionOccupyInfo(unionId, union, playerListData)
|
|
|
}
|
|
|
|
|
|
local now = os.time()
|
|
|
- local tbl = occupyTb.occupyCityArr
|
|
|
- tbl[#tbl+1] = union.baseCityId
|
|
|
+ local t1 = occupyTb.occupyCityArr
|
|
|
+ local t2 = occupyTb.point2CityIdArr
|
|
|
+
|
|
|
+ t1[#t1+1] = union.baseCityId
|
|
|
|
|
|
- local tbl2 = occupyTb.point2CityIdArr
|
|
|
for cityId, cityIno in pairs(union.occupCityList or {}) do
|
|
|
if cityIno.isOccupy then
|
|
|
- tbl[#tbl+1] = cityId
|
|
|
+ t1[#t1+1] = cityId
|
|
|
end
|
|
|
|
|
|
for _, pointInfo in pairs(cityIno.occupyPointList) do
|
|
|
if pointInfo.playerUuid then
|
|
|
- occupyTb.occuoyPointNum = occupyTb.occuoyPointNum + 1
|
|
|
+ if not cityIno.isOccupy then
|
|
|
+ occupyTb.occuoyPointNum = occupyTb.occuoyPointNum + 1
|
|
|
+ end
|
|
|
|
|
|
-- 更新据点最新占领时间段的结束时间
|
|
|
local occupyTimeArr = pointInfo.occupyTimeArr
|
|
|
@@ -259,14 +262,14 @@ local function genUnionOccupyInfo(unionId, union, playerListData)
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- tbl2[#tbl2+1] = {cityId, pointInfo.occupyTimeArr}
|
|
|
+ t2[#t2+1] = {cityId, pointInfo.occupyTimeArr}
|
|
|
end
|
|
|
end
|
|
|
|
|
|
-- 出生点算5个据点
|
|
|
local baseCiyuTimeArr = { {union.baseCityStartTime, union.baseCityEndTime or now } }
|
|
|
for i=1, AnotherWorldBattleDefine.AB_POINT_MAX_NUM do
|
|
|
- tbl2[#tbl2+1] = {union.baseCityId, baseCiyuTimeArr}
|
|
|
+ t2[#t2+1] = {union.baseCityId, baseCiyuTimeArr}
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -304,7 +307,7 @@ function IssueRewardManager()
|
|
|
end
|
|
|
end
|
|
|
|
|
|
--- 检测活动各阶段及相关处理
|
|
|
+-- 检测活动各阶段状态及相关处理
|
|
|
local function timedStageHandle()
|
|
|
-- 处于报名阶段
|
|
|
-- if table.find(AnotherWorldBattleDefine.AB_JOIN_WDAY_AREA, wDay) then
|
|
|
@@ -557,8 +560,7 @@ local function isCanChallengePoint(targetCityId, targetPointIdx, myUnionId, play
|
|
|
return -2
|
|
|
end
|
|
|
|
|
|
- local cityList = AnotherWorldBattleDB.GetCityListByGroupId(groupId)
|
|
|
- local tagetCityData = cityList[targetCityId]
|
|
|
+ local tagetCityData = AnotherWorldBattleDB.GetCityData(groupId, targetCityId)
|
|
|
if not tagetCityData then
|
|
|
return -3
|
|
|
end
|
|
|
@@ -839,8 +841,8 @@ function N2C_CityDetailed_Query(msg)
|
|
|
return errTips(msg.sourceServerId, playerUuid, AnotherWorldBattleDefine.ERR_CODE_3)
|
|
|
end
|
|
|
|
|
|
- local cityList = AnotherWorldBattleDB.GetCityListByGroupId(groupId)
|
|
|
- if not cityList or not cityList[targetCityId] then
|
|
|
+ local cityData = AnotherWorldBattleDB.GetCityData(groupId, targetCityId)
|
|
|
+ if not cityData then
|
|
|
return errTips(msg.sourceServerId, playerUuid, AnotherWorldBattleDefine.ERR_CODE_4)
|
|
|
end
|
|
|
|
|
|
@@ -853,9 +855,8 @@ function N2C_CityDetailed_Query(msg)
|
|
|
end
|
|
|
msgData.myUnionOccupyArr = myUnionOccupyArr
|
|
|
|
|
|
- local cityData = cityList[targetCityId]
|
|
|
- local pointArrMsg = msgData.pointArr
|
|
|
|
|
|
+ local pointArrMsg = msgData.pointArr
|
|
|
for pointIdx, occupyInfo in ipairs(cityData.pointArr) do
|
|
|
pointArrMsg[pointIdx] = {}
|
|
|
local state = isCanChallengePoint(targetCityId, pointIdx, myUnionId, playerUuid)
|
|
|
@@ -929,12 +930,11 @@ function N2C_PointDetailed_Query(msg)
|
|
|
return errTips(msg.sourceServerId, msg.playerUuid, AnotherWorldBattleDefine.ERR_CODE_3)
|
|
|
end
|
|
|
|
|
|
- local cityList = AnotherWorldBattleDB.GetCityListByGroupId(groupId)
|
|
|
- if not cityList or not cityList[targetCityId] then
|
|
|
+ local cityData = AnotherWorldBattleDB.GetCityData(groupId, targetCityId)
|
|
|
+ if not cityData then
|
|
|
return errTips(msg.sourceServerId, msg.playerUuid, AnotherWorldBattleDefine.ERR_CODE_4)
|
|
|
end
|
|
|
|
|
|
- local cityData = cityList[targetCityId]
|
|
|
local pointData = cityData.pointArr[targetPointIdx]
|
|
|
if not pointData then
|
|
|
return errTips(msg.sourceServerId, msg.playerUuid, AnotherWorldBattleDefine.ERR_CODE_4)
|
|
|
@@ -1226,8 +1226,8 @@ function N2C_Try_Challengde_Point(msg)
|
|
|
end
|
|
|
|
|
|
local groupId = getMyUnionGourpId(myUnionId)
|
|
|
- local cityList = AnotherWorldBattleDB.GetCityListByGroupId(groupId)
|
|
|
- local targetPointData = cityList[targetCityId].pointArr[targetPointIdx]
|
|
|
+ local cityData = AnotherWorldBattleDB.GetCityData(groupId, targetCityId)
|
|
|
+ local targetPointData = cityData.pointArr[targetPointIdx]
|
|
|
|
|
|
local pointOccupyInfo = {targetCityId = targetCityId, targetPointIdx = targetPointIdx}
|
|
|
if targetPointData.unionId then
|
|
|
@@ -1241,6 +1241,18 @@ function N2C_Try_Challengde_Point(msg)
|
|
|
pointOccupyInfo.isGather = 1
|
|
|
end
|
|
|
|
|
|
+ -- 检查据点是否有人挑战
|
|
|
+ local now = os.time()
|
|
|
+ local pointBattleTime = targetPointData.battleTime
|
|
|
+ if pointBattleTime and now - pointBattleTime < AnotherWorldBattleDefine.AB_POINT_BATTLE_TIME then
|
|
|
+ return errTips(msg.sourceServerId, playerUuid, AnotherWorldBattleDefine.ERR_CODE_10)
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 更新据点被挑战时间
|
|
|
+ targetPointData.battleTime = now
|
|
|
+ AnotherWorldBattleDB.UpdateCityData(groupId, targetCityId, cityData)
|
|
|
+
|
|
|
+
|
|
|
local msgData = InnerMsg.wl.WL_ANOTHERWORLDBATTLE_POINT_ISCAN_CHALLENGE
|
|
|
msgData.playerUuid = playerUuid
|
|
|
msgData.targetCityId = targetCityId
|
|
|
@@ -1273,8 +1285,7 @@ local function challenge_Win(msg)
|
|
|
return errTips(msg.sourceServerId, msg.playerUuid, AnotherWorldBattleDefine.ERR_CODE_3)
|
|
|
end
|
|
|
|
|
|
- local cityList = AnotherWorldBattleDB.GetCityListByGroupId(groupId)
|
|
|
- local cityData = cityList[targetCityId]
|
|
|
+ local cityData = AnotherWorldBattleDB.GetCityData(groupId, targetCityId)
|
|
|
local pointData = cityData.pointArr[targetPointIdx]
|
|
|
|
|
|
local now = os.time()
|
|
|
@@ -1328,6 +1339,9 @@ local function challenge_Win(msg)
|
|
|
pointData.unionId = myUnionId
|
|
|
pointData.playerUuid = playerUuid
|
|
|
|
|
|
+ -- 据点挑战结束
|
|
|
+ pointData.battleTime = nil
|
|
|
+
|
|
|
-- 更新进攻方公会数据—— 据点占有者, 最新的据点占有时间
|
|
|
myUnionData.occupCityList = myUnionData.occupCityList or {}
|
|
|
local occupCityList = myUnionData.occupCityList
|
|
|
@@ -1388,18 +1402,28 @@ local function challenge_Win(msg)
|
|
|
|
|
|
|
|
|
-- 更新城池数据
|
|
|
- AnotherWorldBattleDB.UpdateCityList(groupId, cityList)
|
|
|
+ AnotherWorldBattleDB.UpdateCityData(groupId, targetCityId, cityData)
|
|
|
end
|
|
|
-- 玩家挑战据点失败
|
|
|
local function challenge_Fail(msg)
|
|
|
local playerUuid = msg.playerUuid
|
|
|
local myUnionId = msg.myUnionId
|
|
|
+ local targetCityId = msg.targetCityId
|
|
|
+ local targetPointIdx = msg.targetPointIdx
|
|
|
|
|
|
local groupId = getMyUnionGourpId(myUnionId)
|
|
|
if not groupId then
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+ -- 据点挑战结束
|
|
|
+ local cityData = AnotherWorldBattleDB.GetCityData(groupId, targetCityId)
|
|
|
+ if cityData and cityData.pointArr[targetPointIdx] then
|
|
|
+ local targetPointData = cityData.pointArr[targetPointIdx]
|
|
|
+ targetPointData.battleTime = nil
|
|
|
+ AnotherWorldBattleDB.UpdateCityData(groupId, targetCityId, cityData)
|
|
|
+ end
|
|
|
+
|
|
|
local playerData = AnotherWorldBattleDB.GetPlayerData(playerUuid)
|
|
|
playerData = playerData or {}
|
|
|
playerData.name = playerData.name
|