Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add easteregg for the jesus mod #1075

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 47 additions & 65 deletions loader/src/ui/mods/list/ModProblemItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,64 +156,59 @@ bool ModProblemItem::showFixButton() {

std::string ModProblemItem::createProblemMessage() {
std::stringstream ss;
std::string modName;

auto extractModName = [this, &modName]() {
std::string id = m_problem.message.substr(0, m_problem.message.find(" "));
if (auto found = Loader::get()->getInstalledMod(id)) {
modName = found->getName();
} else {
modName = id;
}
};

auto getPronoun = [&modName]() {
return modName == "Jesus" ? "His" : "its";
};

ss << m_source->getName() << " ";

switch (m_problem.type) {
case LoadProblem::Type::Unknown:
ss << "has encountered an unknown error while loading.";
return ss.str();
case LoadProblem::Type::Suggestion: {
std::string id = m_problem.message.substr(0, m_problem.message.find(" "));
if (auto found = Loader::get()->getInstalledMod(id)) {
ss << fmt::format(
"suggests enabling the {} mod.",
found->getName()
);
} else {
ss << "suggests " << m_problem.message << " to be installed.";
}
extractModName();
ss << fmt::format(
"suggests enabling the {} mod.",
modName
);
return ss.str();
}
case LoadProblem::Type::Recommendation: {
std::string id = m_problem.message.substr(0, m_problem.message.find(" "));
if (auto found = Loader::get()->getInstalledMod(id)) {
ss << fmt::format(
"recommends enabling the {} mod.",
found->getName()
);
} else {
ss << "recommends" << m_problem.message << " to be installed.";
}
extractModName();
ss << fmt::format(
"recommends enabling the {} mod.",
modName
);
return ss.str();
}
case LoadProblem::Type::OutdatedConflict:
case LoadProblem::Type::Conflict: {
if (auto found = Loader::get()->getInstalledMod(m_problem.message)) {
ss << fmt::format(
"conflicts with the {} mod.",
found->getName()
);
} else {
ss << fmt::format(
"conflicts with the {} mod.",
m_problem.message
);
}
extractModName();
ss << fmt::format(
"conflicts with the {} mod.",
modName
);
return ss.str();
}
case LoadProblem::Type::OutdatedIncompatibility:
case LoadProblem::Type::PresentIncompatibility: {
if (auto found = Loader::get()->getInstalledMod(m_problem.message)) {
ss << fmt::format(
"cannot work if the {} mod is enabled.",
found->getName()
);
} else {
ss << fmt::format(
"cannot work if the {} mod is enabled.",
m_problem.message
);
}
extractModName();
ss << fmt::format(
"cannot work if the {} mod is enabled.",
modName
);
return ss.str();
}
case LoadProblem::Type::InvalidFile: {
Expand All @@ -229,10 +224,9 @@ std::string ModProblemItem::createProblemMessage() {
return ss.str();
}
case LoadProblem::Type::LoadFailed: {
ss << "couldn't load its binary.";
ss << "couldn't load " << getPronoun() << " binary.";
return ss.str();
}
// This one isn't set in LoaderImpl at all
case LoadProblem::Type::EnableFailed: {
ss << "couldn't be enabled.";
return ss.str();
Expand All @@ -254,31 +248,19 @@ std::string ModProblemItem::createProblemMessage() {
return ss.str();
}
case LoadProblem::Type::OutdatedDependency: {
if (auto found = Loader::get()->getInstalledMod(m_problem.message)) {
ss << fmt::format(
"requires the {} mod to be updated.",
found->getName()
);
} else {
ss << fmt::format(
"requires the {} mod to be updated.",
m_problem.message
);
}
extractModName();
ss << fmt::format(
"requires the {} mod to be updated.",
modName
);
return ss.str();
}
case LoadProblem::Type::DisabledDependency: {
if (auto found = Loader::get()->getInstalledMod(m_problem.message)) {
ss << fmt::format(
"requires the {} mod to be enabled.",
found->getName()
);
} else {
ss << fmt::format(
"requires the {} mod to be enabled.",
m_problem.message
);
}
extractModName();
ss << fmt::format(
"requires the {} mod to be enabled.",
modName
);
return ss.str();
}
case LoadProblem::Type::MissingDependency: {
Expand All @@ -301,4 +283,4 @@ ModProblemItem* ModProblemItem::create(Mod* source, LoadProblem problem, CCSize

delete ret;
return nullptr;
}
}