BlueGit

timfa questward

Merge branch 'feature/hide-talk-without-dialogue'

timfa Tim Falken · pushed by timfa

Authored 2026-09-06 · 2 months ago

Hash
d39b04831f5be7a84218d3c7708ad220f1ef93c1
4 files changed +19 −6
client/src/play/main.js +3 −3
@@ -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
1142function canTalkToEntity (entity)
1142function canTalkToEntity (entity)
1143{
1143{
1144 return !!(entity && (entity.hasDialogue || entity.talkable || entity.hasShop));
1144 return !!(entity && (entity.hasDialogue || entity.hasShop));
1145}
1145}
1146
1146
1147function isApproachingCombatOrCast ()
1147function 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.hasDialogue
1200 ? "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}`,
server/tests/entityClick.test.js +14 −1
@@ -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
30test("default LMB prefers talk on peaceful talkable humanoids", () =>
30test("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: false
37 aggressive: false
37 }), "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: false
50 aggressive: false
49 }), false);
51 }), false);
50});
52});
51
53
54test("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
52test("default LMB approaches peaceful humanoids without talk or shop", () =>
65test("default LMB approaches peaceful humanoids without talk or shop", () =>
53{
66{
54 assert.equal(defaultLeftClickEntityAction({
67 assert.equal(defaultLeftClickEntityAction({
server/tests/quest-rewards.test.js +1 −1
@@ -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});
shared/combat/entityClick.js +1 −1
@@ -44,7 +44,7 @@ export function defaultLeftClickEntityAction (entity, context = {})
44 44
45 45 if (attackable && (aggressive || inCombat || guardHostile))
46 46 { return "attack"; }
47 if (entity.hasDialogue || entity.talkable || entity.hasShop)
47 if (entity.hasDialogue || entity.hasShop)
48 48 { return "talk"; }
49 49 // Peaceful body NPCs (vendors without shop UI yet, idle guards, CE staff, …): walk up.
50 50 if (isHumanoidMob(entity.mobTypeId) || isTownGuardMob(entity.mobTypeId))
@@ -44,7 +44,7 @@ export function defaultLeftClickEntityAction (entity, context = {})
44
44
45 if (attackable && (aggressive || inCombat || guardHostile))
45 if (attackable && (aggressive || inCombat || guardHostile))
46 { return "attack"; }
46 { return "attack"; }
47 if (entity.hasDialogue || entity.talkable || entity.hasShop)
47 if (entity.hasDialogue || entity.hasShop)
48 { return "talk"; }
48 { return "talk"; }
49 // Peaceful body NPCs (vendors without shop UI yet, idle guards, CE staff, …): walk up.
49 // Peaceful body NPCs (vendors without shop UI yet, idle guards, CE staff, …): walk up.
50 if (isHumanoidMob(entity.mobTypeId) || isTownGuardMob(entity.mobTypeId))
50 if (isHumanoidMob(entity.mobTypeId) || isTownGuardMob(entity.mobTypeId))