def updateContribution(self,contribution): '''更新捐献值 @param contribution: int 捐献值 ''' self.contribution = contribution dbGuild.updateCharacterGuildInfo(self._owner.baseInfo.id, {'contribution':contribution}) dbGuild.updateGuildPost(self.id)
def TransferCorps(self,operator,memberId): '''移交国长 @param operator: int 操作者的id @param memberId: int 被任命的角色的id ''' managementGroup = eval("["+self.guildinfo['veterans']+"]")\ +eval("["+self.guildinfo['staffOfficers']+"]")\ +eval("["+self.guildinfo['senators']+"]") if memberId not in managementGroup: return {'result':False,'message':Lg().g(534)} if operator!=self.president: return {'result':False,'message':Lg().g(515)} if not dbGuild.checkCharacterInGuild(memberId, self.id): return {'result':False,'message':Lg().g(524)} result = dbGuild.TransferCorps(self.id, operator, memberId) if result: self.president = memberId player = PlayersManager().getPlayerByID(operator) player.updatePlayerInfo() member = PlayersManager().getPlayerByID(memberId) if member: member.updatePlayerInfo() dbGuild.updateCharacterGuildInfo(memberId, {'post':4}) membername = dbGuild.getCharacterNameByID(memberId) content = Lg().g(535)%\ (self.guildinfo.get('nickname',''),membername,self.guildinfo.get('name',''),) title = Lg().g(526) for characterId in dbGuild.getAllGuildCharacterId(self.id): m = Mail( title=title,type =0, senderId =-1, receiverId=characterId[0],\ sender = Lg().g(128),content=content) m.mailIntoDB() postdict = dbGuild.updateGuildPost(self.id) self.veterans=postdict.veterans self.staffOfficers=postdict.staffOfficers self.senators=postdict.senators # self.SynchGuildInfo() return {'result':True,'message':Lg().g(85)} return {'result':False,'message':Lg().g(536)}
def TransferCorps(self, operator, memberId): '''移交国长 @param operator: int 操作者的id @param memberId: int 被任命的角色的id ''' managementGroup = eval("["+self.guildinfo['veterans']+"]")\ +eval("["+self.guildinfo['staffOfficers']+"]")\ +eval("["+self.guildinfo['senators']+"]") if memberId not in managementGroup: return {'result': False, 'message': Lg().g(534)} if operator != self.president: return {'result': False, 'message': Lg().g(515)} if not dbGuild.checkCharacterInGuild(memberId, self.id): return {'result': False, 'message': Lg().g(524)} result = dbGuild.TransferCorps(self.id, operator, memberId) if result: self.president = memberId player = PlayersManager().getPlayerByID(operator) player.updatePlayerInfo() member = PlayersManager().getPlayerByID(memberId) if member: member.updatePlayerInfo() dbGuild.updateCharacterGuildInfo(memberId, {'post': 4}) membername = dbGuild.getCharacterNameByID(memberId) content = Lg().g(535)%\ (self.guildinfo.get('nickname',''),membername,self.guildinfo.get('name',''),) title = Lg().g(526) for characterId in dbGuild.getAllGuildCharacterId(self.id): m = Mail( title=title,type =0, senderId =-1, receiverId=characterId[0],\ sender = Lg().g(128),content=content) m.mailIntoDB() postdict = dbGuild.updateGuildPost(self.id) self.veterans = postdict.veterans self.staffOfficers = postdict.staffOfficers self.senators = postdict.senators # self.SynchGuildInfo() return {'result': True, 'message': Lg().g(85)} return {'result': False, 'message': Lg().g(536)}
def leaveGuild(self,operator): '''离开行会''' from app.scense.core.instance.ColonizeManage import ColonizeManage if self.getPresident() == operator: newPresident = self.findNewPresident() if not newPresident: return {'result':False,'message':Lg().g(550)} else: dbGuild.updateCharacterGuildInfo(newPresident, {'post':4}) self.president=newPresident # if operator in eval("["+self.guildinfo['veterans']+"]"): # newstaffOfficers = str(eval("["+self.guildinfo['veterans']+"]").remove(operator))[1:-1] # self.update('veterans', newstaffOfficers) # if operator in eval("["+self.guildinfo['staffOfficers']+"]"): # newveterans = str(eval("["+self.guildinfo['staffOfficers']+"]").remove(operator))[1:-1] # self.update('staffOfficers', newveterans) # if operator in eval("["+self.guildinfo['senators']+"]"): # newsenators = str(eval("["+self.guildinfo['senators']+"]").remove(operator))[1:-1] # self.update('senators', newsenators) result = dbGuild.deleteCharacterGuildRelation(operator) if result: postdict = dbGuild.updateGuildPost(self.id) self.veterans=postdict.veterans self.staffOfficers=postdict.staffOfficers self.senators=postdict.senators player = PlayersManager().getPlayerByID(operator) player.updatePlayerInfo() playerList = dbGuild.getGuildCharacterIdList(self.id) msg = Lg().g(551)%player.baseInfo.getName() sendList = [PlayersManager().getPlayerByID(p[0]).getDynamicId()\ for p in playerList \ if PlayersManager().getPlayerByID(p[0]) and \ PlayersManager().getPlayerByID(p[0]).getDynamicId()] pushPromptedMessage(msg, sendList) ColonizeManage().updateGuild(operator, 0, Lg().g(143)) return {'result':True,'message':Lg().g(552)}#开除成功 return {'result':False,'message':Lg().g(553)}#开除失败
def leaveGuild(self, operator): '''离开行会''' from app.scense.core.instance.ColonizeManage import ColonizeManage if self.getPresident() == operator: newPresident = self.findNewPresident() if not newPresident: return {'result': False, 'message': Lg().g(550)} else: dbGuild.updateCharacterGuildInfo(newPresident, {'post': 4}) self.president = newPresident # if operator in eval("["+self.guildinfo['veterans']+"]"): # newstaffOfficers = str(eval("["+self.guildinfo['veterans']+"]").remove(operator))[1:-1] # self.update('veterans', newstaffOfficers) # if operator in eval("["+self.guildinfo['staffOfficers']+"]"): # newveterans = str(eval("["+self.guildinfo['staffOfficers']+"]").remove(operator))[1:-1] # self.update('staffOfficers', newveterans) # if operator in eval("["+self.guildinfo['senators']+"]"): # newsenators = str(eval("["+self.guildinfo['senators']+"]").remove(operator))[1:-1] # self.update('senators', newsenators) result = dbGuild.deleteCharacterGuildRelation(operator) if result: postdict = dbGuild.updateGuildPost(self.id) self.veterans = postdict.veterans self.staffOfficers = postdict.staffOfficers self.senators = postdict.senators player = PlayersManager().getPlayerByID(operator) player.updatePlayerInfo() playerList = dbGuild.getGuildCharacterIdList(self.id) msg = Lg().g(551) % player.baseInfo.getName() sendList = [PlayersManager().getPlayerByID(p[0]).getDynamicId()\ for p in playerList \ if PlayersManager().getPlayerByID(p[0]) and \ PlayersManager().getPlayerByID(p[0]).getDynamicId()] pushPromptedMessage(msg, sendList) ColonizeManage().updateGuild(operator, 0, Lg().g(143)) return {'result': True, 'message': Lg().g(552)} #开除成功 return {'result': False, 'message': Lg().g(553)} #开除失败
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)}#开除失败
def addContribution(self,contribution): '''添加捐献值''' self.contribution += contribution dbGuild.updateCharacterGuildInfo(self._owner.baseInfo.id, {'contribution':self.contribution}) dbGuild.updateGuildPost(self.id)
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)} #开除失败