def UseXingYun(self,usetype): ''' @param usetype: int 0四叶草1郁金香2蝴蝶兰3紫罗兰4曼陀罗 ''' self.clearWishRecord() if usetype not in [0,1,2,3,4]: return {'result':False,'msgID':651} CONS_CONFIG = {0:0,1:10,2:15,3:20,4:30} goldcons = CONS_CONFIG.get(usetype) guild = GuildManager().getGuildById(self.id) if not guild: return {'result':False,'msgID':79} if self._owner.finance.getGold()<goldcons: return {'result':False,'msgID':652} characterId = self._owner.baseInfo.id viplevel = self._owner.baseInfo._viptype nowtimes=getattr(self,'wish_%d_times'%usetype) result = dbVIP.vipCertification('wish_%d_times'%usetype, viplevel, nowtimes=nowtimes) if not result: return {'result':False,'msgID':655} setattr(self, 'wish_%d_times'%usetype, nowtimes+1) dbGuild.updateCharacterWishRecord(characterId, {'wish_%d_times'%usetype:nowtimes+1}) self._owner.finance.addGold(-goldcons) usename = self._owner.baseInfo.getName() xingyunadd = guild.UseXingYun(usetype,usename) self._owner.petShop.addXy(xingyunadd) return {'result':True}
def clearWishRecord(self): '''重新清理许愿记录 ''' tihsday = datetime.date.today() if self.recordDate==tihsday: return characterId = self._owner.baseInfo.id self.recordDate=tihsday self.wish_0_times = 0 self.wish_1_times = 0 self.wish_2_times = 0 self.wish_3_times = 0 self.wish_4_times = 0 props = {'recordDate':str(tihsday),'wish_0_times':0, 'wish_1_times':0,'wish_2_times':0, 'wish_3_times':0,'wish_4_times':0} dbGuild.updateCharacterWishRecord(characterId, props)