Hello
I have loaded the source code of VintageStoryAPI, VSEssentialsMod, VSCreativeMod and VSSurvivalMod to find how load a map and generate images for a web site (so, not for a mod).
I know that the map is a .db file in the VintagestoryData\Maps directory
It's possible to read it with the method OpenOrCreate of a MapBD object, get a MapPieceDB object with GetMapPiece method and read the Pixels int array.
But I don't know how to initiate a ILogger object for the MapDB constructor.
MapDB mapdb = new MapDB(logger);
And I don't know yet how I will be able to read the Pixels int array to tranform the int in pixel data and generate the image.
My actual attempt :
string errorMessage = null;
string mapdbfilepath = @"[...]\VintagestoryData\Maps\[...].db";
//? api.World.Logger - ILogger Logger
MapDB mapdb = new MapDB(logger);
mapdb.OpenOrCreate(mapdbfilepath, ref errorMessage, false, true, false);
Vec2i coord = new Vec2i(0, 0);
MapPieceDB piece = mapdb.GetMapPiece(coord);
if (piece?.Pixels != null)
{
lblIntsMap.Text = string.Empty;
foreach (int pixel in piece.Pixels)
lblIntsMap.Text += pixel.ToString();
}
I'm not sure how the coordinates of the Vec2i cord object work...
Can you help me ?