Skip to content

Commit

Permalink
Merge pull request #158 from Savantford/experimental
Browse files Browse the repository at this point in the history
Experimental
  • Loading branch information
Savantford committed Feb 25, 2024
2 parents 7e34672 + 8ea5e9f commit 0e7e1ca
Show file tree
Hide file tree
Showing 30 changed files with 192 additions and 199 deletions.
24 changes: 13 additions & 11 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@

"WW.Attributes.Label": "Attributes",
"WW.Attributes.Strength": "Strength",
"WW.Attributes.StrengthShort": "Strength",
"WW.Attributes.StrengthScore": "Strength Score",
"WW.Attributes.Agility": "Agility",
"WW.Attributes.AgilityShort": "Agility",
"WW.Attributes.AgilityScore": "Agility Score",
"WW.Attributes.Intellect": "Intellect",
"WW.Attributes.IntellectShort": "Intellect",
"WW.Attributes.IntellectScore": "Intellect Score",
"WW.Attributes.Will": "Will",
"WW.Attributes.WillShort": "Will",
"WW.Attributes.WillScore": "Will Score",
"WW.Attributes.Luck": "Luck",

Expand All @@ -39,14 +43,10 @@

"WW.Defense.Label": "Defense",
"WW.Defense.Score": "Defense Score",
"WW.Defense.Total": "Defense Total",
"WW.Defense.Natural": "Natural Defense",
"WW.Defense.Armored": "Armored Defense",
"WW.Defense.Bonus": "Bonus to Defense",
"WW.Defense.Details": "(armor, if any, shield, if any)",

"WW.Dialog.Cancel": "Cancel",

"WW.Health.Label": "Health",
"WW.Health.Normal": "Normal Health Score",
"WW.Health.Current": "Current Health Score",
Expand Down Expand Up @@ -80,7 +80,7 @@

"WW.Rest.Label": "Rest",
"WW.Rest.Msg": "Resting allows you to heal damage and regain expended resources. If you have uninterrupted rest for 6 consecutive hours, you heal all damage and regain Health equal to one-tenth your normal Health score. Some of your other resources, such as spells or talents, might also be replenished after a rest. If you stop resting to use an action or reaction, the time you spent resting up to that point is wasted and you must start resting again to gain any benefit from doing so.",
"WW.Rest.Confirm": "Are you able to rest now?",
"WW.Rest.Confirm": "Were you able to finish your rest?",
"WW.Rest.Finished": "finished a rest",

"WW.Detail.Type.Label": "Type",
Expand Down Expand Up @@ -653,13 +653,12 @@
"WW.Combat.Phase.End": "End of the Round",

"WW.Combat.Turn.Label": "Take a Regular Turn",
"WW.Combat.Turn.Msg": "is taking a regular turn",
"WW.Combat.Turn.Msg": "{name} is taking a regular turn.",

"WW.Combat.Initiative.Label": "Take The Initiative",
"WW.Combat.Initiative.ChatMsg": "is taking the initiative",
"WW.Combat.Initiative.ChatMsg": "{name} is taking the initiative.",
"WW.Combat.Initiative.Title": "Taking the Initiative",
"WW.Combat.Initiative.Msg": "A new round started.",
"WW.Combat.Initiative.Msg2": "Do you want to use a <b>reaction</b> to take the initiative, instead of making a regular turn?",
"WW.Combat.Initiative.Msg": "<p>A new round started.</p><p>Do you want to use a <b>reaction</b> to take the initiative, instead of making a regular turn?</p>",
"WW.Combat.Initiative.NoCharacter": "A new round started, but you don't have a character assigned to you.",

"WW.Combat.ActAgain.Title": "Act Again",
Expand All @@ -672,8 +671,11 @@

"WW.Combat.Tip.RightClick": "Right click for context options.",
"WW.Combat.Tip.FinishTurn": "Finish Your Turn",
"WW.Combat.Tip.SkipActed": "Skip Acted?",
"WW.Combat.Tip.SkipActedHint": "Automatically bypass combatants who acted already during this round.",

"WW.Settings.Combat.SkipActed": "Skip Acted?",
"WW.Settings.Combat.SkipActedHint": "Automatically bypass combatants who already acted during this round.",
"WW.Settings.DamageBarReverse": "Reverse Damage Bars",
"WW.Settings.DamageBarReverseHint": "If enabled, health/damage bars start full and decrease when taking damage. If disabled, bars start at 0, filling as damage increases.",

"WW.System.Help": "Help",

Expand Down
106 changes: 0 additions & 106 deletions module/apps/health-details.mjs

This file was deleted.

8 changes: 6 additions & 2 deletions module/canvas/token.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ export default class WWToken extends Token {

_drawDamageBar(number, bar, data) {
const { value, max } = data;
const colorPct = Math.clamped(value, 0, max) / max;
let colorPct = Math.clamped(value, 0, max) / max;
if (game.settings.get('weirdwizard', 'damageBarReverse')) {
colorPct = Math.clamped(max-value, 0, max) / max
}
const damageColor = WWToken.getDamageColor(value, max);

// Determine the container size (logic borrowed from core)
const w = this.w;
let h = Math.max(canvas.dimensions.size / 12, 8);
if (this.document.height >= 2)
if (this.document.height >= 2) {
h *= 1.6;
}
const stroke = Math.clamped(h / 8, 1, 2);

// Set up bar container
Expand Down
3 changes: 3 additions & 0 deletions module/dice/roll-attribute.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ export default class RollAttribute extends FormApplication {
parent.querySelector('.boons-targets').innerHTML = targetsDisplay;
}

// Update app position/scaling
this.setPosition()

}

_addWeaponDamage(target) {
Expand Down
4 changes: 2 additions & 2 deletions module/documents/combat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ export default class WWCombat extends Combat {
} else {

const confirm = await Dialog.confirm({
title: i18n('WW.Combat.TakingInit.Title'),
content: `<p>${i18n('WW.Combat.TakingInit.Msg')}</p><p>${i18n('WW.Combat.TakingInit.Msg2')}</p>`
title: i18n('WW.Combat.Initiative.Title'),
content: i18n('WW.Combat.Initiative.Msg')
})

// Check if the users's character is present as a combatant in the current combat
Expand Down
6 changes: 5 additions & 1 deletion module/documents/combatant.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ export default class WWCombatant extends Combatant {
/*if ( token.object ) await token.object.toggleEffect(effect, {overlay: true, active: taking});
else await token.toggleActiveEffect(effect, {overlay: true, active: taking});*/

let msg = i18n('WW.Combat.Turn.Msg', {name: '<b>' + token.actor.name + '</b>'});
if (taking) {
msg = i18n('WW.Combat.Initiative.ChatMsg', {name: '<b>' + token.actor.name + '</b>'});
}
// Send to chat
ChatMessage.create({
content: '<div><b>' + token.actor.name + '</b> ' + (taking ? i18n('WW.Combat.Initiative.Msg') : i18n('WW.Combat.Turn.Msg')) + '.</div>',
content: '<div>' + msg + '</div>',
sound: CONFIG.sounds.notification
});

Expand Down
1 change: 0 additions & 1 deletion module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { i18n, plusify, capitalize, resizeInput, clearUserTargets, sum } from '../helpers/utils.mjs';
import { chatMessageButton, targetHeader, addInstEffs, actionFromLabel } from '../chat/chat-html-templates.mjs';
import { healthDetails } from '../apps/health-details.mjs';
import RollAttribute from '../dice/roll-attribute.mjs';
import TargetingHUD from '../apps/targeting-hud.mjs';
import { onManageActiveEffect, prepareActiveEffectCategories } from '../helpers/effects.mjs';
Expand Down
18 changes: 17 additions & 1 deletion module/sheets/character-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,24 @@ export default class WWCharacterSheet extends WWActorSheet {
return mergeObject(super.defaultOptions, {
classes: ['weirdwizard', 'sheet', 'actor'],
width: 860,
height: 480,
height: 480, // 480
tabs: [{ navSelector: '.sheet-tabs', contentSelector: '.sheet-body', initial: 'summary' }]
});
}

/** @override */
setPosition(pos={}) { // NOT WORKING
super.setPosition(pos);

// Fetch elements and new height
const sheet = this.element[0];
const charHeader = $(this.element[0]).find('.header-fields');
const newHeight = charHeader[0].clientHeight;

// Set minimum height to the header's size
sheet.style.minHeight = parseInt(newHeight + 45) + 'px';

return;
}

}
51 changes: 44 additions & 7 deletions module/weirdwizard.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ Hooks.once('init', function () {
CONFIG.Actor.trackableAttributes = {
Character: {
bar: ['stats.damage'],
value: []
value: ['stats.defense.total']
},
NPC: {
bar: ['stats.damage'],
value: []
value: ['stats.defense.total']
}
};

Expand All @@ -135,9 +135,19 @@ Hooks.once('init', function () {
//WWActiveEffectConfig.initializeChangePriorities(); // No longer needed

// Register system settings
game.settings.register('weirdwizard', 'damageBarReverse', {
name: 'WW.Settings.DamageBarReverse',
hint: 'WW.Settings.DamageBarReverseHint',
scope: 'world',
config: true,
requiresReload: true,
type: Boolean,
default: false
});

game.settings.register('weirdwizard', 'skipActed', {
name: 'WW.Combat.Skip',
hint: 'WW.Combat.SkipHint',
name: 'WW.Settings.Combat.SkipActed',
hint: 'WW.Settings.Combat.SkipActedHint',
scope: 'world',
config: true,
requiresReload: false,
Expand Down Expand Up @@ -301,8 +311,7 @@ Hooks.on('renderChatMessage', (app, html) => {

// Initialize chat message listeners
initChatListeners(html, app);

})
});

/* -------------------------------------------- */
/* Misc Hooks */
Expand All @@ -328,7 +337,35 @@ Hooks.on('updateWorldTime', (worldTime, dt, options, userId) => {
expireFromTokens();

if (ui.questcalendar?.rendered) ui.questcalendar.render();
})
});

Hooks.on('renderSettingsConfig', (app, html, data) => {
// Add sections to settings dialog by iterating all *our* settings, stripping the module/system ID,
// then checking whether they have the format '<section>.setting'.
// If so, we check whether the section matches the last section we saw;
// otherwise, this is a new section and we insert a new section header.
let lastSectionID = '';
const wwSettings = html.find(`.tab[data-tab=system] .form-group`)
wwSettings.each((i, value) => {
const setting = (value.getAttribute('data-setting-id') || '').replace(/^(weirdwizard\.)/, '');
if (!setting || setting.indexOf('.') < 1) {
return;
}
const section = setting.split('.')[0];
if (section !== lastSectionID) {
const key = 'WW.Settings.Section.' + section;
const hintKey = key + 'Hint';
let hint = game.i18n.localize(hintKey)
if (hint !== hintKey) {
hint = `<p class="notes">${hint}</p>`;
} else {
hint = '';
}
wwSettings.eq(i).before(`<h3>${game.i18n.localize(key)}</h3>${hint}`);
lastSectionID = section;
}
});
});

/* -------------------------------------------- */
/* External Module Hooks */
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/armor/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000510
MANIFEST-000518
6 changes: 3 additions & 3 deletions packs/armor/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/02/21-19:30:37.430 178 Recovering log #508
2024/02/21-19:30:37.435 178 Delete type=0 #508
2024/02/21-19:30:37.435 178 Delete type=3 #506
2024/02/24-16:55:50.443 9dc Recovering log #517
2024/02/24-16:55:50.448 9dc Delete type=0 #517
2024/02/24-16:55:50.448 9dc Delete type=3 #516
10 changes: 3 additions & 7 deletions packs/armor/LOG.old
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
2024/02/21-17:06:49.492 4e0 Recovering log #505
2024/02/21-17:06:49.497 4e0 Delete type=0 #505
2024/02/21-17:06:49.497 4e0 Delete type=3 #504
2024/02/21-19:08:40.871 3b5c Level-0 table #509: started
2024/02/21-19:08:40.871 3b5c Level-0 table #509: 0 bytes OK
2024/02/21-19:08:40.874 3b5c Delete type=0 #507
2024/02/21-19:08:40.874 3b5c Manual compaction at level-0 from '!items!8kdTjI16oQxvcKow' @ 72057594037927935 : 1 .. '!items.effects!r7Vjowz8ZGGAbD3n.k1mHXJOIELUhGoM5' @ 0 : 0; will stop at (end)
2024/02/23-18:37:11.181 4674 Recovering log #515
2024/02/23-18:37:11.185 4674 Delete type=0 #515
2024/02/23-18:37:11.185 4674 Delete type=3 #514
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/docs/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000142
MANIFEST-000150
6 changes: 3 additions & 3 deletions packs/docs/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/02/21-19:30:37.396 178 Recovering log #140
2024/02/21-19:30:37.401 178 Delete type=0 #140
2024/02/21-19:30:37.401 178 Delete type=3 #138
2024/02/24-16:55:50.398 9dc Recovering log #149
2024/02/24-16:55:50.404 9dc Delete type=0 #149
2024/02/24-16:55:50.404 9dc Delete type=3 #148
10 changes: 3 additions & 7 deletions packs/docs/LOG.old
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
2024/02/21-17:06:49.443 4e0 Recovering log #137
2024/02/21-17:06:49.448 4e0 Delete type=0 #137
2024/02/21-17:06:49.448 4e0 Delete type=3 #136
2024/02/21-19:08:40.857 3b5c Level-0 table #141: started
2024/02/21-19:08:40.857 3b5c Level-0 table #141: 0 bytes OK
2024/02/21-19:08:40.859 3b5c Delete type=0 #139
2024/02/21-19:08:40.864 3b5c Manual compaction at level-0 from '!journal!0xYsAWtUJS591nz9' @ 72057594037927935 : 1 .. '!journal.pages!Lrr8Rl7mRIIoYeW1.thPe333HcfTJyiLv' @ 0 : 0; will stop at (end)
2024/02/23-18:37:11.138 4674 Recovering log #147
2024/02/23-18:37:11.142 4674 Delete type=0 #147
2024/02/23-18:37:11.142 4674 Delete type=3 #146
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/weapons/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000507
MANIFEST-000515
Loading

0 comments on commit 0e7e1ca

Please sign in to comment.