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

Fix Issue# 365: PVP Rank #424

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft

Fix Issue# 365: PVP Rank #424

wants to merge 37 commits into from

Conversation

Phrosfire
Copy link
Collaborator

@Phrosfire Phrosfire commented Mar 9, 2025

Pull Request

Add ranked pvp as an option for battling. Users will be assigned ranks based on their LP as well as rewards.

License

By making this pull request, I confirm that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the Studie-Tech ApS organization has the copyright to use and modify my contribution for perpetuity.

Summary by CodeRabbit

  • New Features
    • Introduced a structured competitive ranking system featuring distinct divisions with specific league points.
    • Expanded PvP options by incorporating a ranked battle mode, offering enhanced competitive play.

@Phrosfire Phrosfire requested a review from MathiasGruber as a code owner March 9, 2025 18:57
Copy link

vercel bot commented Mar 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tnr ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 0:54am

Copy link
Contributor

coderabbitai bot commented Mar 9, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The update introduces a new constant, RankedDivisions, that defines several rank objects with properties for name and lp. Two new types, RankedDivisionKey and RankedDivision, are provided to enforce type safety for these ranks. Additionally, the PvpBattleTypes array is updated to include a new "RANKED" option for PvP battle types.

Changes

File Change Summary
app/drizzle/constants.ts - Added constant RankedDivisions with rank definitions (WOOD, ADEPT, MASTER, LEGEND, SANNIN, NONE).
- Introduced types RankedDivisionKey and RankedDivision.
- Updated PvpBattleTypes array to include "RANKED".

Poem

I'm a bunny with code so bright,
Leaping through changes with pure delight.
New ranks defined, and battles redefined too,
Hopping on lines that look shiny and new.
Here's to code that makes our hearts take flight!
🐇💻✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (1)
app/drizzle/constants.ts (1)

158-165: Nice implementation of ranked divisions with LP thresholds.

The RankedDivisions constant effectively defines the different ranks players can achieve, with clear league point thresholds for each division. I especially like how you've set up an implicit progression system with increasing LP requirements.

Consider adding a brief comment explaining the intended progression between ranks and what "Infinity" for SANNIN means in practical terms (e.g., whether it's truly unreachable or just represents the highest tier with no upper limit).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4765761 and 1a95251.

📒 Files selected for processing (1)
  • app/drizzle/constants.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: analyze
  • GitHub Check: build-test
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
app/drizzle/constants.ts (2)

166-167: Good type safety implementation.

Using TypeScript's keyof and indexed access operators to create strongly-typed interfaces for the ranked divisions will help prevent errors when working with these values throughout the codebase.


283-283:

✅ Verification successful

Successfully extended PvpBattleTypes with the new ranked option.

This addition aligns well with the PR objective of introducing ranked PVP battles. This change ensures that ranked battles become a first-class PvP battle type in the system.

Verify that any code consuming PvpBattleTypes can handle this new value:


🏁 Script executed:

#!/bin/bash
# Look for places that might be using PvpBattleTypes in switch statements or equality checks
rg -A 2 -B 2 "PvpBattleTypes|BattleType.*COMBAT|BattleType.*SPARRING|BattleType.*CLAN_BATTLE|BattleType.*TOURNAMENT"

Length of output: 3966


PvpBattleTypes Extension Verified: Consuming Code Handles "RANKED" Correctly

After reviewing the search output:

  • In files like app/src/layout/Combat.tsx and app/src/server/api/routers/combat.ts, the code uses membership checks (via .includes) on PvpBattleTypes, which will automatically recognize and handle the new "RANKED" value.
  • No additional adjustments or special-case logic are needed since all consumers evaluate the battle type dynamically.

The new "RANKED" option integrates seamlessly with the existing conditional logic.

@Phrosfire Phrosfire marked this pull request as draft March 9, 2025 19:00
Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-2 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.61 KB (-6 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-2 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 129.62 KB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Signed-off-by: Phrosfire <[email protected]>
Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.61 KB (-5 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 129.62 KB (🟡 +3 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.61 KB (-4 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

github-actions bot commented Mar 9, 2025

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 129.62 KB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Signed-off-by: Phrosfire <[email protected]>
Copy link

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-2 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-3 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Signed-off-by: Phrosfire <[email protected]>
Copy link

📦 Next.js Bundle Analysis for tnr

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 129.62 KB (-3 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@Phrosfire
Copy link
Collaborator Author

Phrosfire commented Mar 10, 2025

As of right now, the pvp rank is added to the users profile. The rank thresholds are in constants and the router determines the persons rank. This is still a work in progress.

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.

2 participants