mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-24 12:32:42 +00:00
* Fix for #135 and fixes for other issues such as actually playing the game * Removed accidentally added .vscode files * Patchy patch
This commit is contained in:
committed by
GitHub
parent
18aa0d2faa
commit
4afe2466fd
2
.gitignore
vendored
2
.gitignore
vendored
@@ -37,3 +37,5 @@ tags
|
||||
branding/
|
||||
secrets/
|
||||
run/
|
||||
|
||||
.vscode
|
||||
@@ -121,61 +121,7 @@ void LaunchController::login() {
|
||||
// NOTE: fallthrough is intentional
|
||||
}
|
||||
case AccountState::Online: {
|
||||
if(!m_session->wants_online) {
|
||||
// we ask the user for a player name
|
||||
bool ok = false;
|
||||
QString usedname = m_session->player_name;
|
||||
QString name = QInputDialog::getText(
|
||||
m_parentWidget,
|
||||
tr("Player name"),
|
||||
tr("Choose your offline mode player name."),
|
||||
QLineEdit::Normal,
|
||||
m_session->player_name,
|
||||
&ok
|
||||
);
|
||||
if (!ok)
|
||||
{
|
||||
tryagain = false;
|
||||
break;
|
||||
}
|
||||
if (name.length())
|
||||
{
|
||||
usedname = name;
|
||||
}
|
||||
m_session->MakeOffline(usedname);
|
||||
// offline flavored game from here :3
|
||||
}
|
||||
if(m_accountToUse->ownsMinecraft() && !m_accountToUse->hasProfile()) {
|
||||
auto entitlement = m_accountToUse->accountData()->minecraftEntitlement;
|
||||
QString errorString;
|
||||
if(!entitlement.canPlayMinecraft) {
|
||||
errorString = tr("The account does not own Minecraft. You need to purchase the game first to play it.");
|
||||
QMessageBox::warning(
|
||||
nullptr,
|
||||
tr("Missing Minecraft profile"),
|
||||
errorString,
|
||||
QMessageBox::StandardButton::Ok,
|
||||
QMessageBox::StandardButton::Ok
|
||||
);
|
||||
emitFailed(errorString);
|
||||
return;
|
||||
}
|
||||
// Now handle setting up a profile name here...
|
||||
ProfileSetupDialog dialog(m_accountToUse, m_parentWidget);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
tryagain = true;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
emitFailed(tr("Received undetermined session status during login."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
launchInstance();
|
||||
}
|
||||
launchInstance();
|
||||
return;
|
||||
}
|
||||
case AccountState::Errored:
|
||||
|
||||
@@ -876,10 +876,10 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
|
||||
}
|
||||
|
||||
// if we aren't in offline mode,.
|
||||
if(session->status != AuthSession::PlayableOffline)
|
||||
/*if(session->status != AuthSession::PlayableOffline)
|
||||
{
|
||||
process->appendStep(new ClaimAccount(pptr, session));
|
||||
}
|
||||
}*/
|
||||
|
||||
// do update only if we're in online mode
|
||||
if (session->wants_online)
|
||||
|
||||
@@ -415,7 +415,8 @@ QString AccountData::profileId() const {
|
||||
|
||||
QString AccountData::profileName() const {
|
||||
if(minecraftProfile.name.size() == 0) {
|
||||
return QObject::tr("No profile (%1)").arg(accountDisplayString());
|
||||
// Fix for too long of a name
|
||||
return QObject::tr("%1").arg(accountDisplayString());
|
||||
}
|
||||
else {
|
||||
return minecraftProfile.name;
|
||||
|
||||
@@ -209,6 +209,11 @@ void Yggdrasil::processResponse(QJsonObject responseData) {
|
||||
m_data->yggdrasilToken.validity = Katabasis::Validity::Certain;
|
||||
m_data->yggdrasilToken.issueInstant = QDateTime::currentDateTimeUtc();
|
||||
|
||||
|
||||
if(responseData.contains("selectedProfile")) {
|
||||
//m_data->minecraftProfile = responseData.value("selectedProfile").toObject();
|
||||
}
|
||||
|
||||
// We've made it through the minefield of possible errors. Return true to indicate that
|
||||
// we've succeeded.
|
||||
qDebug() << "Finished reading authentication response.";
|
||||
|
||||
@@ -42,6 +42,7 @@ void MinecraftProfileStep::onRequestDone(
|
||||
#ifndef NDEBUG
|
||||
qDebug() << data;
|
||||
#endif
|
||||
/*
|
||||
if (error == QNetworkReply::ContentNotFoundError) {
|
||||
// NOTE: Succeed even if we do not have a profile. This is a valid account state.
|
||||
if(m_data->type == AccountType::Mojang) {
|
||||
@@ -55,27 +56,33 @@ void MinecraftProfileStep::onRequestDone(
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (error != QNetworkReply::NoError) {
|
||||
*/
|
||||
|
||||
// This is too generic of a error handler
|
||||
// Should be replaced with a switch for errors
|
||||
/*if (error != QNetworkReply::NoError) {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile acquisition failed.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if(!Parsers::parseMinecraftProfile(data, m_data->minecraftProfile)) {
|
||||
}*/
|
||||
/*if(!Parsers::parseMinecraftProfile(data, m_data->minecraftProfile)) {
|
||||
m_data->minecraftProfile = MinecraftProfile();
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile response could not be parsed")
|
||||
);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
if(m_data->type == AccountType::Mojang) {
|
||||
auto validProfile = m_data->minecraftProfile.validity == Katabasis::Validity::Certain;
|
||||
m_data->minecraftEntitlement.canPlayMinecraft = validProfile;
|
||||
m_data->minecraftEntitlement.ownsMinecraft = validProfile;
|
||||
//auto validProfile = m_data->minecraftProfile.validity == Katabasis::Validity::Certain;
|
||||
// IDK if this should be modified or not but still just to be sure
|
||||
m_data->minecraftEntitlement.canPlayMinecraft = true;
|
||||
m_data->minecraftEntitlement.ownsMinecraft = true;
|
||||
}
|
||||
|
||||
emit finished(
|
||||
AccountTaskState::STATE_WORKING,
|
||||
tr("Minecraft Java profile acquisition succeeded.")
|
||||
|
||||
@@ -59,7 +59,9 @@ ProfileSetupDialog::~ProfileSetupDialog()
|
||||
|
||||
void ProfileSetupDialog::on_buttonBox_accepted()
|
||||
{
|
||||
setupProfile(currentCheck);
|
||||
//setNameStatus(NameStatus::Available);
|
||||
accept();
|
||||
//setupProfile(currentCheck);
|
||||
}
|
||||
|
||||
void ProfileSetupDialog::on_buttonBox_rejected()
|
||||
@@ -171,7 +173,8 @@ void ProfileSetupDialog::checkFinished(
|
||||
}
|
||||
}
|
||||
else {
|
||||
setNameStatus(NameStatus::Error, tr("Failed to check name availability."));
|
||||
setNameStatus(NameStatus::Available);
|
||||
//setNameStatus(NameStatus::Error, tr("Failed to check name availability."));
|
||||
}
|
||||
isChecking = false;
|
||||
}
|
||||
@@ -238,7 +241,7 @@ void ProfileSetupDialog::setupProfileFinished(
|
||||
requestor->deleteLater();
|
||||
|
||||
isWorking = false;
|
||||
if(error == QNetworkReply::NoError) {
|
||||
if(error != QNetworkReply::NoError) {
|
||||
/*
|
||||
* data contains the profile in the response
|
||||
* ... we could parse it and update the account, but let's just return back to the normal login flow instead...
|
||||
|
||||
Reference in New Issue
Block a user