| | |
| | | import SkillCommon
|
| | | import IPY_GameWorld
|
| | | import DataRecordPack
|
| | | import NPCHurtManager
|
| | | #import PlayerTruck
|
| | | import ShareDefine
|
| | | import SkillShell
|
| | |
| | | def PlayerLoginSetTeam(curPlayer, tick):
|
| | | ## 玩家登录服务器设置队伍
|
| | | #玩家刚登录, 什么也不做, 等待GameServer刷新自己
|
| | | return
|
| | |
|
| | | def OnPlayerLoginCrossServer(curPlayer):
|
| | | ## 登录跨服服务器处理
|
| | | |
| | | if curPlayer.GetTeamID():
|
| | | curPlayer.SetTeamID(0)
|
| | | GameWorld.DebugLog("登录跨服服务器重置队伍ID!")
|
| | | |
| | | return
|
| | |
|
| | | ## 游戏服务器刷新队伍(封包参数)
|
| | |
| | | playerID = curPackData.PlayerID
|
| | | teamID = curPackData.TeamID
|
| | | teamLV = curPackData.TeamLV
|
| | | memCnt = curPackData.MemCnt
|
| | | dataDict = {"playerID":playerID, "teamLV":teamLV}
|
| | |
|
| | | GameWorld.DebugLog("GameServer_TeamInfo playerID=%s,teamID=%s,teamLV=%s" % (playerID, teamID, teamLV), playerID)
|
| | | GameWorld.DebugLog("GameServer_TeamInfo playerID=%s,teamID=%s,teamLV=%s,memCnt=%s" % (playerID, teamID, teamLV, memCnt), playerID)
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not curPlayer or curPlayer.IsEmpty():
|
| | | DR_Team("TeamInfo", teamID, dataDict, "curPlayer is None or empty")
|
| | |
| | |
|
| | | playerTeamID = curPlayer.GetTeamID()
|
| | | # 切图时GameServer玩家无队伍时会同步teamID为0,这里进一步处理,防止地图玩家在某些异常情况下teamID与GameServer不同步
|
| | | if teamID == 0 and playerTeamID:
|
| | | __OnPlayerLeaveTeam(curPlayer.GetCopyMapID(), playerID, playerTeamID, tick)
|
| | | if teamID == 0:
|
| | | if playerTeamID:
|
| | | __OnPlayerLeaveTeam(curPlayer.GetCopyMapID(), playerID, playerTeamID, tick)
|
| | | return
|
| | |
|
| | | RefreshPlayerTeamID(curPlayer, teamID, teamLV, tick)
|
| | | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_TeamMemCount, memCnt)
|
| | |
|
| | | sameMapMemCount = 0 # 同地图队员数
|
| | | sameMapVIPLV = 0 # 同地图VIP加成等级
|
| | |
| | | #curMapTeam.SetTeamType(recvPack.GetTeamType())
|
| | | DR_Team("RefreshPlayerTeamID_Create", teamID, dataDict)
|
| | |
|
| | | if playerTeamID != teamID or not curTeam:
|
| | | isNewTeam = playerTeamID != teamID # 切地图/上线时teamID可能不变,但是team为None
|
| | | if (playerTeamID != teamID or not curTeam) and curMapTeam:
|
| | | #isNewTeam = playerTeamID != teamID # 切地图/上线时teamID可能不变,但是team为None
|
| | | #GameWorld.DebugLog(" 玩家当前无队伍,处理玩家进队!isNewTeam=%s" % isNewTeam, playerID)
|
| | | __OnEnterTeam(curPlayer, curMapTeam, isNewTeam, tick, dataDict)
|
| | | __OnEnterTeam(curPlayer, curMapTeam, playerTeamID, tick, dataDict)
|
| | | else:
|
| | | dataDict["MemberCount"] = 0 if not curMapTeam else curMapTeam.GetMemberCount()
|
| | | DR_Team("RefreshPlayerTeamID_Update", teamID, dataDict)
|
| | |
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __OnEnterTeam(curPlayer, curMapTeam, isNewTeam, tick, dataDict):
|
| | | def __OnEnterTeam(curPlayer, curMapTeam, playerTeamID, tick, dataDict):
|
| | | teamID = curMapTeam.GetTeamID()
|
| | | memCount = curMapTeam.GetMemberCount()
|
| | | if memCount >= ShareDefine.Def_Team_MaxPlayerCount:
|
| | |
| | | #PlayerTruck.ChangeTruckNoteInfo(curPlayer)
|
| | |
|
| | | #以下为进入一个新的队伍额外处理
|
| | | if not isNewTeam:
|
| | | return
|
| | | if playerTeamID != teamID:
|
| | | NPCHurtManager.OnNPCHurtPlayerEnterTeam(playerID, curPlayer.GetPlayerName(), playerTeamID, curMapTeam, tick)
|
| | | return
|
| | |
|
| | | def __OnPlayerLeaveTeam(copyMapID, playerID, leaveTeamID, tick):
|
| | |
| | | curGameWorld.GetTeamManager().DeleteTeam(leaveTeamID)
|
| | |
|
| | | __DelPlayerIDFromTeamPlayer(playerID, False)
|
| | | |
| | | NPCHurtManager.OnNPCHurtPlayerLeaveTeam(playerID, leaveTeamID, tick)
|
| | |
|
| | | dataDict = {"playerID":playerID, "copyMapID":copyMapID}
|
| | | ### =========================== 以下逻辑是玩家存在时才需要处理的 =================================
|
| | |
| | | return
|
| | |
|
| | | def DR_Team(eventName, teamID, dataDict, info=""):
|
| | | drDict = {"EventName":eventName, "TeamID":teamID, "Info":info}
|
| | | drDict.update(dataDict)
|
| | | DataRecordPack.SendEventPack("Team_%s" % GameWorld.GetMap().GetMapID(), drDict)
|
| | | #drDict = {"EventName":eventName, "TeamID":teamID, "Info":info}
|
| | | #drDict.update(dataDict)
|
| | | #DataRecordPack.SendEventPack("Team_%s" % GameWorld.GetMap().GetMapID(), drDict)
|
| | | return
|
| | |
|