def confirmQuit(self): if self.gameFSM.getCurrentOrNextState() in ['Intro', 'Exit']: return if self.gameFSM.getCurrentOrNextState() not in ['Anim']: if self.closeCurrentDialog is not None: self.closeCurrentDialog() if self.gameFSM.gameStarted: self.confirm = PiratesConfirm.PiratesConfirm( PLocalizer.PotionGui['ExitTitle'], PLocalizer.PotionGui['AbortAndExitText'], self.onCloseConfirmed) self.confirm.bNo['command'] = self.onCloseDeclined self.closeCurrentDialog = self.cleanUpConfirm self.gameBoard.disableInputEvents() self.disableButtons() self.gameFSM.demand('ExitRequest') else: self.confirm = PiratesConfirm.PiratesConfirm( PLocalizer.PotionGui['ExitTitle'], PLocalizer.PotionGui['ExitText'], self.onCloseConfirmed) self.confirm.bNo['command'] = self.onQuitDeclined self.closeCurrentDialog = self.cleanUpConfirm self.gameFSM.demand('ExitRequest') self.confirm.setPos(0.35, 0, -0.17) else: self.askToExit = True return
def sendRoundComplete(self, round): localAvatar.skillDiary.clearRecharging(InventoryType.UseItem) localAvatar.guiMgr.combatTray.tonicButton.skillRingIval.finish() self.confirm = PiratesConfirm.PiratesConfirm( PLocalizer.ScrimmageRoundComplete % round, PLocalizer.ScrimmageRoundContinue, self.onCloseContinue) self.confirm.bNo['command'] = self.onCloseQuit
def selectRecipe(self, recipe): if self.gameFSM.state != 'RecipeSelect': return itemId = PotionGlobals.potionBuffIdToInventoryTypeId(recipe.potionID) inv = localAvatar.getInventory() if not inv: return quantity = inv.getItemQuantity(InventoryType.ItemTypeConsumable, itemId) limit = inv.getItemLimit(InventoryType.ItemTypeConsumable, itemId) if quantity >= limit: self.cleanUpConfirm() self.confirm = PiratesConfirm.PiratesConfirm( PLocalizer.PotionGui['MaxedOutTitle'], PLocalizer.PotionGui['MaxedOutText'], self.onSelectConfirmed) self.confirm.setPos(0.35, 0, -0.17) self.confirm.bOk['command'] = self.onSelectConfirmed self.confirm.bOk['extraArgs'] = [recipe] self.confirm.bNo['command'] = self.onSelectDeclined self.closeCurrentDialog = self.cleanUpConfirm self.gameBoard.disableInputEvents() self.disableButtons() else: self.gameFSM.request('StartGame', recipe)
def createGuild(self): if self.tokenEntry: self.tokenEntry.hide() self.confirmBox = PiratesConfirm.PiratesConfirm( PLocalizer.GuildPageCreateGuild, PLocalizer.GuildAskCreate, base.cr.guildManager.createGuild) if self.clearPermToken: self.clearPermToken['state'] = DGG.DISABLED if self.clearLimitedUseToken: self.clearLimitedUseToken['state'] = DGG.DISABLED
def leaveGuild(self): if localAvatar.getGuildRank() == GUILDRANK_GM and len( base.cr.guildManager.id2Name.keys()) > 1: self.confirmBox = PiratesInfo.PiratesInfo( PLocalizer.GuildPageLeaveGuild, [PLocalizer.GuildAskLeaveGM]) else: self.confirmBox = PiratesConfirm.PiratesConfirm( PLocalizer.GuildPageLeaveGuild, PLocalizer.GuildAskLeave, base.cr.guildManager.removeMember, base.localAvatar.getDoId()) if self.nameEntry: self.nameEntry.hide() self.nameLabel.show() self.recentlySentName = False self.permTokenValue = 0 self.clearLocalPermTokenValue() self.nonPermTokenCount = 0
def buyItem(self, uid, button, confirmed = False): if confirmed: color = button.color self.npc.sendRequestBarber(uid, color) if self.confirmBox: self.confirmBox.destroy() self.confirmBox = None elif self.confirmBox: self.confirmBox.destroy() self.confirmBox = None item = BarberGlobals.barber_id.get(uid) if not item: return None itemColor = button.color itemId = item[0] type = item[1] currentColor = localAvatar.style.getHairColor() if type == BarberGlobals.HAIR: current = [ localAvatar.style.getHairHair(), itemColor] elif type == BarberGlobals.BEARD: current = [ localAvatar.style.getHairBeard(), itemColor] elif type == BarberGlobals.MUSTACHE: current = [ localAvatar.style.getHairMustache(), itemColor] else: current = 0 if current == [ itemId, currentColor]: self.showCurrentlyOwnedAlert() else: text = PLocalizer.BarberConfirm % (str(item[3]), str(item[4])) self.confirmBox = PiratesConfirm.PiratesConfirm(PLocalizer.BarberPurchase, text, self.buyItem, barber = [ uid, button, True]) self.confirmBox.setPos(-self.confirmBox.getWidth() / 2, 0, -self.confirmBox.getHeight() / 2) self.confirmBox.setBin('gui-fixed', 1)
def confirmReturn(self): if self.gameFSM.getCurrentOrNextState() in ['Intro', 'Exit']: return None if self.gameFSM.getCurrentOrNextState() not in ['Anim']: if self.closeCurrentDialog is not None: self.closeCurrentDialog() self.closeCurrentDialog = self.cleanUpConfirm self.confirm = PiratesConfirm.PiratesConfirm( PLocalizer.PotionGui['SwitchTitle'], PLocalizer.PotionGui['SwitchText'], self.onReturnConfirmed) self.confirm.setPos(0.34999999999999998, 0, -0.17000000000000001) self.confirm.bNo['command'] = self.onCloseDeclined self.gameBoard.disableInputEvents() self.disableButtons() self.gameFSM.demand('SwitchRequest') else: self.askToReturn = True
def b_clearLimitedUseToken(self): self.confirmBox = PiratesConfirm.PiratesConfirm( PLocalizer.GuildClearLimUse, PLocalizer.GuildMessageClearLimInvite, self.executeClearLimitedUseToken, titleScale=PiratesGuiGlobals.TextScaleMed)