Files
pirate-corsaire-server/Messages/AttackAbortMessage.js
T
2026-08-24 22:20:36 +02:00

26 lines
843 B
JavaScript

const AttackAbortedPacket = require("../Packets/AttackAborted");
const constants = require("../Data/constants");
const { TYPES } = constants;
const { ENTITY_TYPE_NPC } = TYPES;
module.exports = function (ws, message, player) {
const targetIdentifier = player.abortAttack();
if (!targetIdentifier) return;
const packet = AttackAbortedPacket({
authorID: targetIdentifier.id,
authorTypeID: targetIdentifier.typeID,
targetID: player.id,
targetTypeID: player.typeID
});
player.map.registerIndividualNetworkPacket(player.id, packet);
if (targetIdentifier.typeID === ENTITY_TYPE_NPC) {
const target = player.map.getEntityFromSubgroup(targetIdentifier.id);
if (!target) return;
target.determineMovementState();
};
};