All user data for FoundryVTT. Includes worlds, systems, modules, and any asset in the "foundryuserdata" directory. Does NOT include the FoundryVTT installation itself.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
3.8 KiB

1 year ago
  1. Hooks.once("init", async function () {
  2. game.settings.register(AECONSTS.MN, "companions", {
  3. name: "",
  4. hint: "",
  5. scope: "client",
  6. config: false,
  7. type: Array,
  8. default: [],
  9. });
  10. game.settings.register(AECONSTS.MN, "customautospells", {
  11. name: "",
  12. hint: "",
  13. scope: "world",
  14. config: false,
  15. type: Object,
  16. default: {},
  17. onChange: (obj) => {
  18. game.automatedevocations[game.system.id] = deepClone(game.automatedevocations.originalBindings);
  19. game.automatedevocations[game.system.id] = mergeObject(game.automatedevocations[game.system.id],game.settings.get(AECONSTS.MN, "customautospells"))
  20. },
  21. });
  22. game.settings.register(AECONSTS.MN, "customanimations", {
  23. name: "",
  24. hint: "",
  25. scope: "world",
  26. config: false,
  27. type: Object,
  28. default: {},
  29. });
  30. if(game.system.id === "dnd5e") {
  31. game.settings.registerMenu(AECONSTS.MN, "configBindings", {
  32. name: game.i18n.localize("AE.custombindings.sett.name"),
  33. label: game.i18n.localize("AE.custombindings.sett.label"),
  34. hint: game.i18n.localize("AE.custombindings.sett.hint"),
  35. icon: "fas fa-cogs",
  36. scope: "world",
  37. restricted: true,
  38. type: AutomatedEvocationsCustomBindings,
  39. });
  40. };
  41. game.settings.register(AECONSTS.MN, "autoclose", {
  42. name: game.i18n.localize(`AE.settings.autoclose.title`),
  43. hint: game.i18n.localize(`AE.settings.autoclose.hint`),
  44. scope: "world",
  45. config: true,
  46. type: Boolean,
  47. default: false,
  48. });
  49. game.settings.register(AECONSTS.MN, "enableautomations", {
  50. name: game.i18n.localize(`AE.settings.enableautomations.title`),
  51. hint: game.i18n.localize(`AE.settings.enableautomations.hint`),
  52. scope: "world",
  53. config: true,
  54. type: Boolean,
  55. default: true,
  56. });
  57. game.settings.register(AECONSTS.MN, "storeonactor", {
  58. name: game.i18n.localize(`AE.settings.storeonactor.title`),
  59. hint: game.i18n.localize(`AE.settings.storeonactor.hint`),
  60. scope: "world",
  61. config: true,
  62. type: Boolean,
  63. default: false,
  64. });
  65. game.settings.register(AECONSTS.MN, "hidebutton", {
  66. name: game.i18n.localize(`AE.settings.hidebutton.title`),
  67. hint: game.i18n.localize(`AE.settings.hidebutton.hint`),
  68. scope: "world",
  69. config: true,
  70. type: Boolean,
  71. default: false,
  72. });
  73. game.settings.register(AECONSTS.MN, "restrictOwned", {
  74. name: game.i18n.localize(`AE.settings.restrictOwned.title`),
  75. hint: game.i18n.localize(`AE.settings.restrictOwned.hint`),
  76. scope: "world",
  77. config: true,
  78. type: Boolean,
  79. default: false,
  80. });
  81. });
  82. Hooks.once("ready", async function () {
  83. AECONSTS.animationFunctions = mergeObject(
  84. AECONSTS.animationFunctions,
  85. game.settings.get(AECONSTS.MN, "customanimations")
  86. );
  87. console.log("Automated Evocations: Animation Functions Loaded - ",AECONSTS.animationFunctions);
  88. let sortedAnims = Object.keys(AECONSTS.animationFunctions).sort();
  89. for (let k of sortedAnims) {
  90. const group = AECONSTS.animationFunctions[k].group || "z-none";
  91. AECONSTS.animations[group] = AECONSTS.animations[group] || [];
  92. AECONSTS.animations[group].push({
  93. name:
  94. AECONSTS.animationFunctions[k]?.name ||
  95. game.i18n.localize(`AE.animations.${k}`),
  96. key: k,
  97. });
  98. }
  99. AECONSTS.animations = Object.keys(AECONSTS.animations).sort().reduce(
  100. (obj, key) => {
  101. obj[key] = AECONSTS.animations[key];
  102. return obj;
  103. },
  104. {}
  105. );
  106. //new CompanionManager().render(true)
  107. });
  108. Hooks.on("getActorSheetHeaderButtons", (app, buttons) => {
  109. if(game.settings.get(AECONSTS.MN, "hidebutton")) return;
  110. buttons.unshift({
  111. icon: "fas fa-users",
  112. class: "open-cm",
  113. label: game.i18n.localize("AE.actorSheetBtn"),
  114. onclick: function openCM(event) {
  115. const actor = app.object;
  116. new CompanionManager(actor).render(true);
  117. },
  118. });
  119. });