refactor(channelserver): migrate inline queries to helpers and define named constants

Migrate 6 character data handlers to use the existing loadCharacterData
and saveCharacterData helpers, eliminating duplicate inline SQL:
- LoadFavoriteQuest, SaveFavoriteQuest, LoadDecoMyset, LoadMezfesData,
  LoadHunterNavi, GetEquipSkinHist

Define named constants replacing magic numbers across handlers:
- Achievement trophy tiers, broadcast/message types, diva phase
  durations, RP accrual rates, kill log layout, semaphore bases,
  quest stage/loading screen IDs

Update anti-patterns doc with accurate line counts, evidence-based
softlock analysis, and revised refactoring priorities.
This commit is contained in:
Houmgaor
2026-02-20 19:46:57 +01:00
parent 24ccc167fe
commit bf983966a0
12 changed files with 224 additions and 121 deletions

View File

@@ -9,6 +9,13 @@ import (
"go.uber.org/zap"
)
// Achievement trophy tier thresholds (bitfield values)
const (
AchievementTrophyBronze = uint8(0x40)
AchievementTrophySilver = uint8(0x60)
AchievementTrophyGold = uint8(0x7F)
)
var achievementCurves = [][]int32{
// 0: HR weapon use, Class use, Tore dailies
{5, 15, 30, 50, 100, 150, 200, 300},
@@ -61,10 +68,10 @@ func GetAchData(id uint8, score int32) Achievement {
ach.NextValue = 15
case 6:
ach.NextValue = 15
ach.Trophy = 0x40
ach.Trophy = AchievementTrophyBronze
case 7:
ach.NextValue = 20
ach.Trophy = 0x60
ach.Trophy = AchievementTrophySilver
}
return ach
} else {
@@ -83,7 +90,7 @@ func GetAchData(id uint8, score int32) Achievement {
}
}
ach.Required = uint32(curve[7])
ach.Trophy = 0x7F
ach.Trophy = AchievementTrophyGold
ach.Progress = ach.Required
return ach
}