5722 【后端】【1.5】跨服BOSS开发(本服异兽之地Boss、跨服蓬莱仙境Boss 次数共享支持)
| | |
| | | Def_WorldKey_CrossPKZoneSeasonID = "CrossPKZoneSeasonID_%s" #跨服PK赛区对应赛季,跨服服务器控制,参数(zoneID)
|
| | | Def_WorldKey_CrossPKZoneSeasonState = "CrossPKZoneSeasonState_%s" #跨服PK赛区赛季状态,跨服服务器控制,参数(zoneID)0-未开启,1-开启中,2-已结束
|
| | | Def_WorldKey_CrossPKBillboardSyncTick = "CrossPKBillboardSyncTick_%s_%s" #跨服PK本赛季排行榜同步tick,参数(zoneID, seasonID)
|
| | | Def_WorldKey_CrossSetPlayerAttrTick = "CrossSetPlayerAttrTick" #同步设置跨服玩家属性值tick
|
| | | #---------------------------------------------------------------------
|
| | | #个人时间间隔
|
| | | TYPE_Player_Tick_Requestkey = 0 # 玩家请求处理间隔
|
| | |
| | | import IpyGameDataPY
|
| | | import ChPyNetSendPack
|
| | | import CrossRealmPlayer
|
| | | import DataRecordPack
|
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import CrossRealmMsg
|
| | |
| | | refreshTime = GetRecRefreshTime(bossRecData)
|
| | | killedRecord = GetRecKilledRecord(bossRecData)
|
| | | isAlive = __GetCrossBossIsAlive(zoneID, bossID)
|
| | | bossInfoList.append([zoneID, bossID, killedTime, refreshTime, killedRecord, isAlive])
|
| | | killerExInfo = [] # 重连成功的信息同步不发送击杀者信息
|
| | | bossInfoList.append([zoneID, bossID, killedTime, refreshTime, killedRecord, isAlive, killerExInfo])
|
| | |
|
| | | if bossInfoList:
|
| | | bossInfoDict = {"BossInfoType":"InitOK", "BossInfoList":bossInfoList}
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def DoCrossBossOnKilled(bossID, killPlayerName, realMapID, dataMapID, copyMapID):
|
| | | def DoCrossBossOnKilled(bossID, killPlayerName, realMapID, dataMapID, copyMapID, killerIDList):
|
| | | ## 跨服boss被杀
|
| | | zoneIpyData = GetCrossBossZoneIpyData(realMapID, dataMapID, copyMapID)
|
| | | zoneID = 0 if not zoneIpyData else zoneIpyData.GetZoneID()
|
| | | GameWorld.Log("击杀跨服boss: zoneID=%s,bossID=%s,realMapID=%s,dataMapID=%s,copyMapID=%s" |
| | | % (zoneID, bossID, realMapID, dataMapID, copyMapID))
|
| | | GameWorld.Log("击杀跨服boss: zoneID=%s,bossID=%s,realMapID=%s,dataMapID=%s,copyMapID=%s,killerIDList=%s" |
| | | % (zoneID, bossID, realMapID, dataMapID, copyMapID, killerIDList))
|
| | | if not zoneID:
|
| | | return
|
| | |
|
| | |
| | | # 广播子服跨服boss被击杀
|
| | | serverGroupIDList = zoneIpyData.GetServerGroupIDList()
|
| | | killedRecord = GetRecKilledRecord(bossRecData)
|
| | | bossInfoList = [[zoneID, bossID, killedTime, refreshTime, killedRecord, isAlive]]
|
| | | killerExInfo = [killerIDList, dataMapID]
|
| | | bossInfoList = [[zoneID, bossID, killedTime, refreshTime, killedRecord, isAlive, killerExInfo]]
|
| | | bossInfoDict = {"BossInfoType":"OnKilled", "BossInfoList":bossInfoList}
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossInfo, bossInfoDict, serverGroupIDList)
|
| | | return
|
| | |
| | |
|
| | | syncBOSSIDList = []
|
| | | for bossInfo in bossInfoList:
|
| | | zoneID, bossID, killedTime, refreshTime, killedRecord, isAlive = bossInfo
|
| | | zoneID, bossID, killedTime, refreshTime, killedRecord, isAlive, killerExInfo = bossInfo
|
| | | bossRecData = __GetCrossBossRecData(zoneID, bossID)
|
| | | SetRecKilledTime(bossRecData, killedTime)
|
| | | SetRecRefreshTime(bossRecData, refreshTime)
|
| | |
| | | __SetCrossBossIsAlive(zoneID, bossID, isAlive)
|
| | | syncBOSSIDList.append(bossID)
|
| | |
|
| | | if not killerExInfo:
|
| | | continue
|
| | | |
| | | killerIDList, dataMapID = killerExInfo
|
| | | for playerID in killerIDList:
|
| | | killer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not killer:
|
| | | GameWorld.ErrLog("击杀跨服boss时主服玩家不在线, playerID=%s,dataMapID=%s,bossID=%s" % (playerID, dataMapID, bossID))
|
| | | DataRecordPack.SendEventPack("CrossBoss_Error", {"PlayerID":playerID, "Error":"MainServerOffline"})
|
| | | continue
|
| | | msgInfo = str([dataMapID, bossID])
|
| | | killer.MapServer_QueryPlayerResult(0, 0, "CrossKillBoss", msgInfo, len(msgInfo))
|
| | | |
| | | Sync_CrossBossInfo(None, syncBOSSIDList)
|
| | | return
|
| | |
|
| | |
| | | elif msgType == ShareDefine.ClientServerMsg_QueryNPCInfo:
|
| | | PlayerQuery.ClientServerMsg_QueryNPCInfo(serverGroupID, msgData)
|
| | |
|
| | | elif msgType == ShareDefine.ClientServerMsg_SetPlayerAttrValue:
|
| | | MapServer_CrossSetPlayerAttrValue(msgData)
|
| | | |
| | | # 需要发送到地图服务器处理的
|
| | | elif msgType in [ShareDefine.ClientServerMsg_Reborn]:
|
| | | MapServer_CrossServerReceiveMsg(msgType, msgData, serverGroupID)
|
| | |
| | | tagPlayer.MapServer_QueryPlayerResult(0, 0, "CrossServerReceiveMsg", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | def MapServer_CrossSetPlayerAttrValue(msgData):
|
| | | for playerID, setAttrInfoList in msgData.items():
|
| | | player = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not player:
|
| | | return
|
| | | msgInfo = str(setAttrInfoList)
|
| | | player.MapServer_QueryPlayerResult(0, 0, "CrossSetPlayerAttrValue", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | ## ================================================================================================
|
| | |
|
| | | def SendMsgToClientServer(msgType, dataMsg, serverGroupIDList=[]):
|
| | |
| | | if bossID <= 0:
|
| | | return
|
| | |
|
| | | bossID, killPlayerName, hurtValue, isNotify, realMapID, dataMapID, copyMapID = msgList
|
| | | bossID, killPlayerName, hurtValue, isNotify, realMapID, dataMapID, copyMapID, killerIDList = msgList
|
| | | if GameWorld.IsCrossServer():
|
| | | CrossBoss.DoCrossBossOnKilled(bossID, killPlayerName, realMapID, dataMapID, copyMapID)
|
| | | CrossBoss.DoCrossBossOnKilled(bossID, killPlayerName, realMapID, dataMapID, copyMapID, killerIDList)
|
| | | return
|
| | |
|
| | | mapID = dataMapID
|
| | |
| | | #import ReloadModule
|
| | | import CrossRealmPK
|
| | | import CrossRealmMsg
|
| | | import CrossRealmPlayer
|
| | | import PlayerFBHelpBattle
|
| | | import PlayerFamilyRedPacket
|
| | | import IpyGameDataPY
|
| | |
| | | PlayerFamilyParty.FamilyParty_Process(tick)
|
| | | # 帮主弹劾时钟调用
|
| | | PlayerFamily.OnLeaderImpeachTick(tick)
|
| | | |
| | | #跨服玩家
|
| | | CrossRealmPlayer.OnCrossProcess(tick)
|
| | | #跨服PK匹配
|
| | | CrossRealmPK.OnPKMatchProcess(tick)
|
| | |
|
| | |
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossGiveMoney", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | def SetCrossPlayerAttrValue(msgInfo, tick):
|
| | | ## 设置跨服玩家属性值
|
| | | playerID, setType, setDict, isDelay = msgInfo
|
| | | if not PyGameData.g_crossSetPlayerAttr:
|
| | | GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick, tick)
|
| | | playerSetInfoList = PyGameData.g_crossSetPlayerAttr.get(playerID, [])
|
| | | playerSetInfoList.append([setType, setDict])
|
| | | PyGameData.g_crossSetPlayerAttr[playerID] = playerSetInfoList
|
| | | if not isDelay:
|
| | | __SendCrossServerSetPlayerAttr(0)
|
| | | return
|
| | |
|
| | | def OnCrossProcess(tick):
|
| | | __SendCrossServerSetPlayerAttr(tick)
|
| | | return
|
| | |
|
| | | def __SendCrossServerSetPlayerAttr(tick):
|
| | | if not PyGameData.g_crossSetPlayerAttr:
|
| | | return
|
| | | |
| | | if tick:
|
| | | # 延迟10秒一次性同步,主要是比如OnDay的时候当多个玩家同时跨服时,减少同步次数,延迟统一发送
|
| | | if tick - GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick) < 10 * 1000:
|
| | | return
|
| | | GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick, tick)
|
| | | |
| | | CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_SetPlayerAttrValue, PyGameData.g_crossSetPlayerAttr)
|
| | | PyGameData.g_crossSetPlayerAttr = {}
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | |
| | |
| | | CrossRealmMsg.SendMsgToClientServer(msgType, dataMsg, serverGroupIDList)
|
| | | return
|
| | |
|
| | | if callName == "SetCrossPlayerAttrValue":
|
| | | CrossRealmPlayer.SetCrossPlayerAttrValue(eval(resultName), tick)
|
| | | return
|
| | | |
| | | if callName == 'MergeWorldNotify':
|
| | | country, msgMark, msgParamList, lineID, mergeMinOSD, mergeMaxOSD, mergeMapInfo = eval(resultName)
|
| | | PlayerControl.MergeWorldNotify(country, msgMark, msgParamList, lineID, mergeMinOSD, mergeMaxOSD, mergeMapInfo, 1)
|
| | |
| | |
|
| | | g_crossMapNPCInfo = {} # 跨服地图NPC信息 {mapID:[tick, npcInfo], ...}
|
| | |
|
| | | g_crossSetPlayerAttr = {} # 跨服玩家更新玩家数据 {playerID:[[setType, setDict], ...], ...}
|
| | |
|
| | |
| | | ClientServerMsg_PKBillboard = "PKBillboard" # 跨服PK排行榜
|
| | | ClientServerMsg_Reborn = "Reborn" # 复活
|
| | | ClientServerMsg_QueryNPCInfo = "QueryNPCInfo" # 查询跨服地图NPC信息
|
| | | ClientServerMsg_SetPlayerAttrValue = "SetPlayerAttrValue" # 玩家属性数值更新
|
| | |
|
| | | #角色改名结果
|
| | | (
|
| | |
| | | import DataRecordPack
|
| | | import IpyGameDataPY
|
| | | import ItemControler
|
| | | import CrossRealmPlayer
|
| | | import ShareDefine
|
| | | import ChConfig
|
| | | import FBLogic
|
| | | import PlayerVip
|
| | |
| | | ## 过天
|
| | | def OnDay(curPlayer):
|
| | | #清空当天摸boss次数
|
| | | setCrossDict = {}
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WorldBoss_HurtCnt, 0)
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 2, {})
|
| | | for index,limitCnt in killBossCntLimitDict.items():
|
| | | for index, limitCnt in killBossCntLimitDict.items():
|
| | |
|
| | | killCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt%index, 0)
|
| | | #hasBuyKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntBuyCnt%index, 0)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCntItemAddCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCntBuyCnt % index, 0)
|
| | | if index == ShareDefine.Def_Boss_Func_Dogz:
|
| | | setCrossDict.update({ChConfig.Def_PDict_Boss_KillCntItemAddCnt % index:0,
|
| | | ChConfig.Def_PDict_Boss_KillCnt % index:0,
|
| | | ChConfig.Def_PDict_Boss_KillCntBuyCnt % index:0,
|
| | | })
|
| | |
|
| | | NotifyAttackBossCnt(curPlayer)
|
| | | CrossRealmPlayer.SetCrossPlayerNomalDict(curPlayer, setCrossDict)
|
| | | return
|
| | |
|
| | | ## 登录处理
|
| | |
| | | # @version 1.0
|
| | | #
|
| | | #------------------------------------------------------------------------------
|
| | | """Version = 2017-07-10 19:50"""
|
| | | #"""Version = 2017-07-10 19:50"""
|
| | | #------------------------------------------------------------------------------
|
| | | #导入
|
| | | import ItemCommon
|
| | | import PlayerControl
|
| | | import ChConfig
|
| | | import BossHurtMng
|
| | | import CrossRealmPlayer
|
| | | import ShareDefine
|
| | | #------------------------------------------------------------------------------
|
| | |
|
| | | #------------------------------------------------------------------------------
|
| | |
| | | saveDataDict = {"bossTypeIndex":bossTypeIndex, 'addCnt':addCnt}
|
| | | ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, ChConfig.ItemDel_AddKillBossCnt, saveDataDict)
|
| | | PlayerControl.NotifyCode(curPlayer, 'WorldBossCountItem', [itemTypeID, bossTypeIndex, addCnt])
|
| | | |
| | | if bossTypeIndex == ShareDefine.Def_Boss_Func_Dogz:
|
| | | setCrossDict = {ChConfig.Def_PDict_Boss_KillCntItemAddCnt % bossTypeIndex:itemAddKillCnt + addCnt}
|
| | | CrossRealmPlayer.SetCrossPlayerNomalDict(curPlayer, setCrossDict, isDelay=False)
|
| | | return True
|
| | |
| | | import BossHurtMng
|
| | | import IpyGameDataPY
|
| | | import PlayerControl
|
| | | import CrossRealmPlayer
|
| | | import ShareDefine
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | import math
|
| | |
|
| | | def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
|
| | |
| | |
|
| | | PlayerControl.NotifyCode(curPlayer, 'WorldBossCountItem', [itemTypeID, curKillCnt-newCnt, index])
|
| | | ItemCommon.DelItem(curPlayer, curRoleItem, realUseCnt, True, ChConfig.ItemDel_ResetBossKillCnt)
|
| | | |
| | | if index == ShareDefine.Def_Boss_Func_Dogz:
|
| | | setCrossDict = {ChConfig.Def_PDict_Boss_KillCnt % index:0, ChConfig.Def_PDict_Boss_KillCntBuyCnt % index:0}
|
| | | CrossRealmPlayer.SetCrossPlayerNomalDict(curPlayer, setCrossDict, isDelay=False)
|
| | | return True, realUseCnt
|
| | |
|
| | |
| | | curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerID))
|
| | | return
|
| | |
|
| | | def GameServer_KillGameWorldBoss(bossID, killPlayerName, hurtValue, isNotify=True):
|
| | | def GameServer_KillGameWorldBoss(bossID, killPlayerName, hurtValue, isNotify=True, killerIDList=[]):
|
| | | dataMapID = GameWorld.GetGameWorld().GetMapID()
|
| | | realMapID = GameWorld.GetGameWorld().GetRealMapID()
|
| | | copyMapID = GameWorld.GetGameWorld().GetCopyMapID()
|
| | | killMsg = str([bossID, killPlayerName, hurtValue, isNotify, realMapID, dataMapID, copyMapID])
|
| | | killMsg = str([bossID, killPlayerName, hurtValue, isNotify, realMapID, dataMapID, copyMapID, killerIDList])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'KillGameWorldBoss', killMsg, len(killMsg))
|
| | | GameWorld.DebugLog("Boss被击杀: bossID=%s,dataMapID=%s,realMapID=%s,copyMapID=%s" % (bossID, dataMapID, realMapID, copyMapID))
|
| | | GameWorld.DebugLog("Boss被击杀: bossID=%s,dataMapID=%s,realMapID=%s,copyMapID=%s,killerIDList=%s" % (bossID, dataMapID, realMapID, copyMapID, killerIDList))
|
| | | return
|
| | |
|
| | | def GameServe_GameWorldBossState(bossID, isAlive):
|
| | |
| | | GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID, 0)
|
| | | return
|
| | |
|
| | | def OnPlayerKillBoss(curPlayer, npcID, mapID, isCrossServer): |
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
| | | if limitIndex != None:
|
| | | #今日杀怪次数+1
|
| | | key = ChConfig.Def_PDict_Boss_KillCnt % limitIndex
|
| | | newCnt = curPlayer.NomalDictGetProperty(key, 0) + 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, key, newCnt)
|
| | | BossHurtMng.NotifyAttackBossCnt(curPlayer, limitIndex)
|
| | | GameWorld.DebugLog("今日杀怪次数 playerID=%s, newCnt=%s" % (curPlayer.GetPlayerID(), newCnt))
|
| | | |
| | | dataDict = {"objID":npcID, "bossID":npcID, "touchCnt":newCnt,
|
| | | "AccID":curPlayer.GetAccID(), "PlayerID":curPlayer.GetPlayerID()}
|
| | | DataRecordPack.SendEventPack("AddKillBossCnt", dataDict, curPlayer)
|
| | | |
| | | if isCrossServer:
|
| | | return
|
| | | |
| | | if limitIndex == ShareDefine.Def_Boss_Func_World:
|
| | | # 世界BOSS击杀成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillWorldBoss, 1)
|
| | | # 每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_WorldBOSS)
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_WorldBOSS, 1)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_WorldBoss, 1)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_WorldBOSS, 1)
|
| | | |
| | | if mapID == ChConfig.Def_FBMapID_BossHome:
|
| | | #BOSS之家
|
| | | # BOSS之家BOSS击杀成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillBossHomeBoss, 1)
|
| | | # 每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_BOSSHome)
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_BOSSHome, 1)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_BossHome, 1)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_BOSSHome, 1)
|
| | | return
|
| | | |
| | | #################################################
|
| | | ## NPC控制定义
|
| | | #
|
| | |
| | | self.__Killer = None # 击杀者, 由各种规则得出, 一般也是物品归属的代表, 用于广播、记录等确保与归属一致
|
| | | self.__AllKillerDict = {} # 所有击杀的玩家ID对应字典, 非队伍, 一般也是归属的拥有者
|
| | | self.__FeelPlayerList = [] # 所有摸怪玩家列表,处理任务及某些逻辑用
|
| | | self.__ownerPlayerList = [] # 归属者列表
|
| | |
|
| | | self.__OwnerHurtType = 0
|
| | | self.__OwnerHurtID = 0
|
| | |
| | | if GetDropOwnerType(curNPC) == ChConfig.DropOwnerType_Family:
|
| | | killerName = FamilyRobBoss.FamilyOwnerBossOnKilled(curNPC, self.__OwnerHurtID)
|
| | | #KillerJob = 0 if not self.__Killer else self.__Killer.GetJob()
|
| | | GameServer_KillGameWorldBoss(curNPC.GetNPCID(), killerName, 0)
|
| | | killerIDList = [player.GetPlayerID() for player in self.__ownerPlayerList]
|
| | | GameServer_KillGameWorldBoss(curNPC.GetNPCID(), killerName, 0, True, killerIDList)
|
| | | #===========================================================================================
|
| | | # # 暗金boss
|
| | | # if curNPC.GetIsBoss() == ChConfig.Def_NPCType_Boss_Dark:
|
| | |
| | | dropPlayer = curPlayer
|
| | | self.__KilledByPlayerSetPrize(curPlayer)
|
| | | ownerPlayerList.append(curPlayer)
|
| | | |
| | | self.__ownerPlayerList = ownerPlayerList
|
| | | |
| | | #调用物品掉落
|
| | | self.__NPCDropItem(dropPlayer, hurtType, hurtID, ownerPlayerList)
|
| | |
|
| | |
| | |
|
| | | self.__DoNormalTeamExp(curPlayer)
|
| | | self.__KillNPCFuncEx(curPlayer, curNPC, maxHurtID, True)
|
| | | self.__ownerPlayerList = ownerPlayerList
|
| | |
|
| | | #调用物品掉落
|
| | | self.__NPCDropItem(dropPlayer, hurtType, hurtID, ownerPlayerList)
|
| | |
| | | maxLV = curPlayerLV
|
| | | dropPlayer = player
|
| | | ownerPlayerList.append(player)
|
| | | self.__ownerPlayerList = ownerPlayerList
|
| | |
|
| | | if not ownerPlayerList:
|
| | | GameWorld.Log("奖励归属仙盟,但是不存在可获得该奖励的成员!npcID=%s,hurtType=%s,hurtID=%s"
|
| | |
| | | defObjType = curNPC.GetGameObjType()
|
| | | mapFBType = GameWorld.GetMap().GetMapFBType()
|
| | | mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | #playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | # 如果是NPC
|
| | | if defObjType == IPY_GameWorld.gotNPC:
|
| | | if defObjType != IPY_GameWorld.gotNPC:
|
| | | return
|
| | | |
| | | # 跨服服务器处理
|
| | | if GameWorld.IsCrossServer():
|
| | | #掉落归属
|
| | | if mapFBType != IPY_GameWorld.fbtNull:
|
| | | FBLogic.DoFB_DropOwner(curPlayer , curNPC)
|
| | | else:
|
| | | if curNPC.GetLV()>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_KillNPC)
|
| | |
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
| | | if limitIndex != None:
|
| | | #今日杀怪次数+1
|
| | | key = ChConfig.Def_PDict_Boss_KillCnt % limitIndex
|
| | | newCnt = curPlayer.NomalDictGetProperty(key, 0) + 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, key, newCnt)
|
| | | BossHurtMng.NotifyAttackBossCnt(curPlayer, limitIndex)
|
| | | GameWorld.DebugLog("今日杀怪次数 playerID=%s, newCnt=%s" % (curPlayer.GetPlayerID(), newCnt))
|
| | | |
| | | dataDict = {"objID":curNPC.GetID(), "bossID":npcID, "touchCnt":newCnt,
|
| | | "AccID":curPlayer.GetAccID(), "PlayerID":curPlayer.GetPlayerID()}
|
| | | DataRecordPack.SendEventPack("AddKillBossCnt", dataDict, curPlayer)
|
| | | if limitIndex == 0:
|
| | | # 世界BOSS击杀成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillWorldBoss, 1)
|
| | | # 每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_WorldBOSS)
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_WorldBOSS, 1)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_WorldBoss, 1)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_WorldBOSS, 1)
|
| | | if ChConfig.IsGameBoss(curNPC) and mapID == ChConfig.Def_FBMapID_BossHome:
|
| | | #BOSS之家
|
| | | # BOSS之家BOSS击杀成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillBossHomeBoss, 1)
|
| | | # 每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_BOSSHome)
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_BOSSHome, 1)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_BossHome, 1)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_BOSSHome, 1)
|
| | | if ChConfig.IsGameBoss(curNPC):
|
| | | OnPlayerKillBoss(curPlayer, npcID, mapID, True)
|
| | | return
|
| | | |
| | | #掉落归属
|
| | | if mapFBType != IPY_GameWorld.fbtNull:
|
| | | FBLogic.DoFB_DropOwner(curPlayer , curNPC)
|
| | | else:
|
| | | if curNPC.GetLV()>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_KillNPC)
|
| | |
|
| | | if ChConfig.IsGameBoss(curNPC):
|
| | | OnPlayerKillBoss(curPlayer, npcID, mapID, False)
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #GameWorld.DebugLog("__MissionOnKillNPC isFeel=%s" % (isFeel), curPlayer.GetPlayerID())
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
| | | isWorldBoos = limitIndex == 0
|
| | | isWorldBoos = limitIndex == ShareDefine.Def_Boss_Func_World
|
| | | if isFeel:
|
| | | #击杀NPC触发摸怪任务事件
|
| | | EventShell.EventRespons_OnKillByFeel(curPlayer, curNPC)
|
| | |
| | | ## 跨服服务器是否开放中
|
| | | return GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen)
|
| | |
|
| | | def SetCrossPlayerAttrValue(curPlayer, setDict, isDelay=True):
|
| | | ''' 批量设置玩家属性值
|
| | | @param setDict: 设置属性字典 {attrName:attrValue, ...}
|
| | | @param isDelay: 是否延迟同步,比如OnDay更新的数值,可能多个玩家同时更新多个属性值,所以需要设置延迟统一同步,其他具体根据功能需要选择是否延迟
|
| | | '''
|
| | | if not setDict or not PlayerControl.GetCrossMapID(curPlayer):
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | setType = "PlayerAttr"
|
| | | msgList = str([playerID, setType, setDict, isDelay])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SetCrossPlayerAttrValue", msgList, len(msgList))
|
| | | GameWorld.DebugLog("更新跨服玩家属性: isDelay=%s,%s" % (isDelay, setDict), playerID)
|
| | | return
|
| | |
|
| | | def SetCrossPlayerNomalDict(curPlayer, setDict, isDelay=True):
|
| | | ''' 批量设置玩家字典值
|
| | | @param setDict: 设置字典, 无 dictType 信息时默认类型0 {dictKey:dictValue, dictKey:[dictValue, dictType], ...}
|
| | | @param isDelay: 是否延迟同步,比如OnDay更新的数值,可能多个玩家同时更新多个属性值,所以需要设置延迟统一同步,其他具体根据功能需要选择是否延迟
|
| | | '''
|
| | | if not setDict or not PlayerControl.GetCrossMapID(curPlayer):
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | setType = "PlayerDict"
|
| | | msgList = str([playerID, setType, setDict, isDelay])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SetCrossPlayerAttrValue", msgList, len(msgList))
|
| | | GameWorld.DebugLog("更新跨服玩家字典: isDelay=%s,%s" % (isDelay, setDict), playerID)
|
| | | return
|
| | |
|
| | | def ClientServerMsg_SetPlayerAttrValue(curPlayer, playerSetInfoList):
|
| | | ## 收到子服同步的设置跨服玩家属性值
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("收到子服同步的设置跨服玩家属性值: %s" % playerSetInfoList, playerID)
|
| | | for setType, setDict in playerSetInfoList:
|
| | | if setType == "PlayerDict":
|
| | | for dictKey, valeInfo in setDict.items():
|
| | | if isinstance(valeInfo, int):
|
| | | dictValue, dictType = valeInfo, 0
|
| | | else: |
| | | dictValue, dictType = valeInfo
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, dictKey, dictValue, dictType)
|
| | | GameWorld.DebugLog(" NomalDictSetProperty dictKey=%s, dictValue=%s, dictType=%s" % (dictKey, dictValue, dictType), playerID)
|
| | | else:
|
| | | for attrName, attrValue in setDict.items():
|
| | | if hasattr(curPlayer, attrName):
|
| | | getattr(curPlayer, attrName)(attrValue)
|
| | | GameWorld.DebugLog(" curPlayer.%s(%s)" % (attrName, attrValue))
|
| | | elif hasattr(PlayerControl, attrName):
|
| | | getattr(PlayerControl, attrName)(curPlayer, attrValue)
|
| | | GameWorld.DebugLog(" PlayerControl.%s(curPlayer, %s)" % (attrName, attrValue), playerID)
|
| | | return
|
| | |
|
| | | #// C1 04 主动退出跨服 #tagCMExitCrossRealm
|
| | | #
|
| | | #struct tagCMExitCrossRealm
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.RemoteQuery.GY_Query_CrossKillBoss
|
| | | #
|
| | | # @todo:跨服击杀boss
|
| | | # @author hxp
|
| | | # @date 2019-01-14
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 跨服击杀boss
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2019-01-14 16:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import NPCCommon
|
| | |
|
| | | #------------------------------------------------------------------------------ |
| | | ## 跨服赛报名调用接口
|
| | | # @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): |
| | | return
|
| | |
|
| | |
|
| | | #------------------------------------------------------------------------------ |
| | | ## 执行结果
|
| | | # @param curPlayer 发出请求的玩家
|
| | | # @param callFunName 功能名称
|
| | | # @param funResult 查询的结果
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def DoResult(curPlayer, callFunName, funResult, tick):
|
| | | killerExInfo = eval(funResult)
|
| | | dataMapID, bossID = killerExInfo
|
| | | GameWorld.Log("GY_Query_CrossKillBoss dataMapID=%s, bossID=%s" % (dataMapID, bossID), curPlayer.GetPlayerID())
|
| | | if not curPlayer:
|
| | | return
|
| | | NPCCommon.OnPlayerKillBoss(curPlayer, bossID, dataMapID, False)
|
| | | return
|
| | |
|
| | | |
| | | |
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.RemoteQuery.GY_Query_CrossSetPlayerAttrValue
|
| | | #
|
| | | # @todo:设置跨服玩家属性
|
| | | # @author hxp
|
| | | # @date 2019-01-14
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 设置跨服玩家属性
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2019-01-14 16:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import CrossRealmPlayer
|
| | |
|
| | | #------------------------------------------------------------------------------ |
| | |
|
| | | def DoLogic(query_Type, query_ID, packCMDList, tick): |
| | | return
|
| | |
|
| | |
|
| | | #------------------------------------------------------------------------------ |
| | | ## 执行结果
|
| | | # @param curPlayer 发出请求的玩家
|
| | | # @param callFunName 功能名称
|
| | | # @param funResult 查询的结果
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def DoResult(curPlayer, callFunName, funResult, tick):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("GY_Query_CrossSetPlayerAttrValue %s" % funResult, playerID)
|
| | | playerSetInfoList = eval(funResult)
|
| | | CrossRealmPlayer.ClientServerMsg_SetPlayerAttrValue(curPlayer, playerSetInfoList)
|
| | | return
|
| | |
|
| | | |
| | | |
| | |
| | | ClientServerMsg_PKBillboard = "PKBillboard" # 跨服PK排行榜
|
| | | ClientServerMsg_Reborn = "Reborn" # 复活
|
| | | ClientServerMsg_QueryNPCInfo = "QueryNPCInfo" # 查询跨服地图NPC信息
|
| | | ClientServerMsg_SetPlayerAttrValue = "SetPlayerAttrValue" # 玩家属性数值更新
|
| | |
|
| | | #角色改名结果
|
| | | (
|