Commit Graph

32 Commits

Author SHA1 Message Date
Houmgaor
458d8c9397 refactor(channelserver): add numeric column helpers and extract protocol constants
Add readCharacterInt/adjustCharacterInt helpers for single-column
integer operations on the characters table. Eliminates fmt.Sprintf
SQL construction in handlers_misc.go and replaces inline queries
across cafe, kouryou, and mercenary handlers.

Second round of protocol constant extraction: adds constants_time.go
(secsPerDay, secsPerWeek), constants_raviente.go (register IDs,
semaphore constants), and named constants across 14 handler files
replacing raw hex/numeric literals. Updates anti-patterns doc to
mark #4 (magic numbers) as substantially fixed.
2026-02-20 21:18:40 +01:00
Houmgaor
5f3c843082 refactor(config): eliminate ErupeConfig global variable
Replace the mutable global `_config.ErupeConfig` with dependency
injection across 79 files. Config is now threaded through existing
paths: `ClientContext.RealClientMode` for packet encoding, `s.server.
erupeConfig` for channel handlers, and explicit parameters for utility
functions. This removes hidden coupling, enables test parallelism
without global save/restore, and prevents low-level packages from
reaching up to the config layer.

Key changes:
- Enrich ClientContext with RealClientMode for packet files
- Add mode parameter to CryptConn, mhfitem, mhfcourse functions
- Convert handlers_commands init() to lazy sync.Once initialization
- Delete global var, init(), and helper functions from config.go
- Update all tests to pass config explicitly
2026-02-20 17:07:42 +01:00
Houmgaor
2bd5f98f32 docs: add doc.go files and godoc comments to all packages
Add package-level documentation (doc.go) to all 22 first-party
packages and godoc comments to ~150 previously undocumented
exported symbols across common/, network/, and server/.
2026-02-18 21:39:13 +01:00
Houmgaor
c64dabc3ba fix: check all Close() return values for errcheck lint
Add explicit error discards (_ =) for Close() calls on network
connections, SQL rows, and file handles across 28 files. Also add
.golangci.yml with standard linter defaults to match CI configuration.
2026-02-17 23:57:14 +01:00
Houmgaor
47f7a1f636 fix(channelserver): handle bare Exec errors and filter expected ErrNoRows
138 bare db.Exec calls across 22 handler files silently dropped write
errors. Each is now wrapped with error check and zap logging.

4 QueryRow sites that legitimately return sql.ErrNoRows during normal
operation (new player mezfes, festa rankings, empty guild item box)
now filter it out to reduce log noise.
2026-02-17 23:33:44 +01:00
Houmgaor
46bbb6adf9 fix: resolve all remaining lint errors (errcheck) across 49 files
Fix unchecked error returns on bf.Seek(), db.Exec(), QueryRow().Scan(),
pkt.Build(), logger.Sync(), and binary.Write() calls. The linter now
passes with 0 errors, build compiles, and all tests pass with -race.
2026-02-17 18:07:38 +01:00
Houmgaor
2a0e3e2c84 fix: re-enable CI lint job and fix ~65 lint errors (partial)
Re-enable the golangci-lint job in CI (disabled Oct 2025), update to
Go 1.25 and golangci-lint-action v7. Fix errcheck, gosimple S1009,
staticcheck SA4031 and SA2001 errors across 54 files. Remaining ~39
lint errors will be addressed in follow-up commits.
2026-02-17 17:59:00 +01:00
wish
7640195d2b add min and max Feature Weapons 2024-02-25 21:18:14 +11:00
wish
a9b9c94347 fix RNG 2024-02-21 03:46:15 +11:00
wish
ffcf511c20 simplify UseKeepLoginBoost 2023-10-30 23:54:50 +11:00
wish
813a3df6a7 correctly parse RegisterEvent & move handlers 2023-08-30 22:18:37 +10:00
wish
ab81ca9233 fix built-in shadowing in generateFeatureWeapons 2023-08-20 22:25:57 +10:00
wish
9381534a7d rename Event type variables 2023-08-20 22:24:04 +10:00
wish
15e31d7786 decode EnumerateEvent 2023-07-16 13:00:25 +10:00
wish
d23b6eb61a forgot SAF 2023-07-03 02:08:05 +10:00
wish
1f93419cb7 add support for more versions 2023-07-03 00:30:44 +10:00
wish
b4df642ee3 add ClientMode config option 2023-06-18 20:31:18 +10:00
wish
006f44f3a6 fix feature weapon RNG 2023-03-31 00:53:50 +11:00
wish
f85be55a6d fix login boost creating hanging connections 2023-03-14 02:16:09 +11:00
wish
ccfd2ac36f create RNG in token module 2023-03-12 23:29:50 +11:00
wish
a3b1b2841f move active features to gameplay options 2023-03-09 18:54:53 +11:00
wish
1f349a342e add some gameplay options 2023-03-09 18:51:36 +11:00
wish
9a8edf0b64 fix feature weapons not generating correctly 2023-03-07 21:03:42 +11:00
wish
9cf637d842 fix feature weapon times 2023-03-04 23:22:00 +11:00
wish
e811dd1274 initial time fix 2023-03-04 21:43:10 +11:00
wish
7c75e9118f prevent generating too many featured weapons 2022-12-23 22:37:19 +11:00
wish
7691b84259 add persistent featured weapons 2022-10-23 12:45:10 +11:00
wish
9d589b3338 diva cleanup 2022-08-26 19:51:52 +10:00
wish
09b5de79d3 diva scheduler and cleanup 2022-08-26 17:26:24 +10:00
wish
440b73f696 implement netcafe points and boost time 2022-08-13 21:23:02 +10:00
wish
18989e9435 initial netcafe implementation 2022-08-13 16:25:32 +10:00
wish
2c0e7a5267 repository cleanup 2022-07-29 03:25:23 +10:00