#Remaining Weapon Mastery code

1 messages · Page 1 of 1 (latest)

mild cedar
#

Here are some more pieces


const CUSTOM_CONFIG = {
  DND5E: {},
  CHAOSOS: {},
};

/**
 * @typedef WeaponMasteryConfig
 * @prop {Set<string>} prerequisites
 * @prop {string} label
 */

/**
 * @type {Record<string, WeaponMasteryConfig>}
 */
CUSTOM_CONFIG.CHAOSOS.weaponMastery = {
  cleave: {
    label: 'Cleave',
    prerequisites: new Set(['melee', 'hvy']),
  },
  graze: {
    label: 'Graze',
    prerequisites: new Set(['melee', 'hvy']),
  },
  nick: {
    label: 'Nick',
    prerequisites: new Set(['lgt']),
  },
  push: {
    label: 'Push',
    prerequisites: new Set(['hvy', 'two', 'ver']),
  },
  sap: {
    label: 'Sap',
    prerequisites: new Set(['ver', 'none']),
  },
  slow: {
    label: 'Slow',
    prerequisites: new Set([]),
  },
  topple: {
    label: 'Topple',
    prerequisites: new Set(['hvy', 'rch', 'ver']),
  },
  vex: {
    label: 'Vex',
    prerequisites: new Set(['amm', 'fin', 'lgt']),
  },
};

/**
 * UA7 "The Sap property now works with weapons that have the Versatile property or no property."
 */
CUSTOM_CONFIG.CHAOSOS.sapExclusions = new Set([
  'amm',
  'fin',
  'hvy',
  'lgt',
  'lod',
  'rch',
  'rel',
  'ret',
  'spc',
  'thr',
  'two',
]);


Hooks.once('init', () => {
  foundry.utils.mergeObject(CONFIG, CUSTOM_CONFIG);
});
#

And this is the templates/weaponMastery.hbs file

<label class="checkbox">
    <input type="checkbox" name="flags.chaosos-5e-content.weaponMastered" {{checked mastered}} {{#unless editable}}disabled{{/unless}}>Mastered
</label>
{{#if mastered}}
    <select class="weaponMastery" name="flags.chaosos-5e-content.weaponMastery" {{#unless editable}}disabled{{/unless}}>
        {{selectOptions masteries selected=mastery}}
    </select>
{{/if}}
errant robin
#

is this a seperate mjs

#

or do I add it into the existing file

mild cedar
#

the javascript above goes at the top of the file

#

the handlebars is its own separate file

errant robin
#

gotcha

mild cedar
#

it's referenced in the original script I gave you

errant robin
mild cedar
#

yeah

errant robin
#

then i make a templates folder with this hbs file

mild cedar
#

yeah, goes inside your module

#

and then you need to adjust references to match your module ID

mild cedar
#

in the javascript. Javascript is different from json

errant robin
#

I feel like a fool, but I can't get it working. I assume I'm not replacing the right references

mild cedar
#

I unfortunately don't really have time to walk you through all the pieces that need adjustments

#

especially since 4.0 is only a few weeks away

errant robin
#

more than fair