예제 #1
0
        /// <summary>
        /// Create and initialized UODataManager object, wich represent viewmodel and logic of UO data.
        /// </summary>
        /// <param name="uri">Folder path to client data or data-server address. At this momment only local path are supported.</param>
        /// <param name="type">Combination of flags to specify general behavior of UOEngine.
        /// * if you want to use _x version of maps and statics use UseExtFacet flag (only for SA and HS),
        /// * to use special abilities of UOEngine you need additional files, to do it use UseExtFiles flag.</param>
        /// <param name="language">Specify language that used in data files and server.</param>
        /// <param name="dataoptions">Additional options. Set it 'null' for autodetect.</param>
        /// <param name="realtime">If true, engine will save all data at realtime, otherwise it will caching them and save changes in local folder.</param>
        public UODataManager(Uri uri, UODataType type, Language language, UODataOptions dataoptions = null, bool realtime = true)
        {
            if (uri == null || type == 0 || language == null)
            {
                throw new ArgumentException("Bad parametre values");
            }
            if (m_Instanes.ContainsKey(uri))
            {
                throw new ArgumentException("Already inited with selected Uri");
            }

            Location        = uri;
            DataType        = type;
            Language        = language;
            RealTime        = realtime;
            m_Instanes[uri] = this;

            dataOptions = dataoptions ?? new UODataOptions(Location);
            dataFactory = (type.HasFlag(UODataType.UseMulFiles) || type.HasFlag(UODataType.UseUopFiles)) ? new ClassicFactory(this) : null;

            // Initialize data... its loading, wait, wait
            // TODO: We need separeted thread for data working
            StorageMaps = dataFactory.GetMapFacets();
            StorageLand = dataFactory.GetLandTiles();
            StorageItem = dataFactory.GetItemTiles();
            StorageGump = dataFactory.GetGumpSurfs();
            StorageAnim = dataFactory.GetAnimations();
        }
예제 #2
0
        /// <summary>
        /// Create and initialized UODataManager object, wich represent viewmodel and logic of UO data.
        /// </summary>
        /// <param name="uri">Folder path to client data or data-server address. At this momment only local path are supported.</param>
        /// <param name="type">Combination of flags to specify general behavior of UOEngine.
        /// * if you want to use _x version of maps and statics use UseExtFacet flag (only for SA and HS),
        /// * to use special abilities of UOEngine you need additional files, to do it use UseExtFiles flag.</param>
        /// <param name="language">Specify language that used in data files and server.</param>
        /// <param name="dataoptions">Additional options. Set it 'null' for autodetect.</param>
        /// <param name="realtime">If true, engine will save all data at realtime, otherwise it will caching them and save changes in local folder.</param>
        public UODataManager(Uri uri, UODataType type, Language language, UODataOptions dataoptions = null, bool realtime = true)
        {
            CheckValues(uri, type, language, dataoptions, realtime);

            Location        = uri;
            DataType        = type;
            Language        = language;
            RealTime        = realtime;
            m_Instanes[uri] = this;

            dataOptions = dataoptions ?? new UODataOptions(Location);
            dataFactory = (type.HasFlag(UODataType.UseMulFiles) || type.HasFlag(UODataType.UseUopFiles)) ? new ClassicFactory(this) : null;

            if (dataFactory == null)
            {
                return;
            }

            // Initialize data... its loading, wait, wait
            // TODO: We need separeted thread for data working
            _storageMaps = dataFactory.GetMapFacets();
            _storageLand = dataFactory.GetLandTiles();
            _storageItem = dataFactory.GetItemTiles();
            _storageGump = dataFactory.GetGumpSurfs();
            _storageAnim = dataFactory.GetAnimations();
        }
예제 #3
0
 private static void CheckValues(Uri uri, UODataType type, Language language, UODataOptions dataoptions = null, bool realtime = true)
 {
     if (uri == null || type == 0 || language == null)
     {
         throw new ArgumentException("Bad parametre values");
     }
     if (m_Instanes.ContainsKey(uri))
     {
         throw new ArgumentException("Already inited with selected Uri");
     }
 }
예제 #4
0
        public static UODataManager GetInstance(Uri uri, UODataType type, Language language, UODataOptions dataoptions = null, bool realtime = true)
        {
            if (uri == null || type == 0 || language == null)
            {
                throw new ArgumentException("Bad parametre values");
            }
            if (!m_Instanes.ContainsKey(uri))
            {
                return(new UODataManager(uri, type, language, dataoptions, realtime));
            }


            var result = m_Instanes[uri] as UODataManager;

            if (result != null)
            {
                result.Dispose();
            }

            return(new UODataManager(uri, type, language, dataoptions, realtime));
        }
        private DataType DataSelector(Version version)
        {
            if (version < new Version(1, 23, 27))
            {
                _data = UODataType.ClassicPreAlphaVersion;
                return DataType.ClassicPreAlphaVersion;
            }
            // /// Classic Client (UO: Shattered Legacy)
            // /// Versions: from 1.23.27 up to 1.26.4j
            if (version >= new Version(1, 23, 27) && version <= new Version(1, 26, 4))
            {
                _data = UODataType.ClassicShatteredLegacy;
                return DataType.ClassicShatteredLegacy;
            }

            //// /// Classic Client (UO: Renaissance)
            //// /// Versions: from 2.0.0 up to 2.0.9a
            if (version >= new Version(2, 0, 0) && version <= new Version(2, 0, 9))
            {
                _data = UODataType.ClassicRenaissance;
                return DataType.ClassicRenaissance;
            }


            //// /// Classic Client (UO: Third Dawn)
            //// /// Versions: from 3.0.0 up to 3.0.7a
            if (version >= new Version(3, 0, 0) && version <= new Version(3, 0, 7))
            {
                _data = UODataType.ClassicThirdDawn;
                return DataType.ClassicThirdDawn;
            }


            //// /// Classic Client (UO: Blackthorn's Revenge)
            //// /// Versions: from 3.0.7b up to 3.0.8r
            if (version >= new Version(3, 0, 7) && version <= new Version(3, 0, 8))
            {
                _data = UODataType.ClassicLordBlackthornsRevenge;
                return DataType.ClassicLordBlackthornsRevenge;
            }

            //// /// Classic Client (UO: Age of Shadows)
            //// /// Versions: from 3.0.8z up to 4.0.4b2
            if (version >= new Version(3, 0, 8) && version <= new Version(4, 0, 4))
            {
                _data = UODataType.ClassicAgeOfShadows;
                return DataType.ClassicAgeOfShadows;
            }


            //// /// Classic Client (UO: Samurai Empire)
            //// /// Versions: from 4.0.5a up to 4.0.11c
            if (version >= new Version(4, 0, 5) && version <= new Version(4, 0, 11))
            {
                _data = UODataType.ClassicSamuraiEmpire;
                return DataType.ClassicSamuraiEmpire;
            }

            //// /// Classic Client (UO: Mondain's Legacy)
            //// /// Versions: from 4.0.11d up to 6.0.14.2
            if (version >= new Version(4, 0, 11) && version <= new Version(6, 0, 14, 2))
            {
                _data = UODataType.ClassicMondainsLegacy;
                return DataType.ClassicMondainsLegacy;
            }

            //// /// Classic Client (UO: Stygian Abyss)
            //// /// Versions: from 6.0.14.3 up to 7.0.8.2
            if (version >= new Version(6, 0, 14, 3) && version <= new Version(7, 0, 8, 2))
            {
                _data = UODataType.ClassicStygianAbyss;
                return DataType.ClassicStygianAbyss;
            }

            //// /// Classic Client (UO: Adventures On High Seas)
            //// /// Versions: from 7.0.8.44 up to 7.0.23.1
            if (version >= new Version(7, 0, 8, 44) && version <= new Version(7, 0, 23, 1))
            {
                _data = UODataType.ClassicAdventuresOnHighSeas;
                return DataType.ClassicAdventuresOnHighSeas;
            }

            //// /// Classic Client (UO: Adventures On High Seas)
            //// /// Versions: from 7.0.23.2 up to 7.0.X.X
            if (version > new Version(7, 0, 23, 2))
            {
                _data = UODataType.ClassicAdventuresOnHighSeasUpdated;
                return DataType.ClassicAdventuresOnHighSeasUpdated;
            }

            _data = UODataType.UseOldDatas;
            return 0;
        }
예제 #6
0
        /// <summary>
        /// Create and initialized UODataManager object, wich represent viewmodel and logic of UO data.
        /// </summary>
        /// <param name="uri">Folder path to client data or data-server address. At this momment only local path are supported.</param>
        /// <param name="type">Combination of flags to specify general behavior of UOEngine. 
        /// * if you want to use _x version of maps and statics use UseExtFacet flag (only for SA and HS),
        /// * to use special abilities of UOEngine you need additional files, to do it use UseExtFiles flag.</param>
        /// <param name="language">Specify language that used in data files and server.</param>
        /// <param name="dataoptions">Additional options. Set it 'null' for autodetect.</param>
        /// <param name="realtime">If true, engine will save all data at realtime, otherwise it will caching them and save changes in local folder.</param>
        public UODataManager(Uri uri, UODataType type, Language language, UODataOptions dataoptions = null, bool realtime = true)
        {
            if (uri == null || type == 0 || language == null)
                throw new ArgumentException("Bad parametre values");
            if (m_Instanes.ContainsKey(uri))
                throw new ArgumentException("Already inited with selected Uri");

            Location = uri;
            DataType = type;
            Language = language;
            RealTime = realtime;
            m_Instanes[uri] = this;

            dataOptions = dataoptions ?? new UODataOptions(Location);
            dataFactory = (type.HasFlag(UODataType.UseMulFiles) || type.HasFlag(UODataType.UseUopFiles)) ? new ClassicFactory(this) : null;

            // Initialize data... its loading, wait, wait
            // TODO: We need separeted thread for data working
            StorageMaps = dataFactory.GetMapFacets();
            StorageLand = dataFactory.GetLandTiles();
            StorageItem = dataFactory.GetItemTiles();
            StorageGump = dataFactory.GetGumpSurfs();
            StorageAnim = dataFactory.GetAnimations();
        }
        private DataType DataSelector(Version version)
        {
            if (version < new Version(1, 23, 27))
            {
                _data = UODataType.ClassicPreAlphaVersion;
                return(DataType.ClassicPreAlphaVersion);
            }
            // /// Classic Client (UO: Shattered Legacy)
            // /// Versions: from 1.23.27 up to 1.26.4j
            if (version >= new Version(1, 23, 27) && version <= new Version(1, 26, 4))
            {
                _data = UODataType.ClassicShatteredLegacy;
                return(DataType.ClassicShatteredLegacy);
            }

            //// /// Classic Client (UO: Renaissance)
            //// /// Versions: from 2.0.0 up to 2.0.9a
            if (version >= new Version(2, 0, 0) && version <= new Version(2, 0, 9))
            {
                _data = UODataType.ClassicRenaissance;
                return(DataType.ClassicRenaissance);
            }


            //// /// Classic Client (UO: Third Dawn)
            //// /// Versions: from 3.0.0 up to 3.0.7a
            if (version >= new Version(3, 0, 0) && version <= new Version(3, 0, 7))
            {
                _data = UODataType.ClassicThirdDawn;
                return(DataType.ClassicThirdDawn);
            }


            //// /// Classic Client (UO: Blackthorn's Revenge)
            //// /// Versions: from 3.0.7b up to 3.0.8r
            if (version >= new Version(3, 0, 7) && version <= new Version(3, 0, 8))
            {
                _data = UODataType.ClassicLordBlackthornsRevenge;
                return(DataType.ClassicLordBlackthornsRevenge);
            }

            //// /// Classic Client (UO: Age of Shadows)
            //// /// Versions: from 3.0.8z up to 4.0.4b2
            if (version >= new Version(3, 0, 8) && version <= new Version(4, 0, 4))
            {
                _data = UODataType.ClassicAgeOfShadows;
                return(DataType.ClassicAgeOfShadows);
            }


            //// /// Classic Client (UO: Samurai Empire)
            //// /// Versions: from 4.0.5a up to 4.0.11c
            if (version >= new Version(4, 0, 5) && version <= new Version(4, 0, 11))
            {
                _data = UODataType.ClassicSamuraiEmpire;
                return(DataType.ClassicSamuraiEmpire);
            }

            //// /// Classic Client (UO: Mondain's Legacy)
            //// /// Versions: from 4.0.11d up to 6.0.14.2
            if (version >= new Version(4, 0, 11) && version <= new Version(6, 0, 14, 2))
            {
                _data = UODataType.ClassicMondainsLegacy;
                return(DataType.ClassicMondainsLegacy);
            }

            //// /// Classic Client (UO: Stygian Abyss)
            //// /// Versions: from 6.0.14.3 up to 7.0.8.2
            if (version >= new Version(6, 0, 14, 3) && version <= new Version(7, 0, 8, 2))
            {
                _data = UODataType.ClassicStygianAbyss;
                return(DataType.ClassicStygianAbyss);
            }

            //// /// Classic Client (UO: Adventures On High Seas)
            //// /// Versions: from 7.0.8.44 up to 7.0.23.1
            if (version >= new Version(7, 0, 8, 44) && version <= new Version(7, 0, 23, 1))
            {
                _data = UODataType.ClassicAdventuresOnHighSeas;
                return(DataType.ClassicAdventuresOnHighSeas);
            }

            //// /// Classic Client (UO: Adventures On High Seas)
            //// /// Versions: from 7.0.23.2 up to 7.0.X.X
            if (version > new Version(7, 0, 23, 2))
            {
                _data = UODataType.ClassicAdventuresOnHighSeasUpdated;
                return(DataType.ClassicAdventuresOnHighSeasUpdated);
            }

            _data = UODataType.UseOldDatas;
            return(0);
        }