@@ -2,13 +2,11 @@ package item
2
2
3
3
import (
4
4
"encoding/binary"
5
- "encoding/hex"
6
5
"encoding/json"
7
6
"errors"
8
7
"fmt"
9
8
"hash/crc32"
10
9
"io/ioutil"
11
- "log"
12
10
"strings"
13
11
"sync"
14
12
@@ -22,15 +20,15 @@ var (
22
20
)
23
21
24
22
type Item struct {
25
- Level int
26
- Balance string
27
- Manufacturer string
28
- InvData string
29
- Parts []string
30
- Generics []string
31
- Overflow string
32
- Version uint64
33
- Wrapper * pb.OakInventoryItemSaveGameData
23
+ Level int `json:"level"`
24
+ Balance string `json:"balance"`
25
+ Manufacturer string `json:"manufacturer"`
26
+ InvData string `json:"inv_data"`
27
+ Parts []string `json:"parts"`
28
+ Generics []string `json:"generics"`
29
+ Overflow string `json:"overflow"`
30
+ Version uint64 `json:"version"`
31
+ Wrapper * pb.OakInventoryItemSaveGameData `json:"wrapper"`
34
32
}
35
33
36
34
func DecryptSerial (data []byte ) ([]byte , error ) {
@@ -44,7 +42,6 @@ func DecryptSerial(data []byte) ([]byte, error) {
44
42
decrypted := bogoDecrypt (seed , data [5 :])
45
43
crc := binary .BigEndian .Uint16 (decrypted ) // first two bytes of decrypted data are crc checksum
46
44
combined := append (append (data [:5 ], 0xFF , 0xFF ), decrypted [2 :]... ) // combined data with checksum replaced with 0xFF to compute checksum
47
- log .Println (hex .EncodeToString (combined ))
48
45
computedChecksum := crc32 .ChecksumIEEE (combined )
49
46
check := uint16 (((computedChecksum ) >> 16 ) ^ ((computedChecksum & 0xFFFF ) >> 0 ))
50
47
@@ -151,6 +148,9 @@ func getBits(k string, v uint64) int {
151
148
152
149
func getPart (key string , index uint64 ) string {
153
150
data := db .GetData (key )
151
+ if int (index ) >= len (data .Assets ) {
152
+ return ""
153
+ }
154
154
return data .GetPart (index )
155
155
}
156
156
0 commit comments