Example #1
0
 def pushSceneInfo(self,rate):
     '''给每一个在场景中的玩家推送场景信息
     @param rate: int 移动的频率
     '''
     if not self._canRec:
         return
     self.updateAllPlayerLocation(rate)
     if self._monsters:
         self.updateAllMonsterLocation()
     
     groupState = configure.isteamInstanceTime(20)#组队副本时间判断
     guildFightState = fortress.IsWarTime()#国战时间判断
     
     for room in self.rooms:
         sendlist = []
         sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
         for playerId in room:
             player = PlayersManager().getPlayerByID(playerId)
             if not player:
                 continue
             player.icon.groupIconManager(groupState)#组队战图标管理
             player.icon.guildFightManager(guildFightState)#国战图标管理
             PlayerPosition = sceneInfo.PlayerPosition.add()
             PlayerPosition.id = player.baseInfo.id
             PlayerPosition.name = player.baseInfo.getNickName()
             PlayerPosition.profession = player.profession.getProfessionName()
             PlayerPosition.headicon = player.profession.getFigure()
             GuildInfo = player.guild.getGuildInfo()
             if GuildInfo:
                 PlayerPosition.guildname = GuildInfo.get('name','')
             PlayerPosition.figure = player.profession.getSceneFigure()
             position = player.baseInfo.getDestination()
             PlayerPosition.x = int(position[0])
             PlayerPosition.y = int(position[1])
             PlayerPosition.level = player.level.getLevel()
             PlayerPosition.viptype = player.baseInfo.getType()
             PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
             sendlist.append(player.getDynamicId())
             ###############角色展示宠物的处理################
             petremove = player.pet.popLastRemove()
             for petId in petremove:
                 self.dropPet(petId)
             for petId in player.matrix._matrixSetting.values():
                 if petId<=0:
                     continue
                 pet = player.pet.getPet(petId)
                 figure = pet.templateInfo['resourceid']
                 position = pet.getPosition()
                 PetPosition = sceneInfo.petInfo.add()
                 PetPosition.id = petId
                 PetPosition.name = pet.baseInfo.getName()
                 PetPosition.profession = pet.baseInfo.getName()
                 PetPosition.headicon = figure
                 PetPosition.figure = figure
                 PetPosition.x = int(position[0])
                 PetPosition.y = int(position[1])
                 PetPosition.masterId = playerId
         sceneInfo.sceneId = self._id
         msg = sceneInfo.SerializeToString()
         pushApplyMessage(602,msg, sendlist)
Example #2
0
 def pushEnterPlace(self,sendList):
     '''推送进入场景的信息
     '''
     sceneInfo = self.formatSceneInfo()
     response = EnterSceneMessage_605_pb2.EnterSceneMessage()
     response.sceneId = sceneInfo.get('id',0)
     response.resourceId = sceneInfo.get('resourceId',0)
     response.sceneType = sceneInfo.get('sceneType',0)
     response.scenename = sceneInfo.get('scenename',u'')
     response.corpsName = sceneInfo.get('corpsName',Lg().g(601))
     response.rewardCorpsName = sceneInfo.get('rewardCorpsName',Lg().g(601))
     npclist = response.npclist
     for npc in sceneInfo.get('npclist',[]):
         if not npc:
             continue
         npcInfo = npclist.add()
         npcInfo.npcId = npc['id']
         npcInfo.npcName = npc['name']
         npcInfo.resourceId = npc['resourceid']
         npcInfo.funcType = npc['featureType']
         npcInfo.positionX = npc['position_X']
         npcInfo.positionY = npc['position_Y']
     portals = response.portals
     for portal in sceneInfo['portals']:
         if not portal:
             continue
         portalInfo = portals.add()
         portalInfo.portalId = portal['id']
         portalInfo.portalName = portal['name']
         portalInfo.funcType = portal['functionType']
         portalInfo.positionX = portal['position_x']
         portalInfo.positionY = portal['position_y']
         portalInfo.resourceId = portal['resourceId']
     msg = response.SerializeToString()
     pushApplyMessage(605,msg,sendList)
Example #3
0
    def pushNowScenePosition(self, sendId, playerID):
        '''推送在场景中当前的所有角色和怪物的坐标
        @param sendId: int 推送的目标ID
        '''
        self._canRec.add(playerID)
        sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
        for playerId in self._playerlist:
            player = PlayersManager().getPlayerByID(playerId)
            PlayerPosition = sceneInfo.PlayerPosition.add()
            PlayerPosition.id = player.baseInfo.id
            PlayerPosition.name = player.baseInfo.getNickName()
            PlayerPosition.profession = player.profession.getProfessionName()
            PlayerPosition.headicon = player.profession.getFigure()
            GuildInfo = player.guild.getGuildInfo()
            if GuildInfo:
                PlayerPosition.guildname = GuildInfo.get('name', '')
            PlayerPosition.figure = player.profession.getSceneFigure()
            position = player.baseInfo.getPosition()
            PlayerPosition.x = int(position[0])
            PlayerPosition.y = int(position[1])
            PlayerPosition.level = player.level.getLevel()
            PlayerPosition.viptype = player.baseInfo.getType()
            PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
            PlayerPosition.currentHP = player.attribute.getHp()
            PlayerPosition.MaxHP = player.attribute.getMaxHp()
            ###############角色展示宠物的处理################
            player.pet.updatePetPosition(position)
            for petId in player.matrix._matrixSetting.values():
                if petId <= 0:
                    continue
                pet = player.pet.getPet(petId)
                figure = pet.templateInfo['resourceid']
                position = pet.getPosition()
                PetPosition = sceneInfo.petInfo.add()
                PetPosition.id = petId
                PetPosition.name = pet.baseInfo.getName()
                PetPosition.profession = pet.baseInfo.getName()
                PetPosition.headicon = figure
                PetPosition.figure = figure
                PetPosition.x = int(position[0])
                PetPosition.y = int(position[1])
                PetPosition.masterId = playerId
                PetPosition.currentHP = pet.attribute.getHp()
                PetPosition.MaxHP = pet.attribute.getMaxHp()

        for monster in self._monsters.values():
            MonsterPosition = sceneInfo.MonsterPosition.add()
            MonsterPosition.id = monster.baseInfo.id
            MonsterPosition.profession = monster.formatInfo['name']
            MonsterPosition.figure = monster.formatInfo['resourceid']
            MonsterPosition.name = monster.formatInfo['name']
            MonsterPosition.x = int(monster.baseInfo.getPosition()[0])
            MonsterPosition.y = int(monster.baseInfo.getPosition()[1])
            MonsterPosition.currentHP = monster.formatInfo['maxHp']
            MonsterPosition.MaxHP = monster.formatInfo['maxHp']
        sceneInfo.sceneId = self._id
        msg = sceneInfo.SerializeToString()
        pushApplyMessage(602, msg, [sendId])
Example #4
0
 def pushNowScenePosition(self,sendId,playerID):
     '''推送在场景中当前的所有角色和怪物的坐标
     @param sendId: int 推送的目标ID
     '''
     self._canRec.add(playerID)
     sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
     for playerId in self._playerlist:
         player = PlayersManager().getPlayerByID(playerId)
         PlayerPosition = sceneInfo.PlayerPosition.add()
         PlayerPosition.id = player.baseInfo.id
         PlayerPosition.name = player.baseInfo.getNickName()
         PlayerPosition.profession = player.profession.getProfessionName()
         PlayerPosition.headicon = player.profession.getFigure()
         GuildInfo = player.guild.getGuildInfo()
         if GuildInfo:
             PlayerPosition.guildname = GuildInfo.get('name','')
         PlayerPosition.figure = player.profession.getSceneFigure()
         position = player.baseInfo.getPosition()
         PlayerPosition.x = int(position[0])
         PlayerPosition.y = int(position[1])
         PlayerPosition.level = player.level.getLevel()
         PlayerPosition.viptype = player.baseInfo.getType()
         PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
         PlayerPosition.currentHP = player.attribute.getHp()
         PlayerPosition.MaxHP = player.attribute.getMaxHp()
         ###############角色展示宠物的处理################
         player.pet.updatePetPosition(position)
         for petId in player.matrix._matrixSetting.values():
             if petId<=0:
                 continue
             pet = player.pet.getPet(petId)
             figure = pet.templateInfo['resourceid']
             position = pet.getPosition()
             PetPosition = sceneInfo.petInfo.add()
             PetPosition.id = petId
             PetPosition.name = pet.baseInfo.getName()
             PetPosition.profession = pet.baseInfo.getName()
             PetPosition.headicon = figure
             PetPosition.figure = figure
             PetPosition.x = int(position[0])
             PetPosition.y = int(position[1])
             PetPosition.masterId = playerId
             PetPosition.currentHP = pet.attribute.getHp()
             PetPosition.MaxHP = pet.attribute.getMaxHp()
     
     for monster in self._monsters.values():
         MonsterPosition = sceneInfo.MonsterPosition.add()
         MonsterPosition.id = monster.baseInfo.id
         MonsterPosition.profession = monster.formatInfo['name']
         MonsterPosition.figure  = monster.formatInfo['resourceid']
         MonsterPosition.name = monster.formatInfo['name']
         MonsterPosition.x = int(monster.baseInfo.getPosition()[0])
         MonsterPosition.y = int(monster.baseInfo.getPosition()[1])
         MonsterPosition.currentHP = monster.formatInfo['maxHp']
         MonsterPosition.MaxHP = monster.formatInfo['maxHp']
     sceneInfo.sceneId = self._id
     msg = sceneInfo.SerializeToString()
     pushApplyMessage(602,msg, [sendId])
def pushCharacterEffectList(sendList,infolist):
    '''推送角色的效果列表信息'''
    
    response = GetBuffListInfo_pb2.GetBuffListInfoResponse()
    for info in infolist:
        effectInfo = response.buffInfo.add()
        for item in info.items():
            setattr(effectInfo,item[0],item[1])
    msg = response.SerializeToString()
    pushApplyMessage(222, msg, sendList)
Example #6
0
def pushPromptedMessage(msg ,sendList):
    '''推送其他提示信息'''
    from app.scense.protoFile import PromptedMessage_pb2
    response = PromptedMessage_pb2.PromptedMessage()
    try:
        response.prompted = msg
    except Exception:
        response.prompted = unicode(msg,'gbk')
    data = response.SerializeToString()
    pushApplyMessage(2200,data,sendList)
def pushCharacterEffectList(sendList, infolist):
    """推送角色的效果列表信息"""

    response = GetBuffListInfo_pb2.GetBuffListInfoResponse()
    for info in infolist:
        effectInfo = response.buffInfo.add()
        for item in info.items():
            setattr(effectInfo, item[0], item[1])
    msg = response.SerializeToString()
    pushApplyMessage(222, msg, sendList)
Example #8
0
def pushTurnOneCardMessage(characterId,
                           nickname,
                           cardId,
                           sendList,
                           topicID=706):
    '''推送翻开一张卡牌的消息'''
    response = TurnOneCard_pb2.TurnOneCard()
    response.characterId = characterId
    response.cardId = cardId + 1
    response.nickname = nickname
    msg = response.SerializeToString()
    pushApplyMessage(topicID, msg, sendList)
def ColonizeBattleAfter_713(dynamicId, request_proto):
    '''副本殖民战斗之后回到原场景'''
    argument = EscColonizationBattle713_pb2.EscColonizationBattleRequest()
    argument.ParseFromString(request_proto)
    response = EscColonizationBattle713_pb2.EscColonizationBattleResponse()
    
    dynamicId = dynamicId
    cid = argument.id #角色id
    battleResult=argument.battleResult #副本战斗结果
    instanceid=argument.sceneId #副本id
    InstanceColonizeGuerdon.backScnee(cid,instanceid,battleResult)
    response.result = True
    response.message = u''
    pushObjectNetInterface.pushApplyMessage(713, response.SerializeToString(), [dynamicId])
Example #10
0
def ColonizeBattleAfter_713(dynamicId, request_proto):
    '''副本殖民战斗之后回到原场景'''
    argument = EscColonizationBattle713_pb2.EscColonizationBattleRequest()
    argument.ParseFromString(request_proto)
    response = EscColonizationBattle713_pb2.EscColonizationBattleResponse()

    dynamicId = dynamicId
    cid = argument.id  #角色id
    battleResult = argument.battleResult  #副本战斗结果
    instanceid = argument.sceneId  #副本id
    InstanceColonizeGuerdon.backScnee(cid, instanceid, battleResult)
    response.result = True
    response.message = u''
    pushObjectNetInterface.pushApplyMessage(713, response.SerializeToString(),
                                            [dynamicId])
def pushGameTopTitle2400(sendList, typelist):
    '''推送奖励图标
    @param typeid: int 奖励类型 1为殖民  2殖民管理 3流光溢彩的殖民管理 
    4新手奖励 5每日奖励6点石成金7VIP 8竞技场 9组队副本
    '''
    response = GameTopTitle2400_pb2.GameTopTitleResponse()
    response.message = u'你妹'
    anouInfos = response.anouInfo
    for icon in typelist:
        icontype = icon.getItype()
        if icontype in [2, 3]:
            continue
        anouInfo = anouInfos.add()
        anouInfo.anouType = icontype
        anouInfo.surplusTimes = icon.getSurplustime()
    data = response.SerializeToString()
    pushApplyMessage(2400, data, sendList)
def pushGameTopTitle2400(sendList,typelist):
    '''推送奖励图标
    @param typeid: int 奖励类型 1为殖民  2殖民管理 3流光溢彩的殖民管理 
    4新手奖励 5每日奖励6点石成金7VIP 8竞技场 9组队副本
    '''
    response=GameTopTitle2400_pb2.GameTopTitleResponse()
    response.message = u'你妹'
    anouInfos = response.anouInfo
    for icon in typelist:
        icontype = icon.getItype()
        if icontype in [2,3]:
            continue
        anouInfo = anouInfos.add()
        anouInfo.anouType = icontype
        anouInfo.surplusTimes = icon.getSurplustime()
    data = response.SerializeToString()
    pushApplyMessage(2400 , data, sendList)
Example #13
0
 def pushEnterPlace(self, sendList):
     '''推送进入场景的信息
     '''
     sceneInfo = self.formatSceneInfo()
     response = EnterSceneMessage_605_pb2.EnterSceneMessage()
     response.sceneId = sceneInfo.get('id', 0)
     response.resourceId = sceneInfo.get('resourceId', 0)
     response.sceneType = sceneInfo.get('sceneType', 0)
     response.scenename = sceneInfo.get('scenename', u'')
     response.corpsName = sceneInfo.get('corpsName', Lg().g(601))
     response.rewardCorpsName = sceneInfo.get('rewardCorpsName',
                                              Lg().g(601))
     npclist = response.npclist
     for npc in sceneInfo.get('npclist', []):
         if not npc:
             continue
         npcInfo = npclist.add()
         npcInfo.npcId = npc['id']
         npcInfo.npcName = npc['name']
         npcInfo.resourceId = npc['resourceid']
         npcInfo.funcType = npc['featureType']
         npcInfo.positionX = npc['position_X']
         npcInfo.positionY = npc['position_Y']
     portals = response.portals
     for portal in sceneInfo['portals']:
         if not portal:
             continue
         portalInfo = portals.add()
         portalInfo.portalId = portal['id']
         portalInfo.portalName = portal['name']
         portalInfo.funcType = portal['functionType']
         portalInfo.positionX = portal['position_x']
         portalInfo.positionY = portal['position_y']
         portalInfo.resourceId = portal['resourceId']
     msg = response.SerializeToString()
     pushApplyMessage(605, msg, sendList)
Example #14
0
def practiceFinsihed(characterId, topicID=100001):
    '''修炼完成休息通知'''
    response = practiceFinsihed_pb2.PracticeFinsihed()
    response.message = Lg().g(438)
    msg = response.SerializeToString()
    pushApplyMessage(topicID, msg, [characterId])
Example #15
0
 def pushSceneInfo(self,rate):
     '''给每一个在场景中的玩家推送场景信息
     @param rate: int 移动的频率
     '''
     if not self._playerlist:
         return
     self.updateAllPlayerLocation(rate)
     if self._monsters:
         self.updateAllMonsterLocation()
     sendlist = self.getSendList()
     sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
     for playerId in self._playerlist:
         player = PlayersManager().getPlayerByID(playerId)
         PlayerPosition = sceneInfo.PlayerPosition.add()
         PlayerPosition.id = player.baseInfo.id
         PlayerPosition.name = player.baseInfo.getNickName()
         PlayerPosition.profession = player.profession.getProfessionName()
         PlayerPosition.headicon = player.profession.getFigure()
         GuildInfo = player.guild.getGuildInfo()
         if GuildInfo:
             PlayerPosition.guildname = GuildInfo.get('name','')
         PlayerPosition.figure = player.profession.getSceneFigure()
         position = player.baseInfo.getDestination()
         PlayerPosition.x = int(position[0])
         PlayerPosition.y = int(position[1])
         PlayerPosition.level = player.level.getLevel()
         PlayerPosition.viptype = player.baseInfo.getType()
         PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
         PlayerPosition.currentHP = player.attribute.getHp()
         PlayerPosition.MaxHP = player.attribute.getMaxHp()
         ###############角色展示宠物的处理################
         petremove = player.pet.popLastRemove()
         for petId in petremove:
             self.dropPet(petId)
         for petId in player.matrix._matrixSetting.values():
             if petId<=0:
                 continue
             pet = player.pet.getPet(petId)
             figure = pet.templateInfo['resourceid']
             position = pet.getPosition()
             PetPosition = sceneInfo.petInfo.add()
             PetPosition.id = petId
             PetPosition.name = pet.baseInfo.getName()
             PetPosition.profession = pet.baseInfo.getName()
             PetPosition.headicon = figure
             PetPosition.figure = figure
             PetPosition.x = int(position[0])
             PetPosition.y = int(position[1])
             PetPosition.masterId = playerId
             PetPosition.currentHP = pet.attribute.getHp()
             PetPosition.MaxHP = pet.attribute.getMaxHp()
             
     for monster in self._monsters.values():
         MonsterPosition = sceneInfo.MonsterPosition.add()
         MonsterPosition.id = monster.baseInfo.id
         MonsterPosition.profession = monster.formatInfo['name']
         MonsterPosition.figure  = monster.formatInfo['resourceid']
         MonsterPosition.name = monster.formatInfo['name']
         MonsterPosition.x = int(monster.baseInfo.getPosition()[0])
         MonsterPosition.y = int(monster.baseInfo.getPosition()[1])
         MonsterPosition.currentHP = monster.formatInfo['maxHp']
         MonsterPosition.MaxHP = monster.formatInfo['maxHp']
     sceneInfo.sceneId = self._id
     msg = sceneInfo.SerializeToString()
     pushApplyMessage(602,msg, sendlist)
Example #16
0
def pushGuildLevelUpMessage(level,sendList):
    '''推送国升级的消息'''
    response = CorpsLevelUp_pb2.CorpsLevelUpNotify()
    response.level = level
    msg = response.SerializeToString()
    pushApplyMessage(1323,msg,sendList)
Example #17
0
 def pushRemovePlayerInMap(self,playerId,sendList):
     '''通知场景移除玩家'''
     request = removePlayerInMap_pb2.removePlayerInMap()
     request.id = playerId
     msg = request.SerializeToString()
     pushApplyMessage(604,msg,sendList)
def practiceFinsihed(characterId,topicID=100001):
    '''修炼完成休息通知'''
    response = practiceFinsihed_pb2.PracticeFinsihed()
    response.message = Lg().g(438)
    msg = response.SerializeToString()
    pushApplyMessage(topicID,msg,[characterId])
Example #19
0
    def pushSceneInfo(self, rate):
        '''给每一个在场景中的玩家推送场景信息
        @param rate: int 移动的频率
        '''
        if not self._playerlist:
            return
        self.updateAllPlayerLocation(rate)
        if self._monsters:
            self.updateAllMonsterLocation()
        sendlist = self.getSendList()
        sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
        for playerId in self._playerlist:
            player = PlayersManager().getPlayerByID(playerId)
            PlayerPosition = sceneInfo.PlayerPosition.add()
            PlayerPosition.id = player.baseInfo.id
            PlayerPosition.name = player.baseInfo.getNickName()
            PlayerPosition.profession = player.profession.getProfessionName()
            PlayerPosition.headicon = player.profession.getFigure()
            GuildInfo = player.guild.getGuildInfo()
            if GuildInfo:
                PlayerPosition.guildname = GuildInfo.get('name', '')
            PlayerPosition.figure = player.profession.getSceneFigure()
            position = player.baseInfo.getDestination()
            PlayerPosition.x = int(position[0])
            PlayerPosition.y = int(position[1])
            PlayerPosition.level = player.level.getLevel()
            PlayerPosition.viptype = player.baseInfo.getType()
            PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
            PlayerPosition.currentHP = player.attribute.getHp()
            PlayerPosition.MaxHP = player.attribute.getMaxHp()
            ###############角色展示宠物的处理################
            petremove = player.pet.popLastRemove()
            for petId in petremove:
                self.dropPet(petId)
            for petId in player.matrix._matrixSetting.values():
                if petId <= 0:
                    continue
                pet = player.pet.getPet(petId)
                figure = pet.templateInfo['resourceid']
                position = pet.getPosition()
                PetPosition = sceneInfo.petInfo.add()
                PetPosition.id = petId
                PetPosition.name = pet.baseInfo.getName()
                PetPosition.profession = pet.baseInfo.getName()
                PetPosition.headicon = figure
                PetPosition.figure = figure
                PetPosition.x = int(position[0])
                PetPosition.y = int(position[1])
                PetPosition.masterId = playerId
                PetPosition.currentHP = pet.attribute.getHp()
                PetPosition.MaxHP = pet.attribute.getMaxHp()

        for monster in self._monsters.values():
            MonsterPosition = sceneInfo.MonsterPosition.add()
            MonsterPosition.id = monster.baseInfo.id
            MonsterPosition.profession = monster.formatInfo['name']
            MonsterPosition.figure = monster.formatInfo['resourceid']
            MonsterPosition.name = monster.formatInfo['name']
            MonsterPosition.x = int(monster.baseInfo.getPosition()[0])
            MonsterPosition.y = int(monster.baseInfo.getPosition()[1])
            MonsterPosition.currentHP = monster.formatInfo['maxHp']
            MonsterPosition.MaxHP = monster.formatInfo['maxHp']
        sceneInfo.sceneId = self._id
        msg = sceneInfo.SerializeToString()
        pushApplyMessage(602, msg, sendlist)
Example #20
0
    def pushNowScenePosition(self,sendId,playerID):
        '''推送在场景中当前的所有角色和怪物的坐标
        @param sendId: int 推送的目标ID
        '''
        self._canRec.add(playerID)
        for room in self.rooms:
            if playerID not in room:
                continue
            sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
            for playerId in room:
                player = PlayersManager().getPlayerByID(playerId)
                if not player:
                    continue
                PlayerPosition = sceneInfo.PlayerPosition.add()
                PlayerPosition.id = player.baseInfo.id
                PlayerPosition.name = player.baseInfo.getNickName()
                PlayerPosition.profession = player.profession.getProfessionName()
                PlayerPosition.headicon = player.profession.getFigure()
                GuildInfo = player.guild.getGuildInfo()
                if GuildInfo:
                    PlayerPosition.guildname = GuildInfo.get('name','')
                PlayerPosition.figure = player.profession.getSceneFigure()
                position = player.baseInfo.getPosition()
                PlayerPosition.x = int(position[0])
                PlayerPosition.y = int(position[1])
                PlayerPosition.level = player.level.getLevel()
                PlayerPosition.viptype = player.baseInfo.getType()
                PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
                ###############角色展示宠物的处理################
                player.pet.updatePetPosition(position)
                for petId in player.matrix._matrixSetting.values():
                    if petId<=0:
                        continue
                    pet = player.pet.getPet(petId)
                    figure = pet.templateInfo['resourceid']
                    position = pet.getPosition()
                    PetPosition = sceneInfo.petInfo.add()
                    PetPosition.id = petId
                    PetPosition.name = pet.baseInfo.getName()
                    PetPosition.profession = pet.baseInfo.getName()
                    PlayerPosition.headicon = figure
                    PetPosition.figure = figure
                    PetPosition.x = int(position[0])
                    PetPosition.y = int(position[1])
                    PetPosition.masterId = playerId
#                for petId in player.pet._pets.keys():
#                    pet = player.pet.getPet(petId)
#                    flowFlag = pet.getFlowFlag()
#                    if not flowFlag:
#                        continue
#                    figure = pet._baseInfo['resourceid']
#                    position = pet.getPosition()
#                    PetPosition = sceneInfo.petInfo.add()
#                    PetPosition.id = petId
#                    PetPosition.name = pet.getName()
#                    PetPosition.profession = pet.getName()
#                    PetPosition.figure = figure
#                    PetPosition.x = int(position[0])
#                    PetPosition.y = int(position[1])
            sceneInfo.sceneId = self._id
            msg = sceneInfo.SerializeToString()
            pushApplyMessage(602,msg, [sendId])
            return
Example #21
0
def pushShowAllCards(sendList):
    '''推送显示所有牌子的信息'''
    response = showAllCards_pb2.showAllCards()
    response.signal = 1
    msg = response.SerializeToString()
    pushApplyMessage(709, msg, sendList)
Example #22
0
def pushTurnAllCardMessage(sendList, topicID=708):
    '''推送翻开所有卡牌的消息'''
    response = TurnAllCards_pb2.TurnAllCards()
    response.signal = 1
    msg = response.SerializeToString()
    pushApplyMessage(topicID, msg, sendList)
Example #23
0
    def pushNowScenePosition(self, sendId, playerID):
        '''推送在场景中当前的所有角色和怪物的坐标
        @param sendId: int 推送的目标ID
        '''
        self._canRec.add(playerID)
        for room in self.rooms:
            if playerID not in room:
                continue
            sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
            for playerId in room:
                player = PlayersManager().getPlayerByID(playerId)
                if not player:
                    continue
                PlayerPosition = sceneInfo.PlayerPosition.add()
                PlayerPosition.id = player.baseInfo.id
                PlayerPosition.name = player.baseInfo.getNickName()
                PlayerPosition.profession = player.profession.getProfessionName(
                )
                PlayerPosition.headicon = player.profession.getFigure()
                GuildInfo = player.guild.getGuildInfo()
                if GuildInfo:
                    PlayerPosition.guildname = GuildInfo.get('name', '')
                PlayerPosition.figure = player.profession.getSceneFigure()
                position = player.baseInfo.getPosition()
                PlayerPosition.x = int(position[0])
                PlayerPosition.y = int(position[1])
                PlayerPosition.level = player.level.getLevel()
                PlayerPosition.viptype = player.baseInfo.getType()
                PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel(
                )
                ###############角色展示宠物的处理################
                player.pet.updatePetPosition(position)
                for petId in player.matrix._matrixSetting.values():
                    if petId <= 0:
                        continue
                    pet = player.pet.getPet(petId)
                    figure = pet.templateInfo['resourceid']
                    position = pet.getPosition()
                    PetPosition = sceneInfo.petInfo.add()
                    PetPosition.id = petId
                    PetPosition.name = pet.baseInfo.getName()
                    PetPosition.profession = pet.baseInfo.getName()
                    PlayerPosition.headicon = figure
                    PetPosition.figure = figure
                    PetPosition.x = int(position[0])
                    PetPosition.y = int(position[1])
                    PetPosition.masterId = playerId
#                for petId in player.pet._pets.keys():
#                    pet = player.pet.getPet(petId)
#                    flowFlag = pet.getFlowFlag()
#                    if not flowFlag:
#                        continue
#                    figure = pet._baseInfo['resourceid']
#                    position = pet.getPosition()
#                    PetPosition = sceneInfo.petInfo.add()
#                    PetPosition.id = petId
#                    PetPosition.name = pet.getName()
#                    PetPosition.profession = pet.getName()
#                    PetPosition.figure = figure
#                    PetPosition.x = int(position[0])
#                    PetPosition.y = int(position[1])
            sceneInfo.sceneId = self._id
            msg = sceneInfo.SerializeToString()
            pushApplyMessage(602, msg, [sendId])
            return
Example #24
0
    def pushSceneInfo(self, rate):
        '''给每一个在场景中的玩家推送场景信息
        @param rate: int 移动的频率
        '''
        if not self._canRec:
            return
        self.updateAllPlayerLocation(rate)
        if self._monsters:
            self.updateAllMonsterLocation()

        groupState = configure.isteamInstanceTime(20)  #组队副本时间判断
        guildFightState = fortress.IsWarTime()  #国战时间判断

        for room in self.rooms:
            sendlist = []
            sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
            for playerId in room:
                player = PlayersManager().getPlayerByID(playerId)
                if not player:
                    continue
                player.icon.groupIconManager(groupState)  #组队战图标管理
                player.icon.guildFightManager(guildFightState)  #国战图标管理
                PlayerPosition = sceneInfo.PlayerPosition.add()
                PlayerPosition.id = player.baseInfo.id
                PlayerPosition.name = player.baseInfo.getNickName()
                PlayerPosition.profession = player.profession.getProfessionName(
                )
                PlayerPosition.headicon = player.profession.getFigure()
                GuildInfo = player.guild.getGuildInfo()
                if GuildInfo:
                    PlayerPosition.guildname = GuildInfo.get('name', '')
                PlayerPosition.figure = player.profession.getSceneFigure()
                position = player.baseInfo.getDestination()
                PlayerPosition.x = int(position[0])
                PlayerPosition.y = int(position[1])
                PlayerPosition.level = player.level.getLevel()
                PlayerPosition.viptype = player.baseInfo.getType()
                PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel(
                )
                sendlist.append(player.getDynamicId())
                ###############角色展示宠物的处理################
                petremove = player.pet.popLastRemove()
                for petId in petremove:
                    self.dropPet(petId)
                for petId in player.matrix._matrixSetting.values():
                    if petId <= 0:
                        continue
                    pet = player.pet.getPet(petId)
                    figure = pet.templateInfo['resourceid']
                    position = pet.getPosition()
                    PetPosition = sceneInfo.petInfo.add()
                    PetPosition.id = petId
                    PetPosition.name = pet.baseInfo.getName()
                    PetPosition.profession = pet.baseInfo.getName()
                    PetPosition.headicon = figure
                    PetPosition.figure = figure
                    PetPosition.x = int(position[0])
                    PetPosition.y = int(position[1])
                    PetPosition.masterId = playerId
            sceneInfo.sceneId = self._id
            msg = sceneInfo.SerializeToString()
            pushApplyMessage(602, msg, sendlist)
Example #25
0
def pushGuildLevelUpMessage(level, sendList):
    '''推送国升级的消息'''
    response = CorpsLevelUp_pb2.CorpsLevelUpNotify()
    response.level = level
    msg = response.SerializeToString()
    pushApplyMessage(1323, msg, sendList)
Example #26
0
 def pushRemovePlayerInMap(self, playerId, sendList):
     '''通知场景移除玩家'''
     request = removePlayerInMap_pb2.removePlayerInMap()
     request.id = playerId
     msg = request.SerializeToString()
     pushApplyMessage(604, msg, sendList)