From a7d7f981e369d1ae27410f1fe1aaaeb34c21ea3b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期日, 09 十月 2022 18:32:35 +0800
Subject: [PATCH] 9455 【越南】【后端】通天令

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyBoss.py       |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py                    |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py                               |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDiceEx.py                                 |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                                     |  277 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyInvade.py     |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py      |    5 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py                    |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py     |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTongTianLing.py                           |  375 ++++++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                                          |  277 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py                           |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py                    |    3 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSignDay.py                                |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Love.py             |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                                                 |   24 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py                                       |   58 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                                     |    3 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py                                       |    5 
 PySysDB/PySysDBPY.h                                                                                                        |   22 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ElderBattlefield.py |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TTL.py                                     |  105 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py                           |    3 
 23 files changed, 1,177 insertions(+), 2 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 1184158..ad2f541 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -853,6 +853,28 @@
 	DWORD		MagicWeaponExp;	//法宝升级经验
 };
 
+//通天令等级表
+
+struct tagTongTianLV
+{
+	WORD		_TTLV;	//通天令等级
+	WORD		LVUPPoint;	//升级所需积分(0不可升级)
+	list		CommAwardItemList;	//常规奖励物品列表 [[物品ID,个数,是否拍品], ...]
+	list		XianAwardItemList;	//仙品奖励物品列表 [[物品ID,个数,是否拍品], ...]
+	list		NotifyItemIDList;	//需要广播的物品ID列表
+};
+
+//通天令任务表
+
+struct tagTongTianTask
+{
+	WORD		_TTTaskID;	//通天任务ID(确定后不可修改)
+	BYTE		TTTaskType;	//通天任务类型
+	BYTE		IsDailyTask;	//是否每日任务
+	DWORD		FinishNeedValue;	//任务完成所需值
+	DWORD		TaskPoint;	//任务积分点奖励
+};
+
 //法宝表
 
 struct tagTreasure
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 934c504..0eb8646 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -23476,6 +23476,283 @@
 
 
 #------------------------------------------------------
+# A3 56 通天令信息 #tagMCTongTianLingInfo
+
+class  tagMCTongTianLingInfo(Structure):
+    Head = tagHead()
+    TTLBuyState = 0    #(BYTE TTLBuyState)//通天令是否已购买
+    TTLLV = 0    #(BYTE TTLLV)//通天令等级,从0开始
+    CurPoint = 0    #(DWORD CurPoint)//通天令当前等级经验积分点
+    AwardStateCount = 0    #(BYTE AwardStateCount)//等级领奖记录值数,每个值存31个记录   0-30, 31-61, ...
+    CommAwardStateList = list()    #(vector<DWORD> CommAwardStateList)//常规奖励领奖记录,按等级二进制位存储是否领奖
+    XianAwardStateList = list()    #(vector<DWORD> XianAwardStateList)//仙品奖励领奖记录,按等级二进制位存储是否领奖
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x56
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.TTLBuyState,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.TTLLV,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.CurPoint,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.AwardStateCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.AwardStateCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.CommAwardStateList.append(value)
+        for i in range(self.AwardStateCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.XianAwardStateList.append(value)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x56
+        self.TTLBuyState = 0
+        self.TTLLV = 0
+        self.CurPoint = 0
+        self.AwardStateCount = 0
+        self.CommAwardStateList = list()
+        self.XianAwardStateList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += 1
+        length += 4
+        length += 1
+        length += 4 * self.AwardStateCount
+        length += 4 * self.AwardStateCount
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.TTLBuyState)
+        data = CommFunc.WriteBYTE(data, self.TTLLV)
+        data = CommFunc.WriteDWORD(data, self.CurPoint)
+        data = CommFunc.WriteBYTE(data, self.AwardStateCount)
+        for i in range(self.AwardStateCount):
+            data = CommFunc.WriteDWORD(data, self.CommAwardStateList[i])
+        for i in range(self.AwardStateCount):
+            data = CommFunc.WriteDWORD(data, self.XianAwardStateList[i])
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                TTLBuyState:%d,
+                                TTLLV:%d,
+                                CurPoint:%d,
+                                AwardStateCount:%d,
+                                CommAwardStateList:%s,
+                                XianAwardStateList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.TTLBuyState,
+                                self.TTLLV,
+                                self.CurPoint,
+                                self.AwardStateCount,
+                                "...",
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCTongTianLingInfo=tagMCTongTianLingInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTongTianLingInfo.Head.Cmd,m_NAtagMCTongTianLingInfo.Head.SubCmd))] = m_NAtagMCTongTianLingInfo
+
+
+#------------------------------------------------------
+# A3 58 通天令任务奖励信息 #tagMCTongTianLingTaskAwardInfo
+
+class  tagMCTongTianLingTaskAwardInfo(Structure):
+    Head = tagHead()
+    AwardStateCount = 0    #(BYTE AwardStateCount)
+    TaskAwardStateList = list()    #(vector<DWORD> TaskAwardStateList)//任务领奖记录值个数,按任务ID二进制位存储是否已领取,每个值存31个记录   0-30, 31-61, ...
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x58
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.AwardStateCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.AwardStateCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.TaskAwardStateList.append(value)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x58
+        self.AwardStateCount = 0
+        self.TaskAwardStateList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += 4 * self.AwardStateCount
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.AwardStateCount)
+        for i in range(self.AwardStateCount):
+            data = CommFunc.WriteDWORD(data, self.TaskAwardStateList[i])
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                AwardStateCount:%d,
+                                TaskAwardStateList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.AwardStateCount,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCTongTianLingTaskAwardInfo=tagMCTongTianLingTaskAwardInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTongTianLingTaskAwardInfo.Head.Cmd,m_NAtagMCTongTianLingTaskAwardInfo.Head.SubCmd))] = m_NAtagMCTongTianLingTaskAwardInfo
+
+
+#------------------------------------------------------
+# A3 57 通天令任务进度信息 #tagMCTongTianLingTaskValueInfo
+
+class  tagMCTongTianLingTaskValue(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("TaskType", c_ubyte),    #成就类型
+                  ("IsDaily", c_ubyte),    #是否每日任务
+                  ("TaskValue", c_int),    #当前完成进度值
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        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.TaskType = 0
+        self.IsDaily = 0
+        self.TaskValue = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCTongTianLingTaskValue)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 57 通天令任务进度信息 //tagMCTongTianLingTaskValueInfo:
+                                TaskType:%d,
+                                IsDaily:%d,
+                                TaskValue:%d
+                                '''\
+                                %(
+                                self.TaskType,
+                                self.IsDaily,
+                                self.TaskValue
+                                )
+        return DumpString
+
+
+class  tagMCTongTianLingTaskValueInfo(Structure):
+    Head = tagHead()
+    Count = 0    #(BYTE Count)//信息个数
+    TaskValueList = list()    #(vector<tagMCTongTianLingTaskValue> TaskValueList)
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x57
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.Count):
+            temTaskValueList = tagMCTongTianLingTaskValue()
+            _pos = temTaskValueList.ReadData(_lpData, _pos)
+            self.TaskValueList.append(temTaskValueList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x57
+        self.Count = 0
+        self.TaskValueList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.Count):
+            length += self.TaskValueList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.Count)
+        for i in range(self.Count):
+            data = CommFunc.WriteString(data, self.TaskValueList[i].GetLength(), self.TaskValueList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Count:%d,
+                                TaskValueList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Count,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCTongTianLingTaskValueInfo=tagMCTongTianLingTaskValueInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTongTianLingTaskValueInfo.Head.Cmd,m_NAtagMCTongTianLingTaskValueInfo.Head.SubCmd))] = m_NAtagMCTongTianLingTaskValueInfo
+
+
+#------------------------------------------------------
 #A3 01 坐骑培养信息 #tagTrainHorseData
 
 class  tagTrainHorseData(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index a203507..ecea2eb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -819,6 +819,30 @@
 PacketSubCMD_1=0x42
 PacketCallFunc_1=OnGetSuccessAward
 
+;通天令
+[PlayerTongTianLing]
+ScriptName = Player\PlayerTongTianLing
+Writer = hxp
+Releaser = hxp
+RegType = 0
+RegisterPackCount = 4
+
+PacketCMD_1=0xA5
+PacketSubCMD_1=0x43
+PacketCallFunc_1=OnGetTongTianTaskAward
+
+PacketCMD_2=0xA5
+PacketSubCMD_2=0x44
+PacketCallFunc_2=OnGetTongTianLVAward
+
+PacketCMD_3=0xA5
+PacketSubCMD_3=0x45
+PacketCallFunc_3=OnExchangeTongTianLVPoint
+
+PacketCMD_4=0xA5
+PacketSubCMD_4=0x46
+PacketCallFunc_4=OnBuyTongTianLing
+
 ;大师天赋
 [PlayerGreatMaster]
 ScriptName = Player\PlayerGreatMaster.py
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 934c504..0eb8646 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -23476,6 +23476,283 @@
 
 
 #------------------------------------------------------
+# A3 56 通天令信息 #tagMCTongTianLingInfo
+
+class  tagMCTongTianLingInfo(Structure):
+    Head = tagHead()
+    TTLBuyState = 0    #(BYTE TTLBuyState)//通天令是否已购买
+    TTLLV = 0    #(BYTE TTLLV)//通天令等级,从0开始
+    CurPoint = 0    #(DWORD CurPoint)//通天令当前等级经验积分点
+    AwardStateCount = 0    #(BYTE AwardStateCount)//等级领奖记录值数,每个值存31个记录   0-30, 31-61, ...
+    CommAwardStateList = list()    #(vector<DWORD> CommAwardStateList)//常规奖励领奖记录,按等级二进制位存储是否领奖
+    XianAwardStateList = list()    #(vector<DWORD> XianAwardStateList)//仙品奖励领奖记录,按等级二进制位存储是否领奖
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x56
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.TTLBuyState,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.TTLLV,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.CurPoint,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.AwardStateCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.AwardStateCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.CommAwardStateList.append(value)
+        for i in range(self.AwardStateCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.XianAwardStateList.append(value)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x56
+        self.TTLBuyState = 0
+        self.TTLLV = 0
+        self.CurPoint = 0
+        self.AwardStateCount = 0
+        self.CommAwardStateList = list()
+        self.XianAwardStateList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += 1
+        length += 4
+        length += 1
+        length += 4 * self.AwardStateCount
+        length += 4 * self.AwardStateCount
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.TTLBuyState)
+        data = CommFunc.WriteBYTE(data, self.TTLLV)
+        data = CommFunc.WriteDWORD(data, self.CurPoint)
+        data = CommFunc.WriteBYTE(data, self.AwardStateCount)
+        for i in range(self.AwardStateCount):
+            data = CommFunc.WriteDWORD(data, self.CommAwardStateList[i])
+        for i in range(self.AwardStateCount):
+            data = CommFunc.WriteDWORD(data, self.XianAwardStateList[i])
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                TTLBuyState:%d,
+                                TTLLV:%d,
+                                CurPoint:%d,
+                                AwardStateCount:%d,
+                                CommAwardStateList:%s,
+                                XianAwardStateList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.TTLBuyState,
+                                self.TTLLV,
+                                self.CurPoint,
+                                self.AwardStateCount,
+                                "...",
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCTongTianLingInfo=tagMCTongTianLingInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTongTianLingInfo.Head.Cmd,m_NAtagMCTongTianLingInfo.Head.SubCmd))] = m_NAtagMCTongTianLingInfo
+
+
+#------------------------------------------------------
+# A3 58 通天令任务奖励信息 #tagMCTongTianLingTaskAwardInfo
+
+class  tagMCTongTianLingTaskAwardInfo(Structure):
+    Head = tagHead()
+    AwardStateCount = 0    #(BYTE AwardStateCount)
+    TaskAwardStateList = list()    #(vector<DWORD> TaskAwardStateList)//任务领奖记录值个数,按任务ID二进制位存储是否已领取,每个值存31个记录   0-30, 31-61, ...
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x58
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.AwardStateCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.AwardStateCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.TaskAwardStateList.append(value)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x58
+        self.AwardStateCount = 0
+        self.TaskAwardStateList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += 4 * self.AwardStateCount
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.AwardStateCount)
+        for i in range(self.AwardStateCount):
+            data = CommFunc.WriteDWORD(data, self.TaskAwardStateList[i])
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                AwardStateCount:%d,
+                                TaskAwardStateList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.AwardStateCount,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCTongTianLingTaskAwardInfo=tagMCTongTianLingTaskAwardInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTongTianLingTaskAwardInfo.Head.Cmd,m_NAtagMCTongTianLingTaskAwardInfo.Head.SubCmd))] = m_NAtagMCTongTianLingTaskAwardInfo
+
+
+#------------------------------------------------------
+# A3 57 通天令任务进度信息 #tagMCTongTianLingTaskValueInfo
+
+class  tagMCTongTianLingTaskValue(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("TaskType", c_ubyte),    #成就类型
+                  ("IsDaily", c_ubyte),    #是否每日任务
+                  ("TaskValue", c_int),    #当前完成进度值
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        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.TaskType = 0
+        self.IsDaily = 0
+        self.TaskValue = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCTongTianLingTaskValue)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 57 通天令任务进度信息 //tagMCTongTianLingTaskValueInfo:
+                                TaskType:%d,
+                                IsDaily:%d,
+                                TaskValue:%d
+                                '''\
+                                %(
+                                self.TaskType,
+                                self.IsDaily,
+                                self.TaskValue
+                                )
+        return DumpString
+
+
+class  tagMCTongTianLingTaskValueInfo(Structure):
+    Head = tagHead()
+    Count = 0    #(BYTE Count)//信息个数
+    TaskValueList = list()    #(vector<tagMCTongTianLingTaskValue> TaskValueList)
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x57
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.Count):
+            temTaskValueList = tagMCTongTianLingTaskValue()
+            _pos = temTaskValueList.ReadData(_lpData, _pos)
+            self.TaskValueList.append(temTaskValueList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x57
+        self.Count = 0
+        self.TaskValueList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.Count):
+            length += self.TaskValueList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.Count)
+        for i in range(self.Count):
+            data = CommFunc.WriteString(data, self.TaskValueList[i].GetLength(), self.TaskValueList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Count:%d,
+                                TaskValueList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Count,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCTongTianLingTaskValueInfo=tagMCTongTianLingTaskValueInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTongTianLingTaskValueInfo.Head.Cmd,m_NAtagMCTongTianLingTaskValueInfo.Head.SubCmd))] = m_NAtagMCTongTianLingTaskValueInfo
+
+
+#------------------------------------------------------
 #A3 01 坐骑培养信息 #tagTrainHorseData
 
 class  tagTrainHorseData(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py
index 5a888a9..ee209c0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py
@@ -37,6 +37,7 @@
 import NetPackCommon
 import PlayerWeekParty
 import PlayerActGarbageSorting
+import PlayerTongTianLing
 #-------------------------------------------------------------------------------------------
 
 #===============================================================================
@@ -156,6 +157,7 @@
     PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_EquipPlus)
     PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipPlus, 1)
     PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Plus, 1)
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_Plus, 1)
     return
 
 def __EquipMayaPlusChange(curPlayer, packType, curEquip, index, updPlusLV):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py
index 24ea1be..7df697b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py
@@ -23,6 +23,7 @@
 import IPY_GameWorld
 import DataRecordPack
 import PlayerAuctionHouse
+import PlayerTongTianLing
 import PlayerWeekParty
 import IpyGameDataPY
 import PlayerSuccess
@@ -175,6 +176,8 @@
     curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitEquipStarUp, result)
     DataRecordPack.SendEventPack("EquipStarUp", drDict, curPlayer)
     
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_Star, 1)
+    
     if not isOK:
         return
         
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
index 65af626..6b8aa6a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
@@ -22,6 +22,7 @@
 import PlayerControl
 import PlayerSuccess
 import IPY_GameWorld
+import PlayerTongTianLing
 import PlayerActGarbageSorting
 import DataRecordPack
 import PlayerActLogin
@@ -297,6 +298,7 @@
         RefreshEquipWashAttr(curPlayer, classLV)
     PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipWash, 1)
     PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_EquipWash)
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_Wash, 1)
     return
 
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TTL.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TTL.py
new file mode 100644
index 0000000..f222612
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TTL.py
@@ -0,0 +1,105 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.TTL
+#
+# @todo:通天令
+# @author hxp
+# @date 2022-01-17
+# @version 1.0
+#
+# 详细描述: 通天令
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2022-01-17 19:00"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import PlayerControl
+import PlayerTongTianLing
+import IpyGameDataPY
+import ChConfig
+
+#---------------------------------------------------------------------
+#逻辑实现
+## GM命令执行入口
+#  @param curPlayer 当前玩家
+#  @param paramList 参数列表
+#  @return None
+#  @remarks 函数详细说明.
+def OnExec(curPlayer, paramList):
+    
+    if not paramList:
+        GameWorld.DebugAnswer(curPlayer, "重置通天所有: TTL 0")
+        GameWorld.DebugAnswer(curPlayer, "重置通天等级: TTL 0 1")
+        GameWorld.DebugAnswer(curPlayer, "重置通天任务: TTL 0 2")
+        GameWorld.DebugAnswer(curPlayer, "设置通天等级: TTL 1 等级 经验 是否激活通天令")
+        GameWorld.DebugAnswer(curPlayer, "增加通天任务: TTL 2 任务类型 增加进度值")
+        return
+    
+    value = paramList[0]
+    if not value:
+        value1 = paramList[1] if len(paramList) > 1 else 0
+        if value1 == 1:
+            resetTTLV(curPlayer)
+            GameWorld.DebugAnswer(curPlayer, "重置通天等级OK!")
+        elif value1 == 2:
+            resetTTTask(curPlayer)
+            GameWorld.DebugAnswer(curPlayer, "重置通天任务OK!")
+        else:
+            resetTTLV(curPlayer)
+            resetTTTask(curPlayer)
+            GameWorld.DebugAnswer(curPlayer, "重置通天所有OK!")
+            
+        return
+    
+    if value == 1:
+        ttLV, ttState = PlayerTongTianLing.GetTongTianLingLVInfo(curPlayer)
+        ttLV = paramList[1] if len(paramList) > 1 else ttLV
+        setPoint = paramList[2] if len(paramList) > 2 else 0
+        setState = paramList[3] if len(paramList) > 3 else ttState
+        
+        ttLV = min(ttLV, IpyGameDataPY.IPY_Data().GetTongTianLVCount() - 1)
+        ttState = 1 if setState else 0
+        PlayerTongTianLing.SetTongTianLingLVInfo(curPlayer, ttLV, ttState)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, setPoint)
+        GameWorld.DebugAnswer(curPlayer, "设置通天等级: LV=%s,expPoint=%s,state=%s" % (ttLV, setPoint, ttState))
+        PlayerTongTianLing.SyncTongTianLVInfo(curPlayer)
+        
+    elif value == 2:
+        ttTaskType = paramList[1] if len(paramList) > 1 else 0
+        addValue = paramList[2] if len(paramList) > 2 else 0
+        GameWorld.DebugAnswer(curPlayer, "增加通天任务进度: taskType=%s,addVlue=%s" % (ttTaskType, addValue))
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ttTaskType, addValue)
+        
+    return
+
+def resetTTTask(curPlayer):
+    
+    for i in xrange(10):
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord % i, 0)
+        
+    syncTaskInfoList = []
+    for ttTaskType in ChConfig.TTLTaskTypeList:
+        for isDailyTask in [0, 1]:
+            curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
+            if not curValue:
+                continue
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), 0)
+            syncTaskInfoList.append([ttTaskType, isDailyTask])
+    PlayerTongTianLing.SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
+    PlayerTongTianLing.SyncTongTianTaskAward(curPlayer)
+    return
+
+def resetTTLV(curPlayer):
+    for i in xrange(10):
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord % i, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord % i, 0)
+    PlayerTongTianLing.SetTongTianLingLVInfo(curPlayer, 0, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, 0)
+    PlayerTongTianLing.SyncTongTianLVInfo(curPlayer)
+    return
+
+
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ElderBattlefield.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ElderBattlefield.py
index 44dec7b..2c27930 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ElderBattlefield.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ElderBattlefield.py
@@ -36,6 +36,7 @@
 import EventReport
 import SkillCommon
 import PlayerWeekParty
+import PlayerTongTianLing
 
 import random
 import time
@@ -172,6 +173,7 @@
             GameWorld.GetGameWorld().SetGameWorldDict(FBPlayerDict_TotalExpPoint % playerID, 0)
             EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_ElderBattlefield, 0, ChConfig.CME_Log_Start)
             PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_ElderBattlefield, 1)
+            PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_ElderBattlefield, 1)
     else:
         rebornBuffLV = GameWorld.GetGameFB().GetPlayerGameFBDictByKey(playerID, FBPlayerDict_RebornBuffLV)
         __DoAddRebornBuff(curPlayer, rebornBuffLV, tick)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyBoss.py
index 44b0231..bdfd07b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyBoss.py
@@ -21,6 +21,7 @@
 import IPY_GameWorld
 import PlayerControl
 import GameWorld
+import PlayerTongTianLing
 import NPCCustomRefresh
 import IpyGameDataPY
 import PlayerFamily
@@ -80,6 +81,7 @@
     PyGameData.g_familyBossPlayer[familyID] = familyPlayerList
     GameWorld.DebugLog("仙盟参与玩家: %s" % PyGameData.g_familyBossPlayer)
     EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_FamilyBossMap, openCount, ChConfig.CME_Log_Start)
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_FamilyBoss, 1)
     return
 
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyInvade.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyInvade.py
index 0b5054c..f36a3a9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyInvade.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyInvade.py
@@ -32,6 +32,7 @@
 import SkillCommon
 import BuffSkill
 import PlayerFamily
+import PlayerTongTianLing
 
 Map_FamilyInvadeFB_FamilyID = "FamilyPartyFB_FamilyID"     # 对应的家族id
 Map_FamilyInvadeFB_KillNPCCnt = "FamilyInvadeFB_KillNPCCnt"     # 已击杀数量
@@ -175,6 +176,7 @@
         FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_FamilyInvade)
         EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_FamilyInvade, 0, ChConfig.CME_Log_Start)
         PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_SWRH, 1)
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_SWRH, 1)
         if familyID in PyGameData.g_swrhPlayerIDDict:
             if playerID not in PyGameData.g_swrhPlayerIDDict[familyID]:
                 PyGameData.g_swrhPlayerIDDict[familyID].append(playerID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py
index 4850e89..4815f80 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py
@@ -36,6 +36,7 @@
 import PlayerTalk
 import PlayerActivity
 import PlayerWeekParty
+import PlayerTongTianLing
 
 #---战盟副本---
 FBPlayerDict_TagPlayerID = 'XMYH_TagPlayerID%s'  # 邀请传功目标玩家ID
@@ -226,7 +227,8 @@
     PlayerControl.PlayerControl(curPlayer).AddExp(addExp, ShareDefine.Def_ViewExpType_SysEx)
     PlayerControl.FamilyNotify(curPlayer.GetFamilyID(), 'Party_Answer', [curPlayer.GetName(), rightItemID])
     curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, curAnswerCnt + 1)    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, curAnswerCnt + 1)
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_FamilyPartyAnswerRight, 1)
     
     if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_FamilyParty:
         DoFBHelp(curPlayer, 0)
@@ -466,6 +468,7 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartySitState, 1)
     PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyChuanGong)
     PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_FamilyChuanGong, 1)
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_ChuanGong, 1)
     DoFBHelp(curPlayer, 0)
     
     #帮助传功奖励
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
index b98b449..e4011c0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
@@ -31,6 +31,7 @@
 import NPCCommon
 import GameObj
 import EventShell
+import PlayerTongTianLing
 
 FBPlayerDict_EncourageLV = 'FBPlayerDict_EncourageLV'   # 鼓舞等级
 FBDict_IsOver = 'FBDict_IsOver' #是否已结算, 结算时的tick
@@ -146,6 +147,7 @@
         FBCommon.SetHadDelTicket(curPlayer)
         PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_HorsePetBoss, 1)
         PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_HorsePetBoss, 1)
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_HorsePetBoss, 1)
         EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_HorsePetBoss, 0, ChConfig.CME_Log_Start)
         EventShell.EventRespons_HorsePetBoss(curPlayer)
         if fbStep == FB_Step_Open:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Love.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Love.py
index aa4e5ea..1148db7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Love.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Love.py
@@ -26,6 +26,7 @@
 import PyGameData
 import GameWorld
 import ChConfig
+import PlayerTongTianLing
 
 (
 Def_Time_MapPrepare, # 准备时间, 秒
@@ -99,6 +100,7 @@
         FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_Love)
         PyGameData.g_fbPickUpItemDict.pop(playerID, 0)
         gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_EnterState, 1)
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_LoveFB, 1)
         
     if fbStep == FB_Step_Open:
         FBCommon.SetFBStep(FB_Step_MapPrepare, tick)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 232fb51..5d2ddde 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -714,6 +714,22 @@
                         ("DWORD", "MagicWeaponExp", 0),
                         ),
 
+                "TongTianLV":(
+                        ("WORD", "TTLV", 1),
+                        ("WORD", "LVUPPoint", 0),
+                        ("list", "CommAwardItemList", 0),
+                        ("list", "XianAwardItemList", 0),
+                        ("list", "NotifyItemIDList", 0),
+                        ),
+
+                "TongTianTask":(
+                        ("WORD", "TTTaskID", 1),
+                        ("BYTE", "TTTaskType", 0),
+                        ("BYTE", "IsDailyTask", 0),
+                        ("DWORD", "FinishNeedValue", 0),
+                        ("DWORD", "TaskPoint", 0),
+                        ),
+
                 "Treasure":(
                         ("DWORD", "ID", 1),
                         ("BYTE", "TreasureType", 0),
@@ -3414,6 +3430,40 @@
     def GetRedPacketID(self): return self.RedPacketID # 红包ID
     def GetMagicWeaponID(self): return self.MagicWeaponID # 法宝ID
     def GetMagicWeaponExp(self): return self.MagicWeaponExp # 法宝升级经验
+
+# 通天令等级表
+class IPY_TongTianLV():
+    
+    def __init__(self):
+        self.TTLV = 0
+        self.LVUPPoint = 0
+        self.CommAwardItemList = []
+        self.XianAwardItemList = []
+        self.NotifyItemIDList = []
+        return
+        
+    def GetTTLV(self): return self.TTLV # 通天令等级
+    def GetLVUPPoint(self): return self.LVUPPoint # 升级所需积分(0不可升级)
+    def GetCommAwardItemList(self): return self.CommAwardItemList # 常规奖励物品列表 [[物品ID,个数,是否拍品], ...]
+    def GetXianAwardItemList(self): return self.XianAwardItemList # 仙品奖励物品列表 [[物品ID,个数,是否拍品], ...]
+    def GetNotifyItemIDList(self): return self.NotifyItemIDList # 需要广播的物品ID列表
+
+# 通天令任务表
+class IPY_TongTianTask():
+    
+    def __init__(self):
+        self.TTTaskID = 0
+        self.TTTaskType = 0
+        self.IsDailyTask = 0
+        self.FinishNeedValue = 0
+        self.TaskPoint = 0
+        return
+        
+    def GetTTTaskID(self): return self.TTTaskID # 通天任务ID(确定后不可修改)
+    def GetTTTaskType(self): return self.TTTaskType # 通天任务类型
+    def GetIsDailyTask(self): return self.IsDailyTask # 是否每日任务
+    def GetFinishNeedValue(self): return self.FinishNeedValue # 任务完成所需值
+    def GetTaskPoint(self): return self.TaskPoint # 任务积分点奖励
 
 # 法宝表
 class IPY_Treasure():
@@ -6256,6 +6306,10 @@
         self.ipyEquipGSParamLen = len(self.ipyEquipGSParamCache)
         self.ipySuccessCache = self.__LoadFileData("Success", IPY_Success)
         self.ipySuccessLen = len(self.ipySuccessCache)
+        self.ipyTongTianLVCache = self.__LoadFileData("TongTianLV", IPY_TongTianLV)
+        self.ipyTongTianLVLen = len(self.ipyTongTianLVCache)
+        self.ipyTongTianTaskCache = self.__LoadFileData("TongTianTask", IPY_TongTianTask)
+        self.ipyTongTianTaskLen = len(self.ipyTongTianTaskCache)
         self.ipyTreasureCache = self.__LoadFileData("Treasure", IPY_Treasure)
         self.ipyTreasureLen = len(self.ipyTreasureCache)
         self.ipyTreasureUpCache = self.__LoadFileData("TreasureUp", IPY_TreasureUp)
@@ -6826,6 +6880,10 @@
     def GetEquipGSParamByIndex(self, index): return self.ipyEquipGSParamCache[index]
     def GetSuccessCount(self): return self.ipySuccessLen
     def GetSuccessByIndex(self, index): return self.ipySuccessCache[index]
+    def GetTongTianLVCount(self): return self.ipyTongTianLVLen
+    def GetTongTianLVByIndex(self, index): return self.ipyTongTianLVCache[index]
+    def GetTongTianTaskCount(self): return self.ipyTongTianTaskLen
+    def GetTongTianTaskByIndex(self, index): return self.ipyTongTianTaskCache[index]
     def GetTreasureCount(self): return self.ipyTreasureLen
     def GetTreasureByIndex(self, index): return self.ipyTreasureCache[index]
     def GetTreasureUpCount(self): return self.ipyTreasureUpLen
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index e239ee3..69cc807 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -54,6 +54,7 @@
 import PlayerNewFairyCeremony
 import GameLogic_CrossGrassland
 import PlayerActGarbageSorting
+import PlayerTongTianLing
 import CrossPlayerData
 import PlayerFeastWish
 import PlayerFeastTravel
@@ -2483,7 +2484,8 @@
         PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_WorldBOSS, 1)
         PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_WorldBoss, 1)
         PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_WorldBOSS, 1)
-
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_WorldBoss, 1)
+        
     elif limitIndex == ShareDefine.Def_Boss_Func_Home:
         #BOSS之家
         # BOSS之家BOSS击杀成就
@@ -2505,6 +2507,7 @@
         
     if mapID in [ChConfig.Def_FBMapID_CrossPenglai, ChConfig.Def_FBMapID_CrossDemonLand]:
         PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_CrossBoss)
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_CrossBoss, 1)
     else:
         PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_KillBoss)
         
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index cf80f03..9a22f95 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -125,6 +125,7 @@
 import CrossActCTGBillboard
 import PlayerFuncSysPrivilege
 import PlayerActTurntable
+import PlayerTongTianLing
 import CrossRealmPlayer
 import ChNetSendPack
 import FamilyRobBoss
@@ -848,6 +849,8 @@
     SkillShell.NotifyElementSkillInfo(curPlayer)
     #Boss首杀
     GY_Query_BossFirstKill.OnPlayerLogin(curPlayer)
+    #通天令
+    PlayerTongTianLing.OnPlayerLogin(curPlayer)
     #创角奖励
     Sync_CreateRoleAwardInfo(curPlayer)
     #功能系统特权
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
index 4c36b38..635d239 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -37,6 +37,7 @@
 import FormulaControl
 import PlayerBossReborn
 import PlayerActGarbageSorting
+import PlayerTongTianLing
 
 #关联类型
 (
@@ -309,6 +310,7 @@
     __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, curTotalPoint + addValue)
     __AddCanCostActivityPoint(curPlayer, addValue, isLVUp)
     PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_Activity, addValue)
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_Activity, addValue)
     PlayerControl.NotifyCode(curPlayer, "GetActivity", [addValue])
     SyncDailyActivityInfo(curPlayer)
     EventShell.EventRespons_AddActivityValue(curPlayer)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
index 5bcf74b..867631e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -22,6 +22,7 @@
 import PlayerActivity
 import ChPyNetSendPack
 import CrossRealmPlayer
+import PlayerTongTianLing
 import FunctionNPCCommon
 import PlayerActGarbageSorting
 import DataRecordPack
@@ -366,6 +367,7 @@
         PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_CrossPK, 1)
         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_CrossPK, 1)
         PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_CrossPK)
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_CrossPK, 1)
     else:
         GameWorld.Log("    不同天的PK结算不增加今日PK次数! ", playerID)
         
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDiceEx.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDiceEx.py
index e53692f..1b81d09 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDiceEx.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDiceEx.py
@@ -28,6 +28,7 @@
 import PlayerActivity
 import PlayerSuccess
 import ItemCommon
+import PlayerTongTianLing
 
 
 ## OnLogin
@@ -73,6 +74,7 @@
         if not __DoDicelogic(curPlayer):
             return
         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_Dice, 1)
+        PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_Dice, 1)
         
     elif diceType == 1:
         if not diceResult:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
index 2121523..865dae4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -104,6 +104,7 @@
 import PlayerLuckyCloudBuy
 import PlayerLuckyTreasure
 import PlayerAuctionHouse
+import PlayerTongTianLing
 import PlayerRefineStove
 import PlayerFlashSale
 import PlayerWishingWell
@@ -590,6 +591,8 @@
         PlayerArena.OnDayEx(curPlayer)
         #协助
         PlayerAssist.DoPlayerOnDay(curPlayer)
+        #通天令
+        PlayerTongTianLing.OnDay(curPlayer)
         #特殊时间点过天的,一般是游戏功能,此时立即同步一次跨服玩家数据
         CrossPlayerData.SendMergePlayerDataNow(curPlayer)
         
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSignDay.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSignDay.py
index 92d26c0..f748efc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSignDay.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSignDay.py
@@ -29,6 +29,7 @@
 import DataRecordPack
 import ChPyNetSendPack
 import PlayerMagicWeapon
+import PlayerTongTianLing
 import PlayerPet
 import PlayerControl
 import GameWorld
@@ -180,6 +181,7 @@
             curEffect = signDayAttrSkill.GetEffect(0)
             PlayerControl.NotifyCode(curPlayer, "SignInText2", [ChConfig.Def_SkillID_PetSignDay, curEffect.GetEffectID(), curEffect.GetEffectValue(0)])
             
+    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_Sign, 1)
     return
 
 ## 签到总奖励天数
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTongTianLing.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTongTianLing.py
new file mode 100644
index 0000000..fdc4ceb
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTongTianLing.py
@@ -0,0 +1,375 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package Player.PlayerTongTianLing
+#
+# @todo:通天令
+# @author hxp
+# @date 2022-01-17
+# @version 1.0
+#
+# 详细描述: 通天令
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2022-01-17 19:00"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import PlayerControl
+import IpyGameDataPY
+import ChPyNetSendPack
+import NetPackCommon
+import ItemControler
+import ChConfig
+
+def OnPlayerLogin(curPlayer):
+    SyncTongTianLVInfo(curPlayer)
+    SyncTongTianTaskInfo(curPlayer)
+    SyncTongTianTaskAward(curPlayer)
+    return
+
+def OnDay(curPlayer):
+    
+    resetTaskTypeList, resetTaskIDList = [], []
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for index in xrange(ipyDataMgr.GetTongTianTaskCount()):
+        ipyData = ipyDataMgr.GetTongTianTaskByIndex(index)
+        if not ipyData.GetIsDailyTask():
+            continue
+        ttTaskID = ipyData.GetTTTaskID()
+        ttTaskType = ipyData.GetTTTaskType()
+        resetTaskTypeList.append(ttTaskType)
+        
+        if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID):
+            GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID, 0)
+            resetTaskIDList.append(ttTaskID)
+            
+    isDailyTask = 1 # 只处理每日重置的任务
+    syncTaskInfoList = []
+    for ttTaskType in resetTaskTypeList:
+        curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
+        if not curValue:
+            continue
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), 0)
+        syncTaskInfoList.append([ttTaskType, isDailyTask])
+        
+    if syncTaskInfoList:
+        #GameWorld.DebugLog("重置通天任务进度: syncTaskInfoList=%s" % syncTaskInfoList)
+        SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
+        
+    if resetTaskIDList:
+        #GameWorld.DebugLog("重置通天任务奖励: resetTaskIDList=%s" % resetTaskIDList)
+        SyncTongTianTaskAward(curPlayer)
+        
+    return
+
+def GetTongTianLingLVInfo(curPlayer):
+    ## 获取通天令等级状态信息
+    # @return: 通天令等级, 是否激活通天令
+    lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVInfo)
+    ttLV, ttState = lvInfo / 10, lvInfo % 10
+    return ttLV, ttState
+
+def SetTongTianLingLVInfo(curPlayer, ttLV, ttState):
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVInfo, ttLV * 10 + ttState)
+    return
+
+def AddTongTianTaskValue(curPlayer, ttTaskType, addValue):
+    ## 增加通天令任务进度
+    
+    taskIpyList = IpyGameDataPY.GetIpyGameDataByCondition("TongTianTask", {"TTTaskType":ttTaskType}, True, False)
+    if not taskIpyList:
+        return
+    
+    addValueDict = {}
+    for ipyData in taskIpyList:
+        taskID = ipyData.GetTTTaskID()
+        if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, taskID):
+            # 已领奖的不再处理
+            continue
+        isDailyTask = ipyData.GetIsDailyTask()
+        finishNeedValue = ipyData.GetFinishNeedValue()
+        maxValue = addValueDict.get((ttTaskType, isDailyTask), 0)
+        if finishNeedValue > maxValue:
+            addValueDict[(ttTaskType, isDailyTask)] = finishNeedValue
+            
+    syncTaskInfoList = []
+    for key, finishNeedValue in addValueDict.items():
+        ttTaskType, isDailyTask = key
+        curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
+        if curValue >= finishNeedValue:
+            continue
+        updValue = min(curValue + addValue, finishNeedValue)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), updValue)
+        #GameWorld.DebugLog("更新通天令任务进度: ttTaskType=%s,isDailyTask=%s,curValue=%s,addValue=%s,updValue=%s" 
+        #                   % (ttTaskType, isDailyTask, curValue, addValue, updValue), curPlayer.GetPlayerID())
+        syncTaskInfoList.append([ttTaskType, isDailyTask])
+        
+    if syncTaskInfoList:
+        SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
+        
+    return
+
+def AddTongTianPoint(curPlayer, addPoint):
+    ## 增加通天令经验点
+    playerID = curPlayer.GetPlayerID()
+    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
+    ttPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
+    ipyData = IpyGameDataPY.GetIpyGameData("TongTianLV", ttLV)
+    if not ipyData:
+        return
+    lvUPPoint = ipyData.GetLVUPPoint()
+    if not lvUPPoint:
+        GameWorld.DebugLog("通天令已满级!", playerID)
+        return
+    updLV = ttLV
+    updPoint = ttPoint + addPoint
+    GameWorld.DebugLog("增加通天令经验: ttLV=%s,ttPoint=%s,addPoint=%s,updPoint=%s,lvUPPoint=%s" 
+                       % (ttLV, ttPoint, addPoint, updPoint, lvUPPoint), playerID)
+    doCount = 0
+    while lvUPPoint and updPoint >= lvUPPoint and doCount < 50:
+        doCount += 1
+        updPoint -= lvUPPoint
+        updLV += 1
+        nextLVIPYData = IpyGameDataPY.GetIpyGameDataNotLog("TongTianLV", updLV)
+        lvUPPoint = nextLVIPYData.GetLVUPPoint() if nextLVIPYData else 0
+        GameWorld.DebugLog("    通天令升级: updLV=%s,updPoint=%s,nextLVUPPoint=%s" % (updLV, updPoint, lvUPPoint), playerID)
+        
+    SetTongTianLingLVInfo(curPlayer, updLV, ttState)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, updPoint)
+    SyncTongTianLVInfo(curPlayer)
+    return updLV, updPoint
+
+#// A5 43 通天令领取任务奖励 #tagCMGetTongTianTaskAward
+#
+#struct    tagCMGetTongTianTaskAward
+#{
+#    tagHead        Head;
+#    BYTE        TaskID;    // 任务ID
+#};
+def OnGetTongTianTaskAward(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    ttTaskID = clientData.TaskID
+    
+    ipyData = IpyGameDataPY.GetIpyGameData("TongTianTask", ttTaskID)
+    if not ipyData:
+        return
+    
+    if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID):
+        GameWorld.DebugLog("通天任务已领奖! ttTaskID=%s" % ttTaskID, playerID)
+        return
+    
+    ttTaskType = ipyData.GetTTTaskType()
+    isDailyTask = ipyData.GetIsDailyTask()
+    finishNeedValue = ipyData.GetFinishNeedValue()
+    curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
+    if curValue < finishNeedValue:
+        GameWorld.DebugLog("通天任务进度未完成,无法领奖! ttTaskID=%s,ttTaskType=%s,isDailyTask=%s,curValue=%s < %s" 
+                           % (ttTaskID, ttTaskType, isDailyTask, curValue, finishNeedValue), playerID)
+        return
+    
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID, 1)
+    AddTongTianPoint(curPlayer, ipyData.GetTaskPoint())
+    return
+
+#// A5 44 通天令领取等级奖励 #tagCMGetTongTianLVAward
+#
+#struct    tagCMGetTongTianLVAward
+#{
+#    tagHead        Head;
+#    BYTE        TTLV;    // 领取对应等级奖励,发255为一键领取所有等级奖励,包含仙品奖励
+#    BYTE        IsXian;    // 是否领取仙品奖励,仅指定等级奖励有效
+#};
+def OnGetTongTianLVAward(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    getTTLVLV = clientData.TTLV
+    isXian = clientData.IsXian
+    
+    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
+    if getTTLVLV == 255:
+        awardLVList = range(0, ttLV + 1)
+        isXian = 1 # 一键领取的默认包含仙品奖励
+    else:
+        awardLVList = [getTTLVLV]
+        
+    GameWorld.DebugLog("领取通天令奖励: getTTLVLV=%s,isXian=%s,awardLVList=%s" % (getTTLVLV, isXian, awardLVList), playerID)
+    
+    notifyItemIDList = []
+    itemList = []
+    for awardTTLV in awardLVList:
+        if awardTTLV > ttLV:
+            GameWorld.DebugLog("    通天等级不足,无法领奖! awardTTLV=%s < %s" % (awardTTLV, ttLV), playerID)
+            break
+        ipyData = IpyGameDataPY.GetIpyGameData("TongTianLV", awardTTLV)
+        if not ipyData:
+            continue
+        commAwardItemList = ipyData.GetCommAwardItemList()
+        xianAwardItemList = ipyData.GetXianAwardItemList()
+        notifyItemIDList.extend(ipyData.GetNotifyItemIDList())
+        
+        if commAwardItemList and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord, awardTTLV):
+            GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord, awardTTLV, 1)
+            itemList.extend(commAwardItemList)
+            GameWorld.DebugLog("    常规奖励: awardTTLV=%s,commAwardItemList=%s" % (awardTTLV, commAwardItemList), playerID)
+        #elif commAwardItemList:
+        #    GameWorld.DebugLog("    已领取过该奖励: awardTTLV=%s" % (awardTTLV), playerID)
+                
+        getXian = (isXian and xianAwardItemList)
+        if getXian and ttState and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord, awardTTLV):
+            GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord, awardTTLV, 1)
+            itemList.extend(xianAwardItemList)
+            GameWorld.DebugLog("    仙品奖励: awardTTLV=%s,xianAwardItemList=%s" % (awardTTLV, xianAwardItemList), playerID)
+        #elif getXian:
+        #    GameWorld.DebugLog("    仙品通天令未激活或已领奖: awardTTLV=%s,ttState=%s" % (awardTTLV, ttState), playerID)
+            
+    GameWorld.DebugLog("    最终奖励: itemList=%s" % itemList, playerID)
+    if not itemList:
+        return
+    
+    giveItemDict = {}
+    for itemID, itemCount, isBind in itemList:
+        key = (itemID, isBind)
+        giveItemDict[key] = giveItemDict.get(key, 0) + itemCount
+        
+    awardItemList = []
+    for key, itemCount in giveItemDict.items():
+        itemID, isBind = key
+        awardItemList.append([itemID, itemCount, isBind])
+        if itemID in notifyItemIDList:
+            PlayerControl.NotifyCode(curPlayer, "TongTianLingLVAward", [curPlayer.GetPlayerName(), itemID, itemCount])
+            
+    GameWorld.DebugLog("    汇总奖励: awardItemList=%s" % awardItemList, playerID)
+    dataDict = {"awardLVList":awardLVList, "isXian":isXian}
+    ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["TongTianLing", False, dataDict])
+    SyncTongTianLVInfo(curPlayer)
+    return
+
+#// A5 45 兑换通天令等级经验积分点 #tagCMExchangeTongTianLVPoint
+#
+#struct    tagCMExchangeTongTianLVPoint
+#{
+#    tagHead        Head;
+#    DWORD        ExchangePoint;    // 兑换点数
+#};
+def OnExchangeTongTianLVPoint(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    exchangePoint = clientData.ExchangePoint
+    exchangeCostInfo = IpyGameDataPY.GetFuncEvalCfg("TongTianLing", 1)
+    if len(exchangeCostInfo) != 2:
+        return
+    costMoneyType, costMoneyValue = exchangeCostInfo
+    if not costMoneyType or not costMoneyValue:
+        return
+    
+    ttLV = GetTongTianLingLVInfo(curPlayer)[0]
+    ttPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
+    canBuyPointMax = 0
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for index in xrange(ttLV, ipyDataMgr.GetTongTianLVCount()):
+        ipyData = ipyDataMgr.GetTongTianLVByIndex(index)
+        canBuyPointMax += ipyData.GetLVUPPoint()
+    canBuyPointMax -= ttPoint
+    
+    exchangePoint = min(exchangePoint, canBuyPointMax)
+    costMoneyTotal = costMoneyValue * exchangePoint
+    GameWorld.DebugLog("兑换通天令等级经验: ttLV=%s,ttPoint=%s,exchangePoint=%s,canBuyPointMax=%s,costMoneyType=%s,costMoneyTotal=%s" 
+                       % (ttLV, ttPoint, exchangePoint, canBuyPointMax, costMoneyType, costMoneyTotal), playerID)
+    
+    if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyTotal):
+        return
+        
+    updInfo = AddTongTianPoint(curPlayer, exchangePoint)
+    updLV, updPoint = updInfo if updInfo else (ttLV, ttPoint)
+    
+    infoDict = {ChConfig.Def_Cost_Reason_SonKey:"ExchangeTongTianLVPoint", "exchangePoint":exchangePoint, 
+                "ttLV":ttLV, "ttPoint":ttPoint, "updLV":updLV, "updPoint":updPoint}
+    PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyTotal, ChConfig.Def_Cost_TongTianLing, infoDict)
+    return
+
+#// A5 46 购买通天令 #tagCMBuyTongTianLing
+#
+#struct    tagCMBuyTongTianLing
+#{
+#    tagHead        Head;
+#};
+def OnBuyTongTianLing(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
+    if ttState:
+        GameWorld.DebugLog("通天令已经购买过了!", playerID)
+        return
+    
+    costMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("TongTianLing", 2)
+    if len(costMoneyInfo) != 2:
+        return
+    costMoneyType, costMoneyValue = costMoneyInfo
+    if not costMoneyType or not costMoneyValue:
+        return
+    
+    infoDict = {ChConfig.Def_Cost_Reason_SonKey:"BuyTongTianLing", "ttLV":ttLV}
+    if not PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, ChConfig.Def_Cost_TongTianLing, infoDict):
+        return
+    
+    ttState = 1
+    SetTongTianLingLVInfo(curPlayer, ttLV, ttState)
+    GameWorld.DebugLog("购买激活通天令!", playerID)
+    PlayerControl.NotifyCode(curPlayer, "TongTianLingActive")
+    return
+
+def SyncTongTianLVInfo(curPlayer):
+    ## 等级信息
+    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
+    clientPack = ChPyNetSendPack.tagMCTongTianLingInfo()
+    clientPack.TTLBuyState = ttState
+    clientPack.TTLLV = ttLV
+    clientPack.CurPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
+    clientPack.CommAwardStateList = []
+    clientPack.XianAwardStateList = []
+    for i in xrange(2):
+        clientPack.CommAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_CommAwardRecord % i))
+        clientPack.XianAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_XianAwardRecord % i))
+    clientPack.AwardStateCount = len(clientPack.CommAwardStateList)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
+def SyncTongTianTaskInfo(curPlayer, syncTaskInfoList=None):
+    ## 任务进度信息
+    syncAppoint = True
+    if syncTaskInfoList == None:
+        syncAppoint = False
+        syncTaskInfoList = []
+        for ttTaskType in ChConfig.TTLTaskTypeList:
+            syncTaskInfoList.append([ttTaskType, 0])
+            syncTaskInfoList.append([ttTaskType, 1])
+            
+    clientPack = ChPyNetSendPack.tagMCTongTianLingTaskValueInfo()
+    clientPack.TaskValueList = []
+    for ttTaskType, isDailyTask in syncTaskInfoList:
+        curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
+        if not curValue and not syncAppoint:
+            continue
+        task = ChPyNetSendPack.tagMCTongTianLingTaskValue()
+        task.TaskType = ttTaskType
+        task.IsDaily = isDailyTask
+        task.TaskValue = curValue
+        clientPack.TaskValueList.append(task)
+    clientPack.Count = len(clientPack.TaskValueList)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
+def SyncTongTianTaskAward(curPlayer):
+    ## 任务奖励信息
+    clientPack = ChPyNetSendPack.tagMCTongTianLingTaskAwardInfo()
+    clientPack.TaskAwardStateList = []
+    for i in xrange(9):
+        clientPack.TaskAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskAwardRecord % i))
+    clientPack.AwardStateCount = len(clientPack.TaskAwardStateList)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
+

--
Gitblit v1.8.0