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

Added 2 else if's in npctalk.cpp to check for blindness, and if blind… #56917

Closed

Conversation

LiramuIorin
Copy link

@LiramuIorin LiramuIorin commented Apr 19, 2022

Summary

Bugfixes "Player no longer able to look_at or size_up when is_blind returns true."

Purpose of change

Fixes #55803, to prevent the player from viewing npcs once blinded, whether blindfolds were used or otherwise. Originally, if the player interacted with an npc and looked at them while wearing a blindfold, they get the relevant statistics, which shouldn't happen without sight.

Describe the solution

Added a blindness check for the 2 else ifs in "npctalk.cpp" to display info, and added another 2 else ifs below them to return text if the player was blind, notifying them of that status. So, if the player looks at an npc when blindfolded, they get "You cannot look at characters when blinded" instead.

Describe alternatives you've considered

Once I found the is_blind() method, I knew I just needed to put that check where and npc was inspected. I considered adding the check to faction_camp.cpp, and npctalk_funcs, as they both have a place where npcs are looked at, but frankly I didn't know how to test for faction_camp in-game, and npctalk_funcs's uses are not familiar to me, as adding the check there did nothing to the standard interaction with an npc.

Testing

I ran the unit tests, first off. Then I tried looking at npcs without a blindfold, could see stats. I tried again after wearing a blindfold, got the message I put it instead. Took off the blindfold, and I could see stats again. I suggest trying it in other situations where the player can inspect an npc, I am not completely familiar with all the possible interactions yet. I also ran the file "npctalk.cpp" through astyle in the cmd as requested, using the options available in CODE_STYLE.md

Additional context

…, show text on blindness rather than statistics.
@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) labels Apr 19, 2022
@NetSysFire NetSysFire added the NPC / Factions NPCs, AI, Speech, Factions, Ownership label Apr 19, 2022
@NetSysFire
Copy link
Member

NetSysFire commented Apr 19, 2022

You need to resolve the conflicts and also get rid of all that leading whitespace in your PR summary, it messes it up by making everything into code blocks.

Also, please also link to the issue you are fixing.

@Night-Pryanik
Copy link

Sorry @LiramuIorin #55874 was merged before I got a chance to look at your PR. I think your PR could be closed for now as it's essentially doing the same.

@BrettDong BrettDong added the (S3 - Duplicate) Bug that is duplicate of another one label Apr 19, 2022
@LiramuIorin
Copy link
Author

I linked the issue under purpose of change. Since the other PR was merged I'll close this.

@LiramuIorin LiramuIorin deleted the blindness_exploit branch May 3, 2022 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` NPC / Factions NPCs, AI, Speech, Factions, Ownership (S3 - Duplicate) Bug that is duplicate of another one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exploit: You can look at NPCs while blind
4 participants