Skip to content

Commit

Permalink
Add CheckForCompatibleQuestPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Akkadius committed Oct 15, 2024
1 parent c1c6516 commit 2238eaa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions zone/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void CatchSignal(int sig_num);

extern void MapOpcodes();

bool CheckForCompatibleQuestPlugins();
int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformZone);
Expand Down Expand Up @@ -367,6 +368,11 @@ int main(int argc, char **argv)
return 1;
}

if (!CheckForCompatibleQuestPlugins()) {
LogError("Incompatible quest plugins detected, please update your plugins to the latest version");
return 1;
}

// load these here for now until spells and items can be truly repointed to "content_db"
database.SetSharedItemsCount(content_db.GetItemsCount());
database.SetSharedSpellsCount(content_db.GetSpellsCount());
Expand Down Expand Up @@ -705,3 +711,25 @@ void UpdateWindowTitle(char *iNewTitle)
SetConsoleTitle(tmp);
#endif
}

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;
}
}
}

return found;
}

0 comments on commit 2238eaa

Please sign in to comment.