From c32b4159c5f33b4badd3d5f2a2c06923dda55ec4 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 09 二月 2021 10:59:09 +0800
Subject: [PATCH] 8716 【主干】【后端】【BT2】H.活动-节日祈愿(节日登录优化已登录天不限制领取天);
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 56 ++++++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py | 37 +++++++++---
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 56 ++++++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 1
4 files changed, 141 insertions(+), 9 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 94de87d..51c31cb 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -27426,6 +27426,62 @@
#------------------------------------------------------
+# AA 39 节日登录奖励活动玩家信息 #tagMCFeastLoginPlayerInfo
+
+class tagMCFeastLoginPlayerInfo(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("LoginState", c_int), # 是否已登录,按天索引0代表第1天记录当天是否已登录
+ ("LoginAward", c_int), # 是否已领取,按天索引0代表第1天记录当天是否已领取
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xAA
+ self.SubCmd = 0x39
+ 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 = 0x39
+ self.LoginState = 0
+ self.LoginAward = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagMCFeastLoginPlayerInfo)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// AA 39 节日登录奖励活动玩家信息 //tagMCFeastLoginPlayerInfo:
+ Cmd:%s,
+ SubCmd:%s,
+ LoginState:%d,
+ LoginAward:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.LoginState,
+ self.LoginAward
+ )
+ return DumpString
+
+
+m_NAtagMCFeastLoginPlayerInfo=tagMCFeastLoginPlayerInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFeastLoginPlayerInfo.Cmd,m_NAtagMCFeastLoginPlayerInfo.SubCmd))] = m_NAtagMCFeastLoginPlayerInfo
+
+
+#------------------------------------------------------
# AA 46 节日游历活动信息 #tagMCFeastTravelInfo
class tagMCFeastTravelAwardItem(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 31dadec..8a4916b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3828,6 +3828,7 @@
#节日登录活动
Def_PDict_FeastLoginID = "FeastLoginID" # 玩家身上的活动ID,唯一标识,取活动开始日期time值
+Def_PDict_FeastLoginState = "FeastLoginState" # 活动登录记录,按天编号-1为索引进行二进制位运算记录当天是否已登录
Def_PDict_FeastLoginAwardState = "FeastLoginAwardState" # 活动登录领奖记录,按天编号-1为索引进行二进制位运算记录当天是否已领奖
#节日祝福活动
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 94de87d..51c31cb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -27426,6 +27426,62 @@
#------------------------------------------------------
+# AA 39 节日登录奖励活动玩家信息 #tagMCFeastLoginPlayerInfo
+
+class tagMCFeastLoginPlayerInfo(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("LoginState", c_int), # 是否已登录,按天索引0代表第1天记录当天是否已登录
+ ("LoginAward", c_int), # 是否已领取,按天索引0代表第1天记录当天是否已领取
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xAA
+ self.SubCmd = 0x39
+ 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 = 0x39
+ self.LoginState = 0
+ self.LoginAward = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagMCFeastLoginPlayerInfo)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// AA 39 节日登录奖励活动玩家信息 //tagMCFeastLoginPlayerInfo:
+ Cmd:%s,
+ SubCmd:%s,
+ LoginState:%d,
+ LoginAward:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.LoginState,
+ self.LoginAward
+ )
+ return DumpString
+
+
+m_NAtagMCFeastLoginPlayerInfo=tagMCFeastLoginPlayerInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFeastLoginPlayerInfo.Cmd,m_NAtagMCFeastLoginPlayerInfo.SubCmd))] = m_NAtagMCFeastLoginPlayerInfo
+
+
+#------------------------------------------------------
# AA 46 节日游历活动信息 #tagMCFeastTravelInfo
class tagMCFeastTravelAwardItem(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py
index ea11272..fbcc757 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py
@@ -25,7 +25,6 @@
import NetPackCommon
import GameWorld
import ChConfig
-import ChPlayer
def OnPlayerLogin(curPlayer):
isReset = __CheckPlayerFeastLoginAction(curPlayer)
@@ -33,6 +32,7 @@
actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastLogin, {})
# 活动中同步活动信息
if actInfo.get(ShareDefine.ActKey_State):
+ __SetLoginByDayIndex(curPlayer, actInfo)
Sync_FeastLoginActionInfo(curPlayer)
Sync_FeastLoginPlayerInfo(curPlayer)
return
@@ -60,14 +60,31 @@
# 活动ID 相同的话不处理
if actID == playerActID:
GameWorld.DebugLog("节日登录活动ID不变,不处理!", curPlayer.GetPlayerID())
+ if state:
+ if __SetLoginByDayIndex(curPlayer, actInfo):
+ Sync_FeastLoginPlayerInfo(curPlayer)
return
GameWorld.DebugLog("节日登录活动重置! actID=%s,playerActID=%s,state=%s" % (actID, playerActID, state), playerID)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginID, actID)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginState, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginAwardState, 0)
- Sync_FeastLoginActionInfo(curPlayer)
- Sync_FeastLoginPlayerInfo(curPlayer)
+ if state:
+ __SetLoginByDayIndex(curPlayer, actInfo)
+ Sync_FeastLoginActionInfo(curPlayer)
+ Sync_FeastLoginPlayerInfo(curPlayer)
+ return True
+
+def __SetLoginByDayIndex(curPlayer, actInfo):
+ ## 设置某一天已登录,可领奖
+ dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0)
+ loginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginState)
+ if loginState & pow(2, dayIndex):
+ return
+ updLoginState = loginState | pow(2, dayIndex)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginState, updLoginState)
+ GameWorld.DebugLog(" 节日登录设置天登录: dayIndex=%s,loginState=%s,updLoginState=%s" % (dayIndex, loginState, updLoginState))
return True
def GetFeastLoginAward(curPlayer, dayNum):
@@ -107,14 +124,14 @@
return
awardIndex = dayNum - 1
- dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex)
- if awardIndex != dayIndex:
- GameWorld.DebugLog("非当天奖励,不可领奖! dayNum=%s, awardIndex=%s != dayIndex=%s" % (dayNum, awardIndex, dayIndex))
+ loginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginState)
+ if not loginState & pow(2, awardIndex):
+ GameWorld.DebugLog("节日登录活动该天未登录,无法领奖!dayNum=%s,awardIndex=%s,loginState=%s" % (dayNum, awardIndex, loginState))
return
awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginAwardState)
if awardRecord & pow(2, awardIndex):
- GameWorld.DebugLog("节日登录活动该天已领奖!dayNum=%s" % dayNum)
+ GameWorld.DebugLog("节日登录活动该天已领奖!dayNum=%s,awardIndex=%s,awardRecord=%s" % (dayNum, awardIndex, awardRecord))
return
awardItemList = findIpyData.GetLoginAwardItemList()
@@ -135,8 +152,10 @@
def Sync_FeastLoginPlayerInfo(curPlayer):
## 通知活动玩家信息
- awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginAwardState)
- ChPlayer.Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_FeastLogin, awardState)
+ clientPack = ChPyNetSendPack.tagMCFeastLoginPlayerInfo()
+ clientPack.LoginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginState)
+ clientPack.LoginAward = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginAwardState)
+ NetPackCommon.SendFakePack(curPlayer, clientPack)
return
def Sync_FeastLoginActionInfo(curPlayer):
--
Gitblit v1.8.0