| | |
| | | BYTE ActionType; //活动条目ID
|
| | | DWORD TotalTimes; //可完成的总次数,0表示不限次数
|
| | | WORD SingleTimes; //单次领奖需要的次数
|
| | | list Reward; //奖励物品
|
| | | char Reward; //奖励物品
|
| | | };
|
| | |
|
| | | //诛仙装备套装属性表
|
| | |
| | | #------------------------------------------------------
|
| | | # AA 0C 登录奖励活动信息 #tagMCActLoginAwardInfo
|
| | |
|
| | | class tagMCActLoginAwardItem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("ItemID", c_int), # 物品ID
|
| | | ("ItemCnt", c_ushort), # 物品数量
|
| | | ("IsBind", c_ubyte), # 是否绑定
|
| | | ]
|
| | |
|
| | | 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.ItemID = 0
|
| | | self.ItemCnt = 0
|
| | | self.IsBind = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCActLoginAwardItem)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// AA 0C 登录奖励活动信息 //tagMCActLoginAwardInfo:
|
| | | ItemID:%d,
|
| | | ItemCnt:%d,
|
| | | IsBind:%d
|
| | | '''\
|
| | | %(
|
| | | self.ItemID,
|
| | | self.ItemCnt,
|
| | | self.IsBind
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCActLoginAwardAction(Structure):
|
| | | TemplateID = 0 #(DWORD TemplateID)// 模板ID
|
| | | ActionType = 0 #(WORD ActionType)// 活动类别
|
| | | TotalTimes = 0 #(DWORD TotalTimes)// 可完成的总次数,0表示不限次数
|
| | | SingleTimes = 0 #(DWORD SingleTimes)// 单次领奖需要的次数
|
| | | Count = 0 #(BYTE Count)// 物品数
|
| | | ItemInfo = list() #(vector<tagMCActLoginAwardItem> ItemInfo)// 物品信息
|
| | | Count = 0 #(WORD Count)// 物品配置长度
|
| | | ItemInfo = "" #(String ItemInfo)// 物品信息
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.ActionType,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.TotalTimes,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.SingleTimes,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temItemInfo = tagMCActLoginAwardItem()
|
| | | _pos = temItemInfo.ReadData(_lpData, _pos)
|
| | | self.ItemInfo.append(temItemInfo)
|
| | | self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.ItemInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.Count)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.TotalTimes = 0
|
| | | self.SingleTimes = 0
|
| | | self.Count = 0
|
| | | self.ItemInfo = list()
|
| | | self.ItemInfo = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 2
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.Count):
|
| | | length += self.ItemInfo[i].GetLength()
|
| | | length += 2
|
| | | length += len(self.ItemInfo)
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteWORD(data, self.ActionType)
|
| | | data = CommFunc.WriteDWORD(data, self.TotalTimes)
|
| | | data = CommFunc.WriteDWORD(data, self.SingleTimes)
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.ItemInfo[i].GetLength(), self.ItemInfo[i].GetBuffer())
|
| | | data = CommFunc.WriteWORD(data, self.Count)
|
| | | data = CommFunc.WriteString(data, self.Count, self.ItemInfo)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | self.TotalTimes,
|
| | | self.SingleTimes,
|
| | | self.Count,
|
| | | "..."
|
| | | self.ItemInfo
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | class tagMCActLoginAwardDayInfo(Structure):
|
| | | ActCnt = 0 #(BYTE ActCnt)// 数量
|
| | | TemplateList = list() #(vector<WORD> TemplateList)// 模板列表
|
| | | WorldLV = 0 #(WORD WorldLV)// 世界等级
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | for i in range(self.ActCnt):
|
| | | value,_pos=CommFunc.ReadWORD(_lpData,_pos)
|
| | | self.TemplateList.append(value)
|
| | | self.WorldLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.ActCnt = 0
|
| | | self.TemplateList = list()
|
| | | self.WorldLV = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 2 * self.ActCnt
|
| | | length += 2
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.ActCnt)
|
| | | for i in range(self.ActCnt):
|
| | | data = CommFunc.WriteWORD(data, self.TemplateList[i])
|
| | | data = CommFunc.WriteWORD(data, self.WorldLV)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | ActCnt:%d,
|
| | | TemplateList:%s
|
| | | TemplateList:%s,
|
| | | WorldLV:%d
|
| | | '''\
|
| | | %(
|
| | | self.ActCnt,
|
| | | "..."
|
| | | "...",
|
| | | self.WorldLV
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | import PlayerFairyCeremony
|
| | | import PlayerNewFairyCeremony
|
| | | import PlayerUniversalGameRec
|
| | | import GameWorldAverageLv
|
| | | import GameWorldProcess
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | |
| | | if not activityIpyData or (isActivity and not isEnd):
|
| | | activityIpyData = ipyData
|
| | | activityInfoDict = {ShareDefine.ActKey_CfgID:cfgID}
|
| | | if actName == ShareDefine.OperationActionName_LoginAward:
|
| | | #活动每天的世界等级
|
| | | activityInfoDict[ShareDefine.ActKey_WorldLVList] = GameWorldAverageLv.GetWorldLVListByTime(startDayDate, (endDayDate - startDayDate).days)
|
| | |
|
| | | if startDayDate <= curDateTime < endDayDate:
|
| | | dayIndex = 0
|
| | |
| | | import PlayerDBGSEvent
|
| | | import ChConfig
|
| | | import IpyGameDataPY
|
| | |
|
| | | import datetime
|
| | | #------------------------------------------------------------------------------
|
| | |
|
| | |
|
| | |
| | |
|
| | | return worldLV
|
| | |
|
| | | def GetWorldLVListByTime(startTime, day=1):
|
| | | ##根据时间计算多个世界等级
|
| | | initOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime)
|
| | | if initOpenServerTime <= 0:
|
| | | return []
|
| | | worldlvList = []
|
| | | diffSecond = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_WorldLVExtraTime) #额外时间参数
|
| | | initOpenServerTime = GameWorld.ChangeTimeNumToDatetime(initOpenServerTime, ChConfig.TYPE_Time_Format)
|
| | | if startTime < initOpenServerTime:
|
| | | return []
|
| | | ipyMgr = IpyGameDataPY.IPY_Data()
|
| | | for dayIndex in xrange(day):
|
| | | nextTime = startTime + datetime.timedelta(days=dayIndex)
|
| | | pastTimeDelta = nextTime - initOpenServerTime
|
| | | pastSeconds = max(0, pastTimeDelta.days * 24 * 60 * 60 + pastTimeDelta.seconds + diffSecond)
|
| | | maxCnt = ipyMgr.GetWorldLVCount()
|
| | | worldLV = 0
|
| | | for i in xrange(maxCnt):
|
| | | curIpyData = ipyMgr.GetWorldLVByIndex(i)
|
| | | if i == maxCnt - 1:
|
| | | worldLV = curIpyData.GetWorldLV()
|
| | | else:
|
| | | nextIpyData = ipyMgr.GetWorldLVByIndex(i+1)
|
| | | if curIpyData.GetOpenServerSecond() <= pastSeconds < nextIpyData.GetOpenServerSecond():
|
| | | worldLV = curIpyData.GetWorldLV()
|
| | | break
|
| | | worldlvList.append(worldLV)
|
| | | |
| | | GameWorld.DebugLog(' GetWorldLVByTime startTime=%s,day=%s,worldlvList=%s'%(str(startTime), day, worldlvList))
|
| | | return worldlvList |
| | |
| | | ActKey_CfgID = "CfgID" # 活动表配置ID
|
| | | ActKey_DayIndex = "DayIndex" # 活动表配置ID
|
| | | ActKey_WorldLV = "WorldLV" # 活动开启时世界等级
|
| | | ActKey_WorldLVList = "WorldLVList" # 活动每天的世界等级列表
|
| | |
|
| | | #答题类型枚举
|
| | | Def_Game_ExamTypeList = range(1, 4 + 1)
|
| | |
| | | Def_PDict_LoginAwardID = "LoginAwardID" # 玩家身上的BOSS复活活动ID,唯一标识,取活动开始日期time值
|
| | | Def_PDict_LoginAwardCurTimes = "LoginAwardCurTimes_%s_%s" #当前完成次数 参数(第X天,模板ID)
|
| | | Def_PDict_LoginAwardGotTimes = "LoginAwardGotTimes_%s_%s" #当前已领次数 参数(第X天,模板ID)
|
| | | Def_PDict_LoginAwardWorldLV = "LoginAwardWorldLV%s" #活动开启时世界等级参数(第X天)
|
| | |
|
| | | #诛仙BOSS
|
| | | Def_PDict_ZhuXianBossHelpCnt = "ZhuXianBossHelpCnt" # 协助次数
|
| | |
| | | Def_PDict_LuckyTreasureID = "LuckyTreasureID" # 玩家身上的活动ID,唯一标识,取活动开始日期time值
|
| | | Def_PDict_LuckyTreasureFree = "LuckyTreasureFree" #是否免费过
|
| | | Def_PDict_LuckyTreasurePoint = "LuckyTreasurePoint" #幸运值
|
| | | Def_PDict_LuckyTreasureCnt = "LuckyTreasureCnt" #鉴宝次数
|
| | | #-------------------------------------------------------------------------------
|
| | | #类型 Def_PDictType_OnlinePrize
|
| | | Def_PDict1_OnlinePrizeCnt = "OnlinePrizeCnt" # 新手在线已领取奖励次数
|
| | |
| | | #------------------------------------------------------
|
| | | # AA 0C 登录奖励活动信息 #tagMCActLoginAwardInfo
|
| | |
|
| | | class tagMCActLoginAwardItem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("ItemID", c_int), # 物品ID
|
| | | ("ItemCnt", c_ushort), # 物品数量
|
| | | ("IsBind", c_ubyte), # 是否绑定
|
| | | ]
|
| | |
|
| | | 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.ItemID = 0
|
| | | self.ItemCnt = 0
|
| | | self.IsBind = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCActLoginAwardItem)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// AA 0C 登录奖励活动信息 //tagMCActLoginAwardInfo:
|
| | | ItemID:%d,
|
| | | ItemCnt:%d,
|
| | | IsBind:%d
|
| | | '''\
|
| | | %(
|
| | | self.ItemID,
|
| | | self.ItemCnt,
|
| | | self.IsBind
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCActLoginAwardAction(Structure):
|
| | | TemplateID = 0 #(DWORD TemplateID)// 模板ID
|
| | | ActionType = 0 #(WORD ActionType)// 活动类别
|
| | | TotalTimes = 0 #(DWORD TotalTimes)// 可完成的总次数,0表示不限次数
|
| | | SingleTimes = 0 #(DWORD SingleTimes)// 单次领奖需要的次数
|
| | | Count = 0 #(BYTE Count)// 物品数
|
| | | ItemInfo = list() #(vector<tagMCActLoginAwardItem> ItemInfo)// 物品信息
|
| | | Count = 0 #(WORD Count)// 物品配置长度
|
| | | ItemInfo = "" #(String ItemInfo)// 物品信息
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.ActionType,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.TotalTimes,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.SingleTimes,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temItemInfo = tagMCActLoginAwardItem()
|
| | | _pos = temItemInfo.ReadData(_lpData, _pos)
|
| | | self.ItemInfo.append(temItemInfo)
|
| | | self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.ItemInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.Count)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.TotalTimes = 0
|
| | | self.SingleTimes = 0
|
| | | self.Count = 0
|
| | | self.ItemInfo = list()
|
| | | self.ItemInfo = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 2
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.Count):
|
| | | length += self.ItemInfo[i].GetLength()
|
| | | length += 2
|
| | | length += len(self.ItemInfo)
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteWORD(data, self.ActionType)
|
| | | data = CommFunc.WriteDWORD(data, self.TotalTimes)
|
| | | data = CommFunc.WriteDWORD(data, self.SingleTimes)
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.ItemInfo[i].GetLength(), self.ItemInfo[i].GetBuffer())
|
| | | data = CommFunc.WriteWORD(data, self.Count)
|
| | | data = CommFunc.WriteString(data, self.Count, self.ItemInfo)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | self.TotalTimes,
|
| | | self.SingleTimes,
|
| | | self.Count,
|
| | | "..."
|
| | | self.ItemInfo
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | class tagMCActLoginAwardDayInfo(Structure):
|
| | | ActCnt = 0 #(BYTE ActCnt)// 数量
|
| | | TemplateList = list() #(vector<WORD> TemplateList)// 模板列表
|
| | | WorldLV = 0 #(WORD WorldLV)// 世界等级
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | for i in range(self.ActCnt):
|
| | | value,_pos=CommFunc.ReadWORD(_lpData,_pos)
|
| | | self.TemplateList.append(value)
|
| | | self.WorldLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.ActCnt = 0
|
| | | self.TemplateList = list()
|
| | | self.WorldLV = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 2 * self.ActCnt
|
| | | length += 2
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.ActCnt)
|
| | | for i in range(self.ActCnt):
|
| | | data = CommFunc.WriteWORD(data, self.TemplateList[i])
|
| | | data = CommFunc.WriteWORD(data, self.WorldLV)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | ActCnt:%d,
|
| | | TemplateList:%s
|
| | | TemplateList:%s,
|
| | | WorldLV:%d
|
| | | '''\
|
| | | %(
|
| | | self.ActCnt,
|
| | | "..."
|
| | | "...",
|
| | | self.WorldLV
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | ("BYTE", "ActionType", 0),
|
| | | ("DWORD", "TotalTimes", 0),
|
| | | ("WORD", "SingleTimes", 0),
|
| | | ("list", "Reward", 0),
|
| | | ("char", "Reward", 0),
|
| | | ),
|
| | |
|
| | | "ZhuXianSuitAttr":(
|
| | |
| | | self.ActionType = 0
|
| | | self.TotalTimes = 0
|
| | | self.SingleTimes = 0
|
| | | self.Reward = [] |
| | | self.Reward = "" |
| | | return |
| | | |
| | | def GetTemplateID(self): return self.TemplateID # 模板ID
|
| | |
| | | import PyGameData
|
| | | import ItemCommon
|
| | |
|
| | | import json
|
| | |
|
| | | def OnLogin(curPlayer):
|
| | | isReset = __CheckPlayerLoginAwardAction(curPlayer)
|
| | |
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | actLoginAwardInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_LoginAward, {})
|
| | | #LoginAwardID = actLoginAwardInfo.get(ShareDefine.ActKey_ID, 0)
|
| | | #loginAwardID = actLoginAwardInfo.get(ShareDefine.ActKey_ID, 0)
|
| | | state = actLoginAwardInfo.get(ShareDefine.ActKey_State, 0)
|
| | | cfgID = actLoginAwardInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if state:
|
| | |
| | | if cfgID == playerLoginAwardID:
|
| | | #GameWorld.DebugLog("登录奖励活动ID不变,不处理!", curPlayer.GetPlayerID())
|
| | | return
|
| | | actWorldLVList = actLoginAwardInfo.get(ShareDefine.ActKey_WorldLVList, [])
|
| | | # 未领取的奖励邮件发放
|
| | | __SendLoginAwardMail(curPlayer, playerLoginAwardID)
|
| | | if playerLoginAwardID:
|
| | | __SendLoginAwardMail(curPlayer, playerLoginAwardID)
|
| | |
|
| | | if not cfgID:
|
| | | GameWorld.DebugLog(' 登录奖励活动重置!')
|
| | | curPlayer.ClearNomalDict(ChConfig.Def_PDictType_LoginAward)
|
| | | #if not cfgID:
|
| | | GameWorld.DebugLog(' 登录奖励活动重置!')
|
| | | curPlayer.ClearNomalDict(ChConfig.Def_PDictType_LoginAward)
|
| | |
|
| | | GameWorld.DebugLog("登录奖励变更! state=%s,cfgID=%s,playerLoginAwardID=%s" % (state, cfgID, playerLoginAwardID), playerID)
|
| | | GameWorld.DebugLog("登录奖励变更! state=%s,cfgID=%s,playerLoginAwardID=%s,actWorldLVList=%s" % (state, cfgID, playerLoginAwardID, actWorldLVList), playerID)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoginAwardID, cfgID, ChConfig.Def_PDictType_LoginAward)
|
| | | for i, actWorldLV in enumerate(actWorldLVList):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoginAwardWorldLV % i, actWorldLV, ChConfig.Def_PDictType_LoginAward)
|
| | |
|
| | | SyncLoginAwardInfo(curPlayer)
|
| | | return True
|
| | |
| | |
|
| | | def __SendLoginAwardMail(curPlayer, cfgID):
|
| | | # 未领取的奖励邮件发放
|
| | | actBossIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actBossIpyData:
|
| | | actIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actIpyData:
|
| | | return
|
| | | templateIDList = actBossIpyData.GetTemplateID()
|
| | | templateIDList = actIpyData.GetTemplateID()
|
| | | if not templateIDList:
|
| | | return
|
| | |
|
| | | totalItemDict = {}
|
| | | for day, tidList in enumerate(templateIDList):
|
| | | playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginAwardWorldLV % day, 0, ChConfig.Def_PDictType_LoginAward)
|
| | |
|
| | | for tid in tidList:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('LoginAward', tid)
|
| | | if not ipyData:
|
| | |
| | | canGotCnt = (curTimes - gotTimes) / singleTimes
|
| | | if not canGotCnt:
|
| | | continue
|
| | | itemDict = __GetAwardItem(curPlayer, ipyData, canGotCnt)
|
| | | itemDict = __GetAwardItem(curPlayer, ipyData, playerWorldLV, canGotCnt)
|
| | | GameWorld.AddDictValue(totalItemDict, itemDict)
|
| | |
|
| | | if not totalItemDict:
|
| | | return
|
| | | totalItemList = [[itemID, itemCnt, 1] for itemID, itemCnt in totalItemDict.items()]
|
| | | PlayerControl.SendMailByKey('SecondWeekReward', [curPlayer.GetID()], totalItemList)
|
| | | PlayerControl.SendMailByKey('LoginAward_1', [curPlayer.GetID()], totalItemList)
|
| | | return
|
| | |
|
| | |
|
| | |
| | |
|
| | | if not state or not cfgID:
|
| | | return
|
| | | actBossIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actBossIpyData:
|
| | | actIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actIpyData:
|
| | | return
|
| | | templateIDList = actBossIpyData.GetTemplateID()
|
| | | templateIDList = actIpyData.GetTemplateID()
|
| | | dayIndex = actLoginAwardInfo.get(ShareDefine.ActKey_DayIndex, 0)
|
| | | if dayIndex >= len(templateIDList):
|
| | | return
|
| | |
| | | gotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginAwardGotTimes % (day, templateID), 0, ChConfig.Def_PDictType_LoginAward)
|
| | | if curTimes - gotTimes < singleTimes:
|
| | | return
|
| | | |
| | | playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginAwardWorldLV % day, 0, ChConfig.Def_PDictType_LoginAward)
|
| | | #给奖励
|
| | | awardDict = __GetAwardItem(curPlayer, ipyData)
|
| | | awardDict = __GetAwardItem(curPlayer, ipyData, playerWorldLV)
|
| | | # 检查背包
|
| | | needSpace = len(awardDict)
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | |
| | | return
|
| | |
|
| | |
|
| | |
|
| | | def __GetAwardItem(curPlayer, ipyData, times=1):
|
| | | awardDict = {}
|
| | | for itemID, itemCnt, isbind in ipyData.GetReward():
|
| | | def __GetAwardItem(curPlayer, ipyData, worldLV, times=1):
|
| | | awardItemDict = {}
|
| | | awardDict = eval(ipyData.GetReward())
|
| | | wlvList = [int(lv) for lv in awardDict]
|
| | | wlvList.sort()
|
| | | findWlv = wlvList[-1]
|
| | | for wlv in wlvList:
|
| | | if worldLV <= wlv:
|
| | | findWlv = wlv
|
| | | break
|
| | | itemList = awardDict[findWlv]
|
| | | for itemID, itemCnt, isbind in itemList:
|
| | | if not itemID or not itemCnt:
|
| | | continue
|
| | | awardDict[itemID] = awardDict.get(itemID, 0) + itemCnt * times
|
| | | awardItemDict[itemID] = awardItemDict.get(itemID, 0) + itemCnt * times
|
| | |
|
| | | return awardDict
|
| | | return awardItemDict
|
| | |
|
| | |
|
| | | def SyncLoginAwardPlayerInfo(curPlayer, day=-1, templateID=-1):
|
| | |
| | | cfgID = actLoginAwardInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if not state or not cfgID:
|
| | | return
|
| | | actBossIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actBossIpyData:
|
| | | actIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actIpyData:
|
| | | return
|
| | | templateIDList = actBossIpyData.GetTemplateID()
|
| | | templateIDList = actIpyData.GetTemplateID()
|
| | | if not templateIDList:
|
| | | return
|
| | | if day != -1:
|
| | |
| | | cfgID = actLoginAwardInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if not cfgID:
|
| | | return
|
| | | actBossIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actBossIpyData:
|
| | | actIpyData = IpyGameDataPY.GetIpyGameData("ActLoginAward", cfgID)
|
| | | if not actIpyData:
|
| | | return
|
| | | templateIDList = actBossIpyData.GetTemplateID()
|
| | | templateIDList = actIpyData.GetTemplateID()
|
| | | if not templateIDList:
|
| | | return
|
| | | actWorldLVList = actLoginAwardInfo.get(ShareDefine.ActKey_WorldLVList, [])
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
|
| | | actInfo = ChPyNetSendPack.tagMCActLoginAwardInfo()
|
| | | actInfo.Clear()
|
| | | actInfo.StartDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetStartDate(), openServerDay)
|
| | | actInfo.EndtDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetEndDate(), openServerDay)
|
| | | actInfo.AdvanceMinutes = actBossIpyData.GetAdvanceMinutes()
|
| | | actInfo.IsDayReset = actBossIpyData.GetIsDayReset()
|
| | | actInfo.ResetType = actBossIpyData.GetResetType()
|
| | | actInfo.LimitLV = actBossIpyData.GetLVLimit()
|
| | | actInfo.StartDate = GameWorld.GetOperationActionDateStr(actIpyData.GetStartDate(), openServerDay)
|
| | | actInfo.EndtDate = GameWorld.GetOperationActionDateStr(actIpyData.GetEndDate(), openServerDay)
|
| | | actInfo.AdvanceMinutes = actIpyData.GetAdvanceMinutes()
|
| | | actInfo.IsDayReset = actIpyData.GetIsDayReset()
|
| | | actInfo.ResetType = actIpyData.GetResetType()
|
| | | actInfo.LimitLV = actIpyData.GetLVLimit()
|
| | | actInfo.DayInfoList = []
|
| | | tidList = []
|
| | | for day, dayActList in enumerate(templateIDList):
|
| | |
| | | for tid in dayActList:
|
| | | if tid not in tidList:
|
| | | tidList.append(tid)
|
| | | |
| | | dayInfo.WorldLV = actWorldLVList[day] if day < len(actWorldLVList) else 0
|
| | | actInfo.DayInfoList.append(dayInfo)
|
| | | actInfo.DayCnt = len(actInfo.DayInfoList)
|
| | | actInfo.ActionInfo = []
|
| | |
| | | tInfo.ActionType = ipyData.GetActionType()
|
| | | tInfo.TotalTimes = ipyData.GetTotalTimes()
|
| | | tInfo.SingleTimes = ipyData.GetSingleTimes()
|
| | | tInfo.ItemInfo = []
|
| | | for itemID, itemCnt, isBind in ipyData.GetReward():
|
| | | awardItem = ChPyNetSendPack.tagMCActLoginAwardItem()
|
| | | awardItem.ItemID = itemID
|
| | | awardItem.ItemCnt = itemCnt
|
| | | awardItem.IsBind = isBind
|
| | | tInfo.ItemInfo.append(awardItem)
|
| | | tInfo.ItemInfo = ipyData.GetReward()
|
| | | tInfo.Count = len(tInfo.ItemInfo)
|
| | | actInfo.ActionInfo.append(tInfo)
|
| | | actInfo.TCount = len(actInfo.ActionInfo)
|
| | |
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LuckyTreasureFree, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LuckyTreasurePoint, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LuckyTreasureCnt, 0)
|
| | | |
| | |
|
| | | SyncLuckyTreasureInfo(curPlayer)
|
| | | SyncLuckyTreasureResultInfo(curPlayer)
|
| | |
| | | greatItem = randomRateList[-1][1]
|
| | |
|
| | | curLuckyPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LuckyTreasurePoint)
|
| | | curLuckyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LuckyTreasureCnt)
|
| | | |
| | | maxLuckyPoint = actIpyData.GetLuckyPoint()
|
| | | singlePoint = IpyGameDataPY.GetFuncCfg('LuckyAppraisal', 2)
|
| | | if curLuckyPoint + singlePoint >= maxLuckyPoint:
|
| | | giveItem = greatItem
|
| | | newLuckyPoint = 0
|
| | | else:
|
| | | randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, 1, [])
|
| | | if curLuckyCnt < IpyGameDataPY.GetFuncCfg('LuckyAppraisal', 3):
|
| | | #前X次鉴宝不能出大奖
|
| | | randomResultList = GameWorld.GetResultByRandomListEx(randomRateList[:-1], 1, [])
|
| | | else:
|
| | | randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, 1, [])
|
| | | if len(randomResultList) != 1:
|
| | | GameWorld.DebugLog(' 开始幸运鉴宝 随机库结果 获取错误 !')
|
| | | return
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LuckyTreasureFree, 1)
|
| | | #更新幸运值
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LuckyTreasurePoint, newLuckyPoint)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LuckyTreasureCnt, curLuckyCnt + 1)
|
| | |
|
| | | for itemID, itemCount, isBind in [giveItem]:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem], event=[ChConfig.ItemGive_LuckyTreasure, False, {"isFree":not hasFree}])
|
| | |
| | | ActKey_CfgID = "CfgID" # 活动表配置ID
|
| | | ActKey_DayIndex = "DayIndex" # 活动表配置ID
|
| | | ActKey_WorldLV = "WorldLV" # 活动开启时世界等级
|
| | | ActKey_WorldLVList = "WorldLVList" # 活动每天的世界等级列表
|
| | |
|
| | | #答题类型枚举
|
| | | Def_Game_ExamTypeList = range(1, 4 + 1)
|