56 lines
2.0 KiB
Go
56 lines
2.0 KiB
Go
package gameserver
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gac-hkrpg-go/internal/common"
|
|
pb "gac-hkrpg-go/protocol/proto"
|
|
)
|
|
|
|
func TestCurrencyWarsSupplyOffersUseCapturedRolesAndEquipment(t *testing.T) {
|
|
c, err := common.LoadCurrencyWarsCatalog()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
run := &pb.MPIMAEMCEFH{NAGDJGMMCBE: []*pb.GridFightGameInfo{{LEOIAOFBBFA: &pb.GridFightGameInfo_KLCPAAHDPJF{KLCPAAHDPJF: &pb.BEEFLEJAOCN{DCAHJELNJNP: 2}}}}}
|
|
gear, err := common.LoadCurrencyWarsEquipment(c)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, chapter := range []uint32{2, 3} {
|
|
chRun := &pb.MPIMAEMCEFH{NAGDJGMMCBE: []*pb.GridFightGameInfo{{LEOIAOFBBFA: &pb.GridFightGameInfo_KLCPAAHDPJF{KLCPAAHDPJF: &pb.BEEFLEJAOCN{DCAHJELNJNP: chapter}}}}}
|
|
for n := 0; n < 10; n++ {
|
|
offer, err := cwGenerateSupplyOfferWithRules(c, chRun, nil)
|
|
if err != nil {
|
|
t.Fatalf("chapter %d supply offer: %v", chapter, err)
|
|
}
|
|
if offer.DAEMEBCKHIK == 0 || len(offer.MFBAKLCBPCJ) < int(offer.DAEMEBCKHIK) {
|
|
t.Fatalf("chapter %d supply has too few options", chapter)
|
|
}
|
|
used := map[uint32]bool{}
|
|
for _, item := range offer.MFBAKLCBPCJ {
|
|
if item == nil || used[item.RoleId] {
|
|
t.Fatal("Supply role is missing or duplicated")
|
|
}
|
|
used[item.RoleId] = true
|
|
drop := item.GetOPPFPECOBEF()
|
|
if drop == nil || drop.FNLMKJLKLFH != item.RoleId {
|
|
t.Fatal("Supply role display differs")
|
|
}
|
|
if _, err := c.CapturedRoleVariant(item.RoleId, drop.GetDisplayValue().GetRoleStar()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(item.GridFightItemList) != 1 || len(item.DHLBEFLOOPM) != 1 || item.GridFightItemList[0] != item.DHLBEFLOOPM[0].FNLMKJLKLFH {
|
|
t.Fatal("Supply gear display differs")
|
|
}
|
|
if _, ok := gear[item.GridFightItemList[0]]; !ok {
|
|
t.Fatalf("Supply gear %d is not captured", item.GridFightItemList[0])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if _, err := cwGenerateSupplyOfferWithRules(c, run, map[string]uint32{"ExtraSupplyOption": ^uint32(0)}); err == nil {
|
|
t.Fatal("excessive Supply option count must be rejected")
|
|
}
|
|
}
|