@@ -8,13 +8,24 @@ class Honor {
88 this . endpoint = '/lol-gameflow/v1/gameflow-phase' ;
99 }
1010
11- setup ( ) {
11+ reload ( ) {
12+ return [ { id : 'honor.player.name' , keys : [ 'options' ] } ] ;
13+ }
14+
15+ async setup ( lcu ) {
1216 console . log ( 'Honor.js loaded.' ) ;
1317
18+ const response = await lcu . request ( { method : 'GET' , url : `/lol-chat/v1/friends` } ) ;
19+ const friends = response . json ( ) ;
20+
21+ const defaultFriend = { puuid : '' , summonerId : 0 , gameName : 'Select a friend' } ;
22+ const friendsObject = [ defaultFriend , ...friends . map ( ( { puuid, summonerId, gameName } ) => ( { puuid, summonerId, gameName } ) ) ] ;
23+
1424 const configuration = [
1525 { id : 'honor.system' , type : 'radio' , value : 'Shotcalling' , options : [ 'Cool' , 'Shotcalling' , 'GG' , 'Skip' ] } ,
1626 { id : 'honor.player.type' , type : 'radio' , value : 'Best Player' , options : [ 'Best Player' , 'Random' , 'Custom' ] } ,
17- { id : 'honor.player.name' , type : 'text' , value : 'GR0236621563#EUW' } , // temp
27+ { id : 'honor.message' , type : 'paragraph' , value : 'When opting for custom, it prioritizes honoring the selected friend.' } ,
28+ { id : 'honor.player.name' , type : 'select' , value : friendsObject [ 0 ] , options : friendsObject } , // temp
1829 ] ;
1930
2031 return configuration ;
@@ -65,9 +76,8 @@ class Honor {
6576
6677 case 'Custom' :
6778 const customPlayer = getSetting ( 'honor.player.name' ) ;
68- const [ customName , customTag ] = customPlayer . value . split ( '#' ) ;
69- const response = await lcu . request ( { method : 'GET' , url : `/lol-summoner/v1/summoners?name=${ customName } %23${ customTag } ` } ) ;
70- player = await response . json ( ) ;
79+ console . log ( 'CUSTOM PLAYER / FRIEND' , customPlayer . value ) ;
80+ player = customPlayer . value ;
7181 break ;
7282
7383 default :
0 commit comments