Skip to content
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

Authentic Handling of Mission-Related Barker Messages #266

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

FinnHornhoover
Copy link
Contributor

This PR addresses two issues with the current implementation:

  • The NPC IDs sent by the client in a sP_CL2FE_REQ_BARKER object are usually fixed within chunks. Meaning, the ID of the first available "mission barker" NPC is fixed, even if the player exits and reenters the chunk. This seems to be unlike the original game, and the client logic in this issue seems to have stayed constant through all the standard builds. Ergo, there is a need to decide the "mission barker" NPC on the server side (which appears to be chosen randomly within nearby NPCs in the original game's recordings).
  • All NPCs have a field called m_iBarkerType, that controls which element of the m_iHBarkerTextID array (of the mission task that is selected by the client) gets to be the barker string that is sent back to the client. NPCs without a m_iBarkerType value between 1 and 4 (inclusive) cannot output mission-related barker text. In all recordings of the original game reviewed thus far, the game seems to respect which NPC can say which lines, which is unlike the current behavior where we randomize between the 4 barker type options. Therefore, the randomization is removed in favor of the authentic behavior observed.

The revised behavior is as follows:

  • Ensure the mission task sent by the client exists, and figure out its m_iHBarkerTextID array.
  • Figure out the player from the socket, and traverse all entities within its viewable chunks.
  • When an entitiy is found that leads to a valid barker text ID within the m_iHBarkerTextID array; it is added to a list.
  • Among the entries found, a random one is selected. Using the random NPC and its valid barker text ID, a reply packet is constructed and sent, causing the client to display a mission-related random barker text bubble.
  • If no entry is found, no reply packet is sent.

src/NPCManager.cpp Show resolved Hide resolved
src/NPCManager.cpp Outdated Show resolved Hide resolved
src/NPCManager.cpp Show resolved Hide resolved
Co-authored-by: Gent Semaj <gsemaj@proton.me>
@yungcomputerchair yungcomputerchair merged commit d9ebb4e into OpenFusionProject:master Dec 12, 2023
3 checks passed
@FinnHornhoover FinnHornhoover deleted the barker-fix branch December 12, 2023 16:18
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.

2 participants