Hide Talk when a mob has no dialogue assigned.
Context menu and LMB only offer Talk for hasDialogue; shop-only NPCs keep Shop. Also align the quest bank letter test with quoted titles.
@@ -1141,7 +1141,7 @@ function isAttackableEntity (entity)
1141
1141
1142
1142
function canTalkToEntity (entity)
1143
1143
{
1144
return !!(entity && (entity.hasDialogue || entity.talkable || entity.hasShop));
1144
return !!(entity && (entity.hasDialogue || entity.hasShop));
1145
1145
}
1146
1146
1147
1147
function isApproachingCombatOrCast ()
@@ -1196,7 +1196,7 @@ function handleLeftClick (mouseX, mouseY)
1196
1196
}
1197
1197
if (clickAction === "talk")
1198
1198
{
1199
const purpose = entity.hasDialogue || (entity.talkable && !entity.hasShop)
1199
const purpose = entity.hasDialogue
1200
1200
? "talk"
1201
1201
: (entity.hasShop ? "shop" : "talk");
1202
1202
requestTalk(entity.entityId, purpose);
@@ -1353,7 +1353,7 @@ function handleRightClick (event, mouseX, mouseY)
1353
1353
onSelect: () => requestTalk(entity.entityId, "shop")
1354
1354
});
1355
1355
}
1356
if (entity.hasDialogue || (entity.talkable && !entity.hasShop))
1356
if (entity.hasDialogue)
1357
1357
{
1358
1358
items.push({
1359
1359
label: `Talk to ${targetName}`,
@@ -1141,7 +1141,7 @@ function isAttackableEntity (entity)1141
1141
1142
function canTalkToEntity (entity)1142
function canTalkToEntity (entity)1143
{1143
{1144
return !!(entity && (entity.hasDialogue || entity.talkable || entity.hasShop));1144
return !!(entity && (entity.hasDialogue || entity.hasShop));1145
}1145
}1146
1146
1147
function isApproachingCombatOrCast ()1147
function isApproachingCombatOrCast ()@@ -1196,7 +1196,7 @@ function handleLeftClick (mouseX, mouseY)1196
}1196
}1197
if (clickAction === "talk")1197
if (clickAction === "talk")1198
{1198
{1199
const purpose = entity.hasDialogue || (entity.talkable && !entity.hasShop)1199
const purpose = entity.hasDialogue1200
? "talk"1200
? "talk"1201
: (entity.hasShop ? "shop" : "talk");1201
: (entity.hasShop ? "shop" : "talk");1202
requestTalk(entity.entityId, purpose);1202
requestTalk(entity.entityId, purpose);@@ -1353,7 +1353,7 @@ function handleRightClick (event, mouseX, mouseY)1353
onSelect: () => requestTalk(entity.entityId, "shop")1353
onSelect: () => requestTalk(entity.entityId, "shop")1354
});1354
});1355
}1355
}1356
if (entity.hasDialogue || (entity.talkable && !entity.hasShop))1356
if (entity.hasDialogue)1357
{1357
{1358
items.push({1358
items.push({1359
label: `Talk to ${targetName}`,1359
label: `Talk to ${targetName}`,@@ -27,12 +27,13 @@ test("default LMB prefers attack on aggressive talkable humanoids", () =>
27
27
}), "attack");
28
28
});
29
29
30
test("default LMB prefers talk on peaceful talkable humanoids", () =>
30
test("default LMB prefers talk when dialogue or shop is available", () =>
31
31
{
32
32
assert.equal(defaultLeftClickEntityAction({
33
33
mobTypeId: MobId.humanoid,
34
34
canFight: true,
35
35
talkable: true,
36
hasDialogue: true,
36
37
aggressive: false
37
38
}), "talk");
38
39
assert.equal(defaultLeftClickEntityAction({
@@ -45,10 +46,22 @@ test("default LMB prefers talk on peaceful talkable humanoids", () =>
45
46
mobTypeId: MobId.humanoid,
46
47
canFight: true,
47
48
talkable: true,
49
hasDialogue: true,
48
50
aggressive: false
49
51
}), false);
50
52
});
51
53
54
test("default LMB approaches talkable humanoids without dialogue or shop", () =>
55
{
56
assert.equal(defaultLeftClickEntityAction({
57
mobTypeId: MobId.humanoid,
58
canFight: true,
59
talkable: true,
60
hasDialogue: false,
61
aggressive: false
62
}), "approach");
63
});
64
52
65
test("default LMB approaches peaceful humanoids without talk or shop", () =>
53
66
{
54
67
assert.equal(defaultLeftClickEntityAction({
@@ -27,12 +27,13 @@ test("default LMB prefers attack on aggressive talkable humanoids", () =>27
}), "attack");27
}), "attack");28
});28
});29
29
30
test("default LMB prefers talk on peaceful talkable humanoids", () =>30
test("default LMB prefers talk when dialogue or shop is available", () =>31
{31
{32
assert.equal(defaultLeftClickEntityAction({32
assert.equal(defaultLeftClickEntityAction({33
mobTypeId: MobId.humanoid,33
mobTypeId: MobId.humanoid,34
canFight: true,34
canFight: true,35
talkable: true,35
talkable: true,36
hasDialogue: true,36
aggressive: false37
aggressive: false37
}), "talk");38
}), "talk");38
assert.equal(defaultLeftClickEntityAction({39
assert.equal(defaultLeftClickEntityAction({@@ -45,10 +46,22 @@ test("default LMB prefers talk on peaceful talkable humanoids", () =>45
mobTypeId: MobId.humanoid,46
mobTypeId: MobId.humanoid,46
canFight: true,47
canFight: true,47
talkable: true,48
talkable: true,49
hasDialogue: true,48
aggressive: false50
aggressive: false49
}), false);51
}), false);50
});52
});51
53
54
test("default LMB approaches talkable humanoids without dialogue or shop", () =>55
{56
assert.equal(defaultLeftClickEntityAction({57
mobTypeId: MobId.humanoid,58
canFight: true,59
talkable: true,60
hasDialogue: false,61
aggressive: false62
}), "approach");63
});64
52
test("default LMB approaches peaceful humanoids without talk or shop", () =>65
test("default LMB approaches peaceful humanoids without talk or shop", () =>53
{66
{54
assert.equal(defaultLeftClickEntityAction({67
assert.equal(defaultLeftClickEntityAction({@@ -30,7 +30,7 @@ test("quest bank reward letter body names the quest and items", () =>
30
30
items: [{ itemId: ItemId.bones, quantity: 2 }]
31
31
});
32
32
assert.match(body, /^Dear Ada Worker,/);
33
assert.match(body, /quest Reward Test/);
33
assert.match(body, /quest "Reward Test"/);
34
34
assert.match(body, /• 2× Bones/);
35
35
assert.doesNotMatch(body, /Signed/);
36
36
});
@@ -30,7 +30,7 @@ test("quest bank reward letter body names the quest and items", () =>30
items: [{ itemId: ItemId.bones, quantity: 2 }]30
items: [{ itemId: ItemId.bones, quantity: 2 }]31
});31
});32
assert.match(body, /^Dear Ada Worker,/);32
assert.match(body, /^Dear Ada Worker,/);33
assert.match(body, /quest Reward Test/);33
assert.match(body, /quest "Reward Test"/);34
assert.match(body, /• 2× Bones/);34
assert.match(body, /• 2× Bones/);35
assert.doesNotMatch(body, /Signed/);35
assert.doesNotMatch(body, /Signed/);36
});36
});