| | |
| | | import time
|
| | | #------------------------------------------------------------------------------
|
| | |
|
| | | # 渡劫条件记录位定义
|
| | | (
|
| | | RealmLVUpAward_LV, # 等级
|
| | | RealmLVUpAward_PassMap, # 过关关卡
|
| | | RealmLVUpAward_TreeLV, # 仙树等级
|
| | | RealmLVUpAward_CutTreeCnt, # 砍树次数
|
| | | ) = range(4)
|
| | |
|
| | | def DoOfficialOpen(curPlayer):
|
| | | #功能开启
|
| | |
| | | sendPack = ChPyNetSendPack.tagMCSyncRealmInfo()
|
| | | sendPack.IsPass = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmFBIsOpen)
|
| | | sendPack.XXZLAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmXXZLAward)
|
| | | sendPack.RealmLVUpAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmLVUpAwardState)
|
| | | sendPack.RealmLVUpCutTreeCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmLVUpCutTreeCnt)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | | def AddRealmLVUpCutTreeCnt(curPlayer, addCnt):
|
| | | curRealmLV = curPlayer.GetOfficialRank()
|
| | | realmIpyData = GetRealmIpyData(curRealmLV)
|
| | | if not realmIpyData:
|
| | | return
|
| | | NeedCutTreeCnt = realmIpyData.GetNeedCutTreeCnt()
|
| | | if not NeedCutTreeCnt:
|
| | | return
|
| | | curTreeCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmLVUpCutTreeCnt)
|
| | | if curTreeCnt >= NeedCutTreeCnt:
|
| | | return
|
| | | updCutTreeCnt = min(curTreeCnt + addCnt, NeedCutTreeCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmLVUpCutTreeCnt, updCutTreeCnt)
|
| | | SyncRealmFBState(curPlayer)
|
| | | return
|
| | |
|
| | | def GetRealmLVUpTaskAward(curPlayer, awardIndex):
|
| | | ## 领取境界渡劫任务条件奖励
|
| | | awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmLVUpAwardState)
|
| | | if awardState&pow(2, awardIndex):
|
| | | GameWorld.DebugLog("境界渡劫条件领奖,已领取过! awardIndex=%s" % awardIndex, curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | curRealmLV = curPlayer.GetOfficialRank()
|
| | | realmIpyData = GetRealmIpyData(curRealmLV)
|
| | | if not realmIpyData:
|
| | | return
|
| | | |
| | | awardItemInfo = None
|
| | | if awardIndex == RealmLVUpAward_LV:
|
| | | playerLV = curPlayer.GetLV()
|
| | | NeedLV = realmIpyData.GetNeedLV()
|
| | | if playerLV < NeedLV:
|
| | | GameWorld.DebugLog('境界渡劫条件领奖,等级不足! curRealmLV=%s,playerLV=%s < %s' % (curRealmLV, playerLV, NeedLV))
|
| | | return
|
| | | awardItemInfo = realmIpyData.GetLVAwardItem()
|
| | | |
| | | elif awardIndex == RealmLVUpAward_PassMap:
|
| | | NeedPassMap = realmIpyData.GetNeedPassMap()
|
| | | if not NeedPassMap or len(NeedPassMap) != 2:
|
| | | return
|
| | | mapID, lineID = NeedPassMap
|
| | | grade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
|
| | | if not grade:
|
| | | GameWorld.DebugLog('境界渡劫条件领奖,副本未过关! curRealmLV=%s,mapID=%s,lineID=%s' % (curRealmLV, mapID, lineID))
|
| | | return
|
| | | awardItemInfo = realmIpyData.GetPassMapAwardItem()
|
| | | |
| | | elif awardIndex == RealmLVUpAward_TreeLV:
|
| | | NeedTreeLV = realmIpyData.GetNeedTreeLV()
|
| | | if not NeedTreeLV:
|
| | | return
|
| | | treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
|
| | | if treeLV < NeedTreeLV:
|
| | | GameWorld.DebugLog('境界渡劫条件领奖,仙树等级不足! curRealmLV=%s,treeLV=%s < %s' % (curRealmLV, treeLV, NeedTreeLV))
|
| | | return
|
| | | awardItemInfo = realmIpyData.GetTreeLVAwardItem()
|
| | | |
| | | elif awardIndex == RealmLVUpAward_CutTreeCnt:
|
| | | NeedCutTreeCnt = realmIpyData.GetNeedCutTreeCnt()
|
| | | if not NeedCutTreeCnt:
|
| | | return
|
| | | cutTreeCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmLVUpCutTreeCnt)
|
| | | if cutTreeCnt < NeedCutTreeCnt:
|
| | | GameWorld.DebugLog('境界渡劫条件领奖,砍树次数不足! curRealmLV=%s,cutTreeCnt=%s < %s' % (curRealmLV, cutTreeCnt, NeedCutTreeCnt))
|
| | | return
|
| | | awardItemInfo = realmIpyData.GetCutTreeAwardItem()
|
| | | |
| | | else:
|
| | | return
|
| | | |
| | | if not awardItemInfo or len(awardItemInfo) != 2:
|
| | | return
|
| | | itemID, itemCount = awardItemInfo
|
| | | if not ItemCommon.GiveAwardItem(curPlayer, [[itemID, itemCount, 0]]):
|
| | | return
|
| | | |
| | | updAwardState = awardState|pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmLVUpAwardState, updAwardState)
|
| | | GameWorld.DebugLog("境界渡劫条件领奖OK! curRealmLV=%s,awardIndex=%s,updAwardState=%s" % (curRealmLV, awardIndex, updAwardState), curPlayer.GetPlayerID())
|
| | | SyncRealmFBState(curPlayer)
|
| | | return
|
| | |
|
| | | #// A5 23 提升境界等级 # tagCMRealmLVUp
|
| | | #
|
| | |
| | | if not canLvUp:
|
| | | GameWorld.DebugLog(' 副本未过关,不能升级境界')
|
| | | return
|
| | | #等级判断
|
| | | if curPlayer.GetLV() < realmIpyData.GetNeedLV():
|
| | | |
| | | awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmLVUpAwardState)
|
| | | #等级判断 - 必要条件
|
| | | playerLV = curPlayer.GetLV()
|
| | | if not awardState&pow(2, RealmLVUpAward_LV):
|
| | | GameWorld.DebugLog('等级条件奖励未领取,不能升级境界! curRealmLV=%s' % (curRealmLV))
|
| | | return
|
| | | #装备判断
|
| | | needEquip = realmIpyData.GetNeedEquip()
|
| | | if needEquip and len(needEquip) == 4:
|
| | | classLV, star, isSuite, color = needEquip
|
| | | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for place in ChConfig.EquipPlace_Base:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place)
|
| | | if not ipyData:
|
| | | return
|
| | | gridIndex = ipyData.GetGridIndex()
|
| | | curEquip = equipPack.GetAt(gridIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | return
|
| | | curPartStar = ChEquip.GetEquipPartStar(curPlayer, gridIndex)
|
| | | if curPartStar < star:
|
| | | return
|
| | | if isSuite and not curEquip.GetSuiteID():
|
| | | return
|
| | | if curEquip.GetItemColor() < color:
|
| | | totalExpNeed = PlayerControl.GetTotalExpByPlayerLv(playerLV)
|
| | | totalExp = PlayerControl.GetPlayerTotalExp(curPlayer)
|
| | | if totalExp < totalExpNeed:
|
| | | GameWorld.DebugLog('等级条件经验未满,不能升级境界! curRealmLV=%s,playerLV=%s,totalExp=%s < %s' % (curRealmLV, playerLV, totalExp, totalExpNeed))
|
| | | return
|
| | |
|
| | | needItemID = realmIpyData.GetNeedItemID()
|
| | | needItemCount = realmIpyData.GetNeedItemCnt()
|
| | | # 支持不消耗物品升级
|
| | | if needItemID > 0 and needItemCount > 0:
|
| | | curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(needItemID, curPack, needItemCount)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("渡劫开启, 材料不足! Lv=%s, needItemID=%s,needItemCount=%s" |
| | | % (curRealmLV, needItemID, needItemCount))
|
| | | #副本过关判断
|
| | | NeedPassMap = realmIpyData.GetNeedPassMap()
|
| | | if NeedPassMap:
|
| | | if not awardState&pow(2, RealmLVUpAward_PassMap):
|
| | | GameWorld.DebugLog('过关条件奖励未领取,不能升级境界! curRealmLV=%s' % (curRealmLV))
|
| | | return
|
| | | #扣除物品
|
| | | ItemCommon.ReduceItem(curPlayer, curPack, itemIndexList, needItemCount, True, "Realm")
|
| | | |
| | | #仙树等级判断
|
| | | NeedTreeLV = realmIpyData.GetNeedTreeLV()
|
| | | if NeedTreeLV:
|
| | | if not awardState&pow(2, RealmLVUpAward_TreeLV):
|
| | | GameWorld.DebugLog('仙树等级条件奖励未领取,不能升级境界! curRealmLV=%s' % (curRealmLV))
|
| | | return
|
| | | |
| | | #砍树次数判断
|
| | | NeedCutTreeCnt = realmIpyData.GetNeedCutTreeCnt()
|
| | | if NeedCutTreeCnt:
|
| | | if not awardState&pow(2, RealmLVUpAward_CutTreeCnt):
|
| | | GameWorld.DebugLog('砍树次数条件奖励未领取,不能升级境界! curRealmLV=%s' % (curRealmLV))
|
| | | return
|
| | |
|
| | | DoRealmLVUpLogic(curPlayer)
|
| | | return
|
| | |
| | | __DoRealmLVUpAddPoint(curPlayer)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmFBIsOpen, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmLVUpAwardState, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmLVUpCutTreeCnt, 0)
|
| | | |
| | | PlayerControl.PlayerControl(curPlayer).PlayerLvUp()
|
| | | |
| | | if needSys:
|
| | | addBuffID = nextRealmIpyData.GetBuffID()
|
| | | if addBuffID:
|