@@ -40,34 +40,37 @@ var stdin = bufio.NewReader(os.Stdin)
4040func main () {
4141 flag .Parse ()
4242
43- var c = bnet .NewClient (* binpath )
43+ c , err := bnet .NewClient (& bnet.Config {BinPath : * binpath })
44+ if err != nil {
45+ logErr .Fatal ("NewClient error: " , err )
46+ }
4447
4548 c .ServerAddr = strings .Join (flag .Args (), " " )
4649 if c .ServerAddr == "" {
4750 c .ServerAddr = "uswest.battle.net:6112"
4851 }
4952
5053 if * gamevers != 0 {
51- c .AuthInfo . GameVersion .Version = uint32 (* gamevers )
54+ c .GameVersion .Version = uint32 (* gamevers )
5255 }
5356
5457 if * keyroc != "" {
5558 if * keytft != "" {
56- c .AuthInfo . GameVersion .Product = w3gs .ProductTFT
59+ c .GameVersion .Product = w3gs .ProductTFT
5760 c .CDKeys = []string {* keyroc , * keytft }
5861 } else {
59- c .AuthInfo . GameVersion .Product = w3gs .ProductROC
62+ c .GameVersion .Product = w3gs .ProductROC
6063 c .CDKeys = []string {* keyroc }
6164 }
6265 }
6366
64- c .UserName = * username
67+ c .Username = * username
6568 c .Password = * password
6669
6770 if * username == "" {
6871 fmt .Print ("Enter username: " )
69- c .UserName , _ = stdin .ReadString ('\n' )
70- c .UserName = strings .TrimSpace (c .UserName )
72+ c .Username , _ = stdin .ReadString ('\n' )
73+ c .Username = strings .TrimSpace (c .Username )
7174 }
7275
7376 if * password == "" {
@@ -102,7 +105,7 @@ func main() {
102105 })
103106 c .On (& bnet.Whisper {}, func (ev * network.Event ) {
104107 var msg = ev .Arg .(* bnet.Whisper )
105- logOut .Println (color .GreenString ("[WHISPER] %s: %s" , msg .UserName , msg .Content ))
108+ logOut .Println (color .GreenString ("[WHISPER] %s: %s" , msg .Username , msg .Content ))
106109 })
107110 c .On (& bnet.Chat {}, func (ev * network.Event ) {
108111 var msg = ev .Arg .(* bnet.Chat )
@@ -114,7 +117,7 @@ func main() {
114117 logOut .Printf ("[CHAT] %s\n " , say .Content )
115118 } else {
116119
117- logOut .Printf ("[CHAT] %s: %s\n " , c .UserName , say .Content )
120+ logOut .Printf ("[CHAT] %s: %s\n " , c .Username , say .Content )
118121 }
119122 })
120123 c .On (& bnet.SystemMessage {}, func (ev * network.Event ) {
@@ -129,15 +132,15 @@ func main() {
129132 if err := c .CreateAccount (); err != nil {
130133 logErr .Fatal ("CreateAccount error: " , err )
131134 }
132- logOut .Println (color .MagentaString ("Succesfully registered new account '%s'" , c .UserName ))
135+ logOut .Println (color .MagentaString ("Succesfully registered new account '%s'" , c .Username ))
133136 return
134137 }
135138
136139 if err := c .Logon (); err != nil {
137140 logErr .Fatal ("Logon error: " , err )
138141 }
139142
140- logOut .Println (color .MagentaString ("Succesfully logged onto %s@%s" , c .UserName , c .ServerAddr ))
143+ logOut .Println (color .MagentaString ("Succesfully logged onto %s@%s" , c .Username , c .ServerAddr ))
141144
142145 go func () {
143146 for {
0 commit comments