diff --git a/html/chat.html b/html/chat.html index bb8e812..0cc09e6 100644 --- a/html/chat.html +++ b/html/chat.html @@ -1,6 +1,6 @@
-
{{line.Message}}
+
{{line.Username}}: {{line.Message}}
diff --git a/js/chat.js b/js/chat.js index 4cb1a89..86ceeca 100644 --- a/js/chat.js +++ b/js/chat.js @@ -7,22 +7,20 @@ function ChatController( $scope, rconService, $timeout ) $scope.SubmitCommand = function () { - $scope.Output.push( { Message: $scope.Command, Type: 'Command' } ); - rconService.Command( "say " + $scope.Command, 1 ); $scope.Command = ""; } - $scope.$on( "OnMessage", function ( event, msg ) { $scope.OnMessage( msg ); } ); - - $scope.OnMessage = function( msg ) + $scope.$on( "OnMessage", function ( event, msg ) { if ( msg.Type != "Chat" ) return; - msg.Class = msg.Type; - msg.Message = msg.Message.substr( 7 ); - $scope.Output.push( msg ); + $scope.OnMessage( JSON.parse( msg.Message ) ); + } ); + $scope.OnMessage = function( msg ) + { + $scope.Output.push( msg ); $timeout( $scope.ScrollToBottom, 50 ); } @@ -40,7 +38,7 @@ function ChatController( $scope, rconService, $timeout ) { console.log( "GetHistory" ); - rconService.Request( "console.tail 4096", $scope, function ( msg ) + rconService.Request( "chat.tail 512", $scope, function ( msg ) { var messages = JSON.parse( msg.Message ); diff --git a/js/console.js b/js/console.js index 535c135..02ce256 100644 --- a/js/console.js +++ b/js/console.js @@ -17,8 +17,13 @@ function ConsoleController( $scope, rconService, $timeout ) $scope.OnMessage = function( msg ) { + if ( msg.Message.startsWith( "[rcon] " ) ) return; - if ( msg.Type != "Message" && msg.Type != "Error" && msg.Type != "Warning" ) return; + if ( msg.Type != "Generic" && msg.Type != "Log" && msg.Type != "Error" && msg.Type != "Warning" ) + { + console.log( msg ); + return; + } msg.Class = msg.Type; $scope.Output.push( msg ); @@ -40,7 +45,7 @@ function ConsoleController( $scope, rconService, $timeout ) { console.log( "GetHistory" ); - rconService.Request( "chat.tail 128", $scope, function ( msg ) + rconService.Request( "console.tail 128", $scope, function ( msg ) { var messages = JSON.parse( msg.Message ); diff --git a/rcon.css b/rcon.css index 82d544e..fa4be39 100644 --- a/rcon.css +++ b/rcon.css @@ -132,4 +132,13 @@ th:only-child .panel { background-color: #434857; +} + +.chatname +{ + display: block; + width: 200px; + float: left; + text-align: right; + padding-right: 8px; } \ No newline at end of file