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/Item/UseItem/Item_AddRealmExpRate.py |   34 +++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                   |    8 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py                       |    2 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                        |    8 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py           |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py          |   39 +++++++++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                          |    3 +
 7 files changed, 88 insertions(+), 10 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index c85c0c1..ef4b9e7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -16470,6 +16470,8 @@
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
                   ("BeginTime", c_int),    #开始计时时间
+                  ("BuffTime", c_int),    #buff剩余时间
+                  ("BuffAddRate", c_int),    #buff加成万分率
                   ("CurExp", c_int),    #当前总经验
                   ("CurExpPoint", c_int),    #当前总经验点
                   ]
@@ -16489,6 +16491,8 @@
         self.Cmd = 0xA3
         self.SubCmd = 0x27
         self.BeginTime = 0
+        self.BuffTime = 0
+        self.BuffAddRate = 0
         self.CurExp = 0
         self.CurExpPoint = 0
         return
@@ -16504,6 +16508,8 @@
                                 Cmd:%s,
                                 SubCmd:%s,
                                 BeginTime:%d,
+                                BuffTime:%d,
+                                BuffAddRate:%d,
                                 CurExp:%d,
                                 CurExpPoint:%d
                                 '''\
@@ -16511,6 +16517,8 @@
                                 self.Cmd,
                                 self.SubCmd,
                                 self.BeginTime,
+                                self.BuffTime,
+                                self.BuffAddRate,
                                 self.CurExp,
                                 self.CurExpPoint
                                 )
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 411a03e..bd109f1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -449,6 +449,7 @@
 Def_Effect_ItemGiveHonor = 242      #使用道具给予荣誉
 Def_Effect_ItemGiveWeekPartyPoint = 245      #使用道具给予七日巡礼积分
 Def_Effect_ItemGiveWeekPartyPoint1 = 246      #使用道具给予节日巡礼积分
+Def_Effect_AddRealmExpRate = 251 #增加聚灵效率
 #----以下未使用或代码依然存在的---
 Def_Effect_ItemGiveGongXun = 1920        #使用道具给予功勋
 Def_Effect_ItemGiveRuneJH = 1925       #使用道具给予符印精华
@@ -3860,6 +3861,8 @@
 Def_PDict_RealmExp = "RealmExp" #境界修为池总经验
 Def_PDict_RealmExpPoint = "RealmExpPoint" #境界修为池总经验点
 Def_PDict_RealmExpBeginTime = "RealmExpBeginTime" #境界修为池经验开始计时时间
+Def_PDict_RealmExpBuffRemainTime = "RealmExpBuffRemainTime" #境界修为池经验buff剩余时间
+Def_PDict_RealmExpBuffAddRate = "RealmExpBuffAddRate" #境界修为池经验增加百分比(万分率)
 
 #法宝
 Def_PDict_MagicWeaponIsWear = "MagicWeaponIsWear_%s" #法宝佩戴状态 参数法宝ID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index c85c0c1..ef4b9e7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -16470,6 +16470,8 @@
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
                   ("BeginTime", c_int),    #开始计时时间
+                  ("BuffTime", c_int),    #buff剩余时间
+                  ("BuffAddRate", c_int),    #buff加成万分率
                   ("CurExp", c_int),    #当前总经验
                   ("CurExpPoint", c_int),    #当前总经验点
                   ]
@@ -16489,6 +16491,8 @@
         self.Cmd = 0xA3
         self.SubCmd = 0x27
         self.BeginTime = 0
+        self.BuffTime = 0
+        self.BuffAddRate = 0
         self.CurExp = 0
         self.CurExpPoint = 0
         return
@@ -16504,6 +16508,8 @@
                                 Cmd:%s,
                                 SubCmd:%s,
                                 BeginTime:%d,
+                                BuffTime:%d,
+                                BuffAddRate:%d,
                                 CurExp:%d,
                                 CurExpPoint:%d
                                 '''\
@@ -16511,6 +16517,8 @@
                                 self.Cmd,
                                 self.SubCmd,
                                 self.BeginTime,
+                                self.BuffTime,
+                                self.BuffAddRate,
                                 self.CurExp,
                                 self.CurExpPoint
                                 )
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py
index d90ea4c..3741292 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py
@@ -18,6 +18,7 @@
 
 import PlayerPrestigeSys
 import GameWorld
+import ChConfig
 #---------------------------------------------------------------------
 #逻辑实现
 ## GM命令执行入口
@@ -27,6 +28,7 @@
 #  @remarks 函数详细说明.
 def OnExec(curPlayer, list):
     curTotalRealmExp = PlayerPrestigeSys.UpdateRealmExp(curPlayer, isNotify=True)
-    GameWorld.DebugAnswer(curPlayer, "curTotalRealmExp=%s" % curTotalRealmExp)
+    buffRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime)
+    GameWorld.DebugAnswer(curPlayer, "curTotalRealmExp=%s,buffRemainTime=%s" % (curTotalRealmExp, buffRemainTime))
     return
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
index 94d6e0b..61edf87 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -725,7 +725,7 @@
                             ChConfig.Def_Effect_ChatBubbleBox:"Item_ChatBubbleBox", # 激活聊天气泡框
                             ChConfig.Def_Effect_ItemGiveWeekPartyPoint:"Item_WeekPartyPoint", # 增加活动巡礼积分
                             ChConfig.Def_Effect_ItemGiveWeekPartyPoint1:"Item_WeekPartyPoint", # 增加活动巡礼积分
-                            #ChConfig.Def_Effect_AddZhenQiByTimes:"Item_AddZhenQiByTimes", # 增加真气按一天使用次数减少
+                            ChConfig.Def_Effect_AddRealmExpRate:"Item_AddRealmExpRate", # 增加聚灵效率
                             #ChConfig.Def_Effect_AddPrestige:"Item_AddPrestige",  # 给人物威望
                             #ChConfig.Def_Effect_FamilyImpeach:"Item_FamilyImpeach",  # 弹劾符
                             #ChConfig.Def_Effect_ClothesCoatSkin:"Item_ClothesCoatSkin", #激活时装皮肤
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddRealmExpRate.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddRealmExpRate.py
new file mode 100644
index 0000000..56164ea
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddRealmExpRate.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package UseItem.Item_AddRealmExpRate
+#
+# @todo:增加聚灵效率
+# @author xdh
+# @date 2019-5-5
+# @version 1.0
+#
+# 详细描述: 增加聚灵效率
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2019-5-5 12:00"""
+#-------------------------------------------------------------------------------
+
+import PlayerControl
+import PlayerPrestigeSys
+import ItemCommon
+import ChConfig
+
+def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
+    ##批量使用物品
+    #itemTypeID = curRoleItem.GetItemTypeID()
+    curEff = curRoleItem.GetEffectByIndex(0)
+    addTime = curEff.GetEffectValue(0) * useCnt
+    addRate = curEff.GetEffectValue(1)
+    PlayerPrestigeSys.AddRealmExpBuffTime(curPlayer, addTime, addRate)
+    
+    #PlayerControl.NotifyCode(curPlayer, 'UseItem_1', [itemTypeID, mwID, addExp])
+    ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, isForceDR=True)
+    return True, useCnt
+
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