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,44 @@
|
||||
package common
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Missing avatars must not become a successful empty roster: scene actors and
|
||||
// the Client's lineup member array would then disagree during login.
|
||||
func ValidateAvatarRoster(avatars map[uint32]*AvatarJson) error {
|
||||
if len(avatars) == 0 {
|
||||
return fmt.Errorf("player data is missing a non-empty avatars object")
|
||||
}
|
||||
for id, avatar := range avatars {
|
||||
if id == 0 || avatar == nil || avatar.AvatarID != id {
|
||||
return fmt.Errorf("invalid avatar record for key %d", id)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateAdventureLineup(avatars map[uint32]*AvatarJson, lineup map[uint32]uint32) error {
|
||||
if err := ValidateAvatarRoster(avatars); err != nil {
|
||||
return err
|
||||
}
|
||||
rules, err := LoadTeamPresetRules()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
members := 0
|
||||
for slot, id := range lineup {
|
||||
if id == 0 {
|
||||
continue
|
||||
}
|
||||
if slot >= rules.MaxMembers {
|
||||
return fmt.Errorf("lineup slot %d exceeds captured member limit", slot)
|
||||
}
|
||||
if avatars[id] == nil {
|
||||
return fmt.Errorf("lineup slot %d references missing avatar %d", slot, id)
|
||||
}
|
||||
members++
|
||||
}
|
||||
if members == 0 {
|
||||
return fmt.Errorf("active adventure lineup has no valid members")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user