Switch all existing API requests to use new CharacterIdentifier stuff.
This commit is contained in:
parent
3352c2067f
commit
114ba4bd68
|
@ -32,25 +32,22 @@ message ApiResult {
|
|||
|
||||
//Update an attribute's dot amount. TODO rename to AttributesUpdate.
|
||||
message UpdateAttributeRequest {
|
||||
string character_username = 1;
|
||||
int32 character_id = 2;
|
||||
string attribute_name = 3;
|
||||
int32 attribute_value = 4;
|
||||
CharacterIdentifier character = 1;
|
||||
string attribute_name = 2;
|
||||
int32 attribute_value = 3;
|
||||
}
|
||||
|
||||
//Full update of a single skill
|
||||
message UpdateSkillRequest {
|
||||
string character_username = 1;
|
||||
int32 character_id = 2;
|
||||
CofdSheet.Skill skill = 3;
|
||||
CharacterIdentifier character = 1;
|
||||
CofdSheet.Skill skill = 2;
|
||||
}
|
||||
|
||||
//Partial update of a single skill dot amount.
|
||||
message UpdateSkillValueRequest {
|
||||
string character_username = 1;
|
||||
int32 character_id = 2;
|
||||
string skill_name = 3;
|
||||
int32 skill_value = 4;
|
||||
CharacterIdentifier character = 1;
|
||||
string skill_name = 2;
|
||||
int32 skill_value = 3;
|
||||
}
|
||||
|
||||
//Partial update of only a skill's specializations. The
|
||||
|
|
|
@ -95,11 +95,10 @@ export namespace ApiResult {
|
|||
}
|
||||
|
||||
export class UpdateAttributeRequest extends jspb.Message {
|
||||
getCharacterUsername(): string;
|
||||
setCharacterUsername(value: string): void;
|
||||
|
||||
getCharacterId(): number;
|
||||
setCharacterId(value: number): void;
|
||||
hasCharacter(): boolean;
|
||||
clearCharacter(): void;
|
||||
getCharacter(): CharacterIdentifier | undefined;
|
||||
setCharacter(value?: CharacterIdentifier): void;
|
||||
|
||||
getAttributeName(): string;
|
||||
setAttributeName(value: string): void;
|
||||
|
@ -119,19 +118,17 @@ export class UpdateAttributeRequest extends jspb.Message {
|
|||
|
||||
export namespace UpdateAttributeRequest {
|
||||
export type AsObject = {
|
||||
characterUsername: string,
|
||||
characterId: number,
|
||||
character?: CharacterIdentifier.AsObject,
|
||||
attributeName: string,
|
||||
attributeValue: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class UpdateSkillRequest extends jspb.Message {
|
||||
getCharacterUsername(): string;
|
||||
setCharacterUsername(value: string): void;
|
||||
|
||||
getCharacterId(): number;
|
||||
setCharacterId(value: number): void;
|
||||
hasCharacter(): boolean;
|
||||
clearCharacter(): void;
|
||||
getCharacter(): CharacterIdentifier | undefined;
|
||||
setCharacter(value?: CharacterIdentifier): void;
|
||||
|
||||
hasSkill(): boolean;
|
||||
clearSkill(): void;
|
||||
|
@ -150,18 +147,16 @@ export class UpdateSkillRequest extends jspb.Message {
|
|||
|
||||
export namespace UpdateSkillRequest {
|
||||
export type AsObject = {
|
||||
characterUsername: string,
|
||||
characterId: number,
|
||||
character?: CharacterIdentifier.AsObject,
|
||||
skill?: cofd_pb.CofdSheet.Skill.AsObject,
|
||||
}
|
||||
}
|
||||
|
||||
export class UpdateSkillValueRequest extends jspb.Message {
|
||||
getCharacterUsername(): string;
|
||||
setCharacterUsername(value: string): void;
|
||||
|
||||
getCharacterId(): number;
|
||||
setCharacterId(value: number): void;
|
||||
hasCharacter(): boolean;
|
||||
clearCharacter(): void;
|
||||
getCharacter(): CharacterIdentifier | undefined;
|
||||
setCharacter(value?: CharacterIdentifier): void;
|
||||
|
||||
getSkillName(): string;
|
||||
setSkillName(value: string): void;
|
||||
|
@ -181,8 +176,7 @@ export class UpdateSkillValueRequest extends jspb.Message {
|
|||
|
||||
export namespace UpdateSkillValueRequest {
|
||||
export type AsObject = {
|
||||
characterUsername: string,
|
||||
characterId: number,
|
||||
character?: CharacterIdentifier.AsObject,
|
||||
skillName: string,
|
||||
skillValue: number,
|
||||
}
|
||||
|
|
|
@ -867,10 +867,9 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.toObject = function
|
|||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
characterUsername: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
||||
characterId: jspb.Message.getFieldWithDefault(msg, 2, 0),
|
||||
attributeName: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
||||
attributeValue: jspb.Message.getFieldWithDefault(msg, 4, 0)
|
||||
character: (f = msg.getCharacter()) && proto.models.proto.cofd.api.CharacterIdentifier.toObject(includeInstance, f),
|
||||
attributeName: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
||||
attributeValue: jspb.Message.getFieldWithDefault(msg, 3, 0)
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
|
@ -908,18 +907,15 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.deserializeBinaryFromReader =
|
|||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setCharacterUsername(value);
|
||||
var value = new proto.models.proto.cofd.api.CharacterIdentifier;
|
||||
reader.readMessage(value,proto.models.proto.cofd.api.CharacterIdentifier.deserializeBinaryFromReader);
|
||||
msg.setCharacter(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {number} */ (reader.readInt32());
|
||||
msg.setCharacterId(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setAttributeName(value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
var value = /** @type {number} */ (reader.readInt32());
|
||||
msg.setAttributeValue(value);
|
||||
break;
|
||||
|
@ -952,31 +948,25 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.serializeBinary = f
|
|||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.serializeBinaryToWriter = function(message, writer) {
|
||||
var f = undefined;
|
||||
f = message.getCharacterUsername();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
f = message.getCharacter();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getCharacterId();
|
||||
if (f !== 0) {
|
||||
writer.writeInt32(
|
||||
2,
|
||||
f
|
||||
f,
|
||||
proto.models.proto.cofd.api.CharacterIdentifier.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = message.getAttributeName();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
3,
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getAttributeValue();
|
||||
if (f !== 0) {
|
||||
writer.writeInt32(
|
||||
4,
|
||||
3,
|
||||
f
|
||||
);
|
||||
}
|
||||
|
@ -984,47 +974,48 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.serializeBinaryToWriter = fun
|
|||
|
||||
|
||||
/**
|
||||
* optional string character_username = 1;
|
||||
* @return {string}
|
||||
* optional CharacterIdentifier character = 1;
|
||||
* @return {?proto.models.proto.cofd.api.CharacterIdentifier}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getCharacterUsername = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getCharacter = function() {
|
||||
return /** @type{?proto.models.proto.cofd.api.CharacterIdentifier} */ (
|
||||
jspb.Message.getWrapperField(this, proto.models.proto.cofd.api.CharacterIdentifier, 1));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {?proto.models.proto.cofd.api.CharacterIdentifier|undefined} value
|
||||
* @return {!proto.models.proto.cofd.api.UpdateAttributeRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.setCharacterUsername = function(value) {
|
||||
return jspb.Message.setProto3StringField(this, 1, value);
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.setCharacter = function(value) {
|
||||
return jspb.Message.setWrapperField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional int32 character_id = 2;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getCharacterId = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* Clears the message field making it undefined.
|
||||
* @return {!proto.models.proto.cofd.api.UpdateAttributeRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.setCharacterId = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 2, value);
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.clearCharacter = function() {
|
||||
return this.setCharacter(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string attribute_name = 3;
|
||||
* Returns whether this field is set.
|
||||
* @return {boolean}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.hasCharacter = function() {
|
||||
return jspb.Message.getField(this, 1) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string attribute_name = 2;
|
||||
* @return {string}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getAttributeName = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
||||
};
|
||||
|
||||
|
||||
|
@ -1033,16 +1024,16 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getAttributeName =
|
|||
* @return {!proto.models.proto.cofd.api.UpdateAttributeRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.setAttributeName = function(value) {
|
||||
return jspb.Message.setProto3StringField(this, 3, value);
|
||||
return jspb.Message.setProto3StringField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional int32 attribute_value = 4;
|
||||
* optional int32 attribute_value = 3;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getAttributeValue = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
|
||||
};
|
||||
|
||||
|
||||
|
@ -1051,7 +1042,7 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.getAttributeValue =
|
|||
* @return {!proto.models.proto.cofd.api.UpdateAttributeRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.setAttributeValue = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 4, value);
|
||||
return jspb.Message.setProto3IntField(this, 3, value);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1087,8 +1078,7 @@ proto.models.proto.cofd.api.UpdateSkillRequest.prototype.toObject = function(opt
|
|||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
characterUsername: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
||||
characterId: jspb.Message.getFieldWithDefault(msg, 2, 0),
|
||||
character: (f = msg.getCharacter()) && proto.models.proto.cofd.api.CharacterIdentifier.toObject(includeInstance, f),
|
||||
skill: (f = msg.getSkill()) && cofd_pb.CofdSheet.Skill.toObject(includeInstance, f)
|
||||
};
|
||||
|
||||
|
@ -1127,14 +1117,11 @@ proto.models.proto.cofd.api.UpdateSkillRequest.deserializeBinaryFromReader = fun
|
|||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setCharacterUsername(value);
|
||||
var value = new proto.models.proto.cofd.api.CharacterIdentifier;
|
||||
reader.readMessage(value,proto.models.proto.cofd.api.CharacterIdentifier.deserializeBinaryFromReader);
|
||||
msg.setCharacter(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {number} */ (reader.readInt32());
|
||||
msg.setCharacterId(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = new cofd_pb.CofdSheet.Skill;
|
||||
reader.readMessage(value,cofd_pb.CofdSheet.Skill.deserializeBinaryFromReader);
|
||||
msg.setSkill(value);
|
||||
|
@ -1168,24 +1155,18 @@ proto.models.proto.cofd.api.UpdateSkillRequest.prototype.serializeBinary = funct
|
|||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.serializeBinaryToWriter = function(message, writer) {
|
||||
var f = undefined;
|
||||
f = message.getCharacterUsername();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
f = message.getCharacter();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getCharacterId();
|
||||
if (f !== 0) {
|
||||
writer.writeInt32(
|
||||
2,
|
||||
f
|
||||
f,
|
||||
proto.models.proto.cofd.api.CharacterIdentifier.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = message.getSkill();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
3,
|
||||
2,
|
||||
f,
|
||||
cofd_pb.CofdSheet.Skill.serializeBinaryToWriter
|
||||
);
|
||||
|
@ -1194,48 +1175,49 @@ proto.models.proto.cofd.api.UpdateSkillRequest.serializeBinaryToWriter = functio
|
|||
|
||||
|
||||
/**
|
||||
* optional string character_username = 1;
|
||||
* @return {string}
|
||||
* optional CharacterIdentifier character = 1;
|
||||
* @return {?proto.models.proto.cofd.api.CharacterIdentifier}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getCharacterUsername = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getCharacter = function() {
|
||||
return /** @type{?proto.models.proto.cofd.api.CharacterIdentifier} */ (
|
||||
jspb.Message.getWrapperField(this, proto.models.proto.cofd.api.CharacterIdentifier, 1));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {?proto.models.proto.cofd.api.CharacterIdentifier|undefined} value
|
||||
* @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setCharacterUsername = function(value) {
|
||||
return jspb.Message.setProto3StringField(this, 1, value);
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setCharacter = function(value) {
|
||||
return jspb.Message.setWrapperField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional int32 character_id = 2;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getCharacterId = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* Clears the message field making it undefined.
|
||||
* @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setCharacterId = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 2, value);
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.clearCharacter = function() {
|
||||
return this.setCharacter(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional models.proto.cofd.CofdSheet.Skill skill = 3;
|
||||
* Returns whether this field is set.
|
||||
* @return {boolean}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.hasCharacter = function() {
|
||||
return jspb.Message.getField(this, 1) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional models.proto.cofd.CofdSheet.Skill skill = 2;
|
||||
* @return {?proto.models.proto.cofd.CofdSheet.Skill}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getSkill = function() {
|
||||
return /** @type{?proto.models.proto.cofd.CofdSheet.Skill} */ (
|
||||
jspb.Message.getWrapperField(this, cofd_pb.CofdSheet.Skill, 3));
|
||||
jspb.Message.getWrapperField(this, cofd_pb.CofdSheet.Skill, 2));
|
||||
};
|
||||
|
||||
|
||||
|
@ -1244,7 +1226,7 @@ proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getSkill = function() {
|
|||
* @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setSkill = function(value) {
|
||||
return jspb.Message.setWrapperField(this, 3, value);
|
||||
return jspb.Message.setWrapperField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1262,7 +1244,7 @@ proto.models.proto.cofd.api.UpdateSkillRequest.prototype.clearSkill = function()
|
|||
* @return {boolean}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillRequest.prototype.hasSkill = function() {
|
||||
return jspb.Message.getField(this, 3) != null;
|
||||
return jspb.Message.getField(this, 2) != null;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1298,10 +1280,9 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.toObject = functio
|
|||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
characterUsername: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
||||
characterId: jspb.Message.getFieldWithDefault(msg, 2, 0),
|
||||
skillName: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
||||
skillValue: jspb.Message.getFieldWithDefault(msg, 4, 0)
|
||||
character: (f = msg.getCharacter()) && proto.models.proto.cofd.api.CharacterIdentifier.toObject(includeInstance, f),
|
||||
skillName: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
||||
skillValue: jspb.Message.getFieldWithDefault(msg, 3, 0)
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
|
@ -1339,18 +1320,15 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.deserializeBinaryFromReader
|
|||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setCharacterUsername(value);
|
||||
var value = new proto.models.proto.cofd.api.CharacterIdentifier;
|
||||
reader.readMessage(value,proto.models.proto.cofd.api.CharacterIdentifier.deserializeBinaryFromReader);
|
||||
msg.setCharacter(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {number} */ (reader.readInt32());
|
||||
msg.setCharacterId(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setSkillName(value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
var value = /** @type {number} */ (reader.readInt32());
|
||||
msg.setSkillValue(value);
|
||||
break;
|
||||
|
@ -1383,31 +1361,25 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.serializeBinary =
|
|||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.serializeBinaryToWriter = function(message, writer) {
|
||||
var f = undefined;
|
||||
f = message.getCharacterUsername();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
f = message.getCharacter();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getCharacterId();
|
||||
if (f !== 0) {
|
||||
writer.writeInt32(
|
||||
2,
|
||||
f
|
||||
f,
|
||||
proto.models.proto.cofd.api.CharacterIdentifier.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = message.getSkillName();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
3,
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getSkillValue();
|
||||
if (f !== 0) {
|
||||
writer.writeInt32(
|
||||
4,
|
||||
3,
|
||||
f
|
||||
);
|
||||
}
|
||||
|
@ -1415,47 +1387,48 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.serializeBinaryToWriter = fu
|
|||
|
||||
|
||||
/**
|
||||
* optional string character_username = 1;
|
||||
* @return {string}
|
||||
* optional CharacterIdentifier character = 1;
|
||||
* @return {?proto.models.proto.cofd.api.CharacterIdentifier}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getCharacterUsername = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getCharacter = function() {
|
||||
return /** @type{?proto.models.proto.cofd.api.CharacterIdentifier} */ (
|
||||
jspb.Message.getWrapperField(this, proto.models.proto.cofd.api.CharacterIdentifier, 1));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {?proto.models.proto.cofd.api.CharacterIdentifier|undefined} value
|
||||
* @return {!proto.models.proto.cofd.api.UpdateSkillValueRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.setCharacterUsername = function(value) {
|
||||
return jspb.Message.setProto3StringField(this, 1, value);
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.setCharacter = function(value) {
|
||||
return jspb.Message.setWrapperField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional int32 character_id = 2;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getCharacterId = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* Clears the message field making it undefined.
|
||||
* @return {!proto.models.proto.cofd.api.UpdateSkillValueRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.setCharacterId = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 2, value);
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.clearCharacter = function() {
|
||||
return this.setCharacter(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string skill_name = 3;
|
||||
* Returns whether this field is set.
|
||||
* @return {boolean}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.hasCharacter = function() {
|
||||
return jspb.Message.getField(this, 1) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string skill_name = 2;
|
||||
* @return {string}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getSkillName = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
||||
};
|
||||
|
||||
|
||||
|
@ -1464,16 +1437,16 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getSkillName = fun
|
|||
* @return {!proto.models.proto.cofd.api.UpdateSkillValueRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.setSkillName = function(value) {
|
||||
return jspb.Message.setProto3StringField(this, 3, value);
|
||||
return jspb.Message.setProto3StringField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional int32 skill_value = 4;
|
||||
* optional int32 skill_value = 3;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getSkillValue = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
|
||||
};
|
||||
|
||||
|
||||
|
@ -1482,7 +1455,7 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.getSkillValue = fu
|
|||
* @return {!proto.models.proto.cofd.api.UpdateSkillValueRequest} returns this
|
||||
*/
|
||||
proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.setSkillValue = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 4, value);
|
||||
return jspb.Message.setProto3IntField(this, 3, value);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@ import * as api from "../api";
|
|||
const attribute = input.id;
|
||||
const newValue = parseInt(input.value);
|
||||
const params = new UpdateAttributeRequest();
|
||||
params.setCharacterUsername(USERNAME);
|
||||
params.setCharacterId(parseInt(CHARACTER_ID));
|
||||
params.setCharacter(characterId());
|
||||
params.setAttributeName(attribute);
|
||||
params.setAttributeValue(newValue);
|
||||
let resp = await api.updateAttributeValue(params);
|
||||
|
@ -59,8 +58,7 @@ import * as api from "../api";
|
|||
const newValue = parseInt(input.value);
|
||||
|
||||
const params = new UpdateSkillValueRequest();
|
||||
params.setCharacterUsername(USERNAME);
|
||||
params.setCharacterId(parseInt(CHARACTER_ID));
|
||||
params.setCharacter(characterId());
|
||||
params.setSkillName(attribute);
|
||||
params.setSkillValue(newValue);
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ pub(super) async fn update_attribute_value(
|
|||
let mut character = load_character(
|
||||
&conn,
|
||||
logged_in_user,
|
||||
&req.character_username,
|
||||
req.character_id,
|
||||
&req.character.owner(),
|
||||
req.character.id(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
@ -109,8 +109,8 @@ pub(super) async fn update_skill<'a>(
|
|||
let mut character = load_character(
|
||||
&conn,
|
||||
logged_in_user,
|
||||
&skill_update.character_username,
|
||||
skill_update.character_id,
|
||||
&skill_update.character.owner(),
|
||||
skill_update.character.id(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
@ -132,26 +132,25 @@ pub(super) async fn update_skill<'a>(
|
|||
Ok("lol")
|
||||
}
|
||||
|
||||
#[post("/rpc/cofd/update_skill_value", data = "<request>")]
|
||||
#[post("/rpc/cofd/update_skill_value", data = "<req>")]
|
||||
pub(super) async fn update_skill_value<'a>(
|
||||
request: Proto<UpdateSkillValueRequest>,
|
||||
req: Proto<UpdateSkillValueRequest>,
|
||||
conn: TenebrousDbConn<'_>,
|
||||
logged_in_user: Option<&User>,
|
||||
) -> Result<Proto<ApiResult>, Error> {
|
||||
println!("{:#?}", request);
|
||||
let mut character = load_character(
|
||||
&conn,
|
||||
logged_in_user,
|
||||
&request.character_username,
|
||||
request.character_id,
|
||||
&req.character.owner(),
|
||||
req.character.id(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let mut sheet: CofdSheet = character.try_deserialize()?;
|
||||
|
||||
let mut skill: Option<&mut Skill> = find_skill(&mut sheet, &request.skill_name);
|
||||
let mut skill: Option<&mut Skill> = find_skill(&mut sheet, &req.skill_name);
|
||||
if let Some(ref mut s) = skill {
|
||||
s.dots = request.skill_value;
|
||||
s.dots = req.skill_value;
|
||||
}
|
||||
|
||||
println!("updated skill value");
|
||||
|
|
Loading…
Reference in New Issue