Do a bit of cleanup
This commit is contained in:
parent
2161a8e92a
commit
f26d75b56f
7 changed files with 34 additions and 34 deletions
|
@ -15,8 +15,6 @@ export interface HasTotal<T> {
|
||||||
total: T;
|
total: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModifiableDataTotal<T> extends ModifiableData<T>, HasTotal<T> {}
|
|
||||||
|
|
||||||
export interface ModifiableDataBaseTotal<T> extends ModifiableDataBase<T>, HasTotal<T> {}
|
export interface ModifiableDataBaseTotal<T> extends ModifiableDataBase<T>, HasTotal<T> {}
|
||||||
|
|
||||||
export interface ResourceData<T> extends ModifiableData<T> {
|
export interface ResourceData<T> extends ModifiableData<T> {
|
||||||
|
|
8
src/module/global.d.ts
vendored
8
src/module/global.d.ts
vendored
|
@ -2,8 +2,6 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { DS4 } from "./config";
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace ClientSettings {
|
namespace ClientSettings {
|
||||||
interface Values {
|
interface Values {
|
||||||
|
@ -18,8 +16,6 @@ declare global {
|
||||||
x: (this: PoolTerm, modifier: string) => void;
|
x: (this: PoolTerm, modifier: string) => void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface CONFIG {
|
export {};
|
||||||
DS4: typeof DS4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -63,3 +63,20 @@ async function init() {
|
||||||
await registerHandlebarsPartials();
|
await registerHandlebarsPartials();
|
||||||
registerHandlebarsHelpers();
|
registerHandlebarsHelpers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Game {
|
||||||
|
ds4: {
|
||||||
|
DS4Actor: typeof DS4Actor;
|
||||||
|
DS4Item: typeof DS4Item;
|
||||||
|
DS4: typeof DS4;
|
||||||
|
createCheckRoll: typeof createCheckRoll;
|
||||||
|
migration: typeof migration;
|
||||||
|
macros: typeof macros;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CONFIG {
|
||||||
|
DS4: typeof DS4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -95,10 +95,8 @@ export class DS4ItemSheet extends ItemSheet<ItemSheet.Options, DS4ItemSheetData>
|
||||||
* Create a new ActiveEffect for the item using default data.
|
* Create a new ActiveEffect for the item using default data.
|
||||||
*/
|
*/
|
||||||
protected async _createActiveEffect(): Promise<ActiveEffect | undefined> {
|
protected async _createActiveEffect(): Promise<ActiveEffect | undefined> {
|
||||||
const label = `New Effect`;
|
|
||||||
|
|
||||||
const createData = {
|
const createData = {
|
||||||
label: label,
|
label: "New Effect",
|
||||||
changes: [],
|
changes: [],
|
||||||
duration: {},
|
duration: {},
|
||||||
transfer: true,
|
transfer: true,
|
||||||
|
|
|
@ -8,24 +8,17 @@ const loggingSeparator = "|";
|
||||||
type LogLevel = "debug" | "info" | "warning" | "error";
|
type LogLevel = "debug" | "info" | "warning" | "error";
|
||||||
type LoggingFunction = (...data: unknown[]) => void;
|
type LoggingFunction = (...data: unknown[]) => void;
|
||||||
|
|
||||||
class Logger {
|
const getLoggingFunction = (type: LogLevel = "info"): LoggingFunction => {
|
||||||
readonly debug: LoggingFunction;
|
|
||||||
readonly info: LoggingFunction;
|
|
||||||
readonly warn: LoggingFunction;
|
|
||||||
readonly error: LoggingFunction;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.debug = this.getLoggingFunction("debug");
|
|
||||||
this.info = this.getLoggingFunction("info");
|
|
||||||
this.warn = this.getLoggingFunction("warning");
|
|
||||||
this.error = this.getLoggingFunction("error");
|
|
||||||
}
|
|
||||||
|
|
||||||
getLoggingFunction(type: LogLevel = "info") {
|
|
||||||
const log = { debug: console.debug, info: console.info, warning: console.warn, error: console.error }[type];
|
const log = { debug: console.debug, info: console.info, warning: console.warn, error: console.error }[type];
|
||||||
return (...data: unknown[]) => log(loggingContext, loggingSeparator, ...data);
|
return (...data: unknown[]) => log(loggingContext, loggingSeparator, ...data);
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
const logger = Object.freeze({
|
||||||
|
debug: getLoggingFunction("debug"),
|
||||||
|
info: getLoggingFunction("info"),
|
||||||
|
warn: getLoggingFunction("warning"),
|
||||||
|
error: getLoggingFunction("error"),
|
||||||
|
getLoggingFunction,
|
||||||
|
});
|
||||||
|
|
||||||
const logger = new Logger();
|
|
||||||
export default logger;
|
export default logger;
|
||||||
|
|
|
@ -18,11 +18,11 @@ export function getActiveActor(): DS4Actor | undefined {
|
||||||
|
|
||||||
const speakerToken = speaker.token ? getCanvas().tokens.get(speaker.token) : undefined;
|
const speakerToken = speaker.token ? getCanvas().tokens.get(speaker.token) : undefined;
|
||||||
if (speakerToken) {
|
if (speakerToken) {
|
||||||
return speakerToken.actor as DS4Actor;
|
return speakerToken.actor ?? undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const speakerActor = speaker.actor ? game.actors?.get(speaker.actor) : undefined;
|
const speakerActor = speaker.actor ? game.actors?.get(speaker.actor) : undefined;
|
||||||
if (speakerActor) {
|
if (speakerActor) {
|
||||||
return speakerActor as DS4Actor;
|
return speakerActor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,10 @@ class CheckFactory {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const speaker = ChatMessage.getSpeaker();
|
const speaker = ChatMessage.getSpeaker();
|
||||||
|
|
||||||
const a = roll.toMessage(
|
return roll.toMessage(
|
||||||
{ speaker, flavor: this.options.flavor },
|
{ speaker, flavor: this.options.flavor },
|
||||||
{ rollMode: this.options.rollMode, create: true },
|
{ rollMode: this.options.rollMode, create: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createCheckTargetNumberModifier(): string {
|
createCheckTargetNumberModifier(): string {
|
||||||
|
|
Loading…
Reference in a new issue