| | |
| | | import EventShell
|
| | | import DataRecordPack
|
| | |
|
| | | import time
|
| | | #------------------------------------------------------------------------------
|
| | | (
|
| | | StopSitType1, #离线中断
|
| | | StopSitType2, #主动中断
|
| | | StopSitType3, #被采集打断
|
| | | )=range(1,4)
|
| | |
|
| | |
|
| | | def DoOfficialOpen(curPlayer):
|
| | |
| | | # DoRealmLVUpLogic(curPlayer)
|
| | | return True
|
| | |
|
| | |
|
| | | def OnLogin(curPlayer):
|
| | | SyncRealmFBState(curPlayer)
|
| | | UpdateRealmExp(curPlayer, False)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def GetRealmIpyData(realmLV): return IpyGameDataPY.GetIpyGameData("Realm", realmLV)
|
| | |
|
| | |
|
| | | #// A5 24 开启渡劫 #tagCMOpenRealmFB
|
| | | #
|
| | |
| | | sendPack.IsPass = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmFBIsOpen)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
|
| | | ## 计算爵位属性
|
| | | # @param curPlayer 玩家
|
| | |
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | |
|
| | | #// A5 23 提升境界等级 # tagCMRealmLVUp
|
| | | #
|
| | | #struct tagCMRealmLVUp
|
| | |
| | | #扣除物品
|
| | | ItemCommon.ReduceItem(curPlayer, curPack, itemIndexList, needItemCount, True, "Realm")
|
| | |
|
| | | |
| | | DoRealmLVUpLogic(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def DoRealmLVUpLogic(curPlayer, needSys=True):
|
| | | curRealmLV = curPlayer.GetOfficialRank()
|
| | | nextRealmLv = curRealmLV + 1
|
| | | GameWorld.DebugLog(' 升级境界nextRealmLv=%s'%nextRealmLv)
|
| | | GameWorld.DebugLog(' 升级境界nextRealmLv=%s' % nextRealmLv)
|
| | | nextRealmIpyData = GetRealmIpyData(nextRealmLv)
|
| | | if not nextRealmIpyData:
|
| | | return
|
| | |
| | | curPlayer.SetOfficialRank(nextRealmLv)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmFBIsOpen, 0)
|
| | | if needSys:
|
| | | PlayerControl.WorldNotify(0, 'RealmUpSuccess', [curPlayer.GetName(), nextRealmLv])
|
| | | addBuffID = nextRealmIpyData.GetBuffID()
|
| | | if addBuffID:
|
| | | PlayerControl.WorldNotify(0, 'BigRealmUpSuccess', [curPlayer.GetName(), nextRealmLv, IpyGameDataPY.GetFuncCfg('RadioExpRealm')])
|
| | | msgStr = str(addBuffID)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'RealmUpAddBuff', msgStr, len(msgStr))
|
| | | else:
|
| | | PlayerControl.WorldNotify(0, 'RealmUpSuccess', [curPlayer.GetName(), nextRealmLv])
|
| | | |
| | | RefreshOfficialAttr(curPlayer)
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | SyncRealmFBState(curPlayer)
|
| | | #更新修为速率
|
| | | UpdateRealmExp(curPlayer, False)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | #境界提升成就
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RealmlvUp, nextRealmLv)
|
| | | #更新排行榜
|
| | |
| | | DataRecordPack.DR_RealmLVUp(curPlayer, nextRealmLv)
|
| | | return True
|
| | |
|
| | |
|
| | | def DologicDujieFBPass(curPlayer, realmLV, star):
|
| | | #渡劫通过后处理
|
| | | realmIpyData = GetRealmIpyData(realmLV)
|
| | |
| | | #DoRealmLVUpLogic(curPlayer)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmFBIsOpen, 1)
|
| | | SyncRealmFBState(curPlayer)
|
| | |
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | #// A5 0C 使用道具减少渡劫打坐时间 #tagCMReduceSitTime
|
| | | #// A5 21 境界修为池提取 #tagCMTakeOutRealmExp
|
| | | #
|
| | | #struct tagCMReduceSitTime
|
| | | #struct tagCMTakeOutRealmExp
|
| | | #{
|
| | | # tagHead Head;
|
| | | # WORD ItemCnt; // 道具数量
|
| | | #};
|
| | | def OnReduceSitTime(index, clientData, tick):
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # itemCnt = clientData.ItemCnt
|
| | | # reduceSitTimeItemID = IpyGameDataPY.GetFuncCfg('ReduceSitTimeItemID')
|
| | | # |
| | | # remainTime = __GetRemainSitTime(curPlayer)
|
| | | # if remainTime <= 0:
|
| | | # GameWorld.DebugLog('使用道具减少渡劫打坐时间 remainTime=%s' % remainTime)
|
| | | # return
|
| | | # curItem = GameWorld.GetGameData().GetItemByTypeID(reduceSitTimeItemID)
|
| | | # curEff = curItem.GetEffectByIndex(0)
|
| | | # singleReduceTime = curEff.GetEffectValue(0)
|
| | | # useCnt = min(itemCnt, remainTime/singleReduceTime)
|
| | | # if not useCnt:
|
| | | # GameWorld.DebugLog('使用道具减少渡劫打坐时间 useCnt=%s' % useCnt)
|
| | | # return
|
| | | # |
| | | # itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | # hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(reduceSitTimeItemID, itemPack, useCnt)
|
| | | # if not hasEnough:
|
| | | # GameWorld.DebugLog('使用道具减少渡劫打坐时间 道具不足%s' % useCnt)
|
| | | # return
|
| | | # |
| | | # ItemCommon.ReduceItem(curPlayer, itemPack, itemList, useCnt, False)
|
| | | # |
| | | # reduceTime = useCnt * singleReduceTime
|
| | | # sitRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmSitRemainTime)
|
| | | # newRemainTime = max(0, sitRemainTime-reduceTime)
|
| | | # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmSitRemainTime, newRemainTime)
|
| | | # GameWorld.DebugLog('使用道具减少渡劫打坐时间 使用道具%s,减少打坐时间%s秒' % (useCnt, reduceTime))
|
| | | # SyncRealmFBState(curPlayer)
|
| | | def OnTakeOutRealmExp(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetID()
|
| | | curTotalRealmExp = UpdateRealmExp(curPlayer, False)
|
| | | if curTotalRealmExp <= 0:
|
| | | GameWorld.DebugLog('境界修为池提取 没有经验可提取', playerID)
|
| | | return
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.AddExp(curTotalRealmExp)
|
| | | PlayerControl.NotifyCode(curPlayer, 'TakeOutRealmExp', [curTotalRealmExp])
|
| | | #
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, int(time.time()))
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExp, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpPoint, 0)
|
| | |
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def UpdateRealmExp(curPlayer, isNotify=True):
|
| | | ##更新境界修为池
|
| | | ipyData = GetRealmIpyData(curPlayer.GetOfficialRank())
|
| | | if not ipyData:
|
| | | return 0
|
| | | if not ipyData.GetExpRate():
|
| | | return 0
|
| | | curTime = int(time.time())
|
| | | beginTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBeginTime)
|
| | | if not beginTime:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, curTime)
|
| | | return 0
|
| | | curRealmExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExp)
|
| | | curRealmExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpPoint)
|
| | | curTotalExp = curRealmExpPoint * ChConfig.Def_PerPointValue + curRealmExp
|
| | | if curTotalExp >= ipyData.GetExpLimit():
|
| | | return curTotalExp
|
| | | passSeconds = curTime - beginTime
|
| | | if passSeconds <= 0:
|
| | | return curTotalExp
|
| | | ipyData = GetRealmIpyData(curPlayer.GetOfficialRank())
|
| | | if not ipyData:
|
| | | return curTotalExp
|
| | | addExp = passSeconds / IpyGameDataPY.GetFuncCfg('RealmExpTime') * ipyData.GetExpRate()
|
| | | if addExp <= 0:
|
| | | return curTotalExp
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, curTime)
|
| | | |
| | | updTotalExp = min(curTotalExp + addExp, ipyData.GetExpLimit())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExp, updTotalExp % ChConfig.Def_PerPointValue)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpPoint, updTotalExp / ChConfig.Def_PerPointValue)
|
| | | #֪ͨ
|
| | | if isNotify:
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | return updTotalExp
|
| | |
|
| | |
|
| | | def NotifyRealmExpInfo(curPlayer):
|
| | | ##通知修为池信息
|
| | | sendPack = ChPyNetSendPack.tagMCRealmExpInfo()
|
| | | sendPack.BeginTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBeginTime)
|
| | | sendPack.CurExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExp)
|
| | | sendPack.CurExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpPoint)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|