當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。