Skip to content

Apply 10 yard aggro when beginning to open an object that uses "Treasure" faction and lock type #2997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: development
Choose a base branch
from

Conversation

FlagFlayer
Copy link
Contributor

@FlagFlayer FlagFlayer commented Apr 5, 2025

🍰 Pullrequest

Self explanatory title.

Proof

From testing I found there are 2 conditions needed for an object to cause aggro:

  • The object uses a lockId that uses LOCKTYPE_TREASURE in Lock.dbc.

  • The object must use a faction template that uses faction 77 ("Treasure").

Aggro will result only if both requirements are met.

Results from testing on Classic 1.15 (can supply videos on request, forgot to film the objects that didn't cause aggro):

  • Opening an object with a lockId that uses LOCKTYPE_TREASURE but without a faction that doesn't use ID 77, e.g. Cat Figurine (Faction 0, lockId 57) or Venture Co. Engineering Plans (Faction 84 - uses Alliance Generic, lockId 57) does not aggro nearby mobs.

  • Opening an object with a faction that uses ID 77 but a lockId that doesn't use LOCKTYPE_TREASURE, e.g. Food Crate (Faction 94, lockId 43) does not aggro nearby mobs.

  • Opening an object with faction 94 and lockId 57 results in aggro:

https://i.imgur.com/wDSV9do.mp4

  • Opening a locked object with a lock that uses LOCKTYPE_TREASURE with faction that uses ID 77 (via any method) results in aggro:

https://i.imgur.com/eLaEJCB.mp4

Aggro occurs based on line of sight on any creatures that can attack the player (even if they're already in combat with a different player, the player will be set in combat with them on beginning to open the object)

Issues

How2Test

  • Open a chest -> Aggros nearby mobs
  • Open an object that has a different lockId and/or faction -> Does not aggro nearby mobs

Todo / Checklist

  • None

@ratkosrb
Copy link
Contributor

ratkosrb commented Apr 6, 2025

The indentation looks totally whack.

@FlagFlayer
Copy link
Contributor Author

Looked fine on the file itself. I'll try and adjust it

adjust indentation
@FlagFlayer
Copy link
Contributor Author

FlagFlayer commented Apr 7, 2025

Currently has an issue with handling factions 101 and 102 since the objects are openable by the object faction's friendly mask and should aggro based on the faction's hostile mask. Hostile marks are to prevent players from the same faction as the object from opening it (e.g. preventing Alliance players opening Alliance chests). The aggro is sent to any valid attacker in range.

Updated AnyUnfriendlyUnitInObjectRangeCheck to take WorldObject faction input, used this to fix bug relating to specific faction aggro on gameobjects
Use ToUnit instead of static cast without crash handling
How I missed this is beyond me
@ShiyoKozuki
Copy link
Contributor

I've been waiting for this for like 2 years!
Any chance you can merge in the current core to this? It has tons of merge conflicts if I try to take it as a PR.

@FlagFlayer
Copy link
Contributor Author

I've been waiting for this for like 2 years! Any chance you can merge in the current core to this? It has tons of merge conflicts if I try to take it as a PR.

Done

@ShiyoKozuki
Copy link
Contributor

ShiyoKozuki commented May 15, 2025

Thank you! Works wonderfully.
However, this still has the bug where opening rogue lockers that require lock picking skill aggro everything. (i.e. lockers in wetlands, NOT locked TREASURE chests)

@FlagFlayer
Copy link
Contributor Author

However, this still has the bug where opening rogue lockers that require lock picking skill aggro everything.

Yes. That is intended and correct behaviour. See this video from Classic.

Changes handled in latest commit (df189d7)
Correct edge cases with full logic
small mistake
@FlagFlayer FlagFlayer changed the title Correctly apply nearby aggro on start opening "Treasure" gameobjects with the correct lockId Apply 10 yard aggro when beginning opening an object that uses "Treasure" faction and lock type Jun 1, 2025
@FlagFlayer FlagFlayer changed the title Apply 10 yard aggro when beginning opening an object that uses "Treasure" faction and lock type Apply 10 yard aggro when beginning to open an object that uses "Treasure" faction and lock type Jun 1, 2025
Move execution from Spell::CheckCast to Spell::OnSpellLaunch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants