diff --git a/README.md b/README.md index 65cf797..d8efa95 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ # FoundryVTT - Shadows Over Sol -**STILL IN ALPHA, DO NOT USE IT !!** - Shadows Over Sol ( https://www.tabcreations.com/shadows-over-sol/ ) implementation for FoundryVTT . This system is developed under authorization of Tab Creations. Shadows Over Sol is Property of Tab Creations, all related copyright belongs to Tab Creations. -**STILL IN ALPHA, DO NOT USE IT !!** diff --git a/img/icons/.directory b/img/icons/.directory index 8a192c3..86db330 100644 --- a/img/icons/.directory +++ b/img/icons/.directory @@ -1,5 +1,6 @@ [Dolphin] -Timestamp=2021,3,12,15,41,28.086 +SortRole=creationtime +Timestamp=2021,3,12,18,53,49.303 Version=4 ViewMode=1 VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails diff --git a/img/icons/skill_xp.svg b/img/icons/skill_xp.svg new file mode 100644 index 0000000..9e985d1 --- /dev/null +++ b/img/icons/skill_xp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/module/actor.js b/module/actor.js index 9db2a28..ef4d45f 100644 --- a/module/actor.js +++ b/module/actor.js @@ -160,6 +160,11 @@ export class SoSActor extends Actor { return Math.ceil( (this.data.data.stats.strength.value + this.data.data.stats.endurance.value) / 2) + this.data.data.scores.wound.bonusmalus; } + /* -------------------------------------------- */ + getSkillExperience( skillName ) { + return this.data.items.filter( item => item.type == 'skillexperience' && item.data.skill == skillName); + } + /* -------------------------------------------- */ async wornObject( itemID) { let item = this.getOwnedItem(itemID); @@ -262,13 +267,15 @@ export class SoSActor extends Actor { selectedStat: 'strength', consequencesList: duplicate( this.getApplicableConsequences() ), wounds: duplicate( this.data.data.wounds), + skillExperienceList: this.getSkillExperience( skill.name), skill: duplicate(skill), actor: this, modifierList: SoSUtility.fillRange(-10, +10), tnList: SoSUtility.fillRange(6, 20), malusConsequence: 0, bonusConsequence: 0, - woundMalus: 0 + woundMalus: 0, + bonusSkillXP: 0 } flipData.statList['nostat'] = { label: "No stat (ie defaulting skills)", value: 0, cardsuit: "none" } let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html', flipData); @@ -297,6 +304,7 @@ export class SoSActor extends Actor { target: target, selectedStat: selectedStatName, consequencesList: duplicate( this.getApplicableConsequences() ), + skillExperienceList: this.getSkillExperience( skill.name), wounds: duplicate( this.data.data.wounds), skill: duplicate(skill), actor: this, @@ -304,7 +312,8 @@ export class SoSActor extends Actor { tnList: SoSUtility.fillRange(6, 20), malusConsequence: 0, bonusConsequence: 0, - woundMalus: 0 + woundMalus: 0, + bonusSkillXP: 0 } console.log(flipData); diff --git a/module/item-sheet.js b/module/item-sheet.js index c480b1a..cfb5067 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -45,7 +45,12 @@ export class SoSItemSheet extends ItemSheet { async getData() { let data = super.getData(); data.isGM = game.user.isGM; - + if ( data.item.type == 'skillexperience') { + data.skillList = await SoSUtility.loadCompendiumNames("foundryvtt-shadows-over-sol.skills"); + } + if ( data.item.type == 'skill' && this.object.options?.actor) { + data.skillExperienceList = this.object.options.actor.getSkillExperience( data.item.name ); + } return data; } @@ -57,6 +62,19 @@ export class SoSItemSheet extends ItemSheet { // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; + // Update Inventory Item + html.find('.item-edit').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + const item = this.object.options.actor.getOwnedItem(li.data("item-id")); + console.log("ITEM", item, li.data("item-id"), li); + item.sheet.render(true); + }); + // Update Inventory Item + html.find('.item-delete').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + this.object.options.actor.deleteOwnedItem( li.data("item-id") ).then( this.render(true)); + //this.render(true); + }); } diff --git a/module/sos-flip-dialog.js b/module/sos-flip-dialog.js index 77ad360..e13e2b2 100644 --- a/module/sos-flip-dialog.js +++ b/module/sos-flip-dialog.js @@ -43,6 +43,7 @@ export class SoSFlipDialog extends Dialog { scoreBase += this.flipData.malusConsequence; scoreBase += this.flipData.bonusConsequence; scoreBase += this.flipData.woundMalus; + scoreBase += this.flipData.bonusSkillXP; $('#wound-malus').text(this.flipData.woundMalus); $('#score-base').text( scoreBase); } @@ -74,7 +75,18 @@ export class SoSFlipDialog extends Dialog { }); } - + /* -------------------------------------------- */ + updateSkillXPBonus(event) { + this.flipData.skillXPSelected = $('#skillXPBonus').val(); + let bonusSkillXP = 0; + for (let skillXPId of this.flipData.skillXPSelected) { + bonusSkillXP += 1; + } + $('#skillxp-bonus').text(bonusSkillXP); + this.flipData.bonusSkillXP = bonusSkillXP; + this.updateScoreBase(); + } + /* -------------------------------------------- */ updateConsequenceMalus(event) { this.flipData.consequencesSelected = $('#consequenceSelectMalus').val(); @@ -122,7 +134,9 @@ export class SoSFlipDialog extends Dialog { html.find('#statSelect').change((event) => { this.updateFlip(dialog.flipData ); } ); - + html.find('#skillXPBonus').change((event) => { + this.updateSkillXPBonus( event ); + } ); html.find('#consequenceSelectMalus').change((event) => { this.updateConsequenceMalus( event ); } ); diff --git a/module/sos-utility.js b/module/sos-utility.js index ea96998..c855925 100644 --- a/module/sos-utility.js +++ b/module/sos-utility.js @@ -34,7 +34,7 @@ export class SoSUtility extends Entity { static fillRange (start, end) { return Array(end - start + 1).fill().map((item, index) => start + index); } - + /* -------------------------------------------- */ static onSocketMesssage( msg ) { if( !game.user.isGM ) return; // Only GM diff --git a/system.json b/system.json index 813e155..0145d50 100644 --- a/system.json +++ b/system.json @@ -2,11 +2,11 @@ "name": "foundryvtt-shadows-over-sol", "title": "Shadows over Sol", "description": "Shadows over Sol for FoundryVTT", - "version": "0.1.12", + "version": "0.1.13", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.9", - "templateVersion": 22, + "templateVersion": 23, "author": "LeRatierBretonnien", "esmodules": [ "module/sos-main.js" ], "styles": ["styles/simple.css"], diff --git a/template.json b/template.json index 1d46f73..ef19d57 100644 --- a/template.json +++ b/template.json @@ -145,7 +145,7 @@ }, "Item": { "types": ["gear", "weapon", "armor", "container", "skill", "language", "weakness", "geneline", - "subculture", "consequence", "action", "injury", "malady", "vehicle" ], + "subculture", "consequence", "action", "injury", "malady", "vehicle", "skillexperience"], "templates": { "commongear": { "big": 0, diff --git a/templates/dialog-flip.html b/templates/dialog-flip.html index f430505..957bd91 100644 --- a/templates/dialog-flip.html +++ b/templates/dialog-flip.html @@ -27,6 +27,18 @@ {{/if}} +
+
+ +

Skill XP Bonus : 0

+
+
-
  • - + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
    diff --git a/templates/item-skillexperience-sheet.html b/templates/item-skillexperience-sheet.html new file mode 100644 index 0000000..8d8562d --- /dev/null +++ b/templates/item-skillexperience-sheet.html @@ -0,0 +1,34 @@ +
    +
    + +
    +

    +
    +
    + + {{!-- Sheet Body --}} +
    + +
    +
    + +
    + +
    +
    +
    + +
    + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
    +
    +
    + +
    +