@ -65,11 +65,9 @@ struct DBPointerPair
};
};
var protected const int TCREATE, TDELETE, TLIST, TREAD, TSIZE, TKEYS, TREMOVE;
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, TINCREMENT, TDATABASE_NAME, TDATABASE_LINK;
var protected const int TWRITE_INTEGER, TWRITE_FLOAT, TWRITE_STRING, TINCREMENT;
var protected const int TJSON_VALUE, TQUERY_INVALID_POINTER, TQUERY_INVALID_DB;
var protected const int TDATABASE_NAME, TDATABASE_LINK, TJSON_VALUE;
var protected const int TOBJECT_KEYS_ARE, TOBJECT_SIZE_IS, TQUERY_COMPLETED;
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 TQUERY_INVALID_DATA, TAVAILABLE_DATABASES, TDA_DELETED;
var protected const int TDB_DOESNT_EXIST, TDB_ALREADY_EXISTS, TDB_CREATED;
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;
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`."));
.Describe(P("Removes data from location given by the `databaseLink`."));
builder.SubCommand(T(TWRITE))
builder.SubCommand(T(TWRITE))
.ParamText(T(TDATABASE_LINK))
.ParamText(T(TDATABASE_LINK))
.ParamObject(T(TJSON_VALUE))
.ParamJSON(T(TJSON_VALUE))
.Describe(P("Writes specified JSON object into location given by"
.Describe(P("Writes specified JSON value 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"
@ "the `databaseLink`."));
@ "the `databaseLink`."));
builder.Option(T(TINCREMENT))
builder.Option(T(TINCREMENT))
.Describe(F("Specifying this option for any of the"
.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
// Remember the last player we are making a query to and make that query
PushPlayer(instigator, pair.database);
PushPlayer(instigator, pair.database);
if (subCommand.StartsWith (T(TWRITE)))
if (subCommand.Compare (T(TWRITE)))
{
{
valueToWrite = arguments.parameters.GetItem(T(TJSON_VALUE));
valueToWrite = arguments.parameters.GetItem(T(TJSON_VALUE));
if (arguments.options.HasKey(T(TINCREMENT)))
if (arguments.options.HasKey(T(TINCREMENT)))
@ -457,52 +426,40 @@ defaultproperties
stringConstants(6) = "remove"
stringConstants(6) = "remove"
TWRITE = 7
TWRITE = 7
stringConstants(7) = "write"
stringConstants(7) = "write"
TWRITE_ARRAY = 8
TINCREMENT = 8
stringConstants(8) = "write_array"
stringConstants(8) = "increment"
TWRITE_NULL = 9
TDATABASE_NAME = 9
stringConstants(9) = "write_null"
stringConstants(9) = "databaseName"
TWRITE_BOOLEAN = 10
TDATABASE_LINK = 10
stringConstants(10) = "write_boolean"
stringConstants(10) = "databaseLink"
TWRITE_INTEGER = 11
TJSON_VALUE = 11
stringConstants(11) = "write_integer"
stringConstants(11) = "jsonValue"
TWRITE_FLOAT = 12
TOBJECT_KEYS_ARE = 12
stringConstants(12) = "write_float"
stringConstants(12) = "{$TextEmphasis Object keys are:} "
TWRITE_STRING = 13
TOBJECT_SIZE_IS = 13
stringConstants(13) = "write_string"
stringConstants(13) = "{$TextEmphasis Object size is:} "
TINCREMENT = 14
TQUERY_COMPLETED = 14
stringConstants(14) = "increment"
stringConstants(14) = "{$TextPositive Database query was completed!}"
TDATABASE_NAME = 15
TQUERY_INVALID_POINTER = 15
stringConstants(15) = "databaseName"
stringConstants(15) = "{$TextNegative Query was provided with an invalid JSON pointer.}"
TDATABASE_LINK = 16
TQUERY_INVALID_DB = 16
stringConstants(16) = "databaseLink"
stringConstants(16) = "{$TextNegative Operation could not finish because database is damaged and unusable.}"
TJSON_VALUE = 17
TQUERY_INVALID_DATA = 17
stringConstants(17) = "jsonValue"
stringConstants(17) = "{$TextNegative Query data is invalid.}"
TOBJECT_KEYS_ARE = 18
TAVAILABLE_DATABASES = 18
stringConstants(18) = "{$TextEmphasis Object keys are:} "
stringConstants(18) = "{$TextEmphasis Available databases:} "
TOBJECT_SIZE_IS = 19
TDA_DELETED = 19
stringConstants(19) = "{$TextEmphasis Object size is:} "
stringConstants(19) = "{$TextPositive Database was deleted.}"
TQUERY_COMPLETED = 20
TDB_DOESNT_EXIST = 20
stringConstants(20) = "{$TextPositive Database query was completed!}"
stringConstants(20) = "{$TextNegative Database with specified name does not exist.}"
TQUERY_INVALID_POINTER = 21
TDB_ALREADY_EXISTS = 21
stringConstants(21) = "{$TextNegative Query was provided with an invalid JSON pointer.}"
stringConstants(21) = "{$TextNegative Database with specified name already exists.}"
TQUERY_INVALID_DB = 22
TDB_CREATED = 22
stringConstants(22) = "{$TextNegative Operation could not finish because database is damaged and unusable.}"
stringConstants(22) = "{$TextPositive Database was created.}"
TQUERY_INVALID_DATA = 23
TDB_CANNOT_BE_CREATED = 23
stringConstants(23) = "{$TextNegative Query data is invalid.}"
stringConstants(23) = "{$TextNegative Database cannot be created.}"
TAVAILABLE_DATABASES = 24
TNO_DEFAULT_COMMAND = 24
stringConstants(24) = "{$TextEmphasis Available databases:} "
stringConstants(24) = "{$TextNegative Default command does nothing. Use on of the sub-commands.}"
TDA_DELETED = 25
TBAD_DBLINK = 25
stringConstants(25) = "{$TextPositive Database was deleted.}"
stringConstants(25) = "{$TextNegative Database could not be read for the specified link.}"
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.}"
}
}