From 03a39e5d596b6430db2c406a3349a1dae75c7f2e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 09 七月 2024 16:11:00 +0800
Subject: [PATCH] 10205 【越南】【主干】【港台】【砍树】自选礼包

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                          |    6 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py   |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py |   16 -
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py                  |   56 ++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py              |   63 +-------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py                |   37 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py            |   76 ++++++++++
 PySysDB/PySysDBPY.h                                                                                 |   13 +
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                       |   56 ++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                   |   63 +-------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                     |    1 
 11 files changed, 268 insertions(+), 120 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 2b218a3..84ac25b 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1605,8 +1605,19 @@
 	WORD		FirstGoldPrize;	//首次充值该档位赠送仙玉
 	list		GainItemList;	//获得物品列表[[物品ID,个数,是否绑定], ...]
 	dict		ActWorldLVGainItemInfo;	//根据活动世界等级获得物品信息,活动专用 {"世界等级":[[物品ID,个数,是否绑定], ...], ...}
+	list		SelectItemInfo;	//自选礼包物品信息 [[自选1ID, ...], [自选2ID, ...], ...]
 	char		NotifyMark;	//广播提示
 	BYTE		PayType;	//充值类型
+};
+
+//充值自选物品表
+
+struct tagCTGSelectItem
+{
+	WORD		_SelectID;		//自选ID
+	DWORD		ItemID;	//物品ID
+	DWORD		ItemCount;	//物品个数
+	BYTE		IsAuctionItem;	//是否拍品
 };
 
 //首充表
@@ -2458,7 +2469,7 @@
 	WORD		LVLimit;	//限制等级
 	BYTE		IsDayReset;	//是否每天重置
 	BYTE		ResetType;	//重置类型,0-0点重置;1-5点重置
-	dict		CTGIDInfo;	//充值ID信息 {ctgID:折扣力度百分比, ...}
+	list		CTGIDList;	//充值ID列表 [ctgID, ...]
 	dict		CTGCountAwardInfo;	//累计充值次数额外奖励
 };
 
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 7f66f5a..a44bae5 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -5257,6 +5257,62 @@
 
 
 #------------------------------------------------------
+# A1 26 充值自选物品选择 #tagCMSelectCTGItem
+
+class  tagCMSelectCTGItem(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("RecordID", c_ushort),    #充值ID
+                  ("SelectItemValue", c_int),    # 自选物品索引值,每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA1
+        self.SubCmd = 0x26
+        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 = 0xA1
+        self.SubCmd = 0x26
+        self.RecordID = 0
+        self.SelectItemValue = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMSelectCTGItem)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A1 26 充值自选物品选择 //tagCMSelectCTGItem:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                RecordID:%d,
+                                SelectItemValue:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.RecordID,
+                                self.SelectItemValue
+                                )
+        return DumpString
+
+
+m_NAtagCMSelectCTGItem=tagCMSelectCTGItem()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSelectCTGItem.Cmd,m_NAtagCMSelectCTGItem.SubCmd))] = m_NAtagCMSelectCTGItem
+
+
+#------------------------------------------------------
 #A1 03 设置是否成年 #tagCMAdult
 
 class  tagCMAdult(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index db237bc..bde1c54 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -17476,6 +17476,7 @@
                   ("TotalPayCount", c_int),    # 累计总购买次数
                   ("WeekPayCount", c_ushort),    # 周总购买次数
                   ("MonthPayCount", c_ushort),    # 月总购买次数
+                  ("SelectItemValue", c_int),    # 自选物品索引值,每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
                   ]
 
     def __init__(self):
@@ -17493,6 +17494,7 @@
         self.TotalPayCount = 0
         self.WeekPayCount = 0
         self.MonthPayCount = 0
+        self.SelectItemValue = 0
         return
 
     def GetLength(self):
@@ -17507,14 +17509,16 @@
                                 TodayPayCount:%d,
                                 TotalPayCount:%d,
                                 WeekPayCount:%d,
-                                MonthPayCount:%d
+                                MonthPayCount:%d,
+                                SelectItemValue:%d
                                 '''\
                                 %(
                                 self.RecordID,
                                 self.TodayPayCount,
                                 self.TotalPayCount,
                                 self.WeekPayCount,
-                                self.MonthPayCount
+                                self.MonthPayCount,
+                                self.SelectItemValue
                                 )
         return DumpString
 
@@ -32352,45 +32356,6 @@
         return DumpString
 
 
-class  tagMCActBuyCountCTGID(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("CTGID", c_ushort),    # 充值表ID
-                  ("Discount", c_ushort),    # 折扣力度百分比
-                  ]
-
-    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.CTGID = 0
-        self.Discount = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagMCActBuyCountCTGID)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// AA 74 购买次数礼包活动信息 //tagMCActBuyCountGiftInfo:
-                                CTGID:%d,
-                                Discount:%d
-                                '''\
-                                %(
-                                self.CTGID,
-                                self.Discount
-                                )
-        return DumpString
-
-
 class  tagMCActBuyCountGiftInfo(Structure):
     Head = tagHead()
     ActNum = 0    #(BYTE ActNum)// 活动编号
@@ -32400,7 +32365,7 @@
     ResetType = 0    #(BYTE ResetType)// 重置类型,0-0点重置;1-5点重置
     LimitLV = 0    #(WORD LimitLV)// 限制等级
     CTGIDCount = 0    #(BYTE CTGIDCount)
-    CTGIDInfoList = list()    #(vector<tagMCActBuyCountCTGID> CTGIDInfoList)// CTGID信息列表;总购买次数前端自己统计,直接取CTGID对应的累计购买次数累加
+    CTGIDList = list()    #(vector<WORD> CTGIDList)// CTGID列表;总购买次数前端自己统计,直接取CTGID对应的累计购买次数累加
     GiftCount = 0    #(BYTE GiftCount)
     BuyCountGiftList = list()    #(vector<tagMCActBuyCountGift> BuyCountGiftList)// 购买次数礼包列表
     data = None
@@ -32422,9 +32387,8 @@
         self.LimitLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
         self.CTGIDCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.CTGIDCount):
-            temCTGIDInfoList = tagMCActBuyCountCTGID()
-            _pos = temCTGIDInfoList.ReadData(_lpData, _pos)
-            self.CTGIDInfoList.append(temCTGIDInfoList)
+            value,_pos=CommFunc.ReadWORD(_lpData,_pos)
+            self.CTGIDList.append(value)
         self.GiftCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.GiftCount):
             temBuyCountGiftList = tagMCActBuyCountGift()
@@ -32444,7 +32408,7 @@
         self.ResetType = 0
         self.LimitLV = 0
         self.CTGIDCount = 0
-        self.CTGIDInfoList = list()
+        self.CTGIDList = list()
         self.GiftCount = 0
         self.BuyCountGiftList = list()
         return
@@ -32459,8 +32423,7 @@
         length += 1
         length += 2
         length += 1
-        for i in range(self.CTGIDCount):
-            length += self.CTGIDInfoList[i].GetLength()
+        length += 2 * self.CTGIDCount
         length += 1
         for i in range(self.GiftCount):
             length += self.BuyCountGiftList[i].GetLength()
@@ -32478,7 +32441,7 @@
         data = CommFunc.WriteWORD(data, self.LimitLV)
         data = CommFunc.WriteBYTE(data, self.CTGIDCount)
         for i in range(self.CTGIDCount):
-            data = CommFunc.WriteString(data, self.CTGIDInfoList[i].GetLength(), self.CTGIDInfoList[i].GetBuffer())
+            data = CommFunc.WriteWORD(data, self.CTGIDList[i])
         data = CommFunc.WriteBYTE(data, self.GiftCount)
         for i in range(self.GiftCount):
             data = CommFunc.WriteString(data, self.BuyCountGiftList[i].GetLength(), self.BuyCountGiftList[i].GetBuffer())
@@ -32494,7 +32457,7 @@
                                 ResetType:%d,
                                 LimitLV:%d,
                                 CTGIDCount:%d,
-                                CTGIDInfoList:%s,
+                                CTGIDList:%s,
                                 GiftCount:%d,
                                 BuyCountGiftList:%s
                                 '''\
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index 1348bb2..68a6d3f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1483,7 +1483,7 @@
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 2
+RegisterPackCount = 3
 
 PacketCMD_1=0xA1
 PacketSubCMD_1=0x23
@@ -1493,6 +1493,10 @@
 PacketSubCMD_2=0x25
 PacketCallFunc_2=OnCoinBuyOrderInfo
 
+PacketCMD_3=0xA1
+PacketSubCMD_3=0x26
+PacketCallFunc_3=OnSelectCTGItem
+
 ;首充
 [PlayerGoldGift]
 ScriptName = Player\PlayerGoldGift.py
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index e312001..82f7828 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3708,6 +3708,7 @@
 Def_PDict_WeekCTGCount = "WeekCTGCount_%s"  # 本周充值次数,参数(CTG对应的商品记录ID)
 Def_PDict_MonthCTGCount = "MonthCTGCount_%s"  # 本月充值次数,参数(CTG对应的商品记录ID)
 Def_PDict_CTGGoodsBuyCount = "CTGGoodsBuyCount_%s"  # 对应充值商品已购买次数,参数(CTG对应的商品记录ID)
+Def_PDict_CTGSelectItemValue = "CTGSelectItemValue_%s"  # 充值自选选择记录,参数(CTG对应的商品记录ID) 每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
 Def_PDict_OnlineRechargeTHAward = "OnlineRechargeTHAward"  # 在线特惠充值额外奖励 - 是否已领取奖励
 Def_PDict_DayFreeGoldGiftState = "DayFreeGoldGiftState"  # 每日免费直购礼包领取记录
 Def_PDict_GoldGiftFirstRecord = "GoldGiftFirstRecord"  # 首充领取记录,按位记录首充第x天是否已领取
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 7f66f5a..a44bae5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -5257,6 +5257,62 @@
 
 
 #------------------------------------------------------
+# A1 26 充值自选物品选择 #tagCMSelectCTGItem
+
+class  tagCMSelectCTGItem(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("RecordID", c_ushort),    #充值ID
+                  ("SelectItemValue", c_int),    # 自选物品索引值,每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA1
+        self.SubCmd = 0x26
+        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 = 0xA1
+        self.SubCmd = 0x26
+        self.RecordID = 0
+        self.SelectItemValue = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMSelectCTGItem)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A1 26 充值自选物品选择 //tagCMSelectCTGItem:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                RecordID:%d,
+                                SelectItemValue:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.RecordID,
+                                self.SelectItemValue
+                                )
+        return DumpString
+
+
+m_NAtagCMSelectCTGItem=tagCMSelectCTGItem()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSelectCTGItem.Cmd,m_NAtagCMSelectCTGItem.SubCmd))] = m_NAtagCMSelectCTGItem
+
+
+#------------------------------------------------------
 #A1 03 设置是否成年 #tagCMAdult
 
 class  tagCMAdult(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index db237bc..bde1c54 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -17476,6 +17476,7 @@
                   ("TotalPayCount", c_int),    # 累计总购买次数
                   ("WeekPayCount", c_ushort),    # 周总购买次数
                   ("MonthPayCount", c_ushort),    # 月总购买次数
+                  ("SelectItemValue", c_int),    # 自选物品索引值,每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
                   ]
 
     def __init__(self):
@@ -17493,6 +17494,7 @@
         self.TotalPayCount = 0
         self.WeekPayCount = 0
         self.MonthPayCount = 0
+        self.SelectItemValue = 0
         return
 
     def GetLength(self):
@@ -17507,14 +17509,16 @@
                                 TodayPayCount:%d,
                                 TotalPayCount:%d,
                                 WeekPayCount:%d,
-                                MonthPayCount:%d
+                                MonthPayCount:%d,
+                                SelectItemValue:%d
                                 '''\
                                 %(
                                 self.RecordID,
                                 self.TodayPayCount,
                                 self.TotalPayCount,
                                 self.WeekPayCount,
-                                self.MonthPayCount
+                                self.MonthPayCount,
+                                self.SelectItemValue
                                 )
         return DumpString
 
@@ -32352,45 +32356,6 @@
         return DumpString
 
 
-class  tagMCActBuyCountCTGID(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("CTGID", c_ushort),    # 充值表ID
-                  ("Discount", c_ushort),    # 折扣力度百分比
-                  ]
-
-    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.CTGID = 0
-        self.Discount = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagMCActBuyCountCTGID)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// AA 74 购买次数礼包活动信息 //tagMCActBuyCountGiftInfo:
-                                CTGID:%d,
-                                Discount:%d
-                                '''\
-                                %(
-                                self.CTGID,
-                                self.Discount
-                                )
-        return DumpString
-
-
 class  tagMCActBuyCountGiftInfo(Structure):
     Head = tagHead()
     ActNum = 0    #(BYTE ActNum)// 活动编号
@@ -32400,7 +32365,7 @@
     ResetType = 0    #(BYTE ResetType)// 重置类型,0-0点重置;1-5点重置
     LimitLV = 0    #(WORD LimitLV)// 限制等级
     CTGIDCount = 0    #(BYTE CTGIDCount)
-    CTGIDInfoList = list()    #(vector<tagMCActBuyCountCTGID> CTGIDInfoList)// CTGID信息列表;总购买次数前端自己统计,直接取CTGID对应的累计购买次数累加
+    CTGIDList = list()    #(vector<WORD> CTGIDList)// CTGID列表;总购买次数前端自己统计,直接取CTGID对应的累计购买次数累加
     GiftCount = 0    #(BYTE GiftCount)
     BuyCountGiftList = list()    #(vector<tagMCActBuyCountGift> BuyCountGiftList)// 购买次数礼包列表
     data = None
@@ -32422,9 +32387,8 @@
         self.LimitLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
         self.CTGIDCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.CTGIDCount):
-            temCTGIDInfoList = tagMCActBuyCountCTGID()
-            _pos = temCTGIDInfoList.ReadData(_lpData, _pos)
-            self.CTGIDInfoList.append(temCTGIDInfoList)
+            value,_pos=CommFunc.ReadWORD(_lpData,_pos)
+            self.CTGIDList.append(value)
         self.GiftCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.GiftCount):
             temBuyCountGiftList = tagMCActBuyCountGift()
@@ -32444,7 +32408,7 @@
         self.ResetType = 0
         self.LimitLV = 0
         self.CTGIDCount = 0
-        self.CTGIDInfoList = list()
+        self.CTGIDList = list()
         self.GiftCount = 0
         self.BuyCountGiftList = list()
         return
@@ -32459,8 +32423,7 @@
         length += 1
         length += 2
         length += 1
-        for i in range(self.CTGIDCount):
-            length += self.CTGIDInfoList[i].GetLength()
+        length += 2 * self.CTGIDCount
         length += 1
         for i in range(self.GiftCount):
             length += self.BuyCountGiftList[i].GetLength()
@@ -32478,7 +32441,7 @@
         data = CommFunc.WriteWORD(data, self.LimitLV)
         data = CommFunc.WriteBYTE(data, self.CTGIDCount)
         for i in range(self.CTGIDCount):
-            data = CommFunc.WriteString(data, self.CTGIDInfoList[i].GetLength(), self.CTGIDInfoList[i].GetBuffer())
+            data = CommFunc.WriteWORD(data, self.CTGIDList[i])
         data = CommFunc.WriteBYTE(data, self.GiftCount)
         for i in range(self.GiftCount):
             data = CommFunc.WriteString(data, self.BuyCountGiftList[i].GetLength(), self.BuyCountGiftList[i].GetBuffer())
@@ -32494,7 +32457,7 @@
                                 ResetType:%d,
                                 LimitLV:%d,
                                 CTGIDCount:%d,
-                                CTGIDInfoList:%s,
+                                CTGIDList:%s,
                                 GiftCount:%d,
                                 BuyCountGiftList:%s
                                 '''\
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
index 08a11f2..789ea5c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
@@ -44,6 +44,7 @@
     for i in xrange(ipyDataMgr.GetCTGCount()):
         ipyData = ipyDataMgr.GetCTGByIndex(i)
         recordID = ipyData.GetRecordID()
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGSelectItemValue % recordID, 0)
         totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
         todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
         weekBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 8f2fd39..fd544bb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1294,8 +1294,16 @@
                         ("WORD", "FirstGoldPrize", 0),
                         ("list", "GainItemList", 0),
                         ("dict", "ActWorldLVGainItemInfo", 0),
+                        ("list", "SelectItemInfo", 0),
                         ("char", "NotifyMark", 0),
                         ("BYTE", "PayType", 0),
+                        ),
+
+                "CTGSelectItem":(
+                        ("WORD", "SelectID", 1),
+                        ("DWORD", "ItemID", 0),
+                        ("DWORD", "ItemCount", 0),
+                        ("BYTE", "IsAuctionItem", 0),
                         ),
 
                 "FirstGold":(
@@ -1930,7 +1938,7 @@
                         ("WORD", "LVLimit", 0),
                         ("BYTE", "IsDayReset", 0),
                         ("BYTE", "ResetType", 0),
-                        ("dict", "CTGIDInfo", 0),
+                        ("list", "CTGIDList", 0),
                         ("dict", "CTGCountAwardInfo", 0),
                         ),
 
@@ -4187,8 +4195,21 @@
     def GetFirstGoldPrize(self): return self.attrTuple[9] # 首次充值该档位赠送仙玉 WORD
     def GetGainItemList(self): return self.attrTuple[10] # 获得物品列表[[物品ID,个数,是否绑定], ...] list
     def GetActWorldLVGainItemInfo(self): return self.attrTuple[11] # 根据活动世界等级获得物品信息,活动专用 {"世界等级":[[物品ID,个数,是否绑定], ...], ...} dict
-    def GetNotifyMark(self): return self.attrTuple[12] # 广播提示 char
-    def GetPayType(self): return self.attrTuple[13] # 充值类型 BYTE
+    def GetSelectItemInfo(self): return self.attrTuple[12] # 自选礼包物品信息 [[自选1ID, ...], [自选2ID, ...], ...] list
+    def GetNotifyMark(self): return self.attrTuple[13] # 广播提示 char
+    def GetPayType(self): return self.attrTuple[14] # 充值类型 BYTE
+
+# 充值自选物品表
+class IPY_CTGSelectItem():
+    
+    def __init__(self):
+        self.attrTuple = None
+        return
+        
+    def GetSelectID(self): return self.attrTuple[0] # 自选ID WORD
+    def GetItemID(self): return self.attrTuple[1] # 物品ID DWORD
+    def GetItemCount(self): return self.attrTuple[2] # 物品个数 DWORD
+    def GetIsAuctionItem(self): return self.attrTuple[3] # 是否拍品 BYTE
 
 # 首充表
 class IPY_FirstGold():
@@ -5183,7 +5204,7 @@
     def GetLVLimit(self): return self.attrTuple[3] # 限制等级 WORD
     def GetIsDayReset(self): return self.attrTuple[4] # 是否每天重置 BYTE
     def GetResetType(self): return self.attrTuple[5] # 重置类型,0-0点重置;1-5点重置 BYTE
-    def GetCTGIDInfo(self): return self.attrTuple[6] # 充值ID信息 {ctgID:折扣力度百分比, ...} dict
+    def GetCTGIDList(self): return self.attrTuple[6] # 充值ID列表 [ctgID, ...] list
     def GetCTGCountAwardInfo(self): return self.attrTuple[7] # 累计充值次数额外奖励 dict
 
 # 任务活动时间表
@@ -6056,6 +6077,7 @@
         self.__LoadFileData("SpringSale", onlyCheck)
         self.__LoadFileData("OrderInfo", onlyCheck)
         self.__LoadFileData("CTG", onlyCheck)
+        self.__LoadFileData("CTGSelectItem", onlyCheck)
         self.__LoadFileData("FirstGold", onlyCheck)
         self.__LoadFileData("LVAward", onlyCheck)
         self.__LoadFileData("Invest", onlyCheck)
@@ -7164,6 +7186,13 @@
         self.CheckLoadData("CTG")
         return self.ipyCTGCache[index]
 
+    def GetCTGSelectItemCount(self):
+        self.CheckLoadData("CTGSelectItem")
+        return self.ipyCTGSelectItemLen
+    def GetCTGSelectItemByIndex(self, index):
+        self.CheckLoadData("CTGSelectItem")
+        return self.ipyCTGSelectItemCache[index]
+
     def GetFirstGoldCount(self):
         self.CheckLoadData("FirstGold")
         return self.ipyFirstGoldLen
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py
index 5f0a463..3a1da3e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py
@@ -86,8 +86,7 @@
     ipyData = IpyGameDataPY.GetIpyGameData("ActBuyCountGift", cfgID)
     if not ipyData:
         return
-    ctgIDInfo = ipyData.GetCTGIDInfo()
-    resetCTGIDList = ctgIDInfo.keys()
+    resetCTGIDList = ipyData.GetCTGIDList()
     PlayerCoin.DoResetCTGCountByIDList(curPlayer, "ActBuyCountGift", resetCTGIDList)
     return
 
@@ -109,8 +108,7 @@
     ipyData = IpyGameDataPY.GetIpyGameData("ActBuyCountGift", cfgID)
     if not ipyData:
         return
-    CTGIDInfo= ipyData.GetCTGIDInfo()
-    CTGIDList = CTGIDInfo.keys()
+    CTGIDList = ipyData.GetCTGIDList()
     CTGCountAwardInfo = ipyData.GetCTGCountAwardInfo()
     if buyCount not in CTGCountAwardInfo:
         GameWorld.DebugLog("购买次数礼包没有该次数礼包奖励! actNum=%s,cfgID=%s,buyCount=%s" % (actNum, cfgID, buyCount), playerID)
@@ -168,7 +166,6 @@
     ipyData = IpyGameDataPY.GetIpyGameData("ActBuyCountGift", cfgID)
     if not ipyData:
         return
-    CTGIDInfo = ipyData.GetCTGIDInfo()
     CTGCountAwardInfo = ipyData.GetCTGCountAwardInfo()
     
     startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
@@ -180,13 +177,8 @@
     actInfo.LimitLV = ipyData.GetLVLimit()
     actInfo.IsDayReset = ipyData.GetIsDayReset()
     actInfo.ResetType = ipyData.GetResetType()
-    actInfo.CTGIDInfoList = []
-    for ctgID, discount in CTGIDInfo.items():
-        ctg = ChPyNetSendPack.tagMCActBuyCountCTGID()
-        ctg.CTGID = ctgID
-        ctg.Discount = discount
-        actInfo.CTGIDInfoList.append(ctg)
-    actInfo.CTGIDCount = len(actInfo.CTGIDInfoList)
+    actInfo.CTGIDList = ipyData.GetCTGIDList()
+    actInfo.CTGIDCount = len(actInfo.CTGIDList)
     
     actInfo.BuyCountGiftList = []
     for buyCount, awardItemList in CTGCountAwardInfo.items():
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
index d7cbbc3..705d6e0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -138,6 +138,7 @@
     for i in xrange(ipyDataMgr.GetCTGCount()):
         ipyData = ipyDataMgr.GetCTGByIndex(i)
         recordID = ipyData.GetRecordID()
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGSelectItemValue % recordID, 0)
         if not ipyData.GetCanResetBuyCount():
             continue
         totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
@@ -165,6 +166,7 @@
         return
     playerID = curPlayer.GetPlayerID()
     for recordID in resetCTGIDList:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGSelectItemValue % recordID, 0)
         totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
         todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
         weekBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
@@ -200,9 +202,11 @@
         #if not ipyData.GetDailyBuyCount():
         #    continue
         recordID = ipyData.GetRecordID()
-        if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID):
+        selectItemValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGSelectItemValue % recordID)
+        if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID) and not selectItemValue:
             continue
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGSelectItemValue % recordID, 0)
         syncRecordIDList.append(recordID)
     if syncRecordIDList:
         Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
@@ -252,6 +256,35 @@
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
     recordID = clientData.RecordID
     Sync_CoinToGoldCountInfo(curPlayer, [recordID] if recordID else [])
+    return
+
+#// A1 26 充值自选物品选择 #tagCMSelectCTGItem
+#
+#struct    tagCMSelectCTGItem
+#{
+#    tagHead        Head;
+#    WORD        RecordID;    //充值ID
+#    DWORD        SelectItemValue; // 自选物品索引值,每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
+#};
+def OnSelectCTGItem(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    recordID = clientData.RecordID
+    selectItemValue = clientData.SelectItemValue
+    if selectItemValue > ChConfig.Def_UpperLimit_DWord:
+        GameWorld.ErrLog("充值自选物品选择值溢出! recordID=%s,selectItemValue=%s" % (recordID, selectItemValue), playerID)
+        return
+    ipyData = IpyGameDataPY.GetIpyGameData("CTG", recordID)
+    if not ipyData:
+        return
+    selectItemInfo = ipyData.GetSelectItemInfo()
+    selectItemList, errorInfo = GetSelectItemListInfo(selectItemInfo, selectItemValue)
+    if errorInfo:
+        GameWorld.ErrLog("充值自选物品选择错误! recordID=%s,errorInfo=%s" % (recordID, errorInfo), playerID)
+        return
+    GameWorld.DebugLog("充值自选物品: recordID=%s,selectItemValue=%s,selectItemList=%s" % (recordID, selectItemValue, selectItemList), playerID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGSelectItemValue % recordID, selectItemValue)
+    Sync_CoinToGoldCountInfo(curPlayer, [recordID])
     return
 
 #// A1 25 代币购买充值商品编号商品 #tagCMCoinBuyOrderInfo
@@ -514,6 +547,17 @@
             ExchangePayCoin(curPlayer, "Pay count limit month!monthBuyCount=%s" % monthBuyCount, addDRDict)
             return
         
+    selectItemList = []
+    selectItemInfo = ipyData.GetSelectItemInfo()
+    if selectItemInfo:
+        selectItemValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGSelectItemValue % recordID)
+        addDRDict.update({"selectItemValue":selectItemValue})
+        selectItemList, errorInfo = GetSelectItemListInfo(selectItemInfo, selectItemValue)
+        if errorInfo:
+            ExchangePayCoin(curPlayer, errorInfo, addDRDict)
+            return
+        addDRDict.update({"selectItemList":selectItemList})
+        
     totalBuyCountUpd = min(totalBuyCount + 1, ChConfig.Def_UpperLimit_DWord)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCountUpd)
     addDRDict.update({"totalBuyCountUpd":totalBuyCountUpd})
@@ -530,7 +574,10 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MonthCTGCount % recordID, monthBuyCountUpd)
     addDRDict.update({"monthBuyCountUpd":monthBuyCountUpd})
     
-    giveItemList = GetCTGGiveItemList(ipyData)
+    giveItemList = []
+    giveItemList += GetCTGGiveItemList(ipyData)
+    giveItemList += selectItemList
+    
     moneyType = ipyData.GetMoneyType() # 获得货币类型
     addGold = ipyData.GetGainGold() # 获得货币数
     gainGoldPrize = ipyData.GetGainGoldPrize() # 赠送货币数,首次充值赠送仙玉时,此仙玉不给
@@ -544,6 +591,30 @@
         
     Sync_CoinToGoldCountInfo(curPlayer, [recordID])
     return moneyType, addGold, prizeGold, giveItemList, ipyData
+
+def GetSelectItemListInfo(selectItemInfo, selectItemValue):
+    errorInfo = ""
+    selectItemList = []
+    selectValue = selectItemValue
+    GameWorld.DebugLog("selectItemValue=%s,selectItemInfo=%s" % (selectItemValue, selectItemInfo))
+    for selectNum, selectIDList in enumerate(selectItemInfo, 1):
+        selectIndex = selectValue % 100 - 1 # 记录的时候+1
+        if selectIndex < 0:
+            errorInfo = "Select item is not complete!selectItemValue=%s,selectNum=%s,selectIndex=%s" % (selectItemValue, selectNum, selectIndex)
+            return selectItemList, errorInfo
+        if selectIndex >= len(selectIDList):
+            errorInfo = "Select item index out of range!selectItemValue=%s,selectNum=%s,selectIndex=%s" % (selectItemValue, selectNum, selectIndex)
+            return selectItemList, errorInfo
+        selectID = selectIDList[selectIndex]
+        selectIpyData = IpyGameDataPY.GetIpyGameData("CTGSelectItem", selectID)
+        if not selectIpyData:
+            errorInfo = "SelectID is not exist!selectItemValue=%s,selectNum=%s,selectIndex=%s,selectID=%s" % (selectItemValue, selectNum, selectIndex, selectID)
+            return selectItemList, errorInfo
+        selectItemList.append([selectIpyData.GetItemID(), selectIpyData.GetItemCount(), selectIpyData.GetIsAuctionItem()])
+        selectValue = selectValue / 100
+        GameWorld.DebugLog("    selectNum=%s,selectIndex=%s,selectID=%s,selectItemList=%s,selectItemValue=%s" 
+                           % (selectNum, selectIndex, selectID, selectItemList, selectItemValue))
+    return selectItemList, errorInfo
 
 def GetCTGGiveItemList(ipyData):
     ## 获取充值ID对应给物品列表
@@ -792,6 +863,7 @@
         countInfo.TotalPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
         countInfo.WeekPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
         countInfo.MonthPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MonthCTGCount % recordID)
+        countInfo.SelectItemValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGSelectItemValue % recordID)
         countInfoPack.CTGCountInfoList.append(countInfo)
     countInfoPack.RecordCount = len(countInfoPack.CTGCountInfoList)
     NetPackCommon.SendFakePack(curPlayer, countInfoPack)

--
Gitblit v1.8.0