Files
test/agent-skills/01-naming-conventions.md
2026-02-24 09:50:08 +07:00

192 lines
7.3 KiB
Markdown

# Naming Conventions - CRITICAL RULES
## ⚠️ CRITICAL: Preserve C++ Names Exactly
**Never change C++ class/field/method names unless explicitly requested by the user.**
## Class Names
### Movement System
| C++ Name | C# Name | ✅/❌ |
|----------|---------|------|
| `CGfxMoveBase` | `CGfxMoveBase` | ✅ Correct |
| `CGfxLinearMove` | `CGfxLinearMove` | ✅ Correct |
| `CGfxOnTargetMove` | `CGfxOnTargetMove` | ✅ Correct |
| `CGfxParabolicMove` | `CGfxParabolicMove` | ✅ Correct |
| `CGfxMissileMove` | `CGfxMissileMove` | ✅ Correct |
| `CGfxMeteoricMove` | `CGfxMeteoricMove` | ✅ Correct |
| `CGfxHelixMove` | `CGfxHelixMove` | ✅ Correct |
| `CGfxCurvedMove` | `CGfxCurvedMove` | ✅ Correct |
| `CGfxAccMove` | `CGfxAccMove` | ✅ Correct |
| `CGfxLinkMove` | `CGfxLinkMove` | ✅ Correct |
| `CGfxRandMove` | `CGfxRandMove` | ✅ Correct |
**❌ WRONG:** `IGfxMovement`, `GfxLinearMove`, `LinearMovement`
### Event System
| C++ Name | C# Name | ✅/❌ |
|----------|---------|------|
| `A3DSkillGfxEvent` | `A3DSkillGfxEvent` | ✅ Correct |
| `A3DSkillGfxMan` | `A3DSkillGfxMan` | ✅ Correct |
| `A3DSkillGfxComposer` | `A3DSkillGfxComposer` | ✅ Correct |
| `A3DSkillGfxComposerMan` | `A3DSkillGfxComposerMan` | ✅ Correct |
| `CECSkillGfxEvent` | `CECSkillGfxEvent` | ✅ Correct |
| `CECSkillGfxMan` | `CECSkillGfxMan` | ✅ Correct |
## Field Names
### Movement Base Fields
| C++ Name | C# Name | Notes |
|----------|---------|-------|
| `m_Mode` | `m_Mode` | GfxMoveMode enum |
| `m_HitPos` | `m_HitPos` | GfxHitPos enum |
| `m_vPos` | `m_vPos` | Position vector |
| `m_vMoveDir` | `m_vMoveDir` | Movement direction |
| `m_bOneOfCluser` | `m_bOneOfCluser` | ⚠️ **TYPO PRESERVED** - C++ has this spelling |
| `m_dwMaxFlyTime` | `m_dwMaxFlyTime` | Max flight time (uint) |
| `m_bReverse` | `m_bReverse` | Reverse direction flag |
| `m_bArea` | `m_bArea` | Area emission flag |
| `m_Shape` | `m_Shape` | EmitShape enum |
| `m_vSize` | `m_vSize` | Size vector |
| `m_vXRange` | `m_vXRange` | X range for area emission |
| `m_vYRange` | `m_vYRange` | Y range for area emission |
| `m_vZRange` | `m_vZRange` | Z range for area emission |
| `m_fSquare` | `m_fSquare` | Square magnitude |
| `m_fSquareH` | `m_fSquareH` | Horizontal square magnitude |
**❌ WRONG:** `m_bOneOfCluster` (correct spelling) - C++ has the typo, we must preserve it
### Event Fields
| C++ Name | C# Name | Notes |
|----------|---------|-------|
| `m_pComposer` | `m_pComposer` | A3DSkillGfxComposer reference |
| `m_pMoveMethod` | `m_pMoveMethod` | CGfxMoveBase reference |
| `m_pFlyGfx` | `m_pFlyGfx` | Fly GFX instance |
| `m_pHitGfx` | `m_pHitGfx` | Hit GFX instance |
| `m_dwFlyTimeSpan` | `m_dwFlyTimeSpan` | Flight time span (uint) |
| `m_dwCurSpan` | `m_dwCurSpan` | Current span (uint) |
| `m_dwDelayTime` | `m_dwDelayTime` | Delay time (uint) |
| `m_bTraceTarget` | `m_bTraceTarget` | Trace target flag |
| `m_bFadeOut` | `m_bFadeOut` | Fade out flag |
| `m_nHostID` | `m_nHostID` | Host ID (long/clientid_t) |
| `m_nTargetID` | `m_nTargetID` | Target ID (long/clientid_t) |
| `m_dwModifier` | `m_dwModifier` | Modifier (uint) |
| `m_bIsGoblinSkill` | `m_bIsGoblinSkill` | Goblin skill flag |
| `m_vHostPos` | `m_vHostPos` | Host position |
| `m_vTargetPos` | `m_vTargetPos` | Target position |
| `m_vTargetDir` | `m_vTargetDir` | Target direction |
| `m_vTargetUp` | `m_vTargetUp` | Target up vector |
| `m_bHostExist` | `m_bHostExist` | Host exists flag |
| `m_bTargetExist` | `m_bTargetExist` | Target exists flag |
| `m_bHitGfxInfinite` | `m_bHitGfxInfinite` | Hit GFX infinite flag |
| `m_bTargetDirAndUpExist` | `m_bTargetDirAndUpExist` | Target dir/up exist flag |
| `m_enumState` | `m_enumState` | GfxSkillEventState enum |
## Method Names
### Movement Methods
| C++ Name | C# Name | Notes |
|----------|---------|-------|
| `StartMove()` | `StartMove()` | Initialize movement |
| `TickMove()` | `TickMove()` | Update movement (returns bool) |
| `SetParam()` | `SetParam()` | Set GFX_SKILL_PARAM |
| `SetIsCluster()` | `SetIsCluster()` | Set cluster flag |
| `SetReverse()` | `SetReverse()` | Set reverse flag |
| `UpdateGfxParam()` | `UpdateGfxParam()` | Update GFX parameters |
| `GetMode()` | `GetMode()` | Get movement mode |
| `GetHitPos()` | `GetHitPos()` | Get hit position |
| `GetPos()` | `GetPos()` | Get current position |
| `GetMoveDir()` | `GetMoveDir()` | Get movement direction |
| `IsReverse()` | `IsReverse()` | Check reverse flag |
| `SetMaxFlyTime()` | `SetMaxFlyTime()` | Set max flight time |
| `CreateMoveMethod()` | `CreateMoveMethod()` | Static factory method |
### Event Methods
| C++ Name | C# Name | Notes |
|----------|---------|-------|
| `Tick()` | `Tick()` | Update event |
| `HitTarget()` | `HitTarget()` | Handle target hit |
| `GetTargetCenter()` | `GetTargetCenter()` | Get target center (abstract) |
| `GetTargetDirAndUp()` | `GetTargetDirAndUp()` | Get target direction/up |
| `SetComposer()` | `SetComposer()` | Set composer |
| `GetMoveMethod()` | `GetMoveMethod()` | Get movement method |
| `Resume()` | `Resume()` | Resume event |
## Enum Names
| C++ Name | C# Name | Notes |
|----------|---------|-------|
| `GfxMoveMode` | `GfxMoveMode` | Movement mode enum |
| `GfxHitPos` | `GfxHitPos` | Hit position enum |
| `EmitShape` | `EmitShape` | Emission shape enum |
| `GfxSkillValType` | `GfxSkillValType` | Value type enum |
| `GfxSkillEventState` | `GfxSkillEventState` | Event state enum |
## Enum Values
### GfxMoveMode
- `enumLinearMove` (0)
- `enumParabolicMove` (1)
- `enumMissileMove` (2)
- `enumMeteoricMove` (3)
- `enumHelixMove` (4)
- `enumCurvedMove` (5)
- `enumAccMove` (6)
- `enumOnTarget` (7)
- `enumLink` (8)
- `enumRandMove` (9)
- `enumMoveModeNum` (10)
### GfxHitPos
- `enumHitCenter` (0)
- `enumHitBottom` (1)
### EmitShape
- `enumBox` (0)
- `enumSphere` (1)
- `enumCylinder` (2)
- `enumShapeNum` (3)
### GfxSkillEventState
- `enumWait` (0)
- `enumFlying` (1)
- `enumHit` (2)
- `enumFinished` (3)
## File Names
| C++ File | C# File | Location |
|----------|---------|----------|
| `A3DSkillGfxEvent2.h` | `CGfxMoveBase.cs` | `Assets/PerfectWorld/Scripts/Vfx/` |
| `A3DSkillGfxEvent2.cpp` | `CGfxLinearMove.cs` | `Assets/PerfectWorld/Scripts/Vfx/` |
| `A3DSkillGfxEvent2.cpp` | `CGfxOnTargetMove.cs` | `Assets/PerfectWorld/Scripts/Vfx/` |
| `A3DSkillGfxMan.h` | `A3DSkillGfxMan.cs` | `Assets/PerfectWorld/Scripts/Managers/` |
| `CECSkillGfxMan.h` | `CECSkillGfxMan.cs` | `Assets/PerfectWorld/Scripts/Managers/` |
## Naming Patterns
### Hungarian Notation (Preserved from C++)
- `m_` prefix = member variable
- `p` prefix = pointer/reference (C#: reference)
- `n` prefix = number/ID
- `dw` prefix = DWORD (uint)
- `b` prefix = bool
- `f` prefix = float
- `v` prefix = vector
- `sz` prefix = string (C#: string)
### Examples
- `m_pMoveMethod` = member pointer/reference to MoveMethod
- `m_dwFlyTimeSpan` = member DWORD (uint) for fly time span
- `m_bTraceTarget` = member bool for trace target
- `m_vHostPos` = member vector for host position
- `szFlyGfx` = string for fly GFX path
## Rules Summary
1. **Preserve ALL C++ names exactly** - including typos (`m_bOneOfCluser`)
2. **Keep Hungarian notation** - maintain `m_`, `p`, `dw`, `b`, `f`, `v` prefixes
3. **Match enum values** - exact same names and order
4. **Preserve file structure** - similar organization to C++
5. **Never "improve" names** - unless user explicitly requests it