| | |
| | | Def_Billboard_MaxCnt = 100
|
| | | #---------------------------------------------------------------------
|
| | | #请求类型(需要和MapServer中的一致)
|
| | | Def_QueryType_Count = 54
|
| | | Def_QueryType_Count = 55
|
| | | (
|
| | | queryType_sqtPlayer, #查询玩家
|
| | | queryType_sqtFamilyWar, #家族战
|
| | |
| | | queryType_ServerRewardNotify, #全服奖励提示
|
| | | queryType_EnterFB, #进入副本
|
| | | queryType_NPCInfo, #查询NPCInfo
|
| | | queryType_NPCCnt, #查询NPC数量
|
| | | ) = range(0, Def_QueryType_Count)
|
| | | #------------------------------------------------------------------------------
|
| | | #家族某行为类型保存的条数
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 27 查询地图NPC数量信息 #tagCMQueryNPCCntInfo
|
| | |
|
| | | class tagCMQueryNPCCntInfo(Structure):
|
| | | Head = tagHead()
|
| | | MapID = 0 #(DWORD MapID)// 目标地图ID
|
| | | LineID = 0 #(WORD LineID)// 线路ID
|
| | | IsNoTimeLimit = 0 #(BYTE IsNoTimeLimit)//是否没有查询时间限制,默认有限制
|
| | | NPCIDListLen = 0 #(BYTE NPCIDListLen)
|
| | | NPCIDList = "" #(String NPCIDList)// 需要查询的NPCID列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA2
|
| | | self.Head.SubCmd = 0x27
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.MapID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.LineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.IsNoTimeLimit,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.NPCIDListLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.NPCIDList,_pos = CommFunc.ReadString(_lpData, _pos,self.NPCIDListLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA2
|
| | | self.Head.SubCmd = 0x27
|
| | | self.MapID = 0
|
| | | self.LineID = 0
|
| | | self.IsNoTimeLimit = 0
|
| | | self.NPCIDListLen = 0
|
| | | self.NPCIDList = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 2
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.NPCIDList)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.MapID)
|
| | | data = CommFunc.WriteWORD(data, self.LineID)
|
| | | data = CommFunc.WriteBYTE(data, self.IsNoTimeLimit)
|
| | | data = CommFunc.WriteBYTE(data, self.NPCIDListLen)
|
| | | data = CommFunc.WriteString(data, self.NPCIDListLen, self.NPCIDList)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | MapID:%d,
|
| | | LineID:%d,
|
| | | IsNoTimeLimit:%d,
|
| | | NPCIDListLen:%d,
|
| | | NPCIDList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.MapID,
|
| | | self.LineID,
|
| | | self.IsNoTimeLimit,
|
| | | self.NPCIDListLen,
|
| | | self.NPCIDList
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMQueryNPCCntInfo=tagCMQueryNPCCntInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMQueryNPCCntInfo.Head.Cmd,m_NAtagCMQueryNPCCntInfo.Head.SubCmd))] = m_NAtagCMQueryNPCCntInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 13 查询地图NPC信息 #tagCMQueryNPCInfo
|
| | |
|
| | | class tagCMQueryNPCInfo(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A9 04 通知神兽副本NPC刷新时间 #tagGCDogzNPCRefreshTime
|
| | |
|
| | | class tagDogzTimeInfoObj(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NPCID", c_int), # npcid
|
| | | ("RefreshSecond", c_int), # 刷新倒计时, 秒
|
| | | ]
|
| | |
|
| | | 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.NPCID = 0
|
| | | self.RefreshSecond = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagDogzTimeInfoObj)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A9 04 通知神兽副本NPC刷新时间 //tagGCDogzNPCRefreshTime:
|
| | | NPCID:%d,
|
| | | RefreshSecond:%d
|
| | | '''\
|
| | | %(
|
| | | self.NPCID,
|
| | | self.RefreshSecond
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCDogzNPCRefreshTime(Structure):
|
| | | Head = tagHead()
|
| | | Cnt = 0 #(BYTE Cnt)//信息个数
|
| | | InfoList = list() #(vector<tagDogzTimeInfoObj> InfoList)//信息列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA9
|
| | | self.Head.SubCmd = 0x04
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.Cnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Cnt):
|
| | | temInfoList = tagDogzTimeInfoObj()
|
| | | _pos = temInfoList.ReadData(_lpData, _pos)
|
| | | self.InfoList.append(temInfoList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA9
|
| | | self.Head.SubCmd = 0x04
|
| | | self.Cnt = 0
|
| | | self.InfoList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.Cnt):
|
| | | 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.Cnt)
|
| | | for i in range(self.Cnt):
|
| | | data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | Cnt:%d,
|
| | | InfoList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Cnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagGCDogzNPCRefreshTime=tagGCDogzNPCRefreshTime()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCDogzNPCRefreshTime.Head.Cmd,m_NAtagGCDogzNPCRefreshTime.Head.SubCmd))] = m_NAtagGCDogzNPCRefreshTime
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A9 A9 通知好友互赠精力信息 #tagGCFriendSendEnergyInfo
|
| | |
|
| | | class tagGCFriendSendEnergyInfo(Structure):
|
| | |
| | | class tagMCNPCIDCollectionCnt(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("NPCID", c_int), #NPCID
|
| | | ("CollectionCnt", c_ubyte), #已采集次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x26
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x26
|
| | | self.NPCID = 0
|
| | | self.CollectionCnt = 0
|
| | | return
|
| | |
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 26 NPCID已采集次数信息 //tagMCNPCIDCollectionCntInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | NPCID:%d,
|
| | | CollectionCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.NPCID,
|
| | | self.CollectionCnt
|
| | | )
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A7 14 通知查询的NPC数量 #tagMCNPCCntList
|
| | |
|
| | | class tagMCNPCCntInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NPCID", c_int), |
| | | ("Cnt", c_int), |
| | | ]
|
| | |
|
| | | 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.NPCID = 0
|
| | | self.Cnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCNPCCntInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A7 14 通知查询的NPC数量 //tagMCNPCCntList:
|
| | | NPCID:%d,
|
| | | Cnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.NPCID,
|
| | | self.Cnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCNPCCntList(Structure):
|
| | | Head = tagHead()
|
| | | MapID = 0 #(DWORD MapID)
|
| | | NPCInfoCnt = 0 #(BYTE NPCInfoCnt)
|
| | | NPCInfoList = list() #(vector<tagMCNPCCntInfo> NPCInfoList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA7
|
| | | self.Head.SubCmd = 0x14
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.MapID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.NPCInfoCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.NPCInfoCnt):
|
| | | temNPCInfoList = tagMCNPCCntInfo()
|
| | | _pos = temNPCInfoList.ReadData(_lpData, _pos)
|
| | | self.NPCInfoList.append(temNPCInfoList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA7
|
| | | self.Head.SubCmd = 0x14
|
| | | self.MapID = 0
|
| | | self.NPCInfoCnt = 0
|
| | | self.NPCInfoList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.NPCInfoCnt):
|
| | | length += self.NPCInfoList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.MapID)
|
| | | data = CommFunc.WriteBYTE(data, self.NPCInfoCnt)
|
| | | for i in range(self.NPCInfoCnt):
|
| | | data = CommFunc.WriteString(data, self.NPCInfoList[i].GetLength(), self.NPCInfoList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | MapID:%d,
|
| | | NPCInfoCnt:%d,
|
| | | NPCInfoList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.MapID,
|
| | | self.NPCInfoCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCNPCCntList=tagMCNPCCntList()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCNPCCntList.Head.Cmd,m_NAtagMCNPCCntList.Head.SubCmd))] = m_NAtagMCNPCCntList
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A7 01 通知选中对象 # tagMCNotifySelectObj
|
| | |
|
| | | class tagMCNotifySelectObj(Structure):
|
| | |
| | | class tagMCNPCInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ObjID", c_int),
|
| | | ("NPCID", c_int),
|
| | | ("NPCHP", c_int),
|
| | |
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA7
|
| | | self.SubCmd = 0x06
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA7
|
| | | self.SubCmd = 0x06
|
| | | self.ObjID = 0
|
| | | self.NPCID = 0
|
| | | self.NPCHP = 0
|
| | |
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A7 06 通知查询的NPC信息 //tagMCNPCInfoList:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ObjID:%d,
|
| | | NPCID:%d,
|
| | | NPCHP:%d,
|
| | |
| | | RefreshSecond:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ObjID,
|
| | | self.NPCID,
|
| | | self.NPCHP,
|
| | |
| | | if IsMapNeedBossShunt(0):
|
| | | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntPlayer, PyGameData.g_bossShuntPlayerInfo)
|
| | | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntDeadLine, PyGameData.g_bossShuntDeadLine)
|
| | | #通知一个参数
|
| | | bossID = IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2)
|
| | | onlineCnt = __GetBossOnlineHeroCnt(bossID)[0]
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt % bossID, onlineCnt)
|
| | | return
|
| | |
|
| | |
|
| | |
| | |
|
| | | newNum = newOnlieCnt * 100 + unUpdataCnt
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_GameWorldBossOnlineCnt % bossid, newNum)
|
| | | if bossid == IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2):
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt % bossid, newOnlieCnt)
|
| | | GameWorld.DebugLog("设置计算boss刷新时间用的在线人数 Change:bossid=%s, beforeOnlineCnt = %s, newOnlieCnt = %s, unUpdataCnt=%s" % (bossid, beforeOnlineCnt, newOnlieCnt, unUpdataCnt))
|
| | | return
|
| | |
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
|
| | | def Sync_DogzNPCRefreshTime(msgList):
|
| | | #同步神兽副本NPC刷新时间
|
| | | playerID, refreshTimeDict = msgList
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) if playerID else None
|
| | | if playerID and not curPlayer:
|
| | | return
|
| | | if not refreshTimeDict:
|
| | | return
|
| | | packData = ChPyNetSendPack.tagGCDogzNPCRefreshTime()
|
| | | packData.InfoList=[]
|
| | | for npcid, rTime in refreshTimeDict.items():
|
| | | timeInfo = ChPyNetSendPack.tagDogzTimeInfoObj()
|
| | | timeInfo.NPCID = npcid
|
| | | timeInfo.RefreshSecond = rTime
|
| | | packData.InfoList.append(timeInfo)
|
| | | packData.Cnt = len(packData.InfoList)
|
| | | if not playerID:
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetActivePlayerCount()):
|
| | | curPlayer = playerManager.GetActivePlayerAt(i)
|
| | | if curPlayer == None or not curPlayer.GetInitOK():
|
| | | continue
|
| | | if PlayerControl.GetIsTJG(curPlayer):
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | else:
|
| | | if PlayerControl.GetIsTJG(curPlayer):
|
| | | return
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return |
| | |
| | | elif queryType == ChConfig.queryType_NPCInfo:
|
| | | __QueryMapNPCInfo(curPlayer, queryCallName, sendCMD)
|
| | | return
|
| | | # 查询地图NPC数量
|
| | | elif queryType == ChConfig.queryType_NPCCnt:
|
| | | __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD)
|
| | | return
|
| | | else:
|
| | | GameWorld.ErrLog('unKnow queryType = %s' % (queryType))
|
| | |
|
| | |
| | | queryCallName, sendCMD, len(sendCMD), curPlayer.GetRouteServerIndex())
|
| | | return
|
| | |
|
| | | ## 查询目标地图NPC数量
|
| | | # @param curPlayer: 请求玩家
|
| | | # @param queryCallName: 请求回调名
|
| | | # @param sendCMD: 请求的命令 根据请求类型和请求命令来决定最终操作
|
| | | # @return None
|
| | | def __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD):
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | try:
|
| | | mapInfo = eval(sendCMD)
|
| | | except BaseException:
|
| | | GameWorld.ErrLog("__QueryMapNPCCntInfo() sendCMD=%s error" % sendCMD)
|
| | | return
|
| | | |
| | | if not mapInfo:
|
| | | return
|
| | | |
| | | tagMapID = mapInfo[0]
|
| | | playerManager.MapServer_QueryPlayer(curPlayer.GetPlayerID(), ChConfig.queryType_NPCCnt, 0, tagMapID,
|
| | | queryCallName, sendCMD, len(sendCMD), curPlayer.GetRouteServerIndex())
|
| | | return
|
| | |
|
| | | ## 获得家族属性(等级,人数)获得自己所在家族的属性
|
| | | # @param curPlayer 请求的玩家
|
| | |
| | | if callName =="AddBossRebornPoint":
|
| | | GameWorldBoss.AddBossRebornPoint(eval(resultName))
|
| | | return
|
| | | |
| | | #通知神兽副本NPC刷新时间
|
| | | if callName =="DogzNPCTime":
|
| | | GameWorldBoss.Sync_DogzNPCRefreshTime(eval(resultName))
|
| | | return
|
| | | #---return分割线-----------------------------------------------------------------
|
| | |
|
| | |
|
| | |
| | | Def_Notify_WorldKey_GameWorldBossOnlineCnt = "GameWorldBossOnlineCnt_%s" #世界boss重生时间计算 在线人数统计 %s为bossid
|
| | | Def_Notify_WorldKey_BossShuntPlayer = 'BossShuntPlayer' # boss分流玩家信息
|
| | | Def_Notify_WorldKey_BossShuntDeadLine = 'BossShuntDeadLine' # boss分流线路已死亡的线路
|
| | | Def_Notify_WorldKey_BossOnlineHeroCnt = 'BossOnlineHeroCnt_%s' # boss刷新时间用的在线人数, 参数为NPCID
|
| | |
|
| | | Def_Notify_WorldKey_FamilyActivityDayState = "FamilyActivityDayState" #战盟相关活动今日开启状态, 按位存储代表今日是否开启过
|
| | |
|
| | |
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 15
|
| | | RegisterPackCount = 16
|
| | |
|
| | | PacketCMD_1 = 0xA5
|
| | | PacketSubCMD_1 = 0x04
|
| | |
| | | PacketSubCMD_15=0x05
|
| | | PacketCallFunc_15=PYWorldTransPort
|
| | |
|
| | | PacketCMD_16=0xA2
|
| | | PacketSubCMD_16=0x27
|
| | | PacketCallFunc_16=OnQueryMapNPCCntInfo
|
| | |
|
| | | ;购买相关的
|
| | | [BuySomething]
|
| | |
| | | 'Guard':[Def_FBMapID_Guard], #守护副本
|
| | | 'SealDemon':[Def_FBMapID_SealDemon, Def_FBMapID_SealDemonEx], #封魔坛
|
| | | 'XMZZ':[Def_FBMapID_XMZZ], #仙魔之争
|
| | | #'Dogz':[Def_FBMapID_Dogz], #神兽副本
|
| | | 'Dogz':[Def_FBMapID_Dogz], #神兽副本
|
| | | }
|
| | |
|
| | | #特殊副本ID, 由系统分配, 进入时候不验证IsMapCopyFull
|
| | |
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #请求类型(需要和GameServer中的一致)
|
| | | Def_QueryType_Count = 54
|
| | | Def_QueryType_Count = 55
|
| | | (
|
| | | queryType_sqtPlayer, #查询玩家
|
| | | queryType_sqtFamilyWar, #家族战
|
| | |
| | | queryType_ServerRewardNotify, #全服奖励提示
|
| | | queryType_EnterFB, #进入副本
|
| | | queryType_NPCInfo, #查询NPCInfo
|
| | | queryType_NPCCnt, #查询NPC数量
|
| | | ) = range(0, Def_QueryType_Count)
|
| | | #------------------------------------------------------------------------------
|
| | | #---------------------------------------------------------------------
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 27 查询地图NPC数量信息 #tagCMQueryNPCCntInfo
|
| | |
|
| | | class tagCMQueryNPCCntInfo(Structure):
|
| | | Head = tagHead()
|
| | | MapID = 0 #(DWORD MapID)// 目标地图ID
|
| | | LineID = 0 #(WORD LineID)// 线路ID
|
| | | IsNoTimeLimit = 0 #(BYTE IsNoTimeLimit)//是否没有查询时间限制,默认有限制
|
| | | NPCIDListLen = 0 #(BYTE NPCIDListLen)
|
| | | NPCIDList = "" #(String NPCIDList)// 需要查询的NPCID列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA2
|
| | | self.Head.SubCmd = 0x27
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.MapID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.LineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.IsNoTimeLimit,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.NPCIDListLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.NPCIDList,_pos = CommFunc.ReadString(_lpData, _pos,self.NPCIDListLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA2
|
| | | self.Head.SubCmd = 0x27
|
| | | self.MapID = 0
|
| | | self.LineID = 0
|
| | | self.IsNoTimeLimit = 0
|
| | | self.NPCIDListLen = 0
|
| | | self.NPCIDList = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 2
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.NPCIDList)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.MapID)
|
| | | data = CommFunc.WriteWORD(data, self.LineID)
|
| | | data = CommFunc.WriteBYTE(data, self.IsNoTimeLimit)
|
| | | data = CommFunc.WriteBYTE(data, self.NPCIDListLen)
|
| | | data = CommFunc.WriteString(data, self.NPCIDListLen, self.NPCIDList)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | MapID:%d,
|
| | | LineID:%d,
|
| | | IsNoTimeLimit:%d,
|
| | | NPCIDListLen:%d,
|
| | | NPCIDList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.MapID,
|
| | | self.LineID,
|
| | | self.IsNoTimeLimit,
|
| | | self.NPCIDListLen,
|
| | | self.NPCIDList
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMQueryNPCCntInfo=tagCMQueryNPCCntInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMQueryNPCCntInfo.Head.Cmd,m_NAtagCMQueryNPCCntInfo.Head.SubCmd))] = m_NAtagCMQueryNPCCntInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 13 查询地图NPC信息 #tagCMQueryNPCInfo
|
| | |
|
| | | class tagCMQueryNPCInfo(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A9 04 通知神兽副本NPC刷新时间 #tagGCDogzNPCRefreshTime
|
| | |
|
| | | class tagDogzTimeInfoObj(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NPCID", c_int), # npcid
|
| | | ("RefreshSecond", c_int), # 刷新倒计时, 秒
|
| | | ]
|
| | |
|
| | | 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.NPCID = 0
|
| | | self.RefreshSecond = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagDogzTimeInfoObj)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A9 04 通知神兽副本NPC刷新时间 //tagGCDogzNPCRefreshTime:
|
| | | NPCID:%d,
|
| | | RefreshSecond:%d
|
| | | '''\
|
| | | %(
|
| | | self.NPCID,
|
| | | self.RefreshSecond
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCDogzNPCRefreshTime(Structure):
|
| | | Head = tagHead()
|
| | | Cnt = 0 #(BYTE Cnt)//信息个数
|
| | | InfoList = list() #(vector<tagDogzTimeInfoObj> InfoList)//信息列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA9
|
| | | self.Head.SubCmd = 0x04
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.Cnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Cnt):
|
| | | temInfoList = tagDogzTimeInfoObj()
|
| | | _pos = temInfoList.ReadData(_lpData, _pos)
|
| | | self.InfoList.append(temInfoList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA9
|
| | | self.Head.SubCmd = 0x04
|
| | | self.Cnt = 0
|
| | | self.InfoList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.Cnt):
|
| | | 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.Cnt)
|
| | | for i in range(self.Cnt):
|
| | | data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | Cnt:%d,
|
| | | InfoList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Cnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagGCDogzNPCRefreshTime=tagGCDogzNPCRefreshTime()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCDogzNPCRefreshTime.Head.Cmd,m_NAtagGCDogzNPCRefreshTime.Head.SubCmd))] = m_NAtagGCDogzNPCRefreshTime
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A9 A9 通知好友互赠精力信息 #tagGCFriendSendEnergyInfo
|
| | |
|
| | | class tagGCFriendSendEnergyInfo(Structure):
|
| | |
| | | class tagMCNPCIDCollectionCnt(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("NPCID", c_int), #NPCID
|
| | | ("CollectionCnt", c_ubyte), #已采集次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x26
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x26
|
| | | self.NPCID = 0
|
| | | self.CollectionCnt = 0
|
| | | return
|
| | |
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 26 NPCID已采集次数信息 //tagMCNPCIDCollectionCntInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | NPCID:%d,
|
| | | CollectionCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.NPCID,
|
| | | self.CollectionCnt
|
| | | )
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A7 14 通知查询的NPC数量 #tagMCNPCCntList
|
| | |
|
| | | class tagMCNPCCntInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NPCID", c_int), |
| | | ("Cnt", c_int), |
| | | ]
|
| | |
|
| | | 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.NPCID = 0
|
| | | self.Cnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCNPCCntInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A7 14 通知查询的NPC数量 //tagMCNPCCntList:
|
| | | NPCID:%d,
|
| | | Cnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.NPCID,
|
| | | self.Cnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCNPCCntList(Structure):
|
| | | Head = tagHead()
|
| | | MapID = 0 #(DWORD MapID)
|
| | | NPCInfoCnt = 0 #(BYTE NPCInfoCnt)
|
| | | NPCInfoList = list() #(vector<tagMCNPCCntInfo> NPCInfoList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA7
|
| | | self.Head.SubCmd = 0x14
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.MapID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.NPCInfoCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.NPCInfoCnt):
|
| | | temNPCInfoList = tagMCNPCCntInfo()
|
| | | _pos = temNPCInfoList.ReadData(_lpData, _pos)
|
| | | self.NPCInfoList.append(temNPCInfoList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA7
|
| | | self.Head.SubCmd = 0x14
|
| | | self.MapID = 0
|
| | | self.NPCInfoCnt = 0
|
| | | self.NPCInfoList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.NPCInfoCnt):
|
| | | length += self.NPCInfoList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.MapID)
|
| | | data = CommFunc.WriteBYTE(data, self.NPCInfoCnt)
|
| | | for i in range(self.NPCInfoCnt):
|
| | | data = CommFunc.WriteString(data, self.NPCInfoList[i].GetLength(), self.NPCInfoList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | MapID:%d,
|
| | | NPCInfoCnt:%d,
|
| | | NPCInfoList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.MapID,
|
| | | self.NPCInfoCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCNPCCntList=tagMCNPCCntList()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCNPCCntList.Head.Cmd,m_NAtagMCNPCCntList.Head.SubCmd))] = m_NAtagMCNPCCntList
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A7 01 通知选中对象 # tagMCNotifySelectObj
|
| | |
|
| | | class tagMCNotifySelectObj(Structure):
|
| | |
| | | class tagMCNPCInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ObjID", c_int),
|
| | | ("NPCID", c_int),
|
| | | ("NPCHP", c_int),
|
| | |
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA7
|
| | | self.SubCmd = 0x06
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA7
|
| | | self.SubCmd = 0x06
|
| | | self.ObjID = 0
|
| | | self.NPCID = 0
|
| | | self.NPCHP = 0
|
| | |
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A7 06 通知查询的NPC信息 //tagMCNPCInfoList:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ObjID:%d,
|
| | | NPCID:%d,
|
| | | NPCHP:%d,
|
| | |
| | | RefreshSecond:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ObjID,
|
| | | self.NPCID,
|
| | | self.NPCHP,
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package GameWorldLogic.FBProcess.GameLogic_Dogz
|
| | | #
|
| | | # @todo:神兽地界
|
| | | # @author xdh
|
| | | # @date 2018-08-17
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 神兽地界
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2018-08-17 16:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import IpyGameDataPY
|
| | | import IPY_GameWorld
|
| | | import ShareDefine
|
| | | import NPCCustomRefresh
|
| | | import SkillCommon
|
| | | import GameObj
|
| | | import time
|
| | | import random
|
| | |
|
| | |
|
| | | #{(标识点):[npcid,单个点数量,刷新间隔秒, 每次刷新只数, 第一次刷新只数]}
|
| | | #{(101,102,103):[20302001,1,'20', 2, 10]}
|
| | | (
|
| | | Def_NPCID,
|
| | | Def_MaxCnt,
|
| | | Def_TimeFormula,
|
| | | Def_RefreshCnt,
|
| | | Def_FirstRefreshCnt
|
| | | ) = range(5)
|
| | |
|
| | | Map_Dogzfb_LastRefreshTime = "Dogzfb_LastRefreshTime%s" # 刷新时间 参数npcid
|
| | | Map_Dogzfb_NextNeedTime = "NextNeedTime%s" # 下次刷新需要时间 参数npcid
|
| | | Map_Dogzfb_LastCheckTick = "LastCheckTick" # 上次检查时间
|
| | | Map_Dogzfb_NPCRemainCnt = 'NPCRemainCnt_%s' # NPC剩余数量
|
| | | Map_Dogzfb_CollectLostHPTick = 'CollectLostHPTick' # 采集掉线Tick
|
| | |
|
| | |
|
| | | ## 是否能够通过活动查询进入
|
| | | # @param curPlayer 玩家实例
|
| | | # @param mapID 地图ID
|
| | | # @param lineID 线路id
|
| | | # @param tick 时间戳
|
| | | # @return 布尔值
|
| | | def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
| | | return True
|
| | |
|
| | |
|
| | | ## 查询地图是否开启
|
| | | # @param tick 时间戳
|
| | | # @return 布尔值
|
| | | def OnCanOpen(tick):
|
| | | return True
|
| | |
|
| | |
|
| | | ##查询是否可以进入地图
|
| | | # @param ask:请求结构体(IPY_BMChangeMapAsk)
|
| | | # @param tick:时间戳
|
| | | # @return IPY_GameWorld.cme 枚举
|
| | | def OnChangeMapAsk(ask, tick):
|
| | | return IPY_GameWorld.cmeAccept
|
| | |
|
| | |
|
| | | ## 进副本
|
| | | # @param curPlayer
|
| | | # @param tick
|
| | | # @return None
|
| | | def DoEnterFB(curPlayer, tick):
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ### 是否副本复活
|
| | | ## @param None
|
| | | ## @return 是否副本复活
|
| | | #def OnPlayerReborn():
|
| | | # return False
|
| | |
|
| | |
|
| | | ## 获得副本帮助信息
|
| | | # @param curPlayer 当前玩家(被通知对象)
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def DoFBHelp(curPlayer, tick, isEnter=False):
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | | ## 副本行为
|
| | | # @param curPlayer 玩家
|
| | | # @param actionType 行为类型
|
| | | # @param actionInfo 行为信息
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
| | | |
| | | return
|
| | |
|
| | |
|
| | | ## 收集中
|
| | | def OnCollecting(curPlayer, tick):
|
| | | tagObj = curPlayer.GetActionObj()
|
| | | if not tagObj:
|
| | | return
|
| | | if tagObj.GetGameObjType() != IPY_GameWorld.gotNPC:
|
| | | return
|
| | | |
| | | curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
|
| | | npcID = curNPC.GetNPCID()
|
| | | playerID = curPlayer.GetID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | collectLostHPTick = gameFB.GetPlayerGameFBDictByKey(playerID, Map_Dogzfb_CollectLostHPTick)
|
| | |
|
| | | lostCD = IpyGameDataPY.GetFuncEvalCfg('DogzFBCollect', 1, {}).get(npcID, 1)
|
| | | lostTime = (tick - collectLostHPTick) / 1000/lostCD # 掉血次数
|
| | | if lostTime >3:
|
| | | gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPTick, tick)
|
| | | return
|
| | | |
| | | if not lostTime:
|
| | | return
|
| | | gameFB.SetGameFBDict(Map_Dogzfb_CollectLostHPTick, tick)
|
| | | |
| | | |
| | | lostHPPer = IpyGameDataPY.GetFuncEvalCfg('DogzFBCollect', 2, {}).get(npcID, 1)
|
| | | skillTypeID, buffOwner = 0, None
|
| | | lostValue = min(int(GameObj.GetMaxHP(curPlayer) * lostHPPer / 100.0) * lostTime, GameObj.GetHP(curPlayer)-1)
|
| | | if lostValue <=0:
|
| | | return
|
| | | #GameWorld.DebugLog("OnCollecting npcID=%s, lostHPPer=%s,lostTime=%s,lostValue=%s" % (npcID, lostHPPer, lostTime, lostValue))
|
| | | SkillCommon.SkillLostHP(curPlayer, skillTypeID, buffOwner, lostValue, tick)
|
| | | return
|
| | |
|
| | |
|
| | | ##---副本总逻辑计时器---
|
| | | # @param tick:时间戳
|
| | | # @return 无意义
|
| | | # @remarks 副本总逻辑计时器
|
| | | def OnProcess(tick):
|
| | | CheckRefreshBoss(tick)
|
| | | return
|
| | |
|
| | |
|
| | | def CheckRefreshBoss(tick, isFirst=False):
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | lastCheckTick = gameFB.GetGameFBDictByKey(Map_Dogzfb_LastCheckTick)
|
| | | if not (isFirst or (lastCheckTick and tick - lastCheckTick > 1000)):
|
| | | return
|
| | | gameFB.SetGameFBDict(Map_Dogzfb_LastCheckTick, tick)
|
| | | |
| | | dogzRefreshCfg = IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 1, {})
|
| | | curTime = int(time.time())
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | refreshDict = {}
|
| | | for markInfo, refreshInfo in dogzRefreshCfg.items():
|
| | | npcID = refreshInfo[Def_NPCID]
|
| | | |
| | | nextNeedTime = gameWorld.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
|
| | | if not nextNeedTime:
|
| | | continue
|
| | | lastRefreshTime = gameWorld.GetGameWorldDictByKey(Map_Dogzfb_LastRefreshTime % npcID)
|
| | | if lastRefreshTime and curTime - lastRefreshTime < nextNeedTime:
|
| | | #时间未到
|
| | | continue
|
| | | refreshDict[markInfo] = refreshInfo
|
| | | if not refreshDict:
|
| | | return
|
| | | |
| | | npcCntDict = {} #标识点对应数量
|
| | | gameNPC = GameWorld.GetNPCManager()
|
| | | for i in xrange(0, gameNPC.GetCustomNPCRefreshCount()):
|
| | | npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
|
| | | npcCnt = npcRefresh.GetCount()
|
| | | if not npcCnt:
|
| | | continue
|
| | | rmark = npcRefresh.GetRefreshMark()
|
| | | npcCntDict[rmark] = npcCntDict.get(rmark, 0) + npcRefresh.GetCount()
|
| | | |
| | | for markInfo, refreshInfo in refreshDict.items():
|
| | | npcID = refreshInfo[Def_NPCID]
|
| | | refreshCnt = refreshInfo[Def_FirstRefreshCnt] if isFirst else refreshInfo[Def_RefreshCnt]
|
| | | gameWorld.SetGameWorldDict(Map_Dogzfb_LastRefreshTime % npcID, curTime)
|
| | | maxCnt = refreshInfo[Def_MaxCnt]
|
| | | markList = [markInfo] if isinstance(markInfo, int) else list(markInfo)
|
| | | random.shuffle(markList)
|
| | | for rMark in markList:
|
| | | if refreshCnt <=0:
|
| | | break
|
| | | curCnt = npcCntDict.get(rMark, 0)
|
| | | if curCnt >= maxCnt:
|
| | | continue
|
| | | needRefreshCnt = min(refreshCnt, maxCnt - curCnt)
|
| | | refreshCnt -= needRefreshCnt
|
| | | NPCCustomRefresh.SetNPCRefresh(rMark, [(npcID, needRefreshCnt)], needRefreshCnt + curCnt, needRefreshCnt)
|
| | | |
| | | #计算下次多久刷新
|
| | | __UpdateBossTime(npcID, refreshInfo[Def_TimeFormula])
|
| | | |
| | | #通知时间
|
| | | SyncNPCRefreshTime()
|
| | | |
| | | return
|
| | |
|
| | | def OnOnlineCntChange(key, tick):
|
| | | bossid = IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2)
|
| | | if str(bossid) not in key:
|
| | | return
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | lastCheckTick = gameFB.GetGameFBDictByKey(Map_Dogzfb_LastCheckTick)
|
| | | if not lastCheckTick:
|
| | | dogzRefreshCfg = IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 1, {})
|
| | | for refreshInfo in dogzRefreshCfg.values():
|
| | | npcID = refreshInfo[Def_NPCID]
|
| | | __UpdateBossTime(npcID, refreshInfo[Def_TimeFormula])
|
| | | CheckRefreshBoss(tick, True)
|
| | | return
|
| | |
|
| | | def __UpdateBossTime(npcID, formula):
|
| | | gameWorldMgr = GameWorld.GetGameWorld()
|
| | | onlineCnt = gameWorldMgr.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt)
|
| | | nextTime = eval(formula)
|
| | | gameWorldMgr.SetGameWorldDict(Map_Dogzfb_NextNeedTime % npcID, nextTime)
|
| | | #GameWorld.DebugLog(' 怪刷新间隔 npcID=%s, nextTime=%s'%(npcID, nextTime))
|
| | | return
|
| | |
|
| | | def GetDogzNPCRefreshTime(curTime, npcID):
|
| | | #获取NPC剩余刷新时间
|
| | | gameWorldMgr = GameWorld.GetGameWorld()
|
| | | lastRefreshTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_LastRefreshTime % npcID)
|
| | | nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
|
| | | return max(0, nextNeedTime - curTime + lastRefreshTime)
|
| | |
|
| | | def SyncNPCRefreshTime(playerid=0):
|
| | | curTime = int(time.time())
|
| | | syncNPCIDList = IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 3)
|
| | | syncDict = {}
|
| | | for npcID in syncNPCIDList:
|
| | | refreshTime = GetDogzNPCRefreshTime(curTime, npcID)
|
| | | syncDict[npcID] = refreshTime
|
| | | msgStr = str([playerid, syncDict])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'DogzNPCTime', msgStr, len(msgStr))
|
| | | return
|
| | |
|
| | |
| | | # @param None
|
| | | # @param None
|
| | | def SyncCollectionItemInfo(curPlayer, addExp, addMoney, addZhenQi, syncItemInfoList, collectNPCID=0):
|
| | | return #暂不同步
|
| | | if addExp <= 0 and addMoney <= 0 and addZhenQi <= 0 and not syncItemInfoList:
|
| | | return
|
| | |
|
| | |
| | | collectNPCIDTimeLimit = ReadChConfig.GetEvalChConfig('CollectNPCIDTimeLimit')
|
| | | npcIDList = collectNPCIDTimeLimit.keys()
|
| | |
|
| | | if funcTypeList:
|
| | | collection = ChPyNetSendPack.tagMCFuncNPCCollectionCnt()
|
| | | for fType in funcTypeList:
|
| | | todayCollTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcCollTime % fType)
|
| | | collection.Clear()
|
| | | collection.FuncType = fType
|
| | | collection.CollectionCnt = todayCollTime
|
| | | collection.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcBuyTime % fType)
|
| | | NetPackCommon.SendFakePack(curPlayer, collection)
|
| | | # if funcTypeList:
|
| | | # collection = ChPyNetSendPack.tagMCFuncNPCCollectionCnt()
|
| | | # for fType in funcTypeList:
|
| | | # todayCollTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcCollTime % fType)
|
| | | # collection.Clear()
|
| | | # collection.FuncType = fType
|
| | | # collection.CollectionCnt = todayCollTime
|
| | | # collection.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcBuyTime % fType)
|
| | | # NetPackCommon.SendFakePack(curPlayer, collection)
|
| | |
|
| | | if npcIDList:
|
| | | npcIDCollInfo = ChPyNetSendPack.tagMCNPCIDCollectionCntInfo()
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
|
| | | return
|
| | |
|
| | |
|
| | | ## 获取本地图NPC数量
|
| | | # @param queryNPCIDList:查询的NPCID列表
|
| | | # @param tick
|
| | | # @return {NPCID:cnt}
|
| | | def GetNPCCntInfo(queryNPCIDList, tick):
|
| | | npcCntDict = {}
|
| | |
|
| | | if not queryNPCIDList:
|
| | | return npcCntDict
|
| | | |
| | | gameNPCManager = GameWorld.GetNPCManager()
|
| | | GameWorld.DebugLog("GetNPCCntInfo...queryNPCIDList=%s" % (str(queryNPCIDList)))
|
| | |
|
| | | for index in xrange(gameNPCManager.GetNPCCount()):
|
| | | curNPC = gameNPCManager.GetNPCByIndex(index)
|
| | | curID = curNPC.GetID()
|
| | | if curID == 0:
|
| | | continue
|
| | | |
| | | curNPCID = curNPC.GetNPCID()
|
| | | |
| | | if curNPCID not in queryNPCIDList:
|
| | | continue
|
| | | if curNPC.GetCurAction() == IPY_GameWorld.laNPCDie or not curNPC.IsAlive():
|
| | | continue
|
| | | npcCntDict[curNPCID] = npcCntDict.get(curNPCID, 0) + 1
|
| | | |
| | | GameWorld.DebugLog(" npcCntDict=%s" % (str(npcCntDict)))
|
| | | return npcCntDict
|
| | |
|
| | | ## 同步地图NPC数量信息
|
| | | # @param curPlayer:采集玩家实例
|
| | | # @param mapID:
|
| | | # @param npcInfoDict:
|
| | | # @return None
|
| | | def SyncNPCCntInfo(curPlayer, mapID, npcCntDict):
|
| | | npcInfoPack = ChPyNetSendPack.tagMCNPCCntList()
|
| | | npcInfoPack.Clear()
|
| | | npcInfoPack.MapID = mapID
|
| | | npcInfoPack.NPCInfoList = []
|
| | |
|
| | | for npcid, npcCnt in npcCntDict.items():
|
| | | npcInfo = ChPyNetSendPack.tagMCNPCCntInfo()
|
| | | npcInfo.Clear()
|
| | | npcInfo.NPCID = npcid
|
| | | npcInfo.Cnt = npcCnt
|
| | | npcInfoPack.NPCInfoList.append(npcInfo)
|
| | | |
| | | npcInfoPack.NPCInfoCnt = len(npcInfoPack.NPCInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
|
| | | return
|
| | |
|
| | | def SendGameServerGoodItemRecord(mapID, npcID, playerName, playerID, itemID, equipInfo=[]):
|
| | | # @param equipInfo: [equipPlace, itemClassLV, itemColor, itemQuality, itemUserData]
|
| | | # GameWorld.DebugLog("检查物品是否发送GameServer: mapID=%s, npcID=%s, playerName=%s, itemID=%s"
|
| | |
| | | import PlayerTJG
|
| | | import GameLogic_XMZZ
|
| | | import GameLogic_SealDemon
|
| | | import GameLogic_Dogz
|
| | | import PlayerFlashGiftbag
|
| | | import PlayerCostRebate
|
| | | import PlayerSpringSale
|
| | |
| | | # 古神禁地
|
| | | GameLogic_GodArea.GodAreaOnLogin(curPlayer)
|
| | | # # 采集NPC次数通知
|
| | | # NPCCommon.SyncCollNPCTime(curPlayer)
|
| | | NPCCommon.SyncCollNPCTime(curPlayer)
|
| | | #
|
| | | # # 特惠活动
|
| | | # PlayerTeHui.PlayerLogin_TeHui(curPlayer)
|
| | |
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | # 神兽
|
| | | PlayerDogz.OnPlayerLogin(curPlayer)
|
| | | # 神兽副本
|
| | | GameLogic_Dogz.SyncNPCRefreshTime(curPlayer.GetID())
|
| | |
|
| | | # 上线查询一次充值订单
|
| | | curPlayer.SendDBQueryRecharge()
|
| | |
|
| | |
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ## 地图NPC数量查询封包 A2 27 查询地图NPC数量信息 #tagCMQueryNPCCntInfo
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def OnQueryMapNPCCntInfo(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | # 查询间隔控制
|
| | | if not clientData.IsNoTimeLimit:
|
| | | if not GameWorld.CheckPlayerTick(curPlayer, ChConfig.TYPE_Player_Tick_QueryMapNPCInfo, tick):
|
| | | GameWorld.DebugLog("OnQueryMapNPCCntInfo 查询过于频繁!")
|
| | | return
|
| | | |
| | | tagMapID = clientData.MapID
|
| | | tagLineID = clientData.LineID
|
| | | queryNPCStr = clientData.NPCIDList
|
| | | npcIDList = []
|
| | | if queryNPCStr:
|
| | | try: |
| | | npcIDList = eval(clientData.NPCIDList)
|
| | | except BaseException:
|
| | | GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s" % clientData.NPCIDList)
|
| | | return
|
| | | |
| | | if not isinstance(npcIDList, list):
|
| | | GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s is not list!" % str(npcIDList))
|
| | | return
|
| | | |
| | | GameWorld.DebugLog("OnQueryMapNPCCntInfo tagMapID=%s,tagLineID=%s,npcIDList=%s" |
| | | % (tagMapID, tagLineID, str(npcIDList)))
|
| | | |
| | | curMapID = GameWorld.GetMap().GetMapID()
|
| | | |
| | | # 如果是同张地图,直接查询通知
|
| | | if curMapID == tagMapID:
|
| | | npcInfoDict = NPCCommon.GetNPCCntInfo(npcIDList, tick)
|
| | |
|
| | | GameWorld.DebugLog(" 同地图查询curMapID=%s,tagLineID=%s,npcInfoDict=%s" |
| | | % (curMapID, tagLineID, str(npcInfoDict)))
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, tagMapID, npcInfoDict)
|
| | | else:
|
| | | # 请求GameServer目标地图NPC信息
|
| | | sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList])
|
| | | curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCCnt, 0,
|
| | | 'NPCCntInfo', sendMsg, len(sendMsg))
|
| | | return
|
| | |
|
| | |
|
| | | ## 跨服赛报名状态
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | |
| | | import GameLogic_ElderBattlefield
|
| | | import GameLogic_FamilyBoss
|
| | | import GameLogic_FamilyWar
|
| | | import GameLogic_Dogz
|
| | | import OpenServerCampaign
|
| | | import PlayerCostRebate
|
| | | import PlayerSpringSale
|
| | |
| | |
|
| | | #法宝
|
| | | PlayerMagicWeapon.OnDay(curPlayer)
|
| | | PlayerGoldGift.OnDay(curPlayer)
|
| | |
|
| | | # 特殊时间点X点过天
|
| | | elif onEventType == ShareDefine.Def_OnEventTypeEx:
|
| | |
| | | ChItem.ResetItemUseCntToday(curPlayer)
|
| | | # 极品白拿
|
| | | PlayerFreeGoods.OnDay(curPlayer)
|
| | | #采集次数重置
|
| | | NPCCommon.CollNPCTimeOnDay(curPlayer)
|
| | | |
| | |
|
| | | # 以下为支持两种重置模式切换配置的
|
| | | FBCommon.FBOnDay(curPlayer, onEventType)
|
| | |
| | | # 活动buff状态变更
|
| | | elif key.startswith(ShareDefine.Def_Notify_WorldKey_ActionBuffState[:-2]):
|
| | | PlayerAction.OnActionBuffStateChange(key, tick)
|
| | |
|
| | | #boss刷新时间参数
|
| | | elif key.startswith(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt[:-2]):
|
| | | GameLogic_Dogz.OnOnlineCntChange(key, tick)
|
| | | #===============================================================================
|
| | | # ---修改为上述的 统一字典处理
|
| | | # if msg == ChConfig.Def_Notify_Key_PurTalk:
|
| | |
| | |
|
| | | if tick - curPlayer.GetPlayerActionTick() < curPlayer.GetPrepareTime():
|
| | | #时间间隔没有到
|
| | | if prepareState == IPY_GameWorld.pstCollecting:
|
| | | if prepareState in [IPY_GameWorld.pstCollecting, IPY_GameWorld.pstMissionCollecting]:
|
| | | FBLogic.OnCollecting(curPlayer, tick)
|
| | |
|
| | | return
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.RemoteQuery.GY_Query_NPCCnt
|
| | | #
|
| | | # @todo:查询地图NPC数量
|
| | | # @author xdh
|
| | | # @date 2018-08-20
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 查询地图NPC数量
|
| | | #
|
| | | #---------------------------------------------------------------------
|
| | | """Version = 2018-08-20 17:00"""
|
| | |
|
| | |
|
| | | #导入
|
| | | import NPCCommon
|
| | | import GameWorld
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #逻辑实现
|
| | | ## 请求逻辑
|
| | | # @param query_Type 请求类型
|
| | | # @param query_ID 请求的玩家ID
|
| | | # @param packCMDList 发包命令 [ ]
|
| | | # @param tick 当前时间
|
| | | # @return "True" or "False" or ""
|
| | | # @remarks 函数详细说明.
|
| | | def DoLogic(query_Type, query_ID, packCMDList, tick):
|
| | | GameWorld.DebugLog("GY_Query_NPCCnt DoLogic() query_Type=%s,query_ID=%s,packCMDList=%s,tick=%s" % \
|
| | | (query_Type, query_ID, packCMDList, tick))
|
| | | |
| | | if not packCMDList or len(packCMDList) < 3:
|
| | | GameWorld.DebugLog(" DoLogic() return []")
|
| | | return []
|
| | | |
| | | tagMapID = packCMDList[0] # 目标地图id
|
| | | tagLineID = packCMDList[1] # 线路id
|
| | | queryNPCIDList = packCMDList[2] # 查询的NPCID列表
|
| | | |
| | | npcInfoDict = NPCCommon.GetNPCInfo(queryNPCIDList, tick)
|
| | |
|
| | | return [tagMapID, npcInfoDict]
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
|
| | | #执行结果
|
| | | ## 执行结果
|
| | | # @param curPlayer 发出请求的玩家
|
| | | # @param callFunName 功能名称
|
| | | # @param funResult 查询的结果
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def DoResult(curPlayer, callFunName, funResult, tick):
|
| | | GameWorld.DebugLog("GY_Query_NPCCnt DoResult() funResult=%s" % str(funResult))
|
| | | #还原格式 '[]' -> []
|
| | | funResult = eval(funResult)
|
| | | if not funResult or len(funResult) < 2:
|
| | | return
|
| | | |
| | | tagMapID = funResult[0]
|
| | | npcInfoDict = funResult[1]
|
| | | # 发包
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, tagMapID, npcInfoDict)
|
| | | return
|
| | |
|
| | |
| | | Def_Notify_WorldKey_GameWorldBossOnlineCnt = "GameWorldBossOnlineCnt_%s" #世界boss重生时间计算 在线人数统计 %s为bossid
|
| | | Def_Notify_WorldKey_BossShuntPlayer = 'BossShuntPlayer' # boss分流玩家信息
|
| | | Def_Notify_WorldKey_BossShuntDeadLine = 'BossShuntDeadLine' # boss分流线路已死亡的线路
|
| | | Def_Notify_WorldKey_BossOnlineHeroCnt = 'BossOnlineHeroCnt_%s' # boss刷新时间用的在线人数, 参数为NPCID
|
| | |
|
| | | Def_Notify_WorldKey_FamilyActivityDayState = "FamilyActivityDayState" #战盟相关活动今日开启状态, 按位存储代表今日是否开启过
|
| | |
|