def handleSendGuildInvite(self,errormsg,variables): a = () for var in variables: a = a + (var,) if g.popupWindow is not None: g.popupWindow.delete() popUpConfirm(WARNINGS[errormsg][0] % a,on_cancel=cancelGuildInvite,on_ok=acceptGuildInvite)
def meneNameConfirmFight(menename1): menename = ''.join(char for char in menename1 if special_match(char)) if len(menename) > 12 or len(menename) < 1: popUpWindow(WARNINGS["INVALID_MENE_NAME"][0] % (menename)) return popUpConfirm(WARNINGS["YOUR_MENE_NAME"][0] % (menename), on_ok=sendMeneNameConfirm, argument=menename)
def handleMeneConfirm(self,menename): def removeDisable(event): g.gameEngine.loginMenu.saveBtn.disabled = False def onOk(event): packet = json.dumps([{"p": ClientPackets.SendMeneNameDouble}]) g.tcpConn.sendData(packet) if g.popupWindow is not None: g.popupWindow.delete() popUpConfirm(menename + " will be your mene's name.",on_cancel=removeDisable,on_ok=onOk)
def newGuild(self, name): tmpName = ''.join(char for char in name if special_match(char)) g.tmpName = " ".join(tmpName.split()).lstrip().rstrip() if len(g.tmpName) < 3: constructText(WARNINGS["GUILD_NAME_TOO_SHORT"][0] % (g.tmpName), WARNINGS["GUILD_NAME_TOO_SHORT"][1]) g.tmpName = None else: popUpConfirm("Are you sure you want to create a guild named " + g.tmpName + "?", on_ok=createGuild)
def promoteGuild(self, event): access = GUILD_MEMBER for c in guildList: if c[0] == event: access = c[1] text = "" if g.myGuildAccess == GUILD_ADMIN and access == GUILD_MODERATOR: text = " and lose your status as a guild admin" popUpConfirm("Are you sure you want to promote " + event + text + "?", on_ok=promotePlayer, argument=event) closeSelectWindow(None)
def meneNameConfirm(menename1): menename = ''.join(char for char in menename1 if special_match(char)) g.gameEngine.loginMenu.saveBtn.disabled = False for c in meneList: if menename == c.name: popUpWindow("You already have a mene named " + menename + "!") return if len(menename) > 12 or len(menename) < 1: popUpWindow(WARNINGS["INVALID_MENE_NAME"][0] % (menename)) return popUpConfirm(WARNINGS["YOUR_MENE_NAME"][0] % (menename), on_ok=sendMeneNameConfirm, argument=menename)
def leaveMatchStartConfirm(argument): if g.popupWindow is None and g.turn == PLAYER_ONE_TURN: popUpConfirm(WARNINGS["LEAVE_MATCH"][0], on_ok=sendLeaveMatch)
def demoteGuild(self, event): popUpConfirm("Are you sure you want to demote " + event + "?", on_ok=demotePlayer, argument=event) closeSelectWindow(None)
def kickGuild(self, event): popUpConfirm("Are you sure you want to kick " + event + " from " + g.guildName + "?", on_ok=kickPlayer, argument=event) closeSelectWindow(None)
def leaveBtn(self, event): popUpConfirm("Are you sure you want to leave " + g.guildName + "?", on_ok=self.leaveGuild) closeSelectWindow(None)
def handleVersionOutdated(self): g.gameEngine.loginMenu.button.disabled = True g.updateAvailable=True if g.popupWindow is not None: g.popupWindow.delete() popUpConfirm(WARNINGS['UPDATE_AVAILABLE'][0],on_ok=startUpdate)