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
@@ -60,6 +60,26 @@ func syncPersistedExRanks(s *Session) error {
|
||||
// existing full-import path only when equipment, relics or avatar ownership change.
|
||||
func reloadPlayerData(s *Session, next *common.FreesrData) error {
|
||||
previous := s.JSON()
|
||||
materials, err := bagMaterials(next)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var changedMaterials []*goproto.Material
|
||||
if previous != nil {
|
||||
oldMaterials, err := bagMaterials(previous)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
oldCounts := make(map[uint32]uint32, len(oldMaterials))
|
||||
for _, item := range oldMaterials {
|
||||
oldCounts[item.Tid] = item.Num
|
||||
}
|
||||
for _, item := range materials {
|
||||
if old, exists := oldCounts[item.Tid]; !exists || old != item.Num {
|
||||
changedMaterials = append(changedMaterials, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
full := previous == nil
|
||||
if !full {
|
||||
full = !reflect.DeepEqual(previous.Lightcones, next.Lightcones) || !reflect.DeepEqual(previous.Relics, next.Relics) || len(previous.Avatars) != len(next.Avatars)
|
||||
@@ -81,16 +101,12 @@ func reloadPlayerData(s *Session, next *common.FreesrData) error {
|
||||
if full {
|
||||
return s.SyncPlayer()
|
||||
}
|
||||
if len(changed) == 0 {
|
||||
if len(changed) == 0 && len(changedMaterials) == 0 {
|
||||
return nil
|
||||
}
|
||||
sortU32Slice(changed)
|
||||
notify := &goproto.PlayerSyncScNotify{}
|
||||
buildSync(next, notify, changed, nil, nil)
|
||||
var err error
|
||||
notify.MaterialList, err = eidolonMaterials(next)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notify.MaterialList = changedMaterials
|
||||
return s.Send(notify)
|
||||
}
|
||||
Reference in new issue
Block a user