Esempio n. 1
0
		public static void Load() {
			if( mLoaded )
				return;

			mLoaded = true;

			CConsole.InfoLine( "Begin World loading..." );

			Stopwatch watch = Stopwatch.StartNew();

			mLoading = true;

			mAddQueue = new Queue<SerialObject>();
			mDelQueue = new Queue<SerialObject>();
			mSerialObjects = new SerialObjectManager();

			Events.InvokeWorldLoadStart();

			//------------- loading start -------------

			// Loading Maps

			// Loading Items
			CConsole.Info( "\t# loading Items..." );
			watch.Reset();
			ResultTable table = Core.Database.Query( "SELECT * FROM item_db" );
			table.TableName = "ItemDB Table";
			if( table.Rows == null ) {
				CConsole.ErrorLine( "failed to load Item Database!" );
				CConsole.WriteLine( Core.Database.LastError.ToString() );
			} else
				for( int i = 0; i < table.Rows.Count; i++ ) {
					BaseItem item = new BaseItem( table[ i ] );
					//#TODO# add validation Checks
					mSerialObjects.Add( item );
				}
			watch.Stop();
			CConsole.WriteLine( "done (" + mSerialObjects.Count( ESerialType.Item ) + " Items in " + watch.ElapsedMilliseconds + "ms)" );

			// Loading Mobs

			// Loading other shit
			// o.o

			//------------- loading end -------------

			Events.InvokeWorldLoadFinish();

			mLoading = false;

			ProcessSafetyQueues();

			CConsole.InfoLine( "Finished World loading! Needed {0:F2} sec", watch.Elapsed.TotalSeconds );

			watch.Stop();
			watch = null;
		}
Esempio n. 2
0
        public static void Load()
        {
            if (mLoaded)
            {
                return;
            }

            mLoaded = true;

            CConsole.InfoLine("Begin World loading...");

            Stopwatch watch = Stopwatch.StartNew();

            mLoading = true;

            mAddQueue      = new Queue <SerialObject>();
            mDelQueue      = new Queue <SerialObject>();
            mSerialObjects = new SerialObjectManager();

            Events.InvokeWorldLoadStart();

            //------------- loading start -------------

            // Loading Maps

            // Loading Items
            CConsole.Info("\t# loading Items...");
            watch.Reset();
            ResultTable table = Core.Database.Query("SELECT * FROM item_db");

            table.TableName = "ItemDB Table";
            if (table.Rows == null)
            {
                CConsole.ErrorLine("failed to load Item Database!");
                CConsole.WriteLine(Core.Database.LastError.ToString());
            }
            else
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    BaseItem item = new BaseItem(table[i]);
                    //#TODO# add validation Checks
                    mSerialObjects.Add(item);
                }
            }
            watch.Stop();
            CConsole.WriteLine("done (" + mSerialObjects.Count(ESerialType.Item) + " Items in " + watch.ElapsedMilliseconds + "ms)");

            // Loading Mobs

            // Loading other shit
            // o.o

            //------------- loading end -------------

            Events.InvokeWorldLoadFinish();

            mLoading = false;

            ProcessSafetyQueues();

            CConsole.InfoLine("Finished World loading! Needed {0:F2} sec", watch.Elapsed.TotalSeconds);

            watch.Stop();
            watch = null;
        }