package protocol // Code generated by protogen; DO NOT EDIT. import "google.golang.org/protobuf/encoding/protowire" const ( MessageOnConnection = uint32(1) MessageEnterWorld = uint32(2) MessageAddCurrency = uint32(10001) MessageReadMail = uint32(10002) MessagePushCreateProfile = uint32(30141) MessageNoticePush = uint32(30142) ) type MessageDescriptor struct { MsgID uint32 `json:"msg_id"` Name string `json:"name"` Constant string `json:"constant"` Description string `json:"description,omitempty"` } var genMsgDescs = []MessageDescriptor{ {MsgID: MessageOnConnection, Name: "OnConnection", Constant: "MessageOnConnection", Description: ""}, {MsgID: MessageEnterWorld, Name: "EnterWorld", Constant: "MessageEnterWorld", Description: ""}, {MsgID: MessageAddCurrency, Name: "AddCurrency", Constant: "MessageAddCurrency", Description: ""}, {MsgID: MessageReadMail, Name: "ReadMail", Constant: "MessageReadMail", Description: ""}, {MsgID: MessagePushCreateProfile, Name: "PushCreateProfile", Constant: "MessagePushCreateProfile", Description: ""}, {MsgID: MessageNoticePush, Name: "NoticePush", Constant: "MessageNoticePush", Description: ""}, } func MessageDescriptors() []MessageDescriptor { return append([]MessageDescriptor(nil), genMsgDescs...) } func MessageName(msgID uint32) (string, bool) { switch msgID { case MessageOnConnection: return "OnConnection", true case MessageEnterWorld: return "EnterWorld", true case MessageAddCurrency: return "AddCurrency", true case MessageReadMail: return "ReadMail", true case MessagePushCreateProfile: return "PushCreateProfile", true case MessageNoticePush: return "NoticePush", true default: return "", false } } type CreateProfilePush struct { } type NoticePush struct { NoticeID string DeliveryID string Title string Body string AttachmentRef string CreatedAt int64 } type EnterWorldResponse struct { AccountID string RoleID string Name string Level int ServerTime int64 Gold int64 Diamond int64 InventoryCount int QuestCount int UnreadMail int } type AddCurrencyRequest struct { Currency string Delta int64 } type AddCurrencyResponse struct { AccountID string Currency string Balance int64 ServerTime int64 } type ReadMailRequest struct { MailID string } type ReadMailResponse struct { AccountID string MailID string Changed bool UnreadMail int ServerTime int64 } func EncodeCreateProfilePush(value CreateProfilePush) []byte { return []byte{} } func EncodeNoticePush(value NoticePush) []byte { body := make([]byte, 0, 88) body = appendStringField(body, 1, value.NoticeID) body = appendStringField(body, 2, value.DeliveryID) body = appendStringField(body, 3, value.Title) body = appendStringField(body, 4, value.Body) body = appendStringField(body, 5, value.AttachmentRef) body = appendInt64Varint(body, 6, value.CreatedAt) return body } func EncodeEnterWorldResponse(value EnterWorldResponse) []byte { body := make([]byte, 0, 104) body = appendStringField(body, 1, value.AccountID) body = appendStringField(body, 2, value.RoleID) body = appendStringField(body, 3, value.Name) body = appendIntVarintField(body, 4, value.Level) body = appendInt64Varint(body, 5, value.ServerTime) body = appendInt64Varint(body, 6, value.Gold) body = appendInt64Varint(body, 7, value.Diamond) body = appendIntVarintField(body, 8, value.InventoryCount) body = appendIntVarintField(body, 9, value.QuestCount) body = appendIntVarintField(body, 10, value.UnreadMail) return body } func EncodeAddCurrencyRequest(value AddCurrencyRequest) []byte { body := make([]byte, 0, 24) body = appendStringField(body, 1, value.Currency) body = appendInt64Varint(body, 2, value.Delta) return body } func EncodeAddCurrencyResponse(value AddCurrencyResponse) []byte { body := make([]byte, 0, 48) body = appendStringField(body, 1, value.AccountID) body = appendStringField(body, 2, value.Currency) body = appendInt64Varint(body, 3, value.Balance) body = appendInt64Varint(body, 4, value.ServerTime) return body } func EncodeReadMailRequest(value ReadMailRequest) []byte { body := make([]byte, 0, 16) body = appendStringField(body, 1, value.MailID) return body } func EncodeReadMailResponse(value ReadMailResponse) []byte { body := make([]byte, 0, 56) body = appendStringField(body, 1, value.AccountID) body = appendStringField(body, 2, value.MailID) body = appendBoolField(body, 3, value.Changed) body = appendIntVarintField(body, 4, value.UnreadMail) body = appendInt64Varint(body, 5, value.ServerTime) return body } func DecodeNoticePush(body []byte) NoticePush { var value NoticePush for len(body) > 0 { fieldNumber, typ, consumed := protowire.ConsumeTag(body) if consumed < 0 { return value } body = body[consumed:] switch { case fieldNumber == 1 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.NoticeID = fieldValue body = body[n:] case fieldNumber == 2 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.DeliveryID = fieldValue body = body[n:] case fieldNumber == 3 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.Title = fieldValue body = body[n:] case fieldNumber == 4 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.Body = fieldValue body = body[n:] case fieldNumber == 5 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.AttachmentRef = fieldValue body = body[n:] case fieldNumber == 6 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.CreatedAt = int64FromVarint(fieldValue) body = body[n:] default: n := protowire.ConsumeFieldValue(fieldNumber, typ, body) if n < 0 { return value } body = body[n:] } } return value } func DecodeEnterWorldResponse(body []byte) EnterWorldResponse { var value EnterWorldResponse for len(body) > 0 { fieldNumber, typ, consumed := protowire.ConsumeTag(body) if consumed < 0 { return value } body = body[consumed:] switch { case fieldNumber == 1 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.AccountID = fieldValue body = body[n:] case fieldNumber == 2 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.RoleID = fieldValue body = body[n:] case fieldNumber == 3 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.Name = fieldValue body = body[n:] case fieldNumber == 4 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.Level = intFromVarint(fieldValue) body = body[n:] case fieldNumber == 5 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.ServerTime = int64FromVarint(fieldValue) body = body[n:] case fieldNumber == 6 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.Gold = int64FromVarint(fieldValue) body = body[n:] case fieldNumber == 7 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.Diamond = int64FromVarint(fieldValue) body = body[n:] case fieldNumber == 8 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.InventoryCount = intFromVarint(fieldValue) body = body[n:] case fieldNumber == 9 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.QuestCount = intFromVarint(fieldValue) body = body[n:] case fieldNumber == 10 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.UnreadMail = intFromVarint(fieldValue) body = body[n:] default: n := protowire.ConsumeFieldValue(fieldNumber, typ, body) if n < 0 { return value } body = body[n:] } } return value } func DecodeAddCurrencyRequest(body []byte) AddCurrencyRequest { var value AddCurrencyRequest for len(body) > 0 { fieldNumber, typ, consumed := protowire.ConsumeTag(body) if consumed < 0 { return value } body = body[consumed:] switch { case fieldNumber == 1 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.Currency = fieldValue body = body[n:] case fieldNumber == 2 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.Delta = int64FromVarint(fieldValue) body = body[n:] default: n := protowire.ConsumeFieldValue(fieldNumber, typ, body) if n < 0 { return value } body = body[n:] } } return value } func DecodeAddCurrencyResponse(body []byte) AddCurrencyResponse { var value AddCurrencyResponse for len(body) > 0 { fieldNumber, typ, consumed := protowire.ConsumeTag(body) if consumed < 0 { return value } body = body[consumed:] switch { case fieldNumber == 1 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.AccountID = fieldValue body = body[n:] case fieldNumber == 2 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.Currency = fieldValue body = body[n:] case fieldNumber == 3 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.Balance = int64FromVarint(fieldValue) body = body[n:] case fieldNumber == 4 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.ServerTime = int64FromVarint(fieldValue) body = body[n:] default: n := protowire.ConsumeFieldValue(fieldNumber, typ, body) if n < 0 { return value } body = body[n:] } } return value } func DecodeReadMailRequest(body []byte) ReadMailRequest { var value ReadMailRequest for len(body) > 0 { fieldNumber, typ, consumed := protowire.ConsumeTag(body) if consumed < 0 { return value } body = body[consumed:] switch { case fieldNumber == 1 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.MailID = fieldValue body = body[n:] default: n := protowire.ConsumeFieldValue(fieldNumber, typ, body) if n < 0 { return value } body = body[n:] } } return value } func DecodeReadMailResponse(body []byte) ReadMailResponse { var value ReadMailResponse for len(body) > 0 { fieldNumber, typ, consumed := protowire.ConsumeTag(body) if consumed < 0 { return value } body = body[consumed:] switch { case fieldNumber == 1 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.AccountID = fieldValue body = body[n:] case fieldNumber == 2 && typ == protowire.BytesType: fieldValue, n := protowire.ConsumeString(body) if n < 0 { return value } value.MailID = fieldValue body = body[n:] case fieldNumber == 3 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.Changed = fieldValue != 0 body = body[n:] case fieldNumber == 4 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.UnreadMail = intFromVarint(fieldValue) body = body[n:] case fieldNumber == 5 && typ == protowire.VarintType: fieldValue, n := protowire.ConsumeVarint(body) if n < 0 { return value } value.ServerTime = int64FromVarint(fieldValue) body = body[n:] default: n := protowire.ConsumeFieldValue(fieldNumber, typ, body) if n < 0 { return value } body = body[n:] } } return value }