Skip to content

Commit

Permalink
Merge pull request #19 from crash1115/dev
Browse files Browse the repository at this point in the history
v0.4.1
  • Loading branch information
crash1115 authored Jul 26, 2020
2 parents ad612ac + 1f327de commit d59ac7d
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 47 deletions.
11 changes: 6 additions & 5 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# Change Log

## Version 0.4.1
Improvements:
- Added a description field to the add/edit dialogs so you can add notes to your downtime activities. Clicking the activity's name on the downtime tab will display the notes.
- Changed the default option in dialogs from 'No' to 'Yes' so hitting Enter submits the dialog rather than closing it.

## Version 0.4.0
New Features:
- Added a DC progression type. This is a hybrid between Simple and Ability Check types. When you create a downtime item of this type, you can select the number of successes required to complete the activity, a skill or ability associated with it, and the DC of the check. Passing the check will increase the success count by one. Failing the check will not increase it.

Improvements:
- You can now select skills when selecting what kind of ability check to roll for Ability Check progression

## Version 0.3.2
Improvements:
- Added some missing Korean language translation keys, courtesy of KLO#1490

## Version 0.3.2
## Version 0.3.3
Improvements:
- Added some missing Korean language translation keys, courtesy of KLO#1490

Expand Down
2 changes: 2 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"C5ETRAINING.Delete": "Delete",
"C5ETRAINING.DeleteConfirmation": "Are you sure you want to delete this item?",
"C5ETRAINING.DeleteDowntimeActivity": "Delete Downtime Activity",
"C5ETRAINING.Description": "Description",
"C5ETRAINING.Disadvantage": "Disadvantage",
"C5ETRAINING.Dismiss": "Dismiss",
"C5ETRAINING.DismissSelected": "Dismiss Selected",
Expand Down Expand Up @@ -106,6 +107,7 @@
"C5ETRAINING.SuccessesRequired": "Successes Required",

"C5ETRAINING.Time": "Time (UTC)",
"C5ETRAINING.ToggleInfo": "Toggle Info",

"C5ETRAINING.User": "User"
}
7 changes: 5 additions & 2 deletions lang/missing/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"C5ETRAINING.CheckDC": "Check DC",
"C5ETRAINING.Custom": "Custom",
"C5ETRAINING.CustomRoll": "Custom Roll",

"C5ETRAINING.DC": "DC",
"C5ETRAINING.DefaultDcDifficulty": "Default Check Difficulty (DC)",
"C5ETRAINING.DefaultDcDifficultyHint": "Sets the default DC for ability checks used by downtime activities using the DC progression system. Defaults to 10.",
"C5ETRAINING.DefaultDcSuccesses": "Default Activity Completion Target (DC)",
"C5ETRAINING.DefaultDcSuccessesHint": "Sets the default target number of check successes required to reach 100% activity completion for downtime activities using the DC progression system. The default is 5 successes.",
"C5ETRAINING.Description": "Description",

"C5ETRAINING.Roll": "Roll",

Expand All @@ -34,5 +35,7 @@
"C5ETRAINING.SkillSlt": "Sleight of Hand",
"C5ETRAINING.SkillSte": "Stealth",
"C5ETRAINING.SkillSur": "Survival",
"C5ETRAINING.SuccessesRequired": "Successes Required"
"C5ETRAINING.SuccessesRequired": "Successes Required",

"C5ETRAINING.ToggleInfo": "Toggle Info"
}
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "5e-training",
"title": "Crash's 5e Downtime Tracking",
"description": "Adds a section to the character sheet to keep track of downtime activity progression. Track proficiency training, spell scribing, and anything else you can think of.",
"version": "0.4.0",
"version": "0.4.1",
"author": "CRASH1115#2944",
"minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.7.0",
Expand All @@ -23,5 +23,5 @@
],
"url": "https://github.com/crash1115/5e-training",
"manifest": "https://raw.githubusercontent.com/crash1115/5e-training/master/module.json",
"download": "https://github.com/crash1115/5e-training/releases/download/v0.4.0/5e-training.zip"
"download": "https://github.com/crash1115/5e-training/releases/download/v0.4.1/5e-training.zip"
}
5 changes: 5 additions & 0 deletions styles/training.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
/* DIALOGS */
/*****************************/

.training-dialog .wide-field {
margin-bottom: 10px;
padding-top: 5px;
}

.training-dialog .field {
display: flex;
margin-bottom: 10px;
Expand Down
6 changes: 6 additions & 0 deletions templates/add-training-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
<option value="dc" {{#if (eq training.progressionStyle "dc")}} selected {{/if}}>{{ localize "C5ETRAINING.DC" }}</option>
</select>
</div>

<div class="wide-field">
<label for="description">{{ localize "C5ETRAINING.Description" }}:</label>
<textarea name="descriptionInput" id="descriptionInput">{{training.description}}</textarea>
</div>

</form>
6 changes: 6 additions & 0 deletions templates/training-details-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@
{{#if (eq training.progressionStyle "dc")}}
{{> "modules/5e-training/templates/partials/dc.html" training=training}}
{{/if}}

<div class="wide-field">
<label for="description">{{ localize "C5ETRAINING.Description" }}:</label>
<textarea name="descriptionInput" id="descriptionInput">{{training.description}}</textarea>
</div>

</form>
6 changes: 3 additions & 3 deletions templates/training-section.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ <h3 class="item-name flexrow">{{ localize 'C5ETRAINING.ActivityProgress' }}</h3>
<ol class="item-list">
{{#each actor.flags.5e-training.trainingItems as |training tid| }}
<li class="item flexrow">
<div class="item-name flexrow rollable training-roll" id="roll-{{tid}}" title="{{ localize 'C5ETRAINING.AdvanceActivityProgress' }}">
<div class="item-image" style="background-image: url(icons/svg/d20.svg);"></div>
<h4>{{training.name}}</h4>
<div class="item-name flexrow">
<div class="item-image rollable training-roll" id="roll-{{tid}}" title="{{ localize 'C5ETRAINING.AdvanceActivityProgress' }}" style="background-image: url(icons/svg/d20.svg);"></div>
<h4 class="rollable training-toggle-desc" id="toggle-desc-{{tid}}" title="{{ localize 'C5ETRAINING.ToggleInfo' }}">{{training.name}}</h4>
</div>
<div class="item-detail type">
{{progressionStyle training}}
Expand Down
99 changes: 64 additions & 35 deletions training.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ async function addTrainingTab(app, html, data) {
let newActivity = {
name: game.i18n.localize("C5ETRAINING.NewDowntimeActivity"),
progress: 0,
description: "",
changes: [],
progressionStyle: 'ability'
};
Expand All @@ -209,12 +210,13 @@ async function addTrainingTab(app, html, data) {
yes: {icon: "<i class='fas fa-check'></i>", label: game.i18n.localize("C5ETRAINING.Create"), callback: () => add = true},
no: {icon: "<i class='fas fa-times'></i>", label: game.i18n.localize("C5ETRAINING.Cancel"), callback: () => add = false},
},
default: "no",
default: "yes",
close: html => {
if (add) {
// Set up basic info
newActivity.name = html.find('#nameInput').val();
newActivity.progressionStyle = html.find('#progressionStyleInput').val();
newActivity.description = html.find('#descriptionInput').val();
// Progression Type: Ability Check
if (newActivity.progressionStyle == 'ability'){
newActivity.ability = game.settings.get("5e-training", "defaultAbility");
Expand All @@ -240,39 +242,6 @@ async function addTrainingTab(app, html, data) {
}).render(true);
});

// Remove Downtime Activity
html.find('.training-delete').click(async (event) => {
event.preventDefault();
console.log("Crash's 5e Downtime Tracking | Delete Downtime Activity excuted!");

// Set up some variables
let fieldId = event.currentTarget.id;
let trainingIdx = parseInt(fieldId.replace('delete-',''));
let activity = flags.trainingItems[trainingIdx];
let del = false;
let dialogContent = await renderTemplate('modules/5e-training/templates/delete-training-dialog.html');

// Create dialog
new Dialog({
title: `Delete Downtime Activity`,
content: dialogContent,
buttons: {
yes: {icon: "<i class='fas fa-check'></i>", label: game.i18n.localize("C5ETRAINING.Delete"), callback: () => del = true},
no: {icon: "<i class='fas fa-times'></i>", label: game.i18n.localize("C5ETRAINING.Cancel"), callback: () => del = false},
},
default: "no",
close: html => {
if (del) {
// Delete item and update actor
flags.trainingItems.splice(trainingIdx, 1);
actor.update({'flags.5e-training': null}).then(function(){
actor.update({'flags.5e-training': flags});
});
}
}
}).render(true);
});

// Edit Downtime Activity
html.find('.training-edit').click(async (event) => {
event.preventDefault();
Expand All @@ -293,11 +262,12 @@ async function addTrainingTab(app, html, data) {
yes: {icon: "<i class='fas fa-check'></i>", label: game.i18n.localize("C5ETRAINING.Edit"), callback: () => edit = true},
no: {icon: "<i class='fas fa-times'></i>", label: game.i18n.localize("C5ETRAINING.Cancel"), callback: () => edit = false},
},
default: "no",
default: "yes",
close: html => {
if (edit) {
// Set up base values
activity.name = html.find('#nameInput').val();
activity.description = html.find('#descriptionInput').val();
// Progression Style: Ability Check
if (activity.progressionStyle == 'ability'){
activity.completionAt = parseInt(html.find('#completionAtInput').val());
Expand All @@ -323,6 +293,39 @@ async function addTrainingTab(app, html, data) {
}).render(true);
});

// Remove Downtime Activity
html.find('.training-delete').click(async (event) => {
event.preventDefault();
console.log("Crash's 5e Downtime Tracking | Delete Downtime Activity excuted!");

// Set up some variables
let fieldId = event.currentTarget.id;
let trainingIdx = parseInt(fieldId.replace('delete-',''));
let activity = flags.trainingItems[trainingIdx];
let del = false;
let dialogContent = await renderTemplate('modules/5e-training/templates/delete-training-dialog.html');

// Create dialog
new Dialog({
title: `Delete Downtime Activity`,
content: dialogContent,
buttons: {
yes: {icon: "<i class='fas fa-check'></i>", label: game.i18n.localize("C5ETRAINING.Delete"), callback: () => del = true},
no: {icon: "<i class='fas fa-times'></i>", label: game.i18n.localize("C5ETRAINING.Cancel"), callback: () => del = false},
},
default: "yes",
close: html => {
if (del) {
// Delete item and update actor
flags.trainingItems.splice(trainingIdx, 1);
actor.update({'flags.5e-training': null}).then(function(){
actor.update({'flags.5e-training': flags});
});
}
}
}).render(true);
});

// Edit Progression Value
html.find('.training-override').change(async (event) => {
event.preventDefault();
Expand Down Expand Up @@ -425,6 +428,32 @@ async function addTrainingTab(app, html, data) {
}
});

// Toggle Information Display
// Modified version of _onItemSummary from dnd5e system located in
// dnd5e/module/actor/sheets/base.js
html.find('.training-toggle-desc').click(async (event) => {
event.preventDefault();
console.log("Crash's 5e Downtime Tracking | Toggle Acvtivity Info excuted!");

// Set up some variables
let fieldId = event.currentTarget.id;
let trainingIdx = parseInt(fieldId.replace('toggle-desc-',''));
let activity = flags.trainingItems[trainingIdx];
let desc = activity.description || "";
let li = $(event.currentTarget).parents(".item");

if ( li.hasClass("expanded") ) {
let summary = li.children(".item-summary");
summary.slideUp(200, () => summary.remove());
} else {
let div = $(`<div class="item-summary">${desc}</div>`);
li.append(div.hide());
div.slideDown(200);
}
li.toggleClass("expanded");

});

// Review Changes
html.find('.training-audit').click(async (event) => {
event.preventDefault();
Expand Down

0 comments on commit d59ac7d

Please sign in to comment.