def _populate(self): super(ClanSearchWindow, self)._populate() self._searchDP = _ClanSearchDataProvider() self._searchDP.setFlashObject(self.as_getDPS()) self.startClanListening() self.__clanFinder.onListUpdated += self._onClansListUpdated self.__initControls() self._updateControlsState() self._cooldown.start() if not g_clanCtrl.getAccountProfile().isSynced(): g_clanCtrl.getAccountProfile().resync() self.__clanFinder.setRecommended(True) self.__doSearch('')
def _addInviteClanInfo(self, options, userCMInfo): if g_lobbyContext.getServerSettings().clanProfile.isEnabled() and not userCMInfo.hasClan: profile = g_clanCtrl.getAccountProfile() canHandleClanInvites = profile.getMyClanPermissions().canHandleClanInvites() if profile.isInClan() and canHandleClanInvites: isEnabled = g_clanCtrl.isAvailable() canHandleClanInvites = profile.getMyClanPermissions().canHandleClanInvites() if isEnabled: profile = g_clanCtrl.getAccountProfile() dossier = profile.getClanDossier() isEnabled = canHandleClanInvites and not dossier.isClanInviteSent(userCMInfo.databaseID) and not dossier.hasClanApplication(userCMInfo.databaseID) options.append(self._makeItem(USER.SEND_CLAN_INVITE, MENU.contextmenu(USER.SEND_CLAN_INVITE), optInitData={'enabled': isEnabled})) return options
def userAddToClan(self): self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {}) profile = g_clanCtrl.getAccountProfile() context = CreateInviteCtx(profile.getClanDbID(), [self.__databaseID]) result = yield g_clanCtrl.sendRequest(context, allowDelay=True) showClanInviteSystemMsg(self.__userName, result.isSuccess(), result.getCode()) self.__updateAddToClanBtn() self.as_hideWaitingS()
def userAddToClan(self): self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {}) profile = g_clanCtrl.getAccountProfile() context = CreateInviteCtx(profile.getClanDbID(), [self.__databaseID]) result = yield g_clanCtrl.sendRequest(context, allowDelay=True) if result.isSuccess(): SystemMessages.pushMessage(clans_fmts.getAppSentSysMsg(profile.getClanName(), profile.getClanAbbrev())) self.as_hideWaitingS()
def sendClanInvite(self): profile = g_clanCtrl.getAccountProfile() context = CreateInviteCtx(profile.getClanDbID(), [self.databaseID]) result = yield g_clanCtrl.sendRequest(context, allowDelay=True) if result.isSuccess(): SystemMessages.pushMessage(clans_fmts.getAppSentSysMsg(profile.getClanName(), profile.getClanAbbrev())) else: SystemMessages.pushMessage(clans_fmts.getInvitesNotSentSysMsg([self.userName or '']), type=SystemMessages.SM_TYPE.Error)
def onClanProfileClick(self): if self.clansCtrl.isEnabled(): clan = g_clanCtrl.getAccountProfile() shared_events.showClanProfileWindow(clan.getClanDbID(), clan.getClanAbbrev()) else: LOG_ERROR( "Couldn't invoke Clan Profile Window. Functionality is Unavailable!" )
def _getButtonsStates(self, entity): if self._state in ( CLAN_INVITE_STATES.ACCEPTED, CLAN_INVITE_STATES.DECLINED ) or g_clanCtrl.getAccountProfile().isInClan( ) or not g_clanCtrl.isEnabled() or self.__isInClanEnterCooldown(): submit = cancel = NOTIFICATION_BUTTON_STATE.HIDDEN elif not g_clanCtrl.isAvailable(): submit = cancel = NOTIFICATION_BUTTON_STATE.VISIBLE else: submit = cancel = NOTIFICATION_BUTTON_STATE.DEFAULT return {'submit': submit, 'cancel': cancel}
def _getButtonsStates(self, entity): if ( self._state in (CLAN_APPLICATION_STATES.ACCEPTED, CLAN_APPLICATION_STATES.DECLINED) or not g_clanCtrl.getAccountProfile().getMyClanPermissions().canHandleClanInvites() or not g_clanCtrl.isEnabled() ): submit = cancel = NOTIFICATION_BUTTON_STATE.HIDDEN elif not g_clanCtrl.isAvailable(): submit = cancel = NOTIFICATION_BUTTON_STATE.VISIBLE else: submit = cancel = NOTIFICATION_BUTTON_STATE.DEFAULT return {"submit": submit, "cancel": cancel}
def _getButtonsStates(self, entity): if self._state in ( CLAN_APPLICATION_STATES.ACCEPTED, CLAN_APPLICATION_STATES.DECLINED ) or not g_clanCtrl.getAccountProfile().getMyClanPermissions( ).canHandleClanInvites() or not g_clanCtrl.isEnabled(): submit = cancel = NOTIFICATION_BUTTON_STATE.HIDDEN elif not g_clanCtrl.isAvailable(): submit = cancel = NOTIFICATION_BUTTON_STATE.VISIBLE else: submit = cancel = NOTIFICATION_BUTTON_STATE.DEFAULT return {'submit': submit, 'cancel': cancel}
def _getButtonsStates(self, entity): if ( self._state in (CLAN_INVITE_STATES.ACCEPTED, CLAN_INVITE_STATES.DECLINED) or g_clanCtrl.getAccountProfile().isInClan() or not g_clanCtrl.isEnabled() or self.__isInClanEnterCooldown() ): submit = cancel = NOTIFICATION_BUTTON_STATE.HIDDEN elif not g_clanCtrl.isAvailable(): submit = cancel = NOTIFICATION_BUTTON_STATE.VISIBLE else: submit = cancel = NOTIFICATION_BUTTON_STATE.DEFAULT return {"submit": submit, "cancel": cancel}
def __isInClanEnterCooldown(self): profile = g_clanCtrl.getAccountProfile() return not profile.isInClan() and profile.isInClanEnterCooldown()
def _maySeeFortUpgradeWindow(): profile = g_clanCtrl.getAccountProfile() return profile.isInClan() and profile.getRole( ) == CLAN_MEMBER_FLAGS.RECRUIT
def _maySeeFortUpgradeWindow(): profile = g_clanCtrl.getAccountProfile() return profile.isInClan() and profile.getRole() == CLAN_MEMBER_FLAGS.RECRUIT
def onClanProfileClick(self): if self.clansCtrl.isEnabled(): clan = g_clanCtrl.getAccountProfile() shared_events.showClanProfileWindow(clan.getClanDbID(), clan.getClanAbbrev()) else: LOG_ERROR("Couldn't invoke Clan Profile Window. Functionality is Unavailable!")
def sendClanInvite(self): profile = g_clanCtrl.getAccountProfile() userName = self.userName context = CreateInviteCtx(profile.getClanDbID(), [self.databaseID]) result = yield g_clanCtrl.sendRequest(context, allowDelay=True) showClanInviteSystemMsg(userName, result.isSuccess(), result.getCode())
def _addInviteClanInfo(self, options, userCMInfo): if g_lobbyContext.getServerSettings().clanProfile.isEnabled() and not userCMInfo.hasClan: profile = g_clanCtrl.getAccountProfile() if profile.isInClan() and profile.getMyClanPermissions().canHandleClanInvites(): options.append(self._makeItem(USER.SEND_CLAN_INVITE, MENU.contextmenu(USER.SEND_CLAN_INVITE), optInitData={'enabled': g_clanCtrl.isAvailable()})) return options