@@ -48,11 +48,17 @@ export class AccountCommands {
4848 . restrict ( Player . LEVEL_ADMINISTRATOR )
4949 . build ( AccountCommands . prototype . onAccountCommand . bind ( this ) )
5050 . build ( AccountCommands . prototype . onAccountCommand . bind ( this ) ) ;
51-
51+
5252 // /register
5353 server . commandManager . buildCommand ( 'register' )
5454 . build ( AccountCommands . prototype . onRegisterCommand . bind ( this ) ) ;
55-
55+
56+ // /whereis [player]
57+ server . commandManager . buildCommand ( 'whereis' )
58+ . restrict ( player => this . playground_ ( ) . canAccessCommand ( player , 'whereis' ) )
59+ . parameters ( [ { name : 'player' , type : CommandBuilder . PLAYER_PARAMETER } ] )
60+ . build ( AccountCommands . prototype . onWhereisCommand . bind ( this ) ) ;
61+
5662 // /whois [player]
5763 server . commandManager . buildCommand ( 'whois' )
5864 . restrict ( player => this . playground_ ( ) . canAccessCommand ( player , 'whois' ) )
@@ -63,6 +69,7 @@ export class AccountCommands {
6369 // Registers the commands with configurable access with the Playground feature.
6470 registerTrackedCommands ( ) {
6571 this . playground_ ( ) . registerCommand ( 'account' , Player . LEVEL_PLAYER ) ;
72+ this . playground_ ( ) . registerCommand ( 'whereis' , Player . LEVEL_ADMINISTRATOR ) ;
6673 this . playground_ ( ) . registerCommand ( 'whois' , Player . LEVEL_ADMINISTRATOR ) ;
6774 }
6875
@@ -771,6 +778,50 @@ export class AccountCommands {
771778
772779 // ---------------------------------------------------------------------------------------------
773780
781+ // Called when the |player| wishes to locate the |target| through the "/whereis" command. This
782+ // isn't about their in-game location, but rather their physical location.
783+ async onWhereisCommand ( player , target ) {
784+ const results = await this . database_ . whereIs ( target . ip ) ;
785+ if ( ! results . proxy && ! results . location ) {
786+ return await alert ( player , {
787+ title : `Where is ${ target . name } ?!` ,
788+ message : `I have no idea where ${ target . name } is.. Sorry!`
789+ } ) ;
790+ }
791+
792+ const dialog = new Menu ( `Where is ${ target . name } ?!` , [
793+ 'Field' ,
794+ 'Value' ,
795+ ] ) ;
796+
797+ // (1) When proxy information is known,
798+ if ( results . proxy ) {
799+ dialog . addItem ( '{FFEB3B}Proxy information' , '{9E9E9E}-' ) ;
800+ dialog . addItem ( 'Proxy location' , `${ results . proxy . country } (${ results . proxy . city } )` ) ;
801+ dialog . addItem ( 'Proxy provider' , `${ results . proxy . isp } (${ results . proxy . domain } )` ) ;
802+ dialog . addItem ( 'Proxy network' , `${ results . proxy . networkName } ` ) ;
803+ dialog . addItem ( 'Intended usage' , results . proxy . usage . join ( ', ' ) ) ;
804+ }
805+
806+ // (2) When location information is known,
807+ if ( results . location ) {
808+ if ( results . proxy )
809+ dialog . addItem ( '----------' , '----------' ) ;
810+
811+ dialog . addItem ( '{FFEB3B}Location information' , '{9E9E9E}-' ) ;
812+ dialog . addItem ( 'Country' , results . location . country ) ;
813+ dialog . addItem ( 'Region' , results . location . region ) ;
814+ dialog . addItem ( 'City' , results . location . city ) ;
815+
816+ dialog . addItem ( 'Timezone' , results . location . timeZone ) ;
817+ // Current time estimation if we know DST?
818+ }
819+
820+ await dialog . displayForPlayer ( player ) ;
821+ }
822+
823+ // ---------------------------------------------------------------------------------------------
824+
774825 // Enables administrators to quickly look up if the |targetPlayer| might be another player who's
775826 // recently been on the server. Results will be displayed with a level of certainty.
776827 async onWhoisCommand ( player , targetPlayer ) {
@@ -867,6 +918,7 @@ export class AccountCommands {
867918
868919 dispose ( ) {
869920 this . playground_ ( ) . unregisterCommand ( 'whois' ) ;
921+ this . playground_ ( ) . unregisterCommand ( 'whereis' ) ;
870922 this . playground_ ( ) . unregisterCommand ( 'account' ) ;
871923
872924 this . announce_ = null ;
@@ -875,6 +927,7 @@ export class AccountCommands {
875927 this . playerIdentifier_ = null ;
876928
877929 server . commandManager . removeCommand ( 'whois' ) ;
930+ server . commandManager . removeCommand ( 'whereis' ) ;
878931 server . commandManager . removeCommand ( 'register' ) ;
879932 server . commandManager . removeCommand ( 'account' ) ;
880933 }
0 commit comments