Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/servers/ZoneServer2016/zonepackethandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { scheduler } from "node:timers/promises";
import { ZoneClient2016 as Client } from "./classes/zoneclient";
import { ZoneServer2016 } from "./zoneserver";
import { defaultEmotes } from "./data/emotes";
const apm = require("elastic-apm-node");
const debug = require("debug")("ZoneServer");

Expand Down Expand Up @@ -599,7 +600,7 @@ export class ZonePacketHandlers {
{}
);
}
CommandPlayDialogEffect(
async CommandPlayDialogEffect(
server: ZoneServer2016,
client: Client,
packet: ReceivedPacket<CommandPlayDialogEffect>
Expand All @@ -616,6 +617,30 @@ export class ZonePacketHandlers {
return;
}

// effectId 0 just means "cancel emote", no ownership check needed
if (effectId > 0 && !defaultEmotes.includes(effectId)) {
// Non-default emotes must be owned as an account item (e.g. case rewards)
let hasEmote = false;
const accountItems =
await server.accountInventoriesManager.getAccountItems(
client.loginSessionId
);
for (const accountItem of accountItems) {
if (accountItem && accountItem.itemDefinitionId) {
const itemDef = server.getItemDefinition(
accountItem.itemDefinitionId
);
if (itemDef && itemDef.PARAM1 === effectId) {
hasEmote = true;
break;
}
}
}
if (!hasEmote) {
return;
}
}

// Track that the player is playing an emote
if (effectId > 0) {
client.character.currentEmote = effectId;
Expand Down
Loading