From b9f85c666439ef0e8491d70fb28d48f9deea69bb Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 20 三月 2019 15:37:14 +0800
Subject: [PATCH] 6341 【后端】【2.0】境界改版开发单(修为池)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                      |    4 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py              |  100 +++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py          |   60 ++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py            |   10 
 PySysDB/PySysDBPY.h                                                                             |    2 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                   |  100 +++++-----
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                               |   60 ++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py  |   32 +++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py |  116 ++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                 |    8 
 10 files changed, 341 insertions(+), 151 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 2fb6805..6ed4d3f 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -22,6 +22,8 @@
 	list		AddAttrNum;	//境界加成属性值
 	DWORD		BossID;	//渡劫bossid
 	DWORD		BuffID;	//给全服在线玩家增加buff
+	DWORD		ExpRate;	//修为池经验速率
+	DWORD		ExpLimit;	//修为池经验上限
 };
 
 //神兵表 #tagGodWeapon
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index b360230..910c6f7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -10981,58 +10981,6 @@
 
 
 #------------------------------------------------------
-# A5 0C 使用道具减少渡劫打坐时间 #tagCMReduceSitTime
-
-class  tagCMReduceSitTime(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("ItemCnt", c_ushort),    # 道具数量
-                  ]
-
-    def __init__(self):
-        self.Clear()
-        self.Cmd = 0xA5
-        self.SubCmd = 0x0C
-        return
-
-    def ReadData(self, stringData, _pos=0, _len=0):
-        self.Clear()
-        memmove(addressof(self), stringData[_pos:], self.GetLength())
-        return _pos + self.GetLength()
-
-    def Clear(self):
-        self.Cmd = 0xA5
-        self.SubCmd = 0x0C
-        self.ItemCnt = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagCMReduceSitTime)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// A5 0C 使用道具减少渡劫打坐时间 //tagCMReduceSitTime:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                ItemCnt:%d
-                                '''\
-                                %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.ItemCnt
-                                )
-        return DumpString
-
-
-m_NAtagCMReduceSitTime=tagCMReduceSitTime()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMReduceSitTime.Cmd,m_NAtagCMReduceSitTime.SubCmd))] = m_NAtagCMReduceSitTime
-
-
-#------------------------------------------------------
 # A5 74 刷新悬赏任务 #tagCMRefreshArrestTask
 
 class  tagCMRefreshArrestTask(Structure):
@@ -11606,6 +11554,54 @@
 
 
 #------------------------------------------------------
+# A5 21 境界修为池提取 #tagCMTakeOutRealmExp
+
+class  tagCMTakeOutRealmExp(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA5
+        self.SubCmd = 0x21
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA5
+        self.SubCmd = 0x21
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMTakeOutRealmExp)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A5 21 境界修为池提取 //tagCMTakeOutRealmExp:
+                                Cmd:%s,
+                                SubCmd:%s
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd
+                                )
+        return DumpString
+
+
+m_NAtagCMTakeOutRealmExp=tagCMTakeOutRealmExp()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMTakeOutRealmExp.Cmd,m_NAtagCMTakeOutRealmExp.SubCmd))] = m_NAtagCMTakeOutRealmExp
+
+
+#------------------------------------------------------
 # A5 11 试用首充武器 #tagCMTryFirstGoldItem
 
 class  tagCMTryFirstGoldItem(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 2ca66e3..1bae020 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -16583,6 +16583,66 @@
 
 
 #------------------------------------------------------
+# A3 27 境界修为池信息 #tagMCRealmExpInfo
+
+class  tagMCRealmExpInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("BeginTime", c_int),    #开始计时时间
+                  ("CurExp", c_int),    #当前总经验
+                  ("CurExpPoint", c_int),    #当前总经验点
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA3
+        self.SubCmd = 0x27
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA3
+        self.SubCmd = 0x27
+        self.BeginTime = 0
+        self.CurExp = 0
+        self.CurExpPoint = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCRealmExpInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 27 境界修为池信息 //tagMCRealmExpInfo:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                BeginTime:%d,
+                                CurExp:%d,
+                                CurExpPoint:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.BeginTime,
+                                self.CurExp,
+                                self.CurExpPoint
+                                )
+        return DumpString
+
+
+m_NAtagMCRealmExpInfo=tagMCRealmExpInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCRealmExpInfo.Cmd,m_NAtagMCRealmExpInfo.SubCmd))] = m_NAtagMCRealmExpInfo
+
+
+#------------------------------------------------------
 # A3 49 资源找回次数 #tagMCRecoverNum
 
 class  tagMCRecoverNumInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index c57fbd8..a6f3d26 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -500,8 +500,8 @@
 PacketCallFunc_1 = OpenRealmFB
 
 PacketCMD_2 = 0xA5
-PacketSubCMD_2 = 0x0C
-PacketCallFunc_2 = OnReduceSitTime
+PacketSubCMD_2 = 0x21
+PacketCallFunc_2 = OnTakeOutRealmExp
 
 PacketCMD_3 = 0xA5
 PacketSubCMD_3 = 0x23
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 0987a05..4a09053 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3915,11 +3915,9 @@
 #境界
 Def_PDict_RealmFBIsOpen = "RealmFBIsOpen" #渡劫副本是否开启 0未开启 1已开启 2可升级境界
 Def_PDict_RealmFBAttrAdd = "RealmFBAttrAdd_%s" #渡劫副本属性加成 参数属性ID
-Def_PDict_RealmSitAllTime = "RealmSitAllTime" #打坐总时间
-Def_PDict_RealmSitRemainTime = "RealmSitRemainTime" #开始打坐前剩余时间秒
-Def_PDict_RealmSitStartTime = "RealmSitStartTime" #开始打坐时间
-Def_PDict_RealmSitStopTime = "RealmSitStopTime" #离线时是否在打坐
-
+Def_PDict_RealmExp = "RealmExp" #境界修为池总经验
+Def_PDict_RealmExpPoint = "RealmExpPoint" #境界修为池总经验点
+Def_PDict_RealmExpBeginTime = "RealmExpBeginTime" #境界修为池经验开始计时时间
 
 #法宝
 Def_PDict_MagicWeaponExp = "MagicWeaponExp_%s" #法宝经验 参数法宝ID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index b360230..910c6f7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -10981,58 +10981,6 @@
 
 
 #------------------------------------------------------
-# A5 0C 使用道具减少渡劫打坐时间 #tagCMReduceSitTime
-
-class  tagCMReduceSitTime(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("ItemCnt", c_ushort),    # 道具数量
-                  ]
-
-    def __init__(self):
-        self.Clear()
-        self.Cmd = 0xA5
-        self.SubCmd = 0x0C
-        return
-
-    def ReadData(self, stringData, _pos=0, _len=0):
-        self.Clear()
-        memmove(addressof(self), stringData[_pos:], self.GetLength())
-        return _pos + self.GetLength()
-
-    def Clear(self):
-        self.Cmd = 0xA5
-        self.SubCmd = 0x0C
-        self.ItemCnt = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagCMReduceSitTime)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// A5 0C 使用道具减少渡劫打坐时间 //tagCMReduceSitTime:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                ItemCnt:%d
-                                '''\
-                                %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.ItemCnt
-                                )
-        return DumpString
-
-
-m_NAtagCMReduceSitTime=tagCMReduceSitTime()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMReduceSitTime.Cmd,m_NAtagCMReduceSitTime.SubCmd))] = m_NAtagCMReduceSitTime
-
-
-#------------------------------------------------------
 # A5 74 刷新悬赏任务 #tagCMRefreshArrestTask
 
 class  tagCMRefreshArrestTask(Structure):
@@ -11606,6 +11554,54 @@
 
 
 #------------------------------------------------------
+# A5 21 境界修为池提取 #tagCMTakeOutRealmExp
+
+class  tagCMTakeOutRealmExp(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA5
+        self.SubCmd = 0x21
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA5
+        self.SubCmd = 0x21
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMTakeOutRealmExp)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A5 21 境界修为池提取 //tagCMTakeOutRealmExp:
+                                Cmd:%s,
+                                SubCmd:%s
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd
+                                )
+        return DumpString
+
+
+m_NAtagCMTakeOutRealmExp=tagCMTakeOutRealmExp()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMTakeOutRealmExp.Cmd,m_NAtagCMTakeOutRealmExp.SubCmd))] = m_NAtagCMTakeOutRealmExp
+
+
+#------------------------------------------------------
 # A5 11 试用首充武器 #tagCMTryFirstGoldItem
 
 class  tagCMTryFirstGoldItem(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 2ca66e3..1bae020 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -16583,6 +16583,66 @@
 
 
 #------------------------------------------------------
+# A3 27 境界修为池信息 #tagMCRealmExpInfo
+
+class  tagMCRealmExpInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("BeginTime", c_int),    #开始计时时间
+                  ("CurExp", c_int),    #当前总经验
+                  ("CurExpPoint", c_int),    #当前总经验点
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA3
+        self.SubCmd = 0x27
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA3
+        self.SubCmd = 0x27
+        self.BeginTime = 0
+        self.CurExp = 0
+        self.CurExpPoint = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCRealmExpInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 27 境界修为池信息 //tagMCRealmExpInfo:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                BeginTime:%d,
+                                CurExp:%d,
+                                CurExpPoint:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.BeginTime,
+                                self.CurExp,
+                                self.CurExpPoint
+                                )
+        return DumpString
+
+
+m_NAtagMCRealmExpInfo=tagMCRealmExpInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCRealmExpInfo.Cmd,m_NAtagMCRealmExpInfo.SubCmd))] = m_NAtagMCRealmExpInfo
+
+
+#------------------------------------------------------
 # A3 49 资源找回次数 #tagMCRecoverNum
 
 class  tagMCRecoverNumInfo(Structure):
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
new file mode 100644
index 0000000..d90ea4c
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/GetRealmExp.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.GetRealmExp
+#
+# @todo:获取当前境界修为经验
+# @author xdh
+# @date 2019-03-20
+# @version 1.0
+#
+# 详细描述: 获取当前境界修为经验
+#
+#---------------------------------------------------------------------
+"""Version = 2019-03-20 11:30"""
+
+import PlayerPrestigeSys
+import GameWorld
+#---------------------------------------------------------------------
+#逻辑实现
+## GM命令执行入口
+#  @param curPlayer 当前玩家
+#  @param list 参数列表 [npcID]
+#  @return None
+#  @remarks 函数详细说明.
+def OnExec(curPlayer, list):
+    curTotalRealmExp = PlayerPrestigeSys.UpdateRealmExp(curPlayer, isNotify=True)
+    GameWorld.DebugAnswer(curPlayer, "curTotalRealmExp=%s" % curTotalRealmExp)
+    return
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index b4436fa..b623313 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -50,6 +50,8 @@
                         ("list", "AddAttrNum", 0),
                         ("DWORD", "BossID", 0),
                         ("DWORD", "BuffID", 0),
+                        ("DWORD", "ExpRate", 0),
+                        ("DWORD", "ExpLimit", 0),
                         ),
 
                 "GodWeapon":(
@@ -1442,7 +1444,9 @@
         self.AddAttrType = []
         self.AddAttrNum = []
         self.BossID = 0
-        self.BuffID = 0
+        self.BuffID = 0
+        self.ExpRate = 0
+        self.ExpLimit = 0
         return
         
     def GetLv(self): return self.Lv # 境界等级
@@ -1452,7 +1456,9 @@
     def GetAddAttrType(self): return self.AddAttrType # 境界加成属性类型
     def GetAddAttrNum(self): return self.AddAttrNum # 境界加成属性值
     def GetBossID(self): return self.BossID # 渡劫bossid
-    def GetBuffID(self): return self.BuffID # 给全服在线玩家增加buff
+    def GetBuffID(self): return self.BuffID # 给全服在线玩家增加buff
+    def GetExpRate(self): return self.ExpRate # 修为池经验速率
+    def GetExpLimit(self): return self.ExpLimit # 修为池经验上限
 
 # 神兵表
 class IPY_GodWeapon():
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 fb88005..26948e1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
@@ -31,6 +31,7 @@
 import EventShell
 import DataRecordPack
 
+import time
 #------------------------------------------------------------------------------
 
 
@@ -41,11 +42,15 @@
 #        DoRealmLVUpLogic(curPlayer)
     return True
 
+
 def OnLogin(curPlayer):        
     SyncRealmFBState(curPlayer)
+    UpdateRealmExp(curPlayer)
     return
 
+
 def GetRealmIpyData(realmLV): return IpyGameDataPY.GetIpyGameData("Realm", realmLV)
+
 
 #// A5 24 开启渡劫 #tagCMOpenRealmFB
 #
@@ -65,6 +70,7 @@
     sendPack.IsPass = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmFBIsOpen)
     NetPackCommon.SendFakePack(curPlayer, sendPack)
     return
+
 
 ## 计算爵位属性
 #  @param curPlayer 玩家
@@ -99,6 +105,7 @@
     PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
     return
 
+
 #// A5 23 提升境界等级 # tagCMRealmLVUp
 #
 #struct    tagCMRealmLVUp
@@ -132,14 +139,14 @@
         #扣除物品
         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
@@ -158,6 +165,8 @@
     RefreshOfficialAttr(curPlayer)
     GameFuncComm.DoFuncOpenLogic(curPlayer)
     SyncRealmFBState(curPlayer)
+    #更新修为速率
+    UpdateRealmExp(curPlayer)
     #境界提升成就
     PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RealmlvUp, nextRealmLv)
     #更新排行榜
@@ -169,6 +178,7 @@
     DataRecordPack.DR_RealmLVUp(curPlayer, nextRealmLv)
     return True
 
+
 def DologicDujieFBPass(curPlayer, realmLV, star):
     #渡劫通过后处理
     realmIpyData = GetRealmIpyData(realmLV)
@@ -177,48 +187,78 @@
     #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 / 5 * 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
+

--
Gitblit v1.8.0