Beispiel #1
0
		public void RegisterChannel(Strive.Network.Messages.CommunicationType communicationType, string name, MessageReceived callback)
		{
			if(!_registrations.Contains(CalculateChannelKey(communicationType, name)))
			{
				_registrations.Add(CalculateChannelKey(communicationType, name), callback);
			}
		}
Beispiel #2
0
		private void MiniMap_Update(Strive.Network.Messages.ToServer.Position newPosition)
		{
			Z.Text = ((int)newPosition.position.Z).ToString();
			Y.Text = ((int)newPosition.position.Y).ToString();
			X.Text = ((int)newPosition.position.X).ToString();
			RY.Text = ((int)newPosition.rotation.Y).ToString();
            //Triangles.Text = Game.CurrentWorld.RenderingScene.VisibleTriangleCount.ToString();
		}
Beispiel #3
0
		public static void Play(string ServerName, string LoginName, string Password, int Port, Strive.Network.Messages.NetworkProtocolType Protocol, IWin32Window RenderTarget) 
		{
			userName = LoginName;
			password = Password;
			protocol = Protocol;
			CurrentServerConnection.protocol = protocol;
			Log.Info( "Connecting to " + ServerName + ":" + Port );
			CurrentServerConnection.Start( new IPEndPoint( Dns.GetHostByName( ServerName ).AddressList[0], Port ) );
		}
Beispiel #4
0
		void HandleWhoList( Strive.Network.Messages.ToClient.WhoList wl ) {
			CharactersOnline.Items.Clear();

			for ( int i=0; i< wl.MobileID.Length; i++ ) {
				ListViewItem currentChar = new ListViewItem(new string[] {wl.MobileID[i].ToString(), wl.MobileName[i].ToString()});
				CharactersOnline.Items.Add(currentChar);
			}

		}
Beispiel #5
0
		public string CalculateChannelKey(Strive.Network.Messages.CommunicationType communicationType, string name)
		{
			string CalculateChannelKey_Return = communicationType.ToString();
			if(communicationType == Strive.Network.Messages.CommunicationType.Tell)
			{
				CalculateChannelKey_Return = name + " - Private conversation";
			}
			return CalculateChannelKey_Return;
		}
		public static void ProcessTargetItem( Client client, Strive.Network.Messages.ToServer.GameCommand.TargetItem message ) {
			switch ( message.CommandID ) {
				case Strive.Network.Messages.ToServer.GameCommand.TargetItem.CommandType.Drop:
					Log.LogMessage( "Drop" );
					break;
				default:
					Log.WarningMessage( "Unknown CommandID " + message.CommandID );
					break;
			}
		}
		public static void ProcessTargetAny( Client client, Strive.Network.Messages.ToServer.GameCommand.TargetAny message ) {
			switch ( message.CommandID ) {
				case Strive.Network.Messages.ToServer.GameCommand.TargetAny.CommandType.Attack:
					Log.LogMessage( "Attack" );
					break;
				default:
					Log.WarningMessage( "Unknown CommandID " + message.CommandID );
					break;
			}
		}
		public static void ProcessTargetMobile( Client client, Strive.Network.Messages.ToServer.GameCommand.TargetMobile message ) {
			switch ( message.CommandID ) {
				case Strive.Network.Messages.ToServer.GameCommand.TargetMobile.CommandType.Backstab:
					Log.LogMessage( "Backstab" );
					//Skills.Backstab( client, message.MobileID );
					break;
				default:
					Log.WarningMessage( "Unknown CommandID " + message.CommandID );
					break;
			}
		}
Beispiel #9
0
		void HandleSkillList( Strive.Network.Messages.ToClient.SkillList sl ) {
			if ( sl.skills.Length < 1 ) {
				this.Text = "You have no skills yet.";
				return;
			}
			for ( int i=0; i<sl.skills.Length; i++ ) {
				IdButton b = new IdButton();
				// TODO: do the name lookup
				b.Text = "skill " + sl.skills[i] + " : " + sl.competancy[i] + "%";
				b.id = sl.skills[i];
				b.Click += new System.EventHandler(this.Button_Click);
				Controls.Add( b );
			}
		}
Beispiel #10
0
		private void ProcessChat(Strive.Network.Messages.ToClient.Communication chatMessage)
		{
			string channelWindowName = chatMessage.communicationType.ToString();
			if(chatMessage.communicationType == Strive.Network.Messages.CommunicationType.Tell)
			{
				channelWindowName = chatMessage.name + " - Private conversation";
			}
			
			if(!_dockingManager.Contents.Contains(channelWindowName))
			{
				// add a window
				Crownwood.Magic.Docking.Content chatWindow = _dockingManager.Contents.Add(new Strive.Client.WinForms.Windows.ChildWindows.Chat(chatMessage.communicationType, chatMessage.name), "Chat", null, -1);
				_dockingManager.AddContentWithState(chatWindow, Crownwood.Magic.Docking.State.DockBottom);
			}
			MessageReceived callback = (MessageReceived)_registrations[CalculateChannelKey(chatMessage.communicationType, chatMessage.name)];

			if(callback != null)
			{
				callback(chatMessage);
			}
		}
Beispiel #11
0
		private void ProcessCommunication(Strive.Network.Messages.ToClient.Communication message)
		{
			ChatOutput.AppendText(message.name + " says:" + message.message + Environment.NewLine);
		}
Beispiel #12
0
		public static DataRow AddRecentPlayer(string serverAddress,
			int serverPort,
			Strive.Network.Messages.NetworkProtocolType protocol,
			string emailaddress,
			string password)
		{
			string serverKey = serverAddress + serverPort;
			DataRow serverRow;
			if(!RecentServers.Rows.Contains(serverKey))
			{
				AddRecentServer(serverAddress, serverPort, protocol);
				serverRow = RecentServers.Rows.Find(serverKey);
				DataRow newPlayerRow = RawSettings.Tables["RecentPlayers"].NewRow();
				newPlayerRow["serverkey"] = serverKey;
				newPlayerRow["emailaddress"] = emailaddress;
				newPlayerRow["password"] = password;
				RawSettings.Tables["RecentPlayers"].Rows.Add(newPlayerRow);
				RawSettings.AcceptChanges();
			}
			else
			{
				serverRow = RecentServers.Rows.Find(serverKey);
			}

			DataRow playerRow;
			string playerKey = emailaddress;
			if(RawSettings.Tables["RecentPlayers"].Rows.Contains(new string[] {playerKey, serverKey}))
			{
				playerRow = RawSettings.Tables["RecentPlayers"].Rows.Find(new string[] {playerKey, serverKey});
				playerRow["emailaddress"] = emailaddress;
				playerRow["password"] = password;
				
			}
			else
			{
				playerRow = RawSettings.Tables["RecentPlayers"].NewRow();
				playerRow["playerkey"] = playerKey;
				playerRow["serverkey"] = serverKey;
				playerRow["emailaddress"] = emailaddress;
				playerRow["password"] = password;
				RawSettings.Tables["RecentPlayers"].Rows.Add(playerRow);
			}

			RawSettings.Tables["RecentPlayers"].AcceptChanges();
			Log.Info("Added player '" + emailaddress + "' to recent players");

			return playerRow;
		}
Beispiel #13
0
		/// <summary>
		/// Determines if the key was pressed
		/// </summary>
		/// <param name="Key">The Key to check for</param>
		/// <returns>A true/false indicating that the Key was pressed</returns>
		public bool GetKeyState(Strive.Rendering.Controls.Key Key)
		{
			return Engine.Input.IsKeyPressed( Keys.getTVKeyFromKey(Key) );
		}
Beispiel #14
0
		public static DataRow AddRecentCharacter(string serverAddress,
			int serverPort,
			Strive.Network.Messages.NetworkProtocolType protocol,
			string emailaddress,
			string password,
			int characterid,
			string charactername)
		{

			string serverKey = serverAddress +  serverPort;
			if(!RecentServers.Rows.Contains(serverKey))
			{
				AddRecentServer(serverAddress, serverPort, protocol);
			}
			DataRow serverRow = RecentServers.Rows.Find(serverKey);

			string playerKey = emailaddress;
			if(!RawSettings.Tables["RecentPlayers"].Rows.Contains(new string[] {playerKey, serverKey}))
			{
				AddRecentPlayer(serverAddress, serverPort, protocol, emailaddress, password);
			}

			DataRow charrow;
			if(!RawSettings.Tables["RecentCharacters"].Rows.Contains(new string[] { charactername, playerKey, serverKey}))
			{
				charrow= RawSettings.Tables["RecentCharacters"].NewRow();
				charrow["charactername"] = charactername;
				charrow["playerkey"] = playerKey;
				charrow["serverkey"] = serverKey;
				charrow["characterid"] = characterid;
				RawSettings.Tables["RecentCharacters"].Rows.Add(charrow);
			}
			else
			{
				charrow = RawSettings.Tables["RecentCharacters"].Rows.Find(new string[] {charactername, playerKey, serverKey});
				charrow["charactername"] = charactername;
				charrow["playerkey"] = playerKey;
				charrow["serverkey"] = serverKey;
				charrow["characterid"] = characterid;
			}

			RawSettings.Tables["RecentCharacters"].AcceptChanges();
			Log.Info("Added character '" + charactername+ "' to recent characters");
			return charrow;
		}	
Beispiel #15
0
		/*** no longer on another thread
		void HandleCanPossessThreadSafe( Strive.Network.Messages.ToClient.CanPossess cp ) 
		{
			this.Invoke( new Engine.MessageProcessor.CanPossessHandler( HandleCanPossess ),
				new object [] { cp } );
		}
		*/

		void HandleCanPossess( Strive.Network.Messages.ToClient.CanPossess cp ) {
			if ( cp.possesable.Length < 1 ) {
				this.Text = "No characters available.";
				return;
			}
			StriveWindowState = ConnectionWindowState.Connected;
			Game.CurrentServerConnection.PossessMobile(cp.possesable[0].id);
			Game.CurrentPlayerID = cp.possesable[0].id;
			StriveWindowState = ConnectionWindowState.Playing;
		}
Beispiel #16
0
		public Chat(Strive.Network.Messages.CommunicationType communicationType, string characterName)
		{
			InitializeComponent();
			this.Text = Game.CurrentMainWindow.CurrentChannelManager.CalculateChannelKey(communicationType, characterName);
			Game.CurrentMainWindow.CurrentChannelManager.RegisterChannel(communicationType, characterName, new Channels.ChannelManager.MessageReceived(ProcessCommunication));
		}
Beispiel #17
0
		/// <summary>
		/// Determines if the key was pressed
		/// </summary>
		/// <param name="Key">The Key to check for</param>
		/// <returns>A true/false indicating that the Key was pressed</returns>
		public bool GetKeyState(Strive.Rendering.Controls.Key Key)
		{
			R3DKey r = (R3DKey)Key;
			return Engine.Control.Keyboard_GetKeyState(ref r);
		}
Beispiel #18
0
		public static DataRow AddRecentServer(string serverAddress, 
			int serverPort,
			Strive.Network.Messages.NetworkProtocolType protocol)
		{
			string serverKey = serverAddress + serverPort;
			DataRow serverRow;
			if(!RecentServers.Rows.Contains(serverKey))
			{
				serverRow = RecentServers.NewRow();
				serverRow["serverkey"] = serverKey;
			}
			else
			{
				serverRow = RecentServers.Rows.Find(serverKey);
			}

			serverRow["serveraddress"] = serverAddress;
			serverRow["serverport"] = serverPort;
			serverRow["protocol"] = protocol;


			if(!RecentServers.Rows.Contains(serverKey))
			{
				RecentServers.Rows.Add(serverRow);

			}
			RecentServers.AcceptChanges();

			Log.Info("Added server '" + serverAddress + ":" + serverPort + "' to recent servers");

			return serverRow;
		}