#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_Dingjunge
|
#
|
# @todo:¶¨¾ü¸ó
|
# @author hxp
|
# @date 2026-01-06
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ¶¨¾ü¸ó
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2026-01-06 13:30"""
|
#-------------------------------------------------------------------------------
|
|
import FBCommon
|
import GameWorld
|
import ShareDefine
|
import PlayerControl
|
import PlayerBillboard
|
import ChPyNetSendPack
|
import ItemControler
|
import IpyGameDataPY
|
import NetPackCommon
|
import ChConfig
|
|
# ×Ô¶¯Ñ¡ÔñÅÅÐòÓÅÏȼ¶Ë÷Òý
|
(
|
Priority_InSet, # 0
|
Priority_EffQuality, # 1
|
Priority_SetPriority, # 2
|
Priority_EIndex, # 3
|
Priority_EffInfo, # 4
|
Priority_EffID, # 5
|
Priority_AttrID, # 6
|
) = range(7)
|
|
def OnFBPlayerOnLogin(curPlayer):
|
SyncDingjungeInfo(curPlayer)
|
return
|
|
def OnFBPlayerOnDay(curPlayer):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGLineID, 0)
|
for eIndex in range(len(IpyGameDataPY.GetFuncEvalCfg("DingjungeEff", 1))):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % eIndex, 0)
|
for sIndex in range(IpyGameDataPY.GetFuncCfg("DingjungeEff", 3)):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGSelectEffect % sIndex, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGUnSelectCnt, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffAuto, 0) # ÿÈÕÖØÖÃ×Ô¶¯¿ª¹Ø
|
SyncDingjungeInfo(curPlayer)
|
return
|
|
def GetNextIpyData(curPlayer):
|
## »ñÈ¡ÏÂÒ»¹ØipyData
|
todayLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGLineID)
|
layerNum, levelNum = todayLineID / 100, todayLineID % 100
|
if not layerNum:
|
ipyData = IpyGameDataPY.GetIpyGameData("FBDJGLevel", 1, 1)
|
elif not levelNum:
|
ipyData = IpyGameDataPY.GetIpyGameData("FBDJGLevel", layerNum, 1)
|
else:
|
nextLayerNum = layerNum
|
nextLevelNum = levelNum + 1 # ÏÂÒ»¹Ø
|
ipyData = IpyGameDataPY.GetIpyGameDataNotLog("FBDJGLevel", nextLayerNum, nextLevelNum)
|
if not ipyData:# ûÓÐÏÂÒ»¹ØÈ¡ÏÂÒ»²ã
|
nextLayerNum = layerNum + 1
|
nextLevelNum = 1
|
ipyData = IpyGameDataPY.GetIpyGameDataNotLog("FBDJGLevel", nextLayerNum, nextLevelNum)
|
if ipyData:
|
return ipyData
|
GameWorld.DebugLog("ÒÑͨ¹Ø»òÕÒ²»µ½ÏÂÒ»¹ØÊý¾Ý! layerNum=%s,levelNum=%s" % (layerNum, levelNum))
|
return
|
|
def GetPassLayerMax(curPlayer):
|
## »ñÈ¡ÒÑͨ¹ØµÄ×î´ó²ã¼¶
|
mapID = ChConfig.Def_FBMapID_Dingjunge
|
highestLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
hLayerNum, hLevelNum = highestLineID / 100, highestLineID % 100
|
passLayerMax = max(0, hLayerNum - 1) # ĬÈÏͨ¹ØµÄÊÇÉÏÒ»²ã
|
# Èç¹û¹ý¹Ø¼Ç¼ÔÚ±¾²ã£¬ÇÒûÓÐÏÂÒ»¹ØÁË£¬Ò²Ëãͨ¹ØÁ˱¾²ã
|
if hLayerNum and hLevelNum and not IpyGameDataPY.GetIpyGameDataNotLog("FBDJGLevel", hLayerNum, hLevelNum + 1):
|
passLayerMax = hLayerNum
|
return passLayerMax
|
|
def GetQuickStartLayer(curPlayer):
|
## »ñÈ¡¿ìËÙÌôÕ½µÄÆðʼ²ã¼¶
|
# @return: >1-¿É¿ìËÙÌôÕ½µÄÆðʼ²ã¼¶
|
passLayerMax = GetPassLayerMax(curPlayer)
|
backLayers = IpyGameDataPY.GetFuncCfg("Dingjunge", 1)
|
quickStartLayer = passLayerMax + 1 - backLayers # ÐèÒª+1²ã
|
if quickStartLayer > 1:
|
return quickStartLayer
|
return 0
|
|
def OnTurnFightRequest(curPlayer, mapID, funcLineID, tagType, tagID, valueList):
|
## »ØºÏÕ½¶·ÇëÇó
|
highestLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
quickStartLayer = GetQuickStartLayer(curPlayer)
|
if quickStartLayer:
|
todayLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGLineID)
|
if not todayLineID:
|
GameWorld.DebugLog("½ñÈÕ»¹Î´¿ìËÙÕ½¶·ÎÞ·¨ÊÖ¶¯ÌôÕ½! highestLineID=%s,quickStartLayer=%s" % (highestLineID, quickStartLayer))
|
return
|
nextIpyData = GetNextIpyData(curPlayer)
|
if not nextIpyData:
|
return
|
layerNum = nextIpyData.GetLayerNum()
|
levelNum = nextIpyData.GetLevelNum()
|
funcLineID = layerNum * 100 + levelNum
|
return True, funcLineID
|
|
def GetFBNPCLineupInfo(curPlayer, mapID, funcLineID):
|
## »ñÈ¡NPCÕóÈÝÏà¹Ø
|
# @return: npcLineupIDList, strongerLV, difficulty
|
|
layerNum, levelNum = funcLineID / 100, funcLineID % 100
|
ipyData = IpyGameDataPY.GetIpyGameData("FBDJGLevel", layerNum, levelNum)
|
if not ipyData:
|
return
|
|
npcLineupIDList = ipyData.GetLineupIDList()
|
strongerLV = ipyData.GetNPCLV()
|
difficulty = ipyData.GetDifficulty()
|
|
return npcLineupIDList, strongerLV, difficulty
|
|
def OnTurnFightAward(curPlayer, guid, mapID, funcLineID, winFaction, statMsg, dateStr, reqData, awardDict):
|
## »ØºÏÕ½¶·½áËã½±Àø
|
if not curPlayer:
|
return
|
|
isWin = winFaction == ChConfig.Def_FactionA
|
|
if not isWin:
|
return
|
|
todayLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGLineID)
|
GameWorld.DebugLog("¶¨¾ü¸ó½áËã: funcLineID=%s,todayLineID=%s" % (funcLineID, todayLineID))
|
if todayLineID >= funcLineID:
|
GameWorld.DebugLog("½ñÈÕÒѹý¹ØµÄ²»Öظ´½áËã½±Àø! todayLineID=%s >= %s" % (todayLineID, funcLineID))
|
return
|
|
layerNum, levelNum = funcLineID / 100, funcLineID % 100
|
ipyData = IpyGameDataPY.GetIpyGameData("FBDJGLevel", layerNum, levelNum)
|
if not ipyData:
|
return
|
|
awardItemList = []
|
highestLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
# Ê×ͨ
|
if funcLineID > highestLineID:
|
firstPassAwardList = ipyData.GetPassAwardList()
|
awardItemList += firstPassAwardList
|
GameWorld.DebugLog("Ê״ιý¹Ø: highestLineID=%s,firstPassAwardList=%s" % (highestLineID, firstPassAwardList))
|
FBCommon.SetFBPass(curPlayer, mapID, funcLineID)
|
PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Dingjunge, funcLineID)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGLineID, funcLineID)
|
|
awardItemList += ipyData.GetAwardList() # ÌôÕ½½±Àø
|
GameWorld.DebugLog("×îÖÕ½±Àø: mapID=%s,layerNum=%s,levelNum=%s,awardItemList=%s" % (mapID, layerNum, levelNum, awardItemList))
|
awardDict.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(awardItemList)})
|
|
ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["Dingjunge", False, {}], isNotifyAward=False)
|
|
if not IpyGameDataPY.GetIpyGameDataNotLog("FBDJGLevel", layerNum, levelNum + 1):
|
GameWorld.DebugLog("±¾²ãûÓÐÏÂÒ»¹ØÁË£¬Í¨¹Ø±¾²ã!: layerNum=%s,levelNum=%s" % (layerNum, levelNum))
|
GivePassLayerEff(curPlayer, 1)
|
|
SyncDingjungeInfo(curPlayer)
|
return
|
|
def OnPlayerFBQuickPass(curPlayer, mapID, lineID):
|
'''¸±±¾¿ìËÙ¹ý¹ØÑéÖ¤
|
@param mapID: Êý¾ÝµØÍ¼ID
|
@param lineID: Ä¿±ê¹Ø¿¨Ïß·ID£¬¿ÉÒ»´ÎÐÔÌø¶à¹Ø£¬¸ù¾Ý¹¦ÄÜÓÉǰ¶Ë·¢°ü¾ö¶¨»òºó¶ËÖ±½Ó¾ö¶¨
|
@return: (lineID, quickCnt, quickFightPower, quickData) »ò None
|
@note: lineID Óɺó¶Ë¾ö¶¨µÄ¿ìËÙ¹ý¹Øµ½ÄÄ£¬Èç¹ûǰ¶Ë¾ö¶¨µÄÔòÖ±½Ó·µ»Ø lineID
|
@note: quickCnt ±¾´Î×ܹ²Ìø¹ý¼¸¹Ø
|
@note: quickFightPower Ä¿±êÕóÈÝÕ½Á¦£¬ÓÃÓÚÑéÖ¤Õ½Á¦ÊÇ·ñÂú×ã¿ìËÙ¹ý¹Ø
|
@note: quickData À©Õ¹Êý¾Ý£¬¹¦ÄÜ×Ô¶¨Ò壬´«¸ø OnPlayerFBQuickPassResult
|
'''
|
|
todayLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGLineID)
|
if todayLineID:
|
GameWorld.DebugLog("½ñÈÕÒѾÔÚÊÖ¶¯Õ½¶·ÁË£¬ÎÞ·¨¿ìËÙÌôÕ½! todayLineID=%s" % (todayLineID))
|
return
|
|
highestLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
quickStartLayer = GetQuickStartLayer(curPlayer)
|
if not quickStartLayer:
|
GameWorld.DebugLog("»¹Î´´ïµ½¿É¿ìËÙÌôÕ½µÄ²ã¼¶! highestLineID=%s" % (highestLineID))
|
return
|
quickData = [highestLineID, quickStartLayer]
|
quickCnt = 0
|
quickFightPower = 0
|
return lineID, quickCnt, quickFightPower, quickData
|
|
def OnPlayerFBQuickPassResult(curPlayer, mapID, lineID, quickData):
|
## ¸±±¾¿ìËÙ¹ý¹Ø½á¹û
|
|
highestLineID, quickStartLayer = quickData
|
playerID = curPlayer.GetPlayerID()
|
passLayerMax = GetPassLayerMax(curPlayer) # ÀúÊ·×î´ó¹ý¹Ø²ã¼¶
|
todayLineID = quickStartLayer * 100 + 0 # ÏÈÉèÖÃÒѹýµ½Æðʼ²ãµÚ0¹Ø£¬Ç°¶ËÈç¹ûÓÐÎÊÌâÔÙÉèÖÃΪÉÏÒ»²ã×îºóÒ»¹Ø
|
GameWorld.DebugLog("¶¨¾ü¸ó¿ìËÙÕ½¶·: highestLineID=%s,passLayerMax=%s,quickStartLayer=%s,todayLineID=%s"
|
% (highestLineID, passLayerMax, quickStartLayer, todayLineID), playerID)
|
|
# ¿ìËÙ¹ý¹Ø½±Àø°´ÀúÊ·×î´ó¹ý¹Ø²ã¼¶ÁìÈ¡
|
awardItemDict = {}
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
for index in range(ipyDataMgr.GetFBDJGQuickCount()):
|
quickIpyData = ipyDataMgr.GetFBDJGQuickByIndex(index)
|
needLayer = quickIpyData.GetNeedLayer()
|
if needLayer > passLayerMax:
|
break
|
quickItemList = quickIpyData.GetQuickAwardList()
|
for itemInfo in quickItemList:
|
itemID, itemCount = itemInfo[:2]
|
awardItemDict[itemID] = awardItemDict.get(itemID, 0) + itemCount
|
awardItemList = [[itemID, itemCount] for itemID, itemCount in awardItemDict.items()]
|
|
# ÉèÖÃÆðʼ²ã¹Ø¿¨
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGLineID, todayLineID)
|
|
addEffCnt = quickStartLayer - 1 # -1ÊÇ´ú±í¼Ó³ÉЧ¹û½áËãµ½ÆðʼµÄÉÏÒ»²ã£¬Ã¿¹ý1²ã+1´Î
|
GivePassLayerEff(curPlayer, addEffCnt)
|
SyncDingjungeInfo(curPlayer)
|
|
ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["Dingjunge", False, {}])
|
return
|
|
def GivePassLayerEff(curPlayer, addEffCnt=1):
|
unSelectCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGUnSelectCnt) + addEffCnt
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGUnSelectCnt, unSelectCnt)
|
GameWorld.DebugLog("Ôö¼ÓЧ¹û¼Ó³É´ÎÊý: addEffCnt=%s,unSelectCnt=%s" % (addEffCnt, unSelectCnt))
|
if not __doAutoSelectAll(curPlayer):
|
__randSelectEff(curPlayer)
|
return
|
|
#// B1 01 ¶¨¾ü¸óЧ¹ûÔ¤Éè #tagCSDingjungeEffSet
|
#
|
#struct tagCSDingjungeEffSet
|
#{
|
# tagHead Head;
|
# BYTE SelectAuto; //ÊÇ·ñÆôÓÃ×Ô¶¯Ñ¡Ôñ
|
# BYTE SelectSetCnt;
|
# WORD SelectSetAttrIDList[SelectSetCnt]; //Ô¤ÉèÓÅÏÈÑ¡ÔñÊôÐÔIDÁбí [ÓÅÏȼ¶1ÊôÐÔID, ...]
|
#};
|
def OnDingjungeEffSet(index, clientData, tick):
|
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
selectAuto = 1 if clientData.SelectAuto else 0
|
selectSetAttrIDList = clientData.SelectSetAttrIDList
|
|
canSetAttrIDList = []
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
for index in range(ipyDataMgr.GetFBDJGEffectCount()):
|
ipyData = ipyDataMgr.GetFBDJGEffectByIndex(index)
|
attrID = ipyData.GetAttrID()
|
if attrID not in canSetAttrIDList:
|
canSetAttrIDList.append(attrID)
|
canSetAttrIDList.sort()
|
|
GameWorld.DebugLog("Ч¹ûÔ¤Éè: selectAuto=%s,selectSetAttrIDList=%s,canSetAttrIDList=%s" % (selectAuto, selectSetAttrIDList, canSetAttrIDList))
|
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffAuto, selectAuto)
|
for ssIndex in range(IpyGameDataPY.GetFuncCfg("DingjungeEff", 4)):
|
attrID = selectSetAttrIDList[ssIndex] if len(selectSetAttrIDList) > ssIndex else 0
|
if attrID not in canSetAttrIDList:
|
attrID = 0
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffSet % ssIndex, attrID)
|
SyncDingjungeInfo(curPlayer)
|
return
|
|
#// B1 02 ¶¨¾ü¸óЧ¹ûÑ¡Ôñ #tagCSDingjungeEffSelect
|
#
|
#struct tagCSDingjungeEffSelect
|
#{
|
# tagHead Head;
|
# BYTE SelectType; //0-ÊÖ¶¯Ñ¡Ôñ£¬1-·ÅÆú±¾´ÎÑ¡Ôñ£¬2-Ò»¼üÑ¡Ôñ£¨½ö¿ªÆôÁË×Ô¶¯Ñ¡ÔñʱÓÐЧ£©
|
# BYTE SelectIndex; //ÊÖ¶¯Ñ¡ÔñË÷Òý 0~n
|
# BYTE ReplaceHole; //ÊÖ¶¯Ñ¡ÔñÌæ»»²Ûλ 1~n£¬²Ûλ=²ÛË÷Òý+1£¬Éý¼¶Ê±¿ÉÖ±½Ó·¢0
|
#};
|
def OnDingjungeEffSelect(index, clientData, tick):
|
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
selectType = clientData.SelectType
|
selectIndex = clientData.SelectIndex
|
replaceHole = clientData.ReplaceHole
|
|
if selectType == 2:
|
__doAutoSelectAll(curPlayer)
|
elif selectType == 1:
|
__randSelectEff(curPlayer, isReset=True)
|
else:
|
if __doSelectEff(curPlayer, selectIndex, replaceHole):
|
__randSelectEff(curPlayer, isReset=True)
|
|
SyncDingjungeInfo(curPlayer)
|
return
|
|
def __doAutoSelectAll(curPlayer):
|
if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffAuto):
|
GameWorld.DebugLog("먦Æô×Ô¶¯Ñ¡Ôñ!")
|
return
|
unSelectCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGUnSelectCnt)
|
|
selectSetAttrIDList = [] # Ч¹ûÑ¡ÔñÔ¤Éè
|
for ssIndex in range(IpyGameDataPY.GetFuncCfg("DingjungeEff", 4)):
|
attrID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffSet % ssIndex)
|
if attrID:
|
selectSetAttrIDList.append(attrID)
|
|
effHoleCnt = __getUnlockEffHoleCnt(curPlayer)
|
|
GameWorld.DebugLog("Ö´ÐÐÒ»¼üÑ¡Ôñ¼Ó³ÉЧ¹û: unSelectCnt=%s,effHoleCnt=%s,selectSetAttrIDList=%s" % (unSelectCnt, effHoleCnt, selectSetAttrIDList))
|
|
randEffCnt = IpyGameDataPY.GetFuncCfg("DingjungeEff", 3)
|
for _ in range(unSelectCnt):
|
effIDList = __randSelectEff(curPlayer, randEffCnt)
|
if not effIDList:
|
break
|
if not __doAutoSelectEff(curPlayer, effIDList, selectSetAttrIDList, effHoleCnt):
|
# ²»ÐèÒª×Ô¶¯Ñ¡Ôñ£¬Ö±½ÓÍ˳ö£¬Íæ¼ÒÊÖ¶¯Ñ¡Ôñ
|
break
|
# ×Ô¶¯Ñ¡ÔñºóÖØÖÃ
|
for sIndex in range(randEffCnt):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGSelectEffect % sIndex, 0)
|
return True
|
|
def __getUnlockEffHoleCnt(curPlayer):
|
## »ñÈ¡ÒѽâËøµÄЧ¹û²ÛÊý
|
todayLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGLineID)
|
effHoleNeedLVIDList = IpyGameDataPY.GetFuncEvalCfg("DingjungeEff", 1)
|
effHoleCnt = 0 # ÒѽâËøµÄЧ¹û²ÛÊý
|
for needLVID in effHoleNeedLVIDList:
|
if todayLineID >= needLVID:
|
effHoleCnt += 1
|
return effHoleCnt
|
|
def __randSelectEff(curPlayer, randEffCnt=0, isReset=False):
|
## Ëæ»úÉú³É´ýÑ¡Ôñ¼Ó³ÉЧ¹û
|
unSelectCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGUnSelectCnt)
|
if unSelectCnt <= 0:
|
GameWorld.DebugLog("ûÓÐδ´¦ÀíµÄ¼Ó³ÉЧ¹û´ÎÊýÁË")
|
return
|
if not randEffCnt:
|
randEffCnt = IpyGameDataPY.GetFuncCfg("DingjungeEff", 3)
|
effIDList = []
|
if isReset:
|
# ÖØÖÃ
|
for sIndex in range(randEffCnt):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGSelectEffect % sIndex, 0)
|
else:
|
for sIndex in range(randEffCnt):
|
effID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGSelectEffect % sIndex)
|
if not effID:
|
break
|
effIDList.append(effID)
|
if effIDList:
|
GameWorld.DebugLog("ÒÑ´æÔÚδѡÔñµÄ¼Ó³ÉЧ¹ûµÈÑ¡ÔñºóÔÙÉú³É: effIDList=%s,unSelectCnt=%s" % (effIDList, unSelectCnt))
|
return effIDList
|
|
fullLVEffIDList = [] # ÒÑÂú¼¶µÄЧ¹ûIDÁбí
|
effMaxLV = IpyGameDataPY.GetFuncCfg("DingjungeEff", 2)
|
for eIndex in range(len(IpyGameDataPY.GetFuncEvalCfg("DingjungeEff", 1))):
|
effInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffect % eIndex)
|
if not effInfo:
|
break
|
effID, effLV = effInfo / 100, effInfo % 100
|
if effLV >= effMaxLV:
|
fullLVEffIDList.append(effID)
|
|
randWeightList = []
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
for index in range(ipyDataMgr.GetFBDJGEffectCount()):
|
ipyData = ipyDataMgr.GetFBDJGEffectByIndex(index)
|
effID = ipyData.GetEffID()
|
if effID in fullLVEffIDList:
|
# ÅųýÂú¼¶µÄ
|
continue
|
randWeight = ipyData.GetRandWeight()
|
if randWeight:
|
randWeightList.append([randWeight, effID])
|
|
# Ëæ»úЧ¹û£¬²»Öظ´
|
randCnt = 200
|
while len(effIDList) < randEffCnt and randCnt > 0:
|
randCnt -= 1
|
randEffID = GameWorld.GetResultByWeightList(randWeightList)
|
if randEffID not in effIDList:
|
effIDList.append(randEffID)
|
|
unSelectCnt -= 1
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGUnSelectCnt, unSelectCnt)
|
for sIndex in range(randEffCnt):
|
effID = effIDList[sIndex] if len(effIDList) > sIndex else 0
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGSelectEffect % sIndex, effID)
|
#GameWorld.DebugLog("Ëæ»úÉú³É¼Ó³ÉЧ¹û: effIDList=%s,unSelectCnt=%s,fullLVEffIDList=%s" % (effIDList, unSelectCnt, fullLVEffIDList))
|
return effIDList
|
|
def __doAutoSelectEff(curPlayer, selectEffIDList, selectSetAttrIDList, effHoleCnt):
|
## ×Ô¶¯Ñ¡Ôñ¼Ó³É
|
|
# ÈôËæ»ú³öÁ˶àÖÖÔ¤ÉèÄڵĵÄÊôÐÔ£¬ÔòÓÅÏÈÑ¡ÔñÆ·Öʸߵģ¬Ö»³öÏÖµ¥ÖÖÔ¤ÉèÄÚÊôÐԵϰ£¬ÔòÔ¤ÉèÓÅÏÈ
|
priorityEffList = [] # Æ·ÖÊÓÅÏÈ
|
for effID in selectEffIDList:
|
effIpyData = IpyGameDataPY.GetIpyGameData("FBDJGEffect", effID)
|
if not effIpyData:
|
continue
|
effQuality = effIpyData.GetEffQuality()
|
attrID = effIpyData.GetAttrID()
|
inSet = 0 # Ô¤ÉèÓÅÏÈ£¬µ«¶à¸öÔ¤Éèͬʱ³öÏÖʱ£¬ÏÈÆ·ÖÊÓÅÏÈ£¬ÔÙÔ¤ÉèÓÅÏȼ¶
|
setPriority = 0 # Ô¤ÉèÅÅÐòÓÅÏȼ¶
|
if attrID in selectSetAttrIDList:
|
inSet = 1
|
setPriority = len(selectSetAttrIDList) - selectSetAttrIDList.index(attrID)
|
|
effLV = 1 # ³õʼ1¼¶
|
effInfo = effID * 100 + effLV
|
eIndex = -1 # ÉúЧË÷Òý£¬ÉèΪ-1£¬±ÈÒÑÉúЧµÄµÍ
|
priorityEffList.append([inSet, effQuality, setPriority, eIndex, effInfo, effID, attrID])
|
|
priorityEffList.sort(reverse=True)
|
if not priorityEffList:
|
return
|
#GameWorld.DebugLog(" ÅÅÐòÓÅÏȼ¶: [inSet, effQuality, setPriority, eIndex, effInfo, effID, attrID]")
|
#GameWorld.DebugLog(" ´ýÑ¡ÔñÅÅÐò: %s" % priorityEffList)
|
selectEff = priorityEffList[0] # ×Ô¶¯Ñ¡ÔñµÚÒ»¸ö
|
#selectAttrID = selectEff[Priority_AttrID]
|
selectEffID = selectEff[Priority_EffID]
|
selectEffInfo = selectEff[Priority_EffInfo]
|
|
effMaxLV = IpyGameDataPY.GetFuncCfg("DingjungeEff", 2)
|
emptyIndex = -1
|
effList = [] # ÒÑÉúЧµÄЧ¹û
|
for eIndex in range(effHoleCnt):
|
effInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffect % eIndex)
|
if not effInfo:
|
if emptyIndex == -1:
|
#GameWorld.DebugLog(" »¹ÓпղÛ: eIndex=%s" % eIndex)
|
emptyIndex = eIndex
|
continue
|
|
effID, effLV = effInfo / 100, effInfo % 100
|
|
effIpyData = IpyGameDataPY.GetIpyGameData("FBDJGEffect", effID)
|
if not effIpyData:
|
continue
|
effQuality = effIpyData.GetEffQuality()
|
attrID = effIpyData.GetAttrID()
|
|
# ÒÑ´æÔÚ£¬Éý¼¶
|
if effID == selectEffID and effLV < effMaxLV:
|
effLV += 1
|
effInfo = effID * 100 + effLV
|
#GameWorld.DebugLog(" ÒÑ´æÔÚ¸ÃЧ¹ûÖ±½ÓÉý¼¶: eIndex=%s,effID=%s,effLV=%s,attrID=%s" % (eIndex, effID, effLV, attrID))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % eIndex, effInfo)
|
return True
|
|
inSet = 0 # Ô¤ÉèÓÅÏÈ£¬µ«¶à¸öÔ¤Éèͬʱ³öÏÖʱ£¬ÏÈÆ·ÖÊÓÅÏÈ£¬ÔÙÔ¤ÉèÓÅÏȼ¶
|
setPriority = 0 # Ô¤ÉèÅÅÐòÓÅÏȼ¶
|
if attrID in selectSetAttrIDList:
|
inSet = 1
|
setPriority = len(selectSetAttrIDList) - selectSetAttrIDList.index(attrID)
|
|
effList.append([inSet, effQuality, setPriority, eIndex, effInfo, effID, attrID])
|
|
# ¿Õ²Û
|
if emptyIndex != -1:
|
eIndex = emptyIndex
|
effID = selectEffID
|
effLV = 1
|
effInfo = effID * 100 + effLV
|
#GameWorld.DebugLog(" ¿Õ²ÛÖ±½ÓÉèÖÃ: emptyIndex=%s,effID=%s,effLV=%s,attrID=%s,effList=%s" % (eIndex, effID, effLV, selectAttrID, effList))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % eIndex, effInfo)
|
return True
|
|
# Ìæ»»Âß¼
|
effList.append(selectEff) # Ñ¡ÔñÏîÔÙÓëÉúЧµÄÒ»ÆðÅÅÐò
|
effList.sort(reverse=True)
|
|
lastEff = effList[-1]
|
lastEIndex = lastEff[Priority_EIndex]
|
#lastEffID = lastEff[Priority_EffID]
|
#lastAttrID = lastEff[Priority_AttrID]
|
if lastEIndex == -1:
|
pass
|
#GameWorld.DebugLog(" ÓÅÏȼ¶±ÈÒÑÉúЧµÄµÍ£¬Ö±½ÓÉáÆú! lastEIndex=%s,lastEffID=%s,lastAttrID=%s,effList=%s" % (lastEIndex, lastEffID, lastAttrID, effList))
|
else:
|
replaceIndex = lastEIndex
|
effInfo = selectEffInfo
|
#GameWorld.DebugLog(" ÓÅÏȼ¶±ÈÒÑÉúЧµÄ¸ß£¬Ö±½ÓÌæ»»! replaceIndex=%s,selectAttrID=%s,effInfo=%s,effList=%s" % (replaceIndex, selectAttrID, effInfo, effList))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % replaceIndex, effInfo)
|
|
return True
|
|
def __doSelectEff(curPlayer, selectIndex, replaceHole):
|
## ÊÖ¶¯Ñ¡ÔñЧ¹û
|
selectEffID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGSelectEffect % selectIndex)
|
GameWorld.DebugLog("ÊÖ¶¯Ñ¡ÔñЧ¹û: selectIndex=%s,selectEffID=%s,replaceHole=%s" % (selectIndex, selectEffID, replaceHole))
|
if not selectEffID:
|
return
|
effHoleCnt = __getUnlockEffHoleCnt(curPlayer)
|
effMaxLV = IpyGameDataPY.GetFuncCfg("DingjungeEff", 2)
|
emptyIndex = -1
|
for eIndex in range(effHoleCnt):
|
effInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffect % eIndex)
|
if not effInfo:
|
if emptyIndex == -1:
|
GameWorld.DebugLog(" »¹ÓпղÛ: eIndex=%s" % eIndex)
|
emptyIndex = eIndex
|
continue
|
effID, effLV = effInfo / 100, effInfo % 100
|
# ÒÑ´æÔÚ£¬Éý¼¶
|
if effID == selectEffID:
|
if effLV >= effMaxLV:
|
GameWorld.DebugLog(" ÒÑ´æÔÚ¸ÃЧ¹ûÇÒÒÑÂú¼¶: eIndex=%s,effID=%s,effLV=%s" % (eIndex, effID, effLV))
|
return
|
effLV += 1
|
effInfo = effID * 100 + effLV
|
GameWorld.DebugLog(" ÒÑ´æÔÚ¸ÃЧ¹ûÖ±½ÓÉý¼¶: eIndex=%s,effID=%s,effLV=%s" % (eIndex, effID, effLV))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % eIndex, effInfo)
|
return True
|
|
# ¿Õ²Û
|
if emptyIndex != -1:
|
eIndex = emptyIndex
|
effID = selectEffID
|
effLV = 1
|
effInfo = effID * 100 + effLV
|
GameWorld.DebugLog(" ¿Õ²ÛÖ±½ÓÉèÖÃ: emptyIndex=%s,effID=%s,effLV=%s" % (eIndex, effID, effLV))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % eIndex, effInfo)
|
return True
|
|
# Ìæ»»Âß¼
|
if replaceHole < 1 or replaceHole > effHoleCnt:
|
GameWorld.DebugLog(" Ìæ»»µÄÄ¿±ê²Ûλ²»¿ÉÓÃ: replaceHole=%s,effHoleCnt=%s" % (replaceHole, effHoleCnt))
|
return
|
|
effLV = 1
|
selectEffInfo = selectEffID * 100 + effLV
|
replaceIndex = replaceHole - 1
|
effInfo = selectEffInfo
|
GameWorld.DebugLog(" ÊÖ¶¯Ñ¡ÔñÌæ»»! replaceIndex=%s,effInfo=%s" % (replaceIndex, effInfo))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DJGEffect % replaceIndex, effInfo)
|
return True
|
|
def SyncDingjungeInfo(curPlayer):
|
clientPack = ChPyNetSendPack.tagSCDingjungeInfo()
|
clientPack.TodayPass = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGLineID)
|
effList = [] # ÒÑÉúЧµÄЧ¹û
|
for eIndex in range(len(IpyGameDataPY.GetFuncEvalCfg("DingjungeEff", 1))):
|
effInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffect % eIndex)
|
if not effInfo:
|
break
|
effID, effLV = effInfo / 100, effInfo % 100
|
eff = ChPyNetSendPack.tagSCDingjungeEff()
|
eff.EffIndex = eIndex
|
eff.EffID = effID
|
eff.EffLV = effLV
|
effList.append(eff)
|
clientPack.EffList = effList
|
clientPack.EffCnt = len(clientPack.EffList)
|
selectEffList = [] # ´ýÑ¡ÔñµÄЧ¹û
|
for sIndex in range(IpyGameDataPY.GetFuncCfg("DingjungeEff", 3)):
|
effID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGSelectEffect % sIndex)
|
if not effID:
|
break
|
selectEffList.append(effID)
|
clientPack.SelectEffList = selectEffList
|
clientPack.SelectEffCnt = len(clientPack.SelectEffList)
|
clientPack.UnSelectCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGUnSelectCnt)
|
clientPack.SelectAuto = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffAuto)
|
selectSetAttrIDList = [] # Ч¹ûÑ¡ÔñÔ¤Éè
|
for ssIndex in range(IpyGameDataPY.GetFuncCfg("DingjungeEff", 4)):
|
attrID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DJGEffSet % ssIndex)
|
selectSetAttrIDList.append(attrID)
|
clientPack.SelectSetAttrIDList = selectSetAttrIDList
|
clientPack.SelectSetCnt = len(clientPack.SelectSetAttrIDList)
|
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
return
|