Files
GaCy-GO/internal/gameserver/currency_wars_supply_offer_test.go
T

53 lines
1.7 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 n := 0; n < 10; n++ {
offer, err := cwGenerateSupplyOfferWithRules(c, run, nil)
if err != nil {
t.Fatal(err)
}
if offer.DAEMEBCKHIK == 0 || len(offer.MFBAKLCBPCJ) < int(offer.DAEMEBCKHIK) {
t.Fatal("Supply has too few options")
}
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.Fatal("Supply gear is not captured")
}
}
}
if _, err := cwGenerateSupplyOfferWithRules(c, run, map[string]uint32{"ExtraSupplyOption": ^uint32(0)}); err == nil {
t.Fatal("excessive Supply option count must be rejected")
}
}