Hackily get the client to a channel server

This commit is contained in:
Andrew Gutekanst
2019-12-24 00:20:35 +09:00
parent 7aef17f7d9
commit e5066d4f8b
13 changed files with 1275 additions and 27 deletions

View File

@@ -9,6 +9,20 @@ import (
"github.com/Andoryuuta/byteframe"
)
/*
var conf *config.Config
func init() {
c, err := config.LoadConfig("config.toml")
if err != nil {
panic(err)
}
conf = c
}
*/
func paddedString(x string, size uint) []byte {
out := make([]byte, size)
copy(out, x)
@@ -31,6 +45,10 @@ func uint16PascalString(bf *byteframe.ByteFrame, x string) {
func makeSignInResp(username string) []byte {
bf := byteframe.NewByteFrame()
// delete me:
//bf.WriteUint8(8)
//return bf.Data()
bf.WriteUint8(1) // resp_code
bf.WriteUint8(0) // file/patch server count
bf.WriteUint8(1) // entrance server count
@@ -44,17 +62,65 @@ func makeSignInResp(username string) []byte {
// Array(this.entrance_server_count, PascalString(Byte, "utf8")),
uint8PascalString(bf, "localhost:53310")
///////////////////////////
// Characters:
bf.WriteUint32(1039336769) // character ID
bf.WriteUint16(30)
bf.WriteUint16(7)
bf.WriteUint32(1576761172)
bf.WriteUint8(0)
bf.WriteUint8(0)
bf.WriteUint8(0)
bf.WriteUint8(0)
bf.WriteBytes(paddedString("username", 16))
bf.WriteBytes(paddedString("", 32))
/*
tab = '123456789ABCDEFGHJKLMNPQRTUVWXYZ'
def make_uid_str(cid):
out = ''
for i in range(6):
v = (cid>>5*i)
out += tab[v&0x1f]
return out
def make_cid_int(uid):
v = 0
for c in uid[::-1]:
idx = tab.find(c)
if idx == -1:
raise Exception("not in tab")
v |= idx
v = v<<5
return v>>5
*/
bf.WriteUint32(469153291) // character ID 469153291
bf.WriteUint16(30) // Exp, HR[x] is split by 0, 1, 30, 50, 99, 299, 998, 999
/*
0=大劍/Big sword
1=重弩/Heavy crossbow
2=大錘/Sledgehammer
3=長槍/Spear
4=單手劍/One-handed sword
5=輕弩/Light crossbow
6=雙劍/Double sword
7=太刀/Tadao
8=狩獵笛/Hunting flute
9=銃槍/Shotgun
10=弓/bow
11=穿龍棍/Wear a dragon stick
12=斬擊斧F/Chopping Axe F
13=---
default=不明/unknown
*/
bf.WriteUint16(7) // Weapon, 0-13.
bf.WriteUint32(1576761172) // Last login date, unix timestamp in seconds.
bf.WriteUint8(1) // Sex, 0=male, 1=female.
bf.WriteUint8(0) // Is new character, 1 replaces character name with ?????.
grMode := uint8(0)
bf.WriteUint8(1) // GR level if grMode == 0
bf.WriteUint8(grMode) // GR mode.
bf.WriteBytes(paddedString(username, 16)) // Character name
bf.WriteBytes(paddedString("0", 32)) // unk str
if grMode == 1 {
bf.WriteUint16(55) // GR level override.
bf.WriteUint8(0) // unk
bf.WriteUint8(0) // unk
}
//////////////////////////
bf.WriteUint8(0) // friends_list_count
bf.WriteUint8(0) // guild_members_count