private static EncounterTable LoadOrGet(string name, int id)
        {
            EncounterTable e;

            if (!_loadedEncounterTables.ContainsKey(id))
            {
                e = new EncounterTable(name, id);
                _loadedEncounterTables.Add(id, new WeakReference <EncounterTable>(e));
                return(e);
            }
            WeakReference <EncounterTable> w = _loadedEncounterTables[id];

            if (w.TryGetTarget(out e))
            {
                return(e);
            }
            e = new EncounterTable(name, id);
            w.SetTarget(e);
            return(e);
        }
 public EncounterGroup(JToken j)
 {
     Type  = j[nameof(Type)].EnumValue <EncounterType>();
     Table = EncounterTable.LoadOrGet(j[nameof(Table)].Value <string>());
 }
 public EncounterGroup(EncounterType t, EncounterTable tbl)
 {
     Type  = t;
     Table = tbl;
 }