def creatGuild(self,corpsName,camp):
     '''创建行会
     @param corpsName: 国的名称
     '''
     if self.getID():
         return {'result':False,'message':Lg().g(340)}
     surplushours = self.getCanJoinTime()
     if surplushours:
         return {'result':False,'message':Lg().g(647)%surplushours}
     if self._owner.finance.getCoin()<self.CREATECOIN:
         return {'result':False,'message':Lg().g(345)}
     if self._owner.level.getLevel()<12:
         return {'result':False,'message':Lg().g(346)}
     if self.id:
         return {'result':False,'message':Lg().g(347)}
     guildId = GuildManager().creatGuild(corpsName, self._owner.baseInfo.id,camp)
     if guildId == -1:
         return {'result':False,'message':Lg().g(348)}
     if guildId:
         self.updateID(guildId)
         chatnoderemote.callRemote('updateGuild',self._owner.baseInfo.id,guildId,1)#同步聊天角色中的行会
         self._owner.updatePlayerInfo()
         self._owner.quest.specialTaskHandle(ADDGUILDTASKTYPE)
         self._owner.finance.addCoin(-self.CREATECOIN)
         return {'result':True,'message':Lg().g(349)}
     return {'result':False,'message':Lg().g(350)}
Beispiel #2
0
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)
Beispiel #3
0
 def LevelUpEmblem(self, operator):
     '''升级军徽
     @param operator: int 操作者的id
     '''
     if self.MAXLEVEL <= self.get('emblemLevel'):
         return {'result': False, 'message': Lg().g(542)}
     player = PlayersManager().getPlayerByID(operator)
     self.emblemLevel += 1
     result = True
     if result:
         msg = Lg().g(543)%\
         (self.guildinfo['emblemLevel'])
         pushOtherMessage(905, msg, [player.getDynamicId()])
         if self.guildinfo['emblemLevel'] == 20:
             utype = {
                 1: Lg().g(544),
                 2: Lg().g(545)
             }.get(self.guildinfo['camp'],
                   Lg().g(546))
             palyername = player.baseInfo.getName(0)
             gname = self.getGuildName()
             sendmsg = Lg().g(547) % (utype, palyername, gname)
             chatnoderemote.callRemote('pushSystemToInfo', sendmsg)
         return {
             'result': True,
             'message': Lg().g(548) % (self.guildinfo['emblemLevel'])
         }
     return {'result': False, 'message': Lg().g(549)}
Beispiel #4
0
def pushPlayerGonggaoXinxi(player):
    '''推送角色上线公告的信息
    @param player: PlayerCharacter Object 角色的实例
    @param sendtype: int 发送方式  1聊天 2公告
    '''
    sendstr = ""
    playername = player.baseInfo.getName()
    strlist = []
    viptype = player.baseInfo.getType()
    sendtype = 1
    if 0<viptype<3:
        sendtype = 1
        strlist.append(Lg().g(604))
    elif viptype >= 3:
        sendtype = 2
        strlist.append(Lg().g(604)+u',')
    post = player.guild.getPost()
    guildId = player.guild.getID()
    guildname = player.guild.getGuildName()
    if post==4:
        citylist = ColonizeManage().getCityList()[::-1]
        for city in citylist:
            if city.get('gid',-1)==guildId:
                sendtype = 2
                cityname = city.get('cityname')
                strlist.append(Lg().g(605)%(guildname,cityname))
                continue
    if strlist:
        sendstr = sendstr.join(strlist)+ Lg().g(606)%(playername)
        if sendtype == 1:
            chatnoderemote.callRemote('pushSystemchat',sendstr)
        else:
            chatnoderemote.callRemote('pushSystemToInfo',sendstr)
Beispiel #5
0
def enterPlace_601(dynamicId, characterId, placeId,force,player):
    '''进入场景'''
    state = 0
    if not player:
        player = PlayerCharacter(characterId,dynamicId = dynamicId)
        player.setlastOnline(datetime.datetime.now())
        pushPlayerGonggaoXinxi(player)
    else:
        player = cPickle.loads(player)
        player.startAllTimer()
        state = 1
    #判断是否满足进入场景的需求
    sceneInfo = dbMap.ALL_MAP_INFO.get(placeId,{})
    levelRequired = sceneInfo['level']
    if player.level.getLevel()<sceneInfo['level']:
        msg = Lg().g(607)%levelRequired
        pushOtherMessage(905, msg, [dynamicId])
        return {'result':False,'message':Lg().g(332)}
    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)
    scene.pushEnterPlace([dynamicId])
#    if not state:
#        publicnoderemote.callRemote('addPcharacter',characterId,getNodeId())
#    else:
#        publicnoderemote.callRemote('updatePCharacterNodeId',characterId,getNodeId())
    return {'result':True,'message':'','data':{'placeId':placeId}}
 def pushSystem(self):
     '''推送系统公告'''
     from app.scense.serverconfig.chatnode import chatnoderemote
     msg = self.popsystemToInfo()
     if len(msg) > 0:
         for item in msg:
             #                chat.pushSystemToInfo(item)
             chatnoderemote.callRemote('pushSystemToInfo', item)
    def pushSystem(self):
        """推送系统公告"""
        from app.scense.serverconfig.chatnode import chatnoderemote

        msg = self.popsystemToInfo()
        if len(msg) > 0:
            for item in msg:
                #                chat.pushSystemToInfo(item)
                chatnoderemote.callRemote("pushSystemToInfo", item)
    def addFriend(self, characterId, playerId, friendType, pyid):
        '''添加一个好友或者黑名单
        @param characterId: int 角色的id
        @param friendType: int(1,2) 好友的类型 1:好友  2:黑名单
        @param playerId: int 好友或者黑名单角色id
        @param isSheildedMail: int 0不屏蔽邮件   1屏蔽邮件
        @param pyid: int 关系好友动态id -1表示没有  
        '''
        from app.scense.netInterface import pushObjectNetInterface
        from app.scense.serverconfig.chatnode import chatnoderemote
        if len(self.getFriends()) >= self._friendCount:
            return {'result': False, 'message': Lg().g(317)}
        if playerId == self._owner.baseInfo.id:
            return {'result': False, 'message': Lg().g(318)}

        if friendType == 1:  #添加好友
            chatnoderemote.callRemote('addWhitelist', characterId,
                                      playerId)  #添加到白名单(好友)
            if playerId in self.getEnermies():  #如果角色在黑名单中
                dbFriend.setType(characterId, playerId, friendType, 0)
                self._enermies.remove(playerId)
                self._friends.add(playerId)
                self._owner.daily.noticeDaily(15, 0, -1)
                return {'result': True, 'message': Lg().g(319)}
            elif playerId in self.getFriends():  #如果角色在好友中
                return {'result': False, 'message': Lg().g(320)}
            else:
                self._owner.daily.noticeDaily(15, 0, -1)
                dbaccess.addFriend(self._owner.baseInfo.id, playerId,
                                   friendType, 0)
                self._friends.add(playerId)
                if pyid >= 0:
                    pushObjectNetInterface.pushaddPlayerFriendto(
                        characterId, self._owner.baseInfo.getNickName(),
                        [pyid])  #推送反添加好友
                return {'result': True, 'message': Lg().g(321)}
        else:  #添加黑名单
            chatnoderemote.callRemote('addBacklist', characterId,
                                      playerId)  #添加到黑名单
            if playerId in self.getFriends():  #如果在好友列表中
                dbFriend.setType(characterId, playerId, friendType, 1)
                self._friends.remove(playerId)
                self._enermies.add(playerId)
                return {'result': True, 'message': Lg().g(322)}
            elif playerId in self.getEnermies():  #如果角色已经在黑名单中
                return {'result': False, 'message': Lg().g(323)}
            else:
                dbaccess.addFriend(self._owner.baseInfo.id, playerId,
                                   friendType, 1)
                self._enermies.add(playerId)
                return {'result': True, 'message': Lg().g(324)}
        return {
            'result': True,
            'message': Lg().g(69),
        }
Beispiel #9
0
    def runingQd(self, pid, gold):
        """祈祷逻辑
        @param gold: int 钻石数量
        """
        from app.scense.serverconfig.chatnode import chatnoderemote
        from app.scense.core.PlayersManager import PlayersManager

        v = {1: Lg().g(564), 2: Lg().g(499), 3: Lg().g(565), 4: Lg().g(566), 0: Lg().g(564)}
        player = PlayersManager().getPlayerByID(pid)
        mygold = player.finance.getGold()
        if mygold < gold:
            pushObjectNetInterface.pushOtherMessage(905, Lg().g(567), [player.getDynamicId()])
            return False
        result = configure.qd(gold)
        lx = result[0]  # 奖励类型    1金币奖励    2经验奖励   3声望奖励    4活力
        sl = result[1]  # 奖励数量
        bs = result[2]  # 奖励倍数
        if lx == 1:
            player.finance.addCoin(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        elif lx == 2:
            player.level.addExp(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        elif lx == 3:
            player.finance.addPrestige(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        elif lx == 4:
            player.attribute.addEnergy(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        else:
            player.finance.addCoin(sl)
        if bs > 1:
            ss += Lg().g(569) % bs
        pushObjectNetInterface.pushOtherMessage(905, ss, [player.getDynamicId()])
        #        player.finance.updateGold(mygold-gold)
        player.finance.consGold(gold, 1)

        bbs = 1  # 大于这个倍数的才会广播
        sj = time.strftime("%w%H")
        sj = int(sj)
        if sj >= 310 and sj <= 314:
            bbs = 2

        if bs > bbs:
            pname = player.baseInfo.getName()
            tm = time.strftime("%Y-%m-%d %X")
            mg = Lg().g(570) % (pname, bs, v.get(lx), sl)
            chatnoderemote.callRemote("pushSystemToInfo", mg)

            if len(self.getGG()) == 4:
                del self.gg[0]
            self.gg.append([tm, mg])
            self.uploadGG(self.gg)
        return True
 def updateLevel(self,level):
     '''更新角色当前等级
     @param level: int 等级
     '''
     from app.scense.serverconfig.chatnode import chatnoderemote
     self._level = level
     
     self._owner.quest.pushPlayerQuestProcessList()
     self._owner.daily.noticeDaily(1,0,level)#升级通知每日目标
     chatnoderemote.callRemote('updateCharteLevel',self._owner.baseInfo.id,level)#同步聊天角色中的等级
     dbaccess.updateCharacter(self._owner.baseInfo.id, 'level', level)
    def updateLevel(self, level):
        '''更新角色当前等级
        @param level: int 等级
        '''
        from app.scense.serverconfig.chatnode import chatnoderemote
        self._level = level

        self._owner.quest.pushPlayerQuestProcessList()
        self._owner.daily.noticeDaily(1, 0, level)  #升级通知每日目标
        chatnoderemote.callRemote('updateCharteLevel', self._owner.baseInfo.id,
                                  level)  #同步聊天角色中的等级
        dbaccess.updateCharacter(self._owner.baseInfo.id, 'level', level)
 def leaveGuild(self):
     '''离开国'''
     guild = GuildManager().getGuildById(self.id)
     gid=self.id
     if not guild:
         return {'result':False,'message':Lg().g(79)}
     data = guild.leaveGuild(self._owner.baseInfo.id)
     if data.get('result',False):
         self.updateID(0)
         self.setLeaveTime(datetime.datetime.now())
         chatnoderemote.callRemote('updateGuild',self._owner.baseInfo.id,gid,0)#同步聊天角色中的行会
         self._owner.updatePlayerInfo()
     return data
Beispiel #13
0
    def acceptGuildApply(self, operator, characterId):
        '''同意角色的入会申请
        @param operator: 操作者的id
        @param characterId: int 申请人的id
        '''
        president = self.get('president')
        veteranList = eval('[' + self.guildinfo['veterans'] + ']')
        staffList = eval('[' + self.guildinfo['staffOfficers'] + ']')
        senatorsList = eval('[' + self.guildinfo['senators'] + ']')
        #获取操作者的权限
        if operator == president:
            operatorpost = Lg().g(520)
        elif operator in veteranList:
            operatorpost = Lg().g(519)
        elif operator in staffList:
            operatorpost = Lg().g(518)
        elif operator in senatorsList:
            operatorpost = Lg().g(517)

        managementGroup = veteranList + staffList + senatorsList

        if not dbGuild.checkHasApply(self.id, characterId):
            return -4
        if operator != self.president and operator not in managementGroup:
            return -1  #权限不够
        if dbGuild.checkCharacterHasGuild(characterId):
            return -2  #已经加入了行会
        curMenberNum = dbGuild.countGuildMenberNum(self.id)
        info = self.guildinfo
        maxMemberCount = 20 + ((info['emblemLevel'] - 1) * 30)
        if curMenberNum >= maxMemberCount:
            return -3  #成员数量达到上限
        result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
        dbGuild.delCharacterAllApply(characterId)
        if result:
            player = PlayersManager().getPlayerByID(operator)
            content = Lg().g(532)\
            %(self.guildinfo.get('name',''),operatorpost,\
                player.baseInfo.getNickName(),self.guildinfo.get('name',''))
            title = Lg().g(526)
            m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
                            sender = Lg().g(128),content=content)
            m.mailIntoDB()
            player = PlayersManager().getPlayerByID(characterId)
            if player:
                player.guild.updateID(self.id)
                chatnoderemote.callRemote('updateGuild', characterId, self.id,
                                          1)  #同步聊天角色中的行会
                player.updatePlayerInfo()
            return 1  #同意申请成功
        return 0  #同意申请失败
Beispiel #14
0
 def acceptGuildApply(self,operator,characterId):
     '''同意角色的入会申请
     @param operator: 操作者的id
     @param characterId: int 申请人的id
     '''
     president = self.get('president')
     veteranList = eval('['+self.guildinfo['veterans']+']')
     staffList = eval('['+self.guildinfo['staffOfficers']+']')
     senatorsList = eval('['+self.guildinfo['senators']+']')
     #获取操作者的权限
     if operator==president:
         operatorpost =Lg().g(520)
     elif operator in veteranList:
         operatorpost = Lg().g(519)
     elif operator in staffList:
         operatorpost = Lg().g(518)
     elif operator in senatorsList:
         operatorpost = Lg().g(517)
     
     managementGroup = veteranList + staffList + senatorsList
     
     if not dbGuild.checkHasApply(self.id, characterId):
         return -4
     if operator!=self.president and operator not in managementGroup:
         return -1#权限不够
     if dbGuild.checkCharacterHasGuild(characterId):
         return -2#已经加入了行会
     curMenberNum = dbGuild.countGuildMenberNum(self.id)
     info = self.guildinfo
     maxMemberCount = 20 + ((info['emblemLevel']-1)*30)
     if curMenberNum>=maxMemberCount:
         return -3#成员数量达到上限
     result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
     dbGuild.delCharacterAllApply(characterId)
     if result:
         player = PlayersManager().getPlayerByID(operator)
         content = Lg().g(532)\
         %(self.guildinfo.get('name',''),operatorpost,\
             player.baseInfo.getNickName(),self.guildinfo.get('name',''))
         title = Lg().g(526)
         m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
                         sender = Lg().g(128),content=content)
         m.mailIntoDB()
         player = PlayersManager().getPlayerByID(characterId)
         if player:
             player.guild.updateID(self.id)
             chatnoderemote.callRemote('updateGuild',characterId,self.id,1)#同步聊天角色中的行会
             player.updatePlayerInfo()
         return 1#同意申请成功
     return 0#同意申请失败
Beispiel #15
0
 def pushGuildLevelUp(self,level):
     '''推送国升级的消息'''
     memberList = dbGuild.getGuildMemberIdList(self.id)
     sendlist = []
     for memberId in memberList:
         player = PlayersManager().getPlayerByID(memberId)
         if player:
             sendlist.append(player.getDynamicId())
     pushGuildLevelUpMessage(level, sendlist)
     if level==20:
         utype = {1:Lg().g(544),2:Lg().g(545)}.get(self.guildinfo['camp'],Lg().g(546))
         gname = self.getGuildName()
         msg = Lg().g(558)%(utype,gname)
         chatnoderemote.callRemote('pushSystemToInfo',msg)
Beispiel #16
0
def removePlayerFriend(dynamicId,characterId,friendId):
    '''删除好友
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param friendId: int 好友编号
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result':False,'message':Lg().g(18)}
    result = player.friend.deleteFriend(characterId,friendId) 
    if result:
        if result.get('result'):
            chatnoderemote.callRemote('dropfriend',characterId,friendId)#删除好友
            pushObjectNetInterface.pushOtherMessage(905, Lg().g(71), [player.getDynamicId()])
    return result
    def addFriend(self,characterId,playerId,friendType,pyid):
        '''添加一个好友或者黑名单
        @param characterId: int 角色的id
        @param friendType: int(1,2) 好友的类型 1:好友  2:黑名单
        @param playerId: int 好友或者黑名单角色id
        @param isSheildedMail: int 0不屏蔽邮件   1屏蔽邮件
        @param pyid: int 关系好友动态id -1表示没有  
        '''
        from app.scense.netInterface import pushObjectNetInterface
        from app.scense.serverconfig.chatnode import chatnoderemote
        if len(self.getFriends())>= self._friendCount:
            return {'result':False,'message':Lg().g(317)}
        if playerId ==self._owner.baseInfo.id:
            return {'result':False,'message':Lg().g(318)}

        if friendType==1:#添加好友
            chatnoderemote.callRemote('addWhitelist',characterId,playerId)#添加到白名单(好友)
            if playerId in self.getEnermies():#如果角色在黑名单中
                dbFriend.setType(characterId, playerId, friendType,0)
                self._enermies.remove(playerId)
                self._friends.add(playerId)
                self._owner.daily.noticeDaily(15,0,-1)
                return {'result':True,'message':Lg().g(319)}
            elif playerId in self.getFriends():#如果角色在好友中
                return {'result':False,'message':Lg().g(320)}
            else:
                self._owner.daily.noticeDaily(15,0,-1)
                dbaccess.addFriend(self._owner.baseInfo.id, playerId, friendType, 0)
                self._friends.add(playerId)
                if pyid>=0:
                    pushObjectNetInterface.pushaddPlayerFriendto(characterId, self._owner.baseInfo.getNickName(), [pyid])#推送反添加好友
                return {'result':True,'message':Lg().g(321)}
        else:#添加黑名单
            chatnoderemote.callRemote('addBacklist',characterId,playerId)#添加到黑名单
            if playerId in self.getFriends():#如果在好友列表中
                dbFriend.setType(characterId, playerId, friendType,1)
                self._friends.remove(playerId)
                self._enermies.add(playerId)
                return {'result':True,'message':Lg().g(322)}
            elif playerId in self.getEnermies():#如果角色已经在黑名单中
                return {'result':False,'message':Lg().g(323)}
            else:
                dbaccess.addFriend(self._owner.baseInfo.id, playerId, friendType, 1)
                self._enermies.add(playerId)
                return {'result':True,'message':Lg().g(324)}
        return {'result':True,'message':Lg().g(69),}
Beispiel #18
0
 def pushGuildLevelUp(self, level):
     '''推送国升级的消息'''
     memberList = dbGuild.getGuildMemberIdList(self.id)
     sendlist = []
     for memberId in memberList:
         player = PlayersManager().getPlayerByID(memberId)
         if player:
             sendlist.append(player.getDynamicId())
     pushGuildLevelUpMessage(level, sendlist)
     if level == 20:
         utype = {
             1: Lg().g(544),
             2: Lg().g(545)
         }.get(self.guildinfo['camp'],
               Lg().g(546))
         gname = self.getGuildName()
         msg = Lg().g(558) % (utype, gname)
         chatnoderemote.callRemote('pushSystemToInfo', msg)
Beispiel #19
0
def pushStrengthenSys(player, item, result):
    '''推送强化的系统消息
    @param player: PlayerCharacter
    '''
    strenlevel = item.attribute.getStrengthen()
    if strenlevel % 10 != 0 and strenlevel != 0:
        return
    UnionTypeStr = player.guild.getUnionTypeStr()
    palyername = player.baseInfo.getName()
    imterichname = item.baseInfo.getRichName()
    strenlevel = item.attribute.getStrengthen()
    if result:
        msg = Lg().g(203) % (UnionTypeStr, palyername, imterichname,
                             strenlevel)
    else:
        msg = Lg().g(204) % (UnionTypeStr, palyername, imterichname,
                             strenlevel)
    chatnoderemote.callRemote('pushSystemToInfo', msg)
Beispiel #20
0
def removePlayerFriend(dynamicId, characterId, friendId):
    '''删除好友
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param friendId: int 好友编号
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result': False, 'message': Lg().g(18)}
    result = player.friend.deleteFriend(characterId, friendId)
    if result:
        if result.get('result'):
            chatnoderemote.callRemote('dropfriend', characterId,
                                      friendId)  #删除好友
            pushObjectNetInterface.pushOtherMessage(905,
                                                    Lg().g(71),
                                                    [player.getDynamicId()])
    return result
Beispiel #21
0
 def JointGuild(self,characterId):
     '''将角色加入国'''
     curMenberNum = dbGuild.countGuildMenberNum(self.id)
     info = self.guildinfo
     maxMemberCount = 20 + ((info['emblemLevel']-1)*30)
     if curMenberNum>=maxMemberCount:
         return {'result':False,'message':Lg().g(83)}
     result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
     dbGuild.delCharacterAllApply(characterId)
     if result:
         player = PlayersManager().getPlayerByID(characterId)
         if player:
             player.quest.specialTaskHandle(ADDGUILDTASKTYPE)
             player.guild.updateID(self.id)
             chatnoderemote.callRemote('updateGuild',characterId,self.id,1)#同步聊天角色中的行会
             player.updatePlayerInfo()
         return {'result':True,'message':Lg().g(530)}#同意申请成功
     return {'result':True,'message':Lg().g(531)}#同意申请失败
Beispiel #22
0
def pushStrengthenSys(player,item,result):
    '''推送强化的系统消息
    @param player: PlayerCharacter
    '''
    strenlevel = item.attribute.getStrengthen()
    if strenlevel%10!=0 and strenlevel !=0:
        return
    UnionTypeStr = player.guild.getUnionTypeStr()
    palyername = player.baseInfo.getName()
    imterichname = item.baseInfo.getRichName()
    strenlevel = item.attribute.getStrengthen()
    if result:
        msg = Lg().g(203)%(UnionTypeStr,
                                         palyername,imterichname,strenlevel)
    else:
        msg = Lg().g(204)%(UnionTypeStr,
                                         palyername,imterichname,strenlevel)
    chatnoderemote.callRemote('pushSystemToInfo',msg)
Beispiel #23
0
 def pushJipinInfo(self, player, dropItem):
     '''推送获取极品物品的消息'''
     itemlist = [20030049, 20030050, 20030062, 20030064]
     tempid = dropItem.baseInfo.getItemTemplateId()
     quality = dropItem.baseInfo.getBaseQuality()
     if tempid not in itemlist or quality < 6:
         return
     UnionTypeStr = player.guild.getUnionTypeStr() + Lg().g(129)
     palyername = player.baseInfo.getName()
     hardinfo = {
         1: Lg().g(281),
         2: Lg().g(282),
         3: Lg().g(283)
     }.get(self._owner._hard)
     instansname = self._owner._name + "-" + hardinfo
     itemrichname = dropItem.baseInfo.getRichName()
     msg = Lg().g(284) % (UnionTypeStr, palyername, instansname,
                          itemrichname)
     chatnoderemote.callRemote('pushSystemToInfo', msg)
Beispiel #24
0
 def JointGuild(self, characterId):
     '''将角色加入国'''
     curMenberNum = dbGuild.countGuildMenberNum(self.id)
     info = self.guildinfo
     maxMemberCount = 20 + ((info['emblemLevel'] - 1) * 30)
     if curMenberNum >= maxMemberCount:
         return {'result': False, 'message': Lg().g(83)}
     result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
     dbGuild.delCharacterAllApply(characterId)
     if result:
         player = PlayersManager().getPlayerByID(characterId)
         if player:
             player.quest.specialTaskHandle(ADDGUILDTASKTYPE)
             player.guild.updateID(self.id)
             chatnoderemote.callRemote('updateGuild', characterId, self.id,
                                       1)  #同步聊天角色中的行会
             player.updatePlayerInfo()
         return {'result': True, 'message': Lg().g(530)}  #同意申请成功
     return {'result': True, 'message': Lg().g(531)}  #同意申请失败
Beispiel #25
0
    def ClearingFight(self):
        '''国战战后结算
        '''
        from app.scense.core.guild.GuildManager import GuildManager
        info = {}
        info['applyTime'] = str(datetime.datetime.now())
        if not self.siege:
            info['kimori'] = self.kimori
            winner = info['kimori']
            Loser = 0
        else:
            #守城方的分数大于攻城方的分数
            if self.kimoriScore > self.siegeScore:
                info['kimori'] = self.kimori
                winner = info['kimori']
                Loser = self.siege
            else:
                self.kimori = self.siege
                info['kimori'] = self.siege
                winner = info['kimori']
                Loser = self.kimori
        self.kimoriScore = 0
        self.siegeScore = 0
        self.isOccupied = 1
        info['kimoriScore'] = 0
        info['siegeScore'] = 0
        info['siege'] = 0
        info['isOccupied'] = 1
        self.addFightlog(info['kimori'], 2)
        guild1 = GuildManager().getGuildById(winner)
        guild2 = GuildManager().getGuildById(Loser)
        if guild1:
            guild1.addExp(3500)
            msg = u"%s国成功征战%s,成为其国领地!" % (guild1.get('name'), self.name)
            chatnoderemote.callRemote('pushSystemToInfo', msg)
        if guild2:
            guild1.addExp(1500)

        dbfortress.updateFortressInfo(self.id, {
            'kimori': info['kimori'],
            'isOccupied': 1,
            'siege': 0
        })
Beispiel #26
0
 def ClearingFight(self):
     '''国战战后结算
     '''
     from app.scense.core.guild.GuildManager import GuildManager
     info = {}
     info['applyTime']=str(datetime.datetime.now())
     if not self.siege:
         info['kimori']=self.kimori
         winner = info['kimori']
         Loser = 0
     else:
         #守城方的分数大于攻城方的分数
         if self.kimoriScore>self.siegeScore:
             info['kimori']=self.kimori
             winner = info['kimori']
             Loser = self.siege
         else:
             self.kimori = self.siege
             info['kimori']=self.siege
             winner = info['kimori']
             Loser = self.kimori
     self.kimoriScore = 0
     self.siegeScore = 0
     self.isOccupied = 1
     info['kimoriScore'] = 0
     info['siegeScore'] = 0
     info['siege'] = 0
     info['isOccupied'] = 1
     self.addFightlog(info['kimori'], 2)
     guild1 = GuildManager().getGuildById(winner)
     guild2 = GuildManager().getGuildById(Loser)
     if guild1:
         guild1.addExp(3500)
         msg = u"%s国成功征战%s,成为其国领地!"%(guild1.get('name'),self.name)
         chatnoderemote.callRemote('pushSystemToInfo',msg)
     if guild2:
         guild1.addExp(1500)
     
     dbfortress.updateFortressInfo(self.id, {'kimori':info['kimori'],
                                             'isOccupied':1,'siege':0})
Beispiel #27
0
 def LevelUpEmblem(self,operator):
     '''升级军徽
     @param operator: int 操作者的id
     '''
     if self.MAXLEVEL <= self.get('emblemLevel'):
         return {'result':False,'message':Lg().g(542)}
     player = PlayersManager().getPlayerByID(operator)
     self.emblemLevel+=1
     result = True
     if result:
         msg = Lg().g(543)%\
         (self.guildinfo['emblemLevel'])
         pushOtherMessage(905,msg,[player.getDynamicId()])
         if self.guildinfo['emblemLevel']==20:
             utype = {1:Lg().g(544),2:Lg().g(545)}.get(self.guildinfo['camp'],Lg().g(546))
             palyername = player.baseInfo.getName(0)
             gname = self.getGuildName()
             sendmsg = Lg().g(547)%(utype,
                                         palyername,gname)
             chatnoderemote.callRemote('pushSystemToInfo',sendmsg)
         return {'result':True,'message':Lg().g(548)%(self.guildinfo['emblemLevel'])}
     return {'result':False,'message':Lg().g(549)}
def enterInstance1(player,dynamicId,characterId,instanceId,famId):
    '''进入副本 
    @param dynamicId: int  角色动态Id
    @param characterId: int 角色Id
    @param instanceId: int 副本Id
    '''

    player=PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result':False,'message':Lg().g(18)}
    if player.baseInfo.getState==1: #角色在副本中
        return  {'result':False,'message':Lg().g(114)}
    player.startAllTimer()
    Instan1= InstanceManager().addInstance(instanceId,famId) #把副本添加到副本管理器中,返回副本管理器中的这个副本实例
    scenename = Instan1._name
    chatnoderemote.callRemote('JoinRoom',characterId,famId,scenename)
#    Instan1.setTag(famId)
    if not Instan1:
        return {'result':False,'message':u'没有id为%d的副本'%instanceId}
    activationInstance(Instan1, player) #激活副本
    enterplay(player,instanceId,Instan1) #角色进入副本操作
    data = {'placeId':Instan1.getSceneResourceidByid(Instan1._inSceneid)}
    player.baseInfo.setInstanceid(instanceId)
    return {'result':True,'message':u'进入副本成功','data':data} #返回副本初始Id
Beispiel #29
0
    def runingQd(self, pid, gold):
        '''祈祷逻辑
        @param gold: int 钻石数量
        '''
        from app.scense.serverconfig.chatnode import chatnoderemote
        from app.scense.core.PlayersManager import PlayersManager
        v = {
            1: Lg().g(564),
            2: Lg().g(499),
            3: Lg().g(565),
            4: Lg().g(566),
            0: Lg().g(564)
        }
        player = PlayersManager().getPlayerByID(pid)
        mygold = player.finance.getGold()
        if mygold < gold:
            pushObjectNetInterface.pushOtherMessage(905,
                                                    Lg().g(567),
                                                    [player.getDynamicId()])
            return False
        result = configure.qd(gold)
        lx = result[0]  #奖励类型    1金币奖励    2经验奖励   3声望奖励    4活力
        sl = result[1]  #奖励数量
        bs = result[2]  #奖励倍数
        if lx == 1:
            player.finance.addCoin(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        elif lx == 2:
            player.level.addExp(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        elif lx == 3:
            player.finance.addPrestige(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        elif lx == 4:
            player.attribute.addEnergy(sl)
            ss = Lg().g(568) % (v.get(lx), sl)
        else:
            player.finance.addCoin(sl)
        if bs > 1:
            ss += Lg().g(569) % bs
        pushObjectNetInterface.pushOtherMessage(905, ss,
                                                [player.getDynamicId()])
        #        player.finance.updateGold(mygold-gold)
        player.finance.consGold(gold, 1)

        bbs = 1  #大于这个倍数的才会广播
        sj = time.strftime("%w%H")
        sj = int(sj)
        if sj >= 310 and sj <= 314:
            bbs = 2

        if bs > bbs:
            pname = player.baseInfo.getName()
            tm = time.strftime("%Y-%m-%d %X")
            mg = Lg().g(570) % (pname, bs, v.get(lx), sl)
            chatnoderemote.callRemote('pushSystemToInfo', mg)

            if len(self.getGG()) == 4:
                del self.gg[0]
            self.gg.append([tm, mg])
            self.uploadGG(self.gg)
        return True
Beispiel #30
0
 def fireMember(self,operator,memberId):
     '''开除行会成员
     @param operator: 操作者的id
     @param memberID: int 成员的id 角色id
     '''
     from app.scense.core.instance.ColonizeManage import ColonizeManage
     president = self.getPresident()
     veteranList = eval('['+self.guildinfo['veterans']+']')
     staffList = eval('['+self.guildinfo['staffOfficers']+']')
     senatorsList = eval('['+self.guildinfo['senators']+']')
     #获取操作者的权限
     if operator==president:
         operatorpost =4
     elif operator in veteranList:
         operatorpost = 3
     elif operator in staffList:
         operatorpost = 2
     elif operator in senatorsList:
         operatorpost = 1
     else:
         operatorpost = 0
     #获取被操作者的权限
     if memberId==president:
         memberpost =4
     elif memberId in veteranList:
         memberpost = 3
     elif memberId in staffList:
         memberpost = 2
     elif memberId in senatorsList:
         memberpost = 1
     else:
         memberpost = 0
         
     if operator ==memberId:
         return {'result':False,'message':Lg().g(523)}#权限不够
     if operatorpost<= memberpost:
         return {'result':False,'message':Lg().g(515)}#权限不够
     if not dbGuild.checkCharacterInGuild(memberId, self.id):
         return {'result':False,'message':Lg().g(524)}
     result = dbGuild.deleteCharacterGuildRelation(memberId)
     if result:
         postdict = dbGuild.updateGuildPost(self.id)
         self.veterans=postdict.veterans
         self.staffOfficers=postdict.staffOfficers
         self.senators=postdict.senators
         content = Lg().g(525)%(self.guildinfo.get('nickname',''),\
                                   self.guildinfo.get('name',''))
         title = Lg().g(526)
         m = Mail( title=title,type =0, senderId =-1, receiverId=memberId,\
                         sender = Lg().g(128),content=content)
         m.mailIntoDB()
         player = PlayersManager().getPlayerByID(memberId)
         if player:
             player.guild.updateID(0)
             chatnoderemote.callRemote('updateGuild',memberId,self.id,0)#同步聊天角色中的行会
             playerList = dbGuild.getGuildCharacterIdList(self.id)
             msg = Lg().g(527)%(player.baseInfo.getName(),self.getGuildName())
             sendList = [PlayersManager().getPlayerByID(p[0]).getDynamicId()\
                      for p in playerList \
                     if PlayersManager().getPlayerByID(p[0]) and \
                     PlayersManager().getPlayerByID(p[0]).getDynamicId()]
             pushPromptedMessage(msg, sendList)
             player.updatePlayerInfo()
         ColonizeManage().updateGuild(memberId, 0, u'')
         return {'result':True,'message':Lg().g(528)}#开除成功
     return {'result':False,'message':Lg().g(529)}#开除失败
Beispiel #31
0
    def fireMember(self, operator, memberId):
        '''开除行会成员
        @param operator: 操作者的id
        @param memberID: int 成员的id 角色id
        '''
        from app.scense.core.instance.ColonizeManage import ColonizeManage
        president = self.getPresident()
        veteranList = eval('[' + self.guildinfo['veterans'] + ']')
        staffList = eval('[' + self.guildinfo['staffOfficers'] + ']')
        senatorsList = eval('[' + self.guildinfo['senators'] + ']')
        #获取操作者的权限
        if operator == president:
            operatorpost = 4
        elif operator in veteranList:
            operatorpost = 3
        elif operator in staffList:
            operatorpost = 2
        elif operator in senatorsList:
            operatorpost = 1
        else:
            operatorpost = 0
        #获取被操作者的权限
        if memberId == president:
            memberpost = 4
        elif memberId in veteranList:
            memberpost = 3
        elif memberId in staffList:
            memberpost = 2
        elif memberId in senatorsList:
            memberpost = 1
        else:
            memberpost = 0

        if operator == memberId:
            return {'result': False, 'message': Lg().g(523)}  #权限不够
        if operatorpost <= memberpost:
            return {'result': False, 'message': Lg().g(515)}  #权限不够
        if not dbGuild.checkCharacterInGuild(memberId, self.id):
            return {'result': False, 'message': Lg().g(524)}
        result = dbGuild.deleteCharacterGuildRelation(memberId)
        if result:
            postdict = dbGuild.updateGuildPost(self.id)
            self.veterans = postdict.veterans
            self.staffOfficers = postdict.staffOfficers
            self.senators = postdict.senators
            content = Lg().g(525)%(self.guildinfo.get('nickname',''),\
                                      self.guildinfo.get('name',''))
            title = Lg().g(526)
            m = Mail( title=title,type =0, senderId =-1, receiverId=memberId,\
                            sender = Lg().g(128),content=content)
            m.mailIntoDB()
            player = PlayersManager().getPlayerByID(memberId)
            if player:
                player.guild.updateID(0)
                chatnoderemote.callRemote('updateGuild', memberId, self.id,
                                          0)  #同步聊天角色中的行会
                playerList = dbGuild.getGuildCharacterIdList(self.id)
                msg = Lg().g(527) % (player.baseInfo.getName(),
                                     self.getGuildName())
                sendList = [PlayersManager().getPlayerByID(p[0]).getDynamicId()\
                         for p in playerList \
                        if PlayersManager().getPlayerByID(p[0]) and \
                        PlayersManager().getPlayerByID(p[0]).getDynamicId()]
                pushPromptedMessage(msg, sendList)
                player.updatePlayerInfo()
            ColonizeManage().updateGuild(memberId, 0, u'')
            return {'result': True, 'message': Lg().g(528)}  #开除成功
        return {'result': False, 'message': Lg().g(529)}  #开除失败