def fishSold(self): assert self.notify.debug('fishSold()') avId = self.air.getAvatarIdFromSender() if self.busy != avId: self.air.writeServerEvent('suspicious', avId, 'DistributedNPCPetshopAI.fishSold busy with %s' % (self.busy)) self.notify.warning("somebody called fishSold that I was not busy with! avId: %s" % avId) return av = simbase.air.doId2do.get(avId) if av: # this function sells the fish, clears the tank, and # updates the collection, trophies, and maxhp. One stop shopping! trophyResult = self.air.fishManager.creditFishTank(av) if trophyResult: movieType = NPCToons.SELL_MOVIE_TROPHY extraArgs = [len(av.fishCollection), FishGlobals.getTotalNumFish()] else: movieType = NPCToons.SELL_MOVIE_COMPLETE extraArgs = [] # Send a movie to reward the avatar self.d_setMovie(avId, movieType, extraArgs) self.transactionType = "fish" else: # perhaps the avatar got disconnected, just leave the fish # in his tank and let him resell them next time pass self.sendClearMovie(None)
def completeSale(self, sell): avId = self.air.getAvatarIdFromSender() if self.busy != avId: self.air.writeServerEvent( 'suspicious', avId, 'DistributedNPCFishermanAI.completeSale busy with %s' % self.busy) self.notify.warning( 'somebody called setMovieDone that I was not busy with! avId: %s' % avId) return if sell: av = simbase.air.doId2do.get(avId) if av: trophyResult = self.air.fishManager.creditFishTank(av) if trophyResult: movieType = NPCToons.SELL_MOVIE_TROPHY extraArgs = [ len(av.fishCollection), FishGlobals.getTotalNumFish() ] else: movieType = NPCToons.SELL_MOVIE_COMPLETE extraArgs = [] self.d_setMovie(avId, movieType, extraArgs) else: av = simbase.air.doId2do.get(avId) if av: self.d_setMovie(avId, NPCToons.SELL_MOVIE_NOFISH) self.sendClearMovie(None) return
def fishSold(self): avId = self.air.getAvatarIdFromSender() if self.busy != avId: self.air.writeServerEvent( 'suspicious', avId, 'DistributedNPCPetshopAI.fishSold busy with %s' % self.busy) self.notify.warning( 'somebody called fishSold that I was not busy with! avId: %s' % avId) return av = simbase.air.doId2do.get(avId) if av: trophyResult = self.air.fishManager.creditFishTank(av) if trophyResult: movieType = NPCToons.SELL_MOVIE_TROPHY extraArgs = [ len(av.fishCollection), FishGlobals.getTotalNumFish() ] else: movieType = NPCToons.SELL_MOVIE_COMPLETE extraArgs = [] self.d_setMovie(avId, movieType, extraArgs) self.transactionType = 'fish' self.sendClearMovie(None) return
def completeSale(self, sell): avId = self.air.getAvatarIdFromSender() if self.busy != avId: self.air.writeServerEvent('suspicious', avId=avId, issue='DistributedNPCFishermanAI.completeSale busy with %s' % self.busy) self.notify.warning('somebody called setMovieDone that I was not busy with! avId: %s' % avId) return if sell: av = simbase.air.doId2do.get(avId) if av: #maybe: recreate Disney-style fishManager that does the above code? trophyResult = self.air.fishManager.creditFishTank(av) if trophyResult: movieType = NPCToons.SELL_MOVIE_TROPHY extraArgs = [len(av.fishCollection), FishGlobals.getTotalNumFish()] else: movieType = NPCToons.SELL_MOVIE_COMPLETE extraArgs = [] self.d_setMovie(avId, movieType, extraArgs) else: av = simbase.air.doId2do.get(avId) if av: self.d_setMovie(avId, NPCToons.SELL_MOVIE_NOFISH) self.sendClearMovie(None) return
def updatePage(self): if hasattr(self, 'collectedTotal'): self.collectedTotal[ 'text'] = TTLocalizer.FishPageCollectedTotal % ( len(base.localAvatar.fishCollection), FishGlobals.getTotalNumFish()) if hasattr(self, 'rod'): rod = base.localAvatar.fishingRod rodName = TTLocalizer.FishingRodNameDict[rod] rodWeightRange = FishGlobals.getRodWeightRange(rod) self.rod['text'] = TTLocalizer.FishPageRodInfo % ( rodName, rodWeightRange[0], rodWeightRange[1]) if self.mode == FishPage_Tank: if hasattr(self, 'picker'): newTankFish = base.localAvatar.fishTank.getFish() self.picker.update(newTankFish) elif self.mode == FishPage_Collection: if hasattr(self, 'browser'): self.browser.update() elif self.mode == FishPage_Trophy: if hasattr(self, 'trophies'): for trophy in self.trophies: trophy.setLevel(-1) for trophyId in base.localAvatar.getFishingTrophies(): self.trophies[trophyId].setLevel(trophyId)
def updatePage(self): assert self.notify.debugStateCall(self) if hasattr(self, "collectedTotal"): # update the total collection self.collectedTotal['text'] = ( TTLocalizer.FishPageCollectedTotal % (len(base.localAvatar.fishCollection), FishGlobals.getTotalNumFish())) if hasattr(self, "rod"): # update the rod info on the picker rod = base.localAvatar.fishingRod rodName = TTLocalizer.FishingRodNameDict[rod] rodWeightRange = FishGlobals.getRodWeightRange(rod) self.rod['text'] = TTLocalizer.FishPageRodInfo % ( rodName, rodWeightRange[0], rodWeightRange[1]) if self.mode == FishPage_Tank: if hasattr(self, "picker"): # the fish list may have changed, update the picker newTankFish = base.localAvatar.fishTank.getFish() self.picker.update(newTankFish) elif self.mode == FishPage_Collection: if hasattr(self, "browser"): # the fish gallery may have changed, update the browser self.browser.update() elif self.mode == FishPage_Trophy: if hasattr(self, "trophies"): # the fishing trophy list may have changed, update the display for trophy in self.trophies: trophy.setLevel(-1) for trophyId in base.localAvatar.getFishingTrophies(): self.trophies[trophyId].setLevel(trophyId)
def completeSale(self, sell): avId = self.air.getAvatarIdFromSender() if self.busy != avId: self.air.writeServerEvent('suspicious', avId, 'DistributedNPCFishermanAI.completeSale busy with %s' % self.busy) self.notify.warning('somebody called setMovieDone that I was not busy with! avId: %s' % avId) return for spot in self.air.hoodId2Hood[ZoneUtil.getCanonicalBranchZone(self.zoneId)].fishingSpots: if spot.avId == avId: self.sendClearMovie(None) return if sell: av = simbase.air.doId2do.get(avId) if av: #maybe: recreate Disney-style fishManager that does the above code? trophyResult = self.air.fishManager.creditFishTank(av) if trophyResult: movieType = NPCToons.SELL_MOVIE_TROPHY extraArgs = [len(av.fishCollection), FishGlobals.getTotalNumFish()] else: movieType = NPCToons.SELL_MOVIE_COMPLETE extraArgs = [] self.d_setMovie(avId, movieType, extraArgs) else: av = simbase.air.doId2do.get(avId) if av: self.d_setMovie(avId, NPCToons.SELL_MOVIE_NOFISH) self.sendClearMovie(None) return
def __showSellFishConfirmDialog(self, numFishCaught): self.__makeGui() msg = TTLocalizer.STOREOWNER_TROPHY % ( numFishCaught, FishGlobals.getTotalNumFish(), ) self.sellFishConfirmDialog.setMessage(msg) self.sellFishConfirmDialog.show()
def fishSold(self): avId = self.air.getAvatarIdFromSender() if self.busy != avId: self.air.writeServerEvent('suspicious', avId=avId, issue='DistributedNPCPetshopAI.fishSold busy with %s' % self.busy) self.notify.warning('somebody called fishSold that I was not busy with! avId: %s' % avId) return av = simbase.air.doId2do.get(avId) if av: trophyResult = self.air.fishManager.creditFishTank(av) if trophyResult: movieType = NPCToons.SELL_MOVIE_TROPHY extraArgs = [len(av.fishCollection), FishGlobals.getTotalNumFish()] else: movieType = NPCToons.SELL_MOVIE_COMPLETE extraArgs = [] self.d_setMovie(avId, movieType, extraArgs) self.transactionType = 'fish' self.sendClearMovie(None)
def __showSellFishConfirmDialog(self, numFishCaught): self.__makeGui() msg = TTLocalizer.STOREOWNER_TROPHY % (numFishCaught, FishGlobals.getTotalNumFish()) self.sellFishConfirmDialog.setMessage(msg) self.sellFishConfirmDialog.show()
def updatePage(self): if hasattr(self, 'collectedTotal'): self.collectedTotal['text'] = TTLocalizer.FishPageCollectedTotal % (len(base.localAvatar.fishCollection), FishGlobals.getTotalNumFish()) if hasattr(self, 'rod'): rod = base.localAvatar.fishingRod rodName = TTLocalizer.FishingRodNameDict[rod] rodWeightRange = FishGlobals.getRodWeightRange(rod) self.rod['text'] = TTLocalizer.FishPageRodInfo % (rodName, rodWeightRange[0], rodWeightRange[1]) if self.mode == FishPage_Tank: if hasattr(self, 'picker'): newTankFish = base.localAvatar.fishTank.getFish() self.picker.update(newTankFish) elif self.mode == FishPage_Collection: if hasattr(self, 'browser'): self.browser.update() elif self.mode == FishPage_Trophy: if hasattr(self, 'trophies'): for trophy in self.trophies: trophy.setLevel(-1) for trophyId in base.localAvatar.getFishingTrophies(): self.trophies[trophyId].setLevel(trophyId)
def completeFishSale(self): avId = self.air.getAvatarIdFromSender() av = self.air.doId2do.get(avId) if not av: return if self.air.fishManager.creditFishTank(av): self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()]) else: self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_COMPLETE, 0, 0])
def completeFishSale(self): avId = self.air.getAvatarIdFromSender() av = self.air.doId2do.get(avId) if not av: return if self.air.fishManager.creditFishTank(av): self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()]) else: self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_COMPLETE, 0, 0])