| | |
| | | import PlayerControl
|
| | | import IPY_GameServer
|
| | | import DataRecordPack
|
| | | import cPickle
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ## 设置玩家家族行为
|
| | |
| | | # @return None
|
| | | def MapServer_PlayerFamilyActionNote(curPlayer, actionType, actionData, tick):
|
| | |
|
| | | actionDataList = eval(actionData)
|
| | | actionDataList = cPickle.loads(actionData)
|
| | |
|
| | | familyId = curPlayer.GetFamilyID()
|
| | |
|
| | |
| | | def __RequestAddFamilyNote(curPlayer, actionType, actionDataList, tick):
|
| | |
|
| | | requestAddFamilyID = actionDataList[0] # 申请进入的家族
|
| | | fightPower = actionDataList[1] if len(actionDataList) > 1 else curPlayer.GetFightPower()
|
| | | fightPower = actionDataList[1] if len(actionDataList) > 1 else PlayerControl.GetFightPower(curPlayer)
|
| | | requestPlayerName = curPlayer.GetName() # 申请的玩家名字
|
| | |
|
| | | familyManager = GameWorld.GetFamilyManager()
|
| | |
| | | return
|
| | |
|
| | | #玩家Id, 等级,职业,战斗力
|
| | | actionDataList = [curPlayer.GetID(), curPlayer.GetLV(), curPlayer.GetJob(), fightPower]
|
| | | actionDataList = [curPlayer.GetID(), curPlayer.GetLV(), curPlayer.GetJob(), fightPower % ChConfig.Def_PerPointValue, fightPower / ChConfig.Def_PerPointValue]
|
| | |
|
| | | result = AddFamilyActionNote(requestPlayerName, requestAddFamilyID, actionType, actionDataList, tick, False)
|
| | | if not result:
|
| | |
| | | playerLV = familyActionData.GetValue2() # 等级
|
| | | playerJob = familyActionData.GetValue3() # ְҵ
|
| | | fightPower = familyActionData.GetValue4() # 战斗力
|
| | | |
| | | fightPower += familyActionData.GetValue5() * ChConfig.Def_PerPointValue
|
| | | tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not tagPlayer:
|
| | | isOnLine = 0
|
| | | else:
|
| | | isOnLine = 1
|
| | | playerLV = tagPlayer.GetLV()
|
| | | if tagPlayer.GetFightPower() > fightPower:
|
| | | fightPower = tagPlayer.GetFightPower()
|
| | | if PlayerControl.GetFightPower(tagPlayer) > fightPower:
|
| | | fightPower = PlayerControl.GetFightPower(tagPlayer)
|
| | |
|
| | | memberInfo = ChPyNetSendPack.tagtMemberInfo()
|
| | | memberInfo.PlayerID = playerID
|
| | |
| | | memberInfo.Name = requestPlayerName
|
| | | memberInfo.PlayerLV = playerLV
|
| | | memberInfo.PlayeJob = playerJob
|
| | | memberInfo.PlayeFightPower = fightPower
|
| | | memberInfo.PlayeFightPower = fightPower % ChConfig.Def_PerPointValue
|
| | | memberInfo.PlayeFightPowerEx = fightPower / ChConfig.Def_PerPointValue
|
| | | memberInfo.RequestTime = requestTime
|
| | | memberInfo.IsOnLine = isOnLine
|
| | | packList.append(memberInfo)
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def SendFamilyAction(actionDataList, curPlayer=None):
|
| | | ## 同步指定action
|
| | | # @param actionDataList: 支持列表或指定actionData
|
| | | if not isinstance(actionDataList, list):
|
| | | actionDataList = [actionDataList]
|
| | | if not actionDataList:
|
| | | return
|
| | | familyActionData = actionDataList[0]
|
| | | familyID = familyActionData.GetFamilyId()
|
| | | |
| | | actionInfoPack = ChPyNetSendPack.tagGCFamilyActionInfo()
|
| | | actionInfoPack.Clear()
|
| | | actionInfoPack.FamilyID = familyID
|
| | | actionInfoPack.ActionType = familyActionData.GetActionType()
|
| | | actionInfoPack.FamilyActionList = [] |
| | | |
| | | for familyActionData in actionDataList:
|
| | | actionData = ChPyNetSendPack.tagGCFamilyAction()
|
| | | actionData.Clear()
|
| | | actionData.Time = familyActionData.GetTime()
|
| | | actionData.Name = familyActionData.GetName()
|
| | | actionData.NameLen = len(actionData.Name)
|
| | | actionData.Value1 = familyActionData.GetValue1()
|
| | | actionData.Value2 = familyActionData.GetValue2()
|
| | | actionData.Value3 = familyActionData.GetValue3()
|
| | | actionData.Value4 = familyActionData.GetValue4()
|
| | | actionData.Value5 = familyActionData.GetValue5()
|
| | | actionData.Value6 = familyActionData.GetValue6()
|
| | | actionData.UseData = familyActionData.GetUseData()
|
| | | actionData.UseDataLen = len(actionData.UseData)
|
| | | actionInfoPack.FamilyActionList.append(actionData)
|
| | | |
| | | actionInfoPack.Count = len(actionInfoPack.FamilyActionList)
|
| | | |
| | | if curPlayer:
|
| | | NetPackCommon.SendFakePack(curPlayer, actionInfoPack)
|
| | | return
|
| | | |
| | | # 没有指定玩家的情况下通知全战盟
|
| | | family = GameWorld.GetFamilyManager().FindFamily(familyID)
|
| | | if not family:
|
| | | return
|
| | | |
| | | for index in xrange(family.GetCount()):
|
| | | curMember = family.GetAt(index)
|
| | | curPlayer = curMember.GetPlayer()
|
| | | #不在线
|
| | | if curPlayer == None:
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, actionInfoPack)
|
| | | |
| | | return
|
| | |
|
| | | ## 删除时机: 1-降为普通成员;2-退出家族
|
| | | def DelFamilyOfficerModelEquip(familyID, delPlayerID):
|
| | |
| | | #GameWorld.DebugLog("普通成员不记录家族官员模型装备信息!")
|
| | | return
|
| | |
|
| | | modelEquipInfoList = PlayerViewCache.GetPlayerCacheEquipView(playerID)
|
| | | modelEquipInfoList = []
|
| | | #modelEquipInfoList = PlayerViewCache.GetPlayerCacheEquipView(playerID)
|
| | | if not modelEquipInfoList:
|
| | | #GameWorld.DebugLog("找不到家族官员模型装备信息, 不记录!familyID=%s,playerID=%s" % (familyID, playerID))
|
| | | return
|