10263 【越南】【英文】【BT】【砍树】后端支持NPC仿真实玩家战斗和快速战斗(优化切图同步功能地图ID数据A126 A127 ExAttr3)
| | |
| | | ("SubCmd", c_ubyte),
|
| | | ("MapID", c_ushort),
|
| | | ("FuncLineID", c_ushort), #功能线路ID
|
| | | ("FuncMapID", c_ushort), #功能地图ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.SubCmd = 0x26
|
| | | self.MapID = 0
|
| | | self.FuncLineID = 0
|
| | | self.FuncMapID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | MapID:%d,
|
| | | FuncLineID:%d
|
| | | FuncLineID:%d,
|
| | | FuncMapID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.MapID,
|
| | | self.FuncLineID
|
| | | self.FuncLineID,
|
| | | self.FuncMapID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | ("SubCmd", c_ubyte),
|
| | | ("MapID", c_int),
|
| | | ("FuncLineID", c_ushort), #功能线路ID
|
| | | ("FuncMapID", c_ushort), #功能地图ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.SubCmd = 0x27
|
| | | self.MapID = 0
|
| | | self.FuncLineID = 0
|
| | | self.FuncMapID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | MapID:%d,
|
| | | FuncLineID:%d
|
| | | FuncLineID:%d,
|
| | | FuncMapID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.MapID,
|
| | | self.FuncLineID
|
| | | self.FuncLineID,
|
| | | self.FuncMapID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | | ## 副本功能线路ID
|
| | | def SetFBFuncLineID(curPlayer, funcLineID): return curPlayer.SetExAttr3(funcLineID)
|
| | | def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3()
|
| | | def GetFBFuncMapID(curPlayer): return curPlayer.GetExAttr3() / 1000
|
| | | def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3() % 1000
|
| | |
|
| | | ##VIP到期时间
|
| | | def GetVIPExpireTime(curPlayer): return 0
|
| | |
| | | Def_Player_Dict_FBFirstEnterRecord = "FBFEntRec" # 记录副本是否参与过,按位0 1 存储表示
|
| | | Def_FBStar_MaxKeyCnt = 5 # 暂时每个副本ID支持9*5个lineID记录
|
| | | Def_Player_Dict_EnterFBFree = "EnterFBFree" # 是否免费进入副本
|
| | | Def_Player_Dict_ReqFBMapID = "ReqFBMapID" # 请求进入的副本功能地图ID
|
| | | Def_Player_Dict_ReqFBFuncLine = "ReqFBFuncLine" # 请求进入的副本功能线路
|
| | | Def_Player_Dict_ReqCrossFBZoneID = "ReqCrossFBZoneID" # 请求进入跨服的跨服分区ID
|
| | | Def_Player_Dict_ReqCrossFBFuncLine = "ReqCrossFBFuncLine" # 请求进入跨服的副本功能线路
|
| | |
| | | ("SubCmd", c_ubyte),
|
| | | ("MapID", c_ushort),
|
| | | ("FuncLineID", c_ushort), #功能线路ID
|
| | | ("FuncMapID", c_ushort), #功能地图ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.SubCmd = 0x26
|
| | | self.MapID = 0
|
| | | self.FuncLineID = 0
|
| | | self.FuncMapID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | MapID:%d,
|
| | | FuncLineID:%d
|
| | | FuncLineID:%d,
|
| | | FuncMapID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.MapID,
|
| | | self.FuncLineID
|
| | | self.FuncLineID,
|
| | | self.FuncMapID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | ("SubCmd", c_ubyte),
|
| | | ("MapID", c_int),
|
| | | ("FuncLineID", c_ushort), #功能线路ID
|
| | | ("FuncMapID", c_ushort), #功能地图ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.SubCmd = 0x27
|
| | | self.MapID = 0
|
| | | self.FuncLineID = 0
|
| | | self.FuncMapID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | MapID:%d,
|
| | | FuncLineID:%d
|
| | | FuncLineID:%d,
|
| | | FuncMapID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.MapID,
|
| | | self.FuncLineID
|
| | | self.FuncLineID,
|
| | | self.FuncMapID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | gameMap = GameWorld.GetMap()
|
| | | gameMapID = gameMap.GetMapID()
|
| | |
|
| | | reqMapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBMapID)
|
| | | reqFuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
|
| | | PlayerControl.SetFBFuncLineID(curPlayer, reqFuncLineID)
|
| | | PlayerControl.SetFBFuncLineID(curPlayer, reqMapID, reqFuncLineID)
|
| | |
|
| | | #成长NPC所需数据初始化
|
| | | InitFBNPCStrengthenData(curPlayer, gameMap)
|
| | |
| | | def GetRecordMapID(mapID):
|
| | | DataMapIDDict = IpyGameDataPY.GetConfigEx("DataMapIDDict")
|
| | | if not DataMapIDDict:
|
| | | mIDToDataMapIDDict = {} # 场景ID对应功能地图ID
|
| | | dMapIDDict = {}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetFBLineCount()):
|
| | | ipyData = ipyDataMgr.GetFBLineByIndex(i)
|
| | | dMapID = ipyData.GetDataMapID()
|
| | | mID = ipyData.GetMapID()
|
| | | dMapIDList= dMapIDDict.get(dMapID, [])
|
| | | if mID not in dMapIDList:
|
| | | dMapIDList.append(mID)
|
| | | dMapIDDict[dMapID] = dMapIDList
|
| | | |
| | | for dMapID in dMapIDDict.keys():
|
| | | if len(dMapIDDict[dMapID]) == 1:
|
| | | mIDList= dMapIDDict.get(dMapID, [])
|
| | | if mID not in mIDList:
|
| | | mIDList.append(mID)
|
| | | dMapIDDict[dMapID] = mIDList
|
| | | |
| | | dMIDList= mIDToDataMapIDDict.get(mID, [])
|
| | | if dMapID not in dMIDList:
|
| | | dMIDList.append(dMapID)
|
| | | mIDToDataMapIDDict[mID] = dMIDList
|
| | | |
| | | unMIDList = []
|
| | | for mID, dMIDList in mIDToDataMapIDDict.items():
|
| | | if len(dMIDList) > 1:
|
| | | unMIDList.append(mID)
|
| | | #GameWorld.DebugLog("----------- 同个场景对应到多个功能地图的,视为无意义的地图! mID=%s, to dMIDList=%s" % (mID, dMIDList))
|
| | | for dMapID, mIDList in dMapIDDict.items():
|
| | | for unMID in unMIDList:
|
| | | if unMID in mIDList:
|
| | | mIDList.remove(unMID)
|
| | | if len(mIDList) <= 1:
|
| | | dMapIDDict.pop(dMapID)
|
| | | DataMapIDDict = IpyGameDataPY.SetConfigEx("DataMapIDDict", dMapIDDict)
|
| | | #GameWorld.Log("加载DataMapIDDict=%s" % DataMapIDDict)
|
| | |
| | | PlayerControl.PlayerLeaveFB(curPlayer)
|
| | | return
|
| | |
|
| | | reqMapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBMapID)
|
| | | lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
|
| | | if not FBCommon.GetHadSetFBPropertyMark(): #此处副本属性和功能线路ID不同,故分开设置
|
| | | propertyMark = curPlayer.GetOfficialRank() if lineID else lineID #小境界0 大境界为境界等级
|
| | | GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_FBDict_PropertyMark, propertyMark + 1)
|
| | | PlayerControl.SetFBFuncLineID(curPlayer, lineID)
|
| | | PlayerControl.SetFBFuncLineID(curPlayer, reqMapID, lineID)
|
| | | #FBCommon.SetFBPropertyMark(lineID)
|
| | | #if lineID == 0:
|
| | | FBCommon.SetFBStep(FB_Step_MapPrepare, tick)
|
| | |
| | | PlayerYinji.OnLoadMap(curPlayer)
|
| | | ItemControler.PlayerItemControler(curPlayer).RefreshStartEquipCount() # 刷新装备珍品星级
|
| | |
|
| | | #EndLoadMap需放在最后
|
| | | #EndLoadMap需放在最后, 0403 tagPlayerLoginLoadOK
|
| | | curPlayer.EndLoadMap()
|
| | | return True
|
| | |
|
| | |
| | | SendToGameServerEnterFB(curPlayer, mapID, lineID, tick, extendParamList)
|
| | | return
|
| | |
|
| | | PlayerResetWorldPosFB(curPlayer, sceneMapID, posX, posY, False, fbID, funcLineID=lineID)
|
| | | PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, False, fbID, funcLineID=lineID)
|
| | | return
|
| | |
|
| | | ##发送到GameServer请求进入副本
|
| | |
| | | if curPlayer.GetMapID() != mapID:
|
| | | return
|
| | |
|
| | | reqMapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBMapID) # 由于后端地图不变所以不修改直接读
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBFuncLine, funcLineID)
|
| | | GameWorld.Log("玩家副本中变更功能线路虚拟切地图: mapID=%s,posX=%s,posY=%s,funcLineID=%s"
|
| | | % (mapID, posX, posY, funcLineID), curPlayer.GetPlayerID())
|
| | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosX, posX)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosY, posY)
|
| | |
|
| | | NotifyPrepareChangeMap(curPlayer, mapID, funcLineID)
|
| | | NotifyPrepareChangeMap(curPlayer)
|
| | | NotifyStartChangeMap(curPlayer)
|
| | |
|
| | | ## 发送 04 01 人物所在的场景初始化#tagPlayerMapInit
|
| | |
| | |
|
| | | curPlayer.SetSight(0) # 视野置0,切成功后恢复视野,防止接下来提前设置坐标导致前端视野刷新异常
|
| | | curPlayer.ResetPos(posX, posY) # 这里直接设置坐标,防止前端未加载场景成功掉线导致重登后坐标错误
|
| | | SetFBFuncLineID(curPlayer, funcLineID) # 这里直接设置成目标功能线路ID,防止前端未加载场景成功掉线导致重登后加载场景异常
|
| | | SetFBFuncLineID(curPlayer, reqMapID, funcLineID) # 这里直接设置成目标功能线路ID,防止前端未加载场景成功掉线导致重登后加载场景异常
|
| | |
|
| | | ## 发送 01 09 服务器准备就绪#tagServerPrepareOK
|
| | | prepareOK = ChNetSendPack.tagServerPrepareOK()
|
| | |
| | | return
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_TransTick, tick)
|
| | |
|
| | | sceneMapID = mapID
|
| | | if GameWorld.GetMap().GetMapFBTypeByMapID(mapID) != IPY_GameWorld.fbtNull:
|
| | | # 副本功能场景地图
|
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, funcLineID)
|
| | | if fbLineIpyData:
|
| | | sceneMapID = fbLineIpyData.GetMapID()
|
| | | |
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, funcLineID)
|
| | | sceneMapID = mapID if not fbLineIpyData else fbLineIpyData.GetMapID()
|
| | | |
| | | # 地图分流, 减少单地图压力
|
| | | FBMapShuntDict = ReadChConfig.GetEvalChConfig("FBMapShunt")
|
| | | if mapID in FBMapShuntDict:
|
| | |
| | | #获取副本传入副本需要携带的信息
|
| | | msg = FBLogic.GetPlayerResetWorldPosFBMsg(curPlayer, mapID, funcLineID)
|
| | |
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBMapID, mapID)
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBFuncLine, funcLineID)
|
| | | GameWorld.Log("玩家请求开始切图: sceneMapID=%s,posX=%s,posY=%s,takeTruck=%s,fbID=%s,msg=%s,funcLineID=%s,tick=%s,lastTransTick=%s"
|
| | | % (sceneMapID, posX, posY, takeTruck, fbID, msg, funcLineID, tick, lastTransTick), curPlayer.GetPlayerID())
|
| | |
| | |
|
| | | #切地图处理玩家时钟纠正问题(需要一直通过玩家时钟计算的)
|
| | | RefreshPlayerTick(curPlayer)
|
| | | NotifyPrepareChangeMap(curPlayer, sceneMapID, funcLineID)
|
| | | NotifyPrepareChangeMap(curPlayer)
|
| | | return
|
| | |
|
| | | # 通知准备切换地图
|
| | | def NotifyPrepareChangeMap(curPlayer, sceneMapID, funcLineID):
|
| | | def NotifyPrepareChangeMap(curPlayer):
|
| | | curPlayer.SetVisible(False)
|
| | | sendPack = ChPyNetSendPack.tagMCPrepareChangeMap()
|
| | | sendPack.Clear()
|
| | | sendPack.MapID = GameWorld.GetMapDataMapID(sceneMapID)
|
| | | sendPack.FuncLineID = funcLineID
|
| | | sendPack.MapID = GameWorld.GetMapDataMapID(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID))
|
| | | sendPack.FuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
|
| | | sendPack.FuncMapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBMapID)
|
| | |
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | GameWorld.Log("准备切换地图", curPlayer.GetID())
|
| | |
| | | sendPack.Clear()
|
| | | sendPack.MapID = GameWorld.GetMapDataMapID(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID))
|
| | | sendPack.FuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
|
| | | sendPack.FuncMapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBMapID)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | |
|
| | | GameWorld.Log("通知开始切换地图", curPlayer.GetID())
|
| | |
| | | def GetTeamCheckState(curPlayer): return curPlayer.GetExAttr2()
|
| | |
|
| | | ## 副本功能线路ID, 这里做db存储,防止在合并地图副本中掉线重上时前端无法加载正确的场景资源,登录加载场景时机为0102包
|
| | | def SetFBFuncLineID(curPlayer, funcLineID): return curPlayer.SetExAttr3(funcLineID, False, True)
|
| | | def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3()
|
| | | def SetFBFuncLineID(curPlayer, mapID, funcLineID):
|
| | | value = mapID * 1000 + funcLineID
|
| | | if value != curPlayer.GetExAttr3():
|
| | | curPlayer.SetExAttr3(value, False, True)
|
| | | return
|
| | | def GetFBFuncMapID(curPlayer): return curPlayer.GetExAttr3() / 1000
|
| | | def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3() % 1000
|
| | |
|
| | | ## 跨服状态所在地图ID: 0-非跨服状态,非0-跨服状态对应的地图ID
|
| | | def GetCrossMapID(curPlayer): return curPlayer.GetExAttr5()
|
| | |
| | | if not retPos:
|
| | | return
|
| | |
|
| | | # 传送逻辑
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, funcLineID)
|
| | | sceneMapID = mapID if not fbLineIpyData else fbLineIpyData.GetMapID()
|
| | | PlayerControl.PlayerResetWorldPosFB(curPlayer, sceneMapID, retPos[0], retPos[1], False, backFBID, funcLineID=funcLineID)
|
| | | PlayerControl.PlayerResetWorldPosFB(curPlayer, mapID, retPos[0], retPos[1], False, backFBID, funcLineID=funcLineID)
|
| | | return
|
| | |
|