def handlePicking(self): messenger.send('wakeup') fullName = GardenGlobals.getFlowerVarietyName(self.species, self.variety) if self.isWilted(): self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.ConfirmWiltedFlower % {'plant': fullName}, command=self.confirmCallback) elif not self.isFruiting(): self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.ConfirmUnbloomingFlower % {'plant': fullName}, command=self.confirmCallback) elif base.localAvatar.isFlowerBasketFull(): self.confirmDialog = TTDialog.TTDialog(style=TTDialog.CancelOnly, text=TTLocalizer.ConfirmBasketFull, command=self.confirmCallback) else: shovel = base.localAvatar.shovel skill = base.localAvatar.shovelSkill shovelPower = GardenGlobals.getShovelPower(shovel, skill) giveSkillUp = True beansRequired = GardenGlobals.getNumBeansRequired(self.species, self.variety) if not shovelPower == beansRequired: giveSkillUp = False if giveSkillUp: if skill == GardenGlobals.getMaxShovelSkill(): text = (TTLocalizer.ConfirmMaxedSkillFlower % {'plant': fullName},) else: text = TTLocalizer.ConfirmSkillupFlower % {'plant': fullName} self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=text, command=self.confirmCallback) else: self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.ConfirmNoSkillupFlower % {'plant': fullName}, command=self.confirmCallback) self.confirmDialog.show() base.localAvatar.setInGardenAction(self) base.cr.playGame.getPlace().detectedGardenPlotUse()
def doResultDialog(self): self.startInteraction() flowerName = GardenGlobals.getFlowerVarietyName(self.species, self.variety) stringToShow = TTLocalizer.getResultPlantedSomethingSentence(flowerName) self.resultDialog = TTDialog.TTDialog( style=TTDialog.Acknowledge, text=stringToShow, command=self.resultsCallback )
def doResultDialog(self): self.startInteraction() flowerName = GardenGlobals.getFlowerVarietyName( self.species, self.variety) stringToShow = TTLocalizer.getResultPlantedSomethingSentence( flowerName) self.resultDialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=stringToShow, command=self.resultsCallback)
def update(self): if base.localAvatar.flowerCollection.hasSpecies(self.species): self.flowerPanel.show(showBackground=0) self['text'] = TTLocalizer.FlowerSpeciesNames[self.species] for variety in xrange( len(GardenGlobals.getFlowerVarieties(self.species))): if base.localAvatar.flowerCollection.hasFlower( self.species, variety): name = GardenGlobals.getFlowerVarietyName( self.species, variety) self.speciesLabels[variety]['text'] = name self.speciesLabels[variety]['state'] = DGG.NORMAL self.showRecipe()
def showRecipe(self): if base.localAvatar.flowerCollection.hasSpecies(self.species): self['text'] = TTLocalizer.FlowerSpeciesNames[self.species] if base.localAvatar.flowerCollection.hasFlower( self.species, self.variety): name = GardenGlobals.getFlowerVarietyName( self.species, self.variety) recipeKey = GardenGlobals.PlantAttributes[ self.species]['varieties'][self.variety][0] self['text'] = name self.createBeanRecipeGui( GardenGlobals.Recipes[recipeKey]['beans']) else: self.cleanupBeanRecipeGui() else: self['text'] = TTLocalizer.FlowerUnknown self.cleanupBeanRecipeGui()
def __handleFlowerPlantingDone(self, willPlant=0, recipeStr='', special=-1): self.ignore(self.plantingGuiDoneEvent) self.ignore('stoppedAsleep') self.plantingGui.destroy() self.plantingGui = None base.localAvatar.showGardeningGui() base.localAvatar.removeShovelRelatedDoId(self.doId) successPlanting = False if willPlant: recipeKey = GardenGlobals.getRecipeKey(recipeStr, special) if recipeKey >= 0: species, variety = GardenGlobals.getSpeciesVarietyGivenRecipe( recipeKey) if species >= 0 and variety >= 0: self.sendUpdate('plantFlower', [species, variety]) successPlanting = True else: self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special)) burntBeans = len(recipeStr) self.sendUpdate('plantNothing', [burntBeans]) if successPlanting: flowerName = GardenGlobals.getFlowerVarietyName(species, variety) stringToShow = TTLocalizer.getResultPlantedSomethingSentence( flowerName) elif willPlant: self.resultDialog = TTDialog.TTDialog( style=TTDialog.Acknowledge, text=TTLocalizer.ResultPlantedNothing, command=self.popupFlowerPlantingGuiAgain) else: self.finishInteraction() return
def getFullNameWithRecipe(self): name = GardenGlobals.getFlowerVarietyName(self.species, self.variety) recipeKey = GardenGlobals.PlantAttributes[self.species]['varieties'][ self.variety][0] name += ' (%s)' % GardenGlobals.Recipes[recipeKey]['beans'] return name
def getFullName(self): return GardenGlobals.getFlowerVarietyName(self.species, self.variety)