public static GameLocation GetOriginLocation(GameLocation location)
 {
     if (!(location is IHookedLocation))
     {
         return(location);
     }
     return(HookedLocationBuilder.CopyData(location, location.GetType().BaseType));
 }
        private static Type BuildHookedLocation(Type parent)
        {
            if (HookedLocationBuilder.ModuleBuilder == null)
            {
                HookedLocationBuilder.SetupBuilder();
            }
            TypeBuilder builder = HookedLocationBuilder.ModuleBuilder.DefineType("Hooked" + parent.Name, parent.Attributes, parent, new[] { typeof(IHookedLocation) });

#warning Implement actual builder here
            return(builder.CreateType());
        }
        /*********
        ** Public methods
        *********/
        public static GameLocation GetHookedLocation(GameLocation location)
        {
            if (location is IHookedLocation)
            {
                return(location);
            }
            Type type = location.GetType();

            if (!HookedLocationBuilder.Cache.ContainsKey(type))
            {
                HookedLocationBuilder.Cache.Add(type, HookedLocationBuilder.BuildHookedLocation(type));
            }
            return(HookedLocationBuilder.CopyData(location, HookedLocationBuilder.Cache[type]));
        }