Skip to content

Combat-Reports-should-include-wreckage-created-section-#1175#1301

Merged
Geda173 merged 11 commits into
lanedirt:mainfrom
piciolo:Combat-Reports-should-include-wreckage-created-section-#1175
Mar 29, 2026
Merged

Combat-Reports-should-include-wreckage-created-section-#1175#1301
Geda173 merged 11 commits into
lanedirt:mainfrom
piciolo:Combat-Reports-should-include-wreckage-created-section-#1175

Conversation

@piciolo

@piciolo piciolo commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Description
This PR implements the persistence and display of the "Wreckage created" section within combat reports, specifically for battles involving a Space Dock.

Changes:

Backend Persistence: AttackMission now extracts ship data from battleResult.wreckField and persists it into the report->wreckage attribute during battle report creation.

Data Processing: BattleReport has been updated to extract this data into a UnitCollection (following the existing pattern for repaired defenses), providing $wreckage_count and $wreckage_units to the view.

Frontend UI: The battle_report_full.blade.php template now includes a dedicated section for wreckage, complete with unit icons and counts, positioned before the Wreck Field summary.

Localization: Added the battle_wreckage_created translation key for English, Italian, and Dutch.

Type of Change:
[ ] Bug fix

[x] Feature enhancement

[ ] Documentation update

[ ] Other (please describe):

Related Issues
Fixes #1175

Checklist
[x] Automated Refactoring: Rector has been run and no outstanding issues remain.

[x] Code Standards: Code adheres to PSR-12 coding standards. Verified with Laravel Pint.

[x] Static Analysis: Code passes PHPStan static code analysis.

[x] Testing:

Relevant unit and feature tests are included or updated.

Tests successfully run locally.

[x] CSS & JS Build: CSS and JS assets are compiled using Laravel Mix.

Additional Information
Existing combat reports in the database will remain functional. Since they lack the wreckage data, the new section will simply not be rendered for them, ensuring full backward compatibility.

image

@Geda173

Geda173 commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Hi @piciolo,

I just tested your changes. I noticed the players with the General class are not included in your changes. They too create wreckage that is transported back, as long as there is one surviving ship that makes it back to the origin. Your branch is also behind on the latest changes. There was a substantial addition in AttackMission.php, which should be taken into consideration when fixing this issue.

@piciolo

piciolo commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up and the thorough review!

You're absolutely right about the General class wreckage logic—I missed that specific "surviving ship" requirement. I also noticed my branch was out of sync with the recent substantial changes in AttackMission.php.

I've just updated everything and it's now fully aligned. Let me know if I should push the updates to this same PR or if you'd prefer a fresh, clean one. Thanks!

@Geda173

Geda173 commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the heads-up and the thorough review!

You're absolutely right about the General class wreckage logic—I missed that specific "surviving ship" requirement. I also noticed my branch was out of sync with the recent substantial changes in AttackMission.php.

I've just updated everything and it's now fully aligned. Let me know if I should push the updates to this same PR or if you'd prefer a fresh, clean one. Thanks!

Updating is fine, we'll squash the commits into one later.

@Geda173 Geda173 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @piciolo,

I have added some comments below. Thanks for your contributions to the project!

Comment thread resources/lang/en/t_ingame.php Outdated
'battle_share' => 'share message',
'battle_repaired_def' => 'Repaired defences',
'battle_wreckage_created' => 'Wreckage created',
'battle_attacker_wreckage' => 'Attacker wreckage (General)',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you have any experience or confirmation that this is the exact wording of wreckage created for attackers with the General class? If not, we should default to Wreckage created.

Comment on lines +428 to +465
@if ($wreckage_count > 0)
<div class="section_title">
<div class="c-left"></div>
<div class="c-right"></div>
<span class="title_txt">{{ __('t_ingame.messages.battle_wreckage_created') }}: {{ $wreckage_count }}</span>
</div>
<ul class="detail_list clearfix wreckageContainer">
@foreach ($wreckage_units->units as $unit)
<li class="detail_list_el">
<div class="wreckage_icon float_left">
<img width="28" height="28" alt="{{ $unit->unitObject->title }}" src="{{ asset('img/objects/units/' . $unit->unitObject->assets->imgMicro) }}">
</div>
<span class="detail_list_txt">{{ $unit->unitObject->title }}</span>
<span class="fright" style="margin-right: 10px">{{ $unit->amount }}</span>
</li>
@endforeach
</ul>
@endif

@if ($attacker_wreckage_count > 0)
<div class="section_title">
<div class="c-left"></div>
<div class="c-right"></div>
<span class="title_txt">{{ __('t_ingame.messages.battle_attacker_wreckage') }}: {{ $attacker_wreckage_count }}</span>
</div>
<ul class="detail_list clearfix attackerWreckageContainer">
@foreach ($attacker_wreckage_units->units as $unit)
<li class="detail_list_el">
<div class="wreckage_icon float_left">
<img width="28" height="28" alt="{{ $unit->unitObject->title }}" src="{{ asset('img/objects/units/' . $unit->unitObject->assets->imgMicro) }}">
</div>
<span class="detail_list_txt">{{ $unit->unitObject->title }}</span>
<span class="fright" style="margin-right: 10px">{{ $unit->amount }}</span>
</li>
@endforeach
</ul>
@endif

@Geda173 Geda173 Mar 20, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Each player should only have their individual wreckage displayed.

Comment thread resources/lang/en/t_ingame.php Outdated
Comment on lines +648 to +650
'battle_repaired_def' => 'Repaired defences',
'battle_share' => 'share message',
'battle_repaired_def' => 'Repaired defences',
'battle_wreckage_created' => 'Wreckage created',
'battle_attacker_wreckage' => 'Attacker wreckage (General)',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These and similar translation keys should not be part of this PR. Please focus on one issue at a time and hand in other changes separately. #1297 already aims to include many of the translations, these changes would be best suited there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have cleaned up the Pull Request by removing unrelated translation files that were included by mistake. The PR now strictly contains only the changes required for the "wreckage created" section in combat reports.

image

@piciolo
piciolo force-pushed the Combat-Reports-should-include-wreckage-created-section-#1175 branch from 6d9cafd to 6b8b135 Compare March 21, 2026 15:33
Comment thread .github/workflows/sync-upstream.yml Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are these changes necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That idiot git pushed this too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’m currently running a test on the entire project to check for any further errors, and then I’ll apply a fix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the .github/workflows/sync-upstream.yml file, which was mistakenly included during the upstream sync.

Implemented the requested logic for battle reports: each player will now see only their individual wreckage instead of the global total, ensuring data clarity for all participants.

Persist and display wreckage data in battle reports. BattleReport now aggregates wreckage and attacker_wreckage into UnitCollection instances and exposes counts/units to the view. AttackMission saves defender wreckField ships to report->wreckage and computes a General-class attacker's wreck field (attacker_wreckage) when attacker survives. The blade template was updated to render wreckage and attacker wreckage sections with icons and counts.
@piciolo
piciolo force-pushed the Combat-Reports-should-include-wreckage-created-section-#1175 branch from 6b8b135 to 0accd00 Compare March 21, 2026 17:41
Add a viewer_is_attacker flag to BattleReport (compare message.user_id to battleReportModel.attacker.player_id) and update the battle report Blade template to only show defender wreckage to non-attackers and attacker wreckage to the attacker. This prevents both wreckage sections from being visible to the wrong recipient and ensures each player sees only their relevant wreckage information.

@Geda173 Geda173 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @piciolo,

I have added some comments with minor request changes. Once those are in this should be good to go.

Add two new translation keys (battle_wreckage_created, battle_attacker_wreckage) to English, Italian and Dutch in-game language files for battle UI. Also normalize spacing/alignment of the existing battle_debris_new entries.
@Geda173

Geda173 commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

I just merged #1326, could you please update this branch again to sync up with the latest changes so we can get a preview environment up and running? Thanks!

@github-actions

github-actions Bot commented Mar 28, 2026

Copy link
Copy Markdown

Preview deployment

Status URL Commit
❌ Destroyed pr-1301.preview.ogamex.dev -

Preview environment has been cleaned up.

@piciolo

piciolo commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

I just merged #1326, could you please update this branch again to sync up with the latest changes so we can get a preview environment up and running? Thanks!

Done

@Geda173

Geda173 commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

I just tested it and it seems to be working fine. Even though the Space Dock is at 0, I can still see the wreckage, but that is part of #1315. Once @lanedirt finds the time to take a look, we should be able to get this merged!

@lanedirt lanedirt left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM, thanks for the work on this both!

@Geda173
Geda173 merged commit 394606a into lanedirt:main Mar 29, 2026
6 checks passed
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.

Combat Reports should include wreckage created section

3 participants