示例#1
0
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}
示例#2
0
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}
示例#3
0
 def getTeamInfoByPlayerId(self,pid,dwid):
     '''获取队伍信息
     @param pid: int 角色id
     '''
     tid= self.pi.get(pid,None)#成员的队伍id
     if not tid:
         log.err(u'TeamFight->getTeamInfoByPlayerId(%s,%s) self.pid=%s'%(pid,dwid,self.pi))
     if not dwid==tid:
         log.err("getTeamInfoByPlayerId(%s,%s) tid=%s"%(pid,dwid,tid))
     teaminfo=self.info.get(tid,None)
     if not teaminfo:
         pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(624), [pid])
         return []
         log.err(u'TeamFight->getTeamInfoByPlayerId(%s,%s) tid=%s  self.info=%s'%(pid,dwid,tid,self.info))
     zf=teaminfo.zf #{1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0}#阵法信息 key阵法信息,value:>0表示角色在此位置
     rs=[]#队伍信息(右侧)
     for key,value in zf.items():#key:表示阵法位置,value:表示阵法上面的角色
         if value>0:
             zfinfo={}
             player=teaminfo.players.get(value)#角色实例
             zfinfo['roleId']=player.baseInfo.getId()
             zfinfo['level']=player.level.getLevel()#角色等级
             zfinfo['roleType']=player.profession.getFigure()#角色职业
             zfinfo['roleName']=player.baseInfo.getNickName()#角色名称
             zfinfo['pos']=key#角色位置
             rs.append(zfinfo)
     return rs
示例#4
0
 def TCTeamPlayer(self,pid,cid):
     '''队长将成员踢出队伍
     @param pid: int 队长角色id
     @param cid: int 成员角色id
     '''
     tid= self.pi.get(cid,None)#成员队伍id
     if not tid:
         log.err(u'TeamFight->TCTeamPlayer(%s,%s) self.pid=%s'%(pid,cid,self.pi))
     teaminfo=self.info.get(tid,None)
     if not teaminfo:
         log.err(u'TeamFight->TCTeamPlayer(%s,%s) tid=%s  self.info=%s'%(pid,cid,tid,self.info))
         return {'result':False,'message':Lg().g(479)}
     if not teaminfo.pid==pid:
         return{'result':False,'message':Lg().g(582)}
     if cid==pid:
         return{'result':False,'message':Lg().g(583)}
     
     teaminfo.delTeamPlayer(cid)
     del self.pi[cid]
     self.delCXpi(cid)
     pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(584),[cid])
     plist=teaminfo.players.keys()#队伍成员id列表
     pushObjectNetInterface.team4304(tid, plist)#推送其他队伍成员队伍信息
     pushObjectNetInterface.teamClean4304(tid, [cid])
     return{'result':True,'message':u'成功'}
示例#5
0
def qq(player,itemid,wqtype,baseQuality,jinbi,item):
    '''
    @param player: obj 角色实例
    @param itemid: int 物品id
    @param wqtype: int #装备类型id  1武器  2防具 3饰品  4强化石  0不是装备
    @param baseQuality: int 物品品质
    @param jinbi: int 需要花费多少金币
    @param item: obj 物品实例
    '''
#    item=player.pack._package._PropsPagePack.getItemInfoByItemid(itemid)#物品id
    qlevel=item.attribute.getStrengthen() #物品当前的强化等级
#    baseprobability=int(qhslevel/(qlevel/2.0+baseQuality*qhslevel)*5.0)#成功率百分比 x%    #(强化石Lv/(装备强化Lv/2+装备品质*强化石Lv))*5
    if qlevel>=player.level.getLevel():
        pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(198), [player.baseInfo.id])
        return {'result':False,'message':Lg().g(198),'data':None}
    if not player:
        return {'result':False,'message':Lg().g(199),'data':None}
#    flg=False#金币是否足够
#    playercoin=player.finance.getCoin()#角色的金币数量
#    if playercoin>=jinbi:
#        flg=True
    zyid=item.baseInfo.getItemProfession()#职业类型限制 1战士 2 法师 3 游侠 4 牧师
    arraylist=configure.getAttributeByZyAndWqTypeid(zyid, wqtype,qlevel+1,baseQuality)#根据角色职业类型和装备类型获取增加的属性
    arraylist=arraylist[0]
    itemTemplateId=item.baseInfo.getItemTemplateId()
    data={'syname':arraylist[0],'syvalue':arraylist[1],'coin':jinbi,'itemTemplateId':itemTemplateId,'qlevel':qlevel+1}
    return{'result':True,'message':Lg().g(166),'data':data}
示例#6
0
def StartWaJue(characterId,miningtype):
    '''开始挖掘'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.doMining(miningtype)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message',u''), [characterId])
        return data
    return {'result':False,'message':Lg().g(18)}
示例#7
0
def LevelUpSpeedWaJue(characterId,mtype):
    '''加强挖掘'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.updateMiningMode(mtype)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message',u''), [characterId])
        return data
    return {'result':False,'message':Lg().g(18)}
示例#8
0
def AramStartXunLian(characterId,ttype,funType,funId):
    '''开始训练'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.doTrain(ttype,funType,funId)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message',u''), [characterId])
        return data 
    return {'result':False,'message':Lg().g(18)}
示例#9
0
def NowSuccWaJue(characterId):
    '''立即完成挖掘'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.FinishedMining()
        msg = data.get('message', u'')
        if msg:
            pushOtherMessageByCharacterId(msg, [characterId])
        return data
    return {'result': False, 'message': Lg().g(18)}
示例#10
0
def LevelUpSpeedWaJue(characterId, mtype):
    '''加强挖掘'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.updateMiningMode(mtype)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message', u''),
                                          [characterId])
        return data
    return {'result': False, 'message': Lg().g(18)}
示例#11
0
def StartWaJue(characterId, miningtype):
    '''开始挖掘'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.doMining(miningtype)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message', u''),
                                          [characterId])
        return data
    return {'result': False, 'message': Lg().g(18)}
示例#12
0
def AramNowSuccXunLian(characterId,ptype,funId):
    '''立即完成训练'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        info = player.afk.FinishedTrain()
        msg = info.get('message',u'')
        if msg:
            pushOtherMessageByCharacterId(msg, [characterId])
        return info
    return {'result':False,'message':Lg().g(18)}
示例#13
0
def AramNowSuccXunLian(characterId, ptype, funId):
    '''立即完成训练'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        info = player.afk.FinishedTrain()
        msg = info.get('message', u'')
        if msg:
            pushOtherMessageByCharacterId(msg, [characterId])
        return info
    return {'result': False, 'message': Lg().g(18)}
示例#14
0
def NowSuccWaJue(characterId):
    '''立即完成挖掘'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.FinishedMining()
        msg = data.get('message',u'')
        if msg:
            pushOtherMessageByCharacterId(msg, [characterId])
        return data 
    return {'result':False,'message':Lg().g(18)}
示例#15
0
def AramStartXunLian(characterId, ttype, funType, funId):
    '''开始训练'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.doTrain(ttype, funType, funId)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message', u''),
                                          [characterId])
        return data
    return {'result': False, 'message': Lg().g(18)}
示例#16
0
def TeamFighting(pid):
    '''开始多人副本战斗'''
    from app.scense.core.teamfight.TeamFight import TeamFight
    from app.scense.applyInterface import teamInstanceDrop
    
    if not configure.isteamInstanceTime(17):
        return
    teamid=TeamFight().getTeamidByPid(pid)
    if teamid==0:
        return{'result':False,'message':Lg().g(260)}
    teaminfo=TeamFight().getteaminfoByteamid(teamid)
    
    if not teaminfo.pid==pid:
        return{'result':False,'message':Lg().g(261)}
    if teaminfo.count<2:
        pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(646), [pid])
        return{'result':False,'message':Lg().g(262)}
    PlayerList=teaminfo.players.values()#角色实例列表
    typeid=teaminfo.type
    msgs={}#记录角色获得物品
    playeritem={}#记录角色获得物品信息 key:角色id,value:[{'id':5201,'count':2}]物品列表[物品id和物品数量]
    
        
    playerzf=teaminfo.getZfInfo()#角色阵法位置
    rs=getInfo(typeid)
    MosterList=rs.get('MosterList')#怪物实例列表
    mosterwz=rs.get('mosterwz')#怪物阵法位置
    ItemList=rs.get('ItemList')#物品实例列表
    zy=rs.get('zy')#资源id
    fightinfo=fight_new.DoGroupFight(PlayerList, playerzf, MosterList, mosterwz)
    
    if fightinfo.battleResult==1:
        pklist=teaminfo.players.keys()
        for pk in pklist:
            msgs[pk]=u''
            ItemList=teamInstanceDrop.getTeamDropListItemidCountByTypeid(typeid) #[{'id':5201,'count':2}]
            playeritem[pk]=ItemList
            for item in ItemList:
                itemTemplateId=item.get('id')
                iname=dbaccess.all_ItemTemplate[itemTemplateId]['name']#物品名称
                msgs[pk]=msgs[pk]+u'%s * %s\n'%(iname,item.get('count'))
                gm="player.pack.putNewItemsInPackage(%s,%s)"%(itemTemplateId,item.get('count'))
#                publicnoderemote.callRemote("updateplayerInfo",pk,gm)
    else:#战斗失败
        for pk in teaminfo.players.keys():
            msgs[pk]=Lg().g(143)
    
    for pk in teaminfo.players.keys():
        msg=msgs.get(pk)
        TeamFight().addfightcount(pk, typeid)
        
        pushObjectNetInterface.getzudui_4308(fightinfo, [pk], msg,zy)
    TeamFight().dismissTeam(teamid)
示例#17
0
def AramJiaJiXunLian(characterId,ptype,funId):
    '''加急训练'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.JiaJiXunLian(ptype,funId)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message',u''), [characterId])
        else:
            msg = u"获得%d经验"%(data.get('data',0))
            pushOtherMessageByCharacterId(msg, [characterId])
        return data
    return {'result':False,'message':Lg().g(18)}
示例#18
0
def DianShiChengJin(characterId):
    '''点石成金'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.dianshichengjin()
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message',u''), [characterId])
        else:
            msg = Lg().g(19)%(data.get('data',0))
            pushOtherMessageByCharacterId(msg, [characterId])
        return data
    return {'result':False,'message':Lg().g(18)}
示例#19
0
def DianShiChengJin(characterId):
    '''点石成金'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.dianshichengjin()
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message', u''),
                                          [characterId])
        else:
            msg = Lg().g(19) % (data.get('data', 0))
            pushOtherMessageByCharacterId(msg, [characterId])
        return data
    return {'result': False, 'message': Lg().g(18)}
示例#20
0
def AramJiaJiXunLian(characterId, ptype, funId):
    '''加急训练'''
    player = PlayersManager().getPlayerByID(characterId)
    if player:
        data = player.afk.JiaJiXunLian(ptype, funId)
        if not data.get('result'):
            pushOtherMessageByCharacterId(data.get('message', u''),
                                          [characterId])
        else:
            msg = u"获得%d经验" % (data.get('data', 0))
            pushOtherMessageByCharacterId(msg, [characterId])
        return data
    return {'result': False, 'message': Lg().g(18)}
示例#21
0
def StrengthenItem(characterid, itemid):
    '''强化装备
    @param characterid: int 角色id
    @param itemid: int 装备id
    '''

    item = None  #装备实例
    player = PlayersManager().getPlayerByID(characterid)  #角色实例
    if not player:
        return {'result': False, 'message': Lg().g(199), 'data': None}
    if player.pack._package._PropsPagePack.getPositionByItemId(
            itemid) != -1:  #背包中没有此物品
        item = player.pack._package._PropsPagePack.getItemInfoByItemid(itemid)
    else:
        item = player.pack._equipmentSlot.getItemInfoByItemid(itemid)
    if not item:
        return {'result': False, 'message': Lg().g(189), 'data': None}
    qlevel = item.attribute.getStrengthen()  #装备的强化等级
    plevel = player.level.getLevel()
    if qlevel >= plevel:
        pushObjectNetInterface.pushOtherMessageByCharacterId(
            Lg().g(198), [player.baseInfo.id])
        return {'result': False, 'message': Lg().g(198), 'data': None}


#    sim=player.qhtime.isdraw()
#    if not sim:
#        pushObjectNetInterface.pushOtherMessageByCharacterId(u'冷却时间不足', [player.baseInfo.id])
#        return {'result':False,'message':u'冷却时间不足','data':None}

    baseQuality = item.baseInfo.getItemTemplateInfo().get(
        "baseQuality", 0)  #基础品质 1灰 2白 3绿 4蓝 5紫 6橙 7红
    itemlevel = item.baseInfo.getItemTemplateInfo().get("levelRequire",
                                                        0)  #装备等级
    wqtype = item.getWQtype(
    )  #武器类型  #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}
    jinbi = coinCount(qlevel, baseQuality, wqtype, itemlevel)  #强化所需金币
    if player.finance.getCoin() >= jinbi:
        player.finance.updateCoin(player.finance.getCoin() - jinbi)
    else:
        return {'result': False, 'message': Lg().g(200), 'data': None}

    result = __StrengthenOne(player, item, qlevel, characterid)
    if result:
        return result
    return {'result': True, 'message': Lg().g(166), 'data': None}
示例#22
0
def runningSxzy(characterid, item1, item2):
    '''执行属性转移'''
    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 = None
    if player.pack._package._PropsPagePack.getPositionByItemId(
            item1) != -1:  #背包中没有此物品
        items1 = player.pack._package._PropsPagePack.getItemInfoByItemid(
            item1)  #获取物品实例
    else:
        items1 = player.pack._equipmentSlot.getItemInfoByItemid(item1)
    if not items1:
        return {'result': False, 'message': Lg().g(189), 'data': None}
    items2 = None
    if player.pack._package._PropsPagePack.getPositionByItemId(
            item2) != -1:  #背包中没有此物品
        items2 = player.pack._package._PropsPagePack.getItemInfoByItemid(
            item2)  #获取物品实例
    else:
        items2 = player.pack._equipmentSlot.getItemInfoByItemid(item2)
    if not items2:
        return {'result': False, 'message': Lg().g(189), 'data': None}
    Zcion = getSxzyCoin(items1, items2)  #转移花费金币
    if player.finance.getCoin() < Zcion:
        return {'result': False, 'message': Lg().g(88), 'data': None}
    level = Sxzy(items1, items2)  #转移获得等级

    zyyh = level + items2.attribute.getStrengthen()  #转移以后装备的强化等级
    if player.level.getLevel() < zyyh:
        pushObjectNetInterface.pushOtherMessage(905,
                                                Lg().g(207) % zyyh,
                                                [player.getDynamicId()])
        return {'result': False, 'message': Lg().g(207) % zyyh, 'data': None}
    items1.attribute.updateStrengthen(0)
    if level != 0:
        items2.attribute.updateStrengthen(items2.attribute.getStrengthen() +
                                          level)
    player.finance.updateCoin(player.finance.getCoin() - Zcion)
    player.quest.specialTaskHandle(112)  #特殊任务处理
    player.schedule.noticeSchedule(5, goal=1)
    return {'result': True, 'message': Lg().g(166), 'data': None}
 def doMeditationBound(self,state):
     '''进行挂机经验奖励的处理
     '''
     exppercent = 1
     if state:
         exppercent = 1.1
     timedd = datetime.datetime.now() - self.meditationtime
     timesecond = timedd.days*86400 + timedd.seconds
     goaltime = 32400 if self._owner.baseInfo._viptype==0 else 86400
     if timesecond>=goaltime:
         self.stopMeditation()
         return
     level = self._owner.level.getLevel()
     expbound = int(level*1.0/10*level*exppercent)
     self.goalexp += expbound
     self._owner.level.addExp(expbound)
     msg = u"+%d%s"%(expbound,Lg().g(499))
     pushOtherMessageByCharacterId(msg, [self._owner.baseInfo.id])
     self.guajitimer = reactor.callLater(15,self.doMeditationBound,state)
示例#24
0
def Saodang(characterId,fubenId,sdType,sdRound):
    '''扫荡
    @param characterId: int 角色的ID
    @param fubenId: int 副本的ID
    @param sdType: int 扫荡类型
    @param sdRound: int 扫荡回合数
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result':False,'messge':Lg().g(18)}
    if sdType == 0:
        rounds = 0
    else:
        rounds = sdRound
    result = player.raids.doRaids(rounds,fubenId)
    msg = result.get('message',u'')
    if msg:
        pushOtherMessageByCharacterId(msg, [characterId])
    return result
示例#25
0
def Saodang(characterId, fubenId, sdType, sdRound):
    '''扫荡
    @param characterId: int 角色的ID
    @param fubenId: int 副本的ID
    @param sdType: int 扫荡类型
    @param sdRound: int 扫荡回合数
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result': False, 'messge': Lg().g(18)}
    if sdType == 0:
        rounds = 0
    else:
        rounds = sdRound
    result = player.raids.doRaids(rounds, fubenId)
    msg = result.get('message', u'')
    if msg:
        pushOtherMessageByCharacterId(msg, [characterId])
    return result
示例#26
0
def StrengthenItem(characterid,itemid):
    '''强化装备
    @param characterid: int 角色id
    @param itemid: int 装备id
    '''
    
    item=None #装备实例
    player=PlayersManager().getPlayerByID(characterid) #角色实例
    if not player:
        return {'result':False,'message':Lg().g(199),'data':None}
    if player.pack._package._PropsPagePack.getPositionByItemId(itemid)!=-1:#背包中没有此物品
        item=player.pack._package._PropsPagePack.getItemInfoByItemid(itemid)
    else:
        item=player.pack._equipmentSlot.getItemInfoByItemid(itemid)
    if not item:
        return {'result':False,'message':Lg().g(189),'data':None}
    qlevel=item.attribute.getStrengthen() #装备的强化等级
    plevel=player.level.getLevel()
    if qlevel>=plevel:
        pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(198), [player.baseInfo.id])
        return {'result':False,'message':Lg().g(198),'data':None}
#    sim=player.qhtime.isdraw()
#    if not sim:
#        pushObjectNetInterface.pushOtherMessageByCharacterId(u'冷却时间不足', [player.baseInfo.id])
#        return {'result':False,'message':u'冷却时间不足','data':None}
    
    baseQuality=item.baseInfo.getItemTemplateInfo().get("baseQuality",0)#基础品质 1灰 2白 3绿 4蓝 5紫 6橙 7红
    itemlevel=item.baseInfo.getItemTemplateInfo().get("levelRequire",0) #装备等级
    wqtype=item.getWQtype()#武器类型  #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}
    jinbi= coinCount(qlevel,baseQuality,wqtype,itemlevel)#强化所需金币
    if player.finance.getCoin()>=jinbi:
        player.finance.updateCoin(player.finance.getCoin()-jinbi)
    else:
        return {'result':False,'message':Lg().g(200),'data':None}
    
    result=__StrengthenOne(player,item,qlevel,characterid)    
    if result:
        return result
    return {'result':True,'message':Lg().g(166),'data':None}
示例#27
0
 def CreateTeam(self,player,typeid,wz):
     '''创建队伍
     @param player: obj 角色实例 
     @param typeid: int 副本类型
     @param wz: int 角色所在阵法的位置
     '''
     if not configure.isteamInstanceTime(player.level.getLevel()):
         return 0
     pid=player.baseInfo.getId()#队长id
     if not self.iscsxz(pid, typeid):
         pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(645), [pid])
         return 0            
     self.tag+=1
     pid=player.baseInfo.getId()#队长id
     if self.pi.has_key(pid):
         return 0
     self.info[self.tag]=TeamInfo(self.tag,player,typeid,wz)#组队挑战副本类
     self.pi[pid]=self.tag#记录角色所在队伍id
     self.addCXpi(pid)
     return self.tag
示例#28
0
def runningSxzy(characterid,item1,item2):
    '''执行属性转移'''
    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=None
    if player.pack._package._PropsPagePack.getPositionByItemId(item1)!=-1:#背包中没有此物品
        items1=player.pack._package._PropsPagePack.getItemInfoByItemid(item1)#获取物品实例
    else:
        items1=player.pack._equipmentSlot.getItemInfoByItemid(item1)
    if not items1:
        return {'result':False,'message':Lg().g(189),'data':None}
    items2=None
    if player.pack._package._PropsPagePack.getPositionByItemId(item2)!=-1:#背包中没有此物品
        items2=player.pack._package._PropsPagePack.getItemInfoByItemid(item2)#获取物品实例
    else:
        items2=player.pack._equipmentSlot.getItemInfoByItemid(item2)
    if not items2:
        return {'result':False,'message':Lg().g(189),'data':None}
    Zcion=getSxzyCoin(items1, items2)#转移花费金币
    if player.finance.getCoin()<Zcion:
        return {'result':False,'message':Lg().g(88),'data':None}
    level=Sxzy(items1, items2)#转移获得等级
    
    zyyh=level+items2.attribute.getStrengthen()#转移以后装备的强化等级
    if player.level.getLevel()<zyyh:
        pushObjectNetInterface.pushOtherMessage(905, Lg().g(207)%zyyh, [player.getDynamicId()])
        return {'result':False,'message':Lg().g(207)%zyyh,'data':None}
    items1.attribute.updateStrengthen(0)
    if level !=0:
        items2.attribute.updateStrengthen(items2.attribute.getStrengthen()+level)
    player.finance.updateCoin(player.finance.getCoin()-Zcion)
    player.quest.specialTaskHandle(112)#特殊任务处理
    player.schedule.noticeSchedule(5,goal = 1)
    return {'result':True,'message':Lg().g(166),'data':None}
示例#29
0
def qq(player, itemid, wqtype, baseQuality, jinbi, item):
    '''
    @param player: obj 角色实例
    @param itemid: int 物品id
    @param wqtype: int #装备类型id  1武器  2防具 3饰品  4强化石  0不是装备
    @param baseQuality: int 物品品质
    @param jinbi: int 需要花费多少金币
    @param item: obj 物品实例
    '''
    #    item=player.pack._package._PropsPagePack.getItemInfoByItemid(itemid)#物品id
    qlevel = item.attribute.getStrengthen()  #物品当前的强化等级
    #    baseprobability=int(qhslevel/(qlevel/2.0+baseQuality*qhslevel)*5.0)#成功率百分比 x%    #(强化石Lv/(装备强化Lv/2+装备品质*强化石Lv))*5
    if qlevel >= player.level.getLevel():
        pushObjectNetInterface.pushOtherMessageByCharacterId(
            Lg().g(198), [player.baseInfo.id])
        return {'result': False, 'message': Lg().g(198), 'data': None}
    if not player:
        return {'result': False, 'message': Lg().g(199), 'data': None}


#    flg=False#金币是否足够
#    playercoin=player.finance.getCoin()#角色的金币数量
#    if playercoin>=jinbi:
#        flg=True
    zyid = item.baseInfo.getItemProfession()  #职业类型限制 1战士 2 法师 3 游侠 4 牧师
    arraylist = configure.getAttributeByZyAndWqTypeid(
        zyid, wqtype, qlevel + 1, baseQuality)  #根据角色职业类型和装备类型获取增加的属性
    arraylist = arraylist[0]
    itemTemplateId = item.baseInfo.getItemTemplateId()
    data = {
        'syname': arraylist[0],
        'syvalue': arraylist[1],
        'coin': jinbi,
        'itemTemplateId': itemTemplateId,
        'qlevel': qlevel + 1
    }
    return {'result': True, 'message': Lg().g(166), 'data': data}
示例#30
0
 def TeamAddPlayer(self,player,tid,wz):
     '''角色加入队伍
     @param player: obj 角色实例
     @param tid: int 要加入队伍的id
     @param wz: int 阵法位置
     '''
     #队伍有变动后需要推送队伍信息给所有的成员
     if not configure.isteamInstanceTime(player.level.getLevel()):
         return {'result':False,'message':Lg().g(580),'tid':0}
     pid=player.baseInfo.getId()#角色id
     teid= self.pi.get(pid,None)#原始队伍id
     teaminfo=self.info.get(tid,None)#队伍信息
     if not teaminfo:#如果没有队伍信息
         pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(624), [pid])
         return {'result':False,'message':Lg().g(479),'tid':tid}
     typeid=teaminfo.type
     if not self.iscsxz(pid, typeid):
         pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(645), [pid])
         return {'result':False,'message':Lg().g(645),'tid':tid}
     
     if teaminfo.zf[wz]>0: 
         return{'result':False,'message':Lg().g(577),'tid':tid}
     if teaminfo.count>=5:
         return{'result':False,'message':Lg().g(578),'tid':tid}
     if teid:
         if tid==teid:
             return{'result':False,'message':Lg().g(579),'tid':tid}
         else:
             self.TeamDelPlayer(pid)#退出原始队伍
     teaminfo.addTeamPlayer(player, wz)
     plist=teaminfo.players.keys()#队伍成员id列表
     plist.remove(pid)
     pushObjectNetInterface.team4304(tid, plist)
     self.pi[pid]=tid
     self.addCXpi(pid)
     return {'result':True,'message':Lg().g(166),'tid':tid}
 def pushFightTMsg(self):
     """推送战后3秒信息"""
     msglist = self.popFightTMsg()
     for msg in msglist:
         pushOtherMessageByCharacterId(msg, [self._owner.baseInfo.id])
 def pushFightTMsg(self):
     '''推送战后3秒信息'''
     msglist = self.popFightTMsg()
     for msg in msglist:
         pushOtherMessageByCharacterId(msg, [self._owner.baseInfo.id])