From f194ca807c0ef437b866e74db7cd4dcb02e531c3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 14 二月 2019 17:54:57 +0800
Subject: [PATCH] 6211 【后端】【1.6】合服任务单(运营活动支持合服定制)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py | 157 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 129 insertions(+), 28 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
index a2a665c..98026a1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -27,16 +27,17 @@
import PlayerWeekParty
import IPY_GameWorld
import ItemControler
+import PlayerSuccess
import ItemCommon
import GameWorld
import ChConfig
## 是否匹配中
def SetIsCrossPKMatching(curPlayer, isMatching):
- curPlayer.SetDict(ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
return
-def GetIsCrossPKMatching(curPlayer):
- return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IsCrossPKMatching) and IsCrossRealmPKMatchState()
+def GetIsCrossPKMatching(curPlayer):
+ return curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_IsCrossPKMatching) and IsCrossRealmPKMatchState()
def DoPlayerOnDay(curPlayer):
if GameWorld.IsCrossServer():
@@ -65,6 +66,7 @@
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
SyncCrossRealmPKPlayerInfo(curPlayer)
@@ -90,6 +92,16 @@
## 跨服PK匹配赛是否开启
return GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossDailyActionState \
% ShareDefine.DailyActionID_CrossReamPK) == ChConfig.Def_Action_Open
+
+def GetCrossPKDanAwardIpyData(seasonID, awardDanLV, isLog):
+ ## 获取跨服段位奖励配置信息
+ crossZoneName = GameWorld.GetCrossZoneName()
+ danLVAwardIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CrossRealmPKDanAward", crossZoneName, seasonID, awardDanLV)
+ if not danLVAwardIpyData:
+ danLVAwardIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CrossRealmPKDanAward", "", seasonID, awardDanLV)
+ if not danLVAwardIpyData and isLog:
+ GameWorld.ErrLog("找不到段位奖励配置: seasonID=%s, awardDanLV=%s" % (seasonID, awardDanLV))
+ return danLVAwardIpyData
def OnCrossRealmPKSeasonChange(value):
## 赛区赛季状态变更,规定所有赛区的赛季ID都一样,且赛季ID一定是自增的,所以这里只判断赛季ID变更即可
@@ -137,10 +149,10 @@
# 邮件发放上赛季未领取的段位奖励、赛季奖励(排名或段位)
for awardDanLV in xrange(playerDanLV + 1):
- danLVIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", awardDanLV)
- if not danLVIpyData:
+ danLVAwardIpyData = GetCrossPKDanAwardIpyData(seasonID, awardDanLV, False)
+ if not danLVAwardIpyData:
continue
- awardItemList = danLVIpyData.GetDanLVAwardList()
+ awardItemList = danLVAwardIpyData.GetDanLVAwardList()
if not awardItemList:
continue
if pow(2, awardDanLV) & danLVAwardState:
@@ -155,7 +167,7 @@
DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, True, mailDetail)
# 查询 GameServer 玩家赛季排名
- if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardState):
+ if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardState) and playerDanLV:
OnQueryCrossPKSeasonOrderAward(curPlayer, zoneID, seasonID, True)
# 重置状态
@@ -168,6 +180,7 @@
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLVAwardState, 0)
@@ -229,9 +242,11 @@
if dayFreeMatchCountMax:
todayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
- if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount):
- GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s)"
- % (todayPKCount, dayFreeMatchCountMax, todayBuyCount), playerID)
+ todayItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
+
+ if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount + todayItemAddCount):
+ GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s + todayItemAddCount=%s)"
+ % (todayPKCount, dayFreeMatchCountMax, todayBuyCount, todayItemAddCount), playerID)
return
dataMsg = {
@@ -269,6 +284,32 @@
isWinner = winnerID == playerID
GameWorld.Log("地图收到跨服PK结算: isWinner=%s,roomID=%s,zoneID=%s,seasonID=%s,timeStr=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s,pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s,tagPlayerID=%s,notifyState=%s"
% (isWinner, roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, notifyState), playerID)
+
+ isToday = GameWorld.CheckTimeIsSameServerDayEx(GameWorld.ChangeTimeStrToNum(timeStr))
+ if not __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
+ return
+
+ ## 跨服已经通知过了,证明还在跨服服务器,不做以下的处理
+ if notifyState:
+ return
+
+ overPack = ChPyNetSendPack.tagGCCrossRealmPKOverInfo()
+ overPack.TimeStr = timeStr
+ overPack.OverType = overType
+ overPack.WinnerID = winnerID
+ overPack.RoundWinnerID = roundWinnerIDList
+ overPack.RoundCount = len(overPack.RoundWinnerID)
+ overPack.AddScore = addScore
+ overPack.Score = pkScore
+ overPack.DanLV = danLV
+ overPack.CWinCnt = cWinCount
+ overPack.TagName = tagPlayerName
+ overPack.TagNameLen = len(overPack.TagName)
+ NetPackCommon.SendFakePack(curPlayer, overPack)
+ return
+
+def __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
+ playerID = curPlayer.GetPlayerID()
curSeasonID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID)
if curSeasonID != seasonID:
GameWorld.Log(" 非本赛季的结算信息,不处理!curSeasonID=%s,seasonID=%s" % (curSeasonID, seasonID), playerID)
@@ -300,7 +341,7 @@
GameWorld.Log(" loser cWinCount=0", playerID)
# 同一天的话增加当日PK次数
- if GameWorld.CheckTimeIsSameServerDayEx(GameWorld.ChangeTimeStrToNum(timeStr)):
+ if isToday:
todayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount) + 1
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, todayPKCount)
GameWorld.Log(" 同一天的PK结算增加今日PK次数: todayPKCount=%s" % todayPKCount, playerID)
@@ -310,28 +351,79 @@
GameWorld.Log(" 增加今日已获胜次数: todayWinCount=%s" % todayWinCount, playerID)
PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_CrossReamPK)
PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_CrossPK, 1)
+ PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_CrossPK, 1)
else:
GameWorld.Log(" 不同天的PK结算不增加今日PK次数! ", playerID)
SyncCrossRealmPKPlayerInfo(curPlayer)
-
- ## 跨服已经通知过了,证明还在跨服服务器,不做以下的处理
- if notifyState:
+ return True
+
+#// C1 08 跨服PK挑战机器人结算 #tagCMCrossRealmPKRobotOver
+#
+#struct tagCMCrossRealmPKRobotOver
+#{
+# tagHead Head;
+# BYTE IsWin; //是否获胜
+#};
+def OnCrossRealmPKRobotOver(index, clientData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ playerID = curPlayer.GetPlayerID()
+ isWinner = clientData.IsWin
+ billboardCfg = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKCfg", 1, [])
+ if not billboardCfg or len(billboardCfg) != 2:
+ GameWorld.ErrLog("跨服竞技场排行榜配置错误!")
+ return
+ danLVLimit = billboardCfg[1]
+ playerDanLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
+ #策划设计该机器人目的为了前期体验,这里只验证是否超过上榜段位即可,即使作弊也不管,只要有次数即可
+ if playerDanLV >= danLVLimit:
+ GameWorld.ErrLog("该段位不允许与机器人匹配PK!playerDanLV=%s,danLVLimit=%s" % (playerDanLV, danLVLimit), playerID)
return
+ zoneID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
+ seasonID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID)
+ pkScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore)
+ danLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
+ cWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CWinCount)
+
+ ondayScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_OnDayScore)
+ dayScore = max(0, pkScore - ondayScore) # 今日已获得积分,正积分
+
+ baseScoreList = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKScore", 2) # 胜负保底分
+ wBaseScore = baseScoreList[0] if len(baseScoreList) > 0 else 0
+ lBaseScore = baseScoreList[1] if len(baseScoreList) > 1 else 0
+ wExScore = eval(IpyGameDataPY.GetFuncCompileCfg("CrossRealmPKScore", 3)) # 胜方附加分
+ lExScore = 0
+
+ if isWinner:
+ addScore = wBaseScore + wExScore
+ cWinCount += 1
+ else:
+ addScore = lBaseScore + lExScore
+ cWinCount = 0
+
+ dayMaxScore = IpyGameDataPY.GetFuncCfg("CrossRealmPKScore", 1) # 每日获得积分上限,0为不限制
+ if dayMaxScore and addScore:
+ addScore = min(dayMaxScore - dayScore, addScore)
+
+ GameWorld.Log("机器人跨服PK结算: isWinner=%s,zoneID=%s,seasonID=%s,pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s"
+ % (isWinner, zoneID, seasonID, pkScore, danLV, cWinCount, addScore), playerID)
+
+ pkScore += addScore
+ winIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
+ if winIpyData and winIpyData.GetLVUpScore() and pkScore >= winIpyData.GetLVUpScore():
+ danLV += 1
+
+ # 只同步以下信息,其他信息前端自行补全
overPack = ChPyNetSendPack.tagGCCrossRealmPKOverInfo()
- overPack.TimeStr = timeStr
- overPack.OverType = overType
- overPack.WinnerID = winnerID
- overPack.RoundWinnerID = roundWinnerIDList
- overPack.RoundCount = len(overPack.RoundWinnerID)
overPack.AddScore = addScore
overPack.Score = pkScore
overPack.DanLV = danLV
overPack.CWinCnt = cWinCount
- overPack.TagName = tagPlayerName
- overPack.TagNameLen = len(overPack.TagName)
NetPackCommon.SendFakePack(curPlayer, overPack)
+
+ isToday = True # 机器人结算的默认当天
+ __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday)
return
@@ -446,17 +538,21 @@
if playerDanLV < awardDanLV:
GameWorld.DebugLog(" 段位未达标,无法领取!", playerID)
return
- danLVIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", awardDanLV)
- if not danLVIpyData:
+ danLVAwardIpyData = GetCrossPKDanAwardIpyData(seasonID, awardDanLV, True)
+ if not danLVAwardIpyData:
return
awardIndex = awardDanLV
awardStateDictName = ChConfig.Def_PDict_CrossPK_DanLVAwardState
- awardItemList = danLVIpyData.GetDanLVAwardList()
+ awardItemList = danLVAwardIpyData.GetDanLVAwardList()
eventName = "DanLV"
drDataDict = {"awardDanLV":awardDanLV}
elif awardType == 4:
GameWorld.DebugLog("玩家领取赛季结算奖励!", playerID)
+ totalScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore)
+ if not totalScore:
+ GameWorld.DebugLog("无赛季积分无法领取奖励!", playerID)
+ return
if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonState) != 2:
GameWorld.DebugLog("非赛季结算阶段,不可领取!", playerID)
return
@@ -559,7 +655,11 @@
"order":order, "danLV":danLV, "mapSeasonID":mapSeasonID}
if order > 0:
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonOrder % seasonID, order)
- seasonOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKAward", 3, {}) # {"名次":[[物品ID,个数,是否绑定], ...], ...}
+ crossZoneName = GameWorld.GetCrossZoneName()
+ seasonOrderAwardIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CrossRealmPKOrderAward", crossZoneName, seasonID)
+ if not seasonOrderAwardIpyData:
+ seasonOrderAwardIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKOrderAward", "", seasonID)
+ seasonOrderAwardDict = {} if not seasonOrderAwardIpyData else seasonOrderAwardIpyData.GetOrderAwardInfo() # {"名次":[[物品ID,个数,是否绑定], ...], ...}
awardOrderList = seasonOrderAwardDict.keys()
awardOrderList = [int(k) for k in awardOrderList]
awardOrderList.sort()
@@ -580,10 +680,10 @@
# 没有奖励的话取段位奖励
if not awardItemList:
- danLVIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
- if not danLVIpyData:
+ danLVAwardIpyData = GetCrossPKDanAwardIpyData(seasonID, danLV, False)
+ if not danLVAwardIpyData:
return
- awardItemList = danLVIpyData.GetSeasonDanLVAwardList()
+ awardItemList = danLVAwardIpyData.GetSeasonDanLVAwardList()
mailTypeKey = "CrossServer5"
notifyKey = "CrossMatching24"
mailParamList = [seasonID, danLV]
@@ -633,6 +733,7 @@
pkPlayerInfo.DayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
pkPlayerInfo.DayWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayWinCount)
pkPlayerInfo.DayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+ pkPlayerInfo.DayItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
NetPackCommon.SendFakePack(curPlayer, pkPlayerInfo)
return
--
Gitblit v1.8.0