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 (
"errors"
"fmt"
"log"
"unicode/utf16"
"github.com/sktt1ryze/ygopro-proxy/DarkNeos/ygopropb"
util "github.com/sktt1ryze/ygopro-proxy/util"
"google.golang.org/protobuf/proto"
)
const FILLING_TOKEN uint16 = 0xcccc
const UTF16_BUFFER_MAX_LEN int = 20
const PACKET_MIN_LEN int = 3
const COMPONENT = "[transform]"
const (
......@@ -24,10 +21,13 @@ const (
)
const (
CtosUpdateDeck = 2
CtosProtoPlayerInfo = 16
CtosProtoJoinGame = 18
CtosHsReady = 34
StocJoinGame = 18
StocTypeChange = 19
StocChat = 25
StocHsPlayerEnter = 32
)
......@@ -108,6 +108,10 @@ func Transform(src []byte, tranformType int, ctx *util.Context) ([]byte, error)
packet = (*pCtosPlayerInfo)(message.GetCtosPlayerInfo()).Pb2Packet()
case *(ygopropb.YgoCtosMsg_CtosJoinGame):
packet = (*pCtosJoinGame)(message.GetCtosJoinGame()).Pb2Packet()
case *(ygopropb.YgoCtosMsg_CtosUpdateDeck):
packet = (*pCtosUpdateDeck)(message.GetCtosUpdateDeck()).Pb2Packet()
case *(ygopropb.YgoCtosMsg_CtosHsReady):
packet = (*pCtosHsReady)(message.GetCtosHsReady()).Pb2Packet()
default:
return nil, errors.New(COMPONENT + "Unhandled YgoCtosMsg type")
}
......@@ -128,6 +132,8 @@ func Transform(src []byte, tranformType int, ctx *util.Context) ([]byte, error)
pb = pStocJoinGame{}.Packet2Pb(packet)
case StocHsPlayerEnter:
pb = pStocHsPlayerEnter{}.Packet2Pb(packet)
case StocTypeChange:
pb = pStocTypeChage{}.Packet2Pb(packet)
default:
return nil, errors.New(fmt.Sprintf(COMPONENT+"Unhandled YgoStocMsg type, proto=%d", packet.Proto))
}
......@@ -148,8 +154,8 @@ type pCtosPlayerInfo ygopropb.CtosPlayerInfo
// @Name: [20]uint16
func (pb *pCtosPlayerInfo) Pb2Packet() YgoPacket {
buf := strToUtf16Buffer(pb.Name)
exdata := uint16BufToByteBuf(buf)
buf := util.StrToUtf16Buffer(pb.Name)
exdata := util.Uint16BufToByteBuf(buf)
return YgoPacket{
PacketLen: uint16(len(exdata)) + 1,
......@@ -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))
for _, v := range uint16BufToByteBuf(strToUtf16Buffer(pb.Passwd)) {
for _, v := range util.Uint16BufToByteBuf(util.StrToUtf16Buffer(pb.Passwd)) {
exdata = append(exdata, v)
}
......@@ -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 +++++
type server2Client interface {
......@@ -194,7 +234,7 @@ type pStocChat struct{}
// @message: []uint16
func (_ pStocChat) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
player := int32(binary.LittleEndian.Uint16(pkt.Exdata))
message := utf16BufferToStr(pkt.Exdata[2:])
message := util.Utf16BufferToStr(pkt.Exdata[2:])
msg := ygopropb.YgoStocMsg_StocChat{
StocChat: &ygopropb.StocChat{
......@@ -251,8 +291,8 @@ func (_ pStocJoinGame) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
type pStocHsPlayerEnter struct{}
func (_ pStocHsPlayerEnter) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
name_max := UTF16_BUFFER_MAX_LEN * 2
name := utf16BufferToStr(pkt.Exdata[:name_max])
name_max := util.UTF16_BUFFER_MAX_LEN * 2
name := util.Utf16BufferToStr(pkt.Exdata[:name_max])
pos := pkt.Exdata[name_max]
msg := ygopropb.YgoStocMsg_StocHsPlayerEnter{
......@@ -267,56 +307,16 @@ func (_ pStocHsPlayerEnter) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
}
}
// +++++ Util Functions +++++
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
type pStocTypeChage struct{}
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))
func (_ pStocTypeChage) Packet2Pb(pkt YgoPacket) ygopropb.YgoStocMsg {
msg := ygopropb.YgoStocMsg_StocTypeChange{
StocTypeChange: &ygopropb.StocTypeChange{
Type: int32(pkt.Exdata[0]),
},
}
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 ygopropb.YgoStocMsg{
Msg: &msg,
}
return chunks
}
......@@ -29,6 +29,7 @@ type YgoCtosMsg struct {
// *YgoCtosMsg_CtosPlayerInfo
// *YgoCtosMsg_CtosJoinGame
// *YgoCtosMsg_CtosUpdateDeck
// *YgoCtosMsg_CtosHsReady
Msg isYgoCtosMsg_Msg `protobuf_oneof:"msg"`
}
......@@ -92,6 +93,13 @@ func (x *YgoCtosMsg) GetCtosUpdateDeck() *CtosUpdateDeck {
return nil
}
func (x *YgoCtosMsg) GetCtosHsReady() *CtosHsReady {
if x, ok := x.GetMsg().(*YgoCtosMsg_CtosHsReady); ok {
return x.CtosHsReady
}
return nil
}
type isYgoCtosMsg_Msg interface {
isYgoCtosMsg_Msg()
}
......@@ -108,12 +116,18 @@ type YgoCtosMsg_CtosUpdateDeck struct {
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_CtosJoinGame) isYgoCtosMsg_Msg() {}
func (*YgoCtosMsg_CtosUpdateDeck) isYgoCtosMsg_Msg() {}
func (*YgoCtosMsg_CtosHsReady) isYgoCtosMsg_Msg() {}
type YgoStocMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
......@@ -395,6 +409,44 @@ func (x *CtosUpdateDeck) GetSide() []int32 {
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 {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
......@@ -415,7 +467,7 @@ type StocJoinGame struct {
func (x *StocJoinGame) Reset() {
*x = StocJoinGame{}
if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[5]
mi := &file_ocgcore_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
......@@ -428,7 +480,7 @@ func (x *StocJoinGame) String() string {
func (*StocJoinGame) ProtoMessage() {}
func (x *StocJoinGame) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[5]
mi := &file_ocgcore_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
......@@ -441,7 +493,7 @@ func (x *StocJoinGame) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocJoinGame.ProtoReflect.Descriptor instead.
func (*StocJoinGame) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{5}
return file_ocgcore_proto_rawDescGZIP(), []int{6}
}
func (x *StocJoinGame) GetLflist() int32 {
......@@ -526,7 +578,7 @@ type StocChat struct {
func (x *StocChat) Reset() {
*x = StocChat{}
if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[6]
mi := &file_ocgcore_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
......@@ -539,7 +591,7 @@ func (x *StocChat) String() string {
func (*StocChat) ProtoMessage() {}
func (x *StocChat) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[6]
mi := &file_ocgcore_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
......@@ -552,7 +604,7 @@ func (x *StocChat) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocChat.ProtoReflect.Descriptor instead.
func (*StocChat) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{6}
return file_ocgcore_proto_rawDescGZIP(), []int{7}
}
func (x *StocChat) GetPlayer() int32 {
......@@ -581,7 +633,7 @@ type StocHsPlayerEnter struct {
func (x *StocHsPlayerEnter) Reset() {
*x = StocHsPlayerEnter{}
if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[7]
mi := &file_ocgcore_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
......@@ -594,7 +646,7 @@ func (x *StocHsPlayerEnter) String() string {
func (*StocHsPlayerEnter) ProtoMessage() {}
func (x *StocHsPlayerEnter) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[7]
mi := &file_ocgcore_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
......@@ -607,7 +659,7 @@ func (x *StocHsPlayerEnter) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocHsPlayerEnter.ProtoReflect.Descriptor instead.
func (*StocHsPlayerEnter) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{7}
return file_ocgcore_proto_rawDescGZIP(), []int{8}
}
func (x *StocHsPlayerEnter) GetName() string {
......@@ -635,7 +687,7 @@ type StocTypeChange struct {
func (x *StocTypeChange) Reset() {
*x = StocTypeChange{}
if protoimpl.UnsafeEnabled {
mi := &file_ocgcore_proto_msgTypes[8]
mi := &file_ocgcore_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
......@@ -648,7 +700,7 @@ func (x *StocTypeChange) String() string {
func (*StocTypeChange) ProtoMessage() {}
func (x *StocTypeChange) ProtoReflect() protoreflect.Message {
mi := &file_ocgcore_proto_msgTypes[8]
mi := &file_ocgcore_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
......@@ -661,7 +713,7 @@ func (x *StocTypeChange) ProtoReflect() protoreflect.Message {
// Deprecated: Use StocTypeChange.ProtoReflect.Descriptor instead.
func (*StocTypeChange) Descriptor() ([]byte, []int) {
return file_ocgcore_proto_rawDescGZIP(), []int{8}
return file_ocgcore_proto_rawDescGZIP(), []int{9}
}
func (x *StocTypeChange) GetType() int32 {
......@@ -675,7 +727,7 @@ var File_ocgcore_proto protoreflect.FileDescriptor
var file_ocgcore_proto_rawDesc = []byte{
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,
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,
......@@ -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,
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,
0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x42, 0x05, 0x0a, 0x03,
0x6d, 0x73, 0x67, 0x22, 0x94, 0x02, 0x0a, 0x0a, 0x59, 0x67, 0x6f, 0x53, 0x74, 0x6f, 0x63, 0x4d,
0x73, 0x67, 0x12, 0x3c, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x5f,
0x67, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x79, 0x67, 0x6f,
0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65,
0x48, 0x00, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65,
0x12, 0x2f, 0x0a, 0x09, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x74, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f,
0x63, 0x43, 0x68, 0x61, 0x74, 0x48, 0x00, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61,
0x74, 0x12, 0x4c, 0x0a, 0x14, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x68, 0x73, 0x5f, 0x70, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x5f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x19, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50,
0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x11, 0x73, 0x74,
0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12,
0x42, 0x0a, 0x10, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x63, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70,
0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x24, 0x0a, 0x0e, 0x43, 0x74,
0x6f, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x22, 0x58, 0x0a, 0x0c, 0x43, 0x74, 0x6f, 0x73, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65,
0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x61,
0x6d, 0x65, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65,
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x22, 0x4e, 0x0a, 0x0e, 0x43, 0x74,
0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04,
0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x61, 0x69, 0x6e,
0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52,
0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x03,
0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0xaf, 0x02, 0x0a, 0x0c, 0x53,
0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c,
0x66, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x66, 0x6c,
0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64,
0x75, 0x65, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x64, 0x75, 0x65, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x6f, 0x5f, 0x63,
0x68, 0x65, 0x63, 0x6b, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52,
0x0b, 0x6e, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0f,
0x6e, 0x6f, 0x5f, 0x73, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18,
0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6e, 0x6f, 0x53, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65,
0x44, 0x65, 0x63, 0x6b, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x70,
0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x70, 0x12,
0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x18, 0x08, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x12, 0x1d,
0x0a, 0x0a, 0x64, 0x72, 0x61, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01,
0x28, 0x05, 0x52, 0x09, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a,
0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x05, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x34, 0x0a, 0x08,
0x53, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d,
0x73, 0x67, 0x22, 0x39, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 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,
0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x39, 0x0a, 0x0d,
0x63, 0x74, 0x6f, 0x73, 0x5f, 0x68, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x04, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x43, 0x74, 0x6f,
0x73, 0x48, 0x73, 0x52, 0x65, 0x61, 0x64, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x74, 0x6f, 0x73,
0x48, 0x73, 0x52, 0x65, 0x61, 0x64, 0x79, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x94,
0x02, 0x0a, 0x0a, 0x59, 0x67, 0x6f, 0x53, 0x74, 0x6f, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x3c, 0x0a,
0x0e, 0x73, 0x74, 0x6f, 0x63, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53,
0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x73,
0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x09, 0x73,
0x74, 0x6f, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10,
0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74,
0x48, 0x00, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x14,
0x73, 0x74, 0x6f, 0x63, 0x5f, 0x68, 0x73, 0x5f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x65,
0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x79, 0x67, 0x6f,
0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x45, 0x6e, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x11, 0x73, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50,
0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x10, 0x73, 0x74,
0x6f, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x79, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x2e, 0x53, 0x74,
0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0e,
0x73, 0x74, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x05,
0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x24, 0x0a, 0x0e, 0x43, 0x74, 0x6f, 0x73, 0x50, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x58, 0x0a, 0x0c, 0x43,
0x74, 0x6f, 0x73, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x69, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70,
0x61, 0x73, 0x73, 0x77, 0x64, 0x22, 0x4e, 0x0a, 0x0e, 0x43, 0x74, 0x6f, 0x73, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x18,
0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65,
0x78, 0x74, 0x72, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72,
0x61, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52,
0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x43, 0x74, 0x6f, 0x73, 0x48, 0x73, 0x52,
0x65, 0x61, 0x64, 0x79, 0x22, 0xaf, 0x02, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x63, 0x4a, 0x6f, 0x69,
0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a,
0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x75, 0x6c,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x75, 0x65, 0x6c, 0x5f, 0x72, 0x75,
0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x65, 0x6c, 0x52, 0x75,
0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x6f, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x64,
0x65, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x6f, 0x43, 0x68, 0x65,
0x63, 0x6b, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x73, 0x68, 0x75,
0x66, 0x66, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52,
0x0d, 0x6e, 0x6f, 0x53, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x44, 0x65, 0x63, 0x6b, 0x12, 0x19,
0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61,
0x72, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73,
0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x77,
0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x72,
0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f,
0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x69, 0x6d,
0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x34, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x63, 0x43, 0x68,
0x61, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73,
0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x39, 0x0a, 0x11,
0x53, 0x74, 0x6f, 0x63, 0x48, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65,
0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
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 (
......@@ -764,31 +821,33 @@ func file_ocgcore_proto_rawDescGZIP() []byte {
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{}{
(*YgoCtosMsg)(nil), // 0: ygopro.YgoCtosMsg
(*YgoStocMsg)(nil), // 1: ygopro.YgoStocMsg
(*CtosPlayerInfo)(nil), // 2: ygopro.CtosPlayerInfo
(*CtosJoinGame)(nil), // 3: ygopro.CtosJoinGame
(*CtosUpdateDeck)(nil), // 4: ygopro.CtosUpdateDeck
(*StocJoinGame)(nil), // 5: ygopro.StocJoinGame
(*StocChat)(nil), // 6: ygopro.StocChat
(*StocHsPlayerEnter)(nil), // 7: ygopro.StocHsPlayerEnter
(*StocTypeChange)(nil), // 8: ygopro.StocTypeChange
(*CtosHsReady)(nil), // 5: ygopro.CtosHsReady
(*StocJoinGame)(nil), // 6: ygopro.StocJoinGame
(*StocChat)(nil), // 7: ygopro.StocChat
(*StocHsPlayerEnter)(nil), // 8: ygopro.StocHsPlayerEnter
(*StocTypeChange)(nil), // 9: ygopro.StocTypeChange
}
var file_ocgcore_proto_depIdxs = []int32{
2, // 0: ygopro.YgoCtosMsg.ctos_player_info:type_name -> ygopro.CtosPlayerInfo
3, // 1: ygopro.YgoCtosMsg.ctos_join_game:type_name -> ygopro.CtosJoinGame
4, // 2: ygopro.YgoCtosMsg.ctos_update_deck:type_name -> ygopro.CtosUpdateDeck
5, // 3: ygopro.YgoStocMsg.stoc_join_game:type_name -> ygopro.StocJoinGame
6, // 4: ygopro.YgoStocMsg.stoc_chat:type_name -> ygopro.StocChat
7, // 5: ygopro.YgoStocMsg.stoc_hs_player_enter:type_name -> ygopro.StocHsPlayerEnter
8, // 6: ygopro.YgoStocMsg.stoc_type_change:type_name -> ygopro.StocTypeChange
7, // [7:7] is the sub-list for method output_type
7, // [7:7] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
5, // 3: ygopro.YgoCtosMsg.ctos_hs_ready:type_name -> ygopro.CtosHsReady
6, // 4: ygopro.YgoStocMsg.stoc_join_game:type_name -> ygopro.StocJoinGame
7, // 5: ygopro.YgoStocMsg.stoc_chat:type_name -> ygopro.StocChat
8, // 6: ygopro.YgoStocMsg.stoc_hs_player_enter:type_name -> ygopro.StocHsPlayerEnter
9, // 7: ygopro.YgoStocMsg.stoc_type_change:type_name -> ygopro.StocTypeChange
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension 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() }
......@@ -858,7 +917,7 @@ func file_ocgcore_proto_init() {
}
}
file_ocgcore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocJoinGame); i {
switch v := v.(*CtosHsReady); i {
case 0:
return &v.state
case 1:
......@@ -870,7 +929,7 @@ func file_ocgcore_proto_init() {
}
}
file_ocgcore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocChat); i {
switch v := v.(*StocJoinGame); i {
case 0:
return &v.state
case 1:
......@@ -882,7 +941,7 @@ func file_ocgcore_proto_init() {
}
}
file_ocgcore_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StocHsPlayerEnter); i {
switch v := v.(*StocChat); i {
case 0:
return &v.state
case 1:
......@@ -894,6 +953,18 @@ func file_ocgcore_proto_init() {
}
}
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 {
case 0:
return &v.state
......@@ -910,6 +981,7 @@ func file_ocgcore_proto_init() {
(*YgoCtosMsg_CtosPlayerInfo)(nil),
(*YgoCtosMsg_CtosJoinGame)(nil),
(*YgoCtosMsg_CtosUpdateDeck)(nil),
(*YgoCtosMsg_CtosHsReady)(nil),
}
file_ocgcore_proto_msgTypes[1].OneofWrappers = []interface{}{
(*YgoStocMsg_StocJoinGame)(nil),
......@@ -923,7 +995,7 @@ func file_ocgcore_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ocgcore_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumMessages: 10,
NumExtensions: 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