-
Notifications
You must be signed in to change notification settings - Fork 655
Added notifcation when a player wants to renew #2391
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
Conversation
WalkthroughAdds a localization key and updates alliance-extension execution to notify the other player with a Changes
Sequence DiagramsequenceDiagram
participant P1 as Player 1
participant S as System
participant P2 as Player 2
P1->>S: Request alliance extension
activate S
Note over S: Read pre-state (wasOnlyOneAgreed?)
alt Transition 0 → 1 agreement
S->>P2: Send RENEW_ALLIANCE ("wants_to_renew_alliance")
Note over P2: Shows "{name} wants to renew your alliance"
else No new single-agreement transition
Note over S: Do not re-send renew prompt
end
alt Both players agree
S->>S: Apply alliance extension
Note over S: Alliance extended
end
deactivate S
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🧬 Code graph analysis (1)tests/AllianceExtensionExecution.test.ts (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/core/execution/alliance/AllianceExtensionExecution.ts (1)
1-86: Fix formatting issue before merge.The pipeline indicates code style issues that need to be resolved.
Run the following command to fix the formatting:
npx prettier --write src/core/execution/alliance/AllianceExtensionExecution.ts
🧹 Nitpick comments (1)
src/core/execution/alliance/AllianceExtensionExecution.ts (1)
1-86: Consider adding tests for the notification logic.The contributor checklist mentions adding relevant tests. Consider adding test cases for:
- Notification sent when first player requests renewal
- No duplicate notification when same player requests again
- Both players agreeing triggers renewal message (existing behavior)
Would you like me to help generate test cases for this functionality?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
resources/lang/en.json(1 hunks)src/core/execution/alliance/AllianceExtensionExecution.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.
📚 Learning: 2025-06-02T14:27:37.609Z
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
Applied to files:
resources/lang/en.json
🪛 GitHub Actions: 🧪 CI
src/core/execution/alliance/AllianceExtensionExecution.ts
[warning] 1-1: Code style issues found. Run 'npx prettier --write' to fix formatting.
🔇 Additional comments (3)
resources/lang/en.json (1)
579-579: LGTM! Clean localization string.The new message follows the existing patterns and is correctly placed in the
events_displaysection.src/core/execution/alliance/AllianceExtensionExecution.ts (2)
39-40: Good approach to prevent duplicate notifications.Capturing the state before adding the extension request ensures the notification is sent only on the first request, not on subsequent duplicate requests from the same player.
62-72: MessageType.RENEW_ALLIANCE is defined and properly integrated.Verification confirms
MessageType.RENEW_ALLIANCEexists in the codebase (defined atsrc/core/game/Game.ts:818, categorized at line 850, and used consistently across multiple files). The logic correctly identifies the transition from zero to one agreement and sends the notification to the other player. No issues found.
|
the issue for this pr #2392 |
evanpelle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
51d0fe6
evanpelle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description:
Describe the PR.
Added a new chat message from the server once player wants to renew the alliance, to the other player.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
DISCORD_USERNAME
notifxy (1379678982676676639)