From 2df1f14875b84da3bc57e7e9d3448ff852fb487e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 09 十月 2019 15:51:20 +0800
Subject: [PATCH] 8299 【恺英】【开发】新增每日直购(增加每日免费直购礼包领取支持)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 52 +++++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py | 18 ++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py | 45 +++++++++++++++
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 52 +++++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 4 +
5 files changed, 166 insertions(+), 5 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index a8989cc..b994baa 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -24074,6 +24074,58 @@
#------------------------------------------------------
+# AA 24 每日免费直购礼包信息 #tagMCDayFreeGoldGiftState
+
+class tagMCDayFreeGoldGiftState(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("DayFreeGoldGiftState", c_ubyte), #每日免费直购礼包是否已领奖 0-未领 1-已领
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xAA
+ self.SubCmd = 0x24
+ 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 = 0xAA
+ self.SubCmd = 0x24
+ self.DayFreeGoldGiftState = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagMCDayFreeGoldGiftState)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// AA 24 每日免费直购礼包信息 //tagMCDayFreeGoldGiftState:
+ Cmd:%s,
+ SubCmd:%s,
+ DayFreeGoldGiftState:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.DayFreeGoldGiftState
+ )
+ return DumpString
+
+
+m_NAtagMCDayFreeGoldGiftState=tagMCDayFreeGoldGiftState()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCDayFreeGoldGiftState.Cmd,m_NAtagMCDayFreeGoldGiftState.SubCmd))] = m_NAtagMCDayFreeGoldGiftState
+
+
+#------------------------------------------------------
# AA 20 节日巡礼活动信息 #tagMCFeastWeekPartyInfo
class tagMCFeastWeekPartyItem(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index e4d72bd..89fa4c6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3460,6 +3460,7 @@
Def_PDict_TodayCTGCoinTotal = "TodayCTGCoinTotal" # 当日充值Coin数
Def_PDict_TodayCTGCount = "TodayCTGCount_%s" # 当日充值次数,参数(CTG对应的商品记录ID)
Def_PDict_CTGGoodsBuyCount = "CTGGoodsBuyCount_%s" # 对应充值商品已购买次数,参数(CTG对应的商品记录ID)
+Def_PDict_DayFreeGoldGiftState = "DayFreeGoldGiftState" # 每日免费直购礼包领取记录
Def_PDict_GoldGiftFirstRecord = "GoldGiftFirstRecord" # 首充领取记录,0-未领取;1-已领取
Def_PDict_FirstGoldRemainTime = "FirstGoldRemainTime" # 首充提示剩余时间
Def_PDict_FirstGoldTipStartTime = "FirstGoldTipStartTime" # 首充提示开始时间
@@ -5237,7 +5238,8 @@
Def_RewardType_FeastWeekPartyPoint, # 领取节日巡礼积分奖励26
Def_RewardType_FairyAdventuresAward, #缥缈奇遇领取27
Def_RewardType_HistoryChargeAward, #历史累计充值领取28
-)= range(29)
+Def_RewardType_DayFreeGoldGift, #每日免费直购礼包29
+)= range(30)
#boss复活相关活动定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index a8989cc..b994baa 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -24074,6 +24074,58 @@
#------------------------------------------------------
+# AA 24 每日免费直购礼包信息 #tagMCDayFreeGoldGiftState
+
+class tagMCDayFreeGoldGiftState(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("DayFreeGoldGiftState", c_ubyte), #每日免费直购礼包是否已领奖 0-未领 1-已领
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xAA
+ self.SubCmd = 0x24
+ 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 = 0xAA
+ self.SubCmd = 0x24
+ self.DayFreeGoldGiftState = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagMCDayFreeGoldGiftState)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// AA 24 每日免费直购礼包信息 //tagMCDayFreeGoldGiftState:
+ Cmd:%s,
+ SubCmd:%s,
+ DayFreeGoldGiftState:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.DayFreeGoldGiftState
+ )
+ return DumpString
+
+
+m_NAtagMCDayFreeGoldGiftState=tagMCDayFreeGoldGiftState()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCDayFreeGoldGiftState.Cmd,m_NAtagMCDayFreeGoldGiftState.SubCmd))] = m_NAtagMCDayFreeGoldGiftState
+
+
+#------------------------------------------------------
# AA 20 节日巡礼活动信息 #tagMCFeastWeekPartyInfo
class tagMCFeastWeekPartyItem(Structure):
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 315394c..8d0e19d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5271,10 +5271,17 @@
resultName, len(resultName))
return
-## //A5 04 玩家领取奖励 # tagCMPlayerGetReward
-## 领取奖励
-# @param None None
-# @return None
+#//A5 04 玩家领取奖励 #tagCMPlayerGetReward
+#
+#struct tagCMPlayerGetReward
+#
+#{
+# tagHead Head;
+# BYTE RewardType; //奖励类型
+# DWORD DataEx; //附带信息
+# BYTE DataExStrLen; //附加字符信息长度
+# char DataExStr[DataExStrLen]; //附加字符信息
+#};
def PlayerGetReward(index, clientData, tick):
playerManager = GameWorld.GetPlayerManager()
curPlayer = playerManager.GetPlayerByIndex(index)
@@ -5288,6 +5295,9 @@
# 活跃度奖励
if rewardType == ChConfig.Def_RewardType_Activity:
PlayerActivity.GetActivityAward(curPlayer, dataEx)
+ # 每日免费直购礼包
+ elif rewardType == ChConfig.Def_RewardType_DayFreeGoldGift:
+ PlayerCoin.OnGetDayFreeGoldGift(curPlayer)
# 仙盟活跃度奖励
elif rewardType == ChConfig.Def_RewardType_FamilyActivity:
PlayerFamily.GetFamilyActivityAward(curPlayer, dataEx)
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 f9e530f..aa4b2a0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -64,6 +64,8 @@
def OnLogin(curPlayer):
if not DoResetCTGCountByTime(curPlayer):
Sync_CoinToGoldCountInfo(curPlayer)
+ if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
+ Sync_DayFreeGoldGiftState(curPlayer)
return
def DoResetCTGCountByTime(curPlayer):
@@ -130,6 +132,10 @@
syncRecordIDList.append(recordID)
if syncRecordIDList:
Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
+
+ if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 0)
+ Sync_DayFreeGoldGiftState(curPlayer)
return
## 创角赠送
@@ -422,3 +428,42 @@
NetPackCommon.SendFakePack(curPlayer, countInfoPack)
return
+## ---------- 每日免费直购礼包 ----------------
+
+def OnGetDayFreeGoldGift(curPlayer):
+ ''' 领取每日免费直购礼包
+ '''
+
+ isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
+ if isGet:
+ #GameWorld.DebugLog("已经领取过每日免费直购礼包!")
+ return
+
+ rewardItemList = IpyGameDataPY.GetFuncEvalCfg("DayFreeGoldGift", 1)
+ if not rewardItemList:
+ return
+
+ needSpace = len(rewardItemList)
+ packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
+ if needSpace > packSpace:
+ PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+ return
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 1)
+
+ # 给物品
+ isAuctionItem = False
+ for itemID, itemCount in rewardItemList:
+ ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
+
+ # 通知客户端
+ Sync_DayFreeGoldGiftState(curPlayer)
+ return
+
+def Sync_DayFreeGoldGiftState(curPlayer):
+ clientPack = ChPyNetSendPack.tagMCDayFreeGoldGiftState()
+ clientPack.DayFreeGoldGiftState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
+ NetPackCommon.SendFakePack(curPlayer, clientPack)
+ return
+
+## ------------------------------------------
--
Gitblit v1.8.0