|
@@ -25,7 +25,7 @@ class unitFps {
|
|
|
const tracker = deps.tracker;
|
|
const tracker = deps.tracker;
|
|
|
const proto = deps.proto;
|
|
const proto = deps.proto;
|
|
|
|
|
|
|
|
- let throttledDAta = {};
|
|
|
|
|
|
|
+ let throttlePacketsData = {};
|
|
|
|
|
|
|
|
const blockedPlayers = new Set();
|
|
const blockedPlayers = new Set();
|
|
|
const blockedNpcs = new Set();
|
|
const blockedNpcs = new Set();
|
|
@@ -106,6 +106,11 @@ class unitFps {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (data.activeMode.blockPlayersOptions.name) {
|
|
|
|
|
+ if (utils.arraysHasIntersect(event.name, data.activeMode.blockPlayersOptions.class)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
};
|
|
};
|
|
@@ -163,7 +168,7 @@ class unitFps {
|
|
|
blockedNpcs.delete(event.gameId);
|
|
blockedNpcs.delete(event.gameId);
|
|
|
break;
|
|
break;
|
|
|
case (ENTITY_HOOK_TYPE.SPAWN):
|
|
case (ENTITY_HOOK_TYPE.SPAWN):
|
|
|
- if(tracker.summons.has(event.gameId) && isSummonsBlockable(event)) {
|
|
|
|
|
|
|
+ if(tracker.spawnedSummons.has(event.gameId) && isSummonsBlockable(event)) {
|
|
|
blockedSummons.add(event.gameId);
|
|
blockedSummons.add(event.gameId);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -192,20 +197,20 @@ class unitFps {
|
|
|
const projectileHandler = (event) => {
|
|
const projectileHandler = (event) => {
|
|
|
if (isEntityBlocked(event.gameId)) return false;
|
|
if (isEntityBlocked(event.gameId)) return false;
|
|
|
if (data.activeMode.blockProjectiles && data.activeMode.blockProjectilesOptions) {
|
|
if (data.activeMode.blockProjectiles && data.activeMode.blockProjectilesOptions) {
|
|
|
- if (data.activeMode.blockProjectilesOptions.players && tracker.users.has(event.gameId)) return false;
|
|
|
|
|
|
|
+ if (data.activeMode.blockProjectilesOptions.players && tracker.spawnedPlayers.has(event.gameId)) return false;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const blockAdditionalSkillEffectsHandler = (event) => {
|
|
const blockAdditionalSkillEffectsHandler = (event) => {
|
|
|
if (isEntityBlocked(event.gameId)) return false;
|
|
if (isEntityBlocked(event.gameId)) return false;
|
|
|
if (data.activeMode.blockAdditionalSkillEffects && data.activeMode.blockAdditionalSkillEffectsOptions) {
|
|
if (data.activeMode.blockAdditionalSkillEffects && data.activeMode.blockAdditionalSkillEffectsOptions) {
|
|
|
- if (data.activeMode.blockAdditionalSkillEffectsOptions.players && tracker.users.has(event.gameId)) return false;
|
|
|
|
|
|
|
+ if (data.activeMode.blockAdditionalSkillEffectsOptions.players && tracker.spawnedPlayers.has(event.gameId)) return false;
|
|
|
if (data.activeMode.blockAdditionalSkillEffectsOptions.own && isMe(event.gameId)) return false;
|
|
if (data.activeMode.blockAdditionalSkillEffectsOptions.own && isMe(event.gameId)) return false;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const smtHandler = (event) => (
|
|
const smtHandler = (event) => (
|
|
|
- (data.activeMode.blockAnnoyingScreenMessages && data.smtsSet.has(mod.parseSystemMessage(event.message).id))
|
|
|
|
|
|
|
+ (data.activeMode.blockAnnoyingScreenMessages && data.smtData.has(mod.parseSystemMessage(event.message).id))
|
|
|
? false
|
|
? false
|
|
|
: undefined
|
|
: undefined
|
|
|
);
|
|
);
|
|
@@ -220,8 +225,8 @@ class unitFps {
|
|
|
|
|
|
|
|
const throttlePacketsHandler = (name, code, data) => {
|
|
const throttlePacketsHandler = (name, code, data) => {
|
|
|
// eslint-disable-next-line no-magic-numbers
|
|
// eslint-disable-next-line no-magic-numbers
|
|
|
- let needBlock = (data.activeMode.throttleSomePackets && throttledDAta[name] && (Buffer.compare(throttledDAta[name], data) === 0));
|
|
|
|
|
- throttledDAta[name] = data;
|
|
|
|
|
|
|
+ let needBlock = (data.activeMode.throttleSomePackets && throttlePacketsData[name] && (Buffer.compare(throttlePacketsData[name], data) === 0));
|
|
|
|
|
+ throttlePacketsData[name] = data;
|
|
|
return needBlock ? true : undefined;
|
|
return needBlock ? true : undefined;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -272,7 +277,7 @@ class unitFps {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
else if (
|
|
else if (
|
|
|
- data.activeMode.blockAreaHits && (tracker.users.has(event.owner) || tracker.users.has(event.source))
|
|
|
|
|
|
|
+ data.activeMode.blockAreaHits && (tracker.spawnedPlayers.has(event.owner) || tracker.spawnedPlayers.has(event.source))
|
|
|
&& !isMe(event.target) && !isMe(event.source) && !isMe(event.owner)
|
|
&& !isMe(event.target) && !isMe(event.source) && !isMe(event.owner)
|
|
|
) {
|
|
) {
|
|
|
event.skill.id = 0;
|
|
event.skill.id = 0;
|
|
@@ -306,7 +311,7 @@ class unitFps {
|
|
|
if (isEntityBlocked(event.gameId) || data.activeMode.blockCustomAppearanceChanges) return false;
|
|
if (isEntityBlocked(event.gameId) || data.activeMode.blockCustomAppearanceChanges) return false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const achievementHandler = () => ((data.activeMode.blockAchievementSpamInCombat && meInCombat()) ? false : undefined);
|
|
|
|
|
|
|
+ const achievementHandler = () => ((data.activeMode.blockAchievementsInCombat && meInCombat()) ? false : undefined);
|
|
|
|
|
|
|
|
const cleanup = () => {
|
|
const cleanup = () => {
|
|
|
console.log("DEBUG: unitFps -> cleanup");
|
|
console.log("DEBUG: unitFps -> cleanup");
|
|
@@ -401,18 +406,18 @@ class unitFps {
|
|
|
if (data.prevMode.blockCollections !== data.activeMode.blockCollections) {
|
|
if (data.prevMode.blockCollections !== data.activeMode.blockCollections) {
|
|
|
switch (data.activeMode.blockCollections) {
|
|
switch (data.activeMode.blockCollections) {
|
|
|
case (true):
|
|
case (true):
|
|
|
- for (const value of tracker.collections.values()) {
|
|
|
|
|
|
|
+ for (const value of tracker.spawnedCollections.values()) {
|
|
|
mod.send(...proto.getData("S_DESPAWN_COLLECTION"), value);
|
|
mod.send(...proto.getData("S_DESPAWN_COLLECTION"), value);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case (false):
|
|
case (false):
|
|
|
- for (const value of tracker.collections.values()) {
|
|
|
|
|
|
|
+ for (const value of tracker.spawnedCollections.values()) {
|
|
|
mod.send(...proto.getData("S_SPAWN_COLLECTION"), value);
|
|
mod.send(...proto.getData("S_SPAWN_COLLECTION"), value);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- for (const [key, value] of tracker.drop.entries()) {
|
|
|
|
|
|
|
+ for (const [key, value] of tracker.spawnedDrop.entries()) {
|
|
|
let needBlock = isDropBlockable(value);
|
|
let needBlock = isDropBlockable(value);
|
|
|
if (needBlock && !blockedDrop.has(key)) {
|
|
if (needBlock && !blockedDrop.has(key)) {
|
|
|
mod.send(...proto.getData("S_DESPAWN_DROPITEM"), value);
|
|
mod.send(...proto.getData("S_DESPAWN_DROPITEM"), value);
|
|
@@ -424,7 +429,7 @@ class unitFps {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for (const [key, value] of tracker.users.entries()) {
|
|
|
|
|
|
|
+ for (const [key, value] of tracker.spawnedPlayers.entries()) {
|
|
|
let needBlock = isUserBlockable(value);
|
|
let needBlock = isUserBlockable(value);
|
|
|
if (needBlock && !blockedPlayers.has(key)) {
|
|
if (needBlock && !blockedPlayers.has(key)) {
|
|
|
mod.send(...proto.getData("S_DESPAWN_USER"), value);
|
|
mod.send(...proto.getData("S_DESPAWN_USER"), value);
|
|
@@ -436,7 +441,7 @@ class unitFps {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for (const [key, value] of tracker.servants.entries()) {
|
|
|
|
|
|
|
+ for (const [key, value] of tracker.spawnedServants.entries()) {
|
|
|
let needBlock = isServantBlockable(value);
|
|
let needBlock = isServantBlockable(value);
|
|
|
if (needBlock && !blockedServants.has(key)) {
|
|
if (needBlock && !blockedServants.has(key)) {
|
|
|
mod.send(...proto.getData("S_REQUEST_DESPAWN_SERVANT"), value);
|
|
mod.send(...proto.getData("S_REQUEST_DESPAWN_SERVANT"), value);
|
|
@@ -448,7 +453,7 @@ class unitFps {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for (const [key, value] of tracker.summons.entries()) {
|
|
|
|
|
|
|
+ for (const [key, value] of tracker.spawnedSummons.entries()) {
|
|
|
let needBlock = isSummonsBlockable(value);
|
|
let needBlock = isSummonsBlockable(value);
|
|
|
if (needBlock && !blockedSummons.has(key)) {
|
|
if (needBlock && !blockedSummons.has(key)) {
|
|
|
mod.send(...proto.getData("S_DESPAWN_NPC"), value);
|
|
mod.send(...proto.getData("S_DESPAWN_NPC"), value);
|
|
@@ -460,7 +465,7 @@ class unitFps {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for (const [key, value] of tracker.npcs.entries()) {
|
|
|
|
|
|
|
+ for (const [key, value] of tracker.spawnedNPCS.entries()) {
|
|
|
let needBlock = isSummonsBlockable(value);
|
|
let needBlock = isSummonsBlockable(value);
|
|
|
if (needBlock && !blockedNpcs.has(key)) {
|
|
if (needBlock && !blockedNpcs.has(key)) {
|
|
|
mod.send(...proto.getData("S_DESPAWN_NPC"), value);
|
|
mod.send(...proto.getData("S_DESPAWN_NPC"), value);
|