| | |
| | | import GameWorld
|
| | | import ChConfig
|
| | | import PlayerSuccess
|
| | | import OpenServerCampaign
|
| | | import ChEquip
|
| | | import PlayerBillboard
|
| | | import EventShell
|
| | | import DataRecordPack
|
| | | import SkillCommon
|
| | |
|
| | | import time
|
| | | #------------------------------------------------------------------------------
|
| | |
| | | return True
|
| | |
|
| | |
|
| | | def OnLogin(curPlayer): |
| | | def OnLogin(curPlayer):
|
| | | SyncRealmFBState(curPlayer)
|
| | | UpdateRealmExp(curPlayer, False)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | |
| | | if not canLvUp:
|
| | | GameWorld.DebugLog(' 副本未过关,不能升级境界')
|
| | | return
|
| | | #等级判断
|
| | | if curPlayer.GetLV() < realmIpyData.GetNeedLV():
|
| | | 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:
|
| | | return
|
| | |
|
| | | needItemID = realmIpyData.GetNeedItemID()
|
| | | needItemCount = realmIpyData.GetNeedItemCnt()
|
| | |
| | | if needSys:
|
| | | addBuffID = nextRealmIpyData.GetBuffID()
|
| | | if addBuffID:
|
| | | PlayerControl.WorldNotify(0, 'BigRealmUpSuccess', [curPlayer.GetName(), nextRealmLv, IpyGameDataPY.GetFuncCfg('RadioExpRealm')])
|
| | | PlayerControl.WorldNotify(0, 'BigRealmUpSuccess', [curPlayer.GetName(), curPlayer.GetID(), 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])
|
| | | PlayerControl.WorldNotify(0, 'RealmUpSuccess', [curPlayer.GetName(), curPlayer.GetID(), nextRealmLv])
|
| | |
|
| | | SkillCommon.GivePlayerSkillByJobSkillList(curPlayer, nextRealmIpyData.GetLearnSkillIDInfo())
|
| | | |
| | | addFreePoint = nextRealmIpyData.GetAddFreePoint()
|
| | | if addFreePoint:
|
| | | updFreePoint = curPlayer.GetFreePoint() + addFreePoint
|
| | | curPlayer.SetFreePoint(updFreePoint)
|
| | | GameWorld.DebugLog(" addFreePoint=%s,updFreePoint=%s" % (addFreePoint, updFreePoint))
|
| | | |
| | | RefreshOfficialAttr(curPlayer)
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | SyncRealmFBState(curPlayer)
|
| | | #更新修为速率
|
| | | UpdateRealmExp(curPlayer, False)
|
| | | UpdateRealmExp(curPlayer, False, True)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | #境界提升成就
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RealmlvUp, nextRealmLv)
|
| | | #更新排行榜
|
| | | PlayerBillboard.UpdateRealmBillboard(curPlayer)
|
| | | # 记录开服活动
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_RealmLV, nextRealmLv)
|
| | | #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_RealmLV, nextRealmLv)
|
| | | EventShell.EventRespons_RealmUp(curPlayer, nextRealmLv)
|
| | | #流向
|
| | | DataRecordPack.DR_RealmLVUp(curPlayer, nextRealmLv)
|
| | |
| | | return
|
| | |
|
| | |
|
| | | def UpdateRealmExp(curPlayer, isNotify=True):
|
| | | def UpdateRealmExp(curPlayer, isNotify=True, isRealmLVUP=False):
|
| | | ##更新境界修为池
|
| | | ipyData = GetRealmIpyData(curPlayer.GetOfficialRank())
|
| | | curRealmLV = curPlayer.GetOfficialRank()
|
| | | ipyData = GetRealmIpyData(curRealmLV)
|
| | | if not ipyData:
|
| | | return 0
|
| | | if not ipyData.GetExpRate():
|
| | |
| | | if not beginTime:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, curTime)
|
| | | return 0
|
| | | if isRealmLVUP:
|
| | | ipyData = GetRealmIpyData(curRealmLV-1)
|
| | | |
| | | 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()
|
| | | perRealmExpTime = IpyGameDataPY.GetFuncCfg('RealmExpTime')
|
| | | curExpRate = ipyData.GetExpRate()
|
| | | #buff增加的额外经验
|
| | | buffRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime)
|
| | | buffAddRate = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffAddRate)
|
| | | |
| | | buffTime = min(buffRemainTime, passSeconds)
|
| | | |
| | | addExp = buffTime /perRealmExpTime*(curExpRate*(ShareDefine.Def_MaxRateValue + buffAddRate)/ShareDefine.Def_MaxRateValue) + (passSeconds-buffTime)/perRealmExpTime*curExpRate
|
| | | #addExp = passSeconds / perRealmExpTime * curExpRate
|
| | | if addExp <= 0:
|
| | | return curTotalExp
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, curTime)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBuffRemainTime, buffRemainTime - buffTime)
|
| | |
|
| | | updTotalExp = min(curTotalExp + addExp, ipyData.GetExpLimit())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExp, updTotalExp % ChConfig.Def_PerPointValue)
|
| | |
| | | NotifyRealmExpInfo(curPlayer)
|
| | | return updTotalExp
|
| | |
|
| | | def AddRealmExpBuffTime(curPlayer, addTime, addRate):
|
| | | ##增加会灵丹BUFF时间
|
| | | UpdateRealmExp(curPlayer, False)
|
| | | |
| | | remainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBuffRemainTime, remainTime + addTime)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBuffAddRate, addRate)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def NotifyRealmExpInfo(curPlayer):
|
| | | ##通知修为池信息
|
| | | sendPack = ChPyNetSendPack.tagMCRealmExpInfo()
|
| | | sendPack.BeginTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBeginTime)
|
| | | sendPack.BuffTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime)
|
| | | sendPack.BuffAddRate = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffAddRate)
|
| | | sendPack.CurExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExp)
|
| | | sendPack.CurExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpPoint)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|