def updateTrainMode(self,tmode): '''更改加强模式''' if not self.istrain: return {'result':False,'message':Lg().g(213)} if self.trainmode<=tmode: return {'result':False,'message':Lg().g(211)} goldcons = TRAINMODE.get(tmode)['cons'] nowgold = self._owner.finance.getGold() golddelta = nowgold - goldcons if golddelta < 0: return {'result':False,'message':Lg().g(190)} characterId = self._owner.baseInfo.id self._owner.finance.updateGold(golddelta) self.trainmode = tmode props = {'trainmode':tmode} dbAfk.updateCharacterMining(characterId, props) return {'result':True}
def updateMiningMode(self,mmode): '''更改加强模式''' if not self.ismining: return {'result':False,'message':Lg().g(210)} if self.miningmode<=mmode: return {'result':False,'message':Lg().g(211)} goldcons = MININGMODE.get(mmode)['cons'] nowgold = self._owner.finance.getGold() golddelta = nowgold - goldcons if golddelta < 0: return {'result':False,'message':Lg().g(190)} characterId = self._owner.baseInfo.id self._owner.finance.updateGold(golddelta) self.miningmode = mmode props = {'miningmode':mmode} dbAfk.updateCharacterMining(characterId, props) return {'result':True}