#49 Ziehbare Items
Changes: + Items können jetzt zwischen Charakteren ausgetauscht werden (Nur Gegenstände, keine Zauber etc.) + Items können Sortiert werden durch verziehen und droppen Sneak Change: + Löschen button für mods hinzugefügt + ESLint und Prettier hinzugefügt, sorry für all die changes :D
This commit is contained in:
+33
-30
@@ -2,46 +2,49 @@ import Globals from "../Globals";
|
||||
import Color from "color";
|
||||
|
||||
class Logger {
|
||||
// static class
|
||||
private constructor() {}
|
||||
// static class
|
||||
private constructor() {}
|
||||
|
||||
private static GetCurrentTime(): string {
|
||||
return `[${(new Date().toLocaleTimeString())}] `;
|
||||
}
|
||||
private static GetCurrentTime(): string {
|
||||
return `[${new Date().toLocaleTimeString()}] `;
|
||||
}
|
||||
|
||||
static log(str: string, colour: Color = Color("white"), bold = false): void {
|
||||
const time = ToConsole(Logger.GetCurrentTime(), Color("gray"), false)
|
||||
const moduleName = ToConsole(Globals.name + " ", Color("cyan"), true);
|
||||
const text = ToConsole(str, colour, bold);
|
||||
console.log(time.str + moduleName.str + text.str, ...time.params.concat(moduleName.params, text.params));
|
||||
}
|
||||
static log(str: string, colour: Color = Color("white"), bold = false): void {
|
||||
const time = ToConsole(Logger.GetCurrentTime(), Color("gray"), false);
|
||||
const moduleName = ToConsole(Globals.name + " ", Color("cyan"), true);
|
||||
const text = ToConsole(str, colour, bold);
|
||||
console.log(
|
||||
time.str + moduleName.str + text.str,
|
||||
...time.params.concat(moduleName.params, text.params),
|
||||
);
|
||||
}
|
||||
|
||||
static err(str: string): void {
|
||||
Logger.log(str, Color("orange"));
|
||||
}
|
||||
static err(str: string): void {
|
||||
Logger.log(str, Color("orange"));
|
||||
}
|
||||
|
||||
static warn(str: string): void {
|
||||
Logger.log(str, Color("yellow"));
|
||||
}
|
||||
static warn(str: string): void {
|
||||
Logger.log(str, Color("yellow"));
|
||||
}
|
||||
|
||||
static ok(str: string): void {
|
||||
Logger.log(str, Color("green"));
|
||||
}
|
||||
static ok(str: string): void {
|
||||
Logger.log(str, Color("green"));
|
||||
}
|
||||
}
|
||||
|
||||
interface ConsoleColour {
|
||||
str: string,
|
||||
params: Array<string>;
|
||||
str: string;
|
||||
params: Array<string>;
|
||||
}
|
||||
|
||||
const ToConsole = (str: string, col: Color, bold: boolean): ConsoleColour => {
|
||||
return {
|
||||
str: `%c` + str + `%c`,
|
||||
params: [
|
||||
"color: " + col.hex() + ";" + (bold ? "font-weight: bold;" : ""),
|
||||
"color: unset; font-weight: unset;"
|
||||
]
|
||||
}
|
||||
return {
|
||||
str: `%c` + str + `%c`,
|
||||
params: [
|
||||
"color: " + col.hex() + ";" + (bold ? "font-weight: bold;" : ""),
|
||||
"color: unset; font-weight: unset;",
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
export default Logger;
|
||||
export default Logger;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import {ModuleData} from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/packages.mjs";
|
||||
import { ModuleData } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/packages.mjs";
|
||||
import Globals from "../Globals";
|
||||
|
||||
export const getModuleInformation = async (): Promise<ModuleData> => {
|
||||
const systemOrModule = Globals.isModule ? "module" : "system"
|
||||
const module = await fetch(systemOrModule + "s/" + Globals.name + "/" + systemOrModule + ".json")
|
||||
return await module.json();
|
||||
};
|
||||
const systemOrModule = Globals.isModule ? "module" : "system";
|
||||
const module = await fetch(
|
||||
systemOrModule + "s/" + Globals.name + "/" + systemOrModule + ".json",
|
||||
);
|
||||
return await module.json();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user