public static BossFight IdentifyBossFight(MemorySnapshot snapshot)
        {
            Music?music_ = StaticData.GetMusic(snapshot.musicid);
            Map?  map_   = StaticData.GetMap(snapshot.mapid);

            if (music_ == null || map_ == null)
            {
                return(BossFight.UNKNOWN);
            }

            var music          = music_.Value;
            var map            = map_.Value;
            var mapTile        = snapshot.mapTile;
            var startingBosses = new HashSet <Boss>(snapshot.bossList
                                                    .Select(bossStats => StaticData.GetBoss(bossStats.id))
                                                    .Where(boss => boss != null)
                                                    .Select(boss => boss.Value)
                                                    );

            foreach (var bossFight in _matchMapTile[mapTile])
            {
                if ((bossFight.music == null || music == bossFight.music) &&
                    (bossFight.map == null || map == bossFight.map) &&
                    Matches(bossFight, startingBosses, music, map, mapTile))
                {
                    return(bossFight);
                }
            }

            foreach (var bossFight in _matchMusicAndMap[new Tuple <Music, Map>(music, map)])
            {
                if (Matches(bossFight, startingBosses, music, map, mapTile))
                {
                    return(bossFight);
                }
            }

            foreach (var bossFight in _matchMusic[music])
            {
                if (Matches(bossFight, startingBosses, music, map, mapTile))
                {
                    return(bossFight);
                }
            }

            foreach (var bossFight in _matchMap[map])
            {
                if (Matches(bossFight, startingBosses, music, map, mapTile))
                {
                    return(bossFight);
                }
            }

            return(_remainingDescriptions.FirstOrDefault(bossFight => Matches(bossFight, startingBosses, music, map, mapTile)) ?? BossFight.UNKNOWN);
        }
Example #2
0
        public void ReadMemory(Process process)
        {
            ++memoryReadCount;
            var memoryHelper = new MemoryHelper(process);

            // Snapshot Game Memory
            snapshot = new MemorySnapshot(memoryHelper, mainContext.veridx);

            Update();
            UpdateDebugArea(memoryHelper);
            UpdateEntityData(memoryHelper);
            UpdateFps();
            UpdateVariableExport();

            if (snapshot.musicid >= 0)
            {
                rabiRibiState.lastValidMusicId = snapshot.musicid;
            }
            prevSnapshot = snapshot;

            memoryHelper.Dispose();
        }