|
|
@@ -48,11 +48,11 @@ class unitFps {
|
|
|
const meInCombat = () => mod.game.me.inCombat;
|
|
|
|
|
|
const isDropBlockable = (event) => {
|
|
|
- if (data.activeMode.blockDropItems && data.activeMode.blockDropItemsOptions) {
|
|
|
- if (data.activeMode.blockDropItemsOptions.all) {
|
|
|
+ if (data.activeMode.blockDropItems && data.activeMode.blockDropItems) {
|
|
|
+ if (data.activeMode.blockDropItems.all) {
|
|
|
return true;
|
|
|
}
|
|
|
- else if (data.activeMode.blockDropItemsOptions.templateId && utils.arraysHasIntersect(event.templateId, data.activeMode.blockDropItemsOptions.templateId)) {
|
|
|
+ else if (data.activeMode.blockDropItems.templateId && utils.arraysHasIntersect(event.templateId, data.activeMode.blockDropItems.templateId)) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
@@ -66,49 +66,51 @@ class unitFps {
|
|
|
};
|
|
|
|
|
|
const isServantBlockable = (event) => {
|
|
|
- if (data.activeMode.blockOwnServants && isMe(event.ownerId)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if (data.activeMode.blockAreaServants) {
|
|
|
- return true;
|
|
|
+ if (data.activeMode.blockServants) {
|
|
|
+ if (data.activeMode.blockServants.me && isMe(event.ownerId))
|
|
|
+ return true;
|
|
|
+ else if (data.activeMode.blockServants.area)
|
|
|
+ return true;
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
const isSummonsBlockable = (event) => {
|
|
|
- if (data.activeMode.blockOwnSummons && isMe(event.owner)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if (data.activeMode.blockAreaSummons && !isMe(event.owner)) {
|
|
|
- return true;
|
|
|
+ if (data.activeMode.blockSummons) {
|
|
|
+ if (data.activeMode.blockSummons.my && isMe(event.owner)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if (data.activeMode.blockSummons.area && !isMe(event.owner)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
const isNpcBlockable = (event) => {
|
|
|
- if (data.activeMode.blockNpcs && data.activeMode.blockNpcsOptions) {
|
|
|
- if (utils.arraysHasIntersect(event.templateId, data.activeMode.blockNpcsOptions.templateId)) {
|
|
|
+ if (data.activeMode.blockNpcs) {
|
|
|
+ if (utils.arraysHasIntersect(event.templateId, data.activeMode.blockNpcs.templateId)) {
|
|
|
return true;
|
|
|
}
|
|
|
- else if (utils.arraysHasIntersect(event.huntingZoneId, data.activeMode.blockNpcsOptions.huntingZoneId)) {
|
|
|
+ else if (utils.arraysHasIntersect(event.huntingZoneId, data.activeMode.blockNpcs.huntingZoneId)) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
- const isUserBlockable = (event) => {
|
|
|
- if (data.activeMode.blockPlayers && data.activeMode.blockPlayersOptions) {
|
|
|
- if (data.activeMode.blockPlayersOptions.all) {
|
|
|
+ const isPlayerBlockable = (event) => {
|
|
|
+ if (data.activeMode.blockPlayers) {
|
|
|
+ if (data.activeMode.blockPlayers.all) {
|
|
|
return true;
|
|
|
}
|
|
|
- else if (data.activeMode.blockPlayersOptions.class) {
|
|
|
- if (utils.arraysHasIntersect(data.userTemplateToClassMap[event.templateId], data.activeMode.blockPlayersOptions.class)) {
|
|
|
+ else if (data.activeMode.blockPlayers.class) {
|
|
|
+ if (utils.arraysHasIntersect(data.userTemplateToClassMap[event.templateId], data.activeMode.blockPlayers.class)) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- else if (data.activeMode.blockPlayersOptions.name) {
|
|
|
- if (utils.arraysHasIntersect(event.name, data.activeMode.blockPlayersOptions.name)) {
|
|
|
+ else if (data.activeMode.blockPlayers.name) {
|
|
|
+ if (utils.arraysHasIntersect(event.name, data.activeMode.blockPlayers.name)) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
@@ -169,7 +171,7 @@ class unitFps {
|
|
|
blockedNpcs.delete(event.gameId);
|
|
|
break;
|
|
|
case (ENTITY_HOOK_TYPE.SPAWN):
|
|
|
- if(tracker.spawnedSummons.has(event.gameId) && isSummonsBlockable(event)) {
|
|
|
+ if (tracker.spawnedSummons.has(event.gameId) && isSummonsBlockable(event)) {
|
|
|
blockedSummons.add(event.gameId);
|
|
|
return false;
|
|
|
}
|
|
|
@@ -187,7 +189,7 @@ class unitFps {
|
|
|
blockedPlayers.delete(event.gameId);
|
|
|
break;
|
|
|
case (ENTITY_HOOK_TYPE.SPAWN):
|
|
|
- if (isUserBlockable(event)) {
|
|
|
+ if (isPlayerBlockable(event)) {
|
|
|
blockedPlayers.add(event.gameId);
|
|
|
return false;
|
|
|
}
|
|
|
@@ -197,16 +199,16 @@ class unitFps {
|
|
|
|
|
|
const projectileHandler = (event) => {
|
|
|
if (isEntityBlocked(event.gameId)) return false;
|
|
|
- if (data.activeMode.blockProjectiles && data.activeMode.blockProjectilesOptions) {
|
|
|
- if (data.activeMode.blockProjectilesOptions.players && tracker.spawnedPlayers.has(event.gameId)) return false;
|
|
|
+ if (data.activeMode.blockProjectiles && data.activeMode.blockProjectiles) {
|
|
|
+ if (data.activeMode.blockProjectiles.players && tracker.spawnedPlayers.has(event.gameId)) return false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const blockAdditionalSkillEffectsHandler = (event) => {
|
|
|
if (isEntityBlocked(event.gameId)) return false;
|
|
|
- if (data.activeMode.blockAdditionalSkillEffects && data.activeMode.blockAdditionalSkillEffectsOptions) {
|
|
|
- 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.blockAdditionalSkillEffects && data.activeMode.blockAdditionalSkillEffects) {
|
|
|
+ if (data.activeMode.blockAdditionalSkillEffects.players && tracker.spawnedPlayers.has(event.gameId)) return false;
|
|
|
+ if (data.activeMode.blockAdditionalSkillEffects.own && isMe(event.gameId)) return false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -232,15 +234,17 @@ class unitFps {
|
|
|
};
|
|
|
|
|
|
const abnormalsHandler = (event) => {
|
|
|
- if ((data.activeMode.blockAreaBuffs && !isMe(event.target)) || isEntityBlocked(event.target)) return false;
|
|
|
+ if (data.activeMode.blockBuffs) {
|
|
|
+ if ((data.activeMode.blockBuffs.area && !isMe(event.target)) || isEntityBlocked(event.target)) return false;
|
|
|
|
|
|
- if (data.activeMode.blockHuntingRewardsBuffs && data.huntingRewardsBuffs.has(event.id)) return false;
|
|
|
- if (data.activeMode.blockShapeChangeBuffs && data.shapeChangersBuffs.has(event.id)) return false;
|
|
|
- if (data.activeMode.blockOnScreenEffectsBuffs && data.onScreenEffectsBuffs.has(event.id)) return false;
|
|
|
+ if (data.activeMode.blockBuffs.huntRewards && data.huntingRewardsBuffs.has(event.id)) return false;
|
|
|
+ if (data.activeMode.blockBuffs.shapeChange && data.shapeChangersBuffs.has(event.id)) return false;
|
|
|
+ if (data.activeMode.blockBuffs.effects && data.onScreenEffectsBuffs.has(event.id)) return false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const creatureChangeHpHandler = (event) => {
|
|
|
- if (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopupsOptions.hp && isMe(event.target)) {
|
|
|
+ if (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopups.hp && isMe(event.target)) {
|
|
|
if (event.type !== HPCHANGE.NORMAL) {
|
|
|
event.type = HPCHANGE.NORMAL;
|
|
|
return true;
|
|
|
@@ -249,7 +253,7 @@ class unitFps {
|
|
|
};
|
|
|
|
|
|
const creatureChangeMpHandler = (event) => {
|
|
|
- if (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopupsOptions.mp && isMe(event.target)) {
|
|
|
+ if (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopups.mp && isMe(event.target)) {
|
|
|
if (event.type !== MPCHANGE.DEFAULT) {
|
|
|
event.type = MPCHANGE.DEFAULT;
|
|
|
return true;
|
|
|
@@ -260,7 +264,7 @@ class unitFps {
|
|
|
const eachSkillResultHandler = (event) => {
|
|
|
if (isMe(event.source) || isMe(event.owner)) {
|
|
|
let res = undefined;
|
|
|
- if (data.activeMode.blockOwnHits) {
|
|
|
+ if (data.activeMode.blockHits && data.activeMode.blockHits.me) {
|
|
|
event.skill.id = 0;
|
|
|
event.templateId = 0;
|
|
|
event.superArmorId = 0;
|
|
|
@@ -274,7 +278,7 @@ class unitFps {
|
|
|
|
|
|
res = true;
|
|
|
}
|
|
|
- if (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopupsOptions.damage) {
|
|
|
+ if (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopups.damage) {
|
|
|
// eslint-disable-next-line no-magic-numbers
|
|
|
event.value = BigInt(0);
|
|
|
res = true;
|
|
|
@@ -282,7 +286,7 @@ class unitFps {
|
|
|
return res;
|
|
|
}
|
|
|
else if (
|
|
|
- data.activeMode.blockAreaHits && (tracker.spawnedPlayers.has(event.owner) || tracker.spawnedPlayers.has(event.source))
|
|
|
+ data.activeMode.blockHits && data.activeMode.blockHits.area && (tracker.spawnedPlayers.has(event.owner) || tracker.spawnedPlayers.has(event.source))
|
|
|
&& !isMe(event.target) && !isMe(event.source) && !isMe(event.owner)
|
|
|
) {
|
|
|
event.skill.id = 0;
|
|
|
@@ -300,7 +304,7 @@ class unitFps {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const fontSwapHandler = () => (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopupsOptions.damage ? false : undefined);
|
|
|
+ const fontSwapHandler = () => (data.activeMode.blockNumbersPopups && data.activeMode.blockNumbersPopups.damage ? false : undefined);
|
|
|
|
|
|
const dropIfBlockedHandler = (event) => {
|
|
|
let id = event.target || event.gameId;
|
|
|
@@ -375,7 +379,7 @@ class unitFps {
|
|
|
mod.hook(...proto.getData("S_NPC_LOCATION"), HOOK_SETTINGS.LAST, dropIfBlockedHandler);
|
|
|
mod.hook(...proto.getData("S_MOUNT_VEHICLE"), HOOK_SETTINGS.LAST, dropIfBlockedHandler);
|
|
|
mod.hook(...proto.getData("S_UNMOUNT_VEHICLE"), HOOK_SETTINGS.LAST, dropIfBlockedHandler);
|
|
|
-
|
|
|
+
|
|
|
//---------------------------------------
|
|
|
// Combined hooks with complicated logic
|
|
|
//---------------------------------------
|
|
|
@@ -439,7 +443,7 @@ class unitFps {
|
|
|
for (const [key, value] of tracker.spawnedPlayers.entries()) {
|
|
|
assert.ok(Object.keys(value).length > 3, "reconfigure event: wrong object players");
|
|
|
|
|
|
- let needBlock = isUserBlockable(value);
|
|
|
+ let needBlock = isPlayerBlockable(value);
|
|
|
if (needBlock && !blockedPlayers.has(key)) {
|
|
|
mod.send(...proto.getData("S_DESPAWN_USER"), { "gameId": value.gameId, "type": DESPAWN_TYPES.OUTOFVIEW });
|
|
|
blockedPlayers.add(key);
|