improved logger and more methods related to maps

This commit is contained in:
2025-08-22 00:34:11 -04:00
parent 2bbbac2870
commit d9b9530e9d
2 changed files with 23 additions and 8 deletions

View File

@@ -3,36 +3,49 @@
export class Logger {
public logname: string;
public loglevel: number;
constructor(name: string) {
this.logname = name;
}
this.loglevel = _G["ets_loglevel"];
PrintInfo(`Logger initialized for ${name} with loglevel ${this.loglevel}`);
}
log(message: string) {
const info = debug.getinfo(2, "Sl");
print(`[${this.logname}][Log]: ${message} was printed from ${info.short_src}:${info.currentline}`);
if(this.loglevel >= 5) {
print(`[${this.logname}][Log]: ${message} was printed from ${info.short_src}:${info.currentline}`);
}
}
debug(message: string) {
const info = debug.getinfo(2, "Sl");
PrintDebug(`[${this.logname}][Debug]: ${message} was printed from ${info.short_src}:${info.currentline}`);
if(this.loglevel >= 4) {
PrintDebug(`[${this.logname}][Debug]: ${message} was printed from ${info.short_src}:${info.currentline}`);
}
}
info(message: string) {
const info = debug.getinfo(2, "Sl");
PrintInfo(`[${this.logname}][Info]: ${message} was printed from ${info.short_src}:${info.currentline}`);
if(this.loglevel >= 3) {
PrintInfo(`[${this.logname}][Info]: ${message} was printed from ${info.short_src}:${info.currentline}`);
}
}
warn(message: string) {
const info = debug.getinfo(2, "Sl");
print(`\\27[33m[${this.logname}][Warn]: ${message} was printed from ${info.short_src}:${info.currentline}\\27[0m`);
if(this.loglevel >= 2) {
print(`\\27[33m[${this.logname}][Warn]: ${message} was printed from ${info.short_src}:${info.currentline}\\27[0m`);
}
}
error(message: string) {
const info = debug.getinfo(2, "Sl");
PrintError(`[${this.logname}][Error]: ${message} was printed from ${info.short_src}:${info.currentline}`);
if(this.loglevel >= 1) {
PrintError(`[${this.logname}][Error]: ${message} was printed from ${info.short_src}:${info.currentline}`);
}
}
}

View File

@@ -553,12 +553,14 @@ export function isBossDbCheck(entry: number): boolean {
left join creature c on ct.entry = c.id1
left join map_dbc m on c.map = m.ID
where
(ct.\`rank\` = 3 and InstanceType > 0)
((ct.\`rank\` = 3 and InstanceType > 0)
OR (ct.\`rank\` = 3 and ct.ScriptName like 'boss_%')
OR (ExpansionID = 1 and ct.ScriptName like '%boss%')
OR (m.InstanceType = 1 and ExperienceModifier = 2)
OR (m.InstanceType = 1 and ExperienceModifier = 2))
and entry = ${entry}`;
logger.debug(`Checking if ${entry} is a boss sql: ${sql}`);
const result = WorldDBQuery(sql);
if(result) {
return true;