Commit 91ceb9b1 authored by Chunchi Che's avatar Chunchi Che Committed by GitHub

Merge pull request #10 from DarkNeos/dev

Dev
parents ef89c4a8 f0a266b3
...@@ -7,15 +7,12 @@ import ( ...@@ -7,15 +7,12 @@ import (
"errors" "errors"
"fmt" "fmt"
"log" "log"
"unicode/utf16"
"github.com/sktt1ryze/ygopro-proxy/DarkNeos/ygopropb" "github.com/sktt1ryze/ygopro-proxy/DarkNeos/ygopropb"
util "github.com/sktt1ryze/ygopro-proxy/util" util "github.com/sktt1ryze/ygopro-proxy/util"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
const FILLING_TOKEN uint16 = 0xcccc
const UTF16_BUFFER_MAX_LEN int = 20
const PACKET_MIN_LEN int = 3 const PACKET_MIN_LEN int = 3
const COMPONENT = "[transform]" const COMPONENT = "[transform]"
const ( const (
...@@ -24,10 +21,13 @@ const ( ...@@ -24,10 +21,13 @@ const (
) )
const ( const (
CtosUpdateDeck = 2
CtosProtoPlayerInfo = 16 CtosProtoPlayerInfo = 16
CtosProtoJoinGame = 18 CtosProtoJoinGame = 18
CtosHsReady = 34
StocJoinGame = 18 StocJoinGame = 18
StocTypeChange = 19
StocChat = 25 StocChat = 25
StocHsPlayerEnter = 32 StocHsPlayerEnter = 32
) )
...@@ -108,6 +108,10 @@ func Transform(src []byte, tranformType int, ctx *util.Context) ([]byte, error) ...@@ -108,6 +108,10 @@ func Transform(src []byte, tranformType int, ctx *util.Context) ([]byte, error)
packet = (*pCtosPlayerInfo)(message.GetCtosPlayerInfo()).Pb2Packet() packet = (*pCtosPlayerInfo)(message.GetCtosPlayerInfo()).Pb2Packet()
case *(ygopropb.YgoCtosMsg_CtosJoinGame): case *(ygopropb.YgoCtosMsg_CtosJoinGame):
packet = (*pCtosJoinGame)(message.GetCtosJoinGame()).Pb2Packet() packet = (*pCtosJoinGame)(message.GetCtosJoinGame()).Pb2Packet()
case *(ygopropb.YgoCtosMsg_CtosUpdateDeck):
packet = (*pCtosUpdateDeck)(message.GetCtosUpdateDeck()).Pb2Packet()
case *(ygopropb.YgoCtosMsg_CtosHsReady):
packet = (*pCtosHsReady)(message.GetCtosHsReady()).Pb2Packet()
default: default:
return nil, errors.New(COMPONENT + "Unhandled YgoCtosMsg type") return nil, errors.New(COMPONENT + "Unhandled YgoCtosMsg type")
} }
...@@ -128,6 +132,8 @@ func Transform(src []byte, tranformType int, ctx *util.Context) ([]byte, error) ...@@ -128,6 +132,8 @@ func Transform(src []byte, tranformType int, ctx *util.Context) ([]byte, error)
pb = pStocJoinGame{}.Packet2Pb(packet) pb = pStocJoinGame{}.Packet2Pb(packet)
case StocHsPlayerEnter: case StocHsPlayerEnter:
pb = pStocHsPlayerEnter{}.Packet2Pb(packet) pb = pStocHsPlayerEnter{}.Packet2Pb(packet)
case StocTypeChange:
pb = pStocTypeChage{}.Packet2Pb(packet)
default: default:
return nil, errors.New(fmt.Sprintf(COMPONENT+"Unhandled YgoStocMsg type, proto=%d", packet.Proto)) return nil, errors.New(fmt.Sprintf(COMPONENT+"Unhandled YgoStocMsg type, proto=%d", packet.Proto))
} }
...@@ -148,8 +154,8 @@ type pCtosPlayerInfo ygopropb.CtosPlayerInfo ...@@ -148,8 +154,8 @@ type pCtosPlayerInfo ygopropb.CtosPlayerInfo
// @Name: [20]uint16 // @Name: [20]uint16
func (pb *pCtosPlayerInfo) Pb2Packet() YgoPacket { func (pb *pCtosPlayerInfo) Pb2Packet() YgoPacket {
buf := strToUtf16Buffer(pb.Name) buf := util.StrToUtf16Buffer(pb.Name)
exdata := uint16BufToByteBuf(buf) exdata := util.Uint16BufToByteBuf(buf)
return YgoPacket{ return YgoPacket{
PacketLen: uint16(len(exdata)) + 1, PacketLen: uint16(len(exdata)) + 1,
...@@ -171,7 +177,7 @@ func (pb *pCtosJoinGame) Pb2Packet() YgoPacket { ...@@ -171,7 +177,7 @@ func (pb *pCtosJoinGame) Pb2Packet() YgoPacket {
exdata = append(exdata, byte(pb.Gameid), byte(pb.Gameid>>8), byte(pb.Gameid>>16), byte(pb.Gameid>>24)) exdata = append(exdata, byte(pb.Gameid), byte(pb.Gameid>>8), byte(pb.Gameid>>16), byte(pb.Gameid>>24))
for _, v := range uint16BufToByteBuf(strToUtf16Buffer(pb.Passwd)) { for _, v := range util.Uint16BufToByteBuf(util.StrToUtf16Buffer(pb.Passwd)) {
exdata = append(exdata, v) exdata = append(exdata, v)
} }
...@@ -182,6 +188,40 @@ func (pb *pCtosJoinGame) Pb2Packet() YgoPacket { ...@@ -182,6 +188,40 @@ func (pb *pCtosJoinGame) Pb2Packet() YgoPacket {
} }
} }
type pCtosUpdateDeck ygopropb.CtosUpdateDeck
// @main: []int32
// @extra: []int32
// @size: []int32
func (pb *pCtosUpdateDeck) Pb2Packet() YgoPacket {
v := make([]int32, 0)
v = append(v, int32(len(pb.Main)+len(pb.Extra)))
v = append(v, int32(len(pb.Side)))
v = append(v, pb.Main...)
v = append(v, pb.Extra...)
v = append(v, pb.Side...)
exdata := util.Int32ArrayToByteArray(v)
return YgoPacket{
PacketLen: uint16(len(exdata)) + 1,
Proto: CtosUpdateDeck,
Exdata: exdata,
}
}
type pCtosHsReady ygopropb.CtosHsReady
// empty message
func (_ *pCtosHsReady) Pb2Packet() YgoPacket {
return YgoPacket{
PacketLen: 1,
Proto: CtosHsReady,
Exdata: make([]byte, 0),
}
}
// +++++ Server To Client +++++ // +++++ Server To Client +++++
type server2Client interface { type server2Client interface {
...@@ -194,7 +234,7 @@ type pStocChat struct{} ...@@ -194,7 +234,7 @@ type pStocChat struct{}
// @message: []uint16 // @message: []uint16
func (_ pStocChat) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg { func (_ pStocChat) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
player := int32(binary.LittleEndian.Uint16(pkt.Exdata)) player := int32(binary.LittleEndian.Uint16(pkt.Exdata))
message := utf16BufferToStr(pkt.Exdata[2:]) message := util.Utf16BufferToStr(pkt.Exdata[2:])
msg := ygopropb.YgoStocMsg_StocChat{ msg := ygopropb.YgoStocMsg_StocChat{
StocChat: &ygopropb.StocChat{ StocChat: &ygopropb.StocChat{
...@@ -251,8 +291,8 @@ func (_ pStocJoinGame) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg { ...@@ -251,8 +291,8 @@ func (_ pStocJoinGame) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
type pStocHsPlayerEnter struct{} type pStocHsPlayerEnter struct{}
func (_ pStocHsPlayerEnter) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg { func (_ pStocHsPlayerEnter) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
name_max := UTF16_BUFFER_MAX_LEN * 2 name_max := util.UTF16_BUFFER_MAX_LEN * 2
name := utf16BufferToStr(pkt.Exdata[:name_max]) name := util.Utf16BufferToStr(pkt.Exdata[:name_max])
pos := pkt.Exdata[name_max] pos := pkt.Exdata[name_max]
msg := ygopropb.YgoStocMsg_StocHsPlayerEnter{ msg := ygopropb.YgoStocMsg_StocHsPlayerEnter{
...@@ -267,56 +307,16 @@ func (_ pStocHsPlayerEnter) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg { ...@@ -267,56 +307,16 @@ func (_ pStocHsPlayerEnter) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
} }
} }
// +++++ Util Functions +++++ type pStocTypeChage struct{}
func strToUtf16Buffer(s string) []uint16 {
b := make([]uint16, UTF16_BUFFER_MAX_LEN, UTF16_BUFFER_MAX_LEN)
for i := range b {
b[i] = FILLING_TOKEN
}
s_utf16 := utf16.Encode([]rune(s))
// todo: optimize
for i, v := range s_utf16 {
if i < UTF16_BUFFER_MAX_LEN {
b[i] = v
if i == len(s_utf16)-1 && i < len(b)-1 { func (_ pStocTypeChage) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
b[i+1] = 0 msg := ygopropb.YgoStocMsg_StocTypeChange{
} StocTypeChange: &ygopropb.StocTypeChange{
} else { Type: int32(pkt.Exdata[0]),
break },
}
}
return b
}
func utf16BufferToStr(p []byte) string {
v := chunkBytesToUint16s(p)
return string(utf16.Decode(v))
}
func uint16BufToByteBuf(u16_b []uint16) []byte {
b := make([]byte, 0, len(u16_b)*2)
for _, v := range u16_b {
// little endian
b = append(b, byte(v), byte(v>>8))
} }
return b return ygopropb.YgoStocMsg{
} Msg: &msg,
func chunkBytesToUint16s(items []byte) []uint16 {
const chunkSize = 2
var chunks []uint16
for chunkSize < len(items) {
items, chunks = items[chunkSize:], append(chunks, binary.LittleEndian.Uint16(items))
} }
return chunks
} }
...@@ -29,6 +29,7 @@ type YgoCtosMsg struct { ...@@ -29,6 +29,7 @@ type YgoCtosMsg struct {
// *YgoCtosMsg_CtosPlayerInfo // *YgoCtosMsg_CtosPlayerInfo
// *YgoCtosMsg_CtosJoinGame // *YgoCtosMsg_CtosJoinGame
// *YgoCtosMsg_CtosUpdateDeck // *YgoCtosMsg_CtosUpdateDeck
// *YgoCtosMsg_CtosHsReady
Msg isYgoCtosMsg_Msg `protobuf_oneof:"msg"` Msg isYgoCtosMsg_Msg `protobuf_oneof:"msg"`
} }
...@@ -92,6 +93,13 @@ func (x *YgoCtosMsg) GetCtosUpdateDeck() *CtosUpdateDeck { ...@@ -92,6 +93,13 @@ func (x *YgoCtosMsg) GetCtosUpdateDeck() *CtosUpdateDeck {
return nil return nil
} }
func (x *YgoCtosMsg) GetCtosHsReady() *CtosHsReady {
if x, ok := x.GetMsg().(*YgoCtosMsg_CtosHsReady); ok {
return x.CtosHsReady
}
return nil
}
type isYgoCtosMsg_Msg interface { type isYgoCtosMsg_Msg interface {
isYgoCtosMsg_Msg() isYgoCtosMsg_Msg()
} }
...@@ -108,12 +116,18 @@ type YgoCtosMsg_CtosUpdateDeck struct { ...@@ -108,12 +116,18 @@ type YgoCtosMsg_CtosUpdateDeck struct {
CtosUpdateDeck *CtosUpdateDeck `protobuf:"bytes,3,opt,name=ctos_update_deck,json=ctosUpdateDeck,proto3,oneof"` CtosUpdateDeck *CtosUpdateDeck `protobuf:"bytes,3,opt,name=ctos_update_deck,json=ctosUpdateDeck,proto3,oneof"`
} }
type YgoCtosMsg_CtosHsReady struct {
CtosHsReady *CtosHsReady `protobuf:"bytes,4,opt,name=ctos_hs_ready,json=ctosHsReady,proto3,oneof"`
}
func (*YgoCtosMsg_CtosPlayerInfo) isYgoCtosMsg_Msg() {} func (*YgoCtosMsg_CtosPlayerInfo) isYgoCtosMsg_Msg() {}
func (*YgoCtosMsg_CtosJoinGame) isYgoCtosMsg_Msg() {} func (*YgoCtosMsg_CtosJoinGame) isYgoCtosMsg_Msg() {}
func (*YgoCtosMsg_CtosUpdateDeck) isYgoCtosMsg_Msg() {} func (*YgoCtosMsg_CtosUpdateDeck) isYgoCtosMsg_Msg() {}
func (*YgoCtosMsg_CtosHsReady) isYgoCtosMsg_Msg() {}
type YgoStocMsg struct { type YgoStocMsg struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -395,6 +409,44 @@ func (x *CtosUpdateDeck) GetSide() []int32 { ...@@ -395,6 +409,44 @@ func (x *CtosUpdateDeck) GetSide() []int32 {
return nil return nil
} }
type CtosHsReady struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *CtosHsReady) Reset() {
*x = CtosHsReady{}
if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CtosHsReady) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CtosHsReady) ProtoMessage() {}
func (x *CtosHsReady) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CtosHsReady.ProtoReflect.Descriptor instead.
func (*CtosHsReady) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{5}
}
type StocJoinGame struct { type StocJoinGame struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -415,7 +467,7 @@ type StocJoinGame struct { ...@@ -415,7 +467,7 @@ type StocJoinGame struct {
func (x *StocJoinGame) Reset() { func (x *StocJoinGame) Reset() {
*x = StocJoinGame{} *x = StocJoinGame{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[5] mi := &file_ocgcore_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
...@@ -428,7 +480,7 @@ func (x *StocJoinGame) String() string { ...@@ -428,7 +480,7 @@ func (x *StocJoinGame) String() string {
func (*StocJoinGame) ProtoMessage() {} func (*StocJoinGame) ProtoMessage() {}
func (x *StocJoinGame) ProtoReflect() protoreflect.Message { func (x *StocJoinGame) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[5] mi := &file_ocgcore_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
...@@ -441,7 +493,7 @@ func (x *StocJoinGame) ProtoReflect() protoreflect.Message { ...@@ -441,7 +493,7 @@ func (x *StocJoinGame) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocJoinGame.ProtoReflect.Descriptor instead. // Deprecated: Use StocJoinGame.ProtoReflect.Descriptor instead.
func (*StocJoinGame) Descriptor() ([]byte, []int) { func (*StocJoinGame) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{5} return file_ocgcore_proto_rawDescGZIP(), []int{6}
} }
func (x *StocJoinGame) GetLflist() int32 { func (x *StocJoinGame) GetLflist() int32 {
...@@ -526,7 +578,7 @@ type StocChat struct { ...@@ -526,7 +578,7 @@ type StocChat struct {
func (x *StocChat) Reset() { func (x *StocChat) Reset() {
*x = StocChat{} *x = StocChat{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[6] mi := &file_ocgcore_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
...@@ -539,7 +591,7 @@ func (x *StocChat) String() string { ...@@ -539,7 +591,7 @@ func (x *StocChat) String() string {
func (*StocChat) ProtoMessage() {} func (*StocChat) ProtoMessage() {}
func (x *StocChat) ProtoReflect() protoreflect.Message { func (x *StocChat) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[6] mi := &file_ocgcore_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
...@@ -552,7 +604,7 @@ func (x *StocChat) ProtoReflect() protoreflect.Message { ...@@ -552,7 +604,7 @@ func (x *StocChat) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocChat.ProtoReflect.Descriptor instead. // Deprecated: Use StocChat.ProtoReflect.Descriptor instead.
func (*StocChat) Descriptor() ([]byte, []int) { func (*StocChat) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{6} return file_ocgcore_proto_rawDescGZIP(), []int{7}
} }
func (x *StocChat) GetPlayer() int32 { func (x *StocChat) GetPlayer() int32 {
...@@ -581,7 +633,7 @@ type StocHsPlayerEnter struct { ...@@ -581,7 +633,7 @@ type StocHsPlayerEnter struct {
func (x *StocHsPlayerEnter) Reset() { func (x *StocHsPlayerEnter) Reset() {
*x = StocHsPlayerEnter{} *x = StocHsPlayerEnter{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[7] mi := &file_ocgcore_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
...@@ -594,7 +646,7 @@ func (x *StocHsPlayerEnter) String() string { ...@@ -594,7 +646,7 @@ func (x *StocHsPlayerEnter) String() string {
func (*StocHsPlayerEnter) ProtoMessage() {} func (*StocHsPlayerEnter) ProtoMessage() {}
func (x *StocHsPlayerEnter) ProtoReflect() protoreflect.Message { func (x *StocHsPlayerEnter) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[7] mi := &file_ocgcore_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
...@@ -607,7 +659,7 @@ func (x *StocHsPlayerEnter) ProtoReflect() protoreflect.Message { ...@@ -607,7 +659,7 @@ func (x *StocHsPlayerEnter) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocHsPlayerEnter.ProtoReflect.Descriptor instead. // Deprecated: Use StocHsPlayerEnter.ProtoReflect.Descriptor instead.
func (*StocHsPlayerEnter) Descriptor() ([]byte, []int) { func (*StocHsPlayerEnter) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{7} return file_ocgcore_proto_rawDescGZIP(), []int{8}
} }
func (x *StocHsPlayerEnter) GetName() string { func (x *StocHsPlayerEnter) GetName() string {
...@@ -635,7 +687,7 @@ type StocTypeChange struct { ...@@ -635,7 +687,7 @@ type StocTypeChange struct {
func (x *StocTypeChange) Reset() { func (x *StocTypeChange) Reset() {
*x = StocTypeChange{} *x = StocTypeChange{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[8] mi := &file_ocgcore_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
...@@ -648,7 +700,7 @@ func (x *StocTypeChange) String() string { ...@@ -648,7 +700,7 @@ func (x *StocTypeChange) String() string {
func (*StocTypeChange) ProtoMessage() {} func (*StocTypeChange) ProtoMessage() {}
func (x *StocTypeChange) ProtoReflect() protoreflect.Message { func (x *StocTypeChange) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[8] mi := &file_ocgcore_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
...@@ -661,7 +713,7 @@ func (x *StocTypeChange) ProtoReflect() protoreflect.Message { ...@@ -661,7 +713,7 @@ func (x *StocTypeChange) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocTypeChange.ProtoReflect.Descriptor instead. // Deprecated: Use StocTypeChange.ProtoReflect.Descriptor instead.
func (*StocTypeChange) Descriptor() ([]byte, []int) { func (*StocTypeChange) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{8} return file_ocgcore_proto_rawDescGZIP(), []int{9}
} }
func (x *StocTypeChange) GetType() int32 { func (x *StocTypeChange) GetType() int32 {
...@@ -675,7 +727,7 @@ var File_ocgcore_proto protoreflect.FileDescriptor ...@@ -675,7 +727,7 @@ var File_ocgcore_proto protoreflect.FileDescriptor
var file_ocgcore_proto_rawDesc = []byte{ var file_ocgcore_proto_rawDesc = []byte{
0x0a, 0x0d, 0x6f, 0x63, 0x67, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x0d, 0x6f, 0x63, 0x67, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x06, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x22, 0xd9, 0x01, 0x0a, 0x0a, 0x59, 0x67, 0x6f, 0x43, 0x06, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x22, 0x94, 0x02, 0x0a, 0x0a, 0x59, 0x67, 0x6f, 0x43,
0x74, 0x6f, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x42, 0x0a, 0x10, 0x63, 0x74, 0x6f, 0x73, 0x5f, 0x70, 0x74, 0x6f, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x42, 0x0a, 0x10, 0x63, 0x74, 0x6f, 0x73, 0x5f, 0x70,
0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x43, 0x74, 0x6f, 0x73, 0x50, 0x6c, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x43, 0x74, 0x6f, 0x73, 0x50, 0x6c,
...@@ -688,68 +740,73 @@ var file_ocgcore_proto_rawDesc = []byte{ ...@@ -688,68 +740,73 @@ var file_ocgcore_proto_rawDesc = []byte{
0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x43, 0x74, 0x6f, 0x73, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x43, 0x74, 0x6f, 0x73,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x74,
0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x42, 0x05, 0x0a, 0x03, 0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x39, 0x0a, 0x0d,
0x6d, 0x73, 0x67, 0x22, 0x94, 0x02, 0x0a, 0x0a, 0x59, 0x67, 0x6f, 0x53, 0x74, 0x6f, 0x63, 0x4d, 0x63, 0x74, 0x6f, 0x73, 0x5f, 0x68, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x04, 0x20,
0x73, 0x67, 0x12, 0x3c, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x5f, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x43, 0x74, 0x6f,
0x67, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x79, 0x67, 0x6f, 0x73, 0x48, 0x73, 0x52, 0x65, 0x61, 0x64, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x74, 0x6f, 0x73,
0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x48, 0x73, 0x52, 0x65, 0x61, 0x64, 0x79, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x94,
0x48, 0x00, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x02, 0x0a, 0x0a, 0x59, 0x67, 0x6f, 0x53, 0x74, 0x6f, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x3c, 0x0a,
0x12, 0x2f, 0x0a, 0x09, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x74, 0x18, 0x02, 0x20, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53,
0x63, 0x43, 0x68, 0x61, 0x74, 0x48, 0x00, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x73,
0x74, 0x12, 0x4c, 0x0a, 0x14, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x68, 0x73, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x09, 0x73,
0x79, 0x65, 0x72, 0x5f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x74, 0x6f, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10,
0x19, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74,
0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x11, 0x73, 0x74, 0x48, 0x00, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x14,
0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x68, 0x73, 0x5f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x65,
0x42, 0x0a, 0x10, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x79, 0x67, 0x6f,
0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x11, 0x73, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50,
0x65, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x10, 0x73, 0x74,
0x6e, 0x67, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x24, 0x0a, 0x0e, 0x43, 0x74, 0x6f, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04,
0x6f, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0e,
0x22, 0x58, 0x0a, 0x0c, 0x43, 0x74, 0x6f, 0x73, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x73, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x05,
0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x24, 0x0a, 0x0e, 0x43, 0x74, 0x6f, 0x73, 0x50, 0x6c, 0x61,
0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x6d, 0x65, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x58, 0x0a, 0x0c, 0x43,
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18, 0x03, 0x20, 0x01, 0x74, 0x6f, 0x73, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76,
0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x22, 0x4e, 0x0a, 0x0e, 0x43, 0x74, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65,
0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x69, 0x64, 0x18,
0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x69, 0x64, 0x12, 0x16, 0x0a,
0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70,
0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x03, 0x61, 0x73, 0x73, 0x77, 0x64, 0x22, 0x4e, 0x0a, 0x0e, 0x43, 0x74, 0x6f, 0x73, 0x55, 0x70, 0x64,
0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0xaf, 0x02, 0x0a, 0x0c, 0x53, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x18,
0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65,
0x66, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x66, 0x6c, 0x78, 0x74, 0x72, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72,
0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52,
0x05, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x43, 0x74, 0x6f, 0x73, 0x48, 0x73, 0x52,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x61, 0x64, 0x79, 0x22, 0xaf, 0x02, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69,
0x75, 0x65, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x18,
0x64, 0x75, 0x65, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x6f, 0x5f, 0x63, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a,
0x68, 0x65, 0x63, 0x6b, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x75, 0x6c,
0x0b, 0x6e, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x6e, 0x6f, 0x5f, 0x73, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x75, 0x65, 0x6c, 0x5f, 0x72, 0x75,
0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6e, 0x6f, 0x53, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x65, 0x6c, 0x52, 0x75,
0x44, 0x65, 0x63, 0x6b, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x70, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x6f, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x64,
0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x70, 0x12, 0x65, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x6f, 0x43, 0x68, 0x65,
0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x18, 0x08, 0x20, 0x63, 0x6b, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x73, 0x68, 0x75,
0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x66, 0x66, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52,
0x0a, 0x0a, 0x64, 0x72, 0x61, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x0d, 0x6e, 0x6f, 0x53, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x19,
0x28, 0x05, 0x52, 0x09, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61,
0x05, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x34, 0x0a, 0x08, 0x72, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73,
0x53, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x77,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x72,
0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f,
0x73, 0x67, 0x22, 0x39, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x69, 0x6d,
0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x34, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x63, 0x43, 0x68,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x22, 0x24, 0x0a, 0x28, 0x05, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73,
0x0e, 0x53, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x39, 0x0a, 0x11,
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65,
0x79, 0x70, 0x65, 0x42, 0x13, 0x5a, 0x11, 0x44, 0x61, 0x72, 0x6b, 0x4e, 0x65, 0x6f, 0x73, 0x2f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x22, 0x24, 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x63, 0x54,
0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x13, 0x5a,
0x11, 0x44, 0x61, 0x72, 0x6b, 0x4e, 0x65, 0x6f, 0x73, 0x2f, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
...@@ -764,31 +821,33 @@ func file_ocgcore_proto_rawDescGZIP() []byte { ...@@ -764,31 +821,33 @@ func file_ocgcore_proto_rawDescGZIP() []byte {
return file_ocgcore_proto_rawDescData return file_ocgcore_proto_rawDescData
} }
var file_ocgcore_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_ocgcore_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_ocgcore_proto_goTypes = []interface{}{ var file_ocgcore_proto_goTypes = []interface{}{
(*YgoCtosMsg)(nil), // 0: ygopro.YgoCtosMsg (*YgoCtosMsg)(nil), // 0: ygopro.YgoCtosMsg
(*YgoStocMsg)(nil), // 1: ygopro.YgoStocMsg (*YgoStocMsg)(nil), // 1: ygopro.YgoStocMsg
(*CtosPlayerInfo)(nil), // 2: ygopro.CtosPlayerInfo (*CtosPlayerInfo)(nil), // 2: ygopro.CtosPlayerInfo
(*CtosJoinGame)(nil), // 3: ygopro.CtosJoinGame (*CtosJoinGame)(nil), // 3: ygopro.CtosJoinGame
(*CtosUpdateDeck)(nil), // 4: ygopro.CtosUpdateDeck (*CtosUpdateDeck)(nil), // 4: ygopro.CtosUpdateDeck
(*StocJoinGame)(nil), // 5: ygopro.StocJoinGame (*CtosHsReady)(nil), // 5: ygopro.CtosHsReady
(*StocChat)(nil), // 6: ygopro.StocChat (*StocJoinGame)(nil), // 6: ygopro.StocJoinGame
(*StocHsPlayerEnter)(nil), // 7: ygopro.StocHsPlayerEnter (*StocChat)(nil), // 7: ygopro.StocChat
(*StocTypeChange)(nil), // 8: ygopro.StocTypeChange (*StocHsPlayerEnter)(nil), // 8: ygopro.StocHsPlayerEnter
(*StocTypeChange)(nil), // 9: ygopro.StocTypeChange
} }
var file_ocgcore_proto_depIdxs = []int32{ var file_ocgcore_proto_depIdxs = []int32{
2, // 0: ygopro.YgoCtosMsg.ctos_player_info:type_name -> ygopro.CtosPlayerInfo 2, // 0: ygopro.YgoCtosMsg.ctos_player_info:type_name -> ygopro.CtosPlayerInfo
3, // 1: ygopro.YgoCtosMsg.ctos_join_game:type_name -> ygopro.CtosJoinGame 3, // 1: ygopro.YgoCtosMsg.ctos_join_game:type_name -> ygopro.CtosJoinGame
4, // 2: ygopro.YgoCtosMsg.ctos_update_deck:type_name -> ygopro.CtosUpdateDeck 4, // 2: ygopro.YgoCtosMsg.ctos_update_deck:type_name -> ygopro.CtosUpdateDeck
5, // 3: ygopro.YgoStocMsg.stoc_join_game:type_name -> ygopro.StocJoinGame 5, // 3: ygopro.YgoCtosMsg.ctos_hs_ready:type_name -> ygopro.CtosHsReady
6, // 4: ygopro.YgoStocMsg.stoc_chat:type_name -> ygopro.StocChat 6, // 4: ygopro.YgoStocMsg.stoc_join_game:type_name -> ygopro.StocJoinGame
7, // 5: ygopro.YgoStocMsg.stoc_hs_player_enter:type_name -> ygopro.StocHsPlayerEnter 7, // 5: ygopro.YgoStocMsg.stoc_chat:type_name -> ygopro.StocChat
8, // 6: ygopro.YgoStocMsg.stoc_type_change:type_name -> ygopro.StocTypeChange 8, // 6: ygopro.YgoStocMsg.stoc_hs_player_enter:type_name -> ygopro.StocHsPlayerEnter
7, // [7:7] is the sub-list for method output_type 9, // 7: ygopro.YgoStocMsg.stoc_type_change:type_name -> ygopro.StocTypeChange
7, // [7:7] is the sub-list for method input_type 8, // [8:8] is the sub-list for method output_type
7, // [7:7] is the sub-list for extension type_name 8, // [8:8] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension extendee 8, // [8:8] is the sub-list for extension type_name
0, // [0:7] is the sub-list for field type_name 8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
} }
func init() { file_ocgcore_proto_init() } func init() { file_ocgcore_proto_init() }
...@@ -858,7 +917,7 @@ func file_ocgcore_proto_init() { ...@@ -858,7 +917,7 @@ func file_ocgcore_proto_init() {
} }
} }
file_ocgcore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_ocgcore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocJoinGame); i { switch v := v.(*CtosHsReady); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
...@@ -870,7 +929,7 @@ func file_ocgcore_proto_init() { ...@@ -870,7 +929,7 @@ func file_ocgcore_proto_init() {
} }
} }
file_ocgcore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_ocgcore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocChat); i { switch v := v.(*StocJoinGame); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
...@@ -882,7 +941,7 @@ func file_ocgcore_proto_init() { ...@@ -882,7 +941,7 @@ func file_ocgcore_proto_init() {
} }
} }
file_ocgcore_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_ocgcore_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocHsPlayerEnter); i { switch v := v.(*StocChat); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
...@@ -894,6 +953,18 @@ func file_ocgcore_proto_init() { ...@@ -894,6 +953,18 @@ func file_ocgcore_proto_init() {
} }
} }
file_ocgcore_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_ocgcore_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocHsPlayerEnter); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocgcore_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocTypeChange); i { switch v := v.(*StocTypeChange); i {
case 0: case 0:
return &v.state return &v.state
...@@ -910,6 +981,7 @@ func file_ocgcore_proto_init() { ...@@ -910,6 +981,7 @@ func file_ocgcore_proto_init() {
(*YgoCtosMsg_CtosPlayerInfo)(nil), (*YgoCtosMsg_CtosPlayerInfo)(nil),
(*YgoCtosMsg_CtosJoinGame)(nil), (*YgoCtosMsg_CtosJoinGame)(nil),
(*YgoCtosMsg_CtosUpdateDeck)(nil), (*YgoCtosMsg_CtosUpdateDeck)(nil),
(*YgoCtosMsg_CtosHsReady)(nil),
} }
file_ocgcore_proto_msgTypes[1].OneofWrappers = []interface{}{ file_ocgcore_proto_msgTypes[1].OneofWrappers = []interface{}{
(*YgoStocMsg_StocJoinGame)(nil), (*YgoStocMsg_StocJoinGame)(nil),
...@@ -923,7 +995,7 @@ func file_ocgcore_proto_init() { ...@@ -923,7 +995,7 @@ func file_ocgcore_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ocgcore_proto_rawDesc, RawDescriptor: file_ocgcore_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 9, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
......
Subproject commit a54ddaec084aaf70a779f5a876d2e8554905625c Subproject commit 1ca09b1d90b55e2c155f83781c8b2a5d2ee30a04
package util
import (
"encoding/binary"
"unicode/utf16"
)
const UTF16_BUFFER_MAX_LEN int = 20
const FILLING_TOKEN uint16 = 0xcccc
func StrToUtf16Buffer(s string) []uint16 {
b := make([]uint16, UTF16_BUFFER_MAX_LEN, UTF16_BUFFER_MAX_LEN)
for i := range b {
b[i] = FILLING_TOKEN
}
s_utf16 := utf16.Encode([]rune(s))
// todo: optimize
for i, v := range s_utf16 {
if i < UTF16_BUFFER_MAX_LEN {
b[i] = v
if i == len(s_utf16)-1 && i < len(b)-1 {
b[i+1] = 0
}
} else {
break
}
}
return b
}
func Utf16BufferToStr(p []byte) string {
v := chunkBytesToUint16s(p)
return string(utf16.Decode(v))
}
func Uint16BufToByteBuf(u16_b []uint16) []byte {
b := make([]byte, 0, len(u16_b)*2)
for _, v := range u16_b {
// little endian
b = append(b, byte(v), byte(v>>8))
}
return b
}
func Int32ArrayToByteArray(v []int32) []byte {
b := make([]byte, 0, len(v)*4)
for _, i := range v {
b = append(b, byte(i), byte(i>>8), byte(i>>16), byte(i>>24))
}
return b
}
func chunkBytesToUint16s(items []byte) []uint16 {
const chunkSize = 2
var chunks []uint16
for chunkSize < len(items) {
items, chunks = items[chunkSize:], append(chunks, binary.LittleEndian.Uint16(items))
}
return chunks
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment