Skip to content

Various NPC fixes/enhancements#2433

Merged
hemberger merged 7 commits into
smrealms:mainfrom
hemberger:npc-various
May 11, 2026
Merged

Various NPC fixes/enhancements#2433
hemberger merged 7 commits into
smrealms:mainfrom
hemberger:npc-various

Conversation

@hemberger
Copy link
Copy Markdown
Member

  • Tweak HTML on the "Hire Trader" page
  • Add Race/Last Active columns in the table on the "Manage NPCs" page.
  • Alliance leader now gets a message if NPC is dismissed by someone else.
  • Alliance Bank Report now identifies NPCs.
  • News entries now include alliance membership.
  • Fix bug allowing players to hire more than 3 NPCs.

hemberger added 3 commits May 11, 2026 05:16
Add a newline between the message and the table. It was too cramped
previously.
Call it "Action" like in many other similar tables. This makes the table
look a bit less weird when there are NPCs but they are not allowed to be
hired.
This is especially useful for notifying the leader when an NPC is fired.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.60%. Comparing base (149fe58) to head (0f2c9b5).

Files with missing lines Patch % Lines
src/lib/Smr/Player.php 0.00% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2433      +/-   ##
============================================
- Coverage     35.62%   35.60%   -0.02%     
- Complexity     4314     4319       +5     
============================================
  Files           132      132              
  Lines         12898    12905       +7     
============================================
  Hits           4595     4595              
- Misses         8303     8310       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

hemberger added 4 commits May 11, 2026 05:27
Helpful for deciding which NPC should get the axe.
This helps make it more obvious what the NPC contributions are.

Switching to using Player methods to get the display name, rather than
manually constructing it. Modified Player::getDisplayName to optionally
omit the alignment-based name color. This was needed to recover the
original color in the bank report. Could have also added an option to
omit the player ID (again, to retain original behavior of the report),
but I think it's useful to include the player IDs here for the same
reasons we include them almost everywhere.
This is motivated by the fact that hired NPCs leave their alliance after
being podded, so it is not obvious to see which alliance they were in at
the time they were podded. But I think it may also be a nice way to make
the news more informative.

The main downside is that it is a bit wordy when the player also has a
named ship.
Since Player::joinAlliance only updates the player alliance in PHP,
subsequent calls to Player::getAlliancePlayers will not include the new
player if the cache has not already been populated.

This was the case in HireTrader when loaded from HireTraderProcessor,
which would therefore allow hiring NPCs over the limit of 3. The option
would only display for a split second for AJAX-enabled users, but it was
persistent if AJAX was disabled.

Managing state consistency between PHP and the database is challenging,
and hopefully this can be fixed with transactions once we fully migrate
to InnoDB.
@hemberger hemberger merged commit 9be96e0 into smrealms:main May 11, 2026
8 of 10 checks passed
@hemberger hemberger deleted the npc-various branch May 11, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant