fix event
This commit is contained in:
parent
e95b6ae8d3
commit
e1ba4ea26b
|
@ -110,7 +110,7 @@ class RpgEvent {
|
||||||
this.setSuccess(success, false);
|
this.setSuccess(success, false);
|
||||||
let eventTimestamp = await nextEvent();
|
let eventTimestamp = await nextEvent();
|
||||||
if (!eventTimestamp) {
|
if (!eventTimestamp) {
|
||||||
eventTimestamp = await Event.setNextEvent();
|
eventTimestamp = await RpgEvent.setNextEvent();
|
||||||
await this.calcEventCenter();
|
await this.calcEventCenter();
|
||||||
const [x, y, w, h] = this.eventArea;
|
const [x, y, w, h] = this.eventArea;
|
||||||
await protectCanvasArea(CANVAS_ID, x, y, w, h, true);
|
await protectCanvasArea(CANVAS_ID, x, y, w, h, true);
|
||||||
|
@ -163,8 +163,8 @@ class RpgEvent {
|
||||||
const timestamp = await nextEvent();
|
const timestamp = await nextEvent();
|
||||||
const x = i * TILE_SIZE - canvasSize / 2;
|
const x = i * TILE_SIZE - canvasSize / 2;
|
||||||
const y = j * TILE_SIZE - canvasSize / 2;
|
const y = j * TILE_SIZE - canvasSize / 2;
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
`Suspicious activity spotted in ${Event.getDirection(x, y)}`,
|
`Suspicious activity spotted in ${RpgEvent.getDirection(x, y)}`,
|
||||||
);
|
);
|
||||||
drawCross([i, j], 19, 0, 13);
|
drawCross([i, j], 19, 0, 13);
|
||||||
logger.info(`Set next Event in 60min at ${x},${y}`);
|
logger.info(`Set next Event in 60min at ${x},${y}`);
|
||||||
|
@ -207,8 +207,8 @@ class RpgEvent {
|
||||||
if (eventState !== 3 && eventState !== 4) {
|
if (eventState !== 3 && eventState !== 4) {
|
||||||
this.eventState = 3;
|
this.eventState = 3;
|
||||||
const [x, y] = this.eventArea;
|
const [x, y] = this.eventArea;
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
`Unstable area at ${Event.getDirection(x, y)} at concerning level`,
|
`Unstable area at ${RpgEvent.getDirection(x, y)} at concerning level`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (eventState !== 3) {
|
if (eventState !== 3) {
|
||||||
|
@ -240,7 +240,7 @@ class RpgEvent {
|
||||||
const rand = Math.random() * 3000 - 500;
|
const rand = Math.random() * 3000 - 500;
|
||||||
return Math.floor(z + TILE_SIZE * 1.5 + rand);
|
return Math.floor(z + TILE_SIZE * 1.5 + rand);
|
||||||
});
|
});
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
`Alert! Threat is rising in 2min near #d,${xNear},${yNear},30`,
|
`Alert! Threat is rising in 2min near #d,${xNear},${yNear},30`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ class RpgEvent {
|
||||||
// 1min till Event: blinking solid cross red small fase
|
// 1min till Event: blinking solid cross red small fase
|
||||||
if (eventState !== 9 && eventState !== 10) {
|
if (eventState !== 9 && eventState !== 10) {
|
||||||
this.eventState = 9;
|
this.eventState = 9;
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
'Alert! Danger!',
|
'Alert! Danger!',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ class RpgEvent {
|
||||||
const [x, y, w, h] = this.eventArea;
|
const [x, y, w, h] = this.eventArea;
|
||||||
await protectCanvasArea(CANVAS_ID, x, y, w, h, false);
|
await protectCanvasArea(CANVAS_ID, x, y, w, h, false);
|
||||||
logger.info(`Starting Event at ${x},${y} now`);
|
logger.info(`Starting Event at ${x},${y} now`);
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
'Fight starting!',
|
'Fight starting!',
|
||||||
);
|
);
|
||||||
this.void = new Void(this.eventCenterC);
|
this.void = new Void(this.eventCenterC);
|
||||||
|
@ -284,7 +284,7 @@ class RpgEvent {
|
||||||
if (percent === 100) {
|
if (percent === 100) {
|
||||||
// event lost
|
// event lost
|
||||||
logger.info(`Event got lost after ${Math.abs(eventMinutes)} min`);
|
logger.info(`Event got lost after ${Math.abs(eventMinutes)} min`);
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
'Threat couldn\'t be contained, abandon area',
|
'Threat couldn\'t be contained, abandon area',
|
||||||
);
|
);
|
||||||
this.setSuccess(2);
|
this.setSuccess(2);
|
||||||
|
@ -294,7 +294,7 @@ class RpgEvent {
|
||||||
} else {
|
} else {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (now > this.chatTimeout) {
|
if (now > this.chatTimeout) {
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
`Clown Void reached ${percent}% of its max size`,
|
`Clown Void reached ${percent}% of its max size`,
|
||||||
);
|
);
|
||||||
this.chatTimeout = now + 40000;
|
this.chatTimeout = now + 40000;
|
||||||
|
@ -311,7 +311,7 @@ class RpgEvent {
|
||||||
if (this.void.checkStatus() !== 100) {
|
if (this.void.checkStatus() !== 100) {
|
||||||
// event won
|
// event won
|
||||||
logger.info('Event got won! Cooldown sitewide now half.');
|
logger.info('Event got won! Cooldown sitewide now half.');
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
'Threat successfully defeated. Good work!',
|
'Threat successfully defeated. Good work!',
|
||||||
);
|
);
|
||||||
this.setSuccess(1);
|
this.setSuccess(1);
|
||||||
|
@ -329,7 +329,7 @@ class RpgEvent {
|
||||||
// 5min after last Event
|
// 5min after last Event
|
||||||
// end debuff if lost
|
// end debuff if lost
|
||||||
if (this.success === 2) {
|
if (this.success === 2) {
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
'Void seems to leave again.',
|
'Void seems to leave again.',
|
||||||
);
|
);
|
||||||
this.setSuccess(0);
|
this.setSuccess(0);
|
||||||
|
@ -345,7 +345,7 @@ class RpgEvent {
|
||||||
logger.info('Restoring old event area');
|
logger.info('Restoring old event area');
|
||||||
await clearOldEvent();
|
await clearOldEvent();
|
||||||
if (this.success === 1) {
|
if (this.success === 1) {
|
||||||
Event.broadcastChatMessage(
|
RpgEvent.broadcastChatMessage(
|
||||||
'Celebration time over, get back to work.',
|
'Celebration time over, get back to work.',
|
||||||
);
|
);
|
||||||
this.setSuccess(0);
|
this.setSuccess(0);
|
||||||
|
@ -358,7 +358,7 @@ class RpgEvent {
|
||||||
} else {
|
} else {
|
||||||
// 50min after last Event / 1h before next Event
|
// 50min after last Event / 1h before next Event
|
||||||
// define and protect it
|
// define and protect it
|
||||||
this.eventTimestamp = await Event.setNextEvent();
|
this.eventTimestamp = await RpgEvent.setNextEvent();
|
||||||
await this.calcEventCenter();
|
await this.calcEventCenter();
|
||||||
const [x, y, w, h] = this.eventArea;
|
const [x, y, w, h] = this.eventArea;
|
||||||
await protectCanvasArea(CANVAS_ID, x, y, w, h, true);
|
await protectCanvasArea(CANVAS_ID, x, y, w, h, true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user