private IEnumerable <ObjectDef> GetNewStatics(int _x, int _y) { var ret = new List <ObjectDef>(); foreach (IntPoint i in Sight.GetSightCircle(RADIUS)) { int x = i.X + _x; int y = i.Y + _y; if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight) { continue; } WmapTile tile = Owner.Map[x, y]; if (tile.ObjId != 0 && tile.ObjType != 0 && clientStatic.Add(new IntPoint(x, y))) { ObjectDef def = tile.ToDef(x, y); string cls = Manager.GameData.ObjectDescs[tile.ObjType].Class; if (cls == "ConnectedWall" || cls == "CaveWall") { bool hasCon = false; foreach (var s in def.Stats.Stats) { if (s.Key == StatsType.ObjectConnection && s.Value != null) { hasCon = true; } } if (!hasCon) { var stats = def.Stats.Stats.ToList(); stats.Add(new KeyValuePair <StatsType, object>(StatsType.ObjectConnection, (int)ConnectionComputer.Compute((xx, yy) => Owner.Map[x + xx, y + yy].ObjType == tile.ObjType).Bits)); def.Stats.Stats = stats.ToArray(); } } ret.Add(def); } } return(ret); }
protected override void ExportStats(IDictionary <StatsType, object> stats) { stats[StatsType.ObjectConnection] = (int)ConnectionComputer.Compute((_x, _y) => false).Bits; base.ExportStats(stats); }