From 3811d20e99c0e2ce28a3e9edea805598e59f68af Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期日, 05 五月 2019 11:49:01 +0800
Subject: [PATCH] 6646 【后端】【2.0】特殊丹药效果新增(会灵丹)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
index f578d9c..5629cf1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
@@ -43,7 +43,7 @@
     return True
 
 
-def OnLogin(curPlayer):        
+def OnLogin(curPlayer):
     SyncRealmFBState(curPlayer)
     UpdateRealmExp(curPlayer, False)
     NotifyRealmExpInfo(curPlayer)
@@ -185,7 +185,7 @@
     GameFuncComm.DoFuncOpenLogic(curPlayer)
     SyncRealmFBState(curPlayer)
     #更新修为速率
-    UpdateRealmExp(curPlayer, False)
+    UpdateRealmExp(curPlayer, False, True)
     NotifyRealmExpInfo(curPlayer)
     #境界提升成就
     PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RealmlvUp, nextRealmLv)
@@ -236,9 +236,10 @@
     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():
@@ -248,21 +249,32 @@
     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)
@@ -272,11 +284,22 @@
         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)

--
Gitblit v1.8.0