From ea4723cbe598634c44dfc2ca10d02bb508a72e8b Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 10 Jan 2021 13:56:44 +0000 Subject: [PATCH] Add API endpoint for updating basic character info. --- proto/cofd.proto | 60 +-- proto/cofd_api.proto | 13 +- src/frontend/_proto/cofd_api_pb.d.ts | 8 + src/frontend/_proto/cofd_api_pb.js | 132 +++++-- src/frontend/_proto/cofd_pb.d.ts | 24 +- src/frontend/_proto/cofd_pb.js | 534 ++++++++++++++++----------- src/models/proto/cofd.rs | 10 + src/routes/api/cofd.rs | 19 +- 8 files changed, 500 insertions(+), 300 deletions(-) diff --git a/proto/cofd.proto b/proto/cofd.proto index 323e73f..a539cbd 100644 --- a/proto/cofd.proto +++ b/proto/cofd.proto @@ -57,43 +57,47 @@ message CofdSheet { } string name = 1; - string player = 2; - string campaign = 3; - string description = 4; + string gender = 2; + string concept = 3; + int32 age = 4; - int32 strength = 6; - int32 dexterity = 7; - int32 stamina = 8; + string player = 5; + string chronicle = 6; + string description = 7; - int32 intelligence = 9; - int32 wits = 10; - int32 resolve = 11; + int32 strength = 8; + int32 dexterity = 9; + int32 stamina = 10; - int32 presence = 12; - int32 manipulation = 13; - int32 composure = 14; + int32 intelligence = 11; + int32 wits = 12; + int32 resolve = 13; - map physical_skills = 16; - map mental_skills = 17; - map social_skills = 18; + int32 presence = 14; + int32 manipulation = 15; + int32 composure = 16; - repeated Merit merits = 15; - repeated Condition conditions = 19; + map physical_skills = 17; + map mental_skills = 18; + map social_skills = 19; - int32 size = 20; - int32 health = 21; - int32 willpower = 22; - int32 experience_points = 23; - int32 beats = 24; + repeated Merit merits = 20; + repeated Condition conditions = 21; - repeated Item items = 25; - repeated Attack attacks = 26; + int32 size = 22; + int32 health = 23; + int32 willpower = 24; + int32 experience_points = 25; + int32 beats = 26; - map other_data = 27; + repeated Item items = 27; + repeated Attack attacks = 28; + + map other_data = 29; oneof system_fields { - CoreFields core = 28; - MageFields mage = 29; - ChangelingFields changeling = 30; + CoreFields core = 30; + MageFields mage = 31; + ChangelingFields changeling = 32; } } diff --git a/proto/cofd_api.proto b/proto/cofd_api.proto index a84186f..8116b4f 100644 --- a/proto/cofd_api.proto +++ b/proto/cofd_api.proto @@ -7,11 +7,14 @@ package models.proto.cofd.api; //derivative system) character sheet. This is a straight overwrite of //all basic information on the sheet. message UpdateBasicInfoRequest { - string name = 1; - string gender = 2; - string concept = 3; - string chronicle = 4; - int32 age = 5; + string owner = 1; + int32 character_id = 2; + + string name = 3; + string gender = 4; + string concept = 5; + string chronicle = 6; + int32 age = 7; } //Generic "did something succeed or not" response. diff --git a/src/frontend/_proto/cofd_api_pb.d.ts b/src/frontend/_proto/cofd_api_pb.d.ts index 5e5909e..2360f96 100644 --- a/src/frontend/_proto/cofd_api_pb.d.ts +++ b/src/frontend/_proto/cofd_api_pb.d.ts @@ -5,6 +5,12 @@ import * as jspb from "google-protobuf"; import * as cofd_pb from "./cofd_pb"; export class UpdateBasicInfoRequest extends jspb.Message { + getOwner(): string; + setOwner(value: string): void; + + getCharacterId(): number; + setCharacterId(value: number): void; + getName(): string; setName(value: string): void; @@ -32,6 +38,8 @@ export class UpdateBasicInfoRequest extends jspb.Message { export namespace UpdateBasicInfoRequest { export type AsObject = { + owner: string, + characterId: number, name: string, gender: string, concept: string, diff --git a/src/frontend/_proto/cofd_api_pb.js b/src/frontend/_proto/cofd_api_pb.js index 040db7c..c7cecbe 100644 --- a/src/frontend/_proto/cofd_api_pb.js +++ b/src/frontend/_proto/cofd_api_pb.js @@ -224,11 +224,13 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.toObject = function */ proto.models.proto.cofd.api.UpdateBasicInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - gender: jspb.Message.getFieldWithDefault(msg, 2, ""), - concept: jspb.Message.getFieldWithDefault(msg, 3, ""), - chronicle: jspb.Message.getFieldWithDefault(msg, 4, ""), - age: jspb.Message.getFieldWithDefault(msg, 5, 0) + owner: jspb.Message.getFieldWithDefault(msg, 1, ""), + characterId: jspb.Message.getFieldWithDefault(msg, 2, 0), + name: jspb.Message.getFieldWithDefault(msg, 3, ""), + gender: jspb.Message.getFieldWithDefault(msg, 4, ""), + concept: jspb.Message.getFieldWithDefault(msg, 5, ""), + chronicle: jspb.Message.getFieldWithDefault(msg, 6, ""), + age: jspb.Message.getFieldWithDefault(msg, 7, 0) }; if (includeInstance) { @@ -267,21 +269,29 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.deserializeBinaryFromReader = switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); - msg.setName(value); + msg.setOwner(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setGender(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setCharacterId(value); break; case 3: var value = /** @type {string} */ (reader.readString()); - msg.setConcept(value); + msg.setName(value); break; case 4: var value = /** @type {string} */ (reader.readString()); - msg.setChronicle(value); + msg.setGender(value); break; case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setConcept(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setChronicle(value); + break; + case 7: var value = /** @type {number} */ (reader.readInt32()); msg.setAge(value); break; @@ -314,38 +324,52 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.serializeBinary = f */ proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getName(); + f = message.getOwner(); if (f.length > 0) { writer.writeString( 1, f ); } - f = message.getGender(); - if (f.length > 0) { - writer.writeString( + f = message.getCharacterId(); + if (f !== 0) { + writer.writeInt32( 2, f ); } - f = message.getConcept(); + f = message.getName(); if (f.length > 0) { writer.writeString( 3, f ); } - f = message.getChronicle(); + f = message.getGender(); if (f.length > 0) { writer.writeString( 4, f ); } + f = message.getConcept(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getChronicle(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } f = message.getAge(); if (f !== 0) { writer.writeInt32( - 5, + 7, f ); } @@ -353,10 +377,10 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter = fun /** - * optional string name = 1; + * optional string owner = 1; * @return {string} */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getOwner = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -365,34 +389,34 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function( * @param {string} value * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setName = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setOwner = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** - * optional string gender = 2; - * @return {string} + * optional int32 character_id = 2; + * @return {number} */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getGender = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getCharacterId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {string} value + * @param {number} value * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setGender = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setCharacterId = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional string concept = 3; + * optional string name = 3; * @return {string} */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; @@ -401,16 +425,16 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = functi * @param {string} value * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setConcept = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; /** - * optional string chronicle = 4; + * optional string gender = 4; * @return {string} */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getGender = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -419,17 +443,53 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = func * @param {string} value * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setChronicle = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setGender = function(value) { return jspb.Message.setProto3StringField(this, 4, value); }; /** - * optional int32 age = 5; + * optional string concept = 5; + * @return {string} + */ +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this + */ +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setConcept = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string chronicle = 6; + * @return {string} + */ +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this + */ +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setChronicle = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional int32 age = 7; * @return {number} */ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getAge = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); }; @@ -438,7 +498,7 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getAge = function() * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setAge = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); + return jspb.Message.setProto3IntField(this, 7, value); }; diff --git a/src/frontend/_proto/cofd_pb.d.ts b/src/frontend/_proto/cofd_pb.d.ts index 1d2e169..9eadada 100644 --- a/src/frontend/_proto/cofd_pb.d.ts +++ b/src/frontend/_proto/cofd_pb.d.ts @@ -67,11 +67,20 @@ export class CofdSheet extends jspb.Message { getName(): string; setName(value: string): void; + getGender(): string; + setGender(value: string): void; + + getConcept(): string; + setConcept(value: string): void; + + getAge(): number; + setAge(value: number): void; + getPlayer(): string; setPlayer(value: string): void; - getCampaign(): string; - setCampaign(value: string): void; + getChronicle(): string; + setChronicle(value: string): void; getDescription(): string; setDescription(value: string): void; @@ -175,8 +184,11 @@ export class CofdSheet extends jspb.Message { export namespace CofdSheet { export type AsObject = { name: string, + gender: string, + concept: string, + age: number, player: string, - campaign: string, + chronicle: string, description: string, strength: number, dexterity: number, @@ -353,9 +365,9 @@ export namespace CofdSheet { export enum SystemFieldsCase { SYSTEM_FIELDS_NOT_SET = 0, - CORE = 28, - MAGE = 29, - CHANGELING = 30, + CORE = 30, + MAGE = 31, + CHANGELING = 32, } } diff --git a/src/frontend/_proto/cofd_pb.js b/src/frontend/_proto/cofd_pb.js index 5a617ef..68f7213 100644 --- a/src/frontend/_proto/cofd_pb.js +++ b/src/frontend/_proto/cofd_pb.js @@ -609,7 +609,7 @@ proto.models.proto.cofd.ChangelingFields.prototype.setClarity = function(value) * @private {!Array} * @const */ -proto.models.proto.cofd.CofdSheet.repeatedFields_ = [15,19,25,26]; +proto.models.proto.cofd.CofdSheet.repeatedFields_ = [20,21,27,28]; /** * Oneof group definitions for this message. Each group defines the field @@ -619,16 +619,16 @@ proto.models.proto.cofd.CofdSheet.repeatedFields_ = [15,19,25,26]; * @private {!Array>} * @const */ -proto.models.proto.cofd.CofdSheet.oneofGroups_ = [[28,29,30]]; +proto.models.proto.cofd.CofdSheet.oneofGroups_ = [[30,31,32]]; /** * @enum {number} */ proto.models.proto.cofd.CofdSheet.SystemFieldsCase = { SYSTEM_FIELDS_NOT_SET: 0, - CORE: 28, - MAGE: 29, - CHANGELING: 30 + CORE: 30, + MAGE: 31, + CHANGELING: 32 }; /** @@ -670,18 +670,21 @@ proto.models.proto.cofd.CofdSheet.prototype.toObject = function(opt_includeInsta proto.models.proto.cofd.CofdSheet.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), - player: jspb.Message.getFieldWithDefault(msg, 2, ""), - campaign: jspb.Message.getFieldWithDefault(msg, 3, ""), - description: jspb.Message.getFieldWithDefault(msg, 4, ""), - strength: jspb.Message.getFieldWithDefault(msg, 6, 0), - dexterity: jspb.Message.getFieldWithDefault(msg, 7, 0), - stamina: jspb.Message.getFieldWithDefault(msg, 8, 0), - intelligence: jspb.Message.getFieldWithDefault(msg, 9, 0), - wits: jspb.Message.getFieldWithDefault(msg, 10, 0), - resolve: jspb.Message.getFieldWithDefault(msg, 11, 0), - presence: jspb.Message.getFieldWithDefault(msg, 12, 0), - manipulation: jspb.Message.getFieldWithDefault(msg, 13, 0), - composure: jspb.Message.getFieldWithDefault(msg, 14, 0), + gender: jspb.Message.getFieldWithDefault(msg, 2, ""), + concept: jspb.Message.getFieldWithDefault(msg, 3, ""), + age: jspb.Message.getFieldWithDefault(msg, 4, 0), + player: jspb.Message.getFieldWithDefault(msg, 5, ""), + chronicle: jspb.Message.getFieldWithDefault(msg, 6, ""), + description: jspb.Message.getFieldWithDefault(msg, 7, ""), + strength: jspb.Message.getFieldWithDefault(msg, 8, 0), + dexterity: jspb.Message.getFieldWithDefault(msg, 9, 0), + stamina: jspb.Message.getFieldWithDefault(msg, 10, 0), + intelligence: jspb.Message.getFieldWithDefault(msg, 11, 0), + wits: jspb.Message.getFieldWithDefault(msg, 12, 0), + resolve: jspb.Message.getFieldWithDefault(msg, 13, 0), + presence: jspb.Message.getFieldWithDefault(msg, 14, 0), + manipulation: jspb.Message.getFieldWithDefault(msg, 15, 0), + composure: jspb.Message.getFieldWithDefault(msg, 16, 0), physicalSkillsMap: (f = msg.getPhysicalSkillsMap()) ? f.toObject(includeInstance, proto.models.proto.cofd.CofdSheet.Skill.toObject) : [], mentalSkillsMap: (f = msg.getMentalSkillsMap()) ? f.toObject(includeInstance, proto.models.proto.cofd.CofdSheet.Skill.toObject) : [], socialSkillsMap: (f = msg.getSocialSkillsMap()) ? f.toObject(includeInstance, proto.models.proto.cofd.CofdSheet.Skill.toObject) : [], @@ -689,11 +692,11 @@ proto.models.proto.cofd.CofdSheet.toObject = function(includeInstance, msg) { proto.models.proto.cofd.CofdSheet.Merit.toObject, includeInstance), conditionsList: jspb.Message.toObjectList(msg.getConditionsList(), proto.models.proto.cofd.CofdSheet.Condition.toObject, includeInstance), - size: jspb.Message.getFieldWithDefault(msg, 20, 0), - health: jspb.Message.getFieldWithDefault(msg, 21, 0), - willpower: jspb.Message.getFieldWithDefault(msg, 22, 0), - experiencePoints: jspb.Message.getFieldWithDefault(msg, 23, 0), - beats: jspb.Message.getFieldWithDefault(msg, 24, 0), + size: jspb.Message.getFieldWithDefault(msg, 22, 0), + health: jspb.Message.getFieldWithDefault(msg, 23, 0), + willpower: jspb.Message.getFieldWithDefault(msg, 24, 0), + experiencePoints: jspb.Message.getFieldWithDefault(msg, 25, 0), + beats: jspb.Message.getFieldWithDefault(msg, 26, 0), itemsList: jspb.Message.toObjectList(msg.getItemsList(), proto.models.proto.cofd.CofdSheet.Item.toObject, includeInstance), attacksList: jspb.Message.toObjectList(msg.getAttacksList(), @@ -744,127 +747,139 @@ proto.models.proto.cofd.CofdSheet.deserializeBinaryFromReader = function(msg, re break; case 2: var value = /** @type {string} */ (reader.readString()); - msg.setPlayer(value); + msg.setGender(value); break; case 3: var value = /** @type {string} */ (reader.readString()); - msg.setCampaign(value); + msg.setConcept(value); break; case 4: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAge(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setPlayer(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setChronicle(value); + break; + case 7: var value = /** @type {string} */ (reader.readString()); msg.setDescription(value); break; - case 6: + case 8: var value = /** @type {number} */ (reader.readInt32()); msg.setStrength(value); break; - case 7: + case 9: var value = /** @type {number} */ (reader.readInt32()); msg.setDexterity(value); break; - case 8: + case 10: var value = /** @type {number} */ (reader.readInt32()); msg.setStamina(value); break; - case 9: + case 11: var value = /** @type {number} */ (reader.readInt32()); msg.setIntelligence(value); break; - case 10: + case 12: var value = /** @type {number} */ (reader.readInt32()); msg.setWits(value); break; - case 11: + case 13: var value = /** @type {number} */ (reader.readInt32()); msg.setResolve(value); break; - case 12: + case 14: var value = /** @type {number} */ (reader.readInt32()); msg.setPresence(value); break; - case 13: + case 15: var value = /** @type {number} */ (reader.readInt32()); msg.setManipulation(value); break; - case 14: + case 16: var value = /** @type {number} */ (reader.readInt32()); msg.setComposure(value); break; - case 16: + case 17: var value = msg.getPhysicalSkillsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.models.proto.cofd.CofdSheet.Skill.deserializeBinaryFromReader, "", new proto.models.proto.cofd.CofdSheet.Skill()); }); break; - case 17: + case 18: var value = msg.getMentalSkillsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.models.proto.cofd.CofdSheet.Skill.deserializeBinaryFromReader, "", new proto.models.proto.cofd.CofdSheet.Skill()); }); break; - case 18: + case 19: var value = msg.getSocialSkillsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.models.proto.cofd.CofdSheet.Skill.deserializeBinaryFromReader, "", new proto.models.proto.cofd.CofdSheet.Skill()); }); break; - case 15: + case 20: var value = new proto.models.proto.cofd.CofdSheet.Merit; reader.readMessage(value,proto.models.proto.cofd.CofdSheet.Merit.deserializeBinaryFromReader); msg.addMerits(value); break; - case 19: + case 21: var value = new proto.models.proto.cofd.CofdSheet.Condition; reader.readMessage(value,proto.models.proto.cofd.CofdSheet.Condition.deserializeBinaryFromReader); msg.addConditions(value); break; - case 20: + case 22: var value = /** @type {number} */ (reader.readInt32()); msg.setSize(value); break; - case 21: + case 23: var value = /** @type {number} */ (reader.readInt32()); msg.setHealth(value); break; - case 22: + case 24: var value = /** @type {number} */ (reader.readInt32()); msg.setWillpower(value); break; - case 23: + case 25: var value = /** @type {number} */ (reader.readInt32()); msg.setExperiencePoints(value); break; - case 24: + case 26: var value = /** @type {number} */ (reader.readInt32()); msg.setBeats(value); break; - case 25: + case 27: var value = new proto.models.proto.cofd.CofdSheet.Item; reader.readMessage(value,proto.models.proto.cofd.CofdSheet.Item.deserializeBinaryFromReader); msg.addItems(value); break; - case 26: + case 28: var value = new proto.models.proto.cofd.CofdSheet.Attack; reader.readMessage(value,proto.models.proto.cofd.CofdSheet.Attack.deserializeBinaryFromReader); msg.addAttacks(value); break; - case 27: + case 29: var value = msg.getOtherDataMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); }); break; - case 28: + case 30: var value = new proto.models.proto.cofd.CoreFields; reader.readMessage(value,proto.models.proto.cofd.CoreFields.deserializeBinaryFromReader); msg.setCore(value); break; - case 29: + case 31: var value = new proto.models.proto.cofd.MageFields; reader.readMessage(value,proto.models.proto.cofd.MageFields.deserializeBinaryFromReader); msg.setMage(value); break; - case 30: + case 32: var value = new proto.models.proto.cofd.ChangelingFields; reader.readMessage(value,proto.models.proto.cofd.ChangelingFields.deserializeBinaryFromReader); msg.setChangeling(value); @@ -905,106 +920,127 @@ proto.models.proto.cofd.CofdSheet.serializeBinaryToWriter = function(message, wr f ); } - f = message.getPlayer(); + f = message.getGender(); if (f.length > 0) { writer.writeString( 2, f ); } - f = message.getCampaign(); + f = message.getConcept(); if (f.length > 0) { writer.writeString( 3, f ); } + f = message.getAge(); + if (f !== 0) { + writer.writeInt32( + 4, + f + ); + } + f = message.getPlayer(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getChronicle(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } f = message.getDescription(); if (f.length > 0) { writer.writeString( - 4, + 7, f ); } f = message.getStrength(); if (f !== 0) { writer.writeInt32( - 6, + 8, f ); } f = message.getDexterity(); if (f !== 0) { writer.writeInt32( - 7, + 9, f ); } f = message.getStamina(); if (f !== 0) { writer.writeInt32( - 8, + 10, f ); } f = message.getIntelligence(); if (f !== 0) { writer.writeInt32( - 9, + 11, f ); } f = message.getWits(); if (f !== 0) { writer.writeInt32( - 10, + 12, f ); } f = message.getResolve(); if (f !== 0) { writer.writeInt32( - 11, + 13, f ); } f = message.getPresence(); if (f !== 0) { writer.writeInt32( - 12, + 14, f ); } f = message.getManipulation(); if (f !== 0) { writer.writeInt32( - 13, + 15, f ); } f = message.getComposure(); if (f !== 0) { writer.writeInt32( - 14, + 16, f ); } f = message.getPhysicalSkillsMap(true); if (f && f.getLength() > 0) { - f.serializeBinary(16, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.models.proto.cofd.CofdSheet.Skill.serializeBinaryToWriter); + f.serializeBinary(17, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.models.proto.cofd.CofdSheet.Skill.serializeBinaryToWriter); } f = message.getMentalSkillsMap(true); if (f && f.getLength() > 0) { - f.serializeBinary(17, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.models.proto.cofd.CofdSheet.Skill.serializeBinaryToWriter); + f.serializeBinary(18, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.models.proto.cofd.CofdSheet.Skill.serializeBinaryToWriter); } f = message.getSocialSkillsMap(true); if (f && f.getLength() > 0) { - f.serializeBinary(18, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.models.proto.cofd.CofdSheet.Skill.serializeBinaryToWriter); + f.serializeBinary(19, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.models.proto.cofd.CofdSheet.Skill.serializeBinaryToWriter); } f = message.getMeritsList(); if (f.length > 0) { writer.writeRepeatedMessage( - 15, + 20, f, proto.models.proto.cofd.CofdSheet.Merit.serializeBinaryToWriter ); @@ -1012,7 +1048,7 @@ proto.models.proto.cofd.CofdSheet.serializeBinaryToWriter = function(message, wr f = message.getConditionsList(); if (f.length > 0) { writer.writeRepeatedMessage( - 19, + 21, f, proto.models.proto.cofd.CofdSheet.Condition.serializeBinaryToWriter ); @@ -1020,42 +1056,42 @@ proto.models.proto.cofd.CofdSheet.serializeBinaryToWriter = function(message, wr f = message.getSize(); if (f !== 0) { writer.writeInt32( - 20, + 22, f ); } f = message.getHealth(); if (f !== 0) { writer.writeInt32( - 21, + 23, f ); } f = message.getWillpower(); if (f !== 0) { writer.writeInt32( - 22, + 24, f ); } f = message.getExperiencePoints(); if (f !== 0) { writer.writeInt32( - 23, + 25, f ); } f = message.getBeats(); if (f !== 0) { writer.writeInt32( - 24, + 26, f ); } f = message.getItemsList(); if (f.length > 0) { writer.writeRepeatedMessage( - 25, + 27, f, proto.models.proto.cofd.CofdSheet.Item.serializeBinaryToWriter ); @@ -1063,19 +1099,19 @@ proto.models.proto.cofd.CofdSheet.serializeBinaryToWriter = function(message, wr f = message.getAttacksList(); if (f.length > 0) { writer.writeRepeatedMessage( - 26, + 28, f, proto.models.proto.cofd.CofdSheet.Attack.serializeBinaryToWriter ); } f = message.getOtherDataMap(true); if (f && f.getLength() > 0) { - f.serializeBinary(27, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + f.serializeBinary(29, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); } f = message.getCore(); if (f != null) { writer.writeMessage( - 28, + 30, f, proto.models.proto.cofd.CoreFields.serializeBinaryToWriter ); @@ -1083,7 +1119,7 @@ proto.models.proto.cofd.CofdSheet.serializeBinaryToWriter = function(message, wr f = message.getMage(); if (f != null) { writer.writeMessage( - 29, + 31, f, proto.models.proto.cofd.MageFields.serializeBinaryToWriter ); @@ -1091,7 +1127,7 @@ proto.models.proto.cofd.CofdSheet.serializeBinaryToWriter = function(message, wr f = message.getChangeling(); if (f != null) { writer.writeMessage( - 30, + 32, f, proto.models.proto.cofd.ChangelingFields.serializeBinaryToWriter ); @@ -2124,10 +2160,10 @@ proto.models.proto.cofd.CofdSheet.prototype.setName = function(value) { /** - * optional string player = 2; + * optional string gender = 2; * @return {string} */ -proto.models.proto.cofd.CofdSheet.prototype.getPlayer = function() { +proto.models.proto.cofd.CofdSheet.prototype.getGender = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; @@ -2136,16 +2172,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getPlayer = function() { * @param {string} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setPlayer = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setGender = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** - * optional string campaign = 3; + * optional string concept = 3; * @return {string} */ -proto.models.proto.cofd.CofdSheet.prototype.getCampaign = function() { +proto.models.proto.cofd.CofdSheet.prototype.getConcept = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; @@ -2154,17 +2190,71 @@ proto.models.proto.cofd.CofdSheet.prototype.getCampaign = function() { * @param {string} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setCampaign = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setConcept = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; /** - * optional string description = 4; + * optional int32 age = 4; + * @return {number} + */ +proto.models.proto.cofd.CofdSheet.prototype.getAge = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setAge = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional string player = 5; + * @return {string} + */ +proto.models.proto.cofd.CofdSheet.prototype.getPlayer = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setPlayer = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string chronicle = 6; + * @return {string} + */ +proto.models.proto.cofd.CofdSheet.prototype.getChronicle = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setChronicle = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional string description = 7; * @return {string} */ proto.models.proto.cofd.CofdSheet.prototype.getDescription = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); }; @@ -2173,51 +2263,15 @@ proto.models.proto.cofd.CofdSheet.prototype.getDescription = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setDescription = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); + return jspb.Message.setProto3StringField(this, 7, value); }; /** - * optional int32 strength = 6; + * optional int32 strength = 8; * @return {number} */ proto.models.proto.cofd.CofdSheet.prototype.getStrength = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.CofdSheet} returns this - */ -proto.models.proto.cofd.CofdSheet.prototype.setStrength = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); -}; - - -/** - * optional int32 dexterity = 7; - * @return {number} - */ -proto.models.proto.cofd.CofdSheet.prototype.getDexterity = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.CofdSheet} returns this - */ -proto.models.proto.cofd.CofdSheet.prototype.setDexterity = function(value) { - return jspb.Message.setProto3IntField(this, 7, value); -}; - - -/** - * optional int32 stamina = 8; - * @return {number} - */ -proto.models.proto.cofd.CofdSheet.prototype.getStamina = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); }; @@ -2226,16 +2280,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getStamina = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setStamina = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setStrength = function(value) { return jspb.Message.setProto3IntField(this, 8, value); }; /** - * optional int32 intelligence = 9; + * optional int32 dexterity = 9; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getIntelligence = function() { +proto.models.proto.cofd.CofdSheet.prototype.getDexterity = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); }; @@ -2244,16 +2298,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getIntelligence = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setIntelligence = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setDexterity = function(value) { return jspb.Message.setProto3IntField(this, 9, value); }; /** - * optional int32 wits = 10; + * optional int32 stamina = 10; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getWits = function() { +proto.models.proto.cofd.CofdSheet.prototype.getStamina = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); }; @@ -2262,16 +2316,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getWits = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setWits = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setStamina = function(value) { return jspb.Message.setProto3IntField(this, 10, value); }; /** - * optional int32 resolve = 11; + * optional int32 intelligence = 11; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getResolve = function() { +proto.models.proto.cofd.CofdSheet.prototype.getIntelligence = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); }; @@ -2280,16 +2334,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getResolve = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setResolve = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setIntelligence = function(value) { return jspb.Message.setProto3IntField(this, 11, value); }; /** - * optional int32 presence = 12; + * optional int32 wits = 12; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getPresence = function() { +proto.models.proto.cofd.CofdSheet.prototype.getWits = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); }; @@ -2298,16 +2352,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getPresence = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setPresence = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setWits = function(value) { return jspb.Message.setProto3IntField(this, 12, value); }; /** - * optional int32 manipulation = 13; + * optional int32 resolve = 13; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getManipulation = function() { +proto.models.proto.cofd.CofdSheet.prototype.getResolve = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); }; @@ -2316,16 +2370,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getManipulation = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setManipulation = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setResolve = function(value) { return jspb.Message.setProto3IntField(this, 13, value); }; /** - * optional int32 composure = 14; + * optional int32 presence = 14; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getComposure = function() { +proto.models.proto.cofd.CofdSheet.prototype.getPresence = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); }; @@ -2334,20 +2388,56 @@ proto.models.proto.cofd.CofdSheet.prototype.getComposure = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setComposure = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setPresence = function(value) { return jspb.Message.setProto3IntField(this, 14, value); }; /** - * map physical_skills = 16; + * optional int32 manipulation = 15; + * @return {number} + */ +proto.models.proto.cofd.CofdSheet.prototype.getManipulation = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 15, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setManipulation = function(value) { + return jspb.Message.setProto3IntField(this, 15, value); +}; + + +/** + * optional int32 composure = 16; + * @return {number} + */ +proto.models.proto.cofd.CofdSheet.prototype.getComposure = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 16, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setComposure = function(value) { + return jspb.Message.setProto3IntField(this, 16, value); +}; + + +/** + * map physical_skills = 17; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.models.proto.cofd.CofdSheet.prototype.getPhysicalSkillsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 16, opt_noLazyCreate, + jspb.Message.getMapField(this, 17, opt_noLazyCreate, proto.models.proto.cofd.CofdSheet.Skill)); }; @@ -2362,14 +2452,14 @@ proto.models.proto.cofd.CofdSheet.prototype.clearPhysicalSkillsMap = function() /** - * map mental_skills = 17; + * map mental_skills = 18; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.models.proto.cofd.CofdSheet.prototype.getMentalSkillsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 17, opt_noLazyCreate, + jspb.Message.getMapField(this, 18, opt_noLazyCreate, proto.models.proto.cofd.CofdSheet.Skill)); }; @@ -2384,14 +2474,14 @@ proto.models.proto.cofd.CofdSheet.prototype.clearMentalSkillsMap = function() { /** - * map social_skills = 18; + * map social_skills = 19; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.models.proto.cofd.CofdSheet.prototype.getSocialSkillsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 18, opt_noLazyCreate, + jspb.Message.getMapField(this, 19, opt_noLazyCreate, proto.models.proto.cofd.CofdSheet.Skill)); }; @@ -2406,12 +2496,12 @@ proto.models.proto.cofd.CofdSheet.prototype.clearSocialSkillsMap = function() { /** - * repeated Merit merits = 15; + * repeated Merit merits = 20; * @return {!Array} */ proto.models.proto.cofd.CofdSheet.prototype.getMeritsList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Merit, 15)); + jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Merit, 20)); }; @@ -2420,7 +2510,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getMeritsList = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setMeritsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 15, value); + return jspb.Message.setRepeatedWrapperField(this, 20, value); }; @@ -2430,7 +2520,7 @@ proto.models.proto.cofd.CofdSheet.prototype.setMeritsList = function(value) { * @return {!proto.models.proto.cofd.CofdSheet.Merit} */ proto.models.proto.cofd.CofdSheet.prototype.addMerits = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 15, opt_value, proto.models.proto.cofd.CofdSheet.Merit, opt_index); + return jspb.Message.addToRepeatedWrapperField(this, 20, opt_value, proto.models.proto.cofd.CofdSheet.Merit, opt_index); }; @@ -2444,12 +2534,12 @@ proto.models.proto.cofd.CofdSheet.prototype.clearMeritsList = function() { /** - * repeated Condition conditions = 19; + * repeated Condition conditions = 21; * @return {!Array} */ proto.models.proto.cofd.CofdSheet.prototype.getConditionsList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Condition, 19)); + jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Condition, 21)); }; @@ -2458,7 +2548,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getConditionsList = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setConditionsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 19, value); + return jspb.Message.setRepeatedWrapperField(this, 21, value); }; @@ -2468,7 +2558,7 @@ proto.models.proto.cofd.CofdSheet.prototype.setConditionsList = function(value) * @return {!proto.models.proto.cofd.CofdSheet.Condition} */ proto.models.proto.cofd.CofdSheet.prototype.addConditions = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 19, opt_value, proto.models.proto.cofd.CofdSheet.Condition, opt_index); + return jspb.Message.addToRepeatedWrapperField(this, 21, opt_value, proto.models.proto.cofd.CofdSheet.Condition, opt_index); }; @@ -2482,46 +2572,10 @@ proto.models.proto.cofd.CofdSheet.prototype.clearConditionsList = function() { /** - * optional int32 size = 20; + * optional int32 size = 22; * @return {number} */ proto.models.proto.cofd.CofdSheet.prototype.getSize = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 20, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.CofdSheet} returns this - */ -proto.models.proto.cofd.CofdSheet.prototype.setSize = function(value) { - return jspb.Message.setProto3IntField(this, 20, value); -}; - - -/** - * optional int32 health = 21; - * @return {number} - */ -proto.models.proto.cofd.CofdSheet.prototype.getHealth = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 21, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.CofdSheet} returns this - */ -proto.models.proto.cofd.CofdSheet.prototype.setHealth = function(value) { - return jspb.Message.setProto3IntField(this, 21, value); -}; - - -/** - * optional int32 willpower = 22; - * @return {number} - */ -proto.models.proto.cofd.CofdSheet.prototype.getWillpower = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 22, 0)); }; @@ -2530,16 +2584,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getWillpower = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setWillpower = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setSize = function(value) { return jspb.Message.setProto3IntField(this, 22, value); }; /** - * optional int32 experience_points = 23; + * optional int32 health = 23; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getExperiencePoints = function() { +proto.models.proto.cofd.CofdSheet.prototype.getHealth = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 23, 0)); }; @@ -2548,16 +2602,16 @@ proto.models.proto.cofd.CofdSheet.prototype.getExperiencePoints = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setExperiencePoints = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setHealth = function(value) { return jspb.Message.setProto3IntField(this, 23, value); }; /** - * optional int32 beats = 24; + * optional int32 willpower = 24; * @return {number} */ -proto.models.proto.cofd.CofdSheet.prototype.getBeats = function() { +proto.models.proto.cofd.CofdSheet.prototype.getWillpower = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 24, 0)); }; @@ -2566,18 +2620,54 @@ proto.models.proto.cofd.CofdSheet.prototype.getBeats = function() { * @param {number} value * @return {!proto.models.proto.cofd.CofdSheet} returns this */ -proto.models.proto.cofd.CofdSheet.prototype.setBeats = function(value) { +proto.models.proto.cofd.CofdSheet.prototype.setWillpower = function(value) { return jspb.Message.setProto3IntField(this, 24, value); }; /** - * repeated Item items = 25; + * optional int32 experience_points = 25; + * @return {number} + */ +proto.models.proto.cofd.CofdSheet.prototype.getExperiencePoints = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 25, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setExperiencePoints = function(value) { + return jspb.Message.setProto3IntField(this, 25, value); +}; + + +/** + * optional int32 beats = 26; + * @return {number} + */ +proto.models.proto.cofd.CofdSheet.prototype.getBeats = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 26, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.CofdSheet} returns this + */ +proto.models.proto.cofd.CofdSheet.prototype.setBeats = function(value) { + return jspb.Message.setProto3IntField(this, 26, value); +}; + + +/** + * repeated Item items = 27; * @return {!Array} */ proto.models.proto.cofd.CofdSheet.prototype.getItemsList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Item, 25)); + jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Item, 27)); }; @@ -2586,7 +2676,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getItemsList = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setItemsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 25, value); + return jspb.Message.setRepeatedWrapperField(this, 27, value); }; @@ -2596,7 +2686,7 @@ proto.models.proto.cofd.CofdSheet.prototype.setItemsList = function(value) { * @return {!proto.models.proto.cofd.CofdSheet.Item} */ proto.models.proto.cofd.CofdSheet.prototype.addItems = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 25, opt_value, proto.models.proto.cofd.CofdSheet.Item, opt_index); + return jspb.Message.addToRepeatedWrapperField(this, 27, opt_value, proto.models.proto.cofd.CofdSheet.Item, opt_index); }; @@ -2610,12 +2700,12 @@ proto.models.proto.cofd.CofdSheet.prototype.clearItemsList = function() { /** - * repeated Attack attacks = 26; + * repeated Attack attacks = 28; * @return {!Array} */ proto.models.proto.cofd.CofdSheet.prototype.getAttacksList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Attack, 26)); + jspb.Message.getRepeatedWrapperField(this, proto.models.proto.cofd.CofdSheet.Attack, 28)); }; @@ -2624,7 +2714,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getAttacksList = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setAttacksList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 26, value); + return jspb.Message.setRepeatedWrapperField(this, 28, value); }; @@ -2634,7 +2724,7 @@ proto.models.proto.cofd.CofdSheet.prototype.setAttacksList = function(value) { * @return {!proto.models.proto.cofd.CofdSheet.Attack} */ proto.models.proto.cofd.CofdSheet.prototype.addAttacks = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 26, opt_value, proto.models.proto.cofd.CofdSheet.Attack, opt_index); + return jspb.Message.addToRepeatedWrapperField(this, 28, opt_value, proto.models.proto.cofd.CofdSheet.Attack, opt_index); }; @@ -2648,14 +2738,14 @@ proto.models.proto.cofd.CofdSheet.prototype.clearAttacksList = function() { /** - * map other_data = 27; + * map other_data = 29; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.models.proto.cofd.CofdSheet.prototype.getOtherDataMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 27, opt_noLazyCreate, + jspb.Message.getMapField(this, 29, opt_noLazyCreate, null)); }; @@ -2670,12 +2760,12 @@ proto.models.proto.cofd.CofdSheet.prototype.clearOtherDataMap = function() { /** - * optional CoreFields core = 28; + * optional CoreFields core = 30; * @return {?proto.models.proto.cofd.CoreFields} */ proto.models.proto.cofd.CofdSheet.prototype.getCore = function() { return /** @type{?proto.models.proto.cofd.CoreFields} */ ( - jspb.Message.getWrapperField(this, proto.models.proto.cofd.CoreFields, 28)); + jspb.Message.getWrapperField(this, proto.models.proto.cofd.CoreFields, 30)); }; @@ -2684,7 +2774,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getCore = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setCore = function(value) { - return jspb.Message.setOneofWrapperField(this, 28, proto.models.proto.cofd.CofdSheet.oneofGroups_[0], value); + return jspb.Message.setOneofWrapperField(this, 30, proto.models.proto.cofd.CofdSheet.oneofGroups_[0], value); }; @@ -2702,17 +2792,17 @@ proto.models.proto.cofd.CofdSheet.prototype.clearCore = function() { * @return {boolean} */ proto.models.proto.cofd.CofdSheet.prototype.hasCore = function() { - return jspb.Message.getField(this, 28) != null; + return jspb.Message.getField(this, 30) != null; }; /** - * optional MageFields mage = 29; + * optional MageFields mage = 31; * @return {?proto.models.proto.cofd.MageFields} */ proto.models.proto.cofd.CofdSheet.prototype.getMage = function() { return /** @type{?proto.models.proto.cofd.MageFields} */ ( - jspb.Message.getWrapperField(this, proto.models.proto.cofd.MageFields, 29)); + jspb.Message.getWrapperField(this, proto.models.proto.cofd.MageFields, 31)); }; @@ -2721,7 +2811,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getMage = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setMage = function(value) { - return jspb.Message.setOneofWrapperField(this, 29, proto.models.proto.cofd.CofdSheet.oneofGroups_[0], value); + return jspb.Message.setOneofWrapperField(this, 31, proto.models.proto.cofd.CofdSheet.oneofGroups_[0], value); }; @@ -2739,17 +2829,17 @@ proto.models.proto.cofd.CofdSheet.prototype.clearMage = function() { * @return {boolean} */ proto.models.proto.cofd.CofdSheet.prototype.hasMage = function() { - return jspb.Message.getField(this, 29) != null; + return jspb.Message.getField(this, 31) != null; }; /** - * optional ChangelingFields changeling = 30; + * optional ChangelingFields changeling = 32; * @return {?proto.models.proto.cofd.ChangelingFields} */ proto.models.proto.cofd.CofdSheet.prototype.getChangeling = function() { return /** @type{?proto.models.proto.cofd.ChangelingFields} */ ( - jspb.Message.getWrapperField(this, proto.models.proto.cofd.ChangelingFields, 30)); + jspb.Message.getWrapperField(this, proto.models.proto.cofd.ChangelingFields, 32)); }; @@ -2758,7 +2848,7 @@ proto.models.proto.cofd.CofdSheet.prototype.getChangeling = function() { * @return {!proto.models.proto.cofd.CofdSheet} returns this */ proto.models.proto.cofd.CofdSheet.prototype.setChangeling = function(value) { - return jspb.Message.setOneofWrapperField(this, 30, proto.models.proto.cofd.CofdSheet.oneofGroups_[0], value); + return jspb.Message.setOneofWrapperField(this, 32, proto.models.proto.cofd.CofdSheet.oneofGroups_[0], value); }; @@ -2776,7 +2866,7 @@ proto.models.proto.cofd.CofdSheet.prototype.clearChangeling = function() { * @return {boolean} */ proto.models.proto.cofd.CofdSheet.prototype.hasChangeling = function() { - return jspb.Message.getField(this, 30) != null; + return jspb.Message.getField(this, 32) != null; }; diff --git a/src/models/proto/cofd.rs b/src/models/proto/cofd.rs index cc98d1f..4e1e023 100644 --- a/src/models/proto/cofd.rs +++ b/src/models/proto/cofd.rs @@ -13,6 +13,16 @@ tonic::include_proto!("models.proto.cofd"); pub mod api { //include!(concat!(env!("OUT_DIR"), "/models.proto.cofd.api.rs")); tonic::include_proto!("models.proto.cofd.api"); + + /// Helpers for the ApiResult class. + impl ApiResult { + pub fn success() -> Self { + ApiResult { + success: true, + error: "".to_string(), + } + } + } } /// Default mental skill names for a regular Chronicles of Darkness diff --git a/src/routes/api/cofd.rs b/src/routes/api/cofd.rs index 5553502..10a1c1f 100644 --- a/src/routes/api/cofd.rs +++ b/src/routes/api/cofd.rs @@ -37,9 +37,22 @@ fn find_skill<'a>(sheet: &'a mut CofdSheet, skill_name: &'a str) -> Option<&'a m find_skill_entry(sheet, skill_name).map(|entry| entry.into_mut()) } -#[post("/rpc/cofd/update_basic_info", data = "")] -pub(super) fn update_basic_info<'a>(info: Proto) -> &'a str { - "lol" +#[post("/rpc/cofd/update_basic_info", data = "")] +pub(super) async fn update_basic_info<'a>( + req: Proto, + conn: TenebrousDbConn<'_>, + logged_in_user: Option<&User>, +) -> Result, Error> { + let mut character = load_character(&conn, logged_in_user, &req.owner, req.character_id).await?; + let mut sheet: CofdSheet = character.try_deserialize()?; + + sheet.name = req.name.clone(); + sheet.gender = req.gender.clone(); + sheet.concept = req.concept.clone(); + + character.update_data(&sheet)?; + conn.update_character_sheet(&character).await?; + Ok(Proto(ApiResult::success())) } #[post("/rpc/cofd/update_attribute_value", data = "")]