From 2eb39c9fe42c1ee32500f81c4bf7d735c6116d9d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 30 七月 2019 00:26:20 +0800
Subject: [PATCH] 8180 【后端】【主干】优化打boss掉落套装体验
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py | 268 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 193 insertions(+), 75 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 a4ca269..36e621f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -19,21 +19,25 @@
import PlayerControl
import NetPackCommon
import IpyGameDataPY
+import PlayerActivity
import ChPyNetSendPack
import CrossRealmPlayer
import FunctionNPCCommon
import DataRecordPack
+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)
+def GetIsCrossPKMatching(curPlayer):
+ return curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_IsCrossPKMatching) and IsCrossRealmPKMatchState()
def DoPlayerOnDay(curPlayer):
if GameWorld.IsCrossServer():
@@ -62,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)
@@ -87,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变更即可
@@ -134,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:
@@ -152,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)
# 重置状态
@@ -162,9 +177,11 @@
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
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)
@@ -196,6 +213,10 @@
GameWorld.DebugLog("跨服服务器无法发起匹配!", playerID)
return
+ if not CrossRealmPlayer.IsCrossServerOpen():
+ PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
+ return
+
if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
GameWorld.DebugLog("副本中,无法进行跨服匹配!", playerID)
return
@@ -218,15 +239,9 @@
# 进行匹配
if requestType == 1:
- dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
- 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)
- return
-
+ if not CheckHavePKCount(curPlayer):
+ return
+
dataMsg = {
"seasonID":GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID), # 赛季ID
"pkZoneID":GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID), # PK赛区
@@ -236,11 +251,13 @@
"playerJob":curPlayer.GetJob(),
"playerLV":curPlayer.GetLV(),
"maxHP":curPlayer.GetMaxHP(),
+ "maxProDef":PlayerControl.GetMaxProDef(curPlayer),
"fightPower":curPlayer.GetFightPower(),
"realmLV":curPlayer.GetOfficialRank(),
"pkScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore), # 当前积分
"danLV":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV), # 当前段位
"cWinCount":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CWinCount), # 连胜次数
+ "cLoseCount":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount), # 连败次数
"ondayScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_OnDayScore), # 过天时的积分
}
GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKMatch, dataMsg)
@@ -254,6 +271,20 @@
return
+def CheckHavePKCount(curPlayer):
+ ## 检查是否有PK次数
+ dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
+ if dayFreeMatchCountMax:
+ todayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
+ todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+ 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), curPlayer.GetPlayerID())
+ return False
+ return True
+
def CrossServerMsg_PKOverInfo(curPlayer, overInfo):
## 收到跨服服务器的PK结算信息
playerID = curPlayer.GetPlayerID()
@@ -261,41 +292,10 @@
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)
- curSeasonID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID)
- if curSeasonID != seasonID:
- GameWorld.Log(" 非本赛季的结算信息,不处理!curSeasonID=%s,seasonID=%s" % (curSeasonID, seasonID), playerID)
+
+ isToday = GameWorld.CheckTimeIsSameServerDayEx(GameWorld.ChangeTimeStrToNum(timeStr))
+ if not __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
return
-
- # 赛季已关闭
- if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonState) != 1:
- GameWorld.Log(" 赛季已关闭,不处理!seasonID=%s" % (seasonID), playerID)
- return
-
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ZoneID, zoneID)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonID, seasonID)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonDanLV % seasonID, danLV)
-
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TotalScore, pkScore)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLV, danLV)
-
- pkCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_PKCount) + 1
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, pkCount)
- if isWinner:
- winCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_WinCount) + 1
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, winCount)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, cWinCount)
- else:
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
-
- # 同一天的话增加当日PK次数
- if GameWorld.CheckTimeIsSameServerDayEx(GameWorld.ChangeTimeStrToNum(timeStr)):
- todayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount) + 1
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, todayPKCount)
- if isWinner:
- todayWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayWinCount) + 1
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, todayWinCount)
-
- SyncCrossRealmPKPlayerInfo(curPlayer)
## 跨服已经通知过了,证明还在跨服服务器,不做以下的处理
if notifyState:
@@ -316,6 +316,86 @@
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)
+ return
+
+ # 赛季已关闭
+ if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonState) != 1:
+ GameWorld.Log(" 赛季已关闭,不处理!seasonID=%s" % (seasonID), playerID)
+ return
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ZoneID, zoneID)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonID, seasonID)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonDanLV % seasonID, danLV)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonScore % seasonID, pkScore)
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TotalScore, pkScore)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLV, danLV)
+
+ pkCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_PKCount) + 1
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, pkCount)
+ GameWorld.Log(" 更新数据: danLV=%s,pkScore=%s,pkCount=%s" % (danLV, pkScore, pkCount), playerID)
+ if isWinner:
+ winCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_WinCount) + 1
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, winCount)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, cWinCount)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
+ GameWorld.Log(" winner winCount=%s,cWinCount=%s" % (winCount, cWinCount), playerID)
+ else:
+ cLoseCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount) + 1
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, cLoseCount)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
+ GameWorld.Log(" loser cLoseCount=%s" % cLoseCount, playerID)
+
+ # 同一天的话增加当日PK次数
+ 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)
+ if isWinner:
+ todayWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayWinCount) + 1
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, todayWinCount)
+ 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)
+ 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
+
+ if GameWorld.IsCrossServer():
+ GameWorld.DebugLog("跨服服务器无法发起机器人结算!", playerID)
+ return
+
+ if not CheckHavePKCount(curPlayer):
+ return
+
+ dataMsg = {
+ "playerID":playerID,
+ "isWinner":isWinner,
+ }
+ GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKRobotOver, dataMsg)
+ GameWorld.Log("同步跨服服务器与机器人PK结算: %s" % str(dataMsg), playerID)
+ return
+
#// C1 02 跨服PK购买次数 #tagCMCrossRealmPKBuy
#
@@ -326,12 +406,25 @@
def OnCrossRealmPKBuy(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
playerID = curPlayer.GetPlayerID()
+ if not CrossRealmPlayer.IsCrossServerOpen():
+ PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
+ return
+ if not IsCrossRealmPKMatchState():
+ GameWorld.DebugLog("跨服匹配未开启,不可进行购买次数!", playerID)
+ return
dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
if not dayFreeMatchCountMax:
GameWorld.DebugLog("每日匹配次数没有限制,不需要购买次数!", playerID)
return
- dayBuyCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 2)
+ todayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+ todayItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
+ canPKCount = dayFreeMatchCountMax + todayBuyCount + todayItemAddCount - todayPKCount
+ if canPKCount >= dayFreeMatchCountMax:
+ GameWorld.DebugLog("可PK次数不能大于每日免费次数!", playerID)
+ return
+ dayBuyCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 2)
+ #todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
if dayBuyCountMax and todayBuyCount >= dayBuyCountMax:
GameWorld.DebugLog("今日购买次数已满,无法购买!todayBuyCount=%s" % (todayBuyCount), playerID)
return
@@ -382,14 +475,15 @@
return
dayPKCountAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKAward", 1, {}) # {"次数":[[物品ID,个数,是否绑定], ...], ...}
awardPKCountList = dayPKCountAwardDict.keys()
+ awardPKCountList = [int(k) for k in awardPKCountList]
awardPKCountList.sort()
- awardPKCountStr = str(awardPKCount)
- if awardPKCountStr not in awardPKCountList:
+ GameWorld.DebugLog(" awardPKCountList=%s" % awardPKCountList, playerID)
+ if awardPKCount not in awardPKCountList:
GameWorld.DebugLog(" 没有该PK次数奖励!")
return
- awardIndex = awardPKCountList.index(awardPKCountStr)
+ awardIndex = awardPKCountList.index(awardPKCount)
awardStateDictName = ChConfig.Def_PDict_CrossPK_DayPKCountAwardState
- awardItemList = dayPKCountAwardDict[awardPKCountStr]
+ awardItemList = dayPKCountAwardDict[str(awardPKCount)]
eventName = "PKCount"
drDataDict = {"awardPKCount":awardPKCount}
@@ -402,14 +496,15 @@
return
dayWinCountAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKAward", 2, {}) # {"次数":[[物品ID,个数,是否绑定], ...], ...}
awardWinCountList = dayWinCountAwardDict.keys()
+ awardWinCountList = [int(k) for k in awardWinCountList]
awardWinCountList.sort()
- awardWinCountStr = str(awardWinCount)
- if awardWinCountStr not in awardWinCountList:
+ GameWorld.DebugLog(" awardWinCountList=%s" % awardWinCountList, playerID)
+ if awardWinCount not in awardWinCountList:
GameWorld.DebugLog(" 没有该胜利次数奖励!", playerID)
return
- awardIndex = awardWinCountList.index(awardWinCountStr)
+ awardIndex = awardWinCountList.index(awardWinCount)
awardStateDictName = ChConfig.Def_PDict_CrossPK_DayWinCountAwardState
- awardItemList = dayWinCountAwardDict[awardWinCountStr]
+ awardItemList = dayWinCountAwardDict[str(awardWinCount)]
eventName = "WinCount"
drDataDict = {"awardWinCount":awardWinCount}
@@ -420,17 +515,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
@@ -467,7 +566,10 @@
% (awardType, awardData, awardIndex, awardState, awardItemList), playerID)
drDataDict.update({"awardIndex":awardIndex, "awardState":awardState, "awardItemList":awardItemList})
for itemID, itemCnt, isBind in awardItemList:
- ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem])
+ ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
+
+ if awardType == 3:
+ PlayerControl.WorldNotify(0, "CrossMatching22", [curPlayer.GetPlayerName(), awardDanLV])
DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, False, drDataDict)
return
@@ -476,16 +578,17 @@
## 邮件发放未领取的每日奖励
playerID = curPlayer.GetPlayerID()
awardCountList = awardItemDict.keys()
+ awardCountList = [int(k) for k in awardCountList]
awardCountList.sort()
- for i, awardCountStr in enumerate(awardCountList):
- awardCount = int(awardCountStr)
+ GameWorld.DebugLog(" awardCountList=%s" % awardCountList, playerID)
+ for i, awardCount in enumerate(awardCountList):
if dataCount < awardCount:
GameWorld.DebugLog("跨服PK每日奖励次数不足: eventName=%s,i=%s,awardCount=%s > dataCount=%s" % (eventName, i, awardCount, dataCount), playerID)
break
if pow(2, i) & awardState:
GameWorld.DebugLog("已领取该跨服PK每日奖励: eventName=%s,i=%s,awardCount=%s" % (eventName, i, awardCount), playerID)
continue
- awardItemList = awardItemDict[awardCountStr]
+ awardItemList = awardItemDict[str(awardCount)]
GameWorld.Log("邮件发放跨服PK未领取的每日奖励: zoneID=%s,seasonID=%s,eventName=%s,i=%s,awardCount=%s,dataCount=%s,awardState=%s,awardItemList=%s"
% (zoneID, seasonID, eventName, i, awardCount, dataCount, awardState, awardItemList), playerID)
@@ -517,7 +620,8 @@
def DoGetPKSeasonAward(curPlayer, eventName, zoneID, seasonID, order, danLV, isMail):
## 执行发放赛季结算奖励,名次奖励与最高段位奖励互斥,优先名次奖励
-
+ isNotify = not isMail
+ notifyKey = ""
awardItemList = []
seasonAwardLV = danLV
playerID = curPlayer.GetPlayerID()
@@ -528,29 +632,37 @@
"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()
+ GameWorld.DebugLog(" awardOrderList=%s" % awardOrderList, playerID)
fromOrder, toOrder = 1, 1
- awardOrderList = sorted(seasonOrderAwardDict.keys())
- for i, awardOrderStr in enumerate(awardOrderList):
- awardOrder = int(awardOrderStr)
+ for i, awardOrder in enumerate(awardOrderList):
if order <= awardOrder:
toOrder = awardOrder
- awardItemList = seasonOrderAwardDict[awardOrderStr]
+ awardItemList = seasonOrderAwardDict[str(awardOrder)]
maxDanLV = IpyGameDataPY.IPY_Data().GetCrossRealmPKDanCount() - 1 # 因为段位等级从0开始,所以最大段位等级要减1
seasonAwardLV = maxDanLV + (len(awardOrderList) - i)
GameWorld.Log("获得排名奖励, 更新奖励等级: awardOrderList=%s,i=%s,maxDanLV=%s,seasonAwardLV=%s" % (awardOrderList, i, maxDanLV, seasonAwardLV), playerID)
mailTypeKey = "CrossServer4"
+ notifyKey = "CrossMatching23"
mailParamList = [seasonID, fromOrder, toOrder]
break
fromOrder = awardOrder + 1
# 没有奖励的话取段位奖励
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]
if not awardItemList:
@@ -565,6 +677,7 @@
SyncCrossRealmPKAwardState(curPlayer)
GameWorld.Log("还是同一个赛季,设置赛季奖励已领取!")
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonAwardLV % seasonID, seasonAwardLV)
+ SyncCrossRealmPKHisSeasonInfo(curPlayer)
if not isMail:
needSpace = len(awardItemList)
@@ -576,11 +689,14 @@
PlayerControl.SendMailByKey(mailTypeKey, [playerID], awardItemList, mailParamList, detail=mailDetail)
else:
for itemID, itemCnt, isBind in awardItemList:
- ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem])
+ ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
GameWorld.Log("领取成功! awardItemList=%s" % (awardItemList), playerID)
drDataDict = {"awardItemList":awardItemList, "order":order, "danLV":danLV, "seasonAwardLV":seasonAwardLV, "isMail":isMail}
DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, isMail, drDataDict)
+
+ if isNotify and notifyKey:
+ PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName()] + mailParamList + [awardItemList[0][0]])
return
def SyncCrossRealmPKPlayerInfo(curPlayer):
@@ -594,6 +710,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
@@ -615,6 +732,7 @@
seasonInfo = ChPyNetSendPack.tagMCCrossRealmPKPlayerHisSeason()
seasonInfo.SeasonID = seasonID
seasonInfo.DanLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonDanLV % seasonID)
+ seasonInfo.Score = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonScore % seasonID)
seasonInfo.Order = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonOrder % seasonID)
seasonInfo.AwardLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardLV % seasonID)
hisSeasonInfo.SeasonList.append(seasonInfo)
--
Gitblit v1.8.0