public static Area LoadArea(string primary, string secondary = null, AreaPath.Table table = AreaPath.Table.Area) { Area area = null; string path = null; if ((area = LoadArea(primary, table)) != null) { return(area); } else if (secondary != null) { Log.LogS($"Area Path: {path} was not found >> Source: {primary}"); return(LoadArea(secondary, null)); } Log.LogS($"Area Path: {path} was not found >> Source: {primary} | {secondary}"); return(null); //throw new Exception("Area Failed to Load. Error Logged"); }
static Area LoadArea(string areaId, AreaPath.Table table) { try { return(Database.LoadRecord(table.ToString(), MongoDatabase.FilterEqual <Area, string>("AreaId", areaId)) ?? (table == AreaPath.Table.Dungeons ? Database.LoadRecord("Area", MongoDatabase.FilterEqual <Area, string>("AreaId", areaId)) : Database.LoadRecord("Dungeons", MongoDatabase.FilterEqual <Area, string>("AreaId", areaId)))); } catch (Exception e) { if (e is NeitsilliaError error) { Log.LogS(error.ExtraMessage); } else { _ = Handlers.UniqueChannels.Instance.SendToLog(e); } return(null); } }