From 204db087d497868db38566cf04ab44bc80471ca1 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Tue, 23 Apr 2024 16:27:38 -0400 Subject: [PATCH 01/15] Start datastore/ac-happy-home-designer --- datastore/ac-happy-home-designer/protocol.go | 68 +++++++++++ .../data_store_file_server_object_info.go | 109 ++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 datastore/ac-happy-home-designer/protocol.go create mode 100644 datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go new file mode 100644 index 00000000..550dd746 --- /dev/null +++ b/datastore/ac-happy-home-designer/protocol.go @@ -0,0 +1,68 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "github.com/PretendoNetwork/nex-go/v2" + datastore "github.com/PretendoNetwork/nex-protocols-go/v2/datastore" +) + +const ( + // ProtocolID is the Protocol ID for the DataStore (Animal Crossing: Happy Home Designer) protocol. ID is the same as the DataStore protocol + ProtocolID = 0x73 + + // MethodGetObjectInfos is the method ID for GetObjectInfos + MethodGetObjectInfos = 0x2D + + // MethodGetMetaByOwnerId is the method ID for GetMetaByOwnerId + MethodGetMetaByOwnerId = 0x2E + + // MethodGetMetaByUniqueId is the method ID for GetMetaByUniqueId + MethodGetMetaByUniqueId = 0x2F + + // MethodSearchHouseNew is the method ID for SearchHouseNew + MethodSearchHouseNew = 0x30 + + // MethodSearchHousePopular is the method ID for SearchHousePopular + MethodSearchHousePopular = 0x31 + + // MethodSearchHouseResident is the method ID for SearchHouseResident + MethodSearchHouseResident = 0x32 + + // MethodSearchHouseContent is the method ID for SearchHouseContent + MethodSearchHouseContent = 0x33 + + // MethodSearchHouseContestRandom is the method ID for SearchHouseContentRandom + MethodSearchHouseContentRandom = 0x34 + + // MethodAddToBufferQueue is the method ID for AddToBufferQueue + MethodAddToBufferQueue = 0x35 + + // MethodGetBufferQueue is the method ID for GetBufferQueue + MethodGetBufferQueue = 0x36 + + // MethodGetBufferQueues is the method ID for GetBufferQueues + MethodGetBuffersQueues = 0x37 + + // MethodClearBufferQueues is the method ID for ClearBufferQueues + MethodClearBuffersQueues = 0x38 + + // MethodGetContestEntryCount is the method ID for GetContestEntryCount + MethodGetContestEntryCount = 0x39 +) + +type dataStoreProtocol = datastore.Protocol + +// Protocol stores all the RMC method handlers for the DataStore (Animal Crossing: Happy Home Designer) protocol and listens for requests +// Embeds the DataStore protocol +type Protocol struct { + endpoint nex.EndpointInterface + dataStoreProtocol +} + +// NewProtocol returns a new DataStore (Animal Crossing: Happy Home Designer) protocol +func NewProtocol(endpoint nex.EndpointInterface) *Protocol { + protocol := &Protocol{endpoint: endpoint} + protocol.dataStoreProtocol.SetEndpoint(endpoint) + + return protocol +} diff --git a/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go b/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go new file mode 100644 index 00000000..5a6dd1e0 --- /dev/null +++ b/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go @@ -0,0 +1,109 @@ +// Package types implements all the types used by the DataStoreACHappyHomeDesigner protocol +package types + +import ( + "fmt" + "strings" + + "github.com/PretendoNetwork/nex-go/v2/types" + datastore_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/types" +) + +// DataStoreFileServerObjectInfo is a type within the DataStoreACHappyHomeDesigner protocol +type DataStoreFileServerObjectInfo struct { + types.Structure + + DataId *types.PrimitiveU64 + GetInfo *datastore_types.DataStoreReqGetInfo +} + +// WriteTo writes the DataStoreFileServerObjectInfo to the given variable +func (dsfsoi *DataStoreFileServerObjectInfo) WriteTo(writable types.Writable) { + contentWritable := writable.CopyNew() + + dsfsoi.DataId.WriteTo(contentWritable) + dsfsoi.GetInfo.WriteTo(contentWritable) + + content := contentWritable.Bytes() + + dsfsoi.WriteHeaderTo(writable, uint32(len(content))) + + writable.Write(content) +} + +// ExtractFrom extracts the DataStoreFileServerObjectInfo from the given readable +func (dsfsoi *DataStoreFileServerObjectInfo) ExtractFrom(readable types.Readable) error { + var err error + + err = dsfsoi.ExtractHeaderFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreFileServerObjectInfo header. %s", err.Error()) + } + + err = dsfsoi.DataId.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreFileServerObjectInfo.DataId. %s", err.Error()) + } + + err = dsfsoi.GetInfo.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreFileServerObjectInfo.GetInfo. %s", err.Error()) + } + + return nil +} + +// Copy returns a new copied instance of DataStoreFileServerGetObject +func (dsfsoi *DataStoreFileServerObjectInfo) Copy() types.RVType { + copied := NewDataStoreFileServerObjectInfo() + + copied.DataId = dsfsoi.DataId + copied.GetInfo = dsfsoi.GetInfo + + return copied +} + +// Equals checks if the given DataStoreFileServerObjectInfo contains the same data as the current DataStoreFileServerObjectInfo +func (dsfsoi *DataStoreFileServerObjectInfo) Equals(o types.RVType) bool { + if _, ok := o.(*DataStoreFileServerObjectInfo); !ok { + return false + } + + other := o.(*DataStoreFileServerObjectInfo) + + if !dsfsoi.DataId.Equals(other.DataId) { + return false + } + + return dsfsoi.GetInfo.Equals(other.GetInfo) +} + +// String returns the string representation of the DataStoreFileServerObjectInfo +func (dsfsoi *DataStoreFileServerObjectInfo) String() string { + return dsfsoi.FormatToString(0) +} + +// FormatToString pretty-prints the DataStoreFileServerObjectInfo using the provided indentation level +func (dsfsoi *DataStoreFileServerObjectInfo) FormatToString(indentationLevel int) string { + indentationValues := strings.Repeat("\t", indentationLevel+1) + indentationEnd := strings.Repeat("\t", indentationLevel) + + var b strings.Builder + + b.WriteString("DataStoreFileServerObjectInfo{\n") + b.WriteString(fmt.Sprintf("%sDataId: %s,\n", indentationValues, dsfsoi.DataId)) + b.WriteString(fmt.Sprintf("%sGetInfo: %s,\n", indentationValues, dsfsoi.GetInfo.FormatToString(indentationLevel+1))) + b.WriteString(fmt.Sprintf("%s}", indentationEnd)) + + return b.String() +} + +// NewDataStoreFileServerObjectInfo returns a new DataStoreFileServerObjectInfo +func NewDataStoreFileServerObjectInfo() *DataStoreFileServerObjectInfo { + dsfsoi := &DataStoreFileServerObjectInfo{ + DataId: types.NewPrimitiveU64(0), + GetInfo: datastore_types.NewDataStoreReqGetInfo(), + } + + return dsfsoi +} From d430f3ed8b4d8589c43fd853bd9fc396c8a8eddc Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Tue, 23 Apr 2024 16:38:50 -0400 Subject: [PATCH 02/15] Add DataStoreGetMetaByOwnerIdParam type --- .../data_store_get_meta_by_owner_id_param.go | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go diff --git a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go new file mode 100644 index 00000000..18d8ff8e --- /dev/null +++ b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go @@ -0,0 +1,136 @@ +// Package types implements all the types used by the DataStoreACHappyHomeDesigner protocol +package types + +import ( + "fmt" + "strings" + + "github.com/PretendoNetwork/nex-go/v2/types" +) + +// DataStoreGetMetaByOwnerIdParam is a type within the DataStoreACHappyHomeDesigner protocol +type DataStoreGetMetaByOwnerIdParam struct { + types.Structure + + OwnerIds *types.List[*types.PrimitiveU32] + DataTypes *types.List[*types.PrimitiveU16] + ResultOption *types.PrimitiveU8 + ResultRange *types.ResultRange +} + +// WriteTo writes the DataStoreGetMetaByOwnerIdParam to the given variable +func (dsgmboip *DataStoreGetMetaByOwnerIdParam) WriteTo(writable types.Writable) { + contentWritable := writable.CopyNew() + + dsgmboip.OwnerIds.WriteTo(contentWritable) + dsgmboip.DataTypes.WriteTo(contentWritable) + dsgmboip.ResultOption.WriteTo(contentWritable) + dsgmboip.ResultRange.WriteTo(contentWritable) + + content := contentWritable.Bytes() + + dsgmboip.WriteHeaderTo(writable, uint32(len(content))) + + writable.Write(content) +} + +// ExtractFrom extracts the DataStoreGetMetaByOwnerIdParam from the given readable +func (dsgmboip *DataStoreGetMetaByOwnerIdParam) ExtractFrom(readable types.Readable) error { + var err error + + err = dsgmboip.ExtractHeaderFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam header. %s", err.Error()) + } + + err = dsgmboip.OwnerIds.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.OwnerIds. %s", err.Error()) + } + + err = dsgmboip.DataTypes.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.DataTypes. %s", err.Error()) + } + + err = dsgmboip.ResultOption.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.ResultOption. %s", err.Error()) + } + + err = dsgmboip.ResultRange.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.ResultRange. %s", err.Error()) + } + + return nil +} + +// Copy returns a new copied instance of DataStoreFileServerGetObject +func (dsgmboip *DataStoreGetMetaByOwnerIdParam) Copy() types.RVType { + copied := NewDataStoreGetMetaByOwnerIdParam() + + copied.OwnerIds = dsgmboip.OwnerIds + copied.DataTypes = dsgmboip.DataTypes + copied.ResultOption = dsgmboip.ResultOption + copied.ResultRange = dsgmboip.ResultRange + + return copied +} + +// Equals checks if the given DataStoreGetMetaByOwnerIdParam contains the same data as the current DataStoreGetMetaByOwnerIdParam +func (dsgmboip *DataStoreGetMetaByOwnerIdParam) Equals(o types.RVType) bool { + if _, ok := o.(*DataStoreGetMetaByOwnerIdParam); !ok { + return false + } + + other := o.(*DataStoreGetMetaByOwnerIdParam) + + if !dsgmboip.OwnerIds.Equals(other.OwnerIds) { + return false + } + + if !dsgmboip.DataTypes.Equals(other.DataTypes) { + return false + } + + if !dsgmboip.ResultOption.Equals(other.ResultOption) { + return false + } + + return dsgmboip.ResultRange.Equals(other.ResultRange) +} + +// String returns the string representation of the DataStoreGetMetaByOwnerIdParam +func (dsgmboip *DataStoreGetMetaByOwnerIdParam) String() string { + return dsgmboip.FormatToString(0) +} + +// FormatToString pretty-prints the DataStoreGetMetaByOwnerIdParam using the provided indentation level +func (dsgmboip *DataStoreGetMetaByOwnerIdParam) FormatToString(indentationLevel int) string { + indentationValues := strings.Repeat("\t", indentationLevel+1) + indentationEnd := strings.Repeat("\t", indentationLevel) + + var b strings.Builder + + b.WriteString("DataStoreGetMetaByOwnerIdParam{\n") + b.WriteString(fmt.Sprintf("%sOwnerIds: %s,\n", indentationValues, dsgmboip.OwnerIds)) + b.WriteString(fmt.Sprintf("%sDataTypes: %s,\n", indentationValues, dsgmboip.DataTypes)) + b.WriteString(fmt.Sprintf("%sResultOption: %s,\n", indentationValues, dsgmboip.ResultOption)) + b.WriteString(fmt.Sprintf("%sResultRange: %s,\n", indentationValues, dsgmboip.ResultRange)) + b.WriteString(fmt.Sprintf("%s}", indentationEnd)) + + return b.String() +} + +// NewDataStoreGetMetaByOwnerIdParam returns a new DataStoreGetMetaByOwnerIdParam +func NewDataStoreGetMetaByOwnerIdParam() *DataStoreGetMetaByOwnerIdParam { + dsgmboip := &DataStoreGetMetaByOwnerIdParam{ + OwnerIds: types.NewList[*types.PrimitiveU32](), + DataTypes: types.NewList[*types.PrimitiveU16](), + ResultOption: types.NewPrimitiveU8(0), + ResultRange: types.NewResultRange(), + } + + return dsgmboip +} From 3e92c192227140646f6b11cc7432d0ed8edc8a05 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 24 Apr 2024 07:49:52 -0400 Subject: [PATCH 03/15] add type DataStoreGetMetaByUniqueIdParam --- .../data_store_get_meta_by_unique_id_param.go | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go diff --git a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go new file mode 100644 index 00000000..2290f004 --- /dev/null +++ b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go @@ -0,0 +1,136 @@ +// Package types implements all the types used by the DataStoreACHappyHomeDesigner protocol +package types + +import ( + "fmt" + "strings" + + "github.com/PretendoNetwork/nex-go/v2/types" +) + +// DataStoreGetMetaByUniqueIdParam is a type within the DataStoreACHappyHomeDesigner protocol +type DataStoreGetMetaByUniqueIdParam struct { + types.Structure + + UniqueIds *types.List[*types.PrimitiveU32] + DataTypes *types.List[*types.PrimitiveU16] + ResultOption *types.PrimitiveU8 + ResultRange *types.ResultRange +} + +// WriteTo writes the DataStoreGetMetaByUniqueIdParam to the given variable +func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) WriteTo(writable types.Writable) { + contentWritable := writable.CopyNew() + + dsgmbuip.UniqueIds.WriteTo(contentWritable) + dsgmbuip.DataTypes.WriteTo(contentWritable) + dsgmbuip.ResultOption.WriteTo(contentWritable) + dsgmbuip.ResultRange.WriteTo(contentWritable) + + content := contentWritable.Bytes() + + dsgmbuip.WriteHeaderTo(writable, uint32(len(content))) + + writable.Write(content) +} + +// ExtractFrom extracts the DataStoreGetMetaByUniqueIdParam from the given readable +func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) ExtractFrom(readable types.Readable) error { + var err error + + err = dsgmbuip.ExtractHeaderFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam header. %s", err.Error()) + } + + err = dsgmbuip.UniqueIds.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.UniqueIds. %s", err.Error()) + } + + err = dsgmbuip.DataTypes.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.DataTypes. %s", err.Error()) + } + + err = dsgmbuip.ResultOption.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.ResultOption. %s", err.Error()) + } + + err = dsgmbuip.ResultRange.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.ResultRange. %s", err.Error()) + } + + return nil +} + +// Copy returns a new copied instance of DataStoreFileServerGetObject +func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) Copy() types.RVType { + copied := NewDataStoreGetMetaByUniqueIdParam() + + copied.UniqueIds = dsgmbuip.UniqueIds + copied.DataTypes = dsgmbuip.DataTypes + copied.ResultOption = dsgmbuip.ResultOption + copied.ResultRange = dsgmbuip.ResultRange + + return copied +} + +// Equals checks if the given DataStoreGetMetaByUniqueIdParam contains the same data as the current DataStoreGetMetaByUniqueIdParam +func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) Equals(o types.RVType) bool { + if _, ok := o.(*DataStoreGetMetaByUniqueIdParam); !ok { + return false + } + + other := o.(*DataStoreGetMetaByUniqueIdParam) + + if !dsgmbuip.UniqueIds.Equals(other.UniqueIds) { + return false + } + + if !dsgmbuip.DataTypes.Equals(other.DataTypes) { + return false + } + + if !dsgmbuip.ResultOption.Equals(other.ResultOption) { + return false + } + + return dsgmbuip.ResultRange.Equals(other.ResultRange) +} + +// String returns the string representation of the DataStoreGetMetaByUniqueIdParam +func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) String() string { + return dsgmbuip.FormatToString(0) +} + +// FormatToString pretty-prints the DataStoreGetMetaByUniqueIdParam using the provided indentation level +func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) FormatToString(indentationLevel int) string { + indentationValues := strings.Repeat("\t", indentationLevel+1) + indentationEnd := strings.Repeat("\t", indentationLevel) + + var b strings.Builder + + b.WriteString("DataStoreGetMetaByUniqueIdParam{\n") + b.WriteString(fmt.Sprintf("%sUniqueIds: %s,\n", indentationValues, dsgmbuip.UniqueIds)) + b.WriteString(fmt.Sprintf("%sDataTypes: %s,\n", indentationValues, dsgmbuip.DataTypes)) + b.WriteString(fmt.Sprintf("%sResultOption: %s,\n", indentationValues, dsgmbuip.ResultOption)) + b.WriteString(fmt.Sprintf("%sResultRange: %s,\n", indentationValues, dsgmbuip.ResultRange)) + b.WriteString(fmt.Sprintf("%s}", indentationEnd)) + + return b.String() +} + +// NewDataStoreGetMetaByUniqueIdParam returns a new DataStoreGetMetaByUniqueIdParam +func NewDataStoreGetMetaByUniqueIdParam() *DataStoreGetMetaByUniqueIdParam { + dsgmbuip := &DataStoreGetMetaByUniqueIdParam{ + UniqueIds: types.NewList[*types.PrimitiveU32](), + DataTypes: types.NewList[*types.PrimitiveU16](), + ResultOption: types.NewPrimitiveU8(0), + ResultRange: types.NewResultRange(), + } + + return dsgmbuip +} From 5d18cd580ef6bdf08ec1aa2b0ac11184995d1e7f Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 24 Apr 2024 07:52:51 -0400 Subject: [PATCH 04/15] BufferQueueParam --- .../types/buffer_queue_param.go | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 datastore/ac-happy-home-designer/types/buffer_queue_param.go diff --git a/datastore/ac-happy-home-designer/types/buffer_queue_param.go b/datastore/ac-happy-home-designer/types/buffer_queue_param.go new file mode 100644 index 00000000..aa10ee3d --- /dev/null +++ b/datastore/ac-happy-home-designer/types/buffer_queue_param.go @@ -0,0 +1,108 @@ +// Package types implements all the types used by the DataStoreACHappyHomeDesigner protocol +package types + +import ( + "fmt" + "strings" + + "github.com/PretendoNetwork/nex-go/v2/types" +) + +// BufferQueueParam is a type within the DataStoreACHappyHomeDesigner protocol +type BufferQueueParam struct { + types.Structure + + DataId *types.PrimitiveU64 + Slot *types.PrimitiveU32 +} + +// WriteTo writes the BufferQueueParam to the given variable +func (bqp *BufferQueueParam) WriteTo(writable types.Writable) { + contentWritable := writable.CopyNew() + + bqp.DataId.WriteTo(contentWritable) + bqp.Slot.WriteTo(contentWritable) + + content := contentWritable.Bytes() + + bqp.WriteHeaderTo(writable, uint32(len(content))) + + writable.Write(content) +} + +// ExtractFrom extracts the BufferQueueParam from the given readable +func (bqp *BufferQueueParam) ExtractFrom(readable types.Readable) error { + var err error + + err = bqp.ExtractHeaderFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract BufferQueueParam header. %s", err.Error()) + } + + err = bqp.DataId.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract BufferQueueParam.DataId. %s", err.Error()) + } + + err = bqp.Slot.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract BufferQueueParam.Slot. %s", err.Error()) + } + + return nil +} + +// Copy returns a new copied instance of DataStoreFileServerGetObject +func (bqp *BufferQueueParam) Copy() types.RVType { + copied := NewBufferQueueParam() + + copied.DataId = bqp.DataId + copied.Slot = bqp.Slot + + return copied +} + +// Equals checks if the given BufferQueueParam contains the same data as the current BufferQueueParam +func (bqp *BufferQueueParam) Equals(o types.RVType) bool { + if _, ok := o.(*BufferQueueParam); !ok { + return false + } + + other := o.(*BufferQueueParam) + + if !bqp.DataId.Equals(other.DataId) { + return false + } + + return bqp.Slot.Equals(other.Slot) +} + +// String returns the string representation of the BufferQueueParam +func (bqp *BufferQueueParam) String() string { + return bqp.FormatToString(0) +} + +// FormatToString pretty-prints the BufferQueueParam using the provided indentation level +func (bqp *BufferQueueParam) FormatToString(indentationLevel int) string { + indentationValues := strings.Repeat("\t", indentationLevel+1) + indentationEnd := strings.Repeat("\t", indentationLevel) + + var b strings.Builder + + b.WriteString("BufferQueueParam{\n") + b.WriteString(fmt.Sprintf("%sDataId: %s,\n", indentationValues, bqp.DataId)) + b.WriteString(fmt.Sprintf("%sSlot: %s,\n", indentationValues, bqp.Slot)) + b.WriteString(fmt.Sprintf("%s}", indentationEnd)) + + return b.String() +} + +// NewBufferQueueParam returns a new BufferQueueParam +func NewBufferQueueParam() *BufferQueueParam { + bqp := &BufferQueueParam{ + DataId: types.NewPrimitiveU64(0), + Slot: types.NewPrimitiveU32(0), + } + + return bqp +} From ca39caef0347c454924820dc99aacba106eebc19 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 24 Apr 2024 09:08:32 -0400 Subject: [PATCH 05/15] DataStoreSearchHouseParam type --- .../types/data_store_search_house_param.go | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 datastore/ac-happy-home-designer/types/data_store_search_house_param.go diff --git a/datastore/ac-happy-home-designer/types/data_store_search_house_param.go b/datastore/ac-happy-home-designer/types/data_store_search_house_param.go new file mode 100644 index 00000000..0ff02ed7 --- /dev/null +++ b/datastore/ac-happy-home-designer/types/data_store_search_house_param.go @@ -0,0 +1,165 @@ +// Package types implements all the types used by the DataStoreACHappyHomeDesigner protocol +package types + +import ( + "fmt" + "strings" + + "github.com/PretendoNetwork/nex-go/v2/types" +) + +// DataStoreSearchHouseParam is a type within the DataStoreACHappyHomeDesigner protocol +type DataStoreSearchHouseParam struct { + types.Structure + + DataType *types.PrimitiveU16 + ResultOrderColumns *types.Buffer + ResultRange *types.ResultRange + ResultOption *types.PrimitiveU8 + Region *types.PrimitiveU8 + Country *types.PrimitiveU8 +} + +// WriteTo writes the DataStoreSearchHouseParam to the given variable +func (dsshp *DataStoreSearchHouseParam) WriteTo(writable types.Writable) { + contentWritable := writable.CopyNew() + + dsshp.DataType.WriteTo(contentWritable) + dsshp.ResultOrderColumns.WriteTo(contentWritable) + dsshp.ResultRange.WriteTo(contentWritable) + dsshp.ResultOption.WriteTo(contentWritable) + dsshp.Region.WriteTo(contentWritable) + dsshp.Country.WriteTo(contentWritable) + + content := contentWritable.Bytes() + + dsshp.WriteHeaderTo(writable, uint32(len(content))) + + writable.Write(content) +} + +// ExtractFrom extracts the DataStoreSearchHouseParam from the given readable +func (dsshp *DataStoreSearchHouseParam) ExtractFrom(readable types.Readable) error { + var err error + + err = dsshp.ExtractHeaderFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam header. %s", err.Error()) + } + + err = dsshp.DataType.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam.DataType. %s", err.Error()) + } + + err = dsshp.ResultOrderColumns.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam.ResultOrderColumns. %s", err.Error()) + } + + err = dsshp.ResultRange.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam.ResultRange. %s", err.Error()) + } + + err = dsshp.ResultOption.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam.ResultOption. %s", err.Error()) + } + + err = dsshp.Region.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam.Region. %s", err.Error()) + } + + err = dsshp.Country.ExtractFrom(readable) + if err != nil { + return fmt.Errorf("Failed to extract DataStoreSearchHouseParam.Country. %s", err.Error()) + } + + return nil +} + +// Copy returns a new copied instance of DataStoreSearchHouseParam +func (dsshp *DataStoreSearchHouseParam) Copy() types.RVType { + copied := NewDataStoreSearchHouseParam() + + copied.DataType = dsshp.DataType + copied.ResultOrderColumns = dsshp.ResultOrderColumns + copied.ResultRange = dsshp.ResultRange + copied.ResultOption = dsshp.ResultOption + copied.Region = dsshp.Region + copied.Country = dsshp.Country + + return copied +} + +// Equals checks if the given DataStoreSearchHouseParam contains the same data as the current DataStoreSearchHouseParam +func (dsshp *DataStoreSearchHouseParam) Equals(o types.RVType) bool { + if _, ok := o.(*DataStoreSearchHouseParam); !ok { + return false + } + + other := o.(*DataStoreSearchHouseParam) + + if !dsshp.DataType.Equals(other.DataType) { + return false + } + + if !dsshp.ResultOrderColumns.Equals(other.ResultOrderColumns) { + return false + } + + if !dsshp.ResultRange.Equals(other.ResultRange) { + return false + } + + if !dsshp.ResultOption.Equals(other.ResultOption) { + return false + } + + if !dsshp.Region.Equals(other.Region) { + return false + } + + return dsshp.Country.Equals(other.Country) +} + +// String returns the string representation of the DataStoreSearchHouseParam +func (dsshp *DataStoreSearchHouseParam) String() string { + return dsshp.FormatToString(0) +} + +// FormatToString pretty-prints the DataStoreSearchHouseParam using the provided indentation level + +func (dsshp *DataStoreSearchHouseParam) FormatToString(indentationLevel int) string { + indentationValues := strings.Repeat("\t", indentationLevel+1) + indentationEnd := strings.Repeat("\t", indentationLevel) + + var b strings.Builder + + b.WriteString("DataStoreSearchHouseParam{\n") + b.WriteString(fmt.Sprintf("%sDataType: %s,\n", indentationValues, dsshp.DataType)) + b.WriteString(fmt.Sprintf("%sResultOrderColumns: %s,\n", indentationValues, dsshp.ResultOrderColumns)) + b.WriteString(fmt.Sprintf("%sResultRange: %s,\n", indentationValues, dsshp.ResultRange)) + b.WriteString(fmt.Sprintf("%sResultOption: %s,\n", indentationValues, dsshp.ResultOption)) + b.WriteString(fmt.Sprintf("%sRegion: %s,\n", indentationValues, dsshp.Region)) + b.WriteString(fmt.Sprintf("%sCountry: %s,\n", indentationValues, dsshp.Country)) + b.WriteString(fmt.Sprintf("%s}", indentationEnd)) + + return b.String() +} + +// NewDataStoreSearchHouseParam returns a new DataStoreSearchHouseParam +func NewDataStoreSearchHouseParam() *DataStoreSearchHouseParam { + dsshp := &DataStoreSearchHouseParam{ + DataType: types.NewPrimitiveU16(0), + ResultOrderColumns: types.NewBuffer(nil), + ResultRange: types.NewResultRange(), + ResultOption: types.NewPrimitiveU8(0), + Region: types.NewPrimitiveU8(0), + Country: types.NewPrimitiveU8(0), + } + + return dsshp +} From a00a82105a9e4652ed0134a7122c3ef095d51468 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Sun, 2 Jun 2024 21:42:25 -0400 Subject: [PATCH 06/15] add handler for GetObjectInfos --- .../get_object_infos.go | 48 +++++++++++++++++++ datastore/ac-happy-home-designer/protocol.go | 35 ++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 datastore/ac-happy-home-designer/get_object_infos.go diff --git a/datastore/ac-happy-home-designer/get_object_infos.go b/datastore/ac-happy-home-designer/get_object_infos.go new file mode 100644 index 00000000..28677338 --- /dev/null +++ b/datastore/ac-happy-home-designer/get_object_infos.go @@ -0,0 +1,48 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + "github.com/PretendoNetwork/nex-go/v2/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleGetObjectInfos(packet nex.PacketInterface) { + if protocol.GetObjectInfos == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetObjectInfos not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + dataIDs := types.NewList[*types.PrimitiveU64]() + dataIDs.Type = types.NewPrimitiveU64(0) + + err := dataIDs.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.GetObjectInfos(fmt.Errorf("Failed to read dataIDs from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.GetObjectInfos(nil, packet, callID, dataIDs) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 550dd746..81c64ec1 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -2,8 +2,13 @@ package protocol import ( + "fmt" + "slices" + "github.com/PretendoNetwork/nex-go/v2" + "github.com/PretendoNetwork/nex-go/v2/types" datastore "github.com/PretendoNetwork/nex-protocols-go/v2/datastore" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" ) const ( @@ -50,6 +55,10 @@ const ( MethodGetContestEntryCount = 0x39 ) +var patchedMethods = []uint32{ + MethodGetObjectInfos, +} + type dataStoreProtocol = datastore.Protocol // Protocol stores all the RMC method handlers for the DataStore (Animal Crossing: Happy Home Designer) protocol and listens for requests @@ -57,6 +66,32 @@ type dataStoreProtocol = datastore.Protocol type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol + GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) +} + +// HandlePacket sends the packet to the correct RMC method handler +func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { + message := packet.RMCMessage() + + if !message.IsRequest || message.ProtocolID != ProtocolID { + return + } + + if !slices.Contains(patchedMethods, message.MethodID) { + protocol.dataStoreProtocol.HandlePacket(packet) + return + } + + switch message.MethodID { + case MethodGetObjectInfos: + protocol.handleGetObjectInfos(packet) + default: + errMessage := fmt.Sprintf("Unsupported DataStoreHappyHomeDesigner method ID: %#v\n", message.MethodID) + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, errMessage) + + globals.RespondError(packet, ProtocolID, err) + globals.Logger.Warning(err.Message) + } } // NewProtocol returns a new DataStore (Animal Crossing: Happy Home Designer) protocol From 7d0b810c7c80dafbdc191fe68bc5b5a2ff084260 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 5 Jun 2024 11:38:07 -0400 Subject: [PATCH 07/15] add handler for GetMetaByOwnerId --- .../get_meta_by_owner_id.go | 47 +++++++++++++++++++ datastore/ac-happy-home-designer/protocol.go | 7 ++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 datastore/ac-happy-home-designer/get_meta_by_owner_id.go diff --git a/datastore/ac-happy-home-designer/get_meta_by_owner_id.go b/datastore/ac-happy-home-designer/get_meta_by_owner_id.go new file mode 100644 index 00000000..217b7190 --- /dev/null +++ b/datastore/ac-happy-home-designer/get_meta_by_owner_id.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleGetMetaByOwnerId(packet nex.PacketInterface) { + if protocol.GetMetaByOwnerId == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetMetaByOwnerId not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreGetMetaByOwnerIdParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.GetMetaByOwnerId(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.GetMetaByOwnerId(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 81c64ec1..0242095e 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -8,6 +8,7 @@ import ( "github.com/PretendoNetwork/nex-go/v2" "github.com/PretendoNetwork/nex-go/v2/types" datastore "github.com/PretendoNetwork/nex-protocols-go/v2/datastore" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" "github.com/PretendoNetwork/nex-protocols-go/v2/globals" ) @@ -57,6 +58,7 @@ const ( var patchedMethods = []uint32{ MethodGetObjectInfos, + MethodGetMetaByOwnerId, } type dataStoreProtocol = datastore.Protocol @@ -66,7 +68,8 @@ type dataStoreProtocol = datastore.Protocol type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol - GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) + GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) + GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) } // HandlePacket sends the packet to the correct RMC method handler @@ -85,6 +88,8 @@ func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { switch message.MethodID { case MethodGetObjectInfos: protocol.handleGetObjectInfos(packet) + case MethodGetMetaByOwnerId: + protocol.handleGetMetaByOwnerId(packet) default: errMessage := fmt.Sprintf("Unsupported DataStoreHappyHomeDesigner method ID: %#v\n", message.MethodID) err := nex.NewError(nex.ResultCodes.Core.NotImplemented, errMessage) From 5c5a8956301c5b1ddda5427c557636e4dc2d831e Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 5 Jun 2024 11:39:57 -0400 Subject: [PATCH 08/15] fix --- datastore/ac-happy-home-designer/protocol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 0242095e..721db264 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -69,7 +69,7 @@ type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) - GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) + GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) } // HandlePacket sends the packet to the correct RMC method handler From c6c58886cb17cd1dac2b43224718722499cb7edf Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 5 Jun 2024 20:54:31 -0400 Subject: [PATCH 09/15] add handler for GetMetaByUniqueId --- .../get_meta_by_unique_id.go | 47 +++++++++++++++++++ datastore/ac-happy-home-designer/protocol.go | 8 +++- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 datastore/ac-happy-home-designer/get_meta_by_unique_id.go diff --git a/datastore/ac-happy-home-designer/get_meta_by_unique_id.go b/datastore/ac-happy-home-designer/get_meta_by_unique_id.go new file mode 100644 index 00000000..11b99c4e --- /dev/null +++ b/datastore/ac-happy-home-designer/get_meta_by_unique_id.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleGetMetaByUniqueId(packet nex.PacketInterface) { + if protocol.GetMetaByUniqueId == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetMetaByUniqueId not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreGetMetaByUniqueIdParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.GetMetaByUniqueId(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.GetMetaByUniqueId(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 721db264..493cbff5 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -59,6 +59,7 @@ const ( var patchedMethods = []uint32{ MethodGetObjectInfos, MethodGetMetaByOwnerId, + MethodGetMetaByUniqueId, } type dataStoreProtocol = datastore.Protocol @@ -68,8 +69,9 @@ type dataStoreProtocol = datastore.Protocol type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol - GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) - GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) + GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) + GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) + GetMetaByUniqueId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIdParam) (*nex.RMCMessage, *nex.Error) } // HandlePacket sends the packet to the correct RMC method handler @@ -90,6 +92,8 @@ func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { protocol.handleGetObjectInfos(packet) case MethodGetMetaByOwnerId: protocol.handleGetMetaByOwnerId(packet) + case MethodGetMetaByUniqueId: + protocol.handleGetMetaByUniqueId(packet) default: errMessage := fmt.Sprintf("Unsupported DataStoreHappyHomeDesigner method ID: %#v\n", message.MethodID) err := nex.NewError(nex.ResultCodes.Core.NotImplemented, errMessage) From 1467843c43eb3272b60d2d1ee8abf1256e788c11 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 5 Jun 2024 21:03:46 -0400 Subject: [PATCH 10/15] add SearchHouse-* method handlers --- datastore/ac-happy-home-designer/protocol.go | 34 +++++++++++--- .../search_house_contest.go | 47 +++++++++++++++++++ .../search_house_contest_random.go | 47 +++++++++++++++++++ .../search_house_new.go | 47 +++++++++++++++++++ .../search_house_popular.go | 47 +++++++++++++++++++ .../search_house_resident.go | 47 +++++++++++++++++++ 6 files changed, 262 insertions(+), 7 deletions(-) create mode 100644 datastore/ac-happy-home-designer/search_house_contest.go create mode 100644 datastore/ac-happy-home-designer/search_house_contest_random.go create mode 100644 datastore/ac-happy-home-designer/search_house_new.go create mode 100644 datastore/ac-happy-home-designer/search_house_popular.go create mode 100644 datastore/ac-happy-home-designer/search_house_resident.go diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 493cbff5..c92458d0 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -34,11 +34,11 @@ const ( // MethodSearchHouseResident is the method ID for SearchHouseResident MethodSearchHouseResident = 0x32 - // MethodSearchHouseContent is the method ID for SearchHouseContent - MethodSearchHouseContent = 0x33 + // MethodSearchHouseContest is the method ID for SearchHouseContest + MethodSearchHouseContest = 0x33 - // MethodSearchHouseContestRandom is the method ID for SearchHouseContentRandom - MethodSearchHouseContentRandom = 0x34 + // MethodSearchHouseContestRandom is the method ID for SearchHouseContestRandom + MethodSearchHouseContestRandom = 0x34 // MethodAddToBufferQueue is the method ID for AddToBufferQueue MethodAddToBufferQueue = 0x35 @@ -60,6 +60,11 @@ var patchedMethods = []uint32{ MethodGetObjectInfos, MethodGetMetaByOwnerId, MethodGetMetaByUniqueId, + MethodSearchHouseNew, + MethodSearchHousePopular, + MethodSearchHouseResident, + MethodSearchHouseContest, + MethodSearchHouseContestRandom, } type dataStoreProtocol = datastore.Protocol @@ -69,9 +74,14 @@ type dataStoreProtocol = datastore.Protocol type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol - GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) - GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) - GetMetaByUniqueId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIdParam) (*nex.RMCMessage, *nex.Error) + GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) + GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) + GetMetaByUniqueId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIdParam) (*nex.RMCMessage, *nex.Error) + SearchHouseNew func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHousePopular func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHouseResident func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHouseContest func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHouseContestRandom func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) } // HandlePacket sends the packet to the correct RMC method handler @@ -94,6 +104,16 @@ func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { protocol.handleGetMetaByOwnerId(packet) case MethodGetMetaByUniqueId: protocol.handleGetMetaByUniqueId(packet) + case MethodSearchHouseNew: + protocol.handleSearchHouseNew(packet) + case MethodSearchHousePopular: + protocol.handleSearchHousePopular(packet) + case MethodSearchHouseResident: + protocol.handleSearchHouseResident(packet) + case MethodSearchHouseContest: + protocol.handleSearchHouseContest(packet) + case MethodSearchHouseContestRandom: + protocol.handleSearchHouseContestRandom(packet) default: errMessage := fmt.Sprintf("Unsupported DataStoreHappyHomeDesigner method ID: %#v\n", message.MethodID) err := nex.NewError(nex.ResultCodes.Core.NotImplemented, errMessage) diff --git a/datastore/ac-happy-home-designer/search_house_contest.go b/datastore/ac-happy-home-designer/search_house_contest.go new file mode 100644 index 00000000..845d80d7 --- /dev/null +++ b/datastore/ac-happy-home-designer/search_house_contest.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleSearchHouseContest(packet nex.PacketInterface) { + if protocol.SearchHouseContest == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::SearchHouseContest not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreSearchHouseParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.SearchHouseContest(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.SearchHouseContest(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/search_house_contest_random.go b/datastore/ac-happy-home-designer/search_house_contest_random.go new file mode 100644 index 00000000..a42034f3 --- /dev/null +++ b/datastore/ac-happy-home-designer/search_house_contest_random.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleSearchHouseContestRandom(packet nex.PacketInterface) { + if protocol.SearchHouseContestRandom == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::SearchHouseContestRandom not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreSearchHouseParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.SearchHouseContestRandom(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.SearchHouseContestRandom(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/search_house_new.go b/datastore/ac-happy-home-designer/search_house_new.go new file mode 100644 index 00000000..5b206d61 --- /dev/null +++ b/datastore/ac-happy-home-designer/search_house_new.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleSearchHouseNew(packet nex.PacketInterface) { + if protocol.SearchHouseNew == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::SearchHouseNew not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreSearchHouseParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.SearchHouseNew(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.SearchHouseNew(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/search_house_popular.go b/datastore/ac-happy-home-designer/search_house_popular.go new file mode 100644 index 00000000..7c07c41a --- /dev/null +++ b/datastore/ac-happy-home-designer/search_house_popular.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleSearchHousePopular(packet nex.PacketInterface) { + if protocol.SearchHousePopular == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::SearchHousePopular not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreSearchHouseParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.SearchHousePopular(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.SearchHousePopular(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/search_house_resident.go b/datastore/ac-happy-home-designer/search_house_resident.go new file mode 100644 index 00000000..87ff2bf0 --- /dev/null +++ b/datastore/ac-happy-home-designer/search_house_resident.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleSearchHouseResident(packet nex.PacketInterface) { + if protocol.SearchHouseResident == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::SearchHouseResident not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewDataStoreSearchHouseParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.SearchHouseResident(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.SearchHouseResident(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} From a1527ef1e252be1b42d8e8f69d4ccc0427a4fdde Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 5 Jun 2024 21:14:02 -0400 Subject: [PATCH 11/15] handle buffer queue methods --- .../add_to_buffer_queue.go | 61 +++++++++++++++++++ .../clear_buffer_queues.go | 49 +++++++++++++++ .../get_buffer_queue.go | 47 ++++++++++++++ .../get_buffer_queues.go | 49 +++++++++++++++ datastore/ac-happy-home-designer/protocol.go | 20 +++++- 5 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 datastore/ac-happy-home-designer/add_to_buffer_queue.go create mode 100644 datastore/ac-happy-home-designer/clear_buffer_queues.go create mode 100644 datastore/ac-happy-home-designer/get_buffer_queue.go create mode 100644 datastore/ac-happy-home-designer/get_buffer_queues.go diff --git a/datastore/ac-happy-home-designer/add_to_buffer_queue.go b/datastore/ac-happy-home-designer/add_to_buffer_queue.go new file mode 100644 index 00000000..0b6feda5 --- /dev/null +++ b/datastore/ac-happy-home-designer/add_to_buffer_queue.go @@ -0,0 +1,61 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + "github.com/PretendoNetwork/nex-go/v2/types" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleAddToBufferQueue(packet nex.PacketInterface) { + if protocol.AddToBufferQueue == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::AddToBufferQueue not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewBufferQueueParam() + buffer := types.NewQBuffer(nil) + + var err error + + err = param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.AddToBufferQueue(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + err = buffer.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.AddToBufferQueue(fmt.Errorf("Failed to read buffer from parameters. %s", err.Error()), packet, callID, nil, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.AddToBufferQueue(nil, packet, callID, param, buffer) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/clear_buffer_queues.go b/datastore/ac-happy-home-designer/clear_buffer_queues.go new file mode 100644 index 00000000..ed6df43d --- /dev/null +++ b/datastore/ac-happy-home-designer/clear_buffer_queues.go @@ -0,0 +1,49 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + "github.com/PretendoNetwork/nex-go/v2/types" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleClearBufferQueues(packet nex.PacketInterface) { + if protocol.AddToBufferQueue == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::ClearBufferQueues not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + params := types.NewList[*datastore_ac_happy_home_designer_types.BufferQueueParam]() + params.Type = datastore_ac_happy_home_designer_types.NewBufferQueueParam() + + err := params.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.ClearBufferQueues(fmt.Errorf("Failed to read params from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.ClearBufferQueues(nil, packet, callID, params) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/get_buffer_queue.go b/datastore/ac-happy-home-designer/get_buffer_queue.go new file mode 100644 index 00000000..c05162a2 --- /dev/null +++ b/datastore/ac-happy-home-designer/get_buffer_queue.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleGetBufferQueue(packet nex.PacketInterface) { + if protocol.AddToBufferQueue == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetBufferQueue not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := datastore_ac_happy_home_designer_types.NewBufferQueueParam() + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.GetBufferQueue(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.GetBufferQueue(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/get_buffer_queues.go b/datastore/ac-happy-home-designer/get_buffer_queues.go new file mode 100644 index 00000000..4d1b70ac --- /dev/null +++ b/datastore/ac-happy-home-designer/get_buffer_queues.go @@ -0,0 +1,49 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + "github.com/PretendoNetwork/nex-go/v2/types" + datastore_ac_happy_home_designer_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/ac-happy-home-designer/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleGetBufferQueues(packet nex.PacketInterface) { + if protocol.AddToBufferQueue == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetBufferQueues not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + params := types.NewList[*datastore_ac_happy_home_designer_types.BufferQueueParam]() + params.Type = datastore_ac_happy_home_designer_types.NewBufferQueueParam() + + err := params.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.GetBufferQueues(fmt.Errorf("Failed to read params from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.GetBufferQueues(nil, packet, callID, params) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index c92458d0..d17621d4 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -47,10 +47,10 @@ const ( MethodGetBufferQueue = 0x36 // MethodGetBufferQueues is the method ID for GetBufferQueues - MethodGetBuffersQueues = 0x37 + MethodGetBufferQueues = 0x37 // MethodClearBufferQueues is the method ID for ClearBufferQueues - MethodClearBuffersQueues = 0x38 + MethodClearBufferQueues = 0x38 // MethodGetContestEntryCount is the method ID for GetContestEntryCount MethodGetContestEntryCount = 0x39 @@ -65,6 +65,10 @@ var patchedMethods = []uint32{ MethodSearchHouseResident, MethodSearchHouseContest, MethodSearchHouseContestRandom, + MethodAddToBufferQueue, + MethodGetBufferQueue, + MethodGetBufferQueues, + MethodClearBufferQueues, } type dataStoreProtocol = datastore.Protocol @@ -82,6 +86,10 @@ type Protocol struct { SearchHouseResident func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) SearchHouseContest func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) SearchHouseContestRandom func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + AddToBufferQueue func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.BufferQueueParam, buffer *types.QBuffer) (*nex.RMCMessage, *nex.Error) + GetBufferQueue func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.BufferQueueParam) (*nex.RMCMessage, *nex.Error) + GetBufferQueues func(err error, packet nex.PacketInterface, callID uint32, params *types.List[*datastore_ac_happy_home_designer_types.BufferQueueParam]) (*nex.RMCMessage, *nex.Error) + ClearBufferQueues func(err error, packet nex.PacketInterface, callID uint32, params *types.List[*datastore_ac_happy_home_designer_types.BufferQueueParam]) (*nex.RMCMessage, *nex.Error) } // HandlePacket sends the packet to the correct RMC method handler @@ -114,6 +122,14 @@ func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { protocol.handleSearchHouseContest(packet) case MethodSearchHouseContestRandom: protocol.handleSearchHouseContestRandom(packet) + case MethodAddToBufferQueue: + protocol.handleAddToBufferQueue(packet) + case MethodGetBufferQueue: + protocol.handleGetBufferQueue(packet) + case MethodGetBufferQueues: + protocol.handleGetBufferQueues(packet) + case MethodClearBufferQueues: + protocol.handleClearBufferQueues(packet) default: errMessage := fmt.Sprintf("Unsupported DataStoreHappyHomeDesigner method ID: %#v\n", message.MethodID) err := nex.NewError(nex.ResultCodes.Core.NotImplemented, errMessage) From 4e2957ca896f237ffdbb96606d25fb5978c7346a Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Wed, 5 Jun 2024 21:16:30 -0400 Subject: [PATCH 12/15] add handler for GetContestEntryCount --- .../get_contest_entry_count.go | 47 +++++++++++++++++++ datastore/ac-happy-home-designer/protocol.go | 4 ++ 2 files changed, 51 insertions(+) create mode 100644 datastore/ac-happy-home-designer/get_contest_entry_count.go diff --git a/datastore/ac-happy-home-designer/get_contest_entry_count.go b/datastore/ac-happy-home-designer/get_contest_entry_count.go new file mode 100644 index 00000000..66f17fd3 --- /dev/null +++ b/datastore/ac-happy-home-designer/get_contest_entry_count.go @@ -0,0 +1,47 @@ +// Package protocol implements the Animal Crossing: Happy Home Designer protocol +package protocol + +import ( + "fmt" + + "github.com/PretendoNetwork/nex-go/v2" + "github.com/PretendoNetwork/nex-go/v2/types" + "github.com/PretendoNetwork/nex-protocols-go/v2/globals" +) + +func (protocol *Protocol) handleGetContestEntryCount(packet nex.PacketInterface) { + if protocol.GetObjectInfos == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetContestEntryCount not implemented") + + globals.Logger.Warning(err.Message) + globals.RespondError(packet, ProtocolID, err) + + return + } + + request := packet.RMCMessage() + callID := request.CallID + parameters := request.Parameters + endpoint := packet.Sender().Endpoint() + parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) + + param := types.NewPrimitiveU32(0) + + err := param.ExtractFrom(parametersStream) + if err != nil { + _, rmcError := protocol.GetContestEntryCount(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + } + + return + } + + rmcMessage, rmcError := protocol.GetContestEntryCount(nil, packet, callID, param) + if rmcError != nil { + globals.RespondError(packet, ProtocolID, rmcError) + return + } + + globals.Respond(packet, rmcMessage) +} diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index d17621d4..4aa61b05 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -69,6 +69,7 @@ var patchedMethods = []uint32{ MethodGetBufferQueue, MethodGetBufferQueues, MethodClearBufferQueues, + MethodGetContestEntryCount, } type dataStoreProtocol = datastore.Protocol @@ -90,6 +91,7 @@ type Protocol struct { GetBufferQueue func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.BufferQueueParam) (*nex.RMCMessage, *nex.Error) GetBufferQueues func(err error, packet nex.PacketInterface, callID uint32, params *types.List[*datastore_ac_happy_home_designer_types.BufferQueueParam]) (*nex.RMCMessage, *nex.Error) ClearBufferQueues func(err error, packet nex.PacketInterface, callID uint32, params *types.List[*datastore_ac_happy_home_designer_types.BufferQueueParam]) (*nex.RMCMessage, *nex.Error) + GetContestEntryCount func(err error, packet nex.PacketInterface, callID uint32, pEntries *types.PrimitiveU32) (*nex.RMCMessage, *nex.Error) } // HandlePacket sends the packet to the correct RMC method handler @@ -130,6 +132,8 @@ func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { protocol.handleGetBufferQueues(packet) case MethodClearBufferQueues: protocol.handleClearBufferQueues(packet) + case MethodGetContestEntryCount: + protocol.handleGetContestEntryCount(packet) default: errMessage := fmt.Sprintf("Unsupported DataStoreHappyHomeDesigner method ID: %#v\n", message.MethodID) err := nex.NewError(nex.ResultCodes.Core.NotImplemented, errMessage) From 332447a4917436f8a7f7d3ee6cc7413cfe486c7e Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Thu, 6 Jun 2024 15:23:51 -0400 Subject: [PATCH 13/15] Be consistent with spelling "ID" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel López Guimaraes <112760654+DaniElectra@users.noreply.github.com> --- datastore/ac-happy-home-designer/protocol.go | 8 ++++---- .../types/data_store_get_meta_by_owner_id_param.go | 7 +++---- .../types/data_store_get_meta_by_unique_id_param.go | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 4aa61b05..b3144128 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -19,11 +19,11 @@ const ( // MethodGetObjectInfos is the method ID for GetObjectInfos MethodGetObjectInfos = 0x2D - // MethodGetMetaByOwnerId is the method ID for GetMetaByOwnerId - MethodGetMetaByOwnerId = 0x2E + // MethodGetMetaByOwnerID is the method ID for GetMetaByOwnerID + MethodGetMetaByOwnerID = 0x2E - // MethodGetMetaByUniqueId is the method ID for GetMetaByUniqueId - MethodGetMetaByUniqueId = 0x2F + // MethodGetMetaByUniqueID is the method ID for GetMetaByUniqueID + MethodGetMetaByUniqueID = 0x2F // MethodSearchHouseNew is the method ID for SearchHouseNew MethodSearchHouseNew = 0x30 diff --git a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go index 18d8ff8e..b29e4b51 100644 --- a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go +++ b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go @@ -8,11 +8,10 @@ import ( "github.com/PretendoNetwork/nex-go/v2/types" ) -// DataStoreGetMetaByOwnerIdParam is a type within the DataStoreACHappyHomeDesigner protocol -type DataStoreGetMetaByOwnerIdParam struct { +// DataStoreGetMetaByOwnerIDParam is a type within the DataStoreACHappyHomeDesigner protocol +type DataStoreGetMetaByOwnerIDParam struct { types.Structure - - OwnerIds *types.List[*types.PrimitiveU32] + OwnerIDs *types.List[*types.PrimitiveU32] DataTypes *types.List[*types.PrimitiveU16] ResultOption *types.PrimitiveU8 ResultRange *types.ResultRange diff --git a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go index 2290f004..f967263f 100644 --- a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go +++ b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go @@ -8,11 +8,10 @@ import ( "github.com/PretendoNetwork/nex-go/v2/types" ) -// DataStoreGetMetaByUniqueIdParam is a type within the DataStoreACHappyHomeDesigner protocol -type DataStoreGetMetaByUniqueIdParam struct { +// DataStoreGetMetaByUniqueIDParam is a type within the DataStoreACHappyHomeDesigner protocol +type DataStoreGetMetaByUniqueIDParam struct { types.Structure - - UniqueIds *types.List[*types.PrimitiveU32] + UniqueIDs *types.List[*types.PrimitiveU32] DataTypes *types.List[*types.PrimitiveU16] ResultOption *types.PrimitiveU8 ResultRange *types.ResultRange From 4913a98dc3d3572ccc9690af84c57cffa0650c3e Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Thu, 6 Jun 2024 15:27:55 -0400 Subject: [PATCH 14/15] Fix capitalization of "ID" --- .../get_meta_by_owner_id.go | 12 ++-- .../get_meta_by_unique_id.go | 12 ++-- datastore/ac-happy-home-designer/protocol.go | 16 ++--- .../data_store_get_meta_by_owner_id_param.go | 58 +++++++++---------- .../data_store_get_meta_by_unique_id_param.go | 58 +++++++++---------- 5 files changed, 78 insertions(+), 78 deletions(-) diff --git a/datastore/ac-happy-home-designer/get_meta_by_owner_id.go b/datastore/ac-happy-home-designer/get_meta_by_owner_id.go index 217b7190..72fe2d36 100644 --- a/datastore/ac-happy-home-designer/get_meta_by_owner_id.go +++ b/datastore/ac-happy-home-designer/get_meta_by_owner_id.go @@ -9,9 +9,9 @@ import ( "github.com/PretendoNetwork/nex-protocols-go/v2/globals" ) -func (protocol *Protocol) handleGetMetaByOwnerId(packet nex.PacketInterface) { - if protocol.GetMetaByOwnerId == nil { - err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetMetaByOwnerId not implemented") +func (protocol *Protocol) handleGetMetaByOwnerID(packet nex.PacketInterface) { + if protocol.GetMetaByOwnerID == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetMetaByOwnerID not implemented") globals.Logger.Warning(err.Message) globals.RespondError(packet, ProtocolID, err) @@ -25,11 +25,11 @@ func (protocol *Protocol) handleGetMetaByOwnerId(packet nex.PacketInterface) { endpoint := packet.Sender().Endpoint() parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) - param := datastore_ac_happy_home_designer_types.NewDataStoreGetMetaByOwnerIdParam() + param := datastore_ac_happy_home_designer_types.NewDataStoreGetMetaByOwnerIDParam() err := param.ExtractFrom(parametersStream) if err != nil { - _, rmcError := protocol.GetMetaByOwnerId(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + _, rmcError := protocol.GetMetaByOwnerID(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) if rmcError != nil { globals.RespondError(packet, ProtocolID, rmcError) } @@ -37,7 +37,7 @@ func (protocol *Protocol) handleGetMetaByOwnerId(packet nex.PacketInterface) { return } - rmcMessage, rmcError := protocol.GetMetaByOwnerId(nil, packet, callID, param) + rmcMessage, rmcError := protocol.GetMetaByOwnerID(nil, packet, callID, param) if rmcError != nil { globals.RespondError(packet, ProtocolID, rmcError) return diff --git a/datastore/ac-happy-home-designer/get_meta_by_unique_id.go b/datastore/ac-happy-home-designer/get_meta_by_unique_id.go index 11b99c4e..1e18d34d 100644 --- a/datastore/ac-happy-home-designer/get_meta_by_unique_id.go +++ b/datastore/ac-happy-home-designer/get_meta_by_unique_id.go @@ -9,9 +9,9 @@ import ( "github.com/PretendoNetwork/nex-protocols-go/v2/globals" ) -func (protocol *Protocol) handleGetMetaByUniqueId(packet nex.PacketInterface) { - if protocol.GetMetaByUniqueId == nil { - err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetMetaByUniqueId not implemented") +func (protocol *Protocol) handleGetMetaByUniqueID(packet nex.PacketInterface) { + if protocol.GetMetaByUniqueID == nil { + err := nex.NewError(nex.ResultCodes.Core.NotImplemented, "DataStoreACHappyHomeDesigner::GetMetaByUniqueID not implemented") globals.Logger.Warning(err.Message) globals.RespondError(packet, ProtocolID, err) @@ -25,11 +25,11 @@ func (protocol *Protocol) handleGetMetaByUniqueId(packet nex.PacketInterface) { endpoint := packet.Sender().Endpoint() parametersStream := nex.NewByteStreamIn(parameters, endpoint.LibraryVersions(), endpoint.ByteStreamSettings()) - param := datastore_ac_happy_home_designer_types.NewDataStoreGetMetaByUniqueIdParam() + param := datastore_ac_happy_home_designer_types.NewDataStoreGetMetaByUniqueIDParam() err := param.ExtractFrom(parametersStream) if err != nil { - _, rmcError := protocol.GetMetaByUniqueId(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) + _, rmcError := protocol.GetMetaByUniqueID(fmt.Errorf("Failed to read param from parameters. %s", err.Error()), packet, callID, nil) if rmcError != nil { globals.RespondError(packet, ProtocolID, rmcError) } @@ -37,7 +37,7 @@ func (protocol *Protocol) handleGetMetaByUniqueId(packet nex.PacketInterface) { return } - rmcMessage, rmcError := protocol.GetMetaByUniqueId(nil, packet, callID, param) + rmcMessage, rmcError := protocol.GetMetaByUniqueID(nil, packet, callID, param) if rmcError != nil { globals.RespondError(packet, ProtocolID, rmcError) return diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index b3144128..46343a46 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -58,8 +58,8 @@ const ( var patchedMethods = []uint32{ MethodGetObjectInfos, - MethodGetMetaByOwnerId, - MethodGetMetaByUniqueId, + MethodGetMetaByOwnerID, + MethodGetMetaByUniqueID, MethodSearchHouseNew, MethodSearchHousePopular, MethodSearchHouseResident, @@ -80,8 +80,8 @@ type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) - GetMetaByOwnerId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) - GetMetaByUniqueId func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIdParam) (*nex.RMCMessage, *nex.Error) + GetMetaByOwnerID func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) + GetMetaByUniqueID func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIdParam) (*nex.RMCMessage, *nex.Error) SearchHouseNew func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) SearchHousePopular func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) SearchHouseResident func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) @@ -110,10 +110,10 @@ func (protocol *Protocol) HandlePacket(packet nex.PacketInterface) { switch message.MethodID { case MethodGetObjectInfos: protocol.handleGetObjectInfos(packet) - case MethodGetMetaByOwnerId: - protocol.handleGetMetaByOwnerId(packet) - case MethodGetMetaByUniqueId: - protocol.handleGetMetaByUniqueId(packet) + case MethodGetMetaByOwnerID: + protocol.handleGetMetaByOwnerID(packet) + case MethodGetMetaByUniqueID: + protocol.handleGetMetaByUniqueID(packet) case MethodSearchHouseNew: protocol.handleSearchHouseNew(packet) case MethodSearchHousePopular: diff --git a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go index b29e4b51..4c3c28e7 100644 --- a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go +++ b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_owner_id_param.go @@ -17,11 +17,11 @@ type DataStoreGetMetaByOwnerIDParam struct { ResultRange *types.ResultRange } -// WriteTo writes the DataStoreGetMetaByOwnerIdParam to the given variable -func (dsgmboip *DataStoreGetMetaByOwnerIdParam) WriteTo(writable types.Writable) { +// WriteTo writes the DataStoreGetMetaByOwnerIDParam to the given variable +func (dsgmboip *DataStoreGetMetaByOwnerIDParam) WriteTo(writable types.Writable) { contentWritable := writable.CopyNew() - dsgmboip.OwnerIds.WriteTo(contentWritable) + dsgmboip.OwnerIDs.WriteTo(contentWritable) dsgmboip.DataTypes.WriteTo(contentWritable) dsgmboip.ResultOption.WriteTo(contentWritable) dsgmboip.ResultRange.WriteTo(contentWritable) @@ -33,43 +33,43 @@ func (dsgmboip *DataStoreGetMetaByOwnerIdParam) WriteTo(writable types.Writable) writable.Write(content) } -// ExtractFrom extracts the DataStoreGetMetaByOwnerIdParam from the given readable -func (dsgmboip *DataStoreGetMetaByOwnerIdParam) ExtractFrom(readable types.Readable) error { +// ExtractFrom extracts the DataStoreGetMetaByOwnerIDParam from the given readable +func (dsgmboip *DataStoreGetMetaByOwnerIDParam) ExtractFrom(readable types.Readable) error { var err error err = dsgmboip.ExtractHeaderFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam header. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIDParam header. %s", err.Error()) } - err = dsgmboip.OwnerIds.ExtractFrom(readable) + err = dsgmboip.OwnerIDs.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.OwnerIds. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIDParam.OwnerIDs. %s", err.Error()) } err = dsgmboip.DataTypes.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.DataTypes. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIDParam.DataTypes. %s", err.Error()) } err = dsgmboip.ResultOption.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.ResultOption. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIDParam.ResultOption. %s", err.Error()) } err = dsgmboip.ResultRange.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIdParam.ResultRange. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByOwnerIDParam.ResultRange. %s", err.Error()) } return nil } // Copy returns a new copied instance of DataStoreFileServerGetObject -func (dsgmboip *DataStoreGetMetaByOwnerIdParam) Copy() types.RVType { - copied := NewDataStoreGetMetaByOwnerIdParam() +func (dsgmboip *DataStoreGetMetaByOwnerIDParam) Copy() types.RVType { + copied := NewDataStoreGetMetaByOwnerIDParam() - copied.OwnerIds = dsgmboip.OwnerIds + copied.OwnerIDs = dsgmboip.OwnerIDs copied.DataTypes = dsgmboip.DataTypes copied.ResultOption = dsgmboip.ResultOption copied.ResultRange = dsgmboip.ResultRange @@ -77,15 +77,15 @@ func (dsgmboip *DataStoreGetMetaByOwnerIdParam) Copy() types.RVType { return copied } -// Equals checks if the given DataStoreGetMetaByOwnerIdParam contains the same data as the current DataStoreGetMetaByOwnerIdParam -func (dsgmboip *DataStoreGetMetaByOwnerIdParam) Equals(o types.RVType) bool { - if _, ok := o.(*DataStoreGetMetaByOwnerIdParam); !ok { +// Equals checks if the given DataStoreGetMetaByOwnerIDParam contains the same data as the current DataStoreGetMetaByOwnerIDParam +func (dsgmboip *DataStoreGetMetaByOwnerIDParam) Equals(o types.RVType) bool { + if _, ok := o.(*DataStoreGetMetaByOwnerIDParam); !ok { return false } - other := o.(*DataStoreGetMetaByOwnerIdParam) + other := o.(*DataStoreGetMetaByOwnerIDParam) - if !dsgmboip.OwnerIds.Equals(other.OwnerIds) { + if !dsgmboip.OwnerIDs.Equals(other.OwnerIDs) { return false } @@ -100,20 +100,20 @@ func (dsgmboip *DataStoreGetMetaByOwnerIdParam) Equals(o types.RVType) bool { return dsgmboip.ResultRange.Equals(other.ResultRange) } -// String returns the string representation of the DataStoreGetMetaByOwnerIdParam -func (dsgmboip *DataStoreGetMetaByOwnerIdParam) String() string { +// String returns the string representation of the DataStoreGetMetaByOwnerIDParam +func (dsgmboip *DataStoreGetMetaByOwnerIDParam) String() string { return dsgmboip.FormatToString(0) } -// FormatToString pretty-prints the DataStoreGetMetaByOwnerIdParam using the provided indentation level -func (dsgmboip *DataStoreGetMetaByOwnerIdParam) FormatToString(indentationLevel int) string { +// FormatToString pretty-prints the DataStoreGetMetaByOwnerIDParam using the provided indentation level +func (dsgmboip *DataStoreGetMetaByOwnerIDParam) FormatToString(indentationLevel int) string { indentationValues := strings.Repeat("\t", indentationLevel+1) indentationEnd := strings.Repeat("\t", indentationLevel) var b strings.Builder - b.WriteString("DataStoreGetMetaByOwnerIdParam{\n") - b.WriteString(fmt.Sprintf("%sOwnerIds: %s,\n", indentationValues, dsgmboip.OwnerIds)) + b.WriteString("DataStoreGetMetaByOwnerIDParam{\n") + b.WriteString(fmt.Sprintf("%sOwnerIDs: %s,\n", indentationValues, dsgmboip.OwnerIDs)) b.WriteString(fmt.Sprintf("%sDataTypes: %s,\n", indentationValues, dsgmboip.DataTypes)) b.WriteString(fmt.Sprintf("%sResultOption: %s,\n", indentationValues, dsgmboip.ResultOption)) b.WriteString(fmt.Sprintf("%sResultRange: %s,\n", indentationValues, dsgmboip.ResultRange)) @@ -122,10 +122,10 @@ func (dsgmboip *DataStoreGetMetaByOwnerIdParam) FormatToString(indentationLevel return b.String() } -// NewDataStoreGetMetaByOwnerIdParam returns a new DataStoreGetMetaByOwnerIdParam -func NewDataStoreGetMetaByOwnerIdParam() *DataStoreGetMetaByOwnerIdParam { - dsgmboip := &DataStoreGetMetaByOwnerIdParam{ - OwnerIds: types.NewList[*types.PrimitiveU32](), +// NewDataStoreGetMetaByOwnerIDParam returns a new DataStoreGetMetaByOwnerIDParam +func NewDataStoreGetMetaByOwnerIDParam() *DataStoreGetMetaByOwnerIDParam { + dsgmboip := &DataStoreGetMetaByOwnerIDParam{ + OwnerIDs: types.NewList[*types.PrimitiveU32](), DataTypes: types.NewList[*types.PrimitiveU16](), ResultOption: types.NewPrimitiveU8(0), ResultRange: types.NewResultRange(), diff --git a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go index f967263f..e0a2239b 100644 --- a/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go +++ b/datastore/ac-happy-home-designer/types/data_store_get_meta_by_unique_id_param.go @@ -17,11 +17,11 @@ type DataStoreGetMetaByUniqueIDParam struct { ResultRange *types.ResultRange } -// WriteTo writes the DataStoreGetMetaByUniqueIdParam to the given variable -func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) WriteTo(writable types.Writable) { +// WriteTo writes the DataStoreGetMetaByUniqueIDParam to the given variable +func (dsgmbuip *DataStoreGetMetaByUniqueIDParam) WriteTo(writable types.Writable) { contentWritable := writable.CopyNew() - dsgmbuip.UniqueIds.WriteTo(contentWritable) + dsgmbuip.UniqueIDs.WriteTo(contentWritable) dsgmbuip.DataTypes.WriteTo(contentWritable) dsgmbuip.ResultOption.WriteTo(contentWritable) dsgmbuip.ResultRange.WriteTo(contentWritable) @@ -33,43 +33,43 @@ func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) WriteTo(writable types.Writable writable.Write(content) } -// ExtractFrom extracts the DataStoreGetMetaByUniqueIdParam from the given readable -func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) ExtractFrom(readable types.Readable) error { +// ExtractFrom extracts the DataStoreGetMetaByUniqueIDParam from the given readable +func (dsgmbuip *DataStoreGetMetaByUniqueIDParam) ExtractFrom(readable types.Readable) error { var err error err = dsgmbuip.ExtractHeaderFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam header. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIDParam header. %s", err.Error()) } - err = dsgmbuip.UniqueIds.ExtractFrom(readable) + err = dsgmbuip.UniqueIDs.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.UniqueIds. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIDParam.UniqueIDs. %s", err.Error()) } err = dsgmbuip.DataTypes.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.DataTypes. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIDParam.DataTypes. %s", err.Error()) } err = dsgmbuip.ResultOption.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.ResultOption. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIDParam.ResultOption. %s", err.Error()) } err = dsgmbuip.ResultRange.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIdParam.ResultRange. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreGetMetaByUniqueIDParam.ResultRange. %s", err.Error()) } return nil } // Copy returns a new copied instance of DataStoreFileServerGetObject -func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) Copy() types.RVType { - copied := NewDataStoreGetMetaByUniqueIdParam() +func (dsgmbuip *DataStoreGetMetaByUniqueIDParam) Copy() types.RVType { + copied := NewDataStoreGetMetaByUniqueIDParam() - copied.UniqueIds = dsgmbuip.UniqueIds + copied.UniqueIDs = dsgmbuip.UniqueIDs copied.DataTypes = dsgmbuip.DataTypes copied.ResultOption = dsgmbuip.ResultOption copied.ResultRange = dsgmbuip.ResultRange @@ -77,15 +77,15 @@ func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) Copy() types.RVType { return copied } -// Equals checks if the given DataStoreGetMetaByUniqueIdParam contains the same data as the current DataStoreGetMetaByUniqueIdParam -func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) Equals(o types.RVType) bool { - if _, ok := o.(*DataStoreGetMetaByUniqueIdParam); !ok { +// Equals checks if the given DataStoreGetMetaByUniqueIDParam contains the same data as the current DataStoreGetMetaByUniqueIDParam +func (dsgmbuip *DataStoreGetMetaByUniqueIDParam) Equals(o types.RVType) bool { + if _, ok := o.(*DataStoreGetMetaByUniqueIDParam); !ok { return false } - other := o.(*DataStoreGetMetaByUniqueIdParam) + other := o.(*DataStoreGetMetaByUniqueIDParam) - if !dsgmbuip.UniqueIds.Equals(other.UniqueIds) { + if !dsgmbuip.UniqueIDs.Equals(other.UniqueIDs) { return false } @@ -100,20 +100,20 @@ func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) Equals(o types.RVType) bool { return dsgmbuip.ResultRange.Equals(other.ResultRange) } -// String returns the string representation of the DataStoreGetMetaByUniqueIdParam -func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) String() string { +// String returns the string representation of the DataStoreGetMetaByUniqueIDParam +func (dsgmbuip *DataStoreGetMetaByUniqueIDParam) String() string { return dsgmbuip.FormatToString(0) } -// FormatToString pretty-prints the DataStoreGetMetaByUniqueIdParam using the provided indentation level -func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) FormatToString(indentationLevel int) string { +// FormatToString pretty-prints the DataStoreGetMetaByUniqueIDParam using the provided indentation level +func (dsgmbuip *DataStoreGetMetaByUniqueIDParam) FormatToString(indentationLevel int) string { indentationValues := strings.Repeat("\t", indentationLevel+1) indentationEnd := strings.Repeat("\t", indentationLevel) var b strings.Builder - b.WriteString("DataStoreGetMetaByUniqueIdParam{\n") - b.WriteString(fmt.Sprintf("%sUniqueIds: %s,\n", indentationValues, dsgmbuip.UniqueIds)) + b.WriteString("DataStoreGetMetaByUniqueIDParam{\n") + b.WriteString(fmt.Sprintf("%sUniqueIDs: %s,\n", indentationValues, dsgmbuip.UniqueIDs)) b.WriteString(fmt.Sprintf("%sDataTypes: %s,\n", indentationValues, dsgmbuip.DataTypes)) b.WriteString(fmt.Sprintf("%sResultOption: %s,\n", indentationValues, dsgmbuip.ResultOption)) b.WriteString(fmt.Sprintf("%sResultRange: %s,\n", indentationValues, dsgmbuip.ResultRange)) @@ -122,10 +122,10 @@ func (dsgmbuip *DataStoreGetMetaByUniqueIdParam) FormatToString(indentationLevel return b.String() } -// NewDataStoreGetMetaByUniqueIdParam returns a new DataStoreGetMetaByUniqueIdParam -func NewDataStoreGetMetaByUniqueIdParam() *DataStoreGetMetaByUniqueIdParam { - dsgmbuip := &DataStoreGetMetaByUniqueIdParam{ - UniqueIds: types.NewList[*types.PrimitiveU32](), +// NewDataStoreGetMetaByUniqueIDParam returns a new DataStoreGetMetaByUniqueIDParam +func NewDataStoreGetMetaByUniqueIDParam() *DataStoreGetMetaByUniqueIDParam { + dsgmbuip := &DataStoreGetMetaByUniqueIDParam{ + UniqueIDs: types.NewList[*types.PrimitiveU32](), DataTypes: types.NewList[*types.PrimitiveU16](), ResultOption: types.NewPrimitiveU8(0), ResultRange: types.NewResultRange(), From 01431d48fe86aa1be7df39b9f26ddb7263ff63ab Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Thu, 6 Jun 2024 15:29:57 -0400 Subject: [PATCH 15/15] Final fix for the other "Id" miscapitalizations --- datastore/ac-happy-home-designer/protocol.go | 16 ++++++++-------- .../types/buffer_queue_param.go | 16 ++++++++-------- .../types/data_store_file_server_object_info.go | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/datastore/ac-happy-home-designer/protocol.go b/datastore/ac-happy-home-designer/protocol.go index 46343a46..6016cc5e 100644 --- a/datastore/ac-happy-home-designer/protocol.go +++ b/datastore/ac-happy-home-designer/protocol.go @@ -79,14 +79,14 @@ type dataStoreProtocol = datastore.Protocol type Protocol struct { endpoint nex.EndpointInterface dataStoreProtocol - GetObjectInfos func(err error, packet nex.PacketInterface, callId uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) - GetMetaByOwnerID func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIdParam) (*nex.RMCMessage, *nex.Error) - GetMetaByUniqueID func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIdParam) (*nex.RMCMessage, *nex.Error) - SearchHouseNew func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) - SearchHousePopular func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) - SearchHouseResident func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) - SearchHouseContest func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) - SearchHouseContestRandom func(err error, packet nex.PacketInterface, callId uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + GetObjectInfos func(err error, packet nex.PacketInterface, callID uint32, dataIDs *types.List[*types.PrimitiveU64]) (*nex.RMCMessage, *nex.Error) + GetMetaByOwnerID func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByOwnerIDParam) (*nex.RMCMessage, *nex.Error) + GetMetaByUniqueID func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreGetMetaByUniqueIDParam) (*nex.RMCMessage, *nex.Error) + SearchHouseNew func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHousePopular func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHouseResident func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHouseContest func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) + SearchHouseContestRandom func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.DataStoreSearchHouseParam) (*nex.RMCMessage, *nex.Error) AddToBufferQueue func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.BufferQueueParam, buffer *types.QBuffer) (*nex.RMCMessage, *nex.Error) GetBufferQueue func(err error, packet nex.PacketInterface, callID uint32, param *datastore_ac_happy_home_designer_types.BufferQueueParam) (*nex.RMCMessage, *nex.Error) GetBufferQueues func(err error, packet nex.PacketInterface, callID uint32, params *types.List[*datastore_ac_happy_home_designer_types.BufferQueueParam]) (*nex.RMCMessage, *nex.Error) diff --git a/datastore/ac-happy-home-designer/types/buffer_queue_param.go b/datastore/ac-happy-home-designer/types/buffer_queue_param.go index aa10ee3d..48a0abe4 100644 --- a/datastore/ac-happy-home-designer/types/buffer_queue_param.go +++ b/datastore/ac-happy-home-designer/types/buffer_queue_param.go @@ -12,7 +12,7 @@ import ( type BufferQueueParam struct { types.Structure - DataId *types.PrimitiveU64 + DataID *types.PrimitiveU64 Slot *types.PrimitiveU32 } @@ -20,7 +20,7 @@ type BufferQueueParam struct { func (bqp *BufferQueueParam) WriteTo(writable types.Writable) { contentWritable := writable.CopyNew() - bqp.DataId.WriteTo(contentWritable) + bqp.DataID.WriteTo(contentWritable) bqp.Slot.WriteTo(contentWritable) content := contentWritable.Bytes() @@ -39,9 +39,9 @@ func (bqp *BufferQueueParam) ExtractFrom(readable types.Readable) error { return fmt.Errorf("Failed to extract BufferQueueParam header. %s", err.Error()) } - err = bqp.DataId.ExtractFrom(readable) + err = bqp.DataID.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract BufferQueueParam.DataId. %s", err.Error()) + return fmt.Errorf("Failed to extract BufferQueueParam.DataID. %s", err.Error()) } err = bqp.Slot.ExtractFrom(readable) @@ -56,7 +56,7 @@ func (bqp *BufferQueueParam) ExtractFrom(readable types.Readable) error { func (bqp *BufferQueueParam) Copy() types.RVType { copied := NewBufferQueueParam() - copied.DataId = bqp.DataId + copied.DataID = bqp.DataID copied.Slot = bqp.Slot return copied @@ -70,7 +70,7 @@ func (bqp *BufferQueueParam) Equals(o types.RVType) bool { other := o.(*BufferQueueParam) - if !bqp.DataId.Equals(other.DataId) { + if !bqp.DataID.Equals(other.DataID) { return false } @@ -90,7 +90,7 @@ func (bqp *BufferQueueParam) FormatToString(indentationLevel int) string { var b strings.Builder b.WriteString("BufferQueueParam{\n") - b.WriteString(fmt.Sprintf("%sDataId: %s,\n", indentationValues, bqp.DataId)) + b.WriteString(fmt.Sprintf("%sDataID: %s,\n", indentationValues, bqp.DataID)) b.WriteString(fmt.Sprintf("%sSlot: %s,\n", indentationValues, bqp.Slot)) b.WriteString(fmt.Sprintf("%s}", indentationEnd)) @@ -100,7 +100,7 @@ func (bqp *BufferQueueParam) FormatToString(indentationLevel int) string { // NewBufferQueueParam returns a new BufferQueueParam func NewBufferQueueParam() *BufferQueueParam { bqp := &BufferQueueParam{ - DataId: types.NewPrimitiveU64(0), + DataID: types.NewPrimitiveU64(0), Slot: types.NewPrimitiveU32(0), } diff --git a/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go b/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go index 5a6dd1e0..23f6c8c8 100644 --- a/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go +++ b/datastore/ac-happy-home-designer/types/data_store_file_server_object_info.go @@ -13,7 +13,7 @@ import ( type DataStoreFileServerObjectInfo struct { types.Structure - DataId *types.PrimitiveU64 + DataID *types.PrimitiveU64 GetInfo *datastore_types.DataStoreReqGetInfo } @@ -21,7 +21,7 @@ type DataStoreFileServerObjectInfo struct { func (dsfsoi *DataStoreFileServerObjectInfo) WriteTo(writable types.Writable) { contentWritable := writable.CopyNew() - dsfsoi.DataId.WriteTo(contentWritable) + dsfsoi.DataID.WriteTo(contentWritable) dsfsoi.GetInfo.WriteTo(contentWritable) content := contentWritable.Bytes() @@ -40,9 +40,9 @@ func (dsfsoi *DataStoreFileServerObjectInfo) ExtractFrom(readable types.Readable return fmt.Errorf("Failed to extract DataStoreFileServerObjectInfo header. %s", err.Error()) } - err = dsfsoi.DataId.ExtractFrom(readable) + err = dsfsoi.DataID.ExtractFrom(readable) if err != nil { - return fmt.Errorf("Failed to extract DataStoreFileServerObjectInfo.DataId. %s", err.Error()) + return fmt.Errorf("Failed to extract DataStoreFileServerObjectInfo.DataID. %s", err.Error()) } err = dsfsoi.GetInfo.ExtractFrom(readable) @@ -57,7 +57,7 @@ func (dsfsoi *DataStoreFileServerObjectInfo) ExtractFrom(readable types.Readable func (dsfsoi *DataStoreFileServerObjectInfo) Copy() types.RVType { copied := NewDataStoreFileServerObjectInfo() - copied.DataId = dsfsoi.DataId + copied.DataID = dsfsoi.DataID copied.GetInfo = dsfsoi.GetInfo return copied @@ -71,7 +71,7 @@ func (dsfsoi *DataStoreFileServerObjectInfo) Equals(o types.RVType) bool { other := o.(*DataStoreFileServerObjectInfo) - if !dsfsoi.DataId.Equals(other.DataId) { + if !dsfsoi.DataID.Equals(other.DataID) { return false } @@ -91,7 +91,7 @@ func (dsfsoi *DataStoreFileServerObjectInfo) FormatToString(indentationLevel int var b strings.Builder b.WriteString("DataStoreFileServerObjectInfo{\n") - b.WriteString(fmt.Sprintf("%sDataId: %s,\n", indentationValues, dsfsoi.DataId)) + b.WriteString(fmt.Sprintf("%sDataID: %s,\n", indentationValues, dsfsoi.DataID)) b.WriteString(fmt.Sprintf("%sGetInfo: %s,\n", indentationValues, dsfsoi.GetInfo.FormatToString(indentationLevel+1))) b.WriteString(fmt.Sprintf("%s}", indentationEnd)) @@ -101,7 +101,7 @@ func (dsfsoi *DataStoreFileServerObjectInfo) FormatToString(indentationLevel int // NewDataStoreFileServerObjectInfo returns a new DataStoreFileServerObjectInfo func NewDataStoreFileServerObjectInfo() *DataStoreFileServerObjectInfo { dsfsoi := &DataStoreFileServerObjectInfo{ - DataId: types.NewPrimitiveU64(0), + DataID: types.NewPrimitiveU64(0), GetInfo: datastore_types.NewDataStoreReqGetInfo(), }