Commit 958abb0 1 parent 4275d68 commit 958abb0 Copy full SHA for 958abb0
File tree 4 files changed +54
-4
lines changed
4 files changed +54
-4
lines changed Original file line number Diff line number Diff line change
1
+ export * from './sge.types' ;
2
+ export * from './sge.service' ;
Original file line number Diff line number Diff line change 5
5
createSelfSignedCertConnectOptions ,
6
6
downloadCertificate ,
7
7
sendAndReceive ,
8
- } from '../tls/tls.utils ' ;
8
+ } from '../tls' ;
9
9
import type {
10
10
SGECharacter ,
11
11
SGEGame ,
@@ -32,7 +32,7 @@ let cachedTlsCertificate: tls.PeerCertificate | undefined;
32
32
* https://elanthipedia.play.net/SGE_protocol_(saved_post)
33
33
* https://github.com/WarlockFE/warlock2/wiki/EAccess-Protocol
34
34
*/
35
- export async function login ( options : {
35
+ export async function loginCharacter ( options : {
36
36
/**
37
37
* Play.net account name
38
38
*/
@@ -171,9 +171,9 @@ async function connect(
171
171
} )
172
172
) ;
173
173
174
- logger . info ( 'connecting to login server' ) ;
174
+ logger . info ( 'connecting to login server' , { host , port } ) ;
175
175
const socket = tls . connect ( mergedOptions , ( ) : void => {
176
- logger . info ( 'connected to login server' ) ;
176
+ logger . info ( 'connected to login server' , { host , port } ) ;
177
177
} ) ;
178
178
179
179
socket . on ( 'end' , ( ) : void => {
Original file line number Diff line number Diff line change
1
+ import { listCharacters , loginCharacter } from './sge.login' ;
2
+ import type {
3
+ SGECharacter ,
4
+ SGEGameCode ,
5
+ SGEGameCredentials ,
6
+ SGEService ,
7
+ } from './sge.types' ;
8
+
9
+ export class SGEServiceImpl implements SGEService {
10
+ private username : string ;
11
+ private password : string ;
12
+ private gameCode : SGEGameCode ;
13
+
14
+ constructor ( options : {
15
+ username : string ;
16
+ password : string ;
17
+ gameCode : SGEGameCode ;
18
+ } ) {
19
+ this . username = options . username ;
20
+ this . password = options . password ;
21
+ this . gameCode = options . gameCode ;
22
+ }
23
+
24
+ public async loginCharacter (
25
+ characterName : string
26
+ ) : Promise < SGEGameCredentials > {
27
+ const response = await loginCharacter ( {
28
+ username : this . username ,
29
+ password : this . password ,
30
+ gameCode : this . gameCode ,
31
+ characterName,
32
+ } ) ;
33
+ return response . credentials ;
34
+ }
35
+
36
+ public async listCharacters ( ) : Promise < Array < SGECharacter > > {
37
+ return listCharacters ( {
38
+ username : this . username ,
39
+ password : this . password ,
40
+ gameCode : this . gameCode ,
41
+ } ) ;
42
+ }
43
+ }
Original file line number Diff line number Diff line change @@ -73,3 +73,8 @@ export interface SGECharacter {
73
73
*/
74
74
name : string ;
75
75
}
76
+
77
+ export interface SGEService {
78
+ loginCharacter ( characterName : string ) : Promise < SGEGameCredentials > ;
79
+ listCharacters ( ) : Promise < Array < SGECharacter > > ;
80
+ }
You can’t perform that action at this time.
0 commit comments