Commit Graph

173 Commits

Author SHA1 Message Date
Houmgaor
ba9fce153d refactor(mhfpacket): rename MsgSysCreateStage.Unk0 to CreateType
Wii U decompilation of all 6 callers of snj_stage_create confirms
the field distinguishes new stage creation (1) from entering an
existing stage (2): lobby/myhouse/quest pass 1, guild room and
move operations pass 2.
2026-02-19 00:46:57 +01:00
Houmgaor
151af1a202 refactor(mhfpacket): rename MsgMhfUpdateHouse.Unk1 to HasPassword
Verified via Wii U decompilation of putUpdate_house: the field is set
to 0 when no password is provided, and 1 when a password string is
present. The previous comment "Always 0x01" was inaccurate.
2026-02-18 22:57:18 +01:00
Houmgaor
0d07a1f698 refactor(mhfpacket): rename 15 Unk fields with identified meanings
Replace unknown field names with descriptive names based on handler
logic analysis, switch dispatch patterns, DB query context, and
inline comments:

- ObjectHandleID, IsQuest, ItemIDCount, MaxCount, TokenLength,
  FormatVersion, LogoutType (high confidence from comments/constants)
- QueryType, DataType, MissionIndex, CheckOnly, RequestType,
  ExchangeType, TournamentID (confirmed by handler switch/if usage)

Also fix MsgSysLogout.Build calling ReadUint8 instead of WriteUint8.
2026-02-18 21:48:08 +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
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
Houmgaor
d2b5bb72f8 refactor: extract gametime package, replace fmt.Printf with zap logging
Move time utilities (TimeAdjusted, TimeMidnight, TimeWeekStart, TimeWeekNext,
TimeGameAbsolute) from channelserver into common/gametime to break the
inappropriate dependency where signserver, entranceserver, and api imported
the 38K-line channelserver package just for time functions.

Replace all fmt.Printf debug logging in sys_session.go and handlers_object.go
with structured zap logging for consistent observability.
2026-02-17 17:54:51 +01:00
Houmgaor
645c4ddd38 test: increase code coverage from 45.1% to 48.3%
Add unit tests across multiple packages:
- byteframe: SetBE/SetLE byte order switching
- config: Mode.String() for all safe version ranges
- mhfpacket: 28 Parse methods, 5 Build methods, empty packet builds,
  variable-length packets, NOT IMPLEMENTED error paths, UpdateWarehouse
- network: PacketID.String() for known IDs, out-of-range, and all valid
- channelserver: handleMsgMhfGetPaperData (6 switch cases), grpToGR
  (11 input values), gacha handlers, TimeGameAbsolute, equipSkinHistSize
  (4 config branches), guild mission handlers, dumpSaveData disabled path
- entranceserver: makeHeader with various inputs
2026-02-17 17:32:54 +01:00
Houmgaor
0bd724f74e test: backport remaining test files from v9.2.x-stable
Import 18 network packet test files and 5 server infrastructure test
files, adapted for main branch APIs: fix config import alias (_config),
remove non-existent DevMode field, use global handlerTable instead of
per-server handlers map, and correct validateToken mock expectations
to include both token and tokenID arguments.

Adds go-sqlmock dependency for database mocking in signserver tests.
2026-02-17 00:09:41 +01:00
Houmgaor
127d3af167 tests(network): adds tests for network features (except mhfpacket). 2025-10-27 12:18:41 +01:00
Houmgaor
1398383a8d fix(lint): automated linting, with simple formatter. 2025-10-19 22:43:05 +02:00
Houmgaor
0e7bc553d7 test: fix issues in tests with cryptography 2025-10-19 21:18:55 +02:00
Houmgaor
8a92a7957e fix(crashes): trying to investigate the causes of crash.
New unit tests to that end.
2025-10-19 19:02:29 +02:00
wish
3d0114ce22 fix MhfAcquireCafeItem cost in G1-G5.2 2025-04-01 20:58:33 +11:00
wish
459f382dd7 simplify 2024-07-24 23:41:05 +10:00
wish
4204ab1ecb Merge branch 'refs/heads/main' into fix/quest-stamps 2024-07-24 23:28:13 +10:00
wish
dd13713bc1 fix parsing SysTerminalLog 2024-06-25 22:50:58 +10:00
wish
843b6a9dff fix quest stampcard 2024-03-17 16:39:06 +11:00
wish
d26ae4563e fix G1 compatibility 2024-03-17 16:35:16 +11:00
wish
fac68a2b4b fix UpdateGuacot 2024-03-06 22:17:27 +11:00
wish
40d4aba3c4 convert other Warehouse types to new system 2024-02-25 14:12:37 +11:00
wish
b969c53f3a fix Warehouse packet parsing 2024-02-21 02:09:42 +11:00
wish
db364110eb Merge branch 'main' into feature/warehouse-v2 2024-02-20 17:50:04 +11:00
wish
5bcfe25ede implement Festa Bonus Categories & Guild Character optimisations 2024-02-20 04:18:16 +11:00
wish
4ccb3af5ac simplify cryptography 2024-01-11 23:00:44 +11:00
wish
f73bdd7445 rewrite CastBinary payload handling 2024-01-05 02:39:25 +11:00
wish
7e34862e25 Merge remote-tracking branch 'origin/main' into feature/warehouse-v2
# Conflicts:
#	server/channelserver/handlers.go
2023-12-13 11:38:05 +11:00
wish
ef7d46ba2e revert UpdateGuacot parsing 2023-12-04 22:29:58 +11:00
wish
7717f2f12a fix Enumerate/UpdateGuacot 2023-12-04 22:06:43 +11:00
wish
9d54a9746c remove unused variable 2023-12-02 21:16:26 +11:00
wish
11bac4ecf3 handle UnreserveSrg 2023-12-02 21:10:52 +11:00
wish
67e791be2b parse & stub PostSeibattle 2023-11-30 00:31:09 +11:00
wish
e914cf406b limit EnumerateShop responses 2023-11-29 21:37:41 +11:00
wish
3c6067c8a6 port partial fix/mutex-rework 2023-11-26 23:22:56 +11:00
wish
0550fb21b5 parse & handle PlayFreeGacha 2023-11-22 22:59:36 +11:00
wish
d4ddf7bc25 initial legacy support for DistItem 2023-11-21 23:46:33 +11:00
wish
d7d3e7c61f update parsing of CastBinary & EnterStage 2023-11-19 23:12:58 +11:00
wish
85fc76edd5 update parsing of many packets 2023-11-19 02:34:02 +11:00
wish
fc57d63689 update parsing of many packets 2023-11-19 00:35:22 +11:00
wish
4a83b68725 Merge pull request #97 from ZeruLight/fix/rework-distributions
fix/rework-distributions
2023-11-11 19:42:08 +11:00
wish
317daef04b rewrite EnumerateDistItem handler 2023-11-07 21:26:45 +11:00
wish
6ff20858ed rewrite EnumerateStage & parse ReserveStage 2023-11-07 16:50:39 +11:00
wish
be6f55b5a8 initial distributions rework 2023-11-05 00:31:16 +11:00
wish
f9280f483f simplify & handle Mail better 2023-10-31 00:21:05 +11:00
wish
431b3bbeff Merge branch 'main' of github.com:ZeruLight/Erupe 2023-10-24 21:25:34 +11:00
wish
ba50dc419a fix parsing and handling of DistItem packets 2023-10-24 21:24:35 +11:00
wish
e688fdf3c5 more GuildTresure optimisation 2023-10-17 00:35:06 +11:00
wish
0de15e8440 rewrite ReadMercenaryW parser 2023-10-12 23:26:12 +11:00
wish
641032f862 implement hunt data logging (partial #82) 2023-10-08 19:25:48 +11:00
wish
aa98e89d77 cover more versions with Hiden savedata 2023-10-02 01:19:56 +11:00