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