|
@@ -107,7 +107,7 @@ namespace LOTRO_DAT {
|
|
|
offset += 4;
|
|
|
for (size_t i = 0; i < orig_dict_size; i++) {
|
|
|
auto file = SubFile(*dat, dicts_data.CutData(offset, offset + 32));
|
|
|
- file.category = dicts_data.ToNumber<4>(offset);
|
|
|
+ file.category = dicts_data.ToNumber<4>(offset + 32);
|
|
|
orig_dict_[file.file_id()] = file;
|
|
|
offset += 36;
|
|
|
}
|
|
@@ -116,13 +116,22 @@ namespace LOTRO_DAT {
|
|
|
offset += 4;
|
|
|
for (size_t i = 0; i < patch_dict_size; i++) {
|
|
|
auto file = SubFile(*dat, dicts_data.CutData(offset, offset + 32));
|
|
|
- file.category = dicts_data.ToNumber<4>(offset);
|
|
|
+ file.category = dicts_data.ToNumber<4>(offset + 32);
|
|
|
patch_dict_[file.file_id()] = file;
|
|
|
offset += 36;
|
|
|
}
|
|
|
|
|
|
+ size_t inactive_categories_set_size = size_t(dicts_data.ToNumber<4>(offset));
|
|
|
+ offset += 4;
|
|
|
+ for (size_t i = 0; i < inactive_categories_set_size; i++) {
|
|
|
+ size_t category_id = size_t(dicts_data.ToNumber<4>(offset));
|
|
|
+ inactive_categories.insert(category_id);
|
|
|
+ offset += 4;
|
|
|
+ }
|
|
|
+
|
|
|
LOG(INFO) << "There are " << patch_dict_.size() << " files in patch locale dictionary";
|
|
|
LOG(INFO) << "There are " << orig_dict_.size() << " files in original locale dictionary";
|
|
|
+ LOG(INFO) << "There are " << inactive_categories.size() << " categories inactive: ";
|
|
|
LOG(INFO) << "Finished initialising locales";
|
|
|
|
|
|
if (CheckLocaleCorrect()) {
|
|
@@ -170,7 +179,17 @@ namespace LOTRO_DAT {
|
|
|
}
|
|
|
|
|
|
std::map<long long, SubFile> &dict = GetLocaleDictReference(locale);
|
|
|
+
|
|
|
+ size_t files_total = dict.size();
|
|
|
+ size_t files_proceeded = 0;
|
|
|
+
|
|
|
for (const auto &file : dict) {
|
|
|
+ ++files_proceeded;
|
|
|
+ dat->GetStatusModule().SetPercentage(files_proceeded * 100 / files_total);
|
|
|
+
|
|
|
+ if (CategoryIsInactive(file.second.category) && locale == PATCHED)
|
|
|
+ continue;
|
|
|
+
|
|
|
long long file_id = file.first;
|
|
|
|
|
|
auto dict_file_result = dat->GetFileSystem().GetFile(file_id);
|
|
@@ -534,4 +553,48 @@ namespace LOTRO_DAT {
|
|
|
inactive_categories.clear();
|
|
|
current_locale_ = LOCALE(-1);
|
|
|
}
|
|
|
+
|
|
|
+ DatOperationResult<> DatLocaleManager::EnableCategory(long long category) {
|
|
|
+ inactive_categories.erase(category);
|
|
|
+ dat->GetStatusModule().SetStatus(DatStatus::E_COMMITING);
|
|
|
+ dat->GetStatusModule().SetPercentage(0);
|
|
|
+
|
|
|
+ size_t files_count = patch_dict_.size();
|
|
|
+ size_t files_processed = 0;
|
|
|
+
|
|
|
+ for (const auto& entry : patch_dict_) {
|
|
|
+ SubFile file = entry.second;
|
|
|
+ ++files_processed;
|
|
|
+ dat->GetStatusModule().SetPercentage(files_processed * 100 / files_count);
|
|
|
+
|
|
|
+ if (file.category == category) {
|
|
|
+ dat->GetFileSystem().UpdateFileInfo(file);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dat->GetStatusModule().ClearAll();
|
|
|
+ return DatOperationResult<>(SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ DatOperationResult<> DatLocaleManager::DisableCategory(long long category) {
|
|
|
+ inactive_categories.insert(category);
|
|
|
+ dat->GetStatusModule().SetStatus(DatStatus::E_COMMITING);
|
|
|
+ dat->GetStatusModule().SetPercentage(0);
|
|
|
+
|
|
|
+ size_t files_count = orig_dict_.size();
|
|
|
+ size_t files_processed = 0;
|
|
|
+
|
|
|
+ for (const auto& entry : orig_dict_) {
|
|
|
+ SubFile file = entry.second;
|
|
|
+ ++files_processed;
|
|
|
+ dat->GetStatusModule().SetPercentage(files_processed * 100 / files_count);
|
|
|
+
|
|
|
+ if (file.category == category) {
|
|
|
+ dat->GetFileSystem().UpdateFileInfo(file);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dat->GetStatusModule().ClearAll();
|
|
|
+ return DatOperationResult<>(SUCCESS);
|
|
|
+ }
|
|
|
}
|