private void AddEntrance(SCArea currentArea, SCEntrance entrance, SCBitFlagSet requirements, bool topfloor)
        {
            foreach (var poi in entrance.PointsOfInterest.Where(p => p.BitFlagSet.Count > 0))
            {
                poi.MapId = entrance.Map.MapId;
                SCPointOfInterest dungeonpoi;
                if (!poiDic.TryGetValue(poi, out dungeonpoi))
                {
                    dungeonpoi            = poi.Clone();
                    dungeonpoi.BitFlagSet = new SCBitFlagSet();
                    poiDic.Add(dungeonpoi, dungeonpoi);
                }

                bool changed = dungeonpoi.BitFlagSet.Merge(poi.BitFlagSet, requirements);

                if (changed)
                {
                    if (dungeonpoi.Type == SCPointOfInterestType.Tele)
                    {
                        AddTele(currentArea, dungeonpoi.Teleport, dungeonpoi.BitFlagSet, false);
                    }
                    else if (dungeonpoi.Type == SCPointOfInterestType.Exit)
                    {
                        if (!exits.Contains(dungeonpoi.Teleport))
                        {
                            exits.Add(dungeonpoi.Teleport);
                        }
                    }
                    else if (dungeonpoi.Type == SCPointOfInterestType.Warp && topfloor)
                    {
                        if (!exits.Contains(dungeonpoi.Teleport))
                        {
                            exits.Add(dungeonpoi.Teleport);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void ComposeArea(SCEntrance entrance, HashSet <SCCoords> doneEntrances)
        {
            var poiDic = entrance.PointsOfInterest
                         .Where(e => e.Type == SCPointOfInterestType.SmEntrance || e.Type == SCPointOfInterestType.OwEntrance)
                         .Where(e => e.BitFlagSet.Count > 0)
                         .Select(e => e.Coords)
                         .Distinct(new SCCoordsEqualityComparer())
                         .ToDictionary(e => e, new SCCoordsEqualityComparer());

            var entranceList = Entrances.Where(e => poiDic.ContainsKey(e.Coords)).ToList();

            foreach (var e in entranceList)
            {
                if (!doneEntrances.Contains(e.Coords))
                {
                    doneEntrances.Add(e.Coords);
                }
            }

            var area = new SCArea(this, entranceList);

            Areas.Add(area);
        }