Thank you for your interest in contributing to PhDamage - a floating combat text replacement addon for World of Warcraft! This guide will help you get started.
- Use the bug report template
- Include your WoW version, PhDamage version, and steps to reproduce
- Use the feature request template
- Explain the problem your feature would solve
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- World of Warcraft client (Retail, TBC Anniversary, MoP Classic, Cata, or Classic)
- Lua 5.1 or Lua 5.4 (for linting and testing)
- Luacheck (for static analysis)
- Busted (for unit tests)
- Git
-
Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/PhDamage.git cd PhDamage -
Initialize submodules (for Ace3 and other embedded libraries):
git submodule update --init --recursive
-
Symlink the addon into your WoW AddOns folder:
# Windows (PowerShell as Admin) New-Item -ItemType SymbolicLink -Path "$env:PROGRAMFILES\World of Warcraft\_retail_\Interface\AddOns\PhDamage" -Target "$(Get-Location)"
-
Reload in-game with
/reload
- Indent with 4 spaces (no tabs)
- Max line length: 120 characters
- Spaces around operators:
local x = 1 + 2 - No trailing whitespace
Every Lua file should start with:
-------------------------------------------------------------------------------
-- FileName.lua
-- Brief description
--
-- Supported versions: Retail, MoP Classic, TBC Anniversary, Cata, Classic
-------------------------------------------------------------------------------| Element | Convention | Example |
|---|---|---|
| Files | PascalCase | PhDamage_Core.lua |
| SavedVariables | PascalCase | PhDamageDB |
| Local variables | camelCase | local damageAmount |
| Functions | PascalCase | local function FormatDamage() |
| Constants | UPPER_SNAKE | local MAX_FRAMES = 20 |
PhDamage follows a layered architecture:
| Layer | Directory | Purpose |
|---|---|---|
| Core | Core/ |
WoW API interaction, addon lifecycle |
| Engine | Engine/ |
Pure Lua logic, calculations |
| Data | Data/ |
Static data tables, configuration |
| Presentation | Presentation/ |
UI frames, animations |
PhDamage uses the Ace3 framework:
| Library | Purpose |
|---|---|
| AceAddon-3.0 | Addon lifecycle |
| AceEvent-3.0 | Event handling |
| AceDB-3.0 | Saved variables |
| AceConsole-3.0 | Slash commands |
- Use defensive nil checks for optional APIs
- Use
pcallfor APIs that may be missing in some versions - Prefer
orfallbacks over runtime version checks
Run luacheck before submitting changes:
luacheck .
luacheck path/to/File.lua # single file for fast feedbackPhDamage uses busted for unit testing. Tests live in the tests/ directory.
CI still runs tests with Lua 5.1. Local runs may use Lua 5.1 or Lua 5.4.
Use the repo-local launcher instead of calling busted directly. Invoke it with whichever interpreter you want to verify, such as lua, lua5.1, or lua5.4. The launcher asks LuaRocks where busted.runner is installed and prepends that rock tree to package.path and package.cpath for the active interpreter.
lua tests/RunBusted.lua --verbose # run all tests
lua tests/RunBusted.lua tests/some_spec.lua # run a single test file
lua5.4 tests/RunBusted.lua --verbose # explicitly test under Lua 5.4If busted --verbose fails with module 'busted.runner' not found, your busted wrapper and your active interpreter are using different module paths. The launcher above avoids that mismatch without hard-coded machine-specific paths.
- Load the addon in the target game version
- Attack a target dummy to verify floating combat text
- Enable Lua errors:
/console scriptErrors 1 - Verify no errors in the error frame
-
Branch from
master:git checkout -b feat/your-feature-name
-
Commit using Conventional Commits:
git commit -m "feat: add critical hit animation (#42)" -
Push your branch and open a PR against
master -
Fill out the PR template and wait for CI checks
| Prefix | Purpose | Example |
|---|---|---|
feat/ |
New feature | feat/14-busted-ci |
fix/ |
Bug fix | fix/15-damage-display |
docs/ |
Documentation | docs/update-readme |
refactor/ |
Code improvement | refactor/16-engine-cleanup |
- CI runs luacheck and busted tests automatically
- Review by a maintainer
- Squash merge into
master - Release-please creates a release PR when ready
Thank you for contributing to PhDamage!