Skip to content

Conversation

@tchalvak
Copy link
Member

Purpose of PR:

Before

After

For Non-Hotfixes:

Attached Screenshot of my change:

Things that make review take longer:

(remove lines that do not apply to this PR)

  • Changing more than 20 files (much harder to review)
  • Changing more than 5 files (a bit harder to review)
  • Changes to critical code (login, dashboard, etc)
  • No comments on changed files
  • Tests do not pass (will get pushed back)

Things that make review faster and easier:

(check box with an x where it applies)

  • I attached a screenshot of the changed part of the app working
  • I added tests
  • This feature is requested specifically by a user
  • This will fix a bug

Preview results in my branch at the url:

Copy link

@evolua-app evolua-app bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Analysis Results:
1 issues found (0 critical, 1 high, 0 medium, 0 low)

Key Findings (Critical & High):

  • Potential undefined constant usage in stealth status check in deploy/lib/control/NpcController.php
Files Analyzed
File Path Changes Issues Found
deploy/lib/control/NpcController.php 4 1

This analysis was performed by Evolua. For support, please contact our team.

Comment on lines +328 to +329
if ($player->hasStatus(STEALTH) &&
(in_array(strtolower($victim), self::$STEALTH_REMOVING_NPCS) || ($npco && $npco->hasTrait('stealth_removing')))) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential undefined constant usage in stealth status check

The code uses STEALTH as a constant in the condition $player->hasStatus(STEALTH), but there is no visible declaration of this constant in the provided code. If this constant is undefined, it will be interpreted as a string literal 'STEALTH', which might cause the hasStatus check to fail silently, allowing players to maintain stealth status incorrectly when attacking NPCs that should remove it.

Impact

This could lead to gameplay imbalance where players can attack certain NPCs while maintaining stealth when they shouldn't be allowed to. This breaks game mechanics and could potentially be exploited by players.

References

Recommendation

Either define the STEALTH constant if it's missing, or use a string literal if that's the intended behavior. If the constant is defined elsewhere in the codebase, consider importing it or using a class constant instead for better maintainability.

if ($player->hasStatus(Player::STEALTH) && 
    (in_array(strtolower($victim), self::$STEALTH_REMOVING_NPCS) || ($npco && $npco->hasTrait('stealth_removing')))) {
📝 Suggested fix

‼️ IMPORTANT
Please review this suggestion carefully before applying:

  • Verify it matches your codebase standards
  • Ensure it doesn't introduce new issues
  • Test thoroughly after applying
Suggested change
if ($player->hasStatus(STEALTH) &&
(in_array(strtolower($victim), self::$STEALTH_REMOVING_NPCS) || ($npco && $npco->hasTrait('stealth_removing')))) {
if ($player->hasStatus(Player::STEALTH) &&
(in_array(strtolower($victim), self::$STEALTH_REMOVING_NPCS) || ($npco && $npco->hasTrait('stealth_removing')))) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I think this is the old “defined globally” constant problem.

@cypress
Copy link

cypress bot commented Jul 31, 2025

NinjaWars Functional Testing    Run #775

Run Properties:  status check passed Passed #775  •  git commit 4875f63d73 ℹ️: Merge 21c987cb765c1f25831429d7009434bb72fa052e into cd149540000a3d55658830599b5f...
Project NinjaWars Functional Testing
Branch Review feat/npm-updates
Run status status check passed Passed #775
Run duration 02m 00s
Commit git commit 4875f63d73 ℹ️: Merge 21c987cb765c1f25831429d7009434bb72fa052e into cd149540000a3d55658830599b5f...
Committer Coco R
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 14
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@tchalvak tchalvak changed the title Feat/npm updates Create starting samurai autogen npc Jul 31, 2025
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