当前位置: 首页>>代码示例>>Python>>正文


Python PlayersManager.PlayersManager类代码示例

本文整理汇总了Python中app.scense.core.PlayersManager.PlayersManager的典型用法代码示例。如果您正苦于以下问题:Python PlayersManager类的具体用法?Python PlayersManager怎么用?Python PlayersManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PlayersManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CorpsInviteOther

def CorpsInviteOther(dynamicId,characterId,otherid,otername):
    '''邀请加入行会
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param otherid: int 对方的Id
    @param otername: 对方的名称
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    guildId = player.guild.getID()
    if not guildId:
        return {'result':False,'message':Lg().g(79)}
    toplayer = PlayersManager().getPlayerByID(otherid)
    if not toplayer:
        return {'result':False,'message':Lg().g(91)}
    if toplayer.level.getLevel()<LEVELREQUIRED:
        return {'result':False,'message':Lg().g(86)}
    guild = GuildManager().getGuildById(guildId)
    if guild.guildinfo.get('curMenberNum',50)>=guild.guildinfo.get('memberCount',50):
        return {'result':False,'message':Lg().g(83)}
    sendList = [toplayer.getDynamicId()]
    pushInviteOtherJoinGuild(characterId, guildId, player.baseInfo.getName(),\
                              guild.getGuildName(), sendList)
    msg = Lg().g(92)
    pushOtherMessage(905, msg, [dynamicId])
    return {'result':True}
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:27,代码来源:guild.py

示例2: LevelUpEmblem

def LevelUpEmblem(dynamicId,characterId):
    '''升级军徽
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    guildId = player.guild.getID()
    if not guildId:
        return {'result':False,'message':Lg().g(79)}
    guild = GuildManager().getGuildById(guildId)
    emblemlevel = guild.guildinfo.get('emblemLevel',0)
    goldRequired = {1:100,2:200,3:500,4:1000,5:2000,6:5000,7:10000,8:20000,9:50000,10:10000}
    goldcons = goldRequired.get(emblemlevel,100)
    if goldcons > player.finance.getGold():
        msg = Lg().g(190)
        pushOtherMessage(905, msg, [dynamicId])
        return {'result':False,'message':msg}
    data = guild.LevelUpEmblem(characterId)
    if data.get('result',False):
        player.finance.consGold(goldcons,6)#升级军徽消耗钻
        player.guild.addContribution(int(goldcons*1.5))
        player.updatePlayerInfo()
    else:
        pushOtherMessage(905, data.get('message',''), [dynamicId])
    return data
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:27,代码来源:guild.py

示例3: CorpsInviteReply

def CorpsInviteReply(dynamicId,characterId,union_id,is_ok):
    '''邀请加入行会的反馈信息
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param union_id: int 行会的id(邀请者的ID)
    @param is_ok: int 是否同意 0否 1是
    '''
    player = PlayersManager().getPlayerByID(characterId)
    fplayer = PlayersManager().getPlayerByID(union_id)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    nowguildId = player.guild.getID()
    toguildId = dbGuild.getCharacterGuildId(union_id)
    if fplayer and not is_ok:
        msg = "%s拒绝了你的邀请"%player.baseInfo.getName()
        pushOtherMessage(905, msg, [fplayer.getDynamicId()])
        return {'result':True}
    if nowguildId:
        return {'result':False,'message':Lg().g(94)}
    guild = GuildManager().getGuildById(toguildId)
    if not guild:
        return {'result':False,'message':Lg().g(95)}
    surplushours = player.guild.getCanJoinTime()
    if surplushours:
        return {'result':False,'message':Lg().g(647)%surplushours}
    result = guild.JointGuild(characterId)
    if result.get('result',False):
        
        msg = u'成功加入%s'%guild.getGuildName()
        pushOtherMessage(905, msg, [dynamicId])
    else:
        nmsg = result.get('message','')
        pushOtherMessage(905, nmsg, [dynamicId])
    return result
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:34,代码来源:guild.py

示例4: NetConnLost_2

def NetConnLost_2(dynamicId):
    '''loginout'''
    player = PlayersManager().getPlayerBydynamicId(dynamicId)
    if not player:
        return True
    try:
        tag=player.baseInfo.getInstancetag() #副本动态Id
        InstanceManager().dropInstanceById(tag)#如果角色下线的时候在副本中,就清空副本
        player.afk.stopMeditation()#在线挂机结算
        player.updatePlayerDBInfo()
#        player.qhtime.dbupdate()#记录角色强化冷却时间
        player.nobility.dbupdate()#记录爵位限制信息
        player.petShop.dbupdate()#记录宠物商店信息
#        publicnoderemote.callRemote('dropPCharacter',player.baseInfo.id)
        PlayersManager().dropPlayer(player)
        state = player.baseInfo.getState()
        if state == 0:
            sceneId = player.baseInfo.getTown()
            scene = MapManager().getMapId(sceneId)
            scene.dropPlayer(player.baseInfo.id)
            if player.baseInfo.getState()==0:
                scene.dropPlayer(player.baseInfo.id)
                for petId,pet in player.pet._pets.items():
                    if pet.getFlowFlag():
                        scene.dropPet(petId)
    except Exception as ex:
        log.err(ex) 
    finally:
        return True
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:29,代码来源:loginout.py

示例5: addexp

def addexp(characterId,argument):
    '''升级'''
    if len(argument)<1:
        return 
    player = PlayersManager().getPlayerByID(characterId)
    player.level.addExp(int(argument[0]))
    player.updatePlayerInfo()
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:7,代码来源:gmCommand.py

示例6: getSxzy

def getSxzy(characterid,item1,item2):
    '''获取属性转移后的效果及其花费信息
    @param item1: int 物品id (转移后强化等级变成0的那个物品的id)
    @param item: int 物品id 
    '''
    if item1==item2:
        pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(206), [characterid])
        return {'result':False,'message':Lg().g(206),'data':None}
    player=PlayersManager().getPlayerByID(characterid) #角色实例
    if not player:
        return {'result':False,'message':Lg().g(199),'data':None}
    if player.level.getLevel()<30:
        return {'result':False,'message':Lg().g(205),'data':None}
    items1=getItemByplayer(player, item1)
    if not items1:
        return {'result':False,'message':Lg().g(189),'data':None}
    items2=getItemByplayer(player, item2)
    if not items2:
        return {'result':False,'message':Lg().g(189),'data':None}
    
    if items1.getWQtype()!=items2.getWQtype():
        return {'qh':None,'coin':0}

    level=Sxzy(items1, items2)
    zyyh=level+items2.attribute.getStrengthen()#转移以后装备的强化等级
    if player.level.getLevel()<zyyh:
        pushObjectNetInterface.pushOtherMessage(905, Lg().g(207)%zyyh, [player.getDynamicId()])
    Zcion=getSxzyCoin(items1, items2)#转移花费金币
    
    
    return {'qh':level,'coin':Zcion}
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:31,代码来源:strengthen.py

示例7: addPlayerFriend

def addPlayerFriend(dynamicId,characterId,friendName,friendType,isSheildedMail=0):
    '''添加好友
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param friendName: string 对方的昵称
    @param friendType: int(1,2) 好友的类型 1:好友  2:黑名单
    @param isSheildedMail: 是否屏蔽邮件
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result':False,'message':Lg().g(18)}
        
    friendId = dbaccess.getCharacterIdByNickName(friendName)#返回好友角色id [id]
    if not friendId:
        msg =Lg().g(75)
        pushObjectNetInterface.pushOtherMessage(905,msg, [player.getDynamicId()])
        return {'result':False,'message':Lg().g(68)}
    pyid=-1 #关系好友动态id -1表示角色没有在线   其他表示角色动态id
    py1=PlayersManager().getPlayerByID(friendId[0])
    
    if py1 and py1.friend.getTypeByid(characterId)==0:#如果好友在线
        pyid=py1.getDynamicId()
    result = player.friend.addFriend(characterId,friendId[0],friendType,pyid)
    if result:
        pushObjectNetInterface.pushOtherMessage(905, result['message'], [player.getDynamicId()])
        return {'result':True,'message':Lg().g(69)}

    return {'result':False,'message':Lg().g(70)}
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:28,代码来源:firend.py

示例8: StartUpGuaJi

def StartUpGuaJi(dynamicId,characterId):
    '''角色开始挂机
    @param characterId: int 角色的ID
    '''
    from app.scense.core.campaign.FortressManager import FortressManager
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    #判断是否有冥想加成
    if player.baseInfo.getState()==1:  #如果角色在副本
        state = 0
    else:
        guildId = player.guild.getID()
        sceneId = player.baseInfo.getTown()
        fortress=  FortressManager().getFortressBySceneId(sceneId)
        if not fortress.isOccupied:
            state = 0
        else:
            if fortress.kimori==guildId and guildId!=0:
                state=1
            else:
                state = 0
    result = player.afk.startMeditation(state=state)
    if not result.get('result'):
        msg = result.get('message')
        sendId = player.getDynamicId()
        pushOtherMessage(905, msg, [sendId])
    return result
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:28,代码来源:meditation.py

示例9: pushSceneInfo

 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)
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:60,代码来源:scene.py

示例10: ObtainReward

def ObtainReward(pid,did):
    '''领取单个保卫奖励
    @param pid: int 角色id
    @param did: int 保卫奖励表主键id
    '''
    msg=u""
    flg=True
    player=PlayersManager().getPlayerByID(pid)#获得角色id
    info=dbDefenceBonus.getByid(did) #根据奖励主键id获得奖励信息
    if not info:
        pushObjectNetInterface.pushOtherMessage(905, Lg().g(61), [player.getDynamicId()])
        return False,Lg().g(61)
    reward=info['reward']
    player.finance.updatePrestige(player.finance.getPrestige()+reward)
    if not dbDefenceBonus.delByid(info['id']) : 
        msg+=Lg().g(62)
        flg=False

#    item=Item(itemTemplateId=20030061)
#    item.pack.setStack(info['reward']) #物品的数量
#    rs1=player.pack._package.canPutItem(item,info['reward']) #判断背包中是否可以放入这些数量的物品
#    if rs1: #如果可以放进去
#        player.pack.putNewItemsInPackage(20030061,info['reward'])
#        del item
#        if not dbDefenceBonus.delByid(info['id']) : 
#            msg+=Lg().g(62)
#            flg=False
#    else: #如果一个奖励所获得物品不能放入背包
#        del item
#        pushObjectNetInterface.pushOtherMessage(905, Lg().g(16), [player.getDynamicId()])
#        return False,Lg().g(16)
    return flg,msg
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:32,代码来源:defencelog_app.py

示例11: tiaozhuan

def tiaozhuan(dynamicId,characterid,csz):
    '''场景间的跳转或者进入副本
    '''
    player = PlayersManager().getPlayerByID(characterid)
    if not player:
        return {'result':False,'message':Lg().g(18)}
    doorinfo = dbMap.ALL_DOOR_INFO.get(csz)#获取传送门的信息
    lastscene = MapManager().getMapId(player.baseInfo.getTown())
    if doorinfo.get('functionType')==1:#跳转场景
        placeId = doorinfo.get('nextmap')
        position = (doorinfo.get('init_x'),doorinfo.get('init_y'))
        player.baseInfo.setTown( placeId)
        player.baseInfo.setState(0)
        PlayersManager().addPlayer(player)
        defencelog_app.isReward(player.baseInfo.id, player.getDynamicId())
        scene = MapManager().getMapId(placeId)
        scenename = scene.getSceneName()
        chatnoderemote.callRemote('JoinRoom',characterid,placeId,scenename)
        scene.addPlayer(characterid)
        player.quest.setNpcList(scene._npclist)
        player.baseInfo.initPosition(position)
        scene.pushEnterPlace([dynamicId])
        result = {'result':True}
    else:
        instanceId = doorinfo.get('famID')
        result = instance_app.enterInstance1(player,dynamicId, characterid, instanceId,0)
    if result.get('result'):
        lastscene.dropPlayer(characterid)
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:28,代码来源:tiaozhuan.py

示例12: isHaveQH

def isHaveQH(characterid,itemid):
    '''判断是否能够强化
    @param characterid: int 角色id
    @param itemid: int 物品1(item)表主键id
    '''
    item1=None#物品实例1
    player=PlayersManager().getPlayerByID(characterid)
    
    if itemid>0:#如果物品1存在

        if player.pack._package._PropsPagePack.getPositionByItemId(itemid)!=-1:#背包中没有此物品
            item1=player.pack._package._PropsPagePack.getItemInfoByItemid(itemid)#获取物品实例
        else:
            item1=player.pack._equipmentSlot.getItemInfoByItemid(itemid)
            
        if not item1:
            return {'result':False,'message':Lg().g(189),'data':None}

    wqtype=item1.getWQtype()#武器类型 #装备类型id   #0=衣服#1=裤子 #2=头盔#3=手套#4=靴子#5=护肩#6=项链#7=戒指#8=主武器#9=副武器#10=双手
    if wqtype<0 or wqtype>10: #装备类型id  
        pushObjectNetInterface.pushOtherMessage(905, Lg().g(196), [player.getDynamicId()])
        return {'result':False,'message':Lg().g(197),'data':None}
   
    baseQuality=item1.baseInfo.getItemTemplateInfo().get("baseQuality",0)#基础品质 1灰 2白 3绿 4蓝 5紫 6橙 7红
    itemlevel=item1.baseInfo.getItemTemplateInfo().get("levelRequire",0) #装备等级
    qlevel=item1.attribute.getStrengthen() #物品当前的强化等级
    jinbi= coinCount(qlevel,baseQuality,wqtype,itemlevel)
    return qq(player, itemid,wqtype,baseQuality,jinbi,item1)
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:28,代码来源:strengthen.py

示例13: ObtainItem_2408

def ObtainItem_2408(dynamicId, request_proto):
    '''放到自己背包中'''
    argument=ObtainItem2408_pb2.ObtainItemRequest()
    argument.ParseFromString(request_proto)
    response=ObtainItem2408_pb2.ObtainItemResponse()
    
    id=argument.id #角色id
    type=argument.type #0获取所有 1获取单个
    pos=argument.pos # 单个在背包的位置
    player=PlayersManager().getPlayerByID(id) #角色实例
    if type==0:
        data=player.instance.putAllItemsInPack()
        if not data:
            response.result=False
            response.message=Lg().g(16)
            pushObjectNetInterface.pushOtherMessage(905, Lg().g(16), [player.getDynamicId()])
            return response.SerializeToString()
    else:
        data=player.instance.getOneItemInPackByPosition(pos)
        if not data:
            response.result=False
            response.message=Lg().g(16)
            return response.SerializeToString()
    response.result=True
    response.message=u''
    return response.SerializeToString()
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:26,代码来源:instanceColonize_net.py

示例14: cleancd

def cleancd(characterId,argument):
    '''清除竞技场CD'''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return
    player.arena.clearCD()
    player.updatePlayerInfo()
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:7,代码来源:gmapp.py

示例15: getSendList

 def getSendList(self,room):
     '''获取接受场景消息的角色的客户端ID'''
     sendlist = []
     for playerId in room:
         player = PlayersManager().getPlayerByID(playerId)
         if playerId in self._canRec and player and player.baseInfo.getStatus()!=4:
             sendlist.append(player.getDynamicId())
     return sendlist
开发者ID:9miao,项目名称:firefly_fengyan_OL,代码行数:8,代码来源:scene.py


注:本文中的app.scense.core.PlayersManager.PlayersManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。