public EventsData(BasicTeraData basicData)
{
_basicData = basicData;
EventsCommon = new Dictionary<Event, List<Actions.Action>>();
var eventsdir = Path.Combine(_basicData.ResourceDirectory, "config/events");
try
{
Directory.CreateDirectory(eventsdir);
foreach (var pclass in Enum.GetNames(typeof(PlayerClass)))
{
var fname = Path.Combine(_basicData.ResourceDirectory, "config/events/events-" + pclass.ToLowerInvariant() + ".xml");
if (!File.Exists(fname))
File.WriteAllText(fname, LP.ResourceManager.GetString("events_" + pclass.ToLowerInvariant()));
}
}
catch (Exception ex)
{
BasicTeraData.LogError(ex.Message, true);
}
var windowFile = Path.Combine(_basicData.ResourceDirectory, "config/events/events-common.xml");
XDocument xml;
FileStream filestreamCommon;
try
{
filestreamCommon = new FileStream(windowFile, FileMode.Open, FileAccess.Read);
xml = XDocument.Load(filestreamCommon);
}
catch (Exception ex) when (ex is XmlException || ex is InvalidOperationException)
{
BasicTeraData.LogError(ex.Message, true, true);
Save();
return;
}
catch (Exception ex)
{
BasicTeraData.LogError(ex.Message, true, true);
return;
}
ParseAbnormalities(EventsCommon, xml);
ParseCooldown(EventsCommon, xml);
ParseCommonAFK(EventsCommon, xml);
}