10208 10206 【越南】新增大额战令(新增登录战令;战令支持高级战令;)
| | |
| | | BYTE RewardIndex; //奖励记录索引,0~n,同个战令类型不可重复
|
| | | list FreeRewardItemList; //免费奖励物品列表 [[物品ID,个数,是否拍品],...]
|
| | | list ZLRewardItemList; //战令奖励物品列表 [[物品ID,个数,是否拍品],...]
|
| | | list ZLRewardItemListH; //高级战令奖励物品列表 [[物品ID,个数,是否拍品],...]
|
| | | };
|
| | |
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NeedValue", c_int), # 奖励所需值
|
| | | ("FreeRewardState", c_ubyte), # 免费奖励是否已领取
|
| | | ("ZLRewardState", c_ubyte), # 战令奖励是否已领取
|
| | | ("FreeRewardState", c_ubyte), # 免费战令奖励是否已领取
|
| | | ("ZLRewardState", c_ubyte), # 普通战令奖励是否已领取
|
| | | ("ZLRewardStateH", c_ubyte), # 高级战令奖励是否已领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.NeedValue = 0
|
| | | self.FreeRewardState = 0
|
| | | self.ZLRewardState = 0
|
| | | self.ZLRewardStateH = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | DumpString = '''// B1 20 战令信息 //tagMCZhanlingInfo:
|
| | | NeedValue:%d,
|
| | | FreeRewardState:%d,
|
| | | ZLRewardState:%d
|
| | | ZLRewardState:%d,
|
| | | ZLRewardStateH:%d
|
| | | '''\
|
| | | %(
|
| | | self.NeedValue,
|
| | | self.FreeRewardState,
|
| | | self.ZLRewardState
|
| | | self.ZLRewardState,
|
| | | self.ZLRewardStateH
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | class tagMCZhanlingInfo(Structure):
|
| | | Head = tagHead()
|
| | | ZhanlingType = 0 #(BYTE ZhanlingType)// 战令类型
|
| | | IsActivite = 0 #(BYTE IsActivite)// 是否已激活
|
| | | IsActivite = 0 #(BYTE IsActivite)// 普通战令是否已激活
|
| | | IsActiviteH = 0 #(BYTE IsActiviteH)// 高级战令是否已激活
|
| | | Value1 = 0 #(DWORD Value1)// 战令对应的自定义值,可选,如登录战令代表开始计算日期时间戳
|
| | | RewardCount = 0 #(WORD RewardCount)
|
| | | RewardList = list() #(vector<tagMCZhanling> RewardList)
|
| | | data = None
|
| | |
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.ZhanlingType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.IsActivite,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.IsActiviteH,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Value1,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RewardCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | for i in range(self.RewardCount):
|
| | | temRewardList = tagMCZhanling()
|
| | |
| | | self.Head.SubCmd = 0x20
|
| | | self.ZhanlingType = 0
|
| | | self.IsActivite = 0
|
| | | self.IsActiviteH = 0
|
| | | self.Value1 = 0
|
| | | self.RewardCount = 0
|
| | | self.RewardList = list()
|
| | | return
|
| | |
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1
|
| | | length += 1
|
| | | length += 4
|
| | | length += 2
|
| | | for i in range(self.RewardCount):
|
| | | length += self.RewardList[i].GetLength()
|
| | |
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.ZhanlingType)
|
| | | data = CommFunc.WriteBYTE(data, self.IsActivite)
|
| | | data = CommFunc.WriteBYTE(data, self.IsActiviteH)
|
| | | data = CommFunc.WriteDWORD(data, self.Value1)
|
| | | data = CommFunc.WriteWORD(data, self.RewardCount)
|
| | | for i in range(self.RewardCount):
|
| | | data = CommFunc.WriteString(data, self.RewardList[i].GetLength(), self.RewardList[i].GetBuffer())
|
| | |
| | | Head:%s,
|
| | | ZhanlingType:%d,
|
| | | IsActivite:%d,
|
| | | IsActiviteH:%d,
|
| | | Value1:%d,
|
| | | RewardCount:%d,
|
| | | RewardList:%s
|
| | | '''\
|
| | |
| | | self.Head.OutputString(),
|
| | | self.ZhanlingType,
|
| | | self.IsActivite,
|
| | | self.IsActiviteH,
|
| | | self.Value1,
|
| | | self.RewardCount,
|
| | | "..."
|
| | | )
|
| | |
| | | Def_PDict_DailyPackBuyGiftOnDayTime = "DailyPackBuyGiftOnDayTime" # 每日打包直购礼包 - 上次处理过天时间戳
|
| | |
|
| | | #战令
|
| | | Def_PDict_ZhanlingValue1 = "ZhanlingValue1_%s" # 战令类型对应自定义值1,参数(类型)
|
| | | Def_PDict_ZhanlingState = "ZhanlingState" # 战令已激活状态,按类型二进制位运算记录是否已激活
|
| | | Def_PDict_ZhanlingStateH = "ZhanlingStateH" # 高级战令已激活状态,按类型二进制位运算记录是否已激活
|
| | | Def_PDict_ZhanlingReward = "ZhanlingReward_%s_%s" # 战令奖励领取记录,按类型二进制位运算记录是否已领取,参数(类型,key编号)
|
| | | Def_PDict_ZhanlingRewardH = "ZhanlingRewardH_%s_%s" # 高级战令奖励领取记录,按类型二进制位运算记录是否已领取,参数(类型,key编号)
|
| | | Def_PDict_ZhanlingRewardFree = "ZhanlingRewardFree_%s_%s" # 战令免费奖励领取记录,按类型二进制位运算记录是否已领取,参数(类型,key编号)
|
| | |
|
| | | #登录活动新
|
| | |
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NeedValue", c_int), # 奖励所需值
|
| | | ("FreeRewardState", c_ubyte), # 免费奖励是否已领取
|
| | | ("ZLRewardState", c_ubyte), # 战令奖励是否已领取
|
| | | ("FreeRewardState", c_ubyte), # 免费战令奖励是否已领取
|
| | | ("ZLRewardState", c_ubyte), # 普通战令奖励是否已领取
|
| | | ("ZLRewardStateH", c_ubyte), # 高级战令奖励是否已领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.NeedValue = 0
|
| | | self.FreeRewardState = 0
|
| | | self.ZLRewardState = 0
|
| | | self.ZLRewardStateH = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | DumpString = '''// B1 20 战令信息 //tagMCZhanlingInfo:
|
| | | NeedValue:%d,
|
| | | FreeRewardState:%d,
|
| | | ZLRewardState:%d
|
| | | ZLRewardState:%d,
|
| | | ZLRewardStateH:%d
|
| | | '''\
|
| | | %(
|
| | | self.NeedValue,
|
| | | self.FreeRewardState,
|
| | | self.ZLRewardState
|
| | | self.ZLRewardState,
|
| | | self.ZLRewardStateH
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | class tagMCZhanlingInfo(Structure):
|
| | | Head = tagHead()
|
| | | ZhanlingType = 0 #(BYTE ZhanlingType)// 战令类型
|
| | | IsActivite = 0 #(BYTE IsActivite)// 是否已激活
|
| | | IsActivite = 0 #(BYTE IsActivite)// 普通战令是否已激活
|
| | | IsActiviteH = 0 #(BYTE IsActiviteH)// 高级战令是否已激活
|
| | | Value1 = 0 #(DWORD Value1)// 战令对应的自定义值,可选,如登录战令代表开始计算日期时间戳
|
| | | RewardCount = 0 #(WORD RewardCount)
|
| | | RewardList = list() #(vector<tagMCZhanling> RewardList)
|
| | | data = None
|
| | |
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.ZhanlingType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.IsActivite,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.IsActiviteH,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Value1,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RewardCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | for i in range(self.RewardCount):
|
| | | temRewardList = tagMCZhanling()
|
| | |
| | | self.Head.SubCmd = 0x20
|
| | | self.ZhanlingType = 0
|
| | | self.IsActivite = 0
|
| | | self.IsActiviteH = 0
|
| | | self.Value1 = 0
|
| | | self.RewardCount = 0
|
| | | self.RewardList = list()
|
| | | return
|
| | |
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1
|
| | | length += 1
|
| | | length += 4
|
| | | length += 2
|
| | | for i in range(self.RewardCount):
|
| | | length += self.RewardList[i].GetLength()
|
| | |
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.ZhanlingType)
|
| | | data = CommFunc.WriteBYTE(data, self.IsActivite)
|
| | | data = CommFunc.WriteBYTE(data, self.IsActiviteH)
|
| | | data = CommFunc.WriteDWORD(data, self.Value1)
|
| | | data = CommFunc.WriteWORD(data, self.RewardCount)
|
| | | for i in range(self.RewardCount):
|
| | | data = CommFunc.WriteString(data, self.RewardList[i].GetLength(), self.RewardList[i].GetBuffer())
|
| | |
| | | Head:%s,
|
| | | ZhanlingType:%d,
|
| | | IsActivite:%d,
|
| | | IsActiviteH:%d,
|
| | | Value1:%d,
|
| | | RewardCount:%d,
|
| | | RewardList:%s
|
| | | '''\
|
| | |
| | | self.Head.OutputString(),
|
| | | self.ZhanlingType,
|
| | | self.IsActivite,
|
| | | self.IsActiviteH,
|
| | | self.Value1,
|
| | | self.RewardCount,
|
| | | "..."
|
| | | )
|
| | |
| | | ("BYTE", "RewardIndex", 0),
|
| | | ("list", "FreeRewardItemList", 0),
|
| | | ("list", "ZLRewardItemList", 0),
|
| | | ("list", "ZLRewardItemListH", 0),
|
| | | ),
|
| | | }
|
| | |
|
| | |
| | | def GetNeedValue(self): return self.attrTuple[1] # 所需值 DWORD
|
| | | def GetRewardIndex(self): return self.attrTuple[2] # 奖励记录索引,0~n,同个战令类型不可重复 BYTE
|
| | | def GetFreeRewardItemList(self): return self.attrTuple[3] # 免费奖励物品列表 [[物品ID,个数,是否拍品],...] list
|
| | | def GetZLRewardItemList(self): return self.attrTuple[4] # 战令奖励物品列表 [[物品ID,个数,是否拍品],...] list |
| | | def GetZLRewardItemList(self): return self.attrTuple[4] # 战令奖励物品列表 [[物品ID,个数,是否拍品],...] list
|
| | | def GetZLRewardItemListH(self): return self.attrTuple[5] # 高级战令奖励物品列表 [[物品ID,个数,是否拍品],...] list |
| | |
|
| | |
|
| | | def Log(msg, playerID=0, par=0):
|
| | |
| | | import IPY_GameWorld
|
| | | import PlayerGubao
|
| | | import ChConfig
|
| | | import time
|
| | |
|
| | | # 战令类型
|
| | | ZhanlingTypeList = (
|
| | |
| | | ZhanlingType_Realm,
|
| | | ZhanlingType_SkyTower,
|
| | | ZhanlingType_GubaoStar,
|
| | | ) = range(1, 1 + 4)
|
| | | ZhanlingType_Login,
|
| | | ) = range(1, 1 + 5)
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | for zhanlingType in ZhanlingTypeList:
|
| | | if zhanlingType == ZhanlingType_Login:
|
| | | value1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingValue1 % zhanlingType)
|
| | | if not value1:
|
| | | firstLoginTime = int(time.time())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhanlingValue1 % zhanlingType, firstLoginTime)
|
| | | GameWorld.DebugLog("设置登录战令首次登录时间: %s" % firstLoginTime, curPlayer.GetPlayerID())
|
| | | SyncZhanlingInfo(curPlayer, zhanlingType)
|
| | | return
|
| | |
|
| | |
| | | updState = state|pow(2, zhanlingType)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhanlingState, updState)
|
| | | SyncZhanlingInfo(curPlayer, zhanlingType)
|
| | | GameWorld.Log("激活战令: zhanlingType=%s,updState=%s" % (zhanlingType, updState), curPlayer.GetPlayerID())
|
| | | GameWorld.Log("激活战令普通: zhanlingType=%s,updState=%s" % (zhanlingType, updState), curPlayer.GetPlayerID())
|
| | | break
|
| | |
|
| | | # 高级战令
|
| | | zhanlingCTGIDDictH = IpyGameDataPY.GetFuncEvalCfg("Zhanling", 3)
|
| | | for zhanlingTypeStr, ctgIDList in zhanlingCTGIDDictH.items():
|
| | | if ctgID not in ctgIDList:
|
| | | continue
|
| | | zhanlingType = int(zhanlingTypeStr)
|
| | | state = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingStateH)
|
| | | if state&pow(2, zhanlingType):
|
| | | break
|
| | | |
| | | updState = state|pow(2, zhanlingType)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhanlingStateH, updState)
|
| | | SyncZhanlingInfo(curPlayer, zhanlingType)
|
| | | GameWorld.Log("激活战令高级: zhanlingType=%s,updState=%s" % (zhanlingType, updState), curPlayer.GetPlayerID())
|
| | | break
|
| | | return
|
| | |
|
| | | def GetZhanlingReward(curPlayer, zhanlingType, rewardID):
|
| | | ## 领取战令奖励
|
| | | rewardID = GameWorld.ToIntDef(rewardID)
|
| | | needValue, isFree = rewardID/10, rewardID%10
|
| | | needValue, rewardType = rewardID/10, rewardID%10 # rewardType: 0-免费;1-普通;2-高级
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Zhanling", zhanlingType, needValue)
|
| | |
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerFloor)
|
| | | elif zhanlingType == ZhanlingType_GubaoStar:
|
| | | _, curValue = PlayerGubao.GetGubaoTotalLVStar(curPlayer)
|
| | | elif zhanlingType == ZhanlingType_Login:
|
| | | firstLoginTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingValue1 % zhanlingType)
|
| | | if not firstLoginTime:
|
| | | return
|
| | | curValue = GameWorld.GetDiff_Day(int(time.time()), firstLoginTime) + 1 |
| | | else:
|
| | | return
|
| | |
|
| | |
| | | rewardIndex = ipyData.GetRewardIndex()
|
| | | itemList = ipyData.GetFreeRewardItemList()
|
| | | rewardKey = ChConfig.Def_PDict_ZhanlingRewardFree
|
| | | if not isFree:
|
| | | if rewardType == 1:
|
| | | itemList = ipyData.GetZLRewardItemList()
|
| | | rewardKey = ChConfig.Def_PDict_ZhanlingReward
|
| | | state = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingState)
|
| | | if not state&pow(2, zhanlingType):
|
| | | GameWorld.DebugLog("战令未激活,无法领取战令奖励: zhanlingType=%s,state=%s,isFree=%s" % (zhanlingType, state, isFree), playerID)
|
| | | GameWorld.DebugLog("普通战令未激活,无法领取战令奖励: zhanlingType=%s,state=%s" % (zhanlingType, state), playerID)
|
| | | return
|
| | | elif rewardType == 2:
|
| | | itemList = ipyData.GetZLRewardItemListH()
|
| | | rewardKey = ChConfig.Def_PDict_ZhanlingRewardH
|
| | | state = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingStateH)
|
| | | if not state&pow(2, zhanlingType):
|
| | | GameWorld.DebugLog("高级战令未激活,无法领取战令奖励: zhanlingType=%s,state=%s" % (zhanlingType, state), playerID)
|
| | | return
|
| | |
|
| | | if not itemList:
|
| | | GameWorld.DebugLog("没有该战令奖励! zhanlingType=%s,needValue=%s,rewardType=%s" % (zhanlingType, needValue, rewardType), playerID)
|
| | | return
|
| | | |
| | | if GameWorld.GetDictValueByBit(curPlayer, rewardKey, rewardIndex, True, [zhanlingType]):
|
| | | GameWorld.DebugLog("已经领取过该战令奖励! zhanlingType=%s,needValue=%s,isFree=%s" % (zhanlingType, needValue, isFree), playerID)
|
| | | GameWorld.DebugLog("已经领取过该战令奖励! zhanlingType=%s,needValue=%s,rewardType=%s" % (zhanlingType, needValue, rewardType), playerID)
|
| | | return
|
| | |
|
| | | # 检查背包
|
| | |
| | | # 更新已领取成功标记
|
| | | GameWorld.SetDictValueByBit(curPlayer, rewardKey, rewardIndex, 1, True, [zhanlingType])
|
| | | SyncZhanlingInfo(curPlayer, zhanlingType, ipyData)
|
| | | GameWorld.DebugLog("领取战令奖励: zhanlingType=%s,needValue=%s,isFree=%s" % (zhanlingType, needValue, isFree), playerID)
|
| | | GameWorld.DebugLog("领取战令奖励: zhanlingType=%s,needValue=%s,rewardType=%s,itemList=%s" % (zhanlingType, needValue, rewardType, itemList), playerID)
|
| | |
|
| | | # 给物品
|
| | | for itemID, itemCount, isAuctionItem in itemList:
|
| | |
| | | reward.NeedValue = ipyData.GetNeedValue()
|
| | | reward.FreeRewardState = 1 if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ZhanlingRewardFree, rewardIndex, True, [zhanlingType]) else 0
|
| | | reward.ZLRewardState = 1 if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ZhanlingReward, rewardIndex, True, [zhanlingType]) else 0
|
| | | reward.ZLRewardStateH = 1 if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ZhanlingRewardH, rewardIndex, True, [zhanlingType]) else 0
|
| | | rewardList.append(reward)
|
| | |
|
| | | clientPack = ChPyNetSendPack.tagMCZhanlingInfo()
|
| | | clientPack.Clear()
|
| | | clientPack.ZhanlingType = zhanlingType
|
| | | clientPack.IsActivite = 1 if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingState)&pow(2, zhanlingType) else 0
|
| | | clientPack.IsActiviteH = 1 if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingStateH)&pow(2, zhanlingType) else 0
|
| | | clientPack.Value1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhanlingValue1 % zhanlingType)
|
| | | clientPack.RewardList = rewardList
|
| | | clientPack.RewardCount = len(clientPack.RewardList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|