Ejemplo n.º 1
0
        /// <summary>
        /// The parse pointer.
        /// </summary>
        /// <param name="pointer">The pointer.</param>
        /// <param name="type">The type.</param>
        /// <remarks></remarks>
        public void ParsePointer(ref int pointer, ref MapTypes type)
        {
            long tempmap = pointer & 0XC0000000;

            pointer = pointer & 0X3FFFFFFF;
            if (tempmap == 0)
            {
                type = MapTypes.Internal;
                return;
            }
            else if (tempmap == 0X80000000)
            {
                type = MapTypes.MPShared;

                return;
            }
            else if (tempmap == 0XC0000000)
            {
                type = MapTypes.SPShared;
                return;
            }
            else if (tempmap == 0X40000000)
            {
                type = MapTypes.MainMenu;
                return;
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            DataConnection.DefaultSettings = new LinqToDBSettings();
            MapTypes.Map();

            using (var dc = new DataConnection())
            {
                var table = dc.GetTable <Aa>();

                table.Where(x => x.Name.StartsWith("A")).Set(a => a.Name, b => "B" + b.Name).Update();
            }


            //// Wenn du das ganze mit In Memory Datenbanken in Sqlite machen willst (z.B. für Unit Tests,
            //// musst du die DbConnection manuell erzeugen, weil wenn du den Migrator nutzen willst, du ja die gleich DbConnection brauchst.
            //// Das geht dann ungef. so:
            //var conn = new SQLiteConnection("Data Source=:memory:;Version=3;New=True;");
            //// jetzt die connection im Migator nutzen...
            //// Migator ... blablabla
            //// nun die Connection mit Linq2Db nutzen
            //using (var dc = new DataConnection(new SQLiteDataProvider(), conn))
            //{
            //	var table = dc.GetTable<Aa>();
            //	table.Where(x => x.Name.StartsWith("A")).Set(a => a.Name, b => "B" + b.Name).Update();
            //}


            Console.WriteLine("Feddich...");
            Console.ReadLine();
        }
Ejemplo n.º 3
0
 public override void AreaChange(AreaInstance area)
 {
     base.AreaChange(area);
     if (!Settings.Enable)
     {
         return;
     }
     CurrentZone = MapTypes.Skip;
     if (area.HasWaypoint || area.IsHideout || area.IsTown || area.RealLevel < 68)
     {
         CurrentZone = MapTypes.Skip;
     }
     else if (Contains(UniqueMaps, area.Name))
     {
         CurrentZone = MapTypes.Skip;
     }
     else if (Contains(CancerMaps, area.Name))
     {
         CurrentZone = MapTypes.Cancer;
         Play(DirectoryFullName + @"\Media\Cancer.wav");
     }
     else if (Contains(STierMaps, area.Name))
     {
         CurrentZone = MapTypes.Best;
     }
     else if (Contains(ATierMaps, area.Name))
     {
         CurrentZone = MapTypes.Good;
     }
     else if (area.RealLevel >= 81) // t14+ = 81+ area lvl
     {
         CurrentZone = MapTypes.Unknown;
     }
 }
Ejemplo n.º 4
0
        public string GetLatLngString(LatLng latLng, MapTypes map)
        {
            if (latLng == null)
            {
                throw new ValidationException("LatLng object is NULL", ValidationErrors.Empty);
            }

            if (latLng.IsSet == false)
            {
                return("0.000000,0.000000");
            }

            double[] ar = new double[2];
            switch (map)
            {
            case MapTypes.YandexMap:
                // Longitude and latitude in degrees;
                ar[0] = latLng.Lng;
                ar[1] = latLng.Lat;
                break;

            case MapTypes.GoogleMap:
                // comma-separated {latitude,longitude} pair
                ar[0] = latLng.Lat;
                ar[1] = latLng.Lng;
                break;

            default:
                throw new ValidationException("Could not convert LatLng to string for map: " + map.ToString(), ValidationErrors.IncorrectType);
            }

            return(String.Concat(ar[0].ToString("0.000000", CultureInfo.InvariantCulture), ",", ar[1].ToString("0.000000", CultureInfo.InvariantCulture)));
        }
Ejemplo n.º 5
0
        public LatLng ParseLatLng(string s, MapTypes mapType)
        {
            // Assume that coordinates are comma or slash separated. And decimal separator is dot
            string[] ar = s.Split(",/".ToCharArray());
            if (ar?.Length != 2)
            {
                throw new ValidationException("Expected 2 coordinates, separated with comma or slash. Error parsing incorrect string: " + s, ValidationErrors.NotEqual);
            }

            var ll = new LatLng();

            switch (mapType)
            {
            case MapTypes.YandexMap:
                break;

            case MapTypes.GoogleMap:
                // Expected lattiude/longtitude
                ll.Lat = Double.Parse(ar[0], CultureInfo.InvariantCulture);
                ll.Lng = Double.Parse(ar[1], CultureInfo.InvariantCulture);
                break;

            default:
                throw new ValidationException("Could not parse string to LatLng for map type: " + mapType.ToString(), ValidationErrors.IncorrectType);
            }

            return(ll);
        }
Ejemplo n.º 6
0
 public AdminSpaceModel(GSectorsDataModel sector, MapTypes mapType)
 {
     Id         = sector.Id;
     NativeName = sector.NativeName;
     Translate  = sector.Translate;
     MapType    = mapType;
 }
Ejemplo n.º 7
0
 public AdminSpaceModel(GGalaxyDataModel galaxy, MapTypes mapType)
 {
     Id         = galaxy.Id;
     NativeName = galaxy.NativeName;
     Translate  = galaxy.Translate;
     MapType    = mapType;
 }
Ejemplo n.º 8
0
 public AdminSpaceModel(GDetailSystemDataModel star, MapTypes mapType)
 {
     Id         = star.Id;
     NativeName = star.Name;
     Translate  = star.Description;
     MapType    = mapType;
 }
Ejemplo n.º 9
0
 public AdminSpaceModel(GDetailPlanetDataModel planet, MapTypes mapType)
 {
     Id         = planet.Id;
     NativeName = planet.Name;
     Translate  = planet.Description;
     MapType    = mapType;
 }
Ejemplo n.º 10
0
 public AdminSpaceModel(GDetailMoonDataModel moon, MapTypes mapType)
 {
     Id         = moon.Id;
     NativeName = moon.Name;
     Translate  = moon.Description;
     MapType    = mapType;
 }
Ejemplo n.º 11
0
 public void ExecuteEnterMap(int mapCode)
 {
     if (this._ClientData.MapCode >= 0 && this._ClientData.CopyMapID >= 0)
     {
         MapTypes mapType = Global.GetMapType(mapCode);
         if (mapType >= MapTypes.NormalCopy && mapType <= MapTypes.MarriageCopy)
         {
             CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(this._ClientData.CopyMapID);
             if (null != copyMap)
             {
                 lock (copyMap.EventQueue)
                 {
                     foreach (MapAIEvent e in copyMap.EventQueue)
                     {
                         int guangMuID = e.GuangMuID;
                         int show      = e.Show;
                         this.sendCmd(667, string.Format("{0}:{1}", guangMuID, show), false);
                     }
                 }
                 if (!copyMap.ExecEnterMapLuaFile)
                 {
                     copyMap.ExecEnterMapLuaFile = true;
                     GameMap gameMap = GameManager.MapMgr.DictMaps[this._ClientData.MapCode];
                     if (!string.IsNullOrEmpty(gameMap.EnterMapLuaFile))
                     {
                         Global.ExcuteLuaFunction(this, gameMap.EnterMapLuaFile, "comeOn", null, null);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
    public static List <List <TileType> > ReadMap(MapTypes mapType)
    {
        string path = MapTypesCtrl.GetPath(mapType);

        TextAsset reader  = Resources.Load(path) as TextAsset;
        string    content = reader.text;

        string[] lines = content.Split("\n" [0]);
        int      rows  = lines.Length;

        List <List <TileType> > map = new List <List <TileType> >();

        for (int i = 0; i < rows; i++)
        {
            if (lines[i][0] == ' ')
            {
                lines[i] = lines[i].Substring(1, lines[i].Length - 1);
            }
            string[]        elements = lines [i].Split(' ');
            List <TileType> row      = new List <TileType>();
            for (int j = 0; j < elements.Length; j++)
            {
                row.Add((TileType)int.Parse(elements [j]));
            }
            map.Add(row);
        }

        return(map);
    }
Ejemplo n.º 13
0
        private void LoadTemplate(ref AreaMapTemplate template)
        {
            areaMapType = template.mapType;

            //widthTiles = template.mapWidthTile;
            //heightTiles = template.mapHeightTile;
            //mapAreaTiles = widthTiles * heightTiles;
        }
Ejemplo n.º 14
0
 public GoogleMapApi(Location geoCoordinate, bool overviewMapControl, int zoom = 0, MapTypes mapType = MapTypes.ROADMAP, string apiKey = "")
 {
     _overviewMapControl = overviewMapControl;
     _apiKey             = apiKey;
     _mapType            = mapType;
     _zoom          = zoom;
     _geoCoordinate = geoCoordinate;
 }
Ejemplo n.º 15
0
 public BuildingUI(BuildingCollectionUI ctx, IBuilding building, RectangleShape shape, Vector2f pos, MapTypes type)
 {
     Shape = shape ?? throw new ArgumentNullException(nameof(shape));
     CtxBuildingCollectionUi = ctx;
     Pos           = pos;
     BuildingCtx   = building;
     Menu          = new ContextualMenu(this);
     DrawMenuState = false;
     MapTypes      = type;
 }
Ejemplo n.º 16
0
        /// <summary>
        ///     Get`s the <see cref="MapType" /> of the map's cutout
        /// </summary>
        /// <exception cref="Exception">Can't find a high enough prime</exception>
        public void GetMapTyp()
        {
            var containsWater = false;
            var containsLand  = false;

            // Get the pixels
            var pixels     = MapDataManager.Instance.MapTexture.GetPixels(SW_Point.X, SW_Point.Y, Width, Height);
            var pixelsSize = pixels.Length;

            var prime = Utilities.GetHigherPrime(pixelsSize);

            if (prime < 0)
            {
                throw new Exception("Couldn't find a higher prime");
            }

            var i = prime % pixelsSize;

            for (var j = 1; j <= pixelsSize; j++)
            {
                var pixelType = pixels[i].GetMapType();

                if (pixelType == MapTypes.Water && !containsWater)
                {
                    containsWater = true;
                }
                else if (pixelType != MapTypes.Water && !containsLand)
                {
                    containsLand = true;
                }

                if (containsWater && containsLand)
                {
                    break;
                }

                i = (i + prime) % pixelsSize;
            }

            if (containsLand && containsWater)
            {
                MapType = MapTypes.Mixed;
            }
            else if (containsLand)
            {
                MapType = MapTypes.Ground;
            }
            else
            {
                MapType = MapTypes.Water;
            }

            QuadtreeManager.Instance.RegisterNewNode(this);
        }
Ejemplo n.º 17
0
        private static MapTypes Find(Type type)
        {
            MapTypes valueTypes = null;

            if (!Map.TryGetValue(type, out valueTypes))
            {
                throw new ArgumentException($"Unsupported type \"{type}\".", nameof(type));
            }

            return(valueTypes);
        }
Ejemplo n.º 18
0
        public static Map GetMapByType(MapTypes type)
        {
            switch (type)
            {
            case MapTypes.DefaultMap:
                return(new DefaultMap());

            default:
                return(null);
            }
        }
Ejemplo n.º 19
0
        public Map(GraphicsDevice graphicsDevice, MapTypes type, Rectangle clientBounds)
        {
            switch (type)
            {
            case MapTypes.Dungeon:
                InitializeMap(graphicsDevice, clientBounds);
                return;

            default:
                throw new ArgumentException("Map type not handled");
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// The load halo 2 map header info.
        /// </summary>
        /// <param name="BR">The br.</param>
        /// <remarks></remarks>
        public void LoadHalo2MapHeaderInfo(ref BinaryReader BR)
        {
            // map stuff
            BR.BaseStream.Position = 8;
            fileSize = BR.ReadInt32();
            BR.BaseStream.Position = 16;
            indexOffset            = BR.ReadInt32();
            metaStart              = BR.ReadInt32();
            metaSize               = BR.ReadInt32();
            combinedSize           = BR.ReadInt32();
            BR.BaseStream.Position = 340;
            sizeOfCrazy            = BR.ReadInt32();
            offsetToCrazy          = BR.ReadInt32();

            // string stuff
            BR.BaseStream.Position = 352;
            offsetToStringNames1   = BR.ReadInt32();
            scriptReferenceCount   = BR.ReadInt32();
            sizeOfScriptReference  = BR.ReadInt32();
            offsetToStringIndex    = BR.ReadInt32();
            offsetToStringNames2   = BR.ReadInt32();

            // map names and code to check if it is an external map
            BR.BaseStream.Position = 408;
            mapName = new string(BR.ReadChars(36));
            BR.BaseStream.Position = 444;
            scenarioPath           = new string(BR.ReadChars(64));
            mapType = MapTypes.Internal;
            if (scenarioPath.IndexOf("scenarios\\ui\\mainmenu\\mainmenu") != -1)
            {
                mapType = MapTypes.MainMenu;
            }

            if (scenarioPath.IndexOf("scenarios\\shared\\shared") != -1)
            {
                mapType = MapTypes.MPShared;
            }

            if (scenarioPath.IndexOf("scenarios\\shared\\single_player_shared") != -1)
            {
                mapType = MapTypes.SPShared;
            }

            // read in stuff about meta names
            BR.BaseStream.Position = 704;
            fileCount         = BR.ReadInt32();
            offsetTofileNames = BR.ReadInt32();
            fileNamesSize     = BR.ReadInt32();
            offsetTofileIndex = BR.ReadInt32();

            // signature
            signature = BR.ReadInt32();
        }
Ejemplo n.º 21
0
 public TMap(int Map, DataStore mapDataStore)
 {
     Type = MapTypes.MAP_COMMON;
     Name = "";
     TileUsed = new bool[64, 64];
     Tiles = new TMapTile[64, 64];
     checked
     {
         if (WorldServiceLocator._WS_Maps.Maps.ContainsKey((uint)Map))
         {
             return;
         }
         WorldServiceLocator._WS_Maps.Maps.Add((uint)Map, this);
         int x = 0;
         do
         {
             int y = 0;
             do
             {
                 TileUsed[x, y] = false;
                 y++;
             }
             while (y <= 63);
             x++;
         }
         while (x <= 63);
         try
         {
             int num = mapDataStore.Rows - 1;
             for (int i = 0; i <= num; i++)
             {
                 int tmpMap = mapDataStore.ReadInt(i, 0);
                 if (tmpMap == Map)
                 {
                     ID = Map;
                     Type = (MapTypes)mapDataStore.ReadInt(i, 2);
                     Name = mapDataStore.ReadString(i, 4);
                     break;
                 }
             }
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.INFORMATION, "DBC: 1 Map initialized.", mapDataStore.Rows - 1);
         }
         catch (DirectoryNotFoundException ex)
         {
             ProjectData.SetProjectError(ex);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("DBC File : Map missing.");
             Console.ForegroundColor = ConsoleColor.Gray;
             ProjectData.ClearProjectError();
         }
     }
 }
Ejemplo n.º 22
0
    public Maps ReadMap(MapTypes mapType)
    {
        string filePath = ProjectPaths.RESOURCES_MAP_SETTINGS + Enum.GetName(typeof(MapTypes), mapType) + ".txt";

        HashSet <MapCell>     resultMap  = new HashSet <MapCell>();
        List <string>         lines      = new List <string>();
        List <SpawnWavesData> spawnWaves = new List <SpawnWavesData>();

        using (StreamReader sr = new StreamReader(filePath))
        {
            bool readingMap      = true;
            int  spawnWavesIndex = 1;
            do
            {
                string line = sr.ReadLine();

                if (line == "#")
                {
                    readingMap = false;
                }
                else if (readingMap)
                {
                    lines.Add(line);
                }
                else
                {
                    string[] spawnNumbers = line.Split(' ');
                    if (spawnNumbers.Length == 2)
                    {
                        spawnWaves.Add(new SpawnWavesData(spawnWavesIndex++, int.Parse(spawnNumbers[0]), int.Parse(spawnNumbers[1])));
                    }
                }
            } while (!sr.EndOfStream);
        }


        for (int lineIndex = lines.Count - 1, columnIndex = 0; lineIndex >= 0; lineIndex--, columnIndex++)
        {
            string line = lines[lineIndex];
            for (int rowIndex = 0; rowIndex < line.Length; rowIndex++)
            {
                char item = line[rowIndex];

                resultMap.Add(new MapCell(rowIndex, columnIndex, item));
            }
        }
        return(new Maps {
            GridCells = resultMap, SpawnWaves = spawnWaves, RowCounts = lines.Count, ColumnCounts = lines.FirstOrDefault()?.Length ?? 0
        });
    }
        internal void LoadBuildings()
        {
            foreach (BuildingUI buildingUI in BuildingsUIList)
            {
                buildingUI.Dispose();
            }

            BuildingsUIList.Clear();

            foreach (IBuilding building in CtxfarmUI.Farm.Buildings.
                     BuildingList)
            {
                CtxfarmUI.CtxGame.Window.MapPixelToCoords(
                    new Vector2i((int)building.PosVector.X,
                                 (int)building.PosVector.Y));
                MapTypes type = MapTypes.None;
                Texture  houseTexture;
                if (building is Henhouse)
                {
                    houseTexture = CtxfarmUI.FarmOptionsUI.HenhouseTexture[building.Lvl];
                    type         = MapTypes.InnerHenhouse;
                }
                else if (building is SeedStorage)
                {
                    houseTexture = CtxfarmUI.FarmOptionsUI.StorageTexture[building.Lvl];
                }
                else if (building is EggStorage)
                {
                    houseTexture = CtxfarmUI.FarmOptionsUI.StorageTexture[building.Lvl];
                }
                else if (building is MeatStorage)
                {
                    houseTexture = CtxfarmUI.FarmOptionsUI.StorageTexture[building.Lvl];
                }
                else
                {
                    houseTexture = null;
                }

                if (houseTexture != null)
                {
                    BuildingsUIList.Add(new BuildingUI(this, building,
                                                       new RectangleShape(( Vector2f )houseTexture.Size)
                    {
                        Texture  = houseTexture,
                        Position = new Vector2f(building.PosVector.X, building.PosVector.Y)
                    }, new Vector2f(building.PosVector.X, building.PosVector.Y), type));
                }
            }
        }
Ejemplo n.º 24
0
        public void LoadMap(MapTypes type, int lvl = 0)
        {
            CtxGame.FarmUI.Farm.CollideCollection.Clear();

            if (type == MapTypes.InnerHenhouse)
            {
                CtxGame.FarmUI.FarmOptionsUI.MapPath.TryGetValue(( int )MapTypes.InnerHenhouse, out string[] file);
                CurrentMap = new TileMap(file?[0], CtxGame);
            }
            else
            {
                CtxGame.FarmUI.FarmOptionsUI.MapPath.TryGetValue(( int )MapTypes.World, out string[] file);
                CurrentMap = new TileMap(file?[0], CtxGame);
            }
        }
Ejemplo n.º 25
0
        public static string MapTypeName(MapTypes mt)
        {
            switch (mt)
            {
            case MapTypes.WGXmlMap:
                return("WgXml");

            case MapTypes.XmlMap:
                return("Xml");

            case MapTypes.TxtMap:
                return("Txt");

            default:
                return(MapTypeName(MapTypes.WGXmlMap));
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 执行进入地图的lua脚本
        /// </summary>
        /// <param name="mapCode"></param>
        public void ExecuteEnterMap(int mapCode)
        {
            //角色死亡,并且登出的时候,会被配置成 -1
            if (_ClientData.MapCode < 0 || _ClientData.CopyMapID < 0)
            {
                return;
            }

            MapTypes mapType = Global.GetMapType(mapCode);

            if (mapType >= MapTypes.NormalCopy && mapType <= MapTypes.JingJiChang)
            {
                /// 获取副本地图对象
                CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(_ClientData.CopyMapID);
                if (null == copyMap)
                {
                    return;
                }

                //重发AI相关的指令队列
                lock (copyMap.EventQueue)
                {
                    foreach (var e in copyMap.EventQueue)
                    {
                        int guangMuID = e.GuangMuID;
                        int show      = e.Show;
                        sendCmd((int)TCPGameServerCmds.CMD_SPR_MAPAIEVENT, string.Format("{0}:{1}", guangMuID, show));
                    }
                }

                if (copyMap.ExecEnterMapLuaFile)
                {
                    return;
                }

                copyMap.ExecEnterMapLuaFile = true;

                GameMap gameMap = GameManager.MapMgr.DictMaps[_ClientData.MapCode];
                if (!string.IsNullOrEmpty(gameMap.EnterMapLuaFile))
                {
                    //执行对话脚本
                    Global.ExcuteLuaFunction(this, gameMap.EnterMapLuaFile, "comeOn", null, null);
                }
            }
        }
Ejemplo n.º 27
0
        internal static void CacheImage(string text, int zoom, MapTypes mapType, byte[] byteArray)
        {
            using (var connection = new SqlConnection(connectionString))
            {
                connection.Open();

                var query = @"IF NOT EXISTS
                                (SELECT 1 FROM CachedImages
                                WHERE SearchText = @SearchText
                                    AND Zoom = @Zoom
                                    AND MapType = @MapType)
                            BEGIN
                                INSERT INTO CachedImages (SearchText, Zoom, MapType, ImageBinary)
                                VALUES (@SearchText, @Zoom, @MapType, @ImageBinary)
                            END";

                var command = new SqlCommand();
                command.Connection  = connection;
                command.CommandText = query;
                var searchTextParam = new SqlParameter("@SearchText", System.Data.SqlDbType.NVarChar, 255)
                {
                    Value = text
                };
                var zoomParam = new SqlParameter("@Zoom", System.Data.SqlDbType.Int)
                {
                    Value = zoom
                };
                var mapTypeParam = new SqlParameter("@MapType", System.Data.SqlDbType.Int)
                {
                    Value = (int)mapType
                };
                var imageBinaryParam = new SqlParameter("@ImageBinary", System.Data.SqlDbType.VarBinary)
                {
                    Value = byteArray
                };

                command.Parameters.Add(searchTextParam);
                command.Parameters.Add(zoomParam);
                command.Parameters.Add(mapTypeParam);
                command.Parameters.Add(imageBinaryParam);

                var result = command.ExecuteNonQuery();
            }
        }
Ejemplo n.º 28
0
        public void testRemoteMapTypes()
        {
            log.info("testRemoteMapTypes(");

            MapTypes obj = new MapTypes();

            obj.Boolean1        = new MyMap <String, bool>().add("bool1", true).add("bool2", false);
            obj.Byte1           = new MyMap <double, byte>().add(1.0, (byte)1).add(2.0, (byte)2);
            obj.Char1           = new MyMap <float, char>().add(-1.0f, 'a').add(1.0e-1f, 'b');
            obj.Double1         = new MyMap <byte, double>().add((byte)3, -1.0e12);
            obj.Float1          = new MyMap <char, float>().add('A', 1.0f).add('¶', 2.0f).add('€', -1.2468e-3f);
            obj.Int1            = new MyMap <int, int>().add(1, 2).add(2, 3);
            obj.Long1           = new MyMap <short, long>().add((short)99, 33L).add((short)-99, -33L);
            obj.PrimitiveTypes1 = new MyMap <int, PrimitiveTypes>().add(1, TestUtils.createObjectPrimitiveTypes()).add(2, TestUtils.createObjectPrimitiveTypes());
            obj.Short1          = new MyMap <long, short>().add(-55L, (short)1234).add(0x5555555555555555L, (short)5555);
            obj.Date1           = new MyMap <string, DateTime>().add("A", new DateTime(1600, 1, 2, 3, 4, 5, 6));
            obj.String1         = new MyMap <String, String>().add("A", "a").add("B", "b");

            remote.SetBoolean1(obj.Boolean1);
            TestUtils.assertEquals(log, "boolean1", obj.Boolean1, remote.GetBoolean1());
            remote.SetByte1(obj.Byte1);
            TestUtils.assertEquals(log, "byte1", obj.Byte1, remote.GetByte1());
            remote.SetChar1(obj.Char1);
            TestUtils.assertEquals(log, "char1", obj.Char1, remote.GetChar1());
            remote.SetDouble1(obj.Double1);
            TestUtils.assertEquals(log, "double1", obj.Double1, remote.GetDouble1());
            remote.SetFloat1(obj.Float1);
            TestUtils.assertEquals(log, "float1", obj.Float1, remote.GetFloat1());
            remote.SetInt1(obj.Int1);
            TestUtils.assertEquals(log, "int1", obj.Int1, remote.GetInt1());
            remote.SetLong1(obj.Long1);
            TestUtils.assertEquals(log, "long1", obj.Long1, remote.GetLong1());
            remote.SetPrimitiveTypes1(obj.PrimitiveTypes1);
            TestUtils.assertEquals(log, "primitiveTypes1", obj.PrimitiveTypes1, remote.GetPrimitiveTypes1());
            remote.SetShort1(obj.Short1);
            TestUtils.assertEquals(log, "short1", obj.Short1, remote.GetShort1());
            remote.SetString1(obj.String1);
            TestUtils.assertEquals(log, "string1", obj.String1, remote.GetString1());/* USE THIS FILE ACCORDING TO THE COPYRIGHT RULES IN LICENSE.TXT WHICH IS PART OF THE SOURCE CODE PACKAGE */

            remote.SetDate1(obj.Date1);
            TestUtils.assertEquals(log, "date1", obj.Date1, remote.GetDate1());

            log.info(")testRemoteMapTypes");
        }
Ejemplo n.º 29
0
    public static string GetPath(MapTypes type)
    {
        string root = "Maps/";

        switch (type)
        {
        case MapTypes.Small:
            return(root + "small");

        case MapTypes.Medium:
            return(root + "medium");

        case MapTypes.Big:
            return(root + "big");

        default:
            return(root + "medium");
        }
    }
Ejemplo n.º 30
0
 public MapEntry(int mapId, TStringType directory, MapTypes mapType, AreaFlags flags, bool isPvPMap, LocalizedStringDBC <TStringType> mapName, int areaTableId, LocalizedStringDBC <TStringType> mapDescription0, LocalizedStringDBC <TStringType> mapDescription1, int loadingScreenId, float minimapIconScale, int corpseMapId, Vector2 <int> corpse, int timeOfDayOverride, Expansions expansion, int raidOffset, int maxPlayers)
 {
     MapId             = mapId;
     Directory         = directory;
     MapType           = mapType;
     Flags             = flags;
     PvP               = isPvPMap ? 1 : 0;
     MapName           = mapName;
     AreaTableId       = areaTableId;
     MapDescription0   = mapDescription0;
     MapDescription1   = mapDescription1;
     LoadingScreenId   = loadingScreenId;
     MinimapIconScale  = minimapIconScale;
     CorpseMapId       = corpseMapId;
     Corpse            = corpse;
     TimeOfDayOverride = timeOfDayOverride;
     ExpansionId       = (int)expansion;
     RaidOffset        = raidOffset;
     MaxPlayers        = maxPlayers;
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Opens a Halo/Halo 2 based map for reading / writing (not readonly).
        /// </summary>
        /// <param name="type">MapTypes.(Internal, MainMenu, MPShared, SPShared, Bitmaps)</param>
        /// <param name="readOnly">opens map file as read-only (does NOT apply to internal map file)</param>
        /// <remarks></remarks>
        public void OpenMap(MapTypes type, bool readOnly)
        {
            if (isOpen && type == this.openMapType)
            {
                if (!(type != MapTypes.Internal && (FS.CanWrite == readOnly)))
                {
                    return;
                }
            }

            CloseMap();
            try
            {
                string temp = string.Empty;
                //int x = 0;
                switch (type)
                {
                    case MapTypes.Internal:
                        temp = filePath;
                        break;
                    case MapTypes.MainMenu:

                        // x = filePath.LastIndexOf('\\');
                        // temp = filePath.Substring(0, x + 1) + "mainmenu.map";
                        temp = Prefs.pathMainmenu;
                        if ((!Prefs.useDefaultMaps) && (filePath.LastIndexOf('\\') != -1))
                        {
                            string currentMainMenu = filePath.Substring(0, filePath.LastIndexOf('\\') + 1) +
                                                     "mainmenu.map";
                            if (File.Exists(currentMainMenu))
                            {
                                temp = currentMainMenu;
                            }
                        }

                        break;
                    case MapTypes.MPShared:
                        temp = Prefs.pathShared;
                        if ((!Prefs.useDefaultMaps) && (filePath.LastIndexOf('\\') != -1))
                        {
                            string currentMPShared = filePath.Substring(0, filePath.LastIndexOf('\\') + 1) +
                                                     "shared.map";
                            if (File.Exists(currentMPShared))
                            {
                                temp = currentMPShared;
                            }
                        }

                        break;
                    case MapTypes.SPShared:
                        temp = Prefs.pathSPShared;
                        if ((!Prefs.useDefaultMaps) && (filePath.LastIndexOf('\\') != -1))
                        {
                            string currentSPShared = filePath.Substring(0, filePath.LastIndexOf('\\') + 1) +
                                                     "single_player_shared.map";
                            if (File.Exists(currentSPShared))
                            {
                                temp = currentSPShared;
                            }
                        }

                        break;
                    case MapTypes.Bitmaps:
                        temp = Prefs.pathBitmaps;
                        break;
                }

                FileAccess fa = FileAccess.Read;
                if (type == MapTypes.Internal)
                {
                    fa = FileAccess.ReadWrite;
                }

                if (type != MapTypes.Internal && !readOnly)
                {
                    if (
                        MessageBox.Show(
                            "You are about to write to a shared file\n" + temp + "\nContinue?",
                            "Write to shared file?",
                            MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        fa = FileAccess.ReadWrite;
                    }
                    else
                    {
                        return;
                    }
                }

                FS = new FileStream(temp, FileMode.Open, fa);
                BR = new BinaryReader(FS);
                if (fa != FileAccess.Read)
                {
                    BW = new BinaryWriter(FS);
                }

                isOpen = true;
                openMapType = type;
            }
            catch (Exception ex)
            {
                if (type.ToString() == "Internal")
                {
                    Global.ShowErrorMsg(filePath + " - Not Found\n", ex);
                }
                else
                {
                    Global.ShowErrorMsg(type + " - Map Not Found\n", ex);
                }

                isOpen = false;
            }
        }
Ejemplo n.º 32
0
        /// <summary>
        /// The parse pointer.
        /// </summary>
        /// <param name="pointer">The pointer.</param>
        /// <param name="type">The type.</param>
        /// <remarks></remarks>
        public void ParsePointer(ref int pointer, ref MapTypes type)
        {
            long tempmap = pointer & 0XC0000000;
            pointer = pointer & 0X3FFFFFFF;
            if (tempmap == 0)
            {
                type = MapTypes.Internal;
                return;
            }
            else if (tempmap == 0X80000000)
            {
                type = MapTypes.MPShared;

                return;
            }
            else if (tempmap == 0XC0000000)
            {
                type = MapTypes.SPShared;
                return;
            }
            else if (tempmap == 0X40000000)
            {
                type = MapTypes.MainMenu;
                return;
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Halo 2 Vista map header info.
        /// </summary>
        /// <param name="BR">The br.</param>
        /// <remarks></remarks>
        public void LoadHaloCEMapHeaderInfo(ref BinaryReader BR)
        {
            BR.BaseStream.Position = 8;
            fileSize = BR.ReadInt32();
            BR.BaseStream.Position = 16;
            indexOffset = BR.ReadInt32();
            metaStart = BR.ReadInt32();
            metaSize = BR.ReadInt32();
            combinedSize = BR.ReadInt32();
            BR.BaseStream.Position = 340;
            sizeOfCrazy = BR.ReadInt32();
            offsetToCrazy = BR.ReadInt32();

            // string stuff
            BR.BaseStream.Position = 364;
            offsetToStringNames1 = BR.ReadInt32();
            scriptReferenceCount = BR.ReadInt32();
            sizeOfScriptReference = BR.ReadInt32();
            offsetToStringIndex = BR.ReadInt32();
            offsetToStringNames2 = BR.ReadInt32();

            /*
            BR.BaseStream.Position = 364;
            SIDMetaTableOffset = BR.ReadInt32();
            SIDCount = BR.ReadInt32();
            SIDTableSize = BR.ReadInt32();
            SIDIndexOffset = BR.ReadInt32();
            SIDTableOffset = BR.ReadInt32();
            */

            // map names and code to check if it is an external map
            BR.BaseStream.Position = 420;
            mapName = new string(BR.ReadChars(36));
            BR.BaseStream.Position = 456;
            scenarioPath = new string(BR.ReadChars(80));
            mapType = MapTypes.Internal;
            if (scenarioPath.IndexOf("scenarios\\ui\\mainmenu\\mainmenu") != -1)
            {
                mapType = MapTypes.MainMenu;
            }

            if (scenarioPath.IndexOf("scenarios\\shared\\shared") != -1)
            {
                mapType = MapTypes.MPShared;
            }

            if (scenarioPath.IndexOf("scenarios\\shared\\single_player_shared") != -1)
            {
                mapType = MapTypes.SPShared;
            }

            // read in stuff about meta names
            BR.BaseStream.Position = 716;
            fileCount = BR.ReadInt32();
            offsetTofileNames = BR.ReadInt32();
            fileNamesSize = BR.ReadInt32();
            offsetTofileIndex = BR.ReadInt32();

            //Model Raw
            /*
            BR.BaseStream.Position = 744;
            ModelRawTableStart = BR.ReadInt32();
            ModelRawTableSize = BR.ReadInt32();
            */

            // signature
            BR.BaseStream.Position = 752;
            signature = BR.ReadInt32();
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Opens the
 /// </summary>
 /// <param name="type">The type.</param>
 /// <remarks></remarks>
 public void OpenMap(MapTypes type)
 {
     OpenMap(type, true);
 }