Commit Graph

697 Commits

Author SHA1 Message Date
Houmgaor
7e9440d8cc test: expand channelserver coverage from 20% to 25%
Add tests for:
- Discord handlers (getPlayerSlice, getCharacterList)
- House handlers (boxToBytes, HouseData, Title structs)
- Mail struct tests
- Mercenary handlers (Partner, HunterNavi structs)
- Shop/Gacha handlers (writeShopItems, ShopItem, Gacha structs)
- Additional handler coverage for guild, tower, and simple handlers
- Stage handler tests for binary operations and enumeration
- Channel server tests for BroadcastMHF and session management
2026-02-02 16:02:01 +01:00
Houmgaor
2d8f1d3b41 test: expand channelserver coverage from 16% to 20%
Add comprehensive tests for handler functions and utilities:
- Achievement system (GetAchData, curves, mappings)
- Language system (getLangStrings)
- Core handlers (empty handlers, simple responses)
- Cafe/boost handlers
- Diva defense handlers
- Reward, caravan, tactics handlers
- Festa/ranking handlers
- Cast binary constants
2026-02-02 15:15:47 +01:00
Houmgaor
711916f4a1 test: expand channelserver coverage from 12% to 16%
Add comprehensive tests for handler files:
- handlers_object: object creation, positioning, binary ops
- handlers_semaphore: create, acquire, release, check, delete
- handlers_reserve: stub handlers and reserve188/18B
- handlers_event: registration, release, feature weapons
- handlers_mutex: create, open, close, delete operations
- handlers_campaign: enumerate, state, apply
- handlers_bbs: user status, SNS status, article apply
- handlers_tournament: info, entry, acquire
- handlers_users: user binary operations
- handlers_clients: client enumeration
- handlers_rengoku: ranking
- handlers_register: raviente semaphore functions
- handlers_tower: tower info, tenrouirai, seibatu ranking

All tests pass with race detection enabled.
2026-02-02 11:42:47 +01:00
Houmgaor
0f1684564d test: expand channelserver coverage from 7.5% to 12%
Add comprehensive tests for channelserver package:
- handlers_character_test.go: CharacterSaveData, pointer constants
- handlers_data_test.go: grpToGR function with boundary tests
- handlers_quest_test.go: findSubSliceIndices, equal functions
- handlers_simple_test.go: simple handlers, ack responses
- handlers_util_test.go: stub handlers, ack helpers
- sys_channel_server_test.go: Server, Raviente, stages, semaphores
- sys_object_test.go: Object, Stage, stageBinaryKey structs

All tests pass with race detection enabled.
2026-02-02 11:25:08 +01:00
Houmgaor
dad6a23bba test: improve test coverage from 11% to 20%
Add comprehensive tests across multiple packages:

- mhfpacket: Add tests for 300+ packet opcodes, system packets,
  MHF packets, and detailed parsing tests (6.4% -> 38.8%)
- timeserver: Add tests for all time functions (0% -> 97.4%)
- deltacomp: Add edge case tests for compression functions
- entranceserver: Add server creation tests
- binpacket: Add mail notify panic test
- config: Add Mode.String() tests
- signserver: Expand server tests
2026-02-02 11:02:52 +01:00
Houmgaor
21a66841ab test: expand pascalstring coverage to 100% with edge cases 2026-02-02 00:25:44 +01:00
Houmgaor
bbd33d47ef docs: add cherry-pick recommendations from main branch
Analyze 589 commits on main to identify safe cherry-picks for 9.3.0:
- Tier 1: Critical stability fixes (deadlocks, race conditions, crashes)
- Tier 2: Security dependency updates
- Tier 3: Important bug fixes
- Tier 4: Version compatibility fixes (S6, G1, G10)
- Tier 5: Warehouse/save system fixes (requires testing)
- Tier 6: Optional features (playtime command, ngword)

Also documents commits to avoid and required schema patches.
2026-02-02 00:13:53 +01:00
Houmgaor
15cedc0ec7 docs: add IMPROVEMENTS.md with 9.3.0 release milestones
Add comprehensive improvement recommendations and release milestones:
- Security & stability improvements (token lifecycle, error handling)
- Database performance (indexes, N+1 fixes, caching)
- Feature completeness (guild, daily missions, tournament, tower)
- Operational excellence (health checks, metrics, logging)
- Discord bot enhancements
- Multi-version support audit
- Schema management infrastructure
- High-value packet implementations

Also add project roadmap section to CLAUDE.md referencing IMPROVEMENTS.md.
2026-02-02 00:08:30 +01:00
Houmgaor
160130e464 refactor(docker): improve Docker setup and reduce image size
- Add multi-stage build to Dockerfile for smaller production image
- Move docker-compose.yml to project root for easier usage
- Flatten docker/init/setup.sh to docker/setup.sh
- Expand .dockerignore to exclude unnecessary files
- Remove deprecated version field from compose files
2026-02-01 23:49:52 +01:00
Houmgaor
dc49e5c34a feat(ci): add release automation workflow
Add GitHub Actions workflow that triggers on version tags (v*) to
automatically build release artifacts and create GitHub releases.

- Build matrix for Linux and Windows (amd64)
- Create proper archives (.tar.gz and .zip)
- Inject version via ldflags at build time
- Extract release notes from CHANGELOG.md
- Detect pre-release tags (-alpha, -beta, -rc)
- Add Version variable to main.go for runtime version display
2026-02-01 23:40:40 +01:00
Houmgaor
0e2502c9dc test: add PacketID and core packet tests, expand stringstack coverage
- Add network/packetid_test.go with tests for PacketID type, constants,
  String() method, ranges, uniqueness, and sequential verification
- Add network/mhfpacket/msg_sys_core_test.go with round-trip tests for
  MsgSysAck (including large payloads), MsgSysNop, and MsgSysEnd
- Expand common/stringstack/stringstack_test.go with Lock/Unlock tests
  achieving 100% coverage
2026-02-01 23:36:18 +01:00
Houmgaor
db3e0bccc7 test: improve test coverage for mhfpacket, channelserver, and server packages
Add comprehensive tests for:
- Pure time functions in channelserver (sys_time_test.go)
- Stage-related packet parsing (msg_sys_stage_test.go)
- Acquire packet family parsing (msg_mhf_acquire_test.go)
- Extended mhfpacket tests for login, logout, and stage packets
- Entrance server makeHeader structure and checksum tests
- SignV2 server request/response JSON structure tests
2026-02-01 23:28:19 +01:00
Houmgaor
f83761c0b1 fix(test): initialize ErupeConfig in cafe item tests
Required after cherry-picking 3d0114c which added RealClientMode check.
2026-01-30 01:16:00 +01:00
Houmgaor
021705c006 fix(quest): add S6 compatibility for quest data backporting
Cherry-picked from 8d1c6a7 with conflict resolution.
2026-01-30 01:14:13 +01:00
Houmgaor
fb14a78dbd fix(entrance): read clan member limit from config instead of hardcoded value
Cherry-picked from main (7d760bd) with conflict resolution.
Uses the last entry in ClanMemberLimits config array to determine
the maximum clan member count sent to clients.
2026-01-30 01:11:09 +01:00
Houmgaor
e095c5a5ca fix(cafe): read PointCost as uint16 for G1-G5.2 clients
Cherry-picked from main (3d0114c) with conflict resolution.
Pre-G6 clients send PointCost as uint16, not uint32.
2026-01-30 01:10:34 +01:00
Houmgaor
c4036daebc fix(guild): conditionally write GR field in InfoGuild for G10+ only
Cherry-picked from main (8c219be) with conflict resolution.
Pre-G10 clients don't have the GR field in the applicant list,
so only write it when RealClientMode >= G10.

Also optimizes two consecutive uint16(0) writes to single uint32(0).
2026-01-30 01:09:48 +01:00
Houmgaor
279d8b4aa0 feat(config): add RealClientMode infrastructure for multi-version support
Add client version mode support to enable version-specific behavior:

- Add Mode type with constants for all game versions (S1.0 through ZZ)
- Add ClientMode (string) and RealClientMode (Mode) to Config
- Add ClanMemberLimits to GameplayOptions for configurable clan sizes
- Add MaximumFP to GameplayOptions for festa points cap
- Parse ClientMode string to RealClientMode enum in LoadConfig
- Set sensible defaults (ZZ for mode, standard limits for clans)
- Update config.example.json with new fields

This enables cherry-picking version-specific fixes from main branch.
2026-01-30 01:08:37 +01:00
Houmgaor
94175e6e85 fix(guild): fix nil pointer condition in GetGuildManageRight
Cherry-picked from main (5028355) with conflict resolution.
Changes condition from && to || to properly handle the case where
a player has a guild but also has a prevGuildID set.
2026-01-30 01:03:20 +01:00
Houmgaor
a66b15d6c8 fix(stage): add timeout to WaitStageBinary handler
Cherry-picked from main (c539905).
Prevents infinite loop when stage binary data never arrives by
limiting to 10 iterations (10 seconds) before returning empty response.
2026-01-30 01:02:43 +01:00
Houmgaor
355c2c01cc fix(guild): fix poogie outfit unlock calculation
Cherry-picked from main (7459ded) with conflict resolution.
The original fix changed the poogie outfit unlock from incorrect
math.Pow calculation to direct value assignment.

Also removes unused math import (531b3d2).
2026-01-30 01:02:18 +01:00
Houmgaor
982393daf4 test: add unit tests for cherry-pick impacted handlers
Add comprehensive tests documenting current behavior before applying
fixes from main branch. Tests cover:

- Cafe item PointCost parsing (uint32 vs uint16 for different client modes)
- Guild poogie outfit unlock calculation bug (math.Pow issue)
- Guild manage right nil pointer condition (&& vs || logic)
- InfoGuild applicant GR field size for <G10 clients
- Stage binary wait infinite loop risk (no timeout)
- Entrance server hardcoded clan member limit
2026-01-30 01:01:21 +01:00
Houmgaor
65afcb5f41 ci: add gofmt and golangci-lint checks to test workflow
Add code quality checks that run before tests:
- gofmt formatting verification
- golangci-lint static analysis
2026-01-30 00:44:38 +01:00
Houmgaor
0822835f1b chore(db): add schemas directory from upstream
- Add init.sql for database bootstrap (9.1.0)
- Add update-schema/9.2-update.sql for 9.1 → 9.2 migration
- Add bundled-schema/ with demo data templates
- Empty patch-schema/ ready for 9.2.x patches
2026-01-30 00:37:59 +01:00
Houmgaor
3a1b410ee3 fix(guild): rename GuildMealDuration to ClanMealDuration to match upstream 9.3
- Renamed config key from GuildMealDuration to ClanMealDuration
- Changed unit from minutes to seconds (matching upstream convention)
- Updated handler to use seconds-based calculation
- Updated documentation and examples

This fixes the bug where clan meals were not being shared between
guild members when using a config.json with the upstream naming.
2026-01-30 00:32:00 +01:00
Houmgaor
6b8e468073 chore(docker): improve init script robustness and ignore db-data
- Add file existence checks before iterating schema directories
- Add proper quoting for file paths
- Add completion message
- Ignore docker/db-data/ (PostgreSQL runtime data)
2026-01-30 00:24:39 +01:00
Houmgaor
e929346bf3 test: add unit tests for core packages
Add comprehensive test coverage for:
- common/token: token generation and RNG tests
- common/stringsupport: string encoding, CSV operations
- common/byteframe: binary read/write operations
- common/mhfcourse: course/subscription logic
- network/crypt_packet: packet header parsing
- network/binpacket: binary packet round-trips
- network/mhfpacket: packet interface and opcode mapping
- config: configuration struct and loading
- server/entranceserver: response building
- server/signserver: response ID constants
- server/signv2server: HTTP endpoint validation
- server/channelserver: session, semaphore, and handler tests

All tests pass with race detector enabled.
2026-01-30 00:19:27 +01:00
Houmgaor
69cc84aa2f refactor(distribution): use distribution_items table instead of data blob
Distributions now read items from the distribution_items table instead of
requiring a pre-built binary data blob. This enables creating distributions
via simple SQL inserts rather than generating binary data manually.

Changes:
- Add getDistributionItems() to fetch items from distribution_items table
- Update handleMsgMhfApplyDistItem to build response from table data
- Move server-side rewards (points, RP) to handleMsgMhfAcquireDistItem
- Support G8+ item format (13 bytes per item)
2026-01-29 23:59:19 +01:00
Houmgaor
64cc285fd8 doc: inline code documentation. 2025-11-24 18:41:37 +01:00
Houmgaor
a992c5a603 refactor(format): automated formatting with go fmt. 2025-11-24 17:59:41 +01:00
Houmgaor
42bb5c18ef chore(cicd): updating CD pipeline, adds new CI pipeline with unit tests. 2025-11-24 17:51:53 +01:00
Houmgaor
bfdfed0c71 fix(presets): players with more than 40 presets would crash on logging in. 2025-11-24 11:20:00 +01:00
Houmgaor
c2b51f267c fix(usercheck): issues with strong passwords. 2025-11-24 01:17:01 +01:00
Houmgaor
c03a59b65a refactor(usercheck): use credentials from config.json by default. 2025-11-24 01:13:34 +01:00
Houmgaor
e722533fdb feat(tools): adds a small tools to monitor players. 2025-11-24 01:10:20 +01:00
Houmgaor
67dad15204 fix(server): race condition that created server panic. 2025-11-24 00:51:45 +01:00
Houmgaor
6677f34c27 docs(README): update readme to reference new docs. 2025-11-18 00:52:17 +01:00
Houmgaor
aa638b791d docs: adds documentation files for the major configurable options. 2025-11-18 00:44:17 +01:00
Houmgaor
9a47a876eb feat(logs): by default, log server activity to a file. 2025-11-18 00:18:32 +01:00
Houmgaor
7aafc71dcc feat(loganalyzer): complete tool suite for analysing erupe logs. 2025-11-18 00:02:02 +01:00
Houmgaor
79636af608 chore: more complete git ignore. 2025-11-18 00:00:56 +01:00
Houmgaor
2a7a44b974 feat(docker): backports docker configuration from main for testing. 2025-11-09 17:19:36 +01:00
Houmgaor
fd5f3e5aae doc: expanding main documentation. 2025-11-09 16:23:55 +01:00
Houmgaor
5d2d4f2694 chore: upgrade from Go 1.19 to Go 1.25. 2025-11-09 13:03:46 +01:00
Houmgaor
f0155bf590 refactor: config.json should never be committed. 2025-11-09 12:59:26 +01:00
Houmgaor
c8c0dae8fe test: imports basic tests, all passing. 2025-11-09 12:36:56 +01:00
Houmgaor
33a195b864 docs: documentating upcoming work. 2025-11-09 12:24:51 +01:00
wish
f0db7f0a19 finalise 9.2 v9.2.0 2023-04-01 17:58:26 +11:00
wish
7c5b027457 fix schema 2023-03-31 23:43:48 +11:00
wish
0345fb6da9 undo drop column 2023-03-31 23:43:07 +11:00