//! Возвращает словарь из диалогов для локализации (устаревшие, актуальные или все) public DifferenceDict getDialogDifference(string locale, FindType findType) { //System.Console.WriteLine("CDialogs::getDialogDifference"); DifferenceDict ret = new DifferenceDict(); if (this.locales.Keys.Contains(locale)) { var cur_locale_info = this.locales[locale]; foreach (var npc_name in dialogs.Keys) { if (!cur_locale_info.Keys.Contains(npc_name)) { continue; } var locale_dialogs = cur_locale_info[npc_name]; foreach (var dialog in dialogs[npc_name].Values) { var locale_version = 0; if (locale_dialogs.Keys.Contains(dialog.DialogID)) { locale_version = locale_dialogs[dialog.DialogID].version; } if (!ret.Keys.Contains(npc_name)) { ret.Add(npc_name, new Dictionary <int, CDifference>()); } switch (findType) { case FindType.all: ret[npc_name].Add(dialog.DialogID, new CDifference(dialog.version, locale_version)); break; case FindType.outdatedOnly: if (dialog.version != locale_version) { ret[npc_name].Add(dialog.DialogID, new CDifference(dialog.version, locale_version)); } break; case FindType.actualOnly: if (dialog.version == locale_version) { ret[npc_name].Add(dialog.DialogID, new CDifference(dialog.version, locale_version)); } break; } } } } //foreach (var name in ret.Keys) // { // System.Console.WriteLine(name + ":"); // foreach (var id in ret[name]) // System.Console.WriteLine("id:"+id.ToString()); // } return(ret); }
//! Возвращает словарь из квестов для локализации (устаревшие, актуальные или все) public DifferenceDict getQuestDifference(string locale, FindType findType) { //System.Console.WriteLine("CQuests::getQuestDifference"); QuestLocales sorted_locale = new QuestLocales(); if (this.locales.Keys.Contains(locale)) { foreach (var locale_quest in this.locales[locale].Values) { if (!sorted_locale.Keys.Contains(locale_quest.Additional.Holder)) { sorted_locale.Add(locale_quest.Additional.Holder, new Dictionary <int, CQuest>()); } sorted_locale[locale_quest.Additional.Holder].Add(locale_quest.QuestID, locale_quest); } } DifferenceDict ret = new DifferenceDict(); foreach (var cur_quest in quest.Values) { if (sorted_locale.Keys.Contains(cur_quest.Additional.Holder)) { CQuest locale_quest = new CQuest(); locale_quest.Version = 0; if (sorted_locale[cur_quest.Additional.Holder].Keys.Contains(cur_quest.QuestID)) { locale_quest.Version = sorted_locale[cur_quest.Additional.Holder][cur_quest.QuestID].Version; } if (!ret.Keys.Contains(cur_quest.Additional.Holder)) { ret.Add(cur_quest.Additional.Holder, new Dictionary <int, CDifference>()); } switch (findType) { case FindType.all: ret[cur_quest.Additional.Holder].Add(cur_quest.QuestID, new CDifference(cur_quest.Version, locale_quest.Version)); break; case FindType.outdatedOnly: if (cur_quest.Version != locale_quest.Version) { ret[cur_quest.Additional.Holder].Add(cur_quest.QuestID, new CDifference(cur_quest.Version, locale_quest.Version)); } break; case FindType.actualOnly: if (cur_quest.Version == locale_quest.Version) { ret[cur_quest.Additional.Holder].Add(cur_quest.QuestID, new CDifference(cur_quest.Version, locale_quest.Version)); } break; } } } //foreach (var locale_npc_name in sorted_locale.Keys) //{ // foreach (var locale_quest in sorted_locale[locale_npc_name].Values) // { // var locale_version = locale_quest.Version; // var quest = this.quest[locale_quest.QuestID]; // if (quest.Version != locale_version) // { // if (sorted_locale[locale_npc_name].Any()) // ret.Add(locale_npc_name, new Dictionary<int, CDifference>()); // ret[locale_npc_name].Add(quest.QuestID, new CDifference(quest.Version, locale_version)); // } // } //} /* * foreach (var name in ret.Keys) * { * System.Console.WriteLine("npc:" + name); * foreach (var quest_id in ret[name].Keys) * System.Console.WriteLine("id:" + quest_id.ToString()); * } */ return(ret); }