Exemplo n.º 1
0
def AcceptOrRefuseApply(dynamicId,characterId,operType,appliId ):
    '''拒绝或同意申请
    @param dynamicId: int 客户端的动态id
    @param characterId: int 客户端的动态id
    @param operType: int 操作类型 0 接受 1 拒绝
    @param appliId: 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)
    if operType==0:
        data = guild.acceptGuildApply(characterId,appliId)
        reason = {0:Lg().g(80),-1:Lg().g(81),-2:Lg().g(82),\
                  -3:Lg().g(83),-4:Lg().g(84)}
        if data ==1:
            
            result = {'result':True,'message':Lg().g(85)}
        else:
            result = {'result':False,'message':reason[data]}
    else:
        data = guild.refuseGuildApply(characterId,appliId)
        reason = {0:Lg().g(80),-1:Lg().g(81),-4:Lg().g(84)}
        if data ==1:
            result = {'result':True,'message':Lg().g(85)}
        else:
            result = {'result':False,'message':reason[data]}
    return result
Exemplo n.º 2
0
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}
Exemplo n.º 3
0
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
 def AcceptOrRefuseApply(self,operType,appliId):
     '''拒绝或同意申请
     @param operType: int 操作类型 0 接受 1 拒绝
     @param appliId: int 申请ID
     '''
     guild = GuildManager().getGuildById(self.id)
     if not guild:
         return {'result':False,'message':Lg().g(339)}
     post = self.getPost()
     if post ==0:
         return {'result':False,'message':Lg().g(81)}
     if operType==0:
         data = guild.acceptGuildApply(self._owner.baseInfo.id,appliId)
         reason = {0:Lg().g(80),-1:Lg().g(81),-2:Lg().g(82),\
                   -3:Lg().g(83),-4:Lg().g(84)}
         if data ==1:
             result = {'result':True,'message':Lg().g(85)}
         else:
             result = {'result':False,'message':reason[data]}
     else:
         data = guild.refuseGuildApply(self._owner.baseInfo.id,appliId)
         reason = {0:Lg().g(80),-1:Lg().g(81),-4:Lg().g(84)}
         if data ==1:
             result = {'result':True,'message':Lg().g(85)}
         else:
             result = {'result':False,'message':reason[data]}
     return result
 def getGuildAttrExt(self):
     '''获取国苏醒的加成'''
     info = {}
     guild = GuildManager().getGuildById(self.id)
     if guild:
         info = guild.getGuildAttrExt()
     return info
 def addGuildExp(self,exp):
     '''添加国经验'''
     guild = GuildManager().getGuildById(self.id)
     if guild:
         result = guild.addExp(exp)
         if result:
             self.addContribution(exp)
     else:
         raise Exception(Lg().g(339))
Exemplo n.º 7
0
def ChangeUnionColor(dynamicId,characterId,color):
    '''修改本国势力颜色'''
    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)
    return guild.changeColor(characterId,color)
Exemplo n.º 8
0
def GetSingleUnion(dynamicId,characterId,union_id):
    '''获取单个国的信息'''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    guild = GuildManager().getGuildById(union_id)
    if not guild:
        return {'result':False,'message':Lg().g(95)}
    guildInfo = guild.getGuildInfo(characterId)
    if not guildInfo:
        return {'result':False,'message':Lg().g(95)}
    return {'result':True,'data':guildInfo}
Exemplo n.º 9
0
 def getSceneGuildName(self):
     '''获取城镇占领国的名称
     '''
     from app.scense.core.campaign.FortressManager import FortressManager
     from app.scense.core.guild.GuildManager import GuildManager
     f = FortressManager().getFortressBySceneId(self._id)
     if not f.isOccupied:
         return ''
     if not f.kimori:
         return ''
     guildId = f.kimori
     guild = GuildManager().getGuildById(guildId)
     return guild.get('name')
 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
Exemplo n.º 11
0
def TakeCorpsChief(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)
    data = guild.takeCorpsChief(characterId)
    return data
Exemplo n.º 12
0
def GetCorpsTechnologyListInfo(dynamicId,characterId,curPage):
    '''获取行会科技列表信息
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param curPage: int 当前页数
    '''
    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)
    data = guild.getTechnologyList(characterId,curPage)
    return {'result':True,'data':data}
Exemplo n.º 13
0
def GetCorpsAppliListInfo(dynamicId,characterId,searchCriteria,curPage):
    '''获取行会申请列表
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    '''
    if curPage<1:
        return {'result':False,'message':Lg().g(90)}
    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)
    data = guild.searchApplyJoinGuildInfo(searchCriteria,curPage)
    return {'result':True,'data':data}
Exemplo n.º 14
0
def GetCorpsAppliListInfo(dynamicId, characterId, searchCriteria, curPage):
    '''获取行会申请列表
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    '''
    if curPage < 1:
        return {'result': False, 'message': Lg().g(90)}
    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)
    data = guild.searchApplyJoinGuildInfo(searchCriteria, curPage)
    return {'result': True, 'data': data}
 def getUnionType(self):
     '''获取阵营类型'''
     guild = GuildManager().getGuildById(self.id)
     if guild:
         utype = guild.camp
         return utype
     return 0
Exemplo n.º 16
0
def InstanceMapInfos_2502(dynamicId, request_proto):
    '''获取副本组信息'''
    argument = MapMessage_pb2.InstanceMapInfosRequest()
    argument.ParseFromString(request_proto)
    response = MapMessage_pb2.InstanceMapInfosResponse()

    dynamicId = dynamicId
    characterId = argument.id
    result = map.InstanceMapInfos(dynamicId, characterId)
    response.result = result.get('result', False)
    response.message = result.get('message', '')
    response.self_color = result.get('self_color', 0)
    infos = result.get('infos', {})
    for key, _info in infos.items():
        mapinfo = response.infos.add()
        mapinfo.id = key
        mapinfo.once = _info.get('reward', 0)
        mapinfo.income = _info.get('rewardAll', 0)
        mapinfo.instance_name = _info.get('instancename', '')
        mapinfo.union_name = _info.get('pname',
                                       '') + "(%s)" % _info.get('gname', '')
        guildId = _info.get('gid', 0)
        color = 0
        if not guildId:
            if not _info.get('pid', 0):
                color = 0
            else:
                color = DEFAULTCOLOR
        else:
            guild = GuildManager().getGuildById(guildId)
            if guild:
                color = guild.guildinfo.get('color', 0)

        mapinfo.color = color
    return response.SerializeToString()
 def getUnionTypeStr(self):
     '''获取行会阵营'''
     guild = GuildManager().getGuildById(self.id)
     if guild:
         utype = guild.camp
         return {1:Lg().g(336),2:Lg().g(337)}.get(utype,Lg().g(338))
     return Lg().g(338)
Exemplo n.º 18
0
def loadModule():
    from app.scense.nodeapp import *
    #    from app.scense.publicnodeapp import *
    from app.scense.chatnodeapp import *
    dbScene.getALlInstanceSceneInfo()
    dbScene.getAllPublicSceneInfo()
    dbPortals.getAllPortalsInfo()
    dbStrengthen.getAll()
    dbInstance_colonize_title.updateAll()  #更新殖民头衔配置
    dbNpc.getAllNpcInfo()
    dbAward.getAllAwardInfo()
    dbSchedule.getAllScheduleBound()
    dbSchedule.getAllScheduleConfig()
    dbdaily.getAllDaily()
    dbGodhead.getAllGodhead()
    dbGodhead.getAllHeadtype()
    dbItems.getAllsetInfo()
    dbItems.getAllGemInfo()
    dbItems.getAllCompoundInfo()
    dbMonster.getAllMonsterInfo()
    dbMap.getAllDoorInfo()
    dbMap.getAllMonsterConfig()
    dbMap.getAllMapInfo()
    GuildManager()
    MapManager()
    serviceByStart.doService()
    updateInstanceInfo(1)
    updateSceneInfo(1)
    cleanMeM(1800)
 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)}
 def AppliJionGuild(self,guildId):
     '''申请加入国'''
     if self.getID():
         return {'result':False,'message':Lg().g(340)}
     surplushours = self.getCanJoinTime()
     if surplushours:
         return {'result':False,'message':Lg().g(647)%surplushours}
     if dbGuild.checkHasApply(guildId, self._owner.baseInfo.id):
         return {'result':False,'message':Lg().g(341)}
     guild = GuildManager().getGuildById(guildId)
     if self._owner.level.getLevel()<guild.levelrequired:
         return {'result':False,'message':Lg().g(342)}
     if not guild:
         return {'result':False,'message':Lg().g(343)}
     result = guild.JointGuild(self._owner.baseInfo.id)
     self._owner.quest.specialTaskHandle(ADDGUILDTASKTYPE)
     return result
Exemplo n.º 21
0
 def getBigMapInfo(self):
     '''获取打地图信息
     '''
     from app.scense.core.guild.GuildManager import GuildManager
     infolist = []
     for fortress in self.fortresss.values():
         guild = GuildManager().getGuildById(fortress.kimori)
         info = {}#{'id':1000,'color':randomcorlor(),'tax':10,'income':100,'scene_name':u'克洛村','union_name':'CCC'}
         info['cityid'] = fortress.sceneId
         info['color'] = 16777215 if not guild else guild.get('corlor')
         if not info['color']:
             info['color'] = 16777215
         info['reward'] = 10
         info['cityname'] = fortress.name
         info['gname'] = u'无' if not guild else guild.get('name')
         infolist.append(info)
     return infolist
Exemplo n.º 22
0
 def getBigMapInfo(self):
     '''获取打地图信息
     '''
     from app.scense.core.guild.GuildManager import GuildManager
     infolist = []
     for fortress in self.fortresss.values():
         guild = GuildManager().getGuildById(fortress.kimori)
         info = {
         }  #{'id':1000,'color':randomcorlor(),'tax':10,'income':100,'scene_name':u'克洛村','union_name':'CCC'}
         info['cityid'] = fortress.sceneId
         info['color'] = 16777215 if not guild else guild.get('corlor')
         if not info['color']:
             info['color'] = 16777215
         info['reward'] = 10
         info['cityname'] = fortress.name
         info['gname'] = u'无' if not guild else guild.get('name')
         infolist.append(info)
     return infolist
Exemplo n.º 23
0
def CrusadeCorps(dynamicId, characterId, corpsId):
    '''国讨伐申请
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param corpsId: 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)
    toGuild = GuildManager().getGuildById(corpsId)
    if not toGuild:
        return {'result': False, 'message': Lg().g(87)}
    data = guild.CrusadeCorps(characterId, guildId)
    return data
Exemplo n.º 24
0
 def addFightlog(self,guildId,logtype):
     '''添加战斗日志
     @param guildId: 国的ID
     @param logtype: 日志类型  1 申请   2 占领
     '''
     from app.scense.core.guild.GuildManager import GuildManager
     guild = GuildManager().getGuildById(guildId)
     if not guild:
         return
     gname = guild.get('name')
     thisTime = str(datetime.datetime.now())
     scenename = self.get('name')
     if logtype==1:
         logstr = u'%s\n%s国申请征战%s成功!将于次日19:00:00开始国战。'%(thisTime,gname,scenename)
     else:
         logstr = u'%s\n%s国成功占领%s'%(thisTime,gname,scenename)
     loglist = self.get('fightlog')
     loglist.append(logstr)
Exemplo n.º 25
0
def ModifyCorpsAnnoun(dynamicId, characterId, announContent):
    '''发布行会公告
    @param dynamicId: int 客户的动态id
    @param characterId: int 操作者的id
    @param announContent: str 公告的内容
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result': False, 'message': Lg().g(18)}
    for word in dbaccess.All_ShieldWord:
        cnt = announContent.find(word[0])
        if cnt != -1:
            return {'result': False, 'message': Lg().g(78)}
    guildId = player.guild.getID()
    if not guildId:
        return {'result': False, 'message': Lg().g(79)}
    guild = GuildManager().getGuildById(guildId)
    data = guild.modifyCorpsAnnoun(characterId, announContent)
    return data
Exemplo n.º 26
0
def ModifyCorpsAnnoun(dynamicId,characterId,announContent):
    '''发布行会公告
    @param dynamicId: int 客户的动态id
    @param characterId: int 操作者的id
    @param announContent: str 公告的内容
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    for word in dbaccess.All_ShieldWord:
        cnt = announContent.find(word[0])
        if cnt!=-1:
            return {'result':False,'message':Lg().g(78)}
    guildId = player.guild.getID()
    if not guildId:
        return {'result':False,'message':Lg().g(79)}
    guild = GuildManager().getGuildById(guildId)
    data = guild.modifyCorpsAnnoun(characterId,announContent)
    return data
Exemplo n.º 27
0
def TransferCorpsOrKickMember(dynamicId, characterId, operType, memberId):
    '''移交团长或踢出成员
    @param dynamicId: int 客户端的动态id
    @param characterId: int 客户端的id
    @param operType: int 操作类型
    @param memberId: 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)
    if operType == 0:  #移交国长
        data = guild.TransferCorps(characterId, memberId)
    else:
        data = guild.fireMember(characterId, memberId)
    return data
Exemplo n.º 28
0
 def addFightlog(self, guildId, logtype):
     '''添加战斗日志
     @param guildId: 国的ID
     @param logtype: 日志类型  1 申请   2 占领
     '''
     from app.scense.core.guild.GuildManager import GuildManager
     guild = GuildManager().getGuildById(guildId)
     if not guild:
         return
     gname = guild.get('name')
     thisTime = str(datetime.datetime.now())
     scenename = self.get('name')
     if logtype == 1:
         logstr = u'%s\n%s国申请征战%s成功!将于次日19:00:00开始国战。' % (thisTime, gname,
                                                          scenename)
     else:
         logstr = u'%s\n%s国成功占领%s' % (thisTime, gname, scenename)
     loglist = self.get('fightlog')
     loglist.append(logstr)
Exemplo n.º 29
0
def TransferCorpsOrKickMember(dynamicId,characterId,operType,memberId):
    '''移交团长或踢出成员
    @param dynamicId: int 客户端的动态id
    @param characterId: int 客户端的id
    @param operType: int 操作类型
    @param memberId: 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)
    if operType==0:#移交国长
        data = guild.TransferCorps(characterId,memberId)
    else:
        data = guild.fireMember(characterId,memberId)
    return data
 def pushGuildLevelUp(self):
     '''获取行会升级消息'''
     guild = GuildManager().getGuildById(self.id)
     if guild:
         lastonline = self._owner.lastOnline
         leveluptime = guild.levelupTime
         if leveluptime>lastonline:
             level = guild.level
             sendList = [self._owner.getDynamicId()]
             pushGuildLevelUpMessage(level, sendList)
    def getGuildInfo(self):
        '''获取行会基本信息'''
        if not self.id:
            return {'result':False,'message':Lg().g(339)}
#        if self.id>0 and not GuildManager()._guilds.has_key(self.id):
#            GuildManager().addGuildById(self.id)
        guild = GuildManager().getGuildById(self.id)
        if not guild:
            return {}
        return guild.guildinfo
Exemplo n.º 32
0
    def updateInstancePid(self, groupid, pid, pname, gid, gname, instancename):
        '''更改(或添加)副本领主
        @param groupid: int 副本组id
        @param pid: int 角色id
        @param pname: str 角色名称
        @param gid: int 国id
        @param gname: str 国名称
        @instancename:str 副本名称
        '''
        from app.scense.core.guild.GuildManager import GuildManager

        self.updateIByid(groupid)
        info = self.i[groupid]  #副本殖民信息
        if info['pid'] == 0:  #如果这个副本没有被殖民
            dbInstanceColonize.addInstanceColonize(groupid, instancename, pid,
                                                   pname, gid, gname, 0,
                                                   0)  #添加到数据库中

        info['pid'] = pid  #设置此副本的领主角色id
        info['pname'] = pname  #设置副本领主的角色名称
        info['gid'] = gid  #设置领主行会id
        info['camp'] = 0
        if gid > 0:
            info['camp'] = GuildManager().getGuildById(gid).guildinfo[
                'camp']  #所属阵营 0中立  1光明  2黑暗
        info['gname'] = gname  #设置领主行会名称
        info['name'] = instancename  #设置副本名称
        self.setI(groupid, info)
        cityid = self.ic.get(groupid)  #根据副本组id获取所属城市id
        result, instanceinfo = self.cityColonize(cityid)  #根据城市id判断城市是否已经被玩家占领
        if result:
            pid = instanceinfo['pid']
            cinfo = self.c[cityid]
            cinfo['pid'] = pid
            cinfo['pname'] = instanceinfo['pname']
            cinfo['gid'] = instanceinfo['gid']
            cinfo['gname'] = instanceinfo['gname']
            cinfo['camp'] = instanceinfo['camp']
            self.setC(cityid, cinfo)

        cszid = self.ip.get(groupid)  #根据副本组id获取所属传送阵id
        rs1, cs1 = self.Portal(cszid)  #根据传送阵id判断传送阵是否被主宰
        if rs1:
            pid = cs1['pid']  #设置城市占领者id
            pname = cs1['pname']  #设置城市占领者名称
            gid = cs1['gid']  #设置城市占领者行会id
            gname = cs1['gname']
            camp = cs1['camp']  #所属阵营 0中立  1光明  2黑暗
            pinfo = self.p[cszid]  #传送阵殖民信息
            pinfo['pid'] = pid
            pinfo['pname'] = pname
            pinfo['gid'] = gid
            pinfo['gname'] = gname
            pinfo['camp'] = camp
            self.setP(cszid, pinfo)
Exemplo n.º 33
0
def ModifyJoinLevel(dynamicId, characterId, levelrequired):
    '''修改申请加入等级限制
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param levelrequired: int 等级限制
    '''
    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)
    data = guild.ModifyJoinLevel(characterId, levelrequired)
    reason = {0: Lg().g(80), -1: Lg().g(81)}
    if data == 1:
        result = {'result': True, 'message': Lg().g(85)}
    else:
        result = {'result': False, 'message': reason[data]}
    return result
Exemplo n.º 34
0
 def getForTressInfo(self):
     '''获取当个要塞的信息
     '''
     from app.scense.core.guild.GuildManager import GuildManager
     info = {}
     info['id'] = self.id
     kimoriguild = GuildManager().getGuildById( self.kimori)
     siegeguild = GuildManager().getGuildById( self.siege)
     if kimoriguild:#领主国的名称
         info['kimoriname'] = kimoriguild.get('name')
         info['kimoriemblem'] = kimoriguild.get('emblemLevel')
     else:
         info['kimoriname'] = u''
         info['kimoriemblem'] = 0
     if siegeguild:#挑战国的名称
         info['siegename'] = siegeguild.get('name')
         info['siegeemblem'] = siegeguild.get('emblemLevel')
     else:
         info['siegename'] = u''
         info['siegeemblem'] = 0
         
     if not IsSignUpTime():
         info['fortressstatus'] = 1#等待征战
     elif IsWarTime():
         info['fortressstatus'] = 2#征战中
     else:
         if not (kimoriguild and siegeguild):#判断征战状态
             info['fortressstatus'] = 0#可以征战
         else:
             info['fortressstatus'] = 1#等待征战
     return info
Exemplo n.º 35
0
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
Exemplo n.º 36
0
 def afterFight(self,monsterId,playerId,currentHp):
     '''场景中的战后处理
     @monsterId 怪物的ID
     @param playerId: int 攻击的角色的ID
     @currentHp: int 怪物的当前血量 
     '''
     if monsterId>10:
         return
     monster = self._monsters.get(monsterId)
     if not monster:
         if monsterId == 1:#主帅旗被砍掉
             from app.scense.core.guild.GuildManager import GuildManager
             from app.scense.core.campaign.FortressManager import FortressManager
             from app.scense.utils.dbopera import dbfortress
             player = PlayersManager().getPlayerByID(playerId)
             guildId = player.guild.getID()
             fortress = FortressManager().getFortressBySceneId(self._id)
             info = {}
             info['kimoriScore'] = 0
             info['siegeScore'] = 0
             info['siege'] = 0
             info['isOccupied'] = 1
             info['kimori'] = guildId
             info['siege'] = 0
             guild1 = GuildManager().getGuildById(guildId)
             if guild1:
                 guild1.addExp(3500)
                 msg = u"%s国成功征战%s,成为其国领地!"%(guild1.name,self._name)
                 pushSystemInfo(msg)
                 dbfortress.updateFortressInfo(fortress.id, {'kimori':info['kimori'],
                                             'isOccupied':1,'siege':0})
             return
         else:
             return
     monster.updateHp(currentHp)
     
     
     
Exemplo n.º 37
0
 def afterFight(self, monsterId, playerId, currentHp):
     '''场景中的战后处理
     @monsterId 怪物的ID
     @param playerId: int 攻击的角色的ID
     @currentHp: int 怪物的当前血量 
     '''
     if monsterId > 10:
         return
     monster = self._monsters.get(monsterId)
     if not monster:
         if monsterId == 1:  #主帅旗被砍掉
             from app.scense.core.guild.GuildManager import GuildManager
             from app.scense.core.campaign.FortressManager import FortressManager
             from app.scense.utils.dbopera import dbfortress
             player = PlayersManager().getPlayerByID(playerId)
             guildId = player.guild.getID()
             fortress = FortressManager().getFortressBySceneId(self._id)
             info = {}
             info['kimoriScore'] = 0
             info['siegeScore'] = 0
             info['siege'] = 0
             info['isOccupied'] = 1
             info['kimori'] = guildId
             info['siege'] = 0
             guild1 = GuildManager().getGuildById(guildId)
             if guild1:
                 guild1.addExp(3500)
                 msg = u"%s国成功征战%s,成为其国领地!" % (guild1.name, self._name)
                 pushSystemInfo(msg)
                 dbfortress.updateFortressInfo(fortress.id, {
                     'kimori': info['kimori'],
                     'isOccupied': 1,
                     'siege': 0
                 })
             return
         else:
             return
     monster.updateHp(currentHp)
Exemplo n.º 38
0
def getGuildListInfo(dynamicId, characterId, getType, curPage, searchCriteria):
    '''获取国列表
    @param dynamicId: int 客户端动态id
    @param characterId: int 角色的id
    @param getType: int 获取类型  0获取所有1搜索
    @param curPage: int 当前页数
    @param searchCriteria: str 搜索条件
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result': False, 'message': Lg().g(18)}
    info = GuildManager().getGuildListInfo(characterId, getType, curPage,
                                           searchCriteria)
    return {'result': True, 'data': info}
 def ObtainFortressReward(self):
     '''获取国领地奖励
     '''
     #判断是否领取过今天的奖励
     if self.lastDonate.date()==datetime.date.today():
         return {'result':False,'msgId':658}
     guild = GuildManager().getGuildById(self.id)
     if not guild:
         return {'result':False,'msgId':659}
     coinBound = guild.level * 10000
     self._owner.finance.addCoin(coinBound)
     lastDonate = datetime.datetime.now()
     self.updateLastDonate(lastDonate)
     return {'result':True,'msgId':660}
Exemplo n.º 40
0
 def getSceneGuildName(self):
     '''获取城镇占领国的名称
     '''
     from app.scense.core.campaign.FortressManager import FortressManager
     from app.scense.core.guild.GuildManager import GuildManager
     f = FortressManager().getFortressBySceneId(self._id)
     if not f:
         return ''
     if not f.isOccupied:
         return ''
     if not f.kimori:
         return ''
     guildId = f.kimori
     guild = GuildManager().getGuildById(guildId)
     return guild.name
 def getPost(self):
     '''获取职务'''
     guild = GuildManager().getGuildById(self.id)
     if not guild:
         return 0
     if self._owner.baseInfo.id==guild.president:
         self.post = 4
     elif self._owner.baseInfo.id in eval("["+guild.veterans+"]"):
         self.post = 3
     elif self._owner.baseInfo.id in eval("["+guild.staffOfficers+"]"):
         self.post = 2
     elif self._owner.baseInfo.id in eval("["+guild.senators+"]"):
         self.post = 1
     else:
         self.post = 0
     return self.post
Exemplo n.º 42
0
def SceneMapInfos(dynamicId, characterId):
    '''获取大地图信息
    @param dynamicId: int 客户端的id
    @param characterId: int 角色的id
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result': False, 'message': Lg().g(18)}
    guildId = player.guild.getID()
    if not guildId:
        self_color = int(DEFAULTCOLOR, 16)
    else:
        guild = GuildManager().getGuildById(guildId)
        self_color = guild.guildinfo.get('color', int(DEFAULTCOLOR, 16))
    infos = FortressManager().getBigMapInfo()  #ColonizeManage().getCityList()
    return {'result': True, 'self_color': self_color, 'infos': infos}
Exemplo n.º 43
0
def GetBattleInfo4406(dynamicId, characterId):
    '''获取战斗信息'''
    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)}
    ldID = FortressManager().guildFightFortressId(guildId)
    fortress = FortressManager().getFortressById(ldID)
    if not fortress:
        return {'result': False, 'message': Lg().g(654)}
    guildBattleInfo = {}
    guildBattleInfo['roundCount'] = fortress.getRound()
    guildBattleInfo['remainTime'] = fortress.getBattleRemainTime()
    guildBattleInfo['jishaCount'] = player.guild.successTimes
    guildBattleInfo['obtainCoin'] = player.guild.coinBound
    guildBattleInfo['failCount'] = player.guild.failTimes
    guildBattleInfo['obtainSw'] = player.guild.prestigeBound
    guildBattleInfo['battleInfoList'] = fortress.battleInfoList

    guild1Id = fortress.get('kimori')
    guild2Id = fortress.get('siege')
    guild1Info = {}
    guild2Info = {}
    if guild1Id:
        guild1 = GuildManager().getGuildById(guild1Id)
        guild1Info = {}
        guild1Info['groupName'] = guild1.get('name')
        guild1Info['groupCount'] = fortress.kimoriScore
        guild1Info['icon'] = guild1.get('emblemLevel')
        guild1Info['groupMember'] = fortress.kimoriMembers

    if guild2Id:
        guild2 = GuildManager().getGuildById(guild2Id)
        guild2Info = {}
        guild2Info['groupName'] = guild2.get('name')
        guild2Info['groupCount'] = fortress.siegeScore
        guild2Info['icon'] = guild2.get('emblemLevel')
        guild2Info['groupMember'] = fortress.siegeMembers

    guildBattleInfo['group1Info'] = guild1Info
    guildBattleInfo['group2Info'] = guild2Info
    return {'result': True, 'data': guildBattleInfo}
Exemplo n.º 44
0
def InstanceMapInfos(dynamicId, characterId):
    '''获取副本组信息
    @param dynamicId: int 客户端的id
    @param characterId: int 角色的id
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result': False, 'message': Lg().g(18)}
    guildId = player.guild.getID()
    if not guildId:
        self_color = int(DEFAULTCOLOR, 16)
    else:
        guild = GuildManager().getGuildById(guildId)
        self_color = guild.guildinfo.get('color', int(DEFAULTCOLOR, 16))
    cityid = player.baseInfo.getTown()
    infos = ColonizeManage().getInstanceListByCityid(cityid)
    return {'result': True, 'self_color': self_color, 'infos': infos}
Exemplo n.º 45
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
        })
Exemplo n.º 46
0
def GetBattleInfo4406(dynamicId,characterId):
    '''获取战斗信息'''
    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)}
    ldID = FortressManager().guildFightFortressId(guildId)
    fortress = FortressManager().getFortressById(ldID)
    if not fortress:
        return {'result':False,'message':Lg().g(654)}
    guildBattleInfo = {}
    guildBattleInfo['roundCount'] = fortress.getRound()
    guildBattleInfo['remainTime'] = fortress.getBattleRemainTime()
    guildBattleInfo['jishaCount'] = player.guild.successTimes
    guildBattleInfo['obtainCoin'] = player.guild.coinBound
    guildBattleInfo['failCount'] = player.guild.failTimes
    guildBattleInfo['obtainSw'] = player.guild.prestigeBound
    guildBattleInfo['battleInfoList'] = fortress.battleInfoList
    
    guild1Id = fortress.get('kimori')
    guild2Id = fortress.get('siege')
    guild1Info = {}
    guild2Info = {}
    if guild1Id:
        guild1 = GuildManager().getGuildById(guild1Id)
        guild1Info = {}
        guild1Info['groupName'] = guild1.get('name')
        guild1Info['groupCount'] = fortress.kimoriScore
        guild1Info['icon'] = guild1.get('emblemLevel')
        guild1Info['groupMember'] = fortress.kimoriMembers
        
    if guild2Id:
        guild2 = GuildManager().getGuildById(guild2Id)
        guild2Info = {}
        guild2Info['groupName'] = guild2.get('name')
        guild2Info['groupCount'] = fortress.siegeScore
        guild2Info['icon'] = guild2.get('emblemLevel')
        guild2Info['groupMember'] = fortress.siegeMembers
        
    guildBattleInfo['group1Info'] = guild1Info
    guildBattleInfo['group2Info'] = guild2Info
    return {'result':True,'data':guildBattleInfo}
 def GetCorpsMemberOrAppliListInfo(self,getType,searchCriteria,curPage):
     '''获取获取成员列表或申请列表
     @param getType: int //0获取国成员列表1按条件查找国成员2获取申请列表3按条件查找申请成员
     @param searchCriteria: str//搜索条件
     @param curPage: int 当前页面号
     '''
     guild = GuildManager().getGuildById(self.id)
     if not guild:
         return {'result':False,'message':Lg().g(339)}
     if getType ==0:
         data = guild.getGuildMemberInfo(curPage)
     elif getType ==1:
         data = guild.searchGuildMemberInfo(searchCriteria,curPage)
     elif getType==2:
         data = guild.getApplyList(curPage)
     else:
         data = guild.searchApplyJoinGuildInfo(searchCriteria)
     data['setType'] = getType
     return {'result':True,'data':data}
Exemplo n.º 48
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})
 def getGuildLevel(self):
     '''获取行会的等级'''
     guild = GuildManager().getGuildById(self.id)
     if not guild:
         return 0
     return guild.getGuildLevel()
 def getGuildName(self):
     '''获取行会的名称'''
     guild = GuildManager().getGuildById(self.id)
     if guild:
         return guild.getGuildName()
     return None
Exemplo n.º 51
0
    def initSetDefaultValue(self):
        '''填充城镇与副本,并设置默认值'''
        from app.scense.core.guild.GuildManager import GuildManager
        dataList = dbPublicscene.Allinfo.values()  #获取所有城镇的信息
        for item in dataList:  #迭代所有城镇信息    item['id']城市id ####################################城市
            cityid = item['id']  #城市id
            self.cityi[cityid] = []
            cfo = {
                'cityid': cityid,
                'cityname': item['name'],
                'pid': 0,
                'pname': u'无',
                'gid': 0,
                'gname': u'无',
                'camp': 0
            }
            self.c[cityid] = cfo
            dbInstanceColonize.addCityColonize(cityid, item['name'], 0, u'无',
                                               0, u'无', 0, 0)
            pList = eval("[" + str(item['portals']) + "]")
            if len(pList) < 1:  #如果城镇里面没有副本
                continue
            for it in pList:  #迭代所有传送门id             ########################################传送阵
                itpname = dbPortals.ALL_PORTALS[it]['name']  #传送阵名称
                pfo = {
                    'id': it,
                    'name': itpname,
                    'pid': 0,
                    'pname': u'无',
                    'gid': 0,
                    'gname': u'无',
                    'camp': 0
                }
                self.p[it] = pfo
                self.protali[it] = []
                groupList = InstanceGroupManage().getInstanceGroupBycszid(
                    it)  #获得传送门通往的所有副本组信息
                for i in groupList:  #遍历所有副本组信息  i['id']:副本组id #########################副本组
                    instanceid = i['id']  #副本组id
                    self.cityi[item['id']].append(instanceid)  #向城市中添加副本组id
                    self.protali[it].append(instanceid)  #向传送阵中添加副本组id
                    self.ic[instanceid] = cityid
                    self.ip[instanceid] = it
                    self.wm[instanceid] = 0
                    ifo = {
                        'id': i['id'],
                        'name': u'',
                        'pid': 0,
                        'pname': u'无',
                        'gid': 0,
                        'gname': u'无',
                        'camp': 0,
                        'wm': 0
                    }
                    defence = dbInstanceColonize.getInstanceColonizeByid(
                        i['id'])  #根据副本组id获取保卫信息
                    if defence:  #如果此副本已经被玩家占领
                        ifo['pid'] = defence['pid']
                        ifo['pname'] = defence['pname']
                        ifo['gid'] = defence['gid']
                        ifo['camp'] = 0
                        if defence['gid'] > 0:
                            ifo['camp'] = GuildManager().getGuildById(
                                defence['gid']).guildinfo[
                                    'camp']  #所属阵营 0中立  1光明  2黑暗
                        ifo['gname'] = defence['gname']
                        ifo['name'] = defence['instancename']
                    self.i[i['id']] = ifo
#                    self.setProperty0()
        self.initCityColonize()
        self.initportal()