Skip to content

Commit

Permalink
closes #60
Browse files Browse the repository at this point in the history
  • Loading branch information
Muttley committed Dec 29, 2023
1 parent a0cd005 commit 075286b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 40 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
### Bugfixes
- [#34] Weapon Qualities and Damage Effects should be displayed in (localised) alphabetical order on Weapon item sheet
- [#51] Item quantity boxes polluting actor data when altered
- [#60] Use localized skill names to sort and display alphabetically on Character sheet

### Chores
- [#33] Merged Polish language updates from Crowdin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"system": {
},
"text": {
"content": "<h2>v11.3.0</h2>\n\n<h3>Enhancements</h3>\n\n<ul><li><p>[#37] The following character sheet fields are now auto-calculated and have new variables that can be used to adjust them with Active Effects if needed:</p><ul><li><strong>Defense</strong> (adjusted by <code>system.defense.bonus</code>)</li><li><strong>Max Health</strong> (adjusted by <code>system.health.bonus</code>)</li><li><strong>Initiative</strong> (adjusted by <code>system.initiative.bonus</code>)</li><li><strong>Melee Damage</strong> (adjusted by <code>system.meleeDamage.bonus</code>)</li><li><strong>Next Level XP</strong> (no adjustment available)</li></ul></li><li><p>[#50] Display the sytsem release notes the first time a new version is loaded</p></li></ul>\n\n<h3>Bugfixes</h3>\n\n<ul><li>[#34] Weapon Qualities and Damage Effects should be displayed in (localised) alphabetical order on Weapon item sheet</li></ul>\n\n<h3>Chores</h3>\n\n<ul><li>[#33] Merged Polish language updates from Crowdin</li><li>[#35] Remove usage of deprecated <code>ActiveEffect._getSourceName()</code></li><li>[#36] Remove usage of deprecated <code>ActiveEffect#label</code></li><li>[#46] Implement schema migration tools ready for likely schema changes</li></ul>\n\n<hr/>\n\n<h2>v11.2.6</h2>\n\n<h3>Bugfixes</h3>\n\n<ul><li>[#27] Text for some item sheets seems to be broken</li><li>[#28] Editing/Deleting items broken due to missing data tag</li><li>[#29] Encumbrance not being calculated correctly</li></ul>\n\n<h3>Chores</h3>\n\n<ul><li>Merged Polish translation updates from Crowdin</li></ul>\n\n<hr/>\n\n<h2>v11.2.5</h2>\n\n<h3>Chores</h3>\n\n<ul><li>Translation updates are now all handled via Crowdin to simplify the process of contributing translations. See here for more details: https://github.com/Muttley/foundryvtt-fallout/wiki/Other-ways-to-contribute#translation</li></ul>\n\n<hr/>\n\n<h2>v11.2.4</h2>\n\n<h3>Bugfixes</h3>\n\n<ul><li>[#19] Actor skills being overwritten when an Actor is duplicated</li></ul>\n\n<hr/>\n\n<h2>v11.2.3</h2>\n\n<h3>Bugfixes</h3>\n\n<ul><li>[#17] Item preview/expansion on Actor sheets doesn&#39;t display anything</li></ul>\n\n<hr/>\n\n<h2>v11.2.2</h2>\n\n<h2>Bugfixes</h2>\n\n<ul><li>[#14] NPC / Creature inventory items messed up</li></ul>\n\n<h2>Enhancements</h2>\n\n<ul><li>[#15] Tidy up hunger/thirst/sleep selector layout</li></ul>\n\n<hr/>\n\n<h2>v11.2.1</h2>\n\n<h2>Bugfixes</h2>\n\n<ul><li>[#9] AP Tracker not launching</li></ul>\n\n<hr/>\n\n<h2>v11.2.0</h2>\n\n<ul><li>System migrated to new home and build process</li><li>Compendiums now contained within a top-level system folder</li></ul>\n\n<hr/>\n\n<h2>v11.1.0</h2>\n\n<ul><li>Added Weight unit in settings</li><li>Added some translation fix for french</li><li>Changed defense on charater to read defense.value instead of defense.base</li></ul>\n\n<hr/>\n\n<h2>v11.0.3</h2>\n\n<ul><li>Fixed Unstable radiation weapon quality</li></ul>\n\n<hr/>\n\n<h2>v11.0.2</h2>\n\n<ul><li>Added new weapon qualities and damage effects</li><li>Added Polish and Deutsch languages</li></ul>\n\n<hr/>\n\n<h2>v11.0.1</h2>\n\n<ul><li>Foundry v11 compatible</li></ul>\n\n<hr/>\n\n<h2>v10.1.5</h2>\n\n<ul><li>Moved the TextEditor.enrichHTML to getData on the sheet</li></ul>\n\n<hr/>\n\n<h2>v10.1.4</h2>\n\n<ul><li>updated FR translation</li><li>Added a setting where you can define your custom skill compendium that will be used to populate your newly created characters with the skills from that compendium.</li><li>Exposed the APTracker class if you want to make a macro to update gmAP or partyAP (special request by some users).\nYou can now call\n<code>await fallout.APTracker.setAP(&quot;gmAP&quot;, 1)</code> or <code>await fallout.APTracker.setAP(&quot;partyAP&quot;, 1)</code> to set it to the custom value. Change &quot;1&quot; for some value you want.</li></ul>\n\n<hr/>\n\n<h2>v10.1.3</h2>\n\n<ul><li>removed the <strong>max</strong> Foundry version from the system so you can test it on Foundry V11</li><li>small modification to encumbrance so the system.carryWeight.base could be modified by Active Effects</li><li>robot carryWeight modifications from armor is now only taking the equipped and not-stashed parts in to acount</li></ul>\n\n<hr/>\n\n<h2>v10.1.2</h2>\n\n<ul><li>Lowering <strong>max</strong> version from <strong>11</strong> back to <strong>10</strong> since there are some problems in Foundry 11</li><li>Small fix in weapons names (to show if weapon is damaged)</li><li>Adding images and additional info to the Favorite Weapons Box.</li><li>Small styling fixes on the character status tab</li></ul>\n\n<hr/>\n\n<h2>v10.1.1</h2>\n\n<ul><li>Fixed encumbrance display.</li><li>Adding <strong>this.system.unofficalSpeed = Agi + athletics</strong> in derivedData method. This can be used for grided maps and optional grided combat rules.</li><li>Equipped apparel name now shows when you hover &quot;body part status box&quot; on the status screen</li><li><strong>Diseases</strong>. Added <strong>disease</strong> item. Those can also have Active effect on them that can be transfered to actors. Replaced Quick Apparel box on Character sheet with the diseases.</li><li>Improved the styling of chat messages that detail item&#39;s properties</li><li>Added Português (Brasil) translation</li></ul>\n\n<hr/>\n\n<h2>v10.1.0</h2>\n\n<ul><li>Added new Block for Body Parts with resistances and Injuries to the NPC and Creature sheets. Unfortunately there is no way for me to migrate previous data so the resistances and the injuries of NPCs and Creatures must be repopulated.</li></ul>\n\n<hr/>\n\n<h2>v10.0.9</h2>\n\n<ul><li>Added &quot;perks&quot; parameter to Robot Mods.</li><li>Removed the background from the d6 so the color of the die can be customized in Dice So Nice module</li></ul>\n\n<hr/>\n\n<h2>v10.0.8</h2>\n\n<ul><li>Added &quot;Ammo Per Shoot&quot; parameter to weapons.</li></ul>\n\n<hr/>\n\n<h2>v10.0.7</h2>\n\n<ul><li>Small fix in the Enricher initialization</li></ul>\n\n<hr/>\n\n<h2>v10.0.6</h2>\n\n<ul><li>Small changes to enable compatibility with the Maestro module</li></ul>\n\n<hr/>\n\n<h2>v10.0.5</h2>\n\n<ul><li>Introducing a way to write fallout symbols in to the text fileds. Use &quot;@fos[DC]&quot; for DC die. Use @fos[PH], @fos[EN], @fos[PO], @fos[RA] for the damage types.</li></ul>\n\n<hr/>\n\n<h2>v10.0.4</h2>\n\n<ul><li>Added game settting for the initial carry capacity for characters and robots</li></ul>\n\n<hr/>\n\n<h2>v10.0.3</h2>\n\n<ul><li>Improved Condition status display</li><li>Added system.complication value (initially 20). This can be further modified by Active Effects</li><li>Weapons with unreliable quality now decrease Complication by 1 when you roll 2D20 from the weapon</li></ul>\n\n<hr/>\n\n<h2>v10.0.2</h2>\n\n<ul><li>Adding vicious damage effect in to the weapon damage calculation</li></ul>\n\n<hr/>\n\n<h2>v10.0.1</h2>\n\n<ul><li>Added Ammo Calculation</li><li>Added Weapon Quality labels in the 2d20 chat message</li><li>Cleared some old &quot;data&quot; instances</li></ul>\n\n<hr/>\n\n<h2>v10.0.0</h2>\n\n<ul><li>Compatibility update for Foundry v10</li></ul>\n\n<hr/>\n\n<h2>v9.0.6</h2>\n\n<ul><li>Fixed initial creation of caps and other valuables on Actor (Thanks to Haxxer)</li></ul>\n\n<hr/>\n\n<h2>v9.0.5</h2>\n\n<ul><li>Send item details to chat</li></ul>\n\n<hr/>\n\n<h2>v9.0.4</h2>\n\n<ul><li>Thanks to @e4g13 for making new images for the location die. Check out his cool fallout maps on http://www.patreon.com/e4g13</li></ul>\n\n<hr/>\n\n<h2>v9.0.3</h2>\n\n<ul><li>Introduced the &quot;Hit Location Die&quot; that is automatically rolled when clicking on the weapon. You can also roll it by using the &quot;h&quot; identifier. (eg. /r 1dh or as inline [[1dh]])</li><li>Added French translation</li></ul>\n\n<hr/>\n\n<h2>v9.0.2</h2>\n\n<ul><li>Setting added: &quot;Show Overseer&#39;s AP To Player&quot;</li><li>Setting added: &quot;Players Can Setup Party&#39;s Max AP&quot;</li></ul>\n\n<hr/>\n\n<h2>v9.0.1</h2>\n\n<ul><li>Added mouse hovers for weapon Qualities and Effects. You can change the page numbers for the actual descriptions by creating your own json file and pointing the system to it in the settings.</li></ul>\n\n<hr/>\n\n<h2>v9.0.0</h2>\n\n<ul><li>Bumping the manifest to Foundry v9</li></ul>\n\n<hr/>\n\n<h2>v1.9.1</h2>\n\n<ul><li>Weight of an Item can now be a float. (You can now put for example 0.2 as a weight)</li><li>Added Qualities and Effects to the Weapon List on the Character Sheet.</li><li>Fixed total value of the Challenge Die rolls when you use standard roll formula (/r 1dc).</li><li>Fixed quantity box so it doesn&#39;t disappear if the quantity is set to zero.</li></ul>\n\n<hr/>\n\n<h2>v1.9</h2>\n\n<ul><li>Added quantity filed next to the item name/</li><li>I am still trying to find and fix why sometimes the crit doesn&#39;t register and you get a wrong num of successes. I did put some safe measures around it but I still need more test data.</li></ul>\n\n<hr/>\n\n<h2>v1.8</h2>\n\n<ul><li>Added the &#39;Wear &amp; Tear&#39; field in the weapon sheet. If it is populated the &#39;wrench&#39; will apear next to the weapon name on the character sheet to remind you that you should fix it.</li></ul>\n\n<hr/>\n\n<h2>v1.7</h2>\n\n<ul><li>Radiation tracker added to the chracter sheet</li></ul>\n\n<hr/>\n\n<h2>v1.6</h2>\n\n<ul><li>Fixed encumbrance calculation. Now it should include item quantity too.</li></ul>\n\n<hr/>\n\n<h2>v1.5</h2>\n\n<ul><li>Added skill delete option for characters, and blocked skill duplication.</li></ul>\n\n<hr/>\n\n<h2>v1.4</h2>\n\n<ul><li>Fixed Book and Magazines Effect field</li></ul>\n\n<hr/>\n\n<h2>v1.3</h2>\n\n<ul><li>Added dice term for Combat Die. &quot;/r 1dc&quot;</li><li>Added Dice Modifier &quot;ef&quot; to count the effect results (5,6)</li><li>Added Dice Modifier &quot;sum&quot; to count the results (1+2+0+0+1+1)</li></ul>\n\n<hr/>\n\n<h2>v1.21</h2>\n\n<ul><li>Bug Fix: Show robot mod on the character sheet under &quot;unsorted items&quot;.</li></ul>\n\n<hr/>\n\n<h2>v1.2</h2>\n\n<ul><li>Merged Rosataker translation improvements.</li><li>Bug Fix: show the Perk Rank on the character sheet list.</li><li>Improvement: DC Roll Chat Message now displays weapon damage types and weapon damage effects.</li></ul>\n\n<hr/>\n\n<h2>v1.1</h2>\n\n<ul><li>Weapon Mods: Changed the weapon type field to be a text input so more specific weapon types can be entered.</li><li>Bug Fix: Items Sheet background bug fixed when installed on the Forge servers.</li></ul>",
"content": "<p><strong><em>AUTO-GENERATED. DO NOT EDIT.</em></strong></p>",
"format": 1
},
"title": {
Expand Down
39 changes: 20 additions & 19 deletions system/src/sheets/FalloutActorSheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ export default class FalloutActorSheet extends ActorSheet {
* @return {undefined}
*/
async _prepareItems(context) {
// Initialize containers.

const skills = [];
const perks = [];
const apparel = [];
Expand All @@ -168,19 +166,25 @@ export default class FalloutActorSheet extends ActorSheet {
const consumables = [];
const books_and_magz = [];
const miscellany = [];
// const gear = [];
const specialAbilities = [];
const diseases = [];


// Iterate through items, allocating to containers
for (let i of context.items) {
i.img = i.img || DEFAULT_TOKEN;
// Append to gear.

if (i.type === "skill") {
i.localizedName = game.i18n.localize(
`FALLOUT.SKILL.${i.name}`
);

i.localizedDefaultAttribute = game.i18n.localize(
`FALLOUT.AbilityAbbr.${i.system.defaultAttribute}`
);

skills.push(i);
}
// Append to skills.
else if (i.type === "perk") {
perks.push(i);
}
Expand Down Expand Up @@ -232,13 +236,8 @@ export default class FalloutActorSheet extends ActorSheet {
}
}

// Assign and return
skills.sort((a, b) => a.localizedName.localeCompare(b.localizedName));

skills.sort(function(a, b) {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
return nameA < nameB ? -1 : nameA > nameB ? 1 : 0;
});
context.skills = skills;

let clothing = apparel.filter(a => a.system.appareltype === "clothing");
Expand All @@ -248,29 +247,31 @@ export default class FalloutActorSheet extends ActorSheet {
let powerArmor = apparel.filter(a => a.system.appareltype === "powerArmor");
let plating = robotApparel.filter(a => a.system.appareltype === "plating");
let robotArmor = robotApparel.filter(a => a.system.appareltype === "armor");

context.allApparel = [
{ apparelType: "clothing", list: clothing },
{ apparelType: "outfit", list: outfit },
{ apparelType: "headgear", list: headgear },
{ apparelType: "armor", list: armor },
{ apparelType: "powerArmor", list: powerArmor },
];

context.allRobotApparel = [
{ apparelType: "plating", list: plating },
{ apparelType: "armor", list: robotArmor },
];

context.apparel_mods = apparel_mods;
context.robot_mods = robot_mods;
context.perks = perks;
context.ammo = ammo;
context.weapons = weapons;
context.weapon_mods = weapon_mods;
context.specialAbilities = specialAbilities;
context.consumables = consumables;
context.apparel_mods = apparel_mods;
context.books_and_magz = books_and_magz;
context.miscellany = miscellany;
context.consumables = consumables;
context.diseases = diseases;
context.miscellany = miscellany;
context.perks = perks;
context.robot_mods = robot_mods;
context.specialAbilities = specialAbilities;
context.weapon_mods = weapon_mods;
context.weapons = weapons;

// WRAP INVENTORY DEPENDING ON THE CHARACTER TYPE:
// for example put apparel in inventory for all except the character actor.
Expand Down
45 changes: 25 additions & 20 deletions system/templates/actor/parts/actor-skills.hbs
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<ol class="items-list">
<li class="item skill flexrow items-header">
<div class="item-name">{{localize "FALLOUT.TEMPLATES.SKILL"}}</div>
<div class="item-skill-tag">{{localize "FALLOUT.TEMPLATES.Tag"}}</div>
<div class="item-skill-value">{{localize "FALLOUT.TEMPLATES.Rank"}}</div>
</li>
{{#each skills as |item id|}}
<li class="item skill flexrow" data-item-id="{{item._id}}">
<div class="item-name">
<h4><a class="color-secondary"><span class="resource-label upperC">{{localize (concat 'FALLOUT.SKILL.' item.name)}}</span> [{{localize (concat
'FALLOUT.AbilityAbbr.' item.system.defaultAttribute)}}]</a></h4>
</div>
<div class="item-skill-tag">
<input type="checkbox" name="tag" {{#ifCond item.system.tag '==' true}}checked{{/ifCond}}>
</div>
<div class="item-skill-value">
<input type="number" class="num-short-2" name="value" value="{{item.system.value}}" min="0">
</div>
</li>
{{/each}}
</ol>
<li class="item skill flexrow items-header">
<div class="item-name">{{localize "FALLOUT.TEMPLATES.SKILL"}}</div>
<div class="item-skill-tag">{{localize "FALLOUT.TEMPLATES.Tag"}}</div>
<div class="item-skill-value">{{localize "FALLOUT.TEMPLATES.Rank"}}</div>
</li>
{{#each skills as |item id|}}
<li class="item skill flexrow" data-item-id="{{item._id}}">
<div class="item-name">
<h4>
<a class="color-secondary">
<span class="resource-label upperC">
{{item.localizedName}}
</span> [{{item.localizedDefaultAttribute}}]
</a>
</h4>
</div>
<div class="item-skill-tag">
<input type="checkbox" name="tag" {{#ifCond item.system.tag '==' true}}checked{{/ifCond}}>
</div>
<div class="item-skill-value">
<input type="number" class="num-short-2" name="value" value="{{item.system.value}}" min="0">
</div>
</li>
{{/each}}
</ol>

0 comments on commit 075286b

Please sign in to comment.