pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -0,0 +1,67 @@
|
||||
package gameserver
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gac-hkrpg-go/internal/common"
|
||||
)
|
||||
|
||||
func TestClientRelicCatalogFiltersUnsupportedInventoryEntries(t *testing.T) {
|
||||
chdirRepositoryRoot(t)
|
||||
if _, err := loadInventoryItems(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(inventoryCatalog.Relics) == 0 {
|
||||
t.Fatal("Relic catalog is empty")
|
||||
}
|
||||
validID := inventoryCatalog.Relics[0].RelicID
|
||||
for _, relic := range inventoryCatalog.Relics {
|
||||
if relic.RelicID/10000 >= 7 && relic.RelicID/10000 <= 9 {
|
||||
t.Fatalf("synthetic Relic ID %d appears in the Client catalog", relic.RelicID)
|
||||
}
|
||||
}
|
||||
|
||||
got, omitted, err := supportedProtoRelics([]common.Relic{
|
||||
{RelicID: validID, InternalUID: 1},
|
||||
{RelicID: 71011, InternalUID: 2},
|
||||
{RelicID: 63295, InternalUID: 3},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(got) != 1 || got[0].Tid != validID || omitted != 2 {
|
||||
t.Fatalf("filtered Relics = %+v, omitted %d; want only Client-supported ID %d", got, omitted, validID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBagMaterialsAppliesOnlyCatalogBackedOverrides(t *testing.T) {
|
||||
chdirRepositoryRoot(t)
|
||||
itemIDs, err := loadInventoryItems()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(itemIDs) == 0 {
|
||||
t.Fatal("inventory catalog is empty")
|
||||
}
|
||||
foodAuto := true
|
||||
player := &common.FreesrData{
|
||||
Avatars: map[uint32]*common.AvatarJson{},
|
||||
Materials: map[uint32]uint32{itemIDs[0]: 0, 99999999: 77},
|
||||
TechniqueFoodStock: map[uint32]uint32{},
|
||||
AutoTechniqueFood: &foodAuto,
|
||||
}
|
||||
materials, err := bagMaterials(player)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
counts := make(map[uint32]uint32, len(materials))
|
||||
for _, material := range materials {
|
||||
counts[material.Tid] = material.Num
|
||||
}
|
||||
if count, ok := counts[itemIDs[0]]; !ok || count != 0 {
|
||||
t.Fatalf("catalog item override = %d, present=%v; want explicit zero", count, ok)
|
||||
}
|
||||
if _, ok := counts[99999999]; ok {
|
||||
t.Fatal("unknown item override leaked into the Client bag")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user