private void newButton_Click(object sender, EventArgs e) { MapLoader loader = new MapLoader(); int w = int.Parse(newWidth.Text); int h = int.Parse(newHeight.Text); loader.CreateMap("<Untitled>", "", loader.CreateStandardMapMenu(rightClickHandler), new XNA.Point(w, h), new XNA.Point(w / 2, h / 2), 8, Tabs, multiBoard); DialogResult = DialogResult.OK; Close(); }
private void loadButton_Click(object sender, EventArgs e) { //Hide(); WaitWindow ww = new WaitWindow("Loading..."); ww.Show(); Application.DoEvents(); MapLoader loader = new MapLoader(); WzImage mapImage = null; string mapName = null, streetName = "", categoryName = ""; WzSubProperty strMapProp = null; if (HAMSelect.Checked) { loader.CreateMapFromHam(multiBoard, Tabs, File.ReadAllText(HAMBox.Text), rightClickHandler); DialogResult = DialogResult.OK; ww.EndWait(); Close(); return; } else if (XMLSelect.Checked) { try { mapImage = (WzImage)new WzXmlDeserializer(false, null).ParseXML(XMLBox.Text)[0]; } catch { Warning.Error("Error while loading XML. Aborted."); ww.EndWait(); Show(); return; } } else if (WZSelect.Checked) { if (mapBrowser.SelectedItem == "MapLogin") { mapImage = (WzImage)Program.WzManager["ui"]["MapLogin.img"]; mapName = streetName = categoryName = "MapLogin"; } else if (mapBrowser.SelectedItem == "MapLogin1") { mapImage = (WzImage)Program.WzManager["ui"]["MapLogin1.img"]; mapName = streetName = categoryName = "MapLogin1"; } else if (mapBrowser.SelectedItem == "CashShopPreview") { mapImage = (WzImage)Program.WzManager["ui"]["CashShopPreview.img"]; mapName = streetName = categoryName = "CashShopPreview"; } else { string mapid = mapBrowser.SelectedItem.Substring(0, 9); string mapcat = "Map" + mapid.Substring(0, 1); mapImage = (WzImage)Program.WzManager["map"]["Map"][mapcat][mapid + ".img"]; strMapProp = WzInfoTools.GetMapStringProp(mapid); mapName = WzInfoTools.GetMapName(strMapProp); streetName = WzInfoTools.GetMapStreetName(strMapProp); categoryName = WzInfoTools.GetMapCategoryName(strMapProp); } } loader.CreateMapFromImage(mapImage, mapName, streetName, categoryName, strMapProp, Tabs, multiBoard, rightClickHandler); DialogResult = DialogResult.OK; ww.EndWait(); Close(); }
private void debugButton_Click(object sender, EventArgs e) { // This function iterates over all maps in the game and verifies that we recognize all their props // It is meant to use by the developer(s) to speed up the process of adjusting this program for different MapleStory versions string wzPath = pathBox.Text; short version = -1; WzMapleVersion fileVersion = WzTool.DetectMapleVersion(Path.Combine(wzPath, "Item.wz"), out version); InitializeWzFiles(wzPath, fileVersion); MultiBoard mb = new MultiBoard(); Board b = new Board(new Microsoft.Xna.Framework.Point(), new Microsoft.Xna.Framework.Point(), mb, null, MapleLib.WzLib.WzStructure.Data.ItemTypes.None, MapleLib.WzLib.WzStructure.Data.ItemTypes.None); foreach (string mapid in Program.InfoManager.Maps.Keys) { MapLoader loader = new MapLoader(); string mapcat = "Map" + mapid.Substring(0, 1); WzImage mapImage = (WzImage)Program.WzManager["map"]["Map"][mapcat][mapid + ".img"]; if (mapImage == null) { continue; } mapImage.ParseImage(); if (mapImage["info"]["link"] != null) { mapImage.UnparseImage(); continue; } loader.VerifyMapPropsKnown(mapImage, true); MapInfo info = new MapInfo(mapImage, null, null, null); loader.LoadMisc(mapImage, b); if (ErrorLogger.ErrorsPresent()) { ErrorLogger.SaveToFile("debug_errors.txt"); ErrorLogger.ClearErrors(); } mapImage.UnparseImage(); // To preserve memory, since this is a very memory intensive test } MessageBox.Show("Done"); }