From 1e03fac0bcbd9c57ae5da827cb1ea3294c606781 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 22 九月 2023 13:22:07 +0800
Subject: [PATCH] 9936 【BT0.1】【主干】人族法宝(任务 进度)给予奖励

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py |    9 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py            |  112 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py              |   20 ++
 PySysDB/PySysDBPY.h                                                                               |    8 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py                  |    4 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                 |  112 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CustomAward.py    |   64 ++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCustomAward.py   |   98 ++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                   |    7 
 9 files changed, 433 insertions(+), 1 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index d47397c..0e14ba2 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -2737,3 +2737,11 @@
 	float		NeedRMB;	//所需充值元
 	dict		Reward;	//职业对应的奖励内容,每个职业4组数据,物品ID和物品数量(1.枪豪2.道师3.剑修)
 };
+
+//奖励表
+
+struct tagCustomAward
+{
+	BYTE		_AwardID;	//奖励ID 1~n
+	list		AwardItemList;	//物品奖励[[物品ID,个数,是否拍品], ...]
+};
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index e58e723..d99cced 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -18635,6 +18635,118 @@
 
 
 #------------------------------------------------------
+# A3 CC 自定义奖励信息 #tagMCCustomAwardInfo
+
+class  tagMCCustomAwardState(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("KeyNum", c_ubyte),    # 奖励记录key编号,0~255,每个key存31个ID记录  0-30为编号0, 31-61为编号1..
+                  ("CanGetState", c_int),    # 是否可领取;按位记录是否可领取
+                  ("GetState", 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.KeyNum = 0
+        self.CanGetState = 0
+        self.GetState = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCCustomAwardState)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 CC 自定义奖励信息 //tagMCCustomAwardInfo:
+                                KeyNum:%d,
+                                CanGetState:%d,
+                                GetState:%d
+                                '''\
+                                %(
+                                self.KeyNum,
+                                self.CanGetState,
+                                self.GetState
+                                )
+        return DumpString
+
+
+class  tagMCCustomAwardInfo(Structure):
+    Head = tagHead()
+    RecordStateCnt = 0    #(BYTE RecordStateCnt)// 记录个数
+    RecordStateList = list()    #(vector<tagMCCustomAwardState> RecordStateList)// 记录列表
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0xCC
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.RecordStateCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.RecordStateCnt):
+            temRecordStateList = tagMCCustomAwardState()
+            _pos = temRecordStateList.ReadData(_lpData, _pos)
+            self.RecordStateList.append(temRecordStateList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0xCC
+        self.RecordStateCnt = 0
+        self.RecordStateList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.RecordStateCnt):
+            length += self.RecordStateList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.RecordStateCnt)
+        for i in range(self.RecordStateCnt):
+            data = CommFunc.WriteString(data, self.RecordStateList[i].GetLength(), self.RecordStateList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                RecordStateCnt:%d,
+                                RecordStateList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.RecordStateCnt,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCCustomAwardInfo=tagMCCustomAwardInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCCustomAwardInfo.Head.Cmd,m_NAtagMCCustomAwardInfo.Head.SubCmd))] = m_NAtagMCCustomAwardInfo
+
+
+#------------------------------------------------------
 # A3 15 日常活动次数通知 #tagMCDailyActionCnt
 
 class  tagMCDailyActionInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index f704a64..1c6a178 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4281,6 +4281,10 @@
 #神通
 Def_PDict_ShentongLVInfo = "ShentongLVInfo_%s"  # 神通等级信息,参数(神通ID),阶级*100+等级
 Def_PDict_ShentongSkillID = "ShentongSkillID_%s"  # 神通出战技能ID,参数(编号)
+
+#自定义奖励
+Def_PDict_CustomAwardCanGet = "CustomAwardCanGet_%s" # 是否可领取,参数(key编号)
+Def_PDict_CustomAwardGetState = "CustomAwardGetState_%s" # 是否已领取,参数(key编号)
 #-------------------------------------------------------------------------------
 #可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
 
@@ -5723,7 +5727,8 @@
 Def_RewardType_GubaoItemEff, #古宝特殊效果物品奖励 58
 Def_RewardType_SuccessScore, #成就积分奖励 59
 Def_RewardType_BuyOne, #买一送多活动免费奖励 60
-)= range(61)
+Def_RewardType_CustomAward, #自定义奖励 61
+)= range(62)
 
 
 #boss复活相关活动定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index e58e723..d99cced 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -18635,6 +18635,118 @@
 
 
 #------------------------------------------------------
+# A3 CC 自定义奖励信息 #tagMCCustomAwardInfo
+
+class  tagMCCustomAwardState(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("KeyNum", c_ubyte),    # 奖励记录key编号,0~255,每个key存31个ID记录  0-30为编号0, 31-61为编号1..
+                  ("CanGetState", c_int),    # 是否可领取;按位记录是否可领取
+                  ("GetState", 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.KeyNum = 0
+        self.CanGetState = 0
+        self.GetState = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCCustomAwardState)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 CC 自定义奖励信息 //tagMCCustomAwardInfo:
+                                KeyNum:%d,
+                                CanGetState:%d,
+                                GetState:%d
+                                '''\
+                                %(
+                                self.KeyNum,
+                                self.CanGetState,
+                                self.GetState
+                                )
+        return DumpString
+
+
+class  tagMCCustomAwardInfo(Structure):
+    Head = tagHead()
+    RecordStateCnt = 0    #(BYTE RecordStateCnt)// 记录个数
+    RecordStateList = list()    #(vector<tagMCCustomAwardState> RecordStateList)// 记录列表
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0xCC
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.RecordStateCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.RecordStateCnt):
+            temRecordStateList = tagMCCustomAwardState()
+            _pos = temRecordStateList.ReadData(_lpData, _pos)
+            self.RecordStateList.append(temRecordStateList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0xCC
+        self.RecordStateCnt = 0
+        self.RecordStateList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.RecordStateCnt):
+            length += self.RecordStateList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.RecordStateCnt)
+        for i in range(self.RecordStateCnt):
+            data = CommFunc.WriteString(data, self.RecordStateList[i].GetLength(), self.RecordStateList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                RecordStateCnt:%d,
+                                RecordStateList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.RecordStateCnt,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCCustomAwardInfo=tagMCCustomAwardInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCCustomAwardInfo.Head.Cmd,m_NAtagMCCustomAwardInfo.Head.SubCmd))] = m_NAtagMCCustomAwardInfo
+
+
+#------------------------------------------------------
 # A3 15 日常活动次数通知 #tagMCDailyActionCnt
 
 class  tagMCDailyActionInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
index 2a8e1a2..660d5db 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
@@ -60,6 +60,7 @@
 import PlayerFeastTravel
 import PlayerWeekParty
 import PlayerFairyDomain
+import PlayerCustomAward
 import GameFuncComm
 import PlayerActLogin
 import PlayerHorse
@@ -7337,6 +7338,14 @@
     PlayerMagicWeapon.DoActiveMW(curPlayer, mwID)
     return
 
+##设置自定义奖励可领取
+# @param None
+# @return None <Setcustomaward_Canget id="奖励ID"/>
+def DoType_Setcustomaward_Canget(curPlayer, curMission, curActionNode):
+    awardID = GameWorld.ToIntDef(curActionNode.GetAttribute("id"), 0)
+    PlayerCustomAward.SetCustomAwardCanGet(curPlayer, awardID, 1)
+    return
+
 ## 人物隐身 <Visible id="0隐身1现身"/>
 def DoType_Visible(curPlayer, curMission, curActionNode):
     visible = GameWorld.ToIntDef(curActionNode.GetAttribute("id"), 0)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CustomAward.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CustomAward.py
new file mode 100644
index 0000000..fc2c807
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CustomAward.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.CustomAward
+#
+# @todo:自定义奖励
+# @author hxp
+# @date 2023-09-22
+# @version 1.0
+#
+# 详细描述: 自定义奖励
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2023-09-22 13:30"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import PlayerCustomAward
+import IpyGameDataPY
+import PlayerControl
+import ChConfig
+
+## GM命令执行入口
+#  @param curPlayer 当前玩家
+#  @param msgList 参数列表 []
+#  @return None
+#  @remarks 函数详细说明.
+def OnExec(curPlayer, msgList):
+    if not msgList:
+        GameWorld.DebugAnswer(curPlayer, "重置所有: CustomAward 0")
+        GameWorld.DebugAnswer(curPlayer, "设置奖励: CustomAward ID 是否可领  是否已领")
+        return
+    
+    cmdType = msgList[0]
+    if cmdType == 0:
+        awardIDMax = 0
+        ipyDataMgr = IpyGameDataPY.IPY_Data()
+        for index in range(ipyDataMgr.GetCustomAwardCount()):
+            ipyData = ipyDataMgr.GetCustomAwardByIndex(index)
+            if awardIDMax < ipyData.GetAwardID():
+                awardIDMax = ipyData.GetAwardID()
+                
+        keyNumMax = GameWorld.GetDictKeyNumByBit(awardIDMax)
+        for keyNum in range(keyNumMax + 1):
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet % keyNum, 0)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CustomAwardGetState % keyNum, 0)
+            
+        PlayerCustomAward.Sync_CustomAwardInfo(curPlayer, None, True)
+        GameWorld.DebugAnswer(curPlayer, "重置OK")
+    else:
+        awardID = cmdType
+        canGet = msgList[1] if len(msgList) > 1 else 0
+        getState = msgList[2] if len(msgList) > 2 else 0
+        ipyData = IpyGameDataPY.GetIpyGameData("CustomAward", awardID)
+        if not ipyData:
+            GameWorld.DebugAnswer(curPlayer, "不存在该奖励ID:%s" % awardID)
+            return
+        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet, awardID, canGet)
+        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardGetState, awardID, getState)
+        PlayerCustomAward.Sync_CustomAwardInfo(curPlayer, awardID, True)
+        GameWorld.DebugAnswer(curPlayer, "奖励ID:%s,可领:%s,已领:%s" % (awardID, canGet, getState))
+        
+    return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index 9b7c547..0f0ba57 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -1941,6 +1941,10 @@
             return value
     return defValue
 
+def GetDictKeyNumByBit(bit, isBin=True):
+    perKeyMaxBit = 31 if isBin else 9
+    keyNum = bit / perKeyMaxBit
+    return keyNum
 
 ## 根据玩家字典对应的位值, 使用多个key支持N位索引
 #  @param curPlayer
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 703f7f3..b290b63 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -2112,6 +2112,11 @@
                         ("float", "NeedRMB", 0),
                         ("dict", "Reward", 0),
                         ),
+
+                "CustomAward":(
+                        ("BYTE", "AwardID", 1),
+                        ("list", "AwardItemList", 0),
+                        ),
                 }
 
 
@@ -6491,6 +6496,17 @@
     def GetID(self): return self.ID # id
     def GetNeedRMB(self): return self.NeedRMB # 所需充值元
     def GetReward(self): return self.Reward # 职业对应的奖励内容,每个职业4组数据,物品ID和物品数量(1.枪豪2.道师3.剑修)
+
+# 奖励表
+class IPY_CustomAward():
+    
+    def __init__(self):
+        self.AwardID = 0
+        self.AwardItemList = []
+        return
+        
+    def GetAwardID(self): return self.AwardID # 奖励ID 1~n
+    def GetAwardItemList(self): return self.AwardItemList # 物品奖励[[物品ID,个数,是否拍品], ...]
 
 
 def Log(msg, playerID=0, par=0):
@@ -6946,6 +6962,8 @@
         self.ipyFuncSysPrivilegeLen = len(self.ipyFuncSysPrivilegeCache)
         self.ipyHistoryRechargeAwardCache = self.__LoadFileData("HistoryRechargeAward", IPY_HistoryRechargeAward)
         self.ipyHistoryRechargeAwardLen = len(self.ipyHistoryRechargeAwardCache)
+        self.ipyCustomAwardCache = self.__LoadFileData("CustomAward", IPY_CustomAward)
+        self.ipyCustomAwardLen = len(self.ipyCustomAwardCache)
         Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
         Log("IPY_DataMgr InitOK!")
         return
@@ -7542,6 +7560,8 @@
     def GetFuncSysPrivilegeByIndex(self, index): return self.ipyFuncSysPrivilegeCache[index]
     def GetHistoryRechargeAwardCount(self): return self.ipyHistoryRechargeAwardLen
     def GetHistoryRechargeAwardByIndex(self, index): return self.ipyHistoryRechargeAwardCache[index]
+    def GetCustomAwardCount(self): return self.ipyCustomAwardLen
+    def GetCustomAwardByIndex(self, index): return self.ipyCustomAwardCache[index]
 
 IPYData = IPY_DataMgr()
 def IPY_Data(): return IPYData
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCustomAward.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCustomAward.py
new file mode 100644
index 0000000..d5a0336
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCustomAward.py
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package Player.PlayerCustomAward
+#
+# @todo:自定义奖励
+# @author hxp
+# @date 2023-09-22
+# @version 1.0
+#
+# 详细描述: 自定义奖励
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2023-09-22 13:30"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import NetPackCommon
+import ChPyNetSendPack
+import IpyGameDataPY
+import ItemCommon
+import ChConfig
+
+def OnPlayerLogin(curPlayer):
+    Sync_CustomAwardInfo(curPlayer)
+    return
+
+def SetCustomAwardCanGet(curPlayer, awardID, canGet=1):
+    ipyData = IpyGameDataPY.GetIpyGameData("CustomAward", awardID)
+    if not ipyData:
+        return
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet, awardID, canGet)
+    Sync_CustomAwardInfo(curPlayer, awardID)
+    return
+
+## 领取自定义奖励
+def OnGetCustomAward(curPlayer, awardID):
+    if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet, awardID):
+        GameWorld.Log("该自定义奖励当前不可领取, awardID=%s" % awardID, curPlayer.GetPlayerID())
+        return
+    if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardGetState, awardID):
+        GameWorld.Log("该自定义奖励已经领取过, awardID=%s" % awardID, curPlayer.GetPlayerID())
+        return
+    ipyData = IpyGameDataPY.GetIpyGameData("CustomAward", awardID)
+    if not ipyData:
+        return
+    awardItemList = ipyData.GetAwardItemList()
+    
+    if not ItemCommon.GiveAwardItem(curPlayer, awardItemList):
+        return
+    
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardGetState, awardID, 1)
+    GameWorld.Log("领取自定义奖励, awardID=%s" % awardID, curPlayer.GetPlayerID())
+    Sync_CustomAwardInfo(curPlayer, awardID)
+    return
+
+## 通知自定义奖励记录
+def Sync_CustomAwardInfo(curPlayer, awardID=None, force=False):
+    if awardID == None:
+        awardIDList = []
+        ipyDataMgr = IpyGameDataPY.IPY_Data()
+        for index in range(ipyDataMgr.GetCustomAwardCount()):
+            ipyData = ipyDataMgr.GetCustomAwardByIndex(index)
+            awardIDList.append(ipyData.GetAwardID())
+    else:
+        awardIDList = [awardID]
+        
+    keyNumList = []
+    for aID in awardIDList:
+        keyNum = GameWorld.GetDictKeyNumByBit(aID)
+        if keyNum not in keyNumList:
+            keyNumList.append(keyNum)
+    
+    if not keyNumList:
+        return
+    
+    recordStateList = []
+    for keyNum in keyNumList:
+        canGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CustomAwardCanGet % keyNum)
+        getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CustomAwardGetState % keyNum)
+        if not canGet and not getState and not force:
+            continue
+        awardState = ChPyNetSendPack.tagMCCustomAwardState()
+        awardState.KeyNum = keyNum
+        awardState.CanGetState = canGet
+        awardState.GetState = getState
+        recordStateList.append(awardState)
+        
+    if not recordStateList:
+        return
+    
+    clientPack = ChPyNetSendPack.tagMCCustomAwardInfo()
+    clientPack.Clear()
+    clientPack.RecordStateList = recordStateList
+    clientPack.RecordStateCnt = len(clientPack.RecordStateList)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return

--
Gitblit v1.8.0