diff --git a/sources/Commands/ACommandDB.uc b/sources/Commands/ACommandDB.uc index 1f7e12b..25e8349 100644 --- a/sources/Commands/ACommandDB.uc +++ b/sources/Commands/ACommandDB.uc @@ -65,11 +65,9 @@ struct DBPointerPair }; var protected const int TCREATE, TDELETE, TLIST, TREAD, TSIZE, TKEYS, TREMOVE; -var protected const int TWRITE, TWRITE_ARRAY, TWRITE_NULL, TWRITE_BOOLEAN; -var protected const int TWRITE_INTEGER, TWRITE_FLOAT, TWRITE_STRING, TINCREMENT; -var protected const int TDATABASE_NAME, TDATABASE_LINK, TJSON_VALUE; +var protected const int TWRITE, TINCREMENT, TDATABASE_NAME, TDATABASE_LINK; +var protected const int TJSON_VALUE, TQUERY_INVALID_POINTER, TQUERY_INVALID_DB; var protected const int TOBJECT_KEYS_ARE, TOBJECT_SIZE_IS, TQUERY_COMPLETED; -var protected const int TQUERY_INVALID_POINTER, TQUERY_INVALID_DB; var protected const int TQUERY_INVALID_DATA, TAVAILABLE_DATABASES, TDA_DELETED; var protected const int TDB_DOESNT_EXIST, TDB_ALREADY_EXISTS, TDB_CREATED; var protected const int TDB_CANNOT_BE_CREATED, TNO_DEFAULT_COMMAND, TBAD_DBLINK; @@ -104,37 +102,8 @@ protected function BuildData(CommandDataBuilder builder) .Describe(P("Removes data from location given by the `databaseLink`.")); builder.SubCommand(T(TWRITE)) .ParamText(T(TDATABASE_LINK)) - .ParamObject(T(TJSON_VALUE)) - .Describe(P("Writes specified JSON object into location given by" - @ "the `databaseLink`.")); - builder.SubCommand(T(TWRITE_ARRAY)) - .ParamText(T(TDATABASE_LINK)) - .ParamArray(T(TJSON_VALUE)) - .Describe(P("Writes specified JSON array into location given by" - @ "the `databaseLink`.")); - builder.SubCommand(T(TWRITE_NULL)) - .ParamText(T(TDATABASE_LINK)) - .Describe(P("Writes specified null value into location given by" - @ "the `databaseLink`.")); - builder.SubCommand(T(TWRITE_BOOLEAN)) - .ParamText(T(TDATABASE_LINK)) - .ParamBoolean(T(TJSON_VALUE)) - .Describe(P("Writes specified JSON boolean into location given by" - @ "the `databaseLink`.")); - builder.SubCommand(T(TWRITE_INTEGER)) - .ParamText(T(TDATABASE_LINK)) - .ParamInteger(T(TJSON_VALUE)) - .Describe(P("Writes specified integer as JSON number into location" - @ "given by the `databaseLink`.")); - builder.SubCommand(T(TWRITE_FLOAT)) - .ParamText(T(TDATABASE_LINK)) - .ParamNumber(T(TJSON_VALUE)) - .Describe(P("Writes specified float as JSON number into location" - @ "given by the `databaseLink`.")); - builder.SubCommand(T(TWRITE_STRING)) - .ParamText(T(TDATABASE_LINK)) - .ParamText(T(TJSON_VALUE)) - .Describe(P("Writes specified JSON string into location given by" + .ParamJSON(T(TJSON_VALUE)) + .Describe(P("Writes specified JSON value into location given by" @ "the `databaseLink`.")); builder.Option(T(TINCREMENT)) .Describe(F("Specifying this option for any of the" @@ -196,7 +165,7 @@ protected function Executed(CallData arguments, EPlayer instigator) } // Remember the last player we are making a query to and make that query PushPlayer(instigator, pair.database); - if (subCommand.StartsWith(T(TWRITE))) + if (subCommand.Compare(T(TWRITE))) { valueToWrite = arguments.parameters.GetItem(T(TJSON_VALUE)); if (arguments.options.HasKey(T(TINCREMENT))) @@ -457,52 +426,40 @@ defaultproperties stringConstants(6) = "remove" TWRITE = 7 stringConstants(7) = "write" - TWRITE_ARRAY = 8 - stringConstants(8) = "write_array" - TWRITE_NULL = 9 - stringConstants(9) = "write_null" - TWRITE_BOOLEAN = 10 - stringConstants(10) = "write_boolean" - TWRITE_INTEGER = 11 - stringConstants(11) = "write_integer" - TWRITE_FLOAT = 12 - stringConstants(12) = "write_float" - TWRITE_STRING = 13 - stringConstants(13) = "write_string" - TINCREMENT = 14 - stringConstants(14) = "increment" - TDATABASE_NAME = 15 - stringConstants(15) = "databaseName" - TDATABASE_LINK = 16 - stringConstants(16) = "databaseLink" - TJSON_VALUE = 17 - stringConstants(17) = "jsonValue" - TOBJECT_KEYS_ARE = 18 - stringConstants(18) = "{$TextEmphasis Object keys are:} " - TOBJECT_SIZE_IS = 19 - stringConstants(19) = "{$TextEmphasis Object size is:} " - TQUERY_COMPLETED = 20 - stringConstants(20) = "{$TextPositive Database query was completed!}" - TQUERY_INVALID_POINTER = 21 - stringConstants(21) = "{$TextNegative Query was provided with an invalid JSON pointer.}" - TQUERY_INVALID_DB = 22 - stringConstants(22) = "{$TextNegative Operation could not finish because database is damaged and unusable.}" - TQUERY_INVALID_DATA = 23 - stringConstants(23) = "{$TextNegative Query data is invalid.}" - TAVAILABLE_DATABASES = 24 - stringConstants(24) = "{$TextEmphasis Available databases:} " - TDA_DELETED = 25 - stringConstants(25) = "{$TextPositive Database was deleted.}" - TDB_DOESNT_EXIST = 26 - stringConstants(26) = "{$TextNegative Database with specified name does not exist.}" - TDB_ALREADY_EXISTS = 27 - stringConstants(27) = "{$TextNegative Database with specified name already exists.}" - TDB_CREATED = 28 - stringConstants(28) = "{$TextPositive Database was created.}" - TDB_CANNOT_BE_CREATED = 29 - stringConstants(29) = "{$TextNegative Database cannot be created.}" - TNO_DEFAULT_COMMAND = 30 - stringConstants(30) = "{$TextNegative Default command does nothing. Use on of the sub-commands.}" - TBAD_DBLINK = 31 - stringConstants(31) = "{$TextNegative Database could not be read for the specified link.}" + TINCREMENT = 8 + stringConstants(8) = "increment" + TDATABASE_NAME = 9 + stringConstants(9) = "databaseName" + TDATABASE_LINK = 10 + stringConstants(10) = "databaseLink" + TJSON_VALUE = 11 + stringConstants(11) = "jsonValue" + TOBJECT_KEYS_ARE = 12 + stringConstants(12) = "{$TextEmphasis Object keys are:} " + TOBJECT_SIZE_IS = 13 + stringConstants(13) = "{$TextEmphasis Object size is:} " + TQUERY_COMPLETED = 14 + stringConstants(14) = "{$TextPositive Database query was completed!}" + TQUERY_INVALID_POINTER = 15 + stringConstants(15) = "{$TextNegative Query was provided with an invalid JSON pointer.}" + TQUERY_INVALID_DB = 16 + stringConstants(16) = "{$TextNegative Operation could not finish because database is damaged and unusable.}" + TQUERY_INVALID_DATA = 17 + stringConstants(17) = "{$TextNegative Query data is invalid.}" + TAVAILABLE_DATABASES = 18 + stringConstants(18) = "{$TextEmphasis Available databases:} " + TDA_DELETED = 19 + stringConstants(19) = "{$TextPositive Database was deleted.}" + TDB_DOESNT_EXIST = 20 + stringConstants(20) = "{$TextNegative Database with specified name does not exist.}" + TDB_ALREADY_EXISTS = 21 + stringConstants(21) = "{$TextNegative Database with specified name already exists.}" + TDB_CREATED = 22 + stringConstants(22) = "{$TextPositive Database was created.}" + TDB_CANNOT_BE_CREATED = 23 + stringConstants(23) = "{$TextNegative Database cannot be created.}" + TNO_DEFAULT_COMMAND = 24 + stringConstants(24) = "{$TextNegative Default command does nothing. Use on of the sub-commands.}" + TBAD_DBLINK = 25 + stringConstants(25) = "{$TextNegative Database could not be read for the specified link.}" } \ No newline at end of file