diff options
author | bexnoss <82064510+bexnoss@users.noreply.github.com> | 2022-01-12 14:26:02 +0100 |
---|---|---|
committer | bexnoss <82064510+bexnoss@users.noreply.github.com> | 2022-01-12 14:26:02 +0100 |
commit | a1ff3b1ee34c302ba52d773816207d30badab1eb (patch) | |
tree | ac4fbbddfab2ffbd9b1949d5b51857a528c69035 /launcher/minecraft/auth/AccountData.cpp | |
parent | d4b522b6cb5281df02da54cd9e0f6445770e7ec7 (diff) | |
download | PrismLauncher-a1ff3b1ee34c302ba52d773816207d30badab1eb.tar.gz PrismLauncher-a1ff3b1ee34c302ba52d773816207d30badab1eb.tar.bz2 PrismLauncher-a1ff3b1ee34c302ba52d773816207d30badab1eb.zip |
Add offline mode support
Diffstat (limited to 'launcher/minecraft/auth/AccountData.cpp')
-rw-r--r-- | launcher/minecraft/auth/AccountData.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/launcher/minecraft/auth/AccountData.cpp b/launcher/minecraft/auth/AccountData.cpp index 7526c951..9b84fe1a 100644 --- a/launcher/minecraft/auth/AccountData.cpp +++ b/launcher/minecraft/auth/AccountData.cpp @@ -314,6 +314,8 @@ bool AccountData::resumeStateFromV3(QJsonObject data) { type = AccountType::MSA; } else if (typeS == "Mojang") { type = AccountType::Mojang; + } else if (typeS == "Offline") { + type = AccountType::Offline; } else { qWarning() << "Failed to parse account data: type is not recognized."; return false; @@ -363,6 +365,9 @@ QJsonObject AccountData::saveState() const { tokenToJSONV3(output, xboxApiToken, "xrp-main"); tokenToJSONV3(output, mojangservicesToken, "xrp-mc"); } + else if (type == AccountType::Offline) { + output["type"] = "Offline"; + } tokenToJSONV3(output, yggdrasilToken, "ygg"); profileToJSONV3(output, minecraftProfile, "profile"); @@ -371,7 +376,7 @@ QJsonObject AccountData::saveState() const { } QString AccountData::userName() const { - if(type != AccountType::Mojang) { + if(type == AccountType::MSA) { return QString(); } return yggdrasilToken.extra["userName"].toString(); @@ -427,6 +432,9 @@ QString AccountData::accountDisplayString() const { case AccountType::Mojang: { return userName(); } + case AccountType::Offline: { + return userName(); + } case AccountType::MSA: { if(xboxApiToken.extra.contains("gtg")) { return xboxApiToken.extra["gtg"].toString(); |