fix: improve endgame clock and gameplay stability
This commit is contained in:
1 parent
ce6aabfc55
commit
658298ee86
46 files changed
+1915
-99
No files matched your search
@@ -0,0 +1,66 @@
|
||||
package gameserver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCapturedPlanarRelicAffixesMatchCatalog(t *testing.T) {
|
||||
chdirRepositoryRoot(t)
|
||||
raw, err := os.ReadFile("resources/RelicClientCapture.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var capture struct {
|
||||
Relics []struct{ ID, SetID, MainAffixGroup, SubAffixGroup uint32 } `json:"relics"`
|
||||
Main []struct{ GroupID, AffixID, Property uint32 } `json:"main_affixes"`
|
||||
Sub []struct{ GroupID, AffixID, Property uint32 } `json:"sub_affixes"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &capture); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := loadInventoryItems(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(capture.Relics) != 4 {
|
||||
t.Fatalf("captured %d relics", len(capture.Relics))
|
||||
}
|
||||
for _, row := range capture.Relics {
|
||||
var found bool
|
||||
for _, item := range inventoryCatalog.Relics {
|
||||
if item.RelicID != row.ID {
|
||||
continue
|
||||
}
|
||||
found = true
|
||||
if item.RelicSetID != row.SetID {
|
||||
t.Fatalf("relic %d has wrong set", row.ID)
|
||||
}
|
||||
var mainProperty uint32
|
||||
for _, main := range capture.Main {
|
||||
if main.GroupID == row.MainAffixGroup && main.AffixID == item.MainAffixID {
|
||||
mainProperty = main.Property
|
||||
}
|
||||
}
|
||||
if mainProperty == 0 {
|
||||
t.Fatalf("relic %d main affix is outside its group", row.ID)
|
||||
}
|
||||
seen := make(map[uint32]bool)
|
||||
for _, affix := range item.SubAffixes {
|
||||
valid := false
|
||||
for _, sub := range capture.Sub {
|
||||
if sub.GroupID == row.SubAffixGroup && sub.AffixID == affix.SubAffixID && sub.Property != mainProperty {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid || seen[affix.SubAffixID] {
|
||||
t.Fatalf("relic %d has invalid or duplicate sub affix %d", row.ID, affix.SubAffixID)
|
||||
}
|
||||
seen[affix.SubAffixID] = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("relic %d missing from catalog", row.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user