#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package PlayerActBossTrial
|
#
|
# @todo:bossÀúÁ·
|
# @author hxp
|
# @date 2023-10-20
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: bossÀúÁ·
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2023-10-20 16:00"""
|
#-------------------------------------------------------------------------------
|
|
import ShareDefine
|
import DataRecordPack
|
import PlayerCompensation
|
import PlayerDBGSEvent
|
import PlayerBillboard
|
import IpyGameDataPY
|
import GameWorld
|
import CrossRealmMsg
|
import CrossActionControl
|
import CrossBillboard
|
import PlayerFamily
|
import PyDataManager
|
import GameXiangong
|
import GameWorship
|
|
def OnActStart(actNum):
|
## »î¶¯¿ªÆô
|
PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAward % actNum, 0)
|
PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_BossTrialSubmit)
|
PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_BossTrialSubmitFamily)
|
|
familyActionMgr = GameWorld.GetFamilyActionManager()
|
familyManager = GameWorld.GetFamilyManager()
|
for i in range(0, familyManager.GetCount()):
|
family = familyManager.GetAt(i)
|
familyID = family.GetID()
|
familyActionMgr.DelFamilyAction(familyID, ShareDefine.Def_ActionType_BossTrialSubmit)
|
|
return
|
|
def OnActEnd(actNum, ipyData, dayIndex):
|
## »î¶¯½áÊø
|
cfgID = ipyData.GetCfgID() if ipyData else 0
|
GameWorld.Log("=== bossÀúÁ·»î¶¯½áÊø£¡ === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex))
|
|
__OnEndAward(actNum, ipyData, dayIndex) # ¼æÈݻûÓÐÅäÖòÎÓëʱ¼ä¶ÎµÄÔڻ½áÊø²¹´¥·¢½áËã½±Àø
|
|
PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamilyBak, ShareDefine.Def_BT_BossTrialSubmitFamily)
|
PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitBak, ShareDefine.Def_BT_BossTrialSubmit)
|
GameWorld.Log("=================================================================================")
|
return
|
|
def OnActInStateRefresh(actNum, ipyData, dayIndex):
|
## »î¶¯ÖÐˢУ¬Ã¿´Î¶¼ÐèҪˢеÄÂß¼£¬°üº¬ÖضÁÅäÖõÈ
|
if not ipyData:
|
return
|
cfgID = ipyData.GetCfgID()
|
templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex)
|
familyTemplateID = GameWorld.GetTemplateIDByList(ipyData.GetFamilyTemplateIDList(), dayIndex)
|
|
billboardMgr = PlayerBillboard.GetBillboardMgr()
|
if templateID:
|
orderRuleList = GetOrderRuleList(templateID)
|
billboardObj = billboardMgr.GetBillboardObj(ShareDefine.Def_BT_BossTrialSubmit)
|
billboardObj.SetOrderRuleList(orderRuleList)
|
|
if familyTemplateID:
|
orderRuleList = GetOrderRuleList(familyTemplateID)
|
billboardObj = billboardMgr.GetBillboardObj(ShareDefine.Def_BT_BossTrialSubmitFamily)
|
billboardObj.SetOrderRuleList(orderRuleList)
|
return
|
|
def OnActJoinEnd(actNum, ipyData, dayIndex):
|
## »î¶¯²ÎÓë½áÊø
|
__OnEndAward(actNum, ipyData, dayIndex)
|
return
|
|
def __OnEndAward(actNum, ipyData, dayIndex):
|
## ½áËã½±Àø
|
if not ipyData:
|
return
|
cfgID = ipyData.GetCfgID()
|
awardState = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAward % actNum)
|
if awardState:
|
#ÒѾ½áËã¹ý¸Ã»î¶¯
|
GameWorld.Log("bossÀúÁ·»î¶¯ÒѾ½áËã¹ý½±ÀøÁË! actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex))
|
return
|
PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAward % actNum, 1)
|
|
GameWorld.Log("=== ±¾·þbossÀúÁ·»î¶¯·¢·Å°ñµ¥½±Àø£¡ === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex))
|
|
familyTemplateID = GameWorld.GetTemplateIDByList(ipyData.GetFamilyTemplateIDList(), dayIndex)
|
__OnEndAward_Family(familyTemplateID, ShareDefine.Def_BT_BossTrialSubmitFamily)
|
|
templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex)
|
__OnEndAward_Personal(templateID, ShareDefine.Def_BT_BossTrialSubmit)
|
|
# Á÷Ïò±¸·Ý
|
DataRecordPack.DR_BillboardData(ShareDefine.Def_BT_BossTrialSubmitFamily, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex})
|
DataRecordPack.DR_BillboardData(ShareDefine.Def_BT_BossTrialSubmit, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex})
|
GameWorld.Log("=================================================================================")
|
return
|
|
def __OnEndAward_Personal(templateID, billboardType):
|
billBoard = GameWorld.GetBillboard().FindBillboard(billboardType)
|
if not billBoard:
|
return
|
if not templateID:
|
GameWorld.Log("±¾´Î»î¶¯Ã»ÓиöÈË°ñ½±Àø!")
|
return
|
billboardDataCount = billBoard.GetCount()
|
billBoard.Sort()
|
|
GameWorld.Log("½áËã¸öÈË°ñµ¥½±Àø: billboardType=%s,templateID=%s,billboardDataCount=%s" % (billboardType, templateID, billboardDataCount))
|
|
orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID)
|
if not orderIpyDataList:
|
return
|
|
rankPre = 0
|
billboardIndex = 0
|
for ipyData in orderIpyDataList:
|
rank = ipyData.GetRank()
|
needScore = ipyData.GetNeedScore()
|
scoreAwardEx = ipyData.GetScoreAwardEx()
|
scoreAwardExList = scoreAwardEx.keys()
|
scoreAwardExList.sort()
|
awardItemList = ipyData.GetAwardItemList()
|
orderCountTotal = rank - rankPre # ½±ÀøÃû´ÎÊýÁ¿
|
rankPre = rank
|
|
for index in xrange(billboardIndex, billboardDataCount):
|
if orderCountTotal <= 0:
|
break
|
|
billBoardData = billBoard.At(index)
|
playerID = billBoardData.GetID()
|
name2 = billBoardData.GetName2()
|
cmpValue = billBoardData.GetCmpValue()
|
|
if cmpValue < needScore:
|
GameWorld.Log(" »ý·Ö²»×ã¸Ã°ñµ¥ËùÐè»ý·Ö£¬Ìø¹ý¸ÃÃû´Î: index=%s,rank=%s,playerID=%s,cmpValue=%s < %s" % (index, rank, playerID, cmpValue, needScore))
|
break
|
|
awardItemExList = []
|
for scoreEx in scoreAwardExList:
|
if cmpValue < scoreEx:
|
break
|
awardItemExList = scoreAwardEx[scoreEx] # È¡×î´óÂú×ãÌõ¼þµÄÒ»µµ
|
finalAwardItemList = awardItemList + awardItemExList
|
|
playerRank = rank - orderCountTotal + 1
|
GameWorld.Log(" ·¢·ÅbossÀúÁ·¸öÈË°ñµ¥½±Àø: index=%s,rank=%s,playerRank=%s,playerID=%s,cmpValue=%s,awardItemList=%s,scoreAwardEx=%s,finalAwardItemList=%s, %s"
|
% (index, rank, playerRank, playerID, cmpValue, awardItemList, scoreAwardEx, finalAwardItemList, name2))
|
PlayerCompensation.SendMailByKey("BossTrialMail10", [playerID], finalAwardItemList, [playerRank])
|
|
orderCountTotal -= 1
|
billboardIndex += 1
|
|
return
|
|
def __OnEndAward_Family(familyTemplateID, billboardType):
|
billBoard = GameWorld.GetBillboard().FindBillboard(billboardType)
|
if not billBoard:
|
return
|
if not familyTemplateID:
|
GameWorld.Log("±¾´Î»î¶¯Ã»ÓÐÏÉÃË°ñ½±Àø!")
|
return
|
billboardDataCount = billBoard.GetCount()
|
billBoard.Sort()
|
|
GameWorld.Log("½áËãÏÉÃË°ñµ¥½±Àø: billboardType=%s,familyTemplateID=%s,billboardDataCount=%s" % (billboardType, familyTemplateID, billboardDataCount))
|
|
orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", familyTemplateID)
|
if not orderIpyDataList:
|
return
|
|
familyManager = GameWorld.GetFamilyManager()
|
rankPre = 0
|
billboardIndex = 0
|
for ipyData in orderIpyDataList:
|
rank = ipyData.GetRank()
|
needScore = ipyData.GetNeedScore()
|
leaderAwardItemList = ipyData.GetAwardItemList()
|
memAwardItemList = ipyData.GetMemAwardItemList()
|
orderCountTotal = rank - rankPre # ½±ÀøÃû´ÎÊýÁ¿
|
rankPre = rank
|
|
for index in xrange(billboardIndex, billboardDataCount):
|
if orderCountTotal <= 0:
|
break
|
|
billBoardData = billBoard.At(index)
|
familyID = billBoardData.GetID()
|
cmpValue = billBoardData.GetCmpValue()
|
|
if cmpValue < needScore:
|
GameWorld.Log(" ²»×ã¸Ã°ñµ¥ËùÐèÌá½»Êý£¬Ìø¹ý¸ÃÃû´Î: index=%s,rank=%s,familyID=%s,cmpValue=%s < %s" % (index, rank, familyID, cmpValue, needScore))
|
break
|
|
familyRank = rank - orderCountTotal + 1
|
orderCountTotal -= 1
|
billboardIndex += 1
|
|
family = familyManager.FindFamily(familyID)
|
if not family:
|
continue
|
|
familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False)
|
if not familyActionData:
|
GameWorld.ErrLog("¸ÃÏÉÃËûÓÐÌύƾ֤ActionData! familyID=%s" % familyID)
|
continue
|
awardState = GetFamilyAwardState(familyActionData)
|
awardIndex = 0 # ±¾·þ½±Àø״̬Ë÷Òý
|
if awardState&pow(2, awardIndex):
|
GameWorld.ErrLog("¸ÃÏÉÃ˱¾·þ°ñ½±ÀøÒÑ·¢·Å! familyID=%s" % familyID)
|
continue
|
updAwardState = awardState|pow(2, awardIndex)
|
SetFamilyAwardState(familyActionData, updAwardState)
|
|
memSubCountDict = GetFamilyMemSubCountDict(familyActionData)
|
|
leaderID = family.GetLeaderID()
|
awardMemIDList = []
|
for index in xrange(family.GetCount()):
|
member = family.GetAt(index)
|
memPlayerID = member.GetPlayerID()
|
if memPlayerID == leaderID:
|
continue
|
awardMemIDList.append(memPlayerID)
|
|
paramList = [familyRank]
|
if not leaderAwardItemList:
|
awardMemIDList.append(leaderID)
|
else:
|
PlayerCompensation.SendMailByKey("BossTrialFamilyLeader", [leaderID], leaderAwardItemList, paramList)
|
|
PlayerCompensation.SendMailByKey("BossTrialFamilyMember", awardMemIDList, memAwardItemList, paramList)
|
GameWorld.Log("·¢·ÅbossÀúÁ·»î¶¯ÏÉÃË°ñµ¥½±Àø±¾·þ: index=%s,rank=%s,familyID=%s,Ãû´Î=%s,×ÜÌá½»¸öÊý=%s,updAwardState=%s,awardMemIDList=%s,memSubCountDict=%s"
|
% (index, rank, familyID, familyRank, cmpValue, updAwardState, awardMemIDList, memSubCountDict))
|
|
return
|
|
def MapServer_BossTrial(curPlayer, msgList):
|
mapID = curPlayer.GetRealMapID()
|
playerID = curPlayer.GetPlayerID()
|
GameWorld.DebugLog("MapServer_BossTrial mapID=%s,msgList=%s" % (mapID, msgList), playerID)
|
if not msgList:
|
return
|
|
msgType, dataMsg = msgList
|
ret = None
|
|
if msgType == "BossTrialSubmit":
|
ret = __OnBossTrialSubmit(curPlayer, dataMsg)
|
|
if ret == None:
|
return
|
return msgList + (ret if isinstance(ret, list) else [ret])
|
|
def __OnBossTrialSubmit(curPlayer, dataMsg):
|
## µØͼÌá½»bossƾ֤
|
playerID = curPlayer.GetPlayerID()
|
accID = curPlayer.GetAccID()
|
playerName = curPlayer.GetName()
|
job = curPlayer.GetJob()
|
face = curPlayer.GetFace()
|
facePic = curPlayer.GetFacePic()
|
realmLV = curPlayer.GetOfficialRank()
|
familyID = curPlayer.GetFamilyID()
|
submitCount, updSubmitCount = dataMsg
|
|
curFamily, familySubmitTotal = __DoBossTrialSubmitFamilyAction(curPlayer, submitCount)
|
familyBillInfo = {}
|
|
#¸üб¾·þÏÉÃËÌá½»°ñµ¥
|
if familyID and curFamily and familySubmitTotal:
|
familyBillInfo = PlayerFamily.GetFamilyBillboardInfo(curFamily)
|
familyBillInfo["familySubmitTotal"] = familySubmitTotal
|
PlayerBillboard.UpdateFamilyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamily, familyBillInfo, familySubmitTotal)
|
|
#ͬ²½¿ç·þ
|
playerInfo = {"playerID":playerID, "playerName":playerName, "accID":accID, "job":job, "realmLV":realmLV,
|
"playerSubmitTotal":updSubmitCount, "face":face, "facePic":facePic}
|
SyncBossTrialSubmitToCrossServer(curPlayer, playerInfo, familyBillInfo)
|
return
|
|
def __DoBossTrialSubmitFamilyAction(curPlayer, submitCount):
|
## Ö´ÐÐÌύƾ֤µ½ÏÉÃËActionÊý¾Ý
|
|
curFamily = None
|
familySubmitTotal = 0
|
playerID = curPlayer.GetPlayerID()
|
familyID = curPlayer.GetFamilyID()
|
if not familyID:
|
return curFamily, familySubmitTotal
|
|
familyManager = GameWorld.GetFamilyManager()
|
curFamily = familyManager.FindFamily(familyID)
|
if not curFamily:
|
return curFamily, familySubmitTotal
|
|
familyActionData = GetFamilyBossTrialSubmitActionData(familyID, True)
|
|
familySubmitTotal = GetFamilySubmitTotal(familyActionData) + submitCount
|
SetFamilySubmitTotal(familyActionData, familySubmitTotal)
|
|
memSubCountDict = GetFamilyMemSubCountDict(familyActionData)
|
memSubCountDict[playerID] = memSubCountDict.get(playerID, 0) + submitCount
|
SetFamilyMemSubCountDict(familyActionData, memSubCountDict)
|
|
return curFamily, familySubmitTotal
|
|
def GetFamilyBossTrialSubmitActionData(familyID, isAdd=False):
|
## »ñÈ¡ÏÉÃËbossƾ֤Ìá½»
|
familyActionObj = None
|
actionType = ShareDefine.Def_ActionType_BossTrialSubmit
|
familyAction = GameWorld.GetFamilyActionManager().GetFamilyAction(familyID, actionType)
|
if not familyAction.Count():
|
if isAdd:
|
familyActionObj = familyAction.AddAction()
|
familyActionObj.SetFamilyId(familyID)
|
familyActionObj.SetActionType(actionType)
|
else:
|
familyActionObj = familyAction.At(0)
|
|
return familyActionObj
|
|
def GetFamilySubmitTotalByID(familyID):
|
## »ñÈ¡ÏÉÃËÌá½»µÄƾ֤×ÜÊý
|
familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False)
|
if not familyActionData:
|
return 0
|
return GetFamilySubmitTotal(familyActionData)
|
|
def GetFamilySubmitTotal(familyActionData): return familyActionData.GetValue1()
|
def SetFamilySubmitTotal(familyActionData, submitTotal): familyActionData.SetValue1(submitTotal)
|
def GetFamilyAwardState(familyActionData): return familyActionData.GetValue2()
|
def SetFamilyAwardState(familyActionData, state): return familyActionData.SetValue2(state)
|
|
def GetFamilyMemSubCountDict(familyActionData):
|
memSubCountDict = {}
|
useData = familyActionData.GetUseData()
|
if useData:
|
try:
|
memSubCountDict = eval(useData)
|
except:
|
memSubCountDict = {}
|
return memSubCountDict
|
def SetFamilyMemSubCountDict(familyActionData, memSubCountDict):
|
useData = str(memSubCountDict).replace(" ", "")
|
familyActionData.SetUseData(useData, len(useData))
|
return
|
|
def SyncBossTrialSubmitToCrossServer(curPlayer, playerInfo, familyInfo):
|
## ͬ²½bossƾ֤Ìá½»×ÜÊýµ½¿ç·þ·þÎñÆ÷
|
actInfo = CrossActionControl.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_BossTrial)
|
if not actInfo.get(ShareDefine.ActKey_State):
|
return
|
cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
ipyDataDict = actInfo.get(ShareDefine.ActKey_IpyDataInfo, {})
|
if not ipyDataDict:
|
return
|
zoneID = ipyDataDict.get("ZoneID")
|
if not cfgID or not zoneID:
|
return
|
|
dataMsg = {"cfgID":cfgID, "zoneID":zoneID, "playerInfo":playerInfo, "familyInfo":familyInfo}
|
CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_BossTrialSubmit, dataMsg)
|
return
|
|
def CrossServerMsg_CrossBossTrialFamilyAward(msgData):
|
## ÊÕµ½¿ç·þ֪ͨ - ½áËã¿ç·þÏÉÃË°ñ½±Àø
|
cfgID = msgData["cfgID"]
|
zoneID = msgData["zoneID"]
|
templateID = msgData["templateID"]
|
awardFamilyList = msgData["awardFamilyList"]
|
|
GameWorld.Log("ÊÕµ½¿ç·þͬ²½µÄ½áËãbossÀúÁ·»î¶¯¿ç·þÏÉÃË°ñ½±Àø: cfgID=%s,zoneID=%s,templateID=%s" % (cfgID, zoneID, templateID))
|
|
familyManager = GameWorld.GetFamilyManager()
|
|
for familyInfo in awardFamilyList:
|
familyID, familyRank, familySubmitTotal, leaderAwardItemList, memAwardItemList = familyInfo
|
family = familyManager.FindFamily(familyID)
|
if not family:
|
GameWorld.DebugLog("·Ç±¾·þÏÉÃË»òÒѽâÉ¢! familyID=%s" % familyID)
|
continue
|
|
familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False)
|
if not familyActionData:
|
GameWorld.ErrLog("¸ÃÏÉÃËûÓÐÌύƾ֤ActionData! familyID=%s" % familyID)
|
continue
|
awardState = GetFamilyAwardState(familyActionData)
|
awardIndex = 1 #¿ç·þ½±Àø״̬Ë÷Òý
|
if awardState&pow(2, awardIndex):
|
GameWorld.ErrLog("¸ÃÏÉÃË¿ç·þ°ñ½±ÀøÒÑ·¢·Å! familyID=%s" % familyID)
|
continue
|
updAwardState = awardState|pow(2, awardIndex)
|
SetFamilyAwardState(familyActionData, updAwardState)
|
|
memSubCountDict = GetFamilyMemSubCountDict(familyActionData)
|
|
leaderID = family.GetLeaderID()
|
awardMemIDList = []
|
for index in xrange(family.GetCount()):
|
member = family.GetAt(index)
|
memPlayerID = member.GetPlayerID()
|
if memPlayerID == leaderID:
|
continue
|
awardMemIDList.append(memPlayerID)
|
|
paramList = [familyRank]
|
if not leaderAwardItemList:
|
awardMemIDList.append(leaderID)
|
else:
|
PlayerCompensation.SendMailByKey("BossTrialCrossFamilyLeader", [leaderID], leaderAwardItemList, paramList)
|
|
PlayerCompensation.SendMailByKey("BossTrialCrossFamilyMember", awardMemIDList, memAwardItemList, paramList)
|
GameWorld.Log("·¢·ÅbossÀúÁ·»î¶¯ÏÉÃË°ñµ¥½±Àø¿ç·þ: familyID=%s,Ãû´Î=%s,×ÜÌá½»¸öÊý=%s,updAwardState=%s,awardMemIDList=%s,memSubCountDict=%s"
|
% (familyID, familyRank, familySubmitTotal, updAwardState, awardMemIDList, memSubCountDict))
|
|
return
|
|
##------------------------------------------ ¿ç·þbossÀúÁ·»î¶¯ ---------------------------------------
|
|
def ClientServerMsg_BossTrialSubmit(serverGroupID, msgData):
|
## ÊÕµ½×Ó·þ - Ìá½»bossƾ֤
|
|
cfgID = msgData["cfgID"]
|
zoneID = msgData["zoneID"]
|
playerInfo = msgData["playerInfo"]
|
familyInfo = msgData["familyInfo"]
|
|
actInfo = CrossActionControl.GetCrossActInfoByCfgID(ShareDefine.CrossActName_BossTrial, cfgID, zoneID)
|
if not actInfo or not actInfo[ShareDefine.ActKey_State]:
|
GameWorld.ErrLog("¿ç·þbossÀúÁ··Ç»î¶¯ÖУ¬ÎÞ·¨Ìá½»! cfgID=%s, zoneID=%s" % (cfgID, zoneID))
|
return
|
if actInfo[ShareDefine.ActKey_StateJoin] != ShareDefine.ActStateJoin_Start:
|
GameWorld.ErrLog("¿ç·þbossÀúÁ··Ç¿É²ÎÓë״̬£¬ÎÞ·¨Ìá½»! cfgID=%s, zoneID=%s" % (cfgID, zoneID))
|
return
|
ipyData = IpyGameDataPY.GetIpyGameData("CrossActBossTrial", cfgID)
|
if not ipyData:
|
return
|
personlLimit, familyLimit = 0, 0
|
|
PersonalTemplateID = ipyData.GetPersonalTemplateID()
|
pRankIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", PersonalTemplateID) if PersonalTemplateID else None
|
if pRankIpyDataList:
|
lastRankIpyData = pRankIpyDataList[-1] # È¡×îºóÒ»¸öΪ×îµÍÉÏ°ñ»ý·ÖÏÞÖÆ
|
personlLimit = lastRankIpyData.GetNeedScore()
|
|
FamilyTemplateID = ipyData.GetFamilyTemplateID()
|
fRankIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", FamilyTemplateID) if FamilyTemplateID else None
|
if fRankIpyDataList:
|
lastRankIpyData = fRankIpyDataList[-1] # È¡×îºóÒ»¸öΪ×îµÍÉÏ°ñ»ý·ÖÏÞÖÆ
|
familyLimit = lastRankIpyData.GetNeedScore()
|
|
playerID = playerInfo["playerID"]
|
playerName = playerInfo["playerName"]
|
job = playerInfo["job"]
|
accID = playerInfo["accID"]
|
realmLV = playerInfo["realmLV"]
|
playerSubmitTotal = playerInfo["playerSubmitTotal"]
|
face = playerInfo.get("face", 0)
|
facePic = playerInfo.get("facePic", 0)
|
|
groupValue1 = zoneID
|
|
if playerSubmitTotal >= personlLimit:
|
name2, type2, value1, value2 = accID, job, realmLV, 0
|
CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1, playerID, playerName,
|
name2, type2, value1, value2, playerSubmitTotal, value3=face, value4=facePic)
|
|
if familyInfo and familyInfo.get("familySubmitTotal", 0) >= familyLimit:
|
familySubmitTotal = familyInfo["familySubmitTotal"]
|
CrossBillboard.UpdCrossBillboardFamily(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1, familyInfo, familySubmitTotal)
|
|
return
|
|
def OnCrossActIDChange(cfgID, zoneID, ipyData, state):
|
## ¿ç·þ»î¶¯ID±ä¸ü
|
if state:
|
OnCrossActStart(cfgID, zoneID, ipyData)
|
else:
|
OnCrossActEnd(cfgID, zoneID, ipyData)
|
return
|
|
def OnCrossActStart(cfgID, zoneID, ipyData):
|
## ¿ç·þ»î¶¯¿ªÆô
|
|
PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAwardC % zoneID, 0)
|
|
groupValue1 = zoneID
|
billboardMgr = PyDataManager.GetCrossBillboardManager()
|
billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1)
|
billboardObj.ClearData() # лÖØÖðñµ¥Êý¾Ý
|
|
billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1)
|
billboardObj.ClearData() # лÖØÖðñµ¥Êý¾Ý
|
return
|
|
def OnCrossActEnd(cfgID, zoneID, ipyData):
|
## ¿ç·þ»î¶¯½áÊø
|
|
groupValue1 = zoneID
|
GameWorld.Log("=== ¿ç·þbossÀúÁ·»î¶¯½áÊø£¡ === cfgID=%s,zoneID=%s" % (cfgID, zoneID))
|
__OnCrossEndAward(cfgID, zoneID, ipyData)
|
|
# ±¸·Ý¡¢Çå³ý°ñµ¥Êý¾Ý
|
billboardMgr = PyDataManager.GetCrossBillboardManager()
|
billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1)
|
CrossBillboard.CopyBillboardEx(ShareDefine.Def_CBT_BossTrialSubmit, ShareDefine.Def_CBT_BossTrialSubmitBak, groupValue1)
|
billboardObj.ClearData()
|
|
billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1)
|
CrossBillboard.CopyBillboardEx(ShareDefine.Def_CBT_BossTrialSubmitFamily, ShareDefine.Def_CBT_BossTrialSubmitFamilyBak, groupValue1)
|
billboardObj.ClearData()
|
GameWorld.Log("=================================================================================")
|
return
|
|
def OnCrossActInStateRefresh(cfgID, zoneID, ipyData):
|
## »î¶¯ÖÐˢУ¬Ã¿´Î¶¼ÐèҪˢеÄÂß¼£¬°üº¬ÖضÁÅäÖõÈ
|
if not ipyData:
|
return
|
PersonalTemplateID = ipyData.GetPersonalTemplateID()
|
FamilyTemplateID = ipyData.GetFamilyTemplateID()
|
orderRuleList = GetOrderRuleList(PersonalTemplateID)
|
orderRuleListFamily = GetOrderRuleList(FamilyTemplateID)
|
|
groupValue1 = zoneID
|
billboardMgr = PyDataManager.GetCrossBillboardManager()
|
billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1)
|
billboardObj.SetOrderRuleList(orderRuleList)
|
|
billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1)
|
billboardObj.SetOrderRuleList(orderRuleListFamily)
|
return
|
|
def GetOrderRuleList(templateID):
|
orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID)
|
if not orderIpyDataList:
|
return
|
orderRuleList = []
|
for ipyData in orderIpyDataList:
|
orderRuleList.append([ipyData.GetRank(), ipyData.GetNeedScore()])
|
return orderRuleList
|
|
def OnCrossActJoinEnd(cfgID, zoneID, ipyData):
|
## ¿ç·þ»î¶¯²ÎÓë½áÊø
|
__OnCrossEndAward(cfgID, zoneID, ipyData)
|
return
|
|
def __OnCrossEndAward(cfgID, zoneID, ipyData):
|
## ½áËã¿ç·þ½±Àø
|
awardState = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAwardC % zoneID)
|
if awardState:
|
#ÒѾ½áËã¹ý¸Ã»î¶¯
|
GameWorld.Log("¿ç·þbossÀúÁ·»î¶¯ÒѾ½áËã¹ý½±ÀøÁË! cfgID=%s,zoneID=%s" % (cfgID, zoneID))
|
return
|
PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAwardC % zoneID, 1)
|
|
GameWorld.Log("=== ¿ç·þbossÀúÁ·»î¶¯·¢·Å°ñµ¥½±Àø£¡ === cfgID=%s,zoneID=%s" % (cfgID, zoneID))
|
|
PersonalTemplateID = ipyData.GetPersonalTemplateID()
|
FamilyTemplateID = ipyData.GetFamilyTemplateID()
|
serverIDRangeList = ipyData.GetServerIDRangeList()
|
|
__GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID, ShareDefine.Def_CBT_BossTrialSubmit, serverIDRangeList)
|
__GiveCrossOrderAwardFamily(cfgID, zoneID, FamilyTemplateID, ShareDefine.Def_CBT_BossTrialSubmitFamily)
|
GameWorld.Log("=================================================================================")
|
return
|
|
def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID, billboardType, serverIDRangeList):
|
|
groupValue1 = zoneID
|
#billboardType = ShareDefine.Def_CBT_BossTrialSubmit #°ñµ¥ÀàÐ͸ÄΪ²ÎÊý´«È룬Òì³£Çé¿öÏ¿ÉÌØÊâ´¦ÀíÓñ¸·Ý°ñµ¥·¢½±Àø
|
billboardMgr = PyDataManager.GetCrossBillboardManager()
|
billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1)
|
billboardDataCount = billboardObj.GetCount()
|
if not billboardDataCount:
|
GameWorld.Log("¿ç·þBossƾ֤¸öÈËÅÅÐÐÊý¾ÝΪ¿Õ! billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s" % (billboardType, zoneID, cfgID, templateID))
|
return
|
|
# ½áËãʱÅÅÐò²¢±£´æ°ñµ¥Êý¾ÝÁ÷Ïò
|
billboardObj.SortData()
|
billboardObj.SaveDRData("BossTrial", {"cfgID":cfgID, "zoneID":zoneID})
|
|
GameWorld.Log("½áËã¿ç·þBossƾ֤¸öÈËÅÅÐн±Àø: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s"
|
% (billboardType, zoneID, cfgID, templateID, billboardDataCount))
|
|
orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID)
|
if not orderIpyDataList:
|
return
|
|
worshipType = ShareDefine.Def_WorshipType_CrossBossTrial
|
syncNewWorshipList = []
|
syncNewXiangongDict = {}
|
rankPre = 0
|
billboardIndex = 0
|
for ipyData in orderIpyDataList:
|
rank = ipyData.GetRank()
|
needScore = ipyData.GetNeedScore()
|
scoreAwardEx = ipyData.GetScoreAwardEx()
|
scoreAwardExList = scoreAwardEx.keys()
|
scoreAwardExList.sort()
|
awardItemList = ipyData.GetAwardItemList()
|
xiangongID = ipyData.GetXiangongID()
|
orderCountTotal = rank - rankPre # ½±ÀøÃû´ÎÊýÁ¿
|
rankPre = rank
|
|
for index in xrange(billboardIndex, billboardDataCount):
|
if orderCountTotal <= 0:
|
break
|
|
billboardData = billboardObj.At(index)
|
playerID = billboardData.ID
|
name2 = billboardData.Name2
|
cmpValue = billboardData.CmpValue
|
if cmpValue < needScore:
|
GameWorld.Log(" »ý·Ö²»×ã¸Ã°ñµ¥ËùÐè»ý·Ö£¬Ìø¹ý¸ÃÃû´Î: index=%s,rank=%s,playerID=%s,cmpValue=%s < %s" % (index, rank, playerID, cmpValue, needScore))
|
break
|
|
awardItemExList = []
|
for scoreEx in scoreAwardExList:
|
if cmpValue < scoreEx:
|
break
|
awardItemExList = scoreAwardEx[scoreEx] # È¡×î´óÂú×ãÌõ¼þµÄÒ»µµ
|
finalAwardItemList = awardItemList + awardItemExList
|
|
playerRank = rank - orderCountTotal + 1
|
GameWorld.Log(" ·¢·ÅbossÀúÁ·¸öÈË°ñµ¥½±Àø: index=%s,rank=%s,playerRank=%s,playerID=%s,cmpValue=%s,awardItemList=%s,scoreAwardEx=%s,finalAwardItemList=%s, %s"
|
% (index, rank, playerRank, playerID, cmpValue, awardItemList, scoreAwardEx, finalAwardItemList, name2))
|
PlayerCompensation.SendMailByKey("BossTrialCrossPlayer", [playerID], finalAwardItemList, [playerRank], crossMail=True)
|
|
orderCountTotal -= 1
|
billboardIndex += 1
|
|
GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict)
|
GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList)
|
GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
|
GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
|
return
|
|
def __GiveCrossOrderAwardFamily(cfgID, zoneID, templateID, billboardType):
|
|
groupValue1 = zoneID
|
#billboardType = ShareDefine.Def_CBT_BossTrialSubmitFamily
|
billboardMgr = PyDataManager.GetCrossBillboardManager()
|
billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1)
|
billboardDataCount = billboardObj.GetCount()
|
if not billboardDataCount:
|
GameWorld.Log("¿ç·þBossƾ֤ÏÉÃËÅÅÐÐÊý¾ÝΪ¿Õ! billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s" % (billboardType, zoneID, cfgID, templateID))
|
return
|
|
# ½áËãʱÅÅÐò²¢±£´æ°ñµ¥Êý¾ÝÁ÷Ïò
|
billboardObj.SortData()
|
billboardObj.SaveDRData("BossTrial", {"cfgID":cfgID, "zoneID":zoneID})
|
|
GameWorld.Log("½áËã¿ç·þBossƾ֤ÏÉÃËÅÅÐн±Àø: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s"
|
% (billboardType, zoneID, cfgID, templateID, billboardDataCount))
|
|
orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID)
|
if not orderIpyDataList:
|
return
|
|
awardFamilyList = []
|
rankPre = 0
|
billboardIndex = 0
|
for ipyData in orderIpyDataList:
|
rank = ipyData.GetRank()
|
needScore = ipyData.GetNeedScore()
|
leaderAwardItemList = ipyData.GetAwardItemList()
|
memAwardItemList = ipyData.GetMemAwardItemList()
|
orderCountTotal = rank - rankPre # ½±ÀøÃû´ÎÊýÁ¿
|
rankPre = rank
|
|
for index in xrange(billboardIndex, billboardDataCount):
|
if orderCountTotal <= 0:
|
break
|
|
billboardData = billboardObj.At(index)
|
familyID = billboardData.ID
|
familySubmitTotal = billboardData.CmpValue
|
|
if familySubmitTotal < needScore:
|
GameWorld.Log(" ²»×ã¸Ã°ñµ¥ËùÐèÌá½»Êý£¬Ìø¹ý¸ÃÃû´Î: index=%s,rank=%s,familyID=%s,familySubmitTotal=%s < %s" % (index, rank, familyID, familySubmitTotal, needScore))
|
break
|
|
familyRank = rank - orderCountTotal + 1
|
GameWorld.Log(" index=%s,rank=%s,familyID=%s,Ãû´Î=%s,×ÜÌá½»¸öÊý=%s" % (index, rank, familyID, familyRank, familySubmitTotal))
|
awardFamilyList.append([familyID, familyRank, familySubmitTotal, leaderAwardItemList, memAwardItemList])
|
|
orderCountTotal -= 1
|
billboardIndex += 1
|
|
# ¹ã²¥×Ó·þ·¢·Å½±Àø
|
sendMsg = {"cfgID":cfgID, "zoneID":zoneID, "templateID":templateID, "awardFamilyList":awardFamilyList}
|
CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossTrialFamilyAward, sendMsg)
|
return
|