| | |
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PlayerActivity
|
| | | import ChPyNetSendPack
|
| | | import CrossRealmPlayer
|
| | | import FunctionNPCCommon
|
| | | import DataRecordPack
|
| | | import PlayerWeekParty
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import ItemCommon
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | ## 是否匹配中
|
| | | def SetIsCrossPKMatching(curPlayer, isMatching):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
|
| | | return
|
| | | def GetIsCrossPKMatching(curPlayer):
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_IsCrossPKMatching) and IsCrossRealmPKMatchState()
|
| | |
|
| | | def DoPlayerOnDay(curPlayer):
|
| | | if GameWorld.IsCrossServer():
|
| | |
| | |
|
| | | SyncCrossRealmPKPlayerInfo(curPlayer)
|
| | | SyncCrossRealmPKAwardState(curPlayer)
|
| | | |
| | | # 重置商店物品
|
| | | FunctionNPCCommon.ShopItemOnCrossPKSeasonChange(curPlayer)
|
| | | return True
|
| | |
|
| | | #// C1 01 跨服PK匹配 #tagCMCrossRealmPKMatch
|
| | |
| | | requestType = clientData.Type
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | GameWorld.DebugLog("跨服服务器无法发起匹配!")
|
| | | GameWorld.DebugLog("跨服服务器无法发起匹配!", playerID)
|
| | | return
|
| | | |
| | | if not CrossRealmPlayer.IsCrossServerOpen():
|
| | | PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
|
| | | return
|
| | | |
| | | if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
|
| | | GameWorld.DebugLog("副本中,无法进行跨服匹配!", playerID)
|
| | | return
|
| | | |
| | | if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie or curPlayer.GetHP() == 0:
|
| | | #GameWorld.DebugLog("已死亡,无法进行跨服匹配!", playerID)
|
| | | return
|
| | |
|
| | | if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonState) != 1:
|
| | | GameWorld.DebugLog("OnRequestMergePK 跨服赛季未开启,不可进行匹配!", playerID)
|
| | | PlayerControl.NotifyCode(curPlayer, "SeasonIsNotOpen")
|
| | | GameWorld.DebugLog("OnCrossRealmPKMatch 跨服赛季未开启,不可进行匹配!", playerID)
|
| | | #PlayerControl.NotifyCode(curPlayer, "SeasonIsNotOpen")
|
| | | return
|
| | |
|
| | | if not IsCrossRealmPKMatchState():
|
| | | GameWorld.DebugLog("OnRequestMergePK 跨服匹配未开启,不可进行匹配!", playerID)
|
| | | PlayerControl.NotifyCode(curPlayer, "MatchIsNotOpen")
|
| | | GameWorld.DebugLog("OnCrossRealmPKMatch 跨服匹配未开启,不可进行匹配!", playerID)
|
| | | #PlayerControl.NotifyCode(curPlayer, "MatchIsNotOpen")
|
| | | return
|
| | |
|
| | | GameWorld.Log("收到跨服PK匹配: type=%s,accID=%s" % (requestType, accID), playerID)
|
| | |
| | | "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), # 当前积分
|
| | |
| | |
|
| | | # 取消匹配
|
| | | else:
|
| | | sendMsg = "Client Cancel!"
|
| | | sendMsg = "ClientCancel"
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "CrossRealmPKCancel", sendMsg, len(sendMsg))
|
| | | GameWorld.Log(" 发送取消匹配到GameServer sendMsg=%s" % str(sendMsg), playerID)
|
| | |
|
| | |
| | | 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)
|
| | | GameWorld.Log(" winner winCount=%s,cWinCount=%s" % (winCount, cWinCount), playerID)
|
| | | else:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
|
| | | |
| | | GameWorld.Log(" loser cWinCount=0", playerID)
|
| | | |
| | | # 同一天的话增加当日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)
|
| | | 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)
|
| | | else:
|
| | | GameWorld.Log(" 不同天的PK结算不增加今日PK次数! ", playerID)
|
| | | |
| | | SyncCrossRealmPKPlayerInfo(curPlayer)
|
| | |
|
| | | ## 跨服已经通知过了,证明还在跨服服务器,不做以下的处理
|
| | |
| | | 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
|
| | | 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}
|
| | |
|
| | |
| | | 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}
|
| | |
|
| | |
| | | for itemID, itemCnt, isBind in awardItemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem])
|
| | |
|
| | | if awardType == 3:
|
| | | PlayerControl.WorldNotify(0, "CrossMatching22", [curPlayer.GetPlayerName(), awardDanLV])
|
| | | |
| | | DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, False, drDataDict)
|
| | | return
|
| | |
|
| | |
| | | ## 邮件发放未领取的每日奖励
|
| | | 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)
|
| | |
|
| | |
| | |
|
| | | def DoGetPKSeasonAward(curPlayer, eventName, zoneID, seasonID, order, danLV, isMail):
|
| | | ## 执行发放赛季结算奖励,名次奖励与最高段位奖励互斥,优先名次奖励
|
| | | |
| | | isNotify = not isMail
|
| | | notifyKey = ""
|
| | | awardItemList = []
|
| | | seasonAwardLV = danLV
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
| | | if order > 0:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonOrder % seasonID, order)
|
| | | seasonOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKAward", 3, {}) # {"名次":[[物品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
|
| | |
| | | return
|
| | | awardItemList = danLVIpyData.GetSeasonDanLVAwardList()
|
| | | mailTypeKey = "CrossServer5"
|
| | | notifyKey = "CrossMatching24"
|
| | | mailParamList = [seasonID, danLV]
|
| | |
|
| | | if not awardItemList:
|
| | |
| | | SyncCrossRealmPKAwardState(curPlayer)
|
| | | GameWorld.Log("还是同一个赛季,设置赛季奖励已领取!")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonAwardLV % seasonID, seasonAwardLV)
|
| | | SyncCrossRealmPKHisSeasonInfo(curPlayer)
|
| | |
|
| | | if not isMail:
|
| | | needSpace = len(awardItemList)
|
| | |
| | | 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):
|
| | |
| | | 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)
|