예제 #1
0
 public New(MultiBoard board, System.Windows.Controls.TabControl Tabs, System.Windows.RoutedEventHandler[] rightClickHandler)
 {
     InitializeComponent();
     this.multiBoard        = board;
     this.Tabs              = Tabs;
     this.rightClickHandler = rightClickHandler;
 }
예제 #2
0
        static void Main()
        {
            // Startup
#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#endif

            Properties.Resources.Culture = CultureInfo.CurrentCulture;
            InfoManager     = new WzInformationManager();
            SettingsManager = new WzSettingsManager(GetLocalSettingsPath(), typeof(UserSettings), typeof(ApplicationSettings), typeof(Microsoft.Xna.Framework.Color));
            SettingsManager.Load();

            MultiBoard.RecalculateSettings();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Program run here
            GUI.Initialization initForm = new GUI.Initialization();
            Application.Run(initForm);

            // Shutdown
            if (initForm.editor != null)
            {
                initForm.editor.hcsm.backupMan.ClearBackups();
            }
            SettingsManager.Save();
            if (Restarting)
            {
                Application.Restart();
            }
        }
예제 #3
0
        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 = null;

                foreach (var dir in Program.WzManager.GetDirsStartsWith("map"))
                {
                    if (dir["Map"] != null && dir["Map"][mapcat] != null)
                    {
                        mapImage = (WzImage)dir["Map"][mapcat][mapid + ".img"];
                    }

                    if (mapImage != null)
                    {
                        break;
                    }
                }

                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");
        }
예제 #4
0
 public TabItemContainer(string text, MultiBoard multiBoard, string tooltip, System.Windows.Controls.ContextMenu menu, Board board)
 {
     this.text       = text;
     this.multiBoard = multiBoard;
     this.tooltip    = tooltip;
     this.menu       = menu;
     this.board      = board;
 }
예제 #5
0
 public Load(MultiBoard board, HaCreator.ThirdParty.TabPages.PageCollection Tabs, EventHandler[] rightClickHandler)
 {
     InitializeComponent();
     DialogResult                = DialogResult.Cancel;
     this.multiBoard             = board;
     this.Tabs                   = Tabs;
     this.rightClickHandler      = rightClickHandler;
     this.searchBox.TextChanged += this.mapBrowser.searchBox_TextChanged;
 }
예제 #6
0
파일: Load.cs 프로젝트: xnum/hasuite
 public Load(MultiBoard board, TabPages.PageCollection Tabs, EventHandler rightClickHandler)
 {
     InitializeComponent();
     DialogResult = DialogResult.Cancel;
     styleManager.ManagerStyle = UserSettings.applicationStyle;
     this.multiBoard           = board;
     this.Tabs = Tabs;
     this.rightClickHandler = rightClickHandler;
 }
예제 #7
0
 public InputHandler(MultiBoard parentBoard)
 {
     this.parentBoard = parentBoard;
     parentBoard.LeftMouseDown += new MultiBoard.LeftMouseDownDelegate(parentBoard_LeftMouseDown);
     parentBoard.LeftMouseUp += new MultiBoard.LeftMouseUpDelegate(parentBoard_LeftMouseUp);
     parentBoard.RightMouseClick += new MultiBoard.RightMouseClickDelegate(parentBoard_RightMouseClick);
     parentBoard.MouseDoubleClick += new MultiBoard.MouseDoubleClickDelegate(parentBoard_MouseDoubleClick);
     parentBoard.ShortcutKeyPressed += new MultiBoard.ShortcutKeyPressedDelegate(parentBoard_ShortcutKeyPressed);
     parentBoard.MouseMoved += new MultiBoard.MouseMovedDelegate(parentBoard_MouseMoved);
 }
예제 #8
0
 public InputHandler(MultiBoard parentBoard)
 {
     this.parentBoard                = parentBoard;
     parentBoard.LeftMouseDown      += new MultiBoard.LeftMouseDownDelegate(parentBoard_LeftMouseDown);
     parentBoard.LeftMouseUp        += new MultiBoard.LeftMouseUpDelegate(parentBoard_LeftMouseUp);
     parentBoard.RightMouseClick    += new MultiBoard.RightMouseClickDelegate(parentBoard_RightMouseClick);
     parentBoard.MouseDoubleClick   += new MultiBoard.MouseDoubleClickDelegate(parentBoard_MouseDoubleClick);
     parentBoard.ShortcutKeyPressed += new MultiBoard.ShortcutKeyPressedDelegate(parentBoard_ShortcutKeyPressed);
     parentBoard.MouseMoved         += new MultiBoard.MouseMovedDelegate(parentBoard_MouseMoved);
 }
예제 #9
0
 public void CreateMapFromHam(MultiBoard multiBoard, System.Windows.Controls.TabControl Tabs, string data, System.Windows.RoutedEventHandler[] rightClickHandler)
 {
     CreateMap("", -1, "", CreateStandardMapMenu(rightClickHandler), new XNA.Point(), new XNA.Point(), 8, Tabs, multiBoard);
     multiBoard.SelectedBoard.Loading = true; // Prevent TS Change callbacks while were loading
     lock (multiBoard)
     {
         multiBoard.SelectedBoard.SerializationManager.DeserializeBoard(data);
         multiBoard.AdjustScrollBars();
     }
     multiBoard.SelectedBoard.Loading = false;
 }
예제 #10
0
        public Load(MultiBoard board, System.Windows.Controls.TabControl Tabs, System.Windows.RoutedEventHandler[] rightClickHandler)
        {
            InitializeComponent();

            DialogResult           = DialogResult.Cancel;
            this.multiBoard        = board;
            this.Tabs              = Tabs;
            this.rightClickHandler = rightClickHandler;

            this.searchBox.TextChanged += this.mapBrowser.searchBox_TextChanged;
        }
예제 #11
0
 public void CreateMapFromHam(MultiBoard multiBoard, HaCreator.ThirdParty.TabPages.PageCollection Tabs, string data, EventHandler[] rightClickHandler)
 {
     CreateMap("", "", CreateStandardMapMenu(rightClickHandler), new XNA.Point(), new XNA.Point(), 8, Tabs, multiBoard);
     multiBoard.SelectedBoard.Loading = true; // Prevent TS Change callbacks while were loading
     lock (multiBoard)
     {
         multiBoard.SelectedBoard.SerializationManager.DeserializeBoard(data);
         multiBoard.AdjustScrollBars();
     }
     multiBoard.SelectedBoard.Loading = false;
 }
예제 #12
0
        public MapSimulator(Board mapBoard)
        {
            if (Program.InfoManager.BGMs.ContainsKey(mapBoard.MapInfo.bgm))
            {
                audio = new WzMp3Streamer(Program.InfoManager.BGMs[mapBoard.MapInfo.bgm], true);
            }

            mapCenter  = mapBoard.CenterPoint;
            minimapPos = new Point((int)Math.Round((mapBoard.MinimapPosition.X + mapCenter.X) / (double)mapBoard.mag), (int)Math.Round((mapBoard.MinimapPosition.Y + mapCenter.Y) / (double)mapBoard.mag));

            if (mapBoard.VRRectangle == null)
            {
                vr = new Rectangle(0, 0, mapBoard.MapSize.X, mapBoard.MapSize.Y);
            }
            else
            {
                vr = new Rectangle(mapBoard.VRRectangle.X + mapCenter.X, mapBoard.VRRectangle.Y + mapCenter.Y, mapBoard.VRRectangle.Width, mapBoard.VRRectangle.Height);
            }

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            InitializeComponent();
            width       = UserSettings.XGAResolution ? 1024 : 800;
            height      = UserSettings.XGAResolution ? 768 : 600;
            this.Width  = width;
            this.Height = height;
#if FULLSCREEN
            pParams.BackBufferWidth    = Math.Max(Width, 1);
            pParams.BackBufferHeight   = Math.Max(Height, 1);
            pParams.BackBufferFormat   = SurfaceFormat.Color;
            pParams.IsFullScreen       = false;
            pParams.DepthStencilFormat = DepthFormat.Depth24;
#else
            pParams.BackBufferWidth    = Math.Max(width, 1);
            pParams.BackBufferHeight   = Math.Max(height, 1);
            pParams.BackBufferFormat   = SurfaceFormat.Color;
            pParams.DepthStencilFormat = DepthFormat.Depth24;
            pParams.DeviceWindowHandle = Handle;
            pParams.IsFullScreen       = false;
#endif
            DxDevice     = MultiBoard.CreateGraphicsDevice(pParams);
            this.minimap = BoardItem.TextureFromBitmap(DxDevice, mapBoard.MiniMap ?? new System.Drawing.Bitmap(1, 1));
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1, 1);
            bmp.SetPixel(0, 0, System.Drawing.Color.White);
            pixel  = BoardItem.TextureFromBitmap(DxDevice, bmp);
            sprite = new SpriteBatch(DxDevice);
        }
예제 #13
0
파일: Program.cs 프로젝트: xnum/hasuite
        static void Main()
        {
            SelfCheck();
            InfoManager     = new WzInformationManager();
            SettingsManager = new WzSettingsManager(System.IO.Path.Combine(Application.StartupPath, "HCSettings.wz"), typeof(UserSettings), typeof(ApplicationSettings), typeof(Microsoft.Xna.Framework.Color));
            SettingsManager.Load();
            MultiBoard.RecalculateSettings();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#if !DEBUG
            try
            {
                Application.Run(new GUI.Initialization());
            }
            catch (Exception e)
            {
                Application.Run(new ExceptionHandler(e));
            }
#else
            Application.Run(new GUI.Initialization());
#endif
            SettingsManager.Save();
        }
예제 #14
0
 public void TryConnectFoothold()
 {
     lock (Board.ParentControl)
     {
         Xna.Point     pos = new Xna.Point(X, Y);
         SelectionInfo sel = board.GetUserSelectionInfo();
         foreach (FootholdAnchor anchor in Board.BoardItems.FHAnchors)
         {
             if (MultiBoard.IsPointInsideRectangle(pos, anchor.Left, anchor.Top, anchor.Right, anchor.Bottom) && anchor.CheckIfLayerSelected(sel))
             {
                 if (anchor.connectedLines.Count > 1)
                 {
                     continue;
                 }
                 if (connectedLines.Count > 0) // Are we already holding a foothold?
                 {
                     // We are, so connect the two ends
                     // Check that we are not connecting a foothold to itself, or creating duplicate footholds
                     if (connectedLines[0].FirstDot != anchor && !FootholdLine.Exists(anchor.X, anchor.Y, connectedLines[0].FirstDot.X, connectedLines[0].FirstDot.Y, Board))
                     {
                         Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> {
                             UndoRedoManager.LineAdded(connectedLines[0], connectedLines[0].FirstDot, anchor)
                         });
                         connectedLines[0].ConnectSecondDot(anchor);
                         // Now that we finished the previous foothold, create a new one between the anchor and the mouse
                         FootholdLine fh = new FootholdLine(Board, anchor);
                         Board.BoardItems.FootholdLines.Add(fh);
                     }
                 }
                 else // Construct a footholdline between the anchor and the mouse
                 {
                     Board.BoardItems.FootholdLines.Add(new FootholdLine(Board, anchor));
                 }
             }
         }
     }
 }
예제 #15
0
        /// <summary>
        /// Check map errors
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void debugButton_Click(object sender, EventArgs e)
        {
            const string OUTPUT_ERROR_FILENAME = "Debug_errors.txt";

            // 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      mapBoard = 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)
            {
                string mapcat = "Map" + mapid.Substring(0, 1);

                WzImage mapImage = Program.WzManager.FindMapImage(mapid, mapcat);
                if (mapImage == null)
                {
                    continue;
                }
                mapImage.ParseImage();
                if (mapImage["info"]["link"] != null)
                {
                    mapImage.UnparseImage();
                    continue;
                }
                MapLoader.VerifyMapPropsKnown(mapImage, true);
                MapInfo info = new MapInfo(mapImage, null, null, null);
                try
                {
                    mapBoard.CreateMapLayers();

                    MapLoader.LoadLayers(mapImage, mapBoard);
                    MapLoader.LoadLife(mapImage, mapBoard);
                    MapLoader.LoadFootholds(mapImage, mapBoard);
                    MapLoader.GenerateDefaultZms(mapBoard);
                    MapLoader.LoadRopes(mapImage, mapBoard);
                    MapLoader.LoadChairs(mapImage, mapBoard);
                    MapLoader.LoadPortals(mapImage, mapBoard);
                    MapLoader.LoadReactors(mapImage, mapBoard);
                    MapLoader.LoadToolTips(mapImage, mapBoard);
                    MapLoader.LoadBackgrounds(mapImage, mapBoard);
                    MapLoader.LoadMisc(mapImage, mapBoard);

                    //MapLoader.LoadBackgrounds(mapImage, board);
                    //MapLoader.LoadMisc(mapImage, board);

                    // Check background to ensure that its correct
                    List <BackgroundInstance> allBackgrounds = new List <BackgroundInstance>();
                    allBackgrounds.AddRange(mapBoard.BoardItems.BackBackgrounds);
                    allBackgrounds.AddRange(mapBoard.BoardItems.FrontBackgrounds);

                    foreach (BackgroundInstance bg in allBackgrounds)
                    {
                        if (bg.type != MapleLib.WzLib.WzStructure.Data.BackgroundType.Regular)
                        {
                            if (bg.cx < 0 || bg.cy < 0)
                            {
                                string error = string.Format("Negative CX/ CY moving background object. CX='{0}', CY={1}, Type={2}, {3}{4}", bg.cx, bg.cy, bg.type.ToString(), Environment.NewLine, mapImage.ToString() /*overrides, see WzImage.ToString*/);
                                ErrorLogger.Log(ErrorLevel.IncorrectStructure, error);
                            }
                        }
                    }
                    allBackgrounds.Clear();
                }
                catch (Exception exp)
                {
                    string error = string.Format("Exception occured loading {0}{1}{2}{3}{4}", mapcat, Environment.NewLine, mapImage.ToString() /*overrides, see WzImage.ToString*/, Environment.NewLine, exp.ToString());
                    ErrorLogger.Log(ErrorLevel.Crash, error);
                }
                finally
                {
                    mapBoard.Dispose();

                    mapBoard.BoardItems.BackBackgrounds.Clear();
                    mapBoard.BoardItems.FrontBackgrounds.Clear();

                    mapImage.UnparseImage(); // To preserve memory, since this is a very memory intensive test
                }

                if (ErrorLogger.NumberOfErrorsPresent() > 200)
                {
                    ErrorLogger.SaveToFile(OUTPUT_ERROR_FILENAME);
                }
            }
            ErrorLogger.SaveToFile(OUTPUT_ERROR_FILENAME);


            MessageBox.Show(string.Format("Check for map errors completed. See '{0}' for more information.", OUTPUT_ERROR_FILENAME));
        }
예제 #16
0
        public InfoEditor(Board board, MapInfo info, MultiBoard multiBoard)
        {
            InitializeComponent();

            this.board      = board;
            this.multiBoard = multiBoard;

            timeLimitEnable.Tag       = timeLimit;
            lvLimitEnable.Tag         = lvLimit;
            lvForceMoveUse.Tag        = lvForceMove;
            firstUserEnable.Tag       = firstUserEnter;
            userEnterEnable.Tag       = userEnter;
            fieldTypeEnable.Tag       = fieldType;
            moveLimitEnable.Tag       = moveLimit;
            mapNameEnable.Tag         = mapName;
            mapDescEnable.Tag         = mapDesc;
            streetNameEnable.Tag      = streetNameBox;
            effectEnable.Tag          = effectBox;
            dropExpireEnable.Tag      = dropExpire;
            dropRateEnable.Tag        = dropRate;
            recoveryEnable.Tag        = recovery;
            reactorShuffle.Tag        = new Control[] { reactorNameShuffle, reactorNameBox };
            reactorNameShuffle.Tag    = reactorNameBox;
            fsEnable.Tag              = fsBox;
            massEnable.Tag            = new Control[] { createMobInterval, fixedMobCapacity };
            hpDecEnable.Tag           = new Control[] { decHP, protectItem, decIntervalEnable, decInterval, protectEnable };
            protectEnable.Tag         = new Control[] { protectItem };
            decIntervalEnable.Tag     = decInterval;
            helpEnable.Tag            = helpBox;
            timedMobEnable.Tag        = new Control[] { timedMobEnd, timedMobStart };
            summonMobEnable.Tag       = new Control[] { timedMobId, timedMobEnable, timedMobMessage };
            autoLieDetectorEnable.Tag = new Control[] { autoLieEnd, autoLieInterval, autoLieProp, autoLieStart };
            allowedItemsEnable.Tag    = new Control[] { allowedItems, allowedItemsAdd, allowedItemsRemove };

            this.info = info;
            this.fieldType.SelectedIndex = 0;

            xBox.Value = board.MapSize.X;
            yBox.Value = board.MapSize.Y;

            List <string> sortedBGMs = new List <string>();

            foreach (KeyValuePair <string, WzBinaryProperty> bgm in Program.InfoManager.BGMs)
            {
                sortedBGMs.Add(bgm.Key);
            }
            sortedBGMs.Sort();
            foreach (string bgm in sortedBGMs)
            {
                bgmBox.Items.Add(bgm);
            }
            bgmBox.SelectedItem = info.bgm;

            List <string> sortedMarks = new List <string>();

            foreach (KeyValuePair <string, Bitmap> mark in Program.InfoManager.MapMarks)
            {
                sortedMarks.Add(mark.Key);
            }
            sortedMarks.Sort();
            foreach (string mark in sortedMarks)
            {
                markBox.Items.Add(mark);
            }
            markBox.SelectedIndex = 0;

            switch (info.mapType)
            {
            case MapType.CashShopPreview:
                IDLabel.Text = "CashShopPreview";
                break;

            case MapType.MapLogin:
                IDLabel.Text = "MapLogin";
                break;

            case MapType.RegularMap:
                if (info.id == -1)
                {
                    IDLabel.Text = "";
                }
                else
                {
                    IDLabel.Text = info.id.ToString();
                }
                break;
            }
            nameBox.Text         = info.strMapName;
            streetBox.Text       = info.strStreetName;
            categoryBox.Text     = info.strCategoryName;
            markBox.SelectedItem = info.mapMark;
            if (info.returnMap == info.id)
            {
                cannotReturnCBX.Checked = true;
            }
            else
            {
                returnBox.Text = info.returnMap.ToString();
            }
            if (info.forcedReturn == 999999999)
            {
                returnHereCBX.Checked = true;
            }
            else
            {
                forcedRet.Text = info.forcedReturn.ToString();
            }
            mobRate.Value = (decimal)info.mobRate;
            //LoadOptionalInt(info.link, linkBox);
            LoadOptionalInt(info.timeLimit, timeLimit, timeLimitEnable);
            LoadOptionalInt(info.lvLimit, lvLimit, lvLimitEnable);
            LoadOptionalInt(info.lvForceMove, lvForceMove, lvForceMoveUse);
            LoadOptionalString(info.onFirstUserEnter, firstUserEnter, firstUserEnable);
            LoadOptionalString(info.onUserEnter, userEnter, userEnterEnable);
            LoadOptionalString(info.mapName, mapName, mapNameEnable);
            LoadOptionalString(info.mapDesc, mapDesc, mapDescEnable);
            LoadOptionalString(info.streetName, streetNameBox, streetNameEnable);
            LoadOptionalString(info.effect, effectBox, effectEnable);
            LoadOptionalInt(info.moveLimit, moveLimit, moveLimitEnable);
            LoadOptionalInt(info.dropExpire, dropExpire, dropExpireEnable);
            LoadOptionalFloat(info.dropRate, dropRate, dropRateEnable);
            LoadOptionalFloat(info.recovery, recovery, recoveryEnable);
            reactorShuffle.Checked = info.reactorShuffle;
            LoadOptionalString(info.reactorShuffleName, reactorNameBox, reactorNameShuffle);
            LoadOptionalFloat(info.fs, fsBox, fsEnable);
            LoadOptionalInt(info.createMobInterval, createMobInterval, massEnable);
            LoadOptionalInt(info.fixedMobCapacity, fixedMobCapacity, massEnable);
            LoadOptionalInt(info.decHP, decHP, hpDecEnable);
            LoadOptionalInt(info.decInterval, decInterval, decIntervalEnable);
            LoadOptionalInt(info.protectItem, protectItem, protectEnable);
            helpEnable.Checked = info.help != null;
            if (info.help != null)
            {
                helpBox.Text = info.help.Replace(@"\n", "\r\n");
            }
            if (info.timeMob != null)
            {
                MapInfo.TimeMob tMob = (MapInfo.TimeMob)info.timeMob;
                summonMobEnable.Checked = true;
                LoadOptionalInt(tMob.startHour, timedMobStart, timedMobEnable);
                LoadOptionalInt(tMob.endHour, timedMobEnd, timedMobEnable);
                timedMobId.Value     = tMob.id;
                timedMobMessage.Text = tMob.message.Replace(@"\n", "\r\n");
            }
            if (info.autoLieDetector != null)
            {
                MapInfo.AutoLieDetector ald = (MapInfo.AutoLieDetector)info.autoLieDetector;
                autoLieDetectorEnable.Checked = true;
                autoLieStart.Value            = ald.startHour;
                autoLieEnd.Value      = ald.endHour;
                autoLieInterval.Value = ald.interval;
                autoLieProp.Value     = ald.prop;
            }
            if (info.allowedItem != null)
            {
                allowedItemsEnable.Checked = true;
                foreach (int id in info.allowedItem)
                {
                    allowedItems.Items.Add(id.ToString());
                }
            }
            optionsList.SetChecked(0, info.cloud);
            optionsList.SetChecked(1, info.snow);
            optionsList.SetChecked(2, info.rain);
            optionsList.SetChecked(3, info.swim);
            optionsList.SetChecked(4, info.fly);
            optionsList.SetChecked(5, info.town);
            optionsList.SetChecked(6, info.partyOnly);
            optionsList.SetChecked(7, info.expeditionOnly);
            optionsList.SetChecked(8, info.noMapCmd);
            optionsList.SetChecked(9, info.hideMinimap);
            optionsList.SetChecked(10, info.miniMapOnOff);
            optionsList.SetChecked(11, info.personalShop);
            optionsList.SetChecked(12, info.entrustedShop);
            optionsList.SetChecked(13, info.noRegenMap);
            optionsList.SetChecked(14, info.blockPBossChange);
            optionsList.SetChecked(15, info.everlast);
            optionsList.SetChecked(16, info.damageCheckFree);
            optionsList.SetChecked(17, info.scrollDisable);
            optionsList.SetChecked(18, info.needSkillForFly);
            optionsList.SetChecked(19, info.zakum2Hack);
            optionsList.SetChecked(20, info.allMoveCheck);
            optionsList.SetChecked(21, info.VRLimit);

            // Populate field limit items
            // automatically populated via fieldLimitPanel1.Loaed
            fieldLimitPanel1.PopulateDefaultListView();
            fieldLimitPanel1.UpdateFieldLimitCheckboxes((ulong)info.fieldLimit);

            if (info.fieldType != null)/* fieldType.SelectedIndex = -1;
                                        * else*/
            {
                fieldType.SelectedIndex = 0;
                if ((int)info.fieldType <= 0x22)
                {
                    fieldType.SelectedIndex = (int)info.fieldType;
                }
                else
                {
                    switch (info.fieldType)
                    {
                    case FieldType.FIELDTYPE_WEDDING:
                        fieldType.SelectedIndex = 0x23;
                        break;

                    case FieldType.FIELDTYPE_WEDDINGPHOTO:
                        fieldType.SelectedIndex = 0x24;
                        break;

                    case FieldType.FIELDTYPE_FISHINGKING:
                        fieldType.SelectedIndex = 0x25;
                        break;

                    case FieldType.FIELDTYPE_SHOWABATH:
                        fieldType.SelectedIndex = 0x26;
                        break;

                    case FieldType.FIELDTYPE_BEGINNERCAMP:
                        fieldType.SelectedIndex = 0x27;
                        break;

                    case FieldType.FIELDTYPE_SNOWMAN:
                        fieldType.SelectedIndex = 0x28;
                        break;

                    case FieldType.FIELDTYPE_SHOWASPA:
                        fieldType.SelectedIndex = 0x29;
                        break;

                    case FieldType.FIELDTYPE_HORNTAILPQ:
                        fieldType.SelectedIndex = 0x2A;
                        break;

                    case FieldType.FIELDTYPE_CRIMSONWOODPQ:
                        fieldType.SelectedIndex = 0x2B;
                        break;
                    }
                }
            }
            foreach (WzImageProperty prop in info.additionalProps)
            {
                TreeNode node = unknownProps.Nodes.Add(prop.Name);
                node.Tag = prop;
                if (prop.WzProperties != null && prop.WzProperties.Count > 0)
                {
                    ExtractPropList(prop.WzProperties, node);
                }
            }
        }
예제 #17
0
 public void CreateMap(string text, string tooltip, ContextMenuStrip menu, Point size, Point center, int layers, HaCreator.ThirdParty.TabPages.PageCollection Tabs, MultiBoard multiBoard)
 {
     lock (multiBoard)
     {
         Board newBoard = multiBoard.CreateBoard(size, center, layers, menu);
         GenerateDefaultZms(newBoard);
         HaCreator.ThirdParty.TabPages.TabPage page = new HaCreator.ThirdParty.TabPages.TabPage(text, multiBoard, tooltip, menu);
         newBoard.TabPage = page;
         page.Tag         = newBoard;
         Tabs.Add(page);
         Tabs.CurrentPage         = page;
         multiBoard.SelectedBoard = newBoard;
         menu.Tag = newBoard;
         foreach (ToolStripItem item in menu.Items)
         {
             item.Tag = newBoard;
         }
     }
 }
예제 #18
0
        public void CreateMapFromImage(WzImage mapImage, string mapName, string streetName, string categoryName, WzSubProperty strMapProp, PageCollection Tabs, MultiBoard multiBoard, EventHandler[] rightClickHandler)
        {
            if (!mapImage.Parsed)
            {
                mapImage.ParseImage();
            }
            List <string> copyPropNames = VerifyMapPropsKnown(mapImage, false);
            MapInfo       info          = new MapInfo(mapImage, mapName, streetName, categoryName);

            foreach (string copyPropName in copyPropNames)
            {
                info.additionalNonInfoProps.Add(mapImage[copyPropName]);
            }
            MapType type = GetMapType(mapImage);

            if (type == MapType.RegularMap)
            {
                info.id = int.Parse(WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)));
            }
            info.mapType = type;

            Rectangle VR            = new Rectangle();
            Point     center        = new Point();
            Point     size          = new Point();
            Point     minimapSize   = new Point();
            Point     minimapCenter = new Point();
            bool      hasMinimap    = false;
            bool      hasVR         = false;

            try
            {
                GetMapDimensions(mapImage, out VR, out center, out size, out minimapCenter, out minimapSize, out hasVR, out hasMinimap);
            }
            catch (NoVRException)
            {
                MessageBox.Show("Error - map does not contain size information and HaCreator was unable to generate it. An error has been logged.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ErrorLogger.Log(ErrorLevel.IncorrectStructure, "no size @map " + info.id.ToString());
                return;
            }

            lock (multiBoard)
            {
                CreateMap(mapName, WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)), CreateStandardMapMenu(rightClickHandler), size, center, 8, Tabs, multiBoard);
                Board mapBoard = multiBoard.SelectedBoard;
                mapBoard.Loading = true; // prevents TS Change callbacks
                mapBoard.MapInfo = info;
                if (hasMinimap)
                {
                    mapBoard.MiniMap = ((WzCanvasProperty)mapImage["miniMap"]["canvas"]).PngProperty.GetPNG(false);
                    System.Drawing.Point mmPos = new System.Drawing.Point(-minimapCenter.X, -minimapCenter.Y);
                    mapBoard.MinimapPosition  = mmPos;
                    mapBoard.MinimapRectangle = new MinimapRectangle(mapBoard, new Rectangle(mmPos.X, mmPos.Y, minimapSize.X, minimapSize.Y));
                }
                if (hasVR)
                {
                    mapBoard.VRRectangle = new VRRectangle(mapBoard, VR);
                }
                LoadLayers(mapImage, mapBoard);
                LoadLife(mapImage, mapBoard);
                LoadFootholds(mapImage, mapBoard);
                GenerateDefaultZms(mapBoard);
                LoadRopes(mapImage, mapBoard);
                LoadChairs(mapImage, mapBoard);
                LoadPortals(mapImage, mapBoard);
                LoadReactors(mapImage, mapBoard);
                LoadToolTips(mapImage, mapBoard);
                LoadBackgrounds(mapImage, mapBoard);
                LoadMisc(mapImage, mapBoard);

                mapBoard.BoardItems.Sort();
                mapBoard.Loading = false;
            }
            if (ErrorLogger.ErrorsPresent())
            {
                ErrorLogger.SaveToFile("errors.txt");
                if (UserSettings.ShowErrorsMessage)
                {
                    // MessageBox.Show("Errors were encountered during the loading process. These errors were saved to \"errors.txt\". Please send this file to the author, either via mail (" + ApplicationSettings.AuthorEmail + ") or from the site you got this software from.\n\n(In the case that this program was not updated in so long that this message is now thrown on every map load, you may cancel this message from the settings)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                ErrorLogger.ClearErrors();
            }
        }
예제 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mapName"></param>
        /// <param name="mapId">May be -1 if none.</param>
        /// <param name="tooltip"></param>
        /// <param name="menu"></param>
        /// <param name="size"></param>
        /// <param name="center"></param>
        /// <param name="layers"></param>
        /// <param name="Tabs"></param>
        /// <param name="multiBoard"></param>
        public void CreateMap(string mapName, int mapId, string tooltip, System.Windows.Controls.ContextMenu menu, Point size, Point center, int layers, System.Windows.Controls.TabControl Tabs, MultiBoard multiBoard)
        {
            lock (multiBoard)
            {
                Board newBoard = multiBoard.CreateBoard(size, center, layers, menu);
                GenerateDefaultZms(newBoard);

                System.Windows.Controls.TabItem newTabPage = new System.Windows.Controls.TabItem();
                newTabPage.Header              = string.Format("[{0}] {1}", mapId == -1 ? "" : mapId.ToString(), mapName); // Header of the tab
                newTabPage.MouseRightButtonUp += (sender, e) =>
                {
                    System.Windows.Controls.TabItem senderTab = (System.Windows.Controls.TabItem)sender;

                    menu.PlacementTarget = senderTab;
                    menu.IsOpen          = true;
                };

                newBoard.TabPage = newTabPage;
                newTabPage.Tag   = new TabItemContainer(mapName, multiBoard, tooltip, menu, newBoard); //newBoard;
                Tabs.Items.Add(newTabPage);
                Tabs.SelectedItem = newTabPage;

                multiBoard.SelectedBoard = newBoard;
                menu.Tag = newBoard;
                foreach (System.Windows.Controls.MenuItem item in menu.Items)
                {
                    item.Tag = newTabPage;
                }
            }
        }
예제 #20
0
파일: MapLoader.cs 프로젝트: xnum/hasuite
        public static void CreateMapFromImage(WzImage mapImage, string mapName, string streetName, PageCollection Tabs, MultiBoard multiBoard, EventHandler rightClickHandler)
        {
            if (!mapImage.Parsed)
            {
                mapImage.ParseImage();
            }
            VerifyMapPropsKnown(mapImage);
            MapInfo info = new MapInfo(mapImage, mapName, streetName);
            MapType type = GetMapType(mapImage);

            if (type == MapType.RegularMap)
            {
                info.id = int.Parse(WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)));
            }
            info.mapType = type;
            Point center = new Point();
            Point size   = new Point();

            if (mapImage["miniMap"] == null)
            {
                if (info.VR == null)
                {
                    if (!GetMapVR(mapImage, ref info.VR))
                    {
                        MessageBox.Show("Error - map does not contain size information and HaCreator was unable to generate it. An error has been logged.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        ErrorLogger.Log(ErrorLevel.IncorrectStructure, "no size @map " + info.id.ToString());
                        return;
                    }
                }
                size   = new Point(info.VR.Value.Width + 10, info.VR.Value.Height + 10); //leave 5 pixels on each side
                center = new Point(5 - info.VR.Value.Left, 5 - info.VR.Value.Top);
            }
            else
            {
                IWzImageProperty miniMap = mapImage["miniMap"];
                size   = new Point(InfoTool.GetInt(miniMap["width"]), InfoTool.GetInt(miniMap["height"]));
                center = new Point(InfoTool.GetInt(miniMap["centerX"]), InfoTool.GetInt(miniMap["centerY"]));
            }
            CreateMap(mapName, WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)), CreateStandardMapMenu(rightClickHandler), size, center, 8, Tabs, multiBoard);
            Board mapBoard = multiBoard.SelectedBoard;

            mapBoard.MapInfo = info;
            if (mapImage["miniMap"] != null)
            {
                mapBoard.MiniMap = ((WzCanvasProperty)mapImage["miniMap"]["canvas"]).PngProperty.GetPNG(false);
            }
            LoadLayers(mapImage, mapBoard);
            LoadLife(mapImage, mapBoard);
            LoadFootholds(mapImage, mapBoard);
            LoadRopes(mapImage, mapBoard);
            LoadChairs(mapImage, mapBoard);
            LoadPortals(mapImage, mapBoard);
            LoadReactors(mapImage, mapBoard);
            LoadToolTips(mapImage, mapBoard);
            LoadBackgrounds(mapImage, mapBoard);
            mapBoard.BoardItems.Sort();
        }
        public MapSimulator(Board mapBoard)
        {
            InitializeComponent();

            if (Program.InfoManager.BGMs.ContainsKey(mapBoard.MapInfo.bgm))
            {
                audio = new WzMp3Streamer(Program.InfoManager.BGMs[mapBoard.MapInfo.bgm], true);
            }

            mapCenter  = mapBoard.CenterPoint;
            minimapPos = new Point((int)Math.Round((mapBoard.MinimapPosition.X + mapCenter.X) / (double)mapBoard.mag), (int)Math.Round((mapBoard.MinimapPosition.Y + mapCenter.Y) / (double)mapBoard.mag));
            if (mapBoard.VRRectangle == null)
            {
                vr = new Rectangle(0, 0, mapBoard.MapSize.X, mapBoard.MapSize.Y);
            }
            else
            {
                vr = new Rectangle(mapBoard.VRRectangle.X + mapCenter.X, mapBoard.VRRectangle.Y + mapCenter.Y, mapBoard.VRRectangle.Width, mapBoard.VRRectangle.Height);
            }
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);


            switch (UserSettings.SimulateResolution)
            {
            case MapRenderResolution.Res_1024x768:      // 1024x768
                RenderHeight = 768;
                RenderWidth  = 1024;
                break;

            case MapRenderResolution.Res_1280x720:     // 1280x720
                RenderHeight = 720;
                RenderWidth  = 1280;
                break;

            case MapRenderResolution.Res_1366x768:      // 1366x768
                RenderHeight = 768;
                RenderWidth  = 1366;
                break;

            case MapRenderResolution.Res_1920x1080:
                RenderHeight = 1080;
                RenderWidth  = 1920;
                break;

            case MapRenderResolution.Res_800x600:     // 800x600
            default:
                RenderHeight = 600;
                RenderWidth  = 800;
                break;
            }
            double dpi = ScreenDPIUtil.GetScreenScaleFactor();

            // set Form window height & width
            this.Width  = (int)(RenderWidth * dpi);
            this.Height = (int)(RenderHeight * dpi);

#if FULLSCREEN
            pParams.BackBufferWidth    = Math.Max(Width, 1);
            pParams.BackBufferHeight   = Math.Max(Height, 1);
            pParams.BackBufferFormat   = SurfaceFormat.Color;
            pParams.IsFullScreen       = false;
            pParams.DepthStencilFormat = DepthFormat.Depth24;
#else
            pParams.BackBufferWidth    = Math.Max(RenderWidth, 1);
            pParams.BackBufferHeight   = Math.Max(RenderHeight, 1);
            pParams.BackBufferFormat   = SurfaceFormat.Color;
            pParams.DepthStencilFormat = DepthFormat.Depth24Stencil8;
            pParams.DeviceWindowHandle = Handle;
            pParams.IsFullScreen       = false;
#endif

            // default center
            mapShiftX = vr.Left;
            mapShiftY = vr.Top;


            DxDevice     = MultiBoard.CreateGraphicsDevice(pParams);
            this.minimap = BoardItem.TextureFromBitmap(DxDevice, mapBoard.MiniMap);
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1, 1);
            bmp.SetPixel(0, 0, System.Drawing.Color.White);
            pixel = BoardItem.TextureFromBitmap(DxDevice, bmp);

            sprite = new SpriteBatch(DxDevice);
        }
예제 #22
0
파일: MapLoader.cs 프로젝트: xnum/hasuite
        public static void CreateMap(string text, string tooltip, ContextMenuStrip menu, Point size, Point center, int layers, TabPages.PageCollection Tabs, MultiBoard multiBoard)
        {
            Board newBoard = multiBoard.CreateBoard(size, center, layers);

            TabPages.TabPage page = new TabPages.TabPage(text, multiBoard, tooltip, menu);
            page.Tag = newBoard;
            Tabs.Add(page);
            Tabs.CurrentPage         = page;
            multiBoard.SelectedBoard = newBoard;
            menu.Tag = newBoard;
            foreach (ToolStripItem item in menu.Items)
            {
                item.Tag = newBoard;
            }
        }
        private void parentBoard_MouseMoved(Board selectedBoard, XNA.Point oldPos, XNA.Point newPos, XNA.Point currPhysicalPos)
        {
            lock (parentBoard)
            {
                OnUserInteraction();
                if (selectedBoard.Mouse.MinimapBrowseOngoing && selectedBoard.Mouse.State == MouseState.Selection)
                {
                    HandleMinimapBrowse(selectedBoard, currPhysicalPos);
                }
                else if (selectedBoard.Mouse.MultiSelectOngoing && (Math.Abs(selectedBoard.Mouse.X - selectedBoard.Mouse.MultiSelectStart.X) > 1 || Math.Abs(selectedBoard.Mouse.Y - selectedBoard.Mouse.MultiSelectStart.Y) > 1))
                {
                    XNA.Rectangle    oldRect  = CreateRectangle(oldPos, selectedBoard.Mouse.MultiSelectStart);
                    XNA.Rectangle    newRect  = CreateRectangle(newPos, selectedBoard.Mouse.MultiSelectStart);
                    List <BoardItem> toRemove = new List <BoardItem>();
                    SelectionInfo    sel      = selectedBoard.GetUserSelectionInfo();
                    foreach (BoardItem item in selectedBoard.BoardItems.Items)
                    {
                        if (MultiBoard.IsItemUnderRectangle(item, newRect) && (sel.editedTypes & item.Type) == item.Type && item.CheckIfLayerSelected(sel))
                        {
                            item.Selected = true;
                        }
                        else if (item.Selected && MultiBoard.IsItemUnderRectangle(item, oldRect))
                        {
                            toRemove.Add(item);
                        }
                    }
                    foreach (BoardItem item in toRemove)
                    {
                        item.Selected = false;
                    }
                    toRemove.Clear();
                }
                else if (selectedBoard.Mouse.SingleSelectStarting && (Distance(newPos.X - selectedBoard.Mouse.SingleSelectStart.X, newPos.Y - selectedBoard.Mouse.SingleSelectStart.Y) > UserSettings.SignificantDistance || IsKeyPushedDown(Keys.Menu)))
                {
                    BindAllSelectedItems(selectedBoard, selectedBoard.Mouse.SingleSelectStart);
                    selectedBoard.Mouse.SingleSelectStarting = false;
                }
                else if (selectedBoard.Mouse.BoundItems.Count > 0)
                {
                    //snapping
                    if (UserSettings.useSnapping && selectedBoard.Mouse.BoundItems.Count != 0 && !IsKeyPushedDown(Keys.Menu))
                    {
                        MouseState state = selectedBoard.Mouse.State;
                        if (state == MouseState.Selection || state == MouseState.StaticObjectAdding || state == MouseState.RandomTiles || state == MouseState.Ropes || state == MouseState.Footholds || state == MouseState.Chairs)
                        {
                            List <BoardItem> items = selectedBoard.Mouse.BoundItems.Keys.ToList();
                            foreach (BoardItem item in items)
                            {
                                if (item is ISnappable)
                                {
                                    ((ISnappable)item).DoSnap();
                                }
                            }
                        }
                    }
                }
                else if (selectedBoard.Mouse.State == MouseState.Footholds)
                {
                    // Foothold snap-like behavior
                    selectedBoard.Mouse.DoSnap();
                }

                if ((selectedBoard.Mouse.BoundItems.Count > 0 || selectedBoard.Mouse.MultiSelectOngoing) && selectedBoard.Mouse.State == MouseState.Selection)
                {
                    // auto scrolling
                    // Bind physicalpos to our dxcontainer, to prevent extremely fast scrolling
                    currPhysicalPos = new XNA.Point(Math.Min(Math.Max(currPhysicalPos.X, 0), (int)parentBoard.Width), Math.Min(Math.Max(currPhysicalPos.Y, 0), (int)parentBoard.Height));

                    if (currPhysicalPos.X - UserSettings.ScrollDistance < 0 && oldPos.X > newPos.X) //move to left
                    {
                        selectedBoard.hScroll = (int)Math.Max(0, selectedBoard.hScroll - Math.Pow(UserSettings.ScrollBase, (UserSettings.ScrollDistance - currPhysicalPos.X) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor);
                    }
                    else if (currPhysicalPos.X + UserSettings.ScrollDistance > parentBoard.Width && oldPos.X < newPos.X) //move to right
                    {
                        selectedBoard.hScroll = (int)Math.Min(selectedBoard.hScroll + Math.Pow(UserSettings.ScrollBase, (currPhysicalPos.X - parentBoard.Width + UserSettings.ScrollDistance) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor, parentBoard.MaxHScroll);
                    }
                    if (currPhysicalPos.Y - UserSettings.ScrollDistance < 0 && oldPos.Y > newPos.Y) //move to top
                    {
                        selectedBoard.vScroll = (int)Math.Max(0, selectedBoard.vScroll - Math.Pow(UserSettings.ScrollBase, (UserSettings.ScrollDistance - currPhysicalPos.Y) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor);
                    }
                    else if (currPhysicalPos.Y + UserSettings.ScrollDistance > parentBoard.Height && oldPos.Y < newPos.Y) //move to bottom
                    {
                        selectedBoard.vScroll = (int)Math.Min(selectedBoard.vScroll + Math.Pow(UserSettings.ScrollBase, (currPhysicalPos.Y - parentBoard.Height + UserSettings.ScrollDistance) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor, parentBoard.MaxVScroll);
                    }
                }
            }
        }