示例#1
0
文件: World.cs 项目: GodLesZ/svn-dump
		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;
		}
示例#2
0
		public void OnUseScript( NetState Player, BaseItem Item ) {

			for( int i = 0; i < mHandler.Count; i++ ) {
				if( mHandler[ i ] == null ) 
					continue;

				Item.ScriptArgs = mArguments[ i ];
				mHandler[ i ]( Player, Item );				
			}

		}
示例#3
0
		/// <summary>
		/// Generic Method to add HP
		/// </summary>
		/// <param name="Player"></param>
		/// <param name="Item"></param>
		public static void AddHP( NetState Player, BaseItem Item ) {
			if( Item.ScriptArgs == null || Item.ScriptArgs.Length == 0 )
				return;
			//Player.Active.Status.AddHP( (int)Item.ScriptArgs[ 0 ] ); // gets <Value> HP
		}
示例#4
0
		public PLayerUseItemEventArgs( BaseItem Item ) {
			mBaseItem = Item;
		}