6457 【后端】【2.0】缥缈仙域开发单(随机玩法、购买次数)
| | |
| | | {
|
| | | DWORD _DailyID; //活动ID
|
| | | DWORD DayTimes; //每日次数, 0为不限制
|
| | | DWORD DayBuyTimes; //每日可购买次数
|
| | | DWORD BuyNeedMoney; //购买次数需要仙玉
|
| | | DWORD DayItemAddTimes; //每日可用物品增加次数
|
| | | DWORD DayItemID; //增加次数的物品ID
|
| | | BYTE DayResetType; //每日次数重置类型; 0-不重置,1-0点,2-5点
|
| | | DWORD WeekTimes; //每周次数, 0为不限制
|
| | | BYTE WeekResetType; //每周次数重置类型; 0-不重置,1-0点,2-5点
|
| | |
| | | list Award1; //奖励 [[独立概率万分率,[物品ID,数量,是否拍品]],..]
|
| | | dict Award2; //饼图奖励{随机次数:[(概率,[物品ID,数量,是否拍品]),..]}
|
| | | }; |
| | |
|
| | | //缥缈仙域表
|
| | |
|
| | | struct tagFairyDomain
|
| | | {
|
| | | WORD _ID; //事件编号
|
| | | BYTE EventType; //事件类型
|
| | | DWORD MapID; //副本id
|
| | | BYTE LineID; //副本线路id
|
| | | BYTE CostEnergy; //消耗体力
|
| | | BYTE NeedAlchemyLV; //出现的炼丹等级要求
|
| | | DWORD Weight; //权重
|
| | | }; |
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 25 购买日常活动次数 #tagCMBuyDailyActionCnt
|
| | |
|
| | | class tagCMBuyDailyActionCnt(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ActionID", c_int), # ID
|
| | | ("AddType", c_ubyte), # 0-花仙玉 1-用物品
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA5
|
| | | self.SubCmd = 0x25
|
| | | 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 = 0xA5
|
| | | self.SubCmd = 0x25
|
| | | self.ActionID = 0
|
| | | self.AddType = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMBuyDailyActionCnt)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A5 25 购买日常活动次数 //tagCMBuyDailyActionCnt:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ActionID:%d,
|
| | | AddType:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ActionID,
|
| | | self.AddType
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMBuyDailyActionCnt=tagCMBuyDailyActionCnt()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMBuyDailyActionCnt.Cmd,m_NAtagCMBuyDailyActionCnt.SubCmd))] = m_NAtagCMBuyDailyActionCnt
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A5 75 购买副本进入次数#tagCMBuyEnterCount
|
| | |
|
| | | class tagCMBuyEnterCount(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 26 寻访仙域 #tagCMVisitFairyDomain
|
| | |
|
| | | class tagCMVisitFairyDomain(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("Type", c_ubyte), #0-开始寻访 1-结束寻访
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA5
|
| | | 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 = 0xA5
|
| | | self.SubCmd = 0x26
|
| | | self.Type = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMVisitFairyDomain)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A5 26 寻访仙域 //tagCMVisitFairyDomain:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | Type:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.Type
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMVisitFairyDomain=tagCMVisitFairyDomain()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMVisitFairyDomain.Cmd,m_NAtagCMVisitFairyDomain.SubCmd))] = m_NAtagCMVisitFairyDomain
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 1D 法宝佩戴 #tagCMWearMagicWeapon
|
| | |
|
| | | class tagCMWearMagicWeapon(Structure):
|
| | |
| | | _fields_ = [
|
| | | ("ActionID", c_int), # ID
|
| | | ("DayFinishCnt", c_ushort), # 今日已完成次数
|
| | | ("DayBuyTimes", c_ubyte), # 今日购买次数
|
| | | ("DayItemTimes", c_ubyte), # 今日物品增加次数
|
| | | ("WeekFinishCnt", c_int), # 本周已完成次数
|
| | | ]
|
| | |
|
| | |
| | | def Clear(self):
|
| | | self.ActionID = 0
|
| | | self.DayFinishCnt = 0
|
| | | self.DayBuyTimes = 0
|
| | | self.DayItemTimes = 0
|
| | | self.WeekFinishCnt = 0
|
| | | return
|
| | |
|
| | |
| | | DumpString = '''// A3 15 日常活动次数通知 //tagMCDailyActionCnt:
|
| | | ActionID:%d,
|
| | | DayFinishCnt:%d,
|
| | | DayBuyTimes:%d,
|
| | | DayItemTimes:%d,
|
| | | WeekFinishCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.ActionID,
|
| | | self.DayFinishCnt,
|
| | | self.DayBuyTimes,
|
| | | self.DayItemTimes,
|
| | | self.WeekFinishCnt
|
| | | )
|
| | | return DumpString
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 06 缥缈仙域信息 #tagMCFairyDomainInfo
|
| | |
|
| | | class tagMCFairyDomainEvent(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("EventID", c_ushort), #事件ID
|
| | | ("EventState", c_ubyte), #事件状态 1-可拜访 2-拜访中 3-已拜访
|
| | | ]
|
| | |
|
| | | 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.EventID = 0
|
| | | self.EventState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCFairyDomainEvent)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 06 缥缈仙域信息 //tagMCFairyDomainInfo:
|
| | | EventID:%d,
|
| | | EventState:%d
|
| | | '''\
|
| | | %(
|
| | | self.EventID,
|
| | | self.EventState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCFairyDomainInfo(Structure):
|
| | | Head = tagHead()
|
| | | State = 0 #(BYTE State)//是否寻访中
|
| | | Energy = 0 #(WORD Energy)//体力
|
| | | Count = 0 #(BYTE Count)// 信息个数
|
| | | InfoList = list() #(vector<tagMCFairyDomainEvent> InfoList)// 信息列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x06
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.State,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Energy,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temInfoList = tagMCFairyDomainEvent()
|
| | | _pos = temInfoList.ReadData(_lpData, _pos)
|
| | | self.InfoList.append(temInfoList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x06
|
| | | self.State = 0
|
| | | self.Energy = 0
|
| | | self.Count = 0
|
| | | self.InfoList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | for i in range(self.Count):
|
| | | length += self.InfoList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.State)
|
| | | data = CommFunc.WriteWORD(data, self.Energy)
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | State:%d,
|
| | | Energy:%d,
|
| | | Count:%d,
|
| | | InfoList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.State,
|
| | | self.Energy,
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFairyDomainInfo=tagMCFairyDomainInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFairyDomainInfo.Head.Cmd,m_NAtagMCFairyDomainInfo.Head.SubCmd))] = m_NAtagMCFairyDomainInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 16 仙盟活跃信息通知 #tagMCFamilyActivityInfo
|
| | |
|
| | | class tagMCFamilyActionCnt(Structure):
|
| | |
| | | DailyActionID_FamilyBoss1, # 仙盟BOSS第一场 22
|
| | | DailyActionID_FamilyBoss2, # 仙盟BOSS第二场 23
|
| | | DailyActionID_HorsePetBoss, # 骑宠BOSS 24
|
| | | ) = range(1, 24 + 1)
|
| | | DailyActionID_FairyDomain, # 缥缈仙域 25
|
| | | ) = range(1, 25 + 1)
|
| | |
|
| | |
|
| | |
|
| | |
| | | PacketCMD_1=0xA5
|
| | | PacketSubCMD_1=0xC5
|
| | | PacketCallFunc_1=OnEquipPartStarUp |
| | |
|
| | | ;日常活动
|
| | | [PlayerActivity]
|
| | | ScriptName = Player\PlayerActivity.py
|
| | | Writer = xdh
|
| | | Releaser = xdh
|
| | | RegType = 0
|
| | | RegisterPackCount = 1
|
| | |
|
| | | PacketCMD_1=0xA5
|
| | | PacketSubCMD_1=0x25
|
| | | PacketCallFunc_1=OnDailyActionBuyCnt
|
| | |
|
| | | ;缥缈仙域
|
| | | [PlayerFairyDomain]
|
| | | ScriptName = Player\PlayerFairyDomain.py
|
| | | Writer = xdh
|
| | | Releaser = xdh
|
| | | RegType = 0
|
| | | RegisterPackCount = 1
|
| | |
|
| | | PacketCMD_1=0xA5
|
| | | PacketSubCMD_1=0x26
|
| | | PacketCallFunc_1=OnVisitFairyDomain |
| | |
| | | Def_PDict_Activity_ExtraRealmPoint = "Activity_ExtraRealmPoint" # 多倍活动额外获得的修行点
|
| | | # 每日活动
|
| | | Def_PDict_DailyActionDayTimes = "DailyActionDayTimes_%s" # 每日活动今日完成次数 参数每日活动ID
|
| | | Def_PDict_DailyActionDayBuyTimes = "DADayBuyTimes_%s" # 每日活动今日购买次数 参数每日活动ID
|
| | | Def_PDict_DailyActionDayItemTimes = "DADayItemTimes_%s" # 每日活动今日物品增加次数 参数每日活动ID
|
| | | Def_PDict_DailyActionWeekTimes = "DailyActionWeekTimes_%s" # 每日活动本周完成次数 参数每日活动ID
|
| | | #仙盟活跃
|
| | | Def_PDict_FamilyActivityFinishCnt = "FamilyActivityFinishCnt%s" # 已完成次数
|
| | |
| | | #装备部位星数
|
| | | Def_PDict_EquipPartStar = "EQPartStar_%s" #装备部位星数 参数 装备背包格子索引
|
| | |
|
| | |
|
| | | #缥缈仙域
|
| | | Def_PDict_FairyDomainState = "FairyDomainState" #是否寻访中
|
| | | Def_PDict_FairyDomainEventState = "FairyDomainEventState%s" #单个事件状态1-未拜访 2-拜访中 3-已拜访 参数事件ID
|
| | | Def_PDict_FairyDomainEventID = "FairyDomainEventID%s" #事件ID 参数第n个事件
|
| | | Def_PDict_FairyDomainEnergy = "FairyDomainEnergy" #体力值
|
| | | Def_PDict_FairyDomainVisitCnt = "FairyDomainVisitCnt" #寻访总次数
|
| | | #-------------------------------------------------------------------------------
|
| | | #可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
|
| | |
|
| | |
| | | Def_Cost_LuckyTreasure, #幸运鉴宝
|
| | | Def_Cost_MysteryShopRefresh, # 神秘商店刷新
|
| | | Def_Cost_AuctionBid, # 拍卖行竞价
|
| | | Def_Cost_BuyDailyActionCnt, # 购买活动次数
|
| | | #-----------以下为暂时没用的,先不删除,如有新增消费点则放在这些之前------------
|
| | | Def_Cost_RefreshArrestTask, # 刷新悬赏任务
|
| | | Def_Cost_OffLineExp, # 兑换离线经验
|
| | |
| | | Def_Cost_Trade, # 交易
|
| | | Def_Cost_Rename, # 改名
|
| | | Def_Cost_SkillLvUp, # 技能升级
|
| | | ) = range(2000, 2000 + 56)
|
| | | ) = range(2000, 2000 + 57)
|
| | |
|
| | | Def_Cost_Reason_SonKey = "reason_name_son" # 消费点原因子类说明key
|
| | |
|
| | |
| | | Def_Cost_LuckyTreasure:"LuckyTreasure",
|
| | | Def_Cost_MysteryShopRefresh:"MysteryShopRefresh",
|
| | | Def_Cost_AuctionBid:"AuctionBid",
|
| | | Def_Cost_BuyDailyActionCnt:"BuyDailyActionCnt",
|
| | | }
|
| | | ## -----------------------------------------------------
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 25 购买日常活动次数 #tagCMBuyDailyActionCnt
|
| | |
|
| | | class tagCMBuyDailyActionCnt(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ActionID", c_int), # ID
|
| | | ("AddType", c_ubyte), # 0-花仙玉 1-用物品
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA5
|
| | | self.SubCmd = 0x25
|
| | | 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 = 0xA5
|
| | | self.SubCmd = 0x25
|
| | | self.ActionID = 0
|
| | | self.AddType = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMBuyDailyActionCnt)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A5 25 购买日常活动次数 //tagCMBuyDailyActionCnt:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ActionID:%d,
|
| | | AddType:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ActionID,
|
| | | self.AddType
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMBuyDailyActionCnt=tagCMBuyDailyActionCnt()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMBuyDailyActionCnt.Cmd,m_NAtagCMBuyDailyActionCnt.SubCmd))] = m_NAtagCMBuyDailyActionCnt
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A5 75 购买副本进入次数#tagCMBuyEnterCount
|
| | |
|
| | | class tagCMBuyEnterCount(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 26 寻访仙域 #tagCMVisitFairyDomain
|
| | |
|
| | | class tagCMVisitFairyDomain(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("Type", c_ubyte), #0-开始寻访 1-结束寻访
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA5
|
| | | 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 = 0xA5
|
| | | self.SubCmd = 0x26
|
| | | self.Type = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMVisitFairyDomain)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A5 26 寻访仙域 //tagCMVisitFairyDomain:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | Type:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.Type
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMVisitFairyDomain=tagCMVisitFairyDomain()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMVisitFairyDomain.Cmd,m_NAtagCMVisitFairyDomain.SubCmd))] = m_NAtagCMVisitFairyDomain
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 1D 法宝佩戴 #tagCMWearMagicWeapon
|
| | |
|
| | | class tagCMWearMagicWeapon(Structure):
|
| | |
| | | _fields_ = [
|
| | | ("ActionID", c_int), # ID
|
| | | ("DayFinishCnt", c_ushort), # 今日已完成次数
|
| | | ("DayBuyTimes", c_ubyte), # 今日购买次数
|
| | | ("DayItemTimes", c_ubyte), # 今日物品增加次数
|
| | | ("WeekFinishCnt", c_int), # 本周已完成次数
|
| | | ]
|
| | |
|
| | |
| | | def Clear(self):
|
| | | self.ActionID = 0
|
| | | self.DayFinishCnt = 0
|
| | | self.DayBuyTimes = 0
|
| | | self.DayItemTimes = 0
|
| | | self.WeekFinishCnt = 0
|
| | | return
|
| | |
|
| | |
| | | DumpString = '''// A3 15 日常活动次数通知 //tagMCDailyActionCnt:
|
| | | ActionID:%d,
|
| | | DayFinishCnt:%d,
|
| | | DayBuyTimes:%d,
|
| | | DayItemTimes:%d,
|
| | | WeekFinishCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.ActionID,
|
| | | self.DayFinishCnt,
|
| | | self.DayBuyTimes,
|
| | | self.DayItemTimes,
|
| | | self.WeekFinishCnt
|
| | | )
|
| | | return DumpString
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 06 缥缈仙域信息 #tagMCFairyDomainInfo
|
| | |
|
| | | class tagMCFairyDomainEvent(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("EventID", c_ushort), #事件ID
|
| | | ("EventState", c_ubyte), #事件状态 1-可拜访 2-拜访中 3-已拜访
|
| | | ]
|
| | |
|
| | | 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.EventID = 0
|
| | | self.EventState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCFairyDomainEvent)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 06 缥缈仙域信息 //tagMCFairyDomainInfo:
|
| | | EventID:%d,
|
| | | EventState:%d
|
| | | '''\
|
| | | %(
|
| | | self.EventID,
|
| | | self.EventState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCFairyDomainInfo(Structure):
|
| | | Head = tagHead()
|
| | | State = 0 #(BYTE State)//是否寻访中
|
| | | Energy = 0 #(WORD Energy)//体力
|
| | | Count = 0 #(BYTE Count)// 信息个数
|
| | | InfoList = list() #(vector<tagMCFairyDomainEvent> InfoList)// 信息列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x06
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.State,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Energy,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temInfoList = tagMCFairyDomainEvent()
|
| | | _pos = temInfoList.ReadData(_lpData, _pos)
|
| | | self.InfoList.append(temInfoList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x06
|
| | | self.State = 0
|
| | | self.Energy = 0
|
| | | self.Count = 0
|
| | | self.InfoList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | for i in range(self.Count):
|
| | | length += self.InfoList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.State)
|
| | | data = CommFunc.WriteWORD(data, self.Energy)
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | State:%d,
|
| | | Energy:%d,
|
| | | Count:%d,
|
| | | InfoList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.State,
|
| | | self.Energy,
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFairyDomainInfo=tagMCFairyDomainInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFairyDomainInfo.Head.Cmd,m_NAtagMCFairyDomainInfo.Head.SubCmd))] = m_NAtagMCFairyDomainInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 16 仙盟活跃信息通知 #tagMCFamilyActivityInfo
|
| | |
|
| | | class tagMCFamilyActionCnt(Structure):
|
| | |
| | | gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, 0)
|
| | | gameWorld.SetGameWorldDict(FBDict_Speed % lineID, 0)
|
| | | gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, 0)
|
| | | |
| | | PyGameData.g_horsePetBossPlayerHurtDict[lineID] = {}
|
| | | gameWorld.SetPropertyID(0)
|
| | | return
|
| | |
|
| | |
| | | "DailyAction":(
|
| | | ("DWORD", "DailyID", 1),
|
| | | ("DWORD", "DayTimes", 0),
|
| | | ("DWORD", "DayBuyTimes", 0),
|
| | | ("DWORD", "BuyNeedMoney", 0),
|
| | | ("DWORD", "DayItemAddTimes", 0),
|
| | | ("DWORD", "DayItemID", 0),
|
| | | ("BYTE", "DayResetType", 0),
|
| | | ("DWORD", "WeekTimes", 0),
|
| | | ("BYTE", "WeekResetType", 0),
|
| | |
| | | ("list", "Rank", 0),
|
| | | ("list", "Award1", 0),
|
| | | ("dict", "Award2", 0),
|
| | | ),
|
| | |
|
| | | "FairyDomain":(
|
| | | ("WORD", "ID", 1),
|
| | | ("BYTE", "EventType", 0),
|
| | | ("DWORD", "MapID", 0),
|
| | | ("BYTE", "LineID", 0),
|
| | | ("BYTE", "CostEnergy", 0),
|
| | | ("BYTE", "NeedAlchemyLV", 0),
|
| | | ("DWORD", "Weight", 0),
|
| | | ),
|
| | | }
|
| | |
|
| | |
| | | def __init__(self): |
| | | self.DailyID = 0
|
| | | self.DayTimes = 0
|
| | | self.DayBuyTimes = 0
|
| | | self.BuyNeedMoney = 0
|
| | | self.DayItemAddTimes = 0
|
| | | self.DayItemID = 0
|
| | | self.DayResetType = 0
|
| | | self.WeekTimes = 0
|
| | | self.WeekResetType = 0 |
| | |
| | | |
| | | def GetDailyID(self): return self.DailyID # 活动ID
|
| | | def GetDayTimes(self): return self.DayTimes # 每日次数, 0为不限制
|
| | | def GetDayBuyTimes(self): return self.DayBuyTimes # 每日可购买次数
|
| | | def GetBuyNeedMoney(self): return self.BuyNeedMoney # 购买次数需要仙玉
|
| | | def GetDayItemAddTimes(self): return self.DayItemAddTimes # 每日可用物品增加次数
|
| | | def GetDayItemID(self): return self.DayItemID # 增加次数的物品ID
|
| | | def GetDayResetType(self): return self.DayResetType # 每日次数重置类型; 0-不重置,1-0点,2-5点
|
| | | def GetWeekTimes(self): return self.WeekTimes # 每周次数, 0为不限制
|
| | | def GetWeekResetType(self): return self.WeekResetType # 每周次数重置类型; 0-不重置,1-0点,2-5点 |
| | |
| | | def GetAward1(self): return self.Award1 # 奖励 [[独立概率万分率,[物品ID,数量,是否拍品]],..]
|
| | | def GetAward2(self): return self.Award2 # 饼图奖励{随机次数:[(概率,[物品ID,数量,是否拍品]),..]} |
| | |
|
| | | # 缥缈仙域表 |
| | | class IPY_FairyDomain(): |
| | | |
| | | def __init__(self): |
| | | self.ID = 0
|
| | | self.EventType = 0
|
| | | self.MapID = 0
|
| | | self.LineID = 0
|
| | | self.CostEnergy = 0
|
| | | self.NeedAlchemyLV = 0
|
| | | self.Weight = 0 |
| | | return |
| | | |
| | | def GetID(self): return self.ID # 事件编号
|
| | | def GetEventType(self): return self.EventType # 事件类型
|
| | | def GetMapID(self): return self.MapID # 副本id
|
| | | def GetLineID(self): return self.LineID # 副本线路id
|
| | | def GetCostEnergy(self): return self.CostEnergy # 消耗体力
|
| | | def GetNeedAlchemyLV(self): return self.NeedAlchemyLV # 出现的炼丹等级要求
|
| | | def GetWeight(self): return self.Weight # 权重 |
| | |
|
| | |
|
| | | def Log(msg, playerID=0, par=0):
|
| | | LogUI.Msg("%s\t%s\t%s" % (par, playerID, msg))
|
| | |
| | | self.ipyItemWashMaxLen = len(self.ipyItemWashMaxCache)
|
| | | self.ipyHorsePetBossAwardCache = self.__LoadFileData("HorsePetBossAward", IPY_HorsePetBossAward)
|
| | | self.ipyHorsePetBossAwardLen = len(self.ipyHorsePetBossAwardCache)
|
| | | self.ipyFairyDomainCache = self.__LoadFileData("FairyDomain", IPY_FairyDomain)
|
| | | self.ipyFairyDomainLen = len(self.ipyFairyDomainCache)
|
| | | Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
|
| | | Log("IPY_DataMgr InitOK!")
|
| | | return
|
| | |
| | | def GetItemWashMaxByIndex(self, index): return self.ipyItemWashMaxCache[index]
|
| | | def GetHorsePetBossAwardCount(self): return self.ipyHorsePetBossAwardLen
|
| | | def GetHorsePetBossAwardByIndex(self, index): return self.ipyHorsePetBossAwardCache[index]
|
| | | def GetFairyDomainCount(self): return self.ipyFairyDomainLen
|
| | | def GetFairyDomainByIndex(self, index): return self.ipyFairyDomainCache[index]
|
| | |
|
| | | IPYData = IPY_DataMgr()
|
| | | def IPY_Data(): return IPYData
|
| | |
| | | import PlayerEquipDecompose
|
| | | import PlayerGreatMaster
|
| | | import PlayerGatherSoul
|
| | | import PlayerFairyDomain
|
| | | import PlayerCrossRealmPK
|
| | | import GameFuncComm
|
| | | import PlayerMagicWeapon
|
| | |
| | | FBHelpBattle.DoPlayerLogin(curPlayer)
|
| | | # 聚魂
|
| | | PlayerGatherSoul.PlayerLogin(curPlayer)
|
| | | #缥缈仙域
|
| | | PlayerFairyDomain.OnLogin(curPlayer)
|
| | | |
| | | curPlayer.SetState(0) # 脱机挂恢复为正常上线
|
| | | curPlayer.SetFacePic(0) # 通知数据库是否保存还是下线,做一次恢复,1为保存 0为正常下线
|
| | | tjgTime = PlayerTJG.GetTJGTime(curPlayer)
|
| | |
| | | import PyGameData
|
| | | import GameFuncComm
|
| | |
|
| | |
|
| | | #关联类型
|
| | | (
|
| | | RelatedType_1, # 1关联日常活动表
|
| | | RelatedType_2, # 2关联副本总表
|
| | | ) = range(1, 3)
|
| | |
|
| | |
|
| | |
|
| | | def OnWeek(curPlayer, onWeekType):
|
| | |
| | | # 重置类型不同的不处理
|
| | | if ipyData.GetDayResetType() != onEventType:
|
| | | continue
|
| | | key = ChConfig.Def_PDict_DailyActionDayTimes%ipyData.GetDailyID()
|
| | | __SetPDictValue(curPlayer, key, 0)
|
| | | dailyID = ipyData.GetDailyID()
|
| | | __SetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % dailyID, 0)
|
| | | __SetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID, 0)
|
| | | __SetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID, 0)
|
| | | |
| | | actionIDInfo.append(ipyData.GetDailyID())
|
| | | if actionIDInfo:
|
| | | SyncDailyActionInfo(curPlayer, actionIDInfo)
|
| | | return
|
| | |
|
| | |
|
| | | def SendDayActionMail(curPlayer):
|
| | | ##发送每日活动邮件
|
| | |
| | | GameWorld.DebugLog(' 重新计算活跃奖励阶段 curStage=%s,realmLV=%s'%(curStage, realmLV))
|
| | | return
|
| | |
|
| | |
|
| | | ## OnLogin
|
| | | # @param curPlayer 玩家实例
|
| | | # @return
|
| | |
| | | # @return
|
| | | def __GetPDictValue(curPlayer, key, defaultValue=0):
|
| | | return curPlayer.NomalDictGetProperty(key, defaultValue)
|
| | |
|
| | |
|
| | | ## 设置活跃度玩家数据库字典信息值
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ## 摸NPC获得活跃度
|
| | | # @param atkObj
|
| | | # @param curNPC
|
| | |
| | | # AddActivityFinishCnt(atkObj, ShareDefine.ActivityNum_KillBoss)
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | | ## 增加完成活跃度次数
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | % (activityNum, addPbCnt, addValue, multiple, addExtraPoint, curExtraPoint), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | |
|
| | | def __GetActionAddPer(curPlayer):
|
| | | multiple, extraPointLimit = 1, 0 #倍数、额外可获得修行点上限
|
| | | actRealmPointInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_RealmPoint, {})# 多倍修行点活动
|
| | |
| | | if curPlayer.GetLV() < actRealmPointIpyData.GetLVLimit():
|
| | | return multiple, extraPointLimit
|
| | | return actRealmPointIpyData.GetMultiple(), actRealmPointIpyData.GetPointLimit()
|
| | |
|
| | |
|
| | | ## 同步活跃度信息
|
| | | # @param curPlayer
|
| | |
| | | sendPack.ExtraPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ## 领取活跃度奖励
|
| | |
| | | GameWorld.DebugLog("领取活跃度奖励OK!awardStage=%s, index=%s,needActivity=%s,totalActivity=%s,awardRecord=%s"
|
| | | % (awardStage, awardIndex, needActivity, totalActivity, updAwardRecord))
|
| | |
|
| | | |
| | | |
| | | return
|
| | |
|
| | |
|
| | | def GetRealmPointAward(curPlayer):
|
| | | #领取活跃修行点
|
| | |
| | | SyncDailyActivityInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def GetActivityNum(relatedType, relatedID):
|
| | | ## 获取日常任务ID(活跃ID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('DailyQuest', {"RelatedID":relatedID,"RelatedType":relatedType}, False, False)
|
| | |
| | | return ipyData.GetID()
|
| | |
|
| | | #########################################日常活动###########################################
|
| | |
|
| | |
|
| | | def AddDailyActionFinishCnt(curPlayer, dailyID, addCnt=1):
|
| | | ##增加日常活动完成次数
|
| | |
| | | if dayTimesLimit:
|
| | | key = ChConfig.Def_PDict_DailyActionDayTimes%dailyID
|
| | | curDayTimes = curPlayer.NomalDictGetProperty(key)
|
| | | if not unLimitCnt and curDayTimes >= dayTimesLimit:
|
| | | curDayBuyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID)
|
| | | curDayItemTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID)
|
| | | if not unLimitCnt and curDayTimes >= dayTimesLimit + curDayBuyTimes + curDayItemTimes:
|
| | | return
|
| | | updDayTimes = curDayTimes+addCnt if unLimitCnt else min(dayTimesLimit, curDayTimes+addCnt)
|
| | | updDayTimes = curDayTimes + addCnt if unLimitCnt else min(dayTimesLimit + curDayBuyTimes + curDayItemTimes, curDayTimes + addCnt)
|
| | | addCnt = updDayTimes - curDayTimes
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, key, updDayTimes)
|
| | | GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curDayTimes=%s, updDayTimes=%s'%(dailyID, curDayTimes, updDayTimes))
|
| | |
| | | AddActivityFinishCnt(curPlayer, activityNum, updTimes, addCnt)
|
| | | return True
|
| | |
|
| | |
|
| | | def GetDailyActionFinishCnt(curPlayer, dailyID):
|
| | | key = ChConfig.Def_PDict_DailyActionDayTimes%dailyID
|
| | | curDayTimes = __GetPDictValue(curPlayer, key)
|
| | |
| | | dayTimesLimit = GetMaxDayTimes(ipyData)#ipyData.GetDayTimes()
|
| | | return curDayTimes, dayTimesLimit
|
| | |
|
| | | def GetDailyActionrRemainCnt(curPlayer, dailyID):
|
| | | ##获取活动剩余次数
|
| | | curDayTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % dailyID)
|
| | | curDayBuyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID)
|
| | | curDayItemTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('DailyAction', dailyID)
|
| | | dayTimesLimit = GetMaxDayTimes(ipyData)
|
| | | return max(0, dayTimesLimit+curDayBuyTimes+curDayItemTimes-curDayTimes)
|
| | |
|
| | | def GetMaxDayTimes(ipyData):
|
| | | dayTimesLimit = ipyData.GetDayTimes()
|
| | | if ipyData.GetDailyID() == ShareDefine.DailyActionID_TowerSD:
|
| | | dayTimesLimit += IpyGameDataPY.GetFuncCfg('RuneTowerSweepBuy')
|
| | | return dayTimesLimit
|
| | |
|
| | |
|
| | | #// A5 25 购买日常活动次数 #tagCMBuyDailyActionCnt
|
| | | #
|
| | | #struct tagCMBuyDailyActionCnt
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD ActionID; // ID
|
| | | # BYTE AddType; // 0-花仙玉 1-用物品
|
| | | #};
|
| | | def OnDailyActionBuyCnt(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | dailyID = clientData.ActionID
|
| | | addType = clientData.AddType #0花仙玉 1使用物品
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('DailyAction', dailyID)
|
| | | if not ipyData:
|
| | | return
|
| | | curDayTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % dailyID)
|
| | | curDayBuyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID)
|
| | | curDayItemTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID)
|
| | | if curDayBuyTimes + curDayItemTimes - curDayTimes >= 0:
|
| | | GameWorld.DebugLog('剩余次数已达上限,不可增加!')
|
| | | return
|
| | | |
| | | if addType == 0:
|
| | | dayBuyTimesLimit = ipyData.GetDayBuyTimes()
|
| | | buyNeedMoney = ipyData.GetBuyNeedMoney()
|
| | | if not dayBuyTimesLimit or not buyNeedMoney:
|
| | | return
|
| | | if curDayBuyTimes >= dayBuyTimesLimit:
|
| | | GameWorld.DebugLog('今日购买次数已达上限,不可增加!')
|
| | | return
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, buyNeedMoney, ChConfig.Def_Cost_BuyDailyActionCnt, {'dailyID':dailyID, 'curDayBuyTimes':curDayBuyTimes}):
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID, curDayBuyTimes + 1)
|
| | | |
| | | elif addType == 1:
|
| | | dayItemAddTimesLimit = ipyData.GetDayItemAddTimes()
|
| | | dayItemID = ipyData.GetDayItemID()
|
| | | if not dayItemAddTimesLimit or not dayItemID:
|
| | | return
|
| | | if curDayItemTimes >= dayItemAddTimesLimit:
|
| | | GameWorld.DebugLog('今日使用物品增加次数已达上限,不可增加!')
|
| | | return
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(dayItemID, itemPack, 1)
|
| | | if not enough:
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, indexList, 1, False, "DailyActionCnt")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID, curDayItemTimes + 1)
|
| | |
|
| | | else:
|
| | | return
|
| | | SyncDailyActionInfo(curPlayer, [dailyID])
|
| | | return
|
| | |
|
| | |
|
| | | ## 同步活跃度信息
|
| | | # @param curPlayer
|
| | |
| | | activityInfo.Clear()
|
| | | activityInfo.ActionID = activityNum
|
| | | activityInfo.DayFinishCnt = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % activityNum)
|
| | | activityInfo.DayBuyTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % activityNum)
|
| | | activityInfo.DayItemTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayItemTimes % activityNum)
|
| | | activityInfo.WeekFinishCnt = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionWeekTimes % activityNum)
|
| | | sendPack.ActionInfo.append(activityInfo)
|
| | |
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
|
| | | ##################################副本类增加活跃##########################################
|
| | | ## 参加副本获得活跃度
|
| | | # @param curPlayer 玩家实例
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.PlayerFairyDomain
|
| | | #
|
| | | # @todo:缥缈仙域
|
| | | # @author xdh
|
| | | # @date 2019-04-04
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 缥缈仙域
|
| | | #---------------------------------------------------------------------
|
| | | #"""Version = 2019-04-04"""
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import ShareDefine
|
| | | import GameWorld
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import PlayerActivity
|
| | |
|
| | | import copy
|
| | |
|
| | | #0-奇遇 1-宝藏 2-仙草 3-妖王 4-灵草
|
| | | (
|
| | | FDEventType0,
|
| | | FDEventType1,
|
| | | FDEventType2,
|
| | | FDEventType3,
|
| | | FDEventType4,
|
| | | ) = range(5)
|
| | |
|
| | | (
|
| | | FDEventState_No, #不可拜访0
|
| | | FDEventState_CanVisit, #可拜访1
|
| | | FDEventState_Visiting, #拜访中2
|
| | | FDEventState_Visited, #已拜访3
|
| | | ) = range(4)
|
| | |
|
| | |
|
| | | def OnLogin(curPlayer):
|
| | | NotifyVisitFairyDomainInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | #// A5 26 寻访仙域 #tagCMVisitFairyDomain
|
| | | #
|
| | | #struct tagCMVisitFairyDomain
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE Type; //0-开始寻访 1-结束寻访
|
| | | #};
|
| | | def OnVisitFairyDomain(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | dailyID = ShareDefine.DailyActionID_FairyDomain
|
| | | hasOpen = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID)
|
| | | if not hasOpen:
|
| | | GameWorld.DebugLog(" 寻访仙域活动未开启!")
|
| | | return
|
| | | otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
|
| | | maxEventCnt = max([info[1] for info in otherCntRateList]) + 1 #最大可出现事件个数
|
| | | |
| | | if clientData.Type == 1: #结束寻访
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState):
|
| | | GameWorld.DebugLog(" 未开始寻访仙域, 无法结束")
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 0)
|
| | | for i in xrange(maxEventCnt):
|
| | | fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
|
| | | if fdEventID:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID%i, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState%fdEventID, 0)
|
| | | |
| | | NotifyVisitFairyDomainInfo(curPlayer)
|
| | | return
|
| | | |
| | | #是否寻访中
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState):
|
| | | GameWorld.DebugLog(" 正在寻访仙域中!请先退出寻访")
|
| | | return
|
| | | |
| | | if not PlayerActivity.AddDailyActionFinishCnt(curPlayer, dailyID):
|
| | | GameWorld.DebugLog(" 寻访仙域次数不足!")
|
| | | return
|
| | | |
| | | #随机事件 重置事件状态
|
| | | visitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
|
| | | specialVisitDict = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 5, {})
|
| | | maxSpecialCnt = max(specialVisitDict) if specialVisitDict else 0
|
| | | if visitCnt + 1 in specialVisitDict:
|
| | | fdEventIDList = specialVisitDict[visitCnt + 1]
|
| | | else:
|
| | | fdEventTypeDict = {}
|
| | | #先随机奇遇事件
|
| | | fortuitousEventRate = IpyGameDataPY.GetFuncCfg('ImmortalDomain')
|
| | | if GameWorld.CanHappen(fortuitousEventRate):
|
| | | fdEventTypeDict[FDEventType0] = 1
|
| | | |
| | | otherCnt = GameWorld.GetResultByRandomList(otherCntRateList, 0)
|
| | | if otherCnt:
|
| | | otherEventRateList = copy.deepcopy(IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 3))
|
| | | unRepeatTypeList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 4)
|
| | | for _ in xrange(otherCnt):
|
| | | otherEventType = GameWorld.GetResultByRandomList(otherEventRateList, 0)
|
| | | if not otherEventType:
|
| | | continue
|
| | | if otherEventType in unRepeatTypeList:
|
| | | for index, info in enumerate(otherEventRateList):
|
| | | if otherEventType == info[1]:
|
| | | otherEventRateList = GameWorld.ResetRiseList(otherEventRateList, index)
|
| | | break
|
| | | fdEventTypeDict[otherEventType] = fdEventTypeDict.get(otherEventType, 0) + 1
|
| | | |
| | | fdEventIDList = []
|
| | | for eventType, cnt in fdEventTypeDict.items():
|
| | | fdEventIDList += __RandomFDEventByType(curPlayer, eventType, cnt)
|
| | | if not fdEventIDList:
|
| | | GameWorld.Log('寻访仙域, 没有随机出事件!!')
|
| | | return
|
| | | |
| | | if visitCnt < maxSpecialCnt:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainVisitCnt, visitCnt + 1)
|
| | | #设置事件
|
| | | for i in xrange(maxEventCnt):
|
| | | fdEventID = fdEventIDList[i] if i < len(fdEventIDList) else 0
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID % i, fdEventID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, FDEventState_CanVisit)
|
| | | #设置寻访中
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 1)
|
| | | #设置初始体力
|
| | | initEnergy = IpyGameDataPY.GetFuncCfg('ImmortalDomainStrength')
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEnergy, initEnergy)
|
| | | GameWorld.DebugLog('寻访仙域 随机结果 fdEventIDList=%s, visitCnt=%s' % (fdEventIDList, visitCnt))
|
| | | #֪ͨ
|
| | | NotifyVisitFairyDomainInfo(curPlayer, fdEventIDList)
|
| | | return
|
| | |
|
| | |
|
| | | def __RandomFDEventByType(curPlayer, eventType, cnt):
|
| | | ##根据事件类型随机事件
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'EventType':eventType}, True)
|
| | | if not ipyDataList:
|
| | | return []
|
| | | randomRateList = []
|
| | | rate = 0
|
| | | for ipyData in ipyDataList:
|
| | | needAlchemyLV = ipyData.GetNeedAlchemyLV()
|
| | | curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | if curAlchemyLV < needAlchemyLV - 1:
|
| | | #丹炉等级不足
|
| | | continue
|
| | | rate += ipyData.GetWeight()
|
| | | randomRateList.append([rate, ipyData.GetID()])
|
| | | if not randomRateList:
|
| | | GameWorld.DebugLog(' 缥缈仙域刷新池 随机库获取错误 !eventType=%s' % eventType, curPlayer.GetID())
|
| | | return []
|
| | | randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, cnt, [])
|
| | | |
| | | return randomResultList
|
| | |
|
| | |
|
| | | def SetFairyDomainEventState(curPlayer, fdeventID, state):
|
| | | ## 设置缥缈事件状态, return 是否成功
|
| | | if state not in [FDEventState_Visiting, FDEventState_Visited]: # 1-未拜访 2-拜访中 3-已拜访
|
| | | GameWorld.Log('缥缈仙域事件状态设置错误,state=%s' % state)
|
| | | return
|
| | | curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
|
| | | if state == FDEventState_Visiting:
|
| | | if curState != FDEventState_CanVisit:
|
| | | GameWorld.Log('缥缈仙域事件状态设置错误,fdeventID=%s, state=%s, curState=%s' % (fdeventID, state, curState))
|
| | | return
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('FairyDomain', fdeventID)
|
| | | if not ipyData:
|
| | | return
|
| | | costEnergy = ipyData.GetCostEnergy()
|
| | | curEnergy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEnergy)
|
| | | if curEnergy < costEnergy:
|
| | | GameWorld.Log('缥缈仙域事件状态设置,体力不足!,fdeventID=%s, costEnergy=%s, curEnergy=%s' % (fdeventID, costEnergy, curEnergy))
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEnergy, curEnergy - costEnergy)
|
| | | elif state == FDEventState_Visited:
|
| | | if curState != FDEventState_Visiting:
|
| | | GameWorld.Log('缥缈仙域事件状态设置错误,fdeventID=%s, state=%s, curState=%s' % (fdeventID, state, curState))
|
| | | return
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdeventID, state)
|
| | | NotifyVisitFairyDomainInfo(curPlayer, fdeventID)
|
| | | return True
|
| | |
|
| | |
|
| | | def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=[]):
|
| | | if not fdEventList:
|
| | | otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
|
| | | maxEventCnt = max([info[1] for info in otherCntRateList]) + 1 #最大可出现事件个数
|
| | | for i in xrange(maxEventCnt):
|
| | | fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
|
| | | if fdEventID:
|
| | | fdEventList.append(fdEventID)
|
| | | |
| | | packData = ChPyNetSendPack.tagMCFairyDomainInfo()
|
| | | packData.State = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState)
|
| | | packData.Energy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEnergy)
|
| | | packData.InfoList = []
|
| | | for fdeventID in fdEventList:
|
| | | fdeventData = ChPyNetSendPack.tagMCFairyDomainEvent()
|
| | | fdeventData.EventID = fdeventID
|
| | | fdeventData.EventState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
|
| | | packData.InfoList.append(fdeventData)
|
| | | packData.Count = len(packData.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
| | | DailyActionID_FamilyBoss1, # 仙盟BOSS第一场 22
|
| | | DailyActionID_FamilyBoss2, # 仙盟BOSS第二场 23
|
| | | DailyActionID_HorsePetBoss, # 骑宠BOSS 24
|
| | | ) = range(1, 24 + 1)
|
| | | DailyActionID_FairyDomain, # 缥缈仙域 25
|
| | | ) = range(1, 25 + 1)
|
| | |
|
| | |
|
| | |
|