diff options
| author | historia <[not public]> | 2026-09-18 17:48:26 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 17:48:26 -0400 |
| commit | 8fe9e3c3fef0049df82281a62afe35dda516dfe2 (patch) | |
| tree | dd269f2c0710f334e19f00a191260ebc46284a90 /internal/game/hardening_disconnect_combat_test.go | |
| parent | 194164a77eb4f2479b94c19e6f0e1278ab608781 (diff) | |
| download | thehouseoficarus-8fe9e3c3fef0049df82281a62afe35dda516dfe2.tar.gz | |
fix: close combat ghost, admin traversal, login throttle, journal double-pay, and quality/economy gaps
Diffstat (limited to 'internal/game/hardening_disconnect_combat_test.go')
| -rw-r--r-- | internal/game/hardening_disconnect_combat_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/game/hardening_disconnect_combat_test.go b/internal/game/hardening_disconnect_combat_test.go new file mode 100644 index 0000000..7bd6708 --- /dev/null +++ b/internal/game/hardening_disconnect_combat_test.go @@ -0,0 +1,31 @@ +package game + +import "testing" + +// TestDisconnectHardRemoveEndsCombat pins the P0 fix: a session hard-removed +// while a fight is live must have that fight ended. Otherwise the combat tick +// subscribers (keyed by character name) keep attacking and saving a detached +// Player, which duplicates items/credits on death and can permanently lock a +// finishing_blow mob. +func TestDisconnectHardRemoveEndsCombat(t *testing.T) { + h := newHarness(t) + h.seedAccount("alice") + h.seedCharacter("alice", "alice") + sess, _ := h.connect("alice") + p := sess.Player + + h.g.RunOnOwner(func() { + sess.StartDisconnect(1) + h.g.Combat.Enter(p.Name, "skeleton") + for i := 0; i < disconnectCombatGraceTicks+5 && len(h.g.Hub.AllSessions()) > 0; i++ { + h.g.DisconnectTick() + } + }) + + if len(h.g.Hub.AllSessions()) != 0 { + t.Fatal("session was not hard-removed") + } + if h.g.Combat.Get(p.Name) != nil { + t.Fatal("combat survived the hard remove; a ghost fight would keep saving the detached character") + } +} |
