Esempio n. 1
0
		/// <summary>
		/// Add a npc
		/// </summary>
		private void bAdd_Click(object sender, System.EventArgs e)
		{
			if ( SelectedMobile != null )
			{
				if ( SelectedMobile.CanBeNamed && chkName.Checked && cbNames.Text.Length > 0 )
				{
					// Mobile + name
					Pandora.Profile.Commands.DoAddMobile( SelectedMobile.Name, cbNames.Text );

					UpdateNames();
				}
				else
				{
					// Mobile only
					Pandora.Profile.Commands.DoAddMobile( SelectedMobile.Name );
				}
			}

			if ( SelectedSpawn != null )
			{
                if (!Pandora.BoxConnection.Connected)
				{
					Pandora.BoxConnection.RequestConnection();
				}

                if (Pandora.BoxConnection.Connected)
				{
					TheBox.BoxServer.SpawnMessage msg = new SpawnMessage();
					Pandora.Profile.Server.FillBoxMessage( msg );

					msg.Spawn = SelectedSpawn;

					object response = Pandora.BoxConnection.ProcessMessage( msg );

					// null outcome means that the spawn has been processed
					if ( response == null )
						Utility.BringClientToFront();
				}
			}
		}
Esempio n. 2
0
		/// <summary>
		/// User clicked the spawn link
		/// </summary>
		private void linkSpawn_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
		{
			UpdateSpawnInfo();

			if ( SelectedMobile != null )
			{
				// Simple mobile node
				Pandora.Profile.Commands.DoSpawn( SelectedMobile.Name );
				return;
			}
			
			if ( SelectedSpawn != null )
			{
                if (!Pandora.BoxConnection.Connected)
					Pandora.BoxConnection.RequestConnection();

                if (Pandora.BoxConnection.Connected)
				{
					// Spawn group
					BoxSpawn spawn = SelectedSpawn.Clone() as BoxSpawn;

					spawn.Count = Pandora.Profile.Mobiles.Amount;
					spawn.MinDelay = Pandora.Profile.Mobiles.MinDelay;
					spawn.MaxDelay = Pandora.Profile.Mobiles.MaxDelay;
					spawn.Team = Pandora.Profile.Mobiles.Team;
					spawn.HomeRange = Pandora.Profile.Mobiles.Range;

					SpawnMessage msg = new SpawnMessage();
					Pandora.Profile.Server.FillBoxMessage( msg );

					msg.Spawn = spawn;

					if ( Pandora.BoxConnection.ProcessMessage( msg ) == null ) // null answer = ok
						Utility.BringClientToFront();
				}
			}
		}