def _email(self) -> None: import urllib.parse # If somehow we got signed out. if _ba.get_account_state() != 'signed_in': ba.screenmessage(ba.Lstr(resource='notSignedInText'), color=(1, 0, 0)) ba.playsound(ba.getsound('error')) return ba.set_analytics_screen('Email Friend Code') subject = (ba.Lstr(resource='gatherWindow.friendHasSentPromoCodeText'). evaluate().replace( '${NAME}', _ba.get_account_name()).replace( '${APP_NAME}', ba.Lstr(resource='titleText').evaluate()).replace( '${COUNT}', str(self._data['tickets']))) body = (ba.Lstr(resource='gatherWindow.youHaveBeenSentAPromoCodeText'). evaluate().replace('${APP_NAME}', ba.Lstr(resource='titleText').evaluate()) + '\n\n' + str(self._data['code']) + '\n\n') body += ( (ba.Lstr(resource='gatherWindow.friendPromoCodeRedeemShortText'). evaluate().replace('${COUNT}', str(self._data['tickets']))) + '\n\n' + ba.Lstr(resource='gatherWindow.friendPromoCodeInstructionsText'). evaluate().replace('${APP_NAME}', ba.Lstr(resource='titleText').evaluate()) + '\n' + ba.Lstr(resource='gatherWindow.friendPromoCodeExpireText'). evaluate().replace('${EXPIRE_HOURS}', str( self._data['expireHours'])) + '\n' + ba.Lstr(resource='enjoyText').evaluate()) ba.open_url('mailto:?subject=' + urllib.parse.quote(subject) + '&body=' + urllib.parse.quote(body))
def _google_invites(self) -> None: ba.set_analytics_screen('App Invite UI') _ba.show_app_invite( ba.Lstr(resource='gatherWindow.appInviteTitleText', subs=[('${APP_NAME}', ba.Lstr(resource='titleText')) ]).evaluate(), ba.Lstr(resource='gatherWindow.appInviteMessageText', subs=[('${COUNT}', str(self._data['tickets'])), ('${NAME}', _ba.get_account_name().split()[0]), ('${APP_NAME}', ba.Lstr(resource='titleText')) ]).evaluate(), self._data['code'])
def _update_clipped_name(self) -> None: if not self._clipped_name_text: return name = self.get_name() if name == '__account__': name = (_ba.get_account_name() if _ba.get_account_state() == 'signed_in' else '???') if len(name) > 10 and not (self._global or self._is_account_profile): ba.textwidget(edit=self._clipped_name_text, text=ba.Lstr(resource='inGameClippedNameText', subs=[('${NAME}', name[:10] + '...')])) else: ba.textwidget(edit=self._clipped_name_text, text='')
def _google_invites(self) -> None: if self._data is None: ba.screenmessage(ba.Lstr( resource='getTicketsWindow.unavailableTemporarilyText'), color=(1, 0, 0)) ba.playsound(ba.getsound('error')) return if _ba.get_account_state() == 'signed_in': ba.set_analytics_screen('App Invite UI') _ba.show_app_invite( ba.Lstr(resource='gatherWindow.appInviteTitleText', subs=[('${APP_NAME}', ba.Lstr(resource='titleText')) ]).evaluate(), ba.Lstr(resource='gatherWindow.appInviteMessageText', subs=[('${COUNT}', str(self._data['tickets'])), ('${NAME}', _ba.get_account_name().split()[0]), ('${APP_NAME}', ba.Lstr(resource='titleText')) ]).evaluate(), self._data['code']) else: ba.playsound(ba.getsound('error'))