コード例 #1
0
        public static void SaveMap(Frames.MapFrame frame)
        {
            try
            {
                lock (connectionLocker)
                {
                    Connect();

                    var text    = "DELETE FROM maps WHERE id=" + frame.ID;
                    var command = new MySqlCommand(text, connection);

                    command.ExecuteNonQuery();

                    text = "INSERT INTO maps (id, date, width, heigth, places, mapData, monsters, capabilities, mappos, numgroup) VALUES ( '" +
                           frame.ID + "', '" + frame.signature + "', '" + frame.width + "', '" + frame.height + "', '" + frame.GetCellsFight(true) + "', '" +
                           frame.compressMap() + "', '', '" + frame.getCapabilities() + "', '0,0,0', '5');";
                    command = new MySqlCommand(text, connection);

                    command.ExecuteNonQuery();

                    Disconnect();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.ToString());
            }
        }
コード例 #2
0
ファイル: Cell.cs プロジェクト: poisskai/DofusWorldEditor
        public Cell(int aid, string CellData, int w, int h, Frames.MapFrame frame)
        {
            try
            {
                id = aid;
                Frame = frame;
                byte[] CellInfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                for (int i = CellData.Length - 1; i >= 0; i--)
                    CellInfo[i] = (byte)Program.Hash.IndexOf(CellData[i]);

                active = ((CellInfo[0] & 32) >> 5) != 0;
                if (!active)
                {
                    gID = 0;
                    return;
                }
                LoS = (CellInfo[0] & 1) != 0;
                grot = (CellInfo[1] & 48) >> 4;
                glvl = CellInfo[1] & 15;
                type = (CellInfo[2] & 56) >> 3;
                gID = ((CellInfo[0] & 24) << 6) + ((CellInfo[2] & 7) << 6) + CellInfo[3];
                ground = frame.getBitmap(gID, true);
                gslope = (CellInfo[4] & 60) >> 2;
                gflip = ((CellInfo[4] & 2) >> 1) != 0;
                o1ID = ((CellInfo[0] & 4) << 11) + ((CellInfo[4] & 1) << 12) + (CellInfo[5] << 6) + CellInfo[6];
                object1 = frame.getBitmap(o1ID, false);
                o1rot = (CellInfo[7] & 48) >> 4;
                o1flip = ((CellInfo[7] & 8) >> 3) != 0;
                o2flip = ((CellInfo[7] & 4) >> 2) != 0;
                o2interactive = Convert.ToBoolean((CellInfo[7] & 2) >> 1);
                o2ID = ((CellInfo[0] & 2) << 12) + ((CellInfo[7] & 1) << 12) + (CellInfo[8] << 6) + CellInfo[9];
                object2 = frame.getBitmap(o2ID, false);

                if (ground != null)
                {
                    if (gflip)
                        ground.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    if (grot == 1)
                    {
                        ground.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        gflip = true;
                        grot = 0;
                    }
                    else if (grot == 2)
                        ground.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    else if (grot == 3)
                        ground.RotateFlip(RotateFlipType.Rotate180FlipX);
                }

                if (object1 != null)
                {
                    if (o1flip)
                        object1.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    if (o1rot == 1)
                    {
                        object1.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        o1flip = true;
                        o1rot = 0;
                    }
                    else if (o1rot == 2)
                        object1.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    else if (o1rot == 3)
                        object1.RotateFlip(RotateFlipType.Rotate180FlipX);
                }

                if (object2 != null)
                {
                    if (o2flip)
                        object2.RotateFlip(RotateFlipType.RotateNoneFlipX);
                }

                pos = getPositionByCellID(id, glvl, w, h);
            }
            catch { }
        }
コード例 #3
0
ファイル: Cell.cs プロジェクト: poisskai/DofusWorldEditor
 public Cell(int i,int w,int h, Frames.MapFrame frame)
 {
     id = i;
     Frame = frame;
     pos = getPositionByCellID(i,glvl,w,h);
 }
コード例 #4
0
ファイル: Cell.cs プロジェクト: 745c5412/DofusWorldEditor
        public Cell(int aid, string CellData, int w, int h, Frames.MapFrame frame)
        {
            try
            {
                id    = aid;
                Frame = frame;
                byte[] CellInfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                for (int i = CellData.Length - 1; i >= 0; i--)
                {
                    CellInfo[i] = (byte)Program.Hash.IndexOf(CellData[i]);
                }

                active = ((CellInfo[0] & 32) >> 5) != 0;
                if (!active)
                {
                    gID = 0;
                    return;
                }
                LoS           = (CellInfo[0] & 1) != 0;
                grot          = (CellInfo[1] & 48) >> 4;
                glvl          = CellInfo[1] & 15;
                type          = (CellInfo[2] & 56) >> 3;
                gID           = ((CellInfo[0] & 24) << 6) + ((CellInfo[2] & 7) << 6) + CellInfo[3];
                ground        = frame.getBitmap(gID, true);
                gslope        = (CellInfo[4] & 60) >> 2;
                gflip         = ((CellInfo[4] & 2) >> 1) != 0;
                o1ID          = ((CellInfo[0] & 4) << 11) + ((CellInfo[4] & 1) << 12) + (CellInfo[5] << 6) + CellInfo[6];
                object1       = frame.getBitmap(o1ID, false);
                o1rot         = (CellInfo[7] & 48) >> 4;
                o1flip        = ((CellInfo[7] & 8) >> 3) != 0;
                o2flip        = ((CellInfo[7] & 4) >> 2) != 0;
                o2interactive = Convert.ToBoolean((CellInfo[7] & 2) >> 1);
                o2ID          = ((CellInfo[0] & 2) << 12) + ((CellInfo[7] & 1) << 12) + (CellInfo[8] << 6) + CellInfo[9];
                object2       = frame.getBitmap(o2ID, false);

                if (ground != null)
                {
                    if (gflip)
                    {
                        ground.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    }

                    if (grot == 1)
                    {
                        ground.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        gflip = true;
                        grot  = 0;
                    }
                    else if (grot == 2)
                    {
                        ground.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    }
                    else if (grot == 3)
                    {
                        ground.RotateFlip(RotateFlipType.Rotate180FlipX);
                    }
                }

                if (object1 != null)
                {
                    if (o1flip)
                    {
                        object1.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    }

                    if (o1rot == 1)
                    {
                        object1.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        o1flip = true;
                        o1rot  = 0;
                    }
                    else if (o1rot == 2)
                    {
                        object1.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    }
                    else if (o1rot == 3)
                    {
                        object1.RotateFlip(RotateFlipType.Rotate180FlipX);
                    }
                }

                if (object2 != null)
                {
                    if (o2flip)
                    {
                        object2.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    }
                }

                pos = getPositionByCellID(id, glvl, w, h);
            }
            catch { }
        }
コード例 #5
0
ファイル: Cell.cs プロジェクト: 745c5412/DofusWorldEditor
 public Cell(int i, int w, int h, Frames.MapFrame frame)
 {
     id    = i;
     Frame = frame;
     pos   = getPositionByCellID(i, glvl, w, h);
 }