diff --git a/lang/en.json b/lang/en.json index 1a205ab..85f13a6 100644 --- a/lang/en.json +++ b/lang/en.json @@ -151,7 +151,7 @@ "DG.Tooltip.SkillLabel": "Click to roll a skill check.", "DG.Tooltip.CannotRollSkillLabel": "A skill at 0% cannot be used. See page 28 of the Agent's Handbook.", "DG.Tooltip.SkillFailCheckbox": "After failing a test on this skill (if proficiency is at least 1%), check this box. At the end of the session, add 1D4 percentage points to the skill and uncheck the box. Does not apply to the Unnatural or Ritual skill. See page 29 of the Agent's Handbook.", - "DG.Tooltip.DistinguishingFeature": "Distinguishing Feature (fill out if score is 12 or higher, or 8 or lower).", + "DG.Tooltip.DistinguishingFeature": "Distinguishing Feature (fill out if score is 13 or higher, or 8 or lower).", "DG.Tooltip.x5AttributeLabel": "Click to roll a x5 check.", "DG.Tooltip.FirstAidAttempted": "Once an agent receives first aid, they cannot benefit from it again until they receive further damage from a different source.", "DG.Tooltip.AdaptedToViolence": "Being adapted to violence means your Agent’s empathy suffers as they come to view violence as nothing but another tool to be wielded. He or she permanently loses 1D6 CHA and the same amount from each of their Bonds.", diff --git a/lang/es.json b/lang/es.json index 2fcc7d4..0446f20 100644 --- a/lang/es.json +++ b/lang/es.json @@ -151,7 +151,7 @@ "DG.Tooltip.SkillLabel": "Click para hacer una tirada de habilidad.", "DG.Tooltip.CannotRollSkillLabel": "No se puede usar una habilidad al 0%. Consulte la página 28 del Manual del Agente.", "DG.Tooltip.SkillFailCheckbox": "Después de fallar una prueba sobre esta habilidad (si el dominio es de al menos 1%), marque esta casilla. Al final de la sesión, agregue puntos porcentuales 1D4-1 a la habilidad y desmarque la casilla. No se aplica a la habilidad Antinatural. Consulte la página 29 del Manual del Agente.", - "DG.Tooltip.DistinguishingFeature": "Característica Distintiva (rellene si la puntuación es 12 o superior, u 8 o inferior).", + "DG.Tooltip.DistinguishingFeature": "Característica Distintiva (rellene si la puntuación es 13 o superior, u 8 o inferior).", "DG.Tooltip.x5AttributeLabel": "Click para una tirada x5.", "DG.Tooltip.FirstAidAttempted": "Una vez que un agente recibe primeros auxilios, no puede beneficiarse de él de nuevo hasta que reciba más daños de una fuente diferente.", "DG.Tooltip.AdaptedToViolence": "Adaptarse a la violencia significa que la empatía de su agente sufre al ser testigo de tanta violencia. Pierde permanentemente 1D6 CAR y la misma cantidad de cada uno de sus vínculos.", diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 4d61e79..ce7f9d9 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -35,10 +35,11 @@ export class DeltaGreenActorSheet extends ActorSheet { const data = super.getData(); // Prepare items. - if (this.actor.data.type == 'character') { + if (this.actor.data.type == 'agent') { this._prepareCharacterItems(data); } - + //console.log(data); + //return data.data; return data; } @@ -56,9 +57,6 @@ export class DeltaGreenActorSheet extends ActorSheet { const armor = []; const weapons = []; - // total armor rating - let armorRating = 0; - // Iterate through items, allocating to containers // let totalWeight = 0; for (let i of sheetData.items) { @@ -146,14 +144,19 @@ export class DeltaGreenActorSheet extends ActorSheet { // Update Inventory Item html.find('.item-edit').click(ev => { const li = $(ev.currentTarget).parents(".item"); - const item = this.actor.getOwnedItem(li.data("itemId")); + //const item = this.actor.getOwnedItem(li.data("itemId")); + const item = this.actor.items.get(li.data("itemId")); item.sheet.render(true); }); // Delete Inventory Item html.find('.item-delete').click(ev => { const li = $(ev.currentTarget).parents(".item"); - this.actor.deleteOwnedItem(li.data("itemId")); + + //this.actor.deleteOwnedItem(li.data("itemId")); + let options = {}; + this.actor.deleteEmbeddedDocuments("Item", [li.data("itemId")], options); + li.slideUp(200, () => this.render(false)); }); @@ -165,7 +168,7 @@ export class DeltaGreenActorSheet extends ActorSheet { html.find('.equipped-item').mousedown(this._onEquippedStatusChange.bind(this)); // Drag events for macros. - if (this.actor.owner) { + if (this.actor.isOwner) { let handler = ev => this._onDragStart(ev); html.find('li.item').each((i, li) => { if (li.classList.contains("inventory-header")) return; @@ -277,6 +280,7 @@ export class DeltaGreenActorSheet extends ActorSheet { type: type, data: data }; + // Remove the type from the dataset since it's in the itemData.type prop. delete itemData.data["type"]; @@ -293,7 +297,8 @@ export class DeltaGreenActorSheet extends ActorSheet { } // Finally, create the item! - return this.actor.createOwnedItem(itemData); + //return this.actor.createOwnedItem(itemData); + return this.actor.createEmbeddedDocuments("Item", [itemData]); } /** @@ -395,7 +400,8 @@ export class DeltaGreenActorSheet extends ActorSheet { const dataset = element.dataset; try{ - const item = this.actor.getOwnedItem(dataset.id); + //const item = this.actor.getOwnedItem(dataset.id); + const item = this.actor.items.get(dataset.id); var isEquipped = item.data.data.equipped; isEquipped = !isEquipped; item.update({data:{equipped: isEquipped}}); diff --git a/module/actor/actor.js b/module/actor/actor.js index 52d12c1..ebcdcf0 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -14,9 +14,14 @@ export class DeltaGreenActor extends Actor { const data = actorData.data; const flags = actorData.flags; + //console.log('actor.js prepareData'); + //console.log(this); + // Make separate methods for each Actor type (character, npc, etc.) to keep // things organized. - if (actorData.type === 'agent') this._prepareAgentData(this); + if (actorData.type === 'agent'){ + this._prepareAgentData(this); + } } /** diff --git a/module/deltagreen.js b/module/deltagreen.js index 7f378ec..28a24a6 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -99,15 +99,22 @@ Hooks.once('init', async function() { }); Handlebars.registerHelper('getActorSkillProp', function(actorData, skillName, prop) { - if(skillName != "" && prop != ""){ - let skills = actorData.skills; - let skill = skills[skillName]; - let propVal = skill[prop]; - return propVal; + try{ + if(skillName != "" && prop != ""){ + let skills = actorData.data.skills; + let skill = skills[skillName]; + let propVal = skill[prop]; + return propVal; + } + else{ + return ""; + } } - else{ + catch(ex){ + console.log(ex); return ""; } + }); // looks at system setting for what font to use and returns the class that is then used in the handlebars template that diff --git a/module/roll/roll.js b/module/roll/roll.js index b3329ec..897fa14 100644 --- a/module/roll/roll.js +++ b/module/roll/roll.js @@ -1,7 +1,7 @@ import {localizeWithFallback} from "../other/utility-functions.js" export function sendPercentileTestToChat(actor, skill, target){ - let roll = new Roll('1D100', actor.data.data).roll(); + let roll = new Roll('1D100', actor.data.data).evaluate(false); let total = roll.total; let isCritical = false; let isSuccess = false; @@ -96,7 +96,7 @@ export function sendPercentileTestToChat(actor, skill, target){ speaker: ChatMessage.getSpeaker({actor: actor}), content: html, flavor: label, - type: CHAT_MESSAGE_TYPES.ROLL, + type: 5, //CHAT_MESSAGE_TYPES.ROLL, roll: roll, rollMode: game.settings.get("core", "rollMode") }; @@ -123,7 +123,7 @@ export function skillCheckResultIsCritical(rollResult){ } export function sendLethalityTestToChat(actor, weaponName, target){ - let roll = new Roll('1D100', actor.data.data).roll(); + let roll = new Roll('1D100', actor.data.data).evaluate(false); let isCritical = false; let skillCheckTotal = roll.total; @@ -202,7 +202,7 @@ export function sendLethalityTestToChat(actor, weaponName, target){ speaker: ChatMessage.getSpeaker({actor: actor}), content: html, flavor: label, - type: CHAT_MESSAGE_TYPES.ROLL, + type: 5, //CHAT_MESSAGE_TYPES.ROLL, roll: roll, rollMode: game.settings.get("core", "rollMode") }; @@ -223,10 +223,10 @@ export function sendDamageRollToChat(actor, label, diceFormula){ label = `Rolling DAMAGE for ${label.toUpperCase()}` } - roll.roll().toMessage({ + roll.evaluate(false).toMessage({ speaker: ChatMessage.getSpeaker({ actor: actor }), flavor: label, - type: CHAT_MESSAGE_TYPES.ROLL, + type: 5, //CHAT_MESSAGE_TYPES.ROLL, roll: roll, rollMode: game.settings.get("core", "rollMode") }); diff --git a/packs/firearms.db b/packs/firearms.db index 2820fdc..6b7c072 100644 --- a/packs/firearms.db +++ b/packs/firearms.db @@ -4,6 +4,7 @@ {"_id":"7TSuCYbhLeHIRpod","name":"Light Pistol","permission":{"default":0,"bugxCCxa4GzlYx2g":3},"type":"weapon","data":{"name":"","description":"

Revolver capacity: 6. Examples: .22 LR, .32 ACP, .380 ACP, .38 Special: S&W Model 36 Chief’s Special, Walther PPK.

","skill":"firearms","range":"10M","damage":"1D8","armorPiercing":0,"lethality":0,"isLethal":false,"killRadius":"","ammo":"20","expense":"Standard"},"flags":{},"img":"systems/deltagreen/assets/icons/walther-ppk.svg"} {"_id":"DruzlEXzmEMSwoSq","name":"Shotgun (Firing Slug)","permission":{"default":0,"bugxCCxa4GzlYx2g":3},"type":"weapon","data":{"name":"","description":"

Examples (12-gauge): Mossberg Model 500, Remington Model 870, Ruger Red Label. Double-barrel capacity: 2.

","skill":"firearms","range":"75M","damage":"2D6","armorPiercing":0,"lethality":0,"isLethal":false,"killRadius":"","ammo":"20","expense":"Standard"},"flags":{},"img":"systems/deltagreen/assets/icons/sawed-off-shotgun.svg"} {"_id":"Zh1TVVNUFBxfxAOc","name":"Shotgun (Firing Shot)","permission":{"default":0,"bugxCCxa4GzlYx2g":3},"type":"weapon","data":{"name":"","description":"

Full damage up to 20 m; 2D6 from 21 to 50 m; 1D6 beyond beyond 50 m.

\n

Examples (12-gauge): Mossberg Model 500, Remington Model 870, Ruger Red Label. Double-barrel capacity: 2.

","skill":"firearms","range":"50M","damage":"2d10","armorPiercing":0,"lethality":0,"isLethal":false,"killRadius":"","ammo":"20","expense":"Standard"},"flags":{},"img":"systems/deltagreen/assets/icons/sawed-off-shotgun.svg"} +{"name":"Shotgun (Firing Shot)","type":"weapon","img":"systems/deltagreen/assets/icons/sawed-off-shotgun.svg","data":{"name":"","description":"

Full damage up to 20 m; 2D6 from 21 to 50 m; 1D6 beyond beyond 50 m.

\n

Examples (12-gauge): Mossberg Model 500, Remington Model 870, Ruger Red Label. Double-barrel capacity: 2.

","skill":"firearms","range":"50M","damage":"2d10","armorPiercing":0,"lethality":0,"isLethal":false,"killRadius":"","ammo":"20","expense":"Standard"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"bugxCCxa4GzlYx2g":3},"flags":{"core":{"sourceId":"Compendium.deltagreen.firearms.Zh1TVVNUFBxfxAOc"}},"_id":"ZyOe653MI3bPZwQ0"} {"name":"Rifle (Very Heavy)","permission":{"default":0,"bugxCCxa4GzlYx2g":3},"type":"weapon","data":{"name":"","description":"

Use lethality rating (10%) if firing bursts.  Heavier rounds inflict 1D12+1 damage.

","skill":"firearms","range":"250M","damage":"2D10","armorPiercing":5,"lethality":20,"isLethal":true,"killRadius":"N/A","ammo":"","expense":"Major"},"flags":{},"img":"systems/deltagreen/assets/icons/fn-fal.svg","_id":"ccNHepyVZVb6p49U"} {"_id":"mvGLbgOB9TeGBfhr","name":"Heavy Pistol","permission":{"default":0,"bugxCCxa4GzlYx2g":3},"type":"weapon","data":{"name":"","description":"

Revolver capacity: 6. Examples: 10×25mm Auto, .357 Magnum, .44 Magnum, .50 AE: Colt Delta Elite, Glock 20, S&W Model 13.

","skill":"firearms","range":"20M","damage":"1D12","armorPiercing":0,"lethality":0,"isLethal":false,"killRadius":"","ammo":"20","expense":"Standard"},"flags":{},"img":"systems/deltagreen/assets/icons/desert-eagle.svg"} {"_id":"oQhWip2JTJYY18fS","name":"Shotgun (Firing Nonlethal)","permission":{"default":0,"bugxCCxa4GzlYx2g":3},"type":"weapon","data":{"name":"","description":"

Target stunned on a hit (along with damage).

","skill":"firearms","range":"10M","damage":"1D6","armorPiercing":0,"lethality":0,"isLethal":false,"killRadius":"","ammo":"20","expense":"Standard"},"flags":{},"img":"systems/deltagreen/assets/icons/sawed-off-shotgun.svg"} diff --git a/system.json b/system.json index 5a59cd4..b48c085 100644 --- a/system.json +++ b/system.json @@ -2,9 +2,9 @@ "name": "deltagreen", "title": "Delta Green (Unofficial)", "description": "Fan-made Foundry VTT system for Delta Green: The Role Playing Game for Foundry VTT. Based on the rules in the Agent's Handbook (https://www.drivethrurpg.com/product/181674/Delta-Green-Agents-Handbook). Made with the permission of but neither affiliated with nor endorsed by Arc Dream Publishing or the Delta Green Partnership.", - "version": "0.9.9", - "minimumCoreVersion": "0.6.2", - "compatibleCoreVersion": "0.7.9", + "version": "1.0.0", + "minimumCoreVersion": "0.8.1", + "compatibleCoreVersion": "0.8.1", "templateVersion": 2, "author": "TheLastScrub (https://github.com/TheLastScrub)", "esmodules": ["module/deltagreen.js"], diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 9aeabcd..8975827 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -13,22 +13,22 @@

-

+

- + {{!-- HP --}}
- +
- + /
-
{{numberFormat data.health.max decimals=0 sign=false}}
+
{{numberFormat actor.data.data.health.max decimals=0 sign=false}}
@@ -37,11 +37,11 @@
- + /
-
{{numberFormat data.wp.max decimals=0 sign=false}}
+
{{numberFormat actor.data.data.wp.max decimals=0 sign=false}}
@@ -52,10 +52,10 @@ data-rolltype="sanity" data-roll="d100" data-target="sanity" data-label="SAN" title="{{localize 'DG.Tooltip.SanityLabel'}}" >{{localize 'DG.Attributes.SAN' }}
- + /
-
{{numberFormat data.sanity.max decimals=0 sign=false}}
+
{{numberFormat actor.data.data.sanity.max decimals=0 sign=false}}
@@ -80,7 +80,7 @@ {{!-- Skills Tab --}}
- {{#each data.skills as |skill key|}} + {{#each actor.data.data.skills as |skill key|}}
- {{#each data.typedSkills as |skill key|}} + {{#each actor.data.data.typedSkills as |skill key|}}
diff --git a/templates/item/item-motivation-sheet.html b/templates/item/item-motivation-sheet.html index 8b867a8..0a815ca 100644 --- a/templates/item/item-motivation-sheet.html +++ b/templates/item/item-motivation-sheet.html @@ -13,7 +13,7 @@
-
@@ -25,7 +25,7 @@ title="{{localize 'DG.ItemWindow.Motivations.MotivationNameTooltip'}}" {{!-- If a motivation has been crossed off after a breaking point, do a strikeout on it and disable it. --}} - {{#if data.crossedOut}} + {{#if data.data.crossedOut}} style="text-decoration: line-through;" disabled {{/if}} @@ -33,18 +33,18 @@
{{!-- Only Show the Disorders Section if Motivation Lost Checked --}} - {{#if data.crossedOut}} + {{#if data.data.crossedOut}}
-
-
@@ -54,7 +54,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item/item-sheet.html b/templates/item/item-sheet.html deleted file mode 100644 index 1871b4c..0000000 --- a/templates/item/item-sheet.html +++ /dev/null @@ -1,29 +0,0 @@ -{{!-- I don't actually use this file, but leaving it around for now --}} -
-
- -
-

-
-
- - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} -
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} -
- - {{!-- Attributes Tab --}} -
- {{!-- As you add new fields, add them in here! --}} -
-
-
diff --git a/templates/item/item-weapon-sheet.html b/templates/item/item-weapon-sheet.html index 4d3fc10..d2c5c72 100644 --- a/templates/item/item-weapon-sheet.html +++ b/templates/item/item-weapon-sheet.html @@ -7,69 +7,67 @@
-
- {{#unless data.isLethal}} + {{#unless data.data.isLethal}}
- +
{{/unless}} - {{#if data.isLethal}} + {{#if data.data.isLethal}}
-
{{/if}} - -
- +
- +
- +
- +
@@ -86,7 +84,7 @@ {{!-- Description Tab --}}
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}