Skip to content

Commit

Permalink
Update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinglykrab committed Oct 15, 2024
1 parent 5ee0e0f commit fc0122b
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions zone/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,22 +714,32 @@ void UpdateWindowTitle(char *iNewTitle)

bool CheckForCompatibleQuestPlugins()
{
std::vector<std::string> files = {
"quests/plugins/check_handin.pl",
"lua_modules/items.lua",
};

bool found = true;
for (const auto &file : files) {
auto f = path.GetServerPath() + "/" + file;
if (File::Exists(f)) {
auto r = File::GetContents(std::filesystem::path{f}.string());
if (!Strings::Contains(r.contents, "CheckHandin")) {
found = false;
break;
const std::vector<std::string>& directories = { "lua_modules", "plugins" };

bool lua_found = true;
bool perl_found = true;

for (const auto& directory : directories) {
for (const auto& file : fs::directory_iterator(path.GetServerPath() + "/" + directory)) {
if (file.is_regular_file()) {
auto f = path.GetServerPath() + "/" + file.path().string();
if (File::Exists(f)) {
auto r = File::GetContents(std::filesystem::path{ f }.string());
if (!Strings::Contains(r.contents, "CheckHandin")) {
if (Strings::EqualFold(directory, "lua_modules")) {
lua_found = false;
LogError("Failed to find CheckHandin in lua_modules");
} else if (Strings::EqualFold(directory, "plugins")) {
perl_found = false;
LogError("Failed to find CheckHandin in plugins");
}

break;
}
}
}
}
}

return found;
return lua_found && perl_found;
}

0 comments on commit fc0122b

Please sign in to comment.