Skip to content

Refactor/core common#105

Open
emyhrberg wants to merge 10 commits into
masterfrom
refactor/core-common
Open

Refactor/core common#105
emyhrberg wants to merge 10 commits into
masterfrom
refactor/core-common

Conversation

@emyhrberg

Copy link
Copy Markdown
Collaborator

Refactor: Feature-based namespace organization (Common/Core)

This PR is a pure refactor based on master. There are no intended gameplay changes.

Summary

  • Moved all code into either Common or Core.
  • Refactored AdventurePlayer / AdventureProjectile / AdventureItem / AdventureNPC into feature-based namespaces under Common.
  • Restructured the codebase to make it significantly easier to maintain, extend, and onboard additional contributors.

Namespace layout

Common (gameplay features)

Gameplay mechanics/features that directly implement how the mod behaves in-game.

  • Common.Combat — PvP/PvE changes, i-frames, hit/kill markers, ghost heal/LoS adjustments, etc.
  • Common.DropRates — rewrites loot pools for bosses, etc.
  • Common.GameTimer — match state, countdown, time remaining, etc.
  • Common.Items — item stat changes, bans, shimmer transforms, prefixes.
  • Common.Npcs — spawn rules, boss changes, hitmarker sound, etc.
  • Common.Recipes — crafting recipes.
  • Common.Spawnbox — random teleport, disallow movement in 50x50 box, recall, etc.
  • Common.Statistics — K/D, boss score, bounties, team points, pickups, etc.
  • Common.Teams — team chat, team beds.
  • Common.UI — player outlines, remove social slots, etc.

Core (infrastructure)

Foundational infrastructure that other modules depend on, but that is not itself gameplay.

  • Core.Config — client & server config.
  • Core.Discord — Discord integration.
  • Core.Input — keybinds.
  • Core.Net — ping, section sync, spawn sync, etc.

- Make all files use file scoped namespaces
- Moved client and server configs to Common/Configs
- Moved everything Discord related to Core/Discord

This was made to follow best practices from tML code style guide, among others. This was just moving files, no renames or splitting classes into feature-based names yet.
Split into:
1. DiscordAuthPlayer (discord authentication)
2. LatencyTrackerPlayer (ping pong tracker)
3. CombatPlayer (combat)
4. SpawnboxPlayer (recall, spawnbox restrictions)
5. PreventAutoReuse : GlobalItem
6. BlockSocialSlots : ModSystem
Split into:
1. Spawnbox/BlockProjectilesInSpawn
2. Combat/CombatProjectile
Split into:
1. Combat/CombatNpc
2. Npcs/NpcRules
3. Statistics/NpcStatistics
Split into:
1. Items/ItemBalance
2. Items/ItemRules
3. Items/ItemTooltips
4. Items/ItemQuality

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the codebase by reorganizing code from flat namespaces into feature-based namespaces under Common (gameplay features) and Core (infrastructure). The large monolithic AdventurePlayer, AdventureItem, and AdventureNpc classes have been split into smaller, feature-specific classes. Discord SDK files have been moved from Discord/ to Core/Discord/ with updated namespaces.

Changes:

  • Reorganized code into Common (gameplay) and Core (infrastructure) namespaces
  • Split large monolithic classes into feature-specific modules (e.g., AdventurePlayerStatisticsPlayer, CombatPlayer, DiscordAuthPlayer, etc.)
  • Moved Discord SDK integration from Discord/ to Core/Discord/ namespace
  • Renamed AdventureConfig to AdventureServerConfig for clarity

Reviewed changes

Copilot reviewed 69 out of 71 changed files in this pull request and generated 47 comments.

Show a summary per file
File Description
PvPAdventure.cs Updated imports to use new namespaces and renamed classes
AdventurePlayer.cs Deleted - split into StatisticsPlayer, CombatPlayer, SpawnboxPlayer, etc.
AdventureItem.cs Deleted - split into ItemBalance, ItemRules, ItemTooltips, ItemQuality, etc.
Core/Discord/* Discord SDK files moved from Discord/ with namespace updates
Common/Combat/* Combat-related logic extracted into dedicated classes
Common/Statistics/* Statistics and scoring logic extracted
Common/Spawnbox/* Spawn region management extracted
Core/Net/* Network/latency tracking extracted
Core/Input/Keybinds.cs Moved from System/Client with added KeybindsPlayer
Core/Config/* Config classes moved and AdventureConfig renamed to AdventureServerConfig
Comments suppressed due to low confidence (5)

Common/Npcs/NpcRules.cs:23

  • The class is named NpcRules but the old class was AdventureNpc. Consider a more descriptive name like NpcBehavior or NpcModifications to better reflect that this handles spawn rules, boss modifications, and loot changes.
    Common/Teams/TeamChatManager.cs:13
  • The namespace is Common.Chat but the file is in the Common/Teams/ directory. Either move the file to Common/Chat/ or change the namespace to Common.Teams for consistency.
    Common/Teams/TeamColoredBeds.cs:9
  • The namespace is Common.TeamBeds but the file is in the Common/Teams/ directory. Either move the file to Common/TeamBeds/ or change the namespace to Common.Teams for consistency.
    Common/Recipes/RecipeManager.cs:6
  • The namespace is Common.Loot but the file is in the Common/Recipes/ directory. Either move the file to Common/Loot/ or change the namespace to Common.Recipes for consistency.
    Common/Npcs/BoundNpc.cs:7
  • The namespace is Content.NPCs but the file is in the Common/Npcs/ directory. This should be Common.Npcs to match the directory structure and the pattern described in the PR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Core/Discord/ActivityManager.cs
Comment thread Common/Combat/CombatNpc.cs
Comment thread Common/Items/PreventAutoReuse.cs
Comment thread Common/UI/AllowMouseInputWhenHoveringBuffIcons.cs Outdated
Comment thread Core/Discord/DiscordCore.cs
Comment thread Core/Discord/DiscordCore.cs
Comment thread Core/Discord/DiscordCore.cs
Comment thread Core/Discord/DiscordCore.cs
Comment thread Core/Discord/DiscordCore.cs
Comment thread Core/Discord/DiscordCore.cs
- Fixed so all classnames match filenames
- Remove some duplicate code in NpcRules and NpcStatistics
- Fixed so namespaces match filenames
@emyhrberg
emyhrberg force-pushed the refactor/core-common branch 2 times, most recently from c1a96a7 to 1aa353b Compare January 19, 2026 01:40
@emyhrberg
emyhrberg force-pushed the refactor/core-common branch from 3939212 to 92c2c57 Compare January 19, 2026 16:58
@emyhrberg
emyhrberg force-pushed the refactor/core-common branch from 92c2c57 to b97a2c2 Compare January 19, 2026 17:05
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