public static void Notify_ThingChanged(Thing thing)
 {
     if (StealAIDebugDrawer.debugDrawLord == null)
     {
         return;
     }
     StealAIDebugDrawer.CheckInitDebugDrawGrid();
     if (thing.def.category != ThingCategory.Building && thing.def.category != ThingCategory.Item && thing.def.passability != Traversability.Impassable)
     {
         return;
     }
     if (thing.def.passability == Traversability.Impassable)
     {
         StealAIDebugDrawer.debugDrawLord = null;
     }
     else
     {
         int   num  = GenRadial.NumCellsInRadius(8f);
         float num2 = StealAIUtility.StartStealingMarketValueThreshold(StealAIDebugDrawer.debugDrawLord);
         for (int i = 0; i < num; i++)
         {
             IntVec3 intVec = thing.Position + GenRadial.RadialPattern[i];
             if (intVec.InBounds(thing.Map))
             {
                 StealAIDebugDrawer.debugDrawGrid[intVec] = (StealAIDebugDrawer.TotalMarketValueAround(intVec, Find.CurrentMap, StealAIDebugDrawer.debugDrawLord.ownedPawns.Count) > num2);
             }
         }
     }
 }
 public void MapInterfaceUpdate()
 {
     if (Find.CurrentMap != null)
     {
         if (!WorldRendererUtility.WorldRenderedNow)
         {
             Profiler.BeginSample("TargeterUpdate()");
             this.targeter.TargeterUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("DrawSelectionOverlays()");
             SelectionDrawer.DrawSelectionOverlays();
             Profiler.EndSample();
             Profiler.BeginSample("EnvironmentStatsDrawer.DrawRoomOverlays()");
             EnvironmentStatsDrawer.DrawRoomOverlays();
             Profiler.EndSample();
             Profiler.BeginSample("DesignatorManagerUpdate()");
             this.designatorManager.DesignatorManagerUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("RoofGridUpdate()");
             Find.CurrentMap.roofGrid.RoofGridUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("ExitMapGridUpdate()");
             Find.CurrentMap.exitMapGrid.ExitMapGridUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("DeepResourceGridUpdate()");
             Find.CurrentMap.deepResourceGrid.DeepResourceGridUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("Debug drawing");
             if (DebugViewSettings.drawPawnDebug)
             {
                 Find.CurrentMap.pawnDestinationReservationManager.DebugDrawDestinations();
                 Find.CurrentMap.reservationManager.DebugDrawReservations();
             }
             if (DebugViewSettings.drawFoodSearchFromMouse)
             {
                 FoodUtility.DebugFoodSearchFromMouse_Update();
             }
             if (DebugViewSettings.drawPreyInfo)
             {
                 FoodUtility.DebugDrawPredatorFoodSource();
             }
             if (DebugViewSettings.drawAttackTargetScores)
             {
                 AttackTargetFinder.DebugDrawAttackTargetScores_Update();
             }
             MiscDebugDrawer.DebugDrawInteractionCells();
             Find.CurrentMap.debugDrawer.DebugDrawerUpdate();
             Find.CurrentMap.regionGrid.DebugDraw();
             InfestationCellFinder.DebugDraw();
             StealAIDebugDrawer.DebugDraw();
             if (DebugViewSettings.drawRiverDebug)
             {
                 Find.CurrentMap.waterInfo.DebugDrawRiver();
             }
             Profiler.EndSample();
         }
     }
 }
 public void MapInterfaceUpdate()
 {
     if (Find.CurrentMap != null && !WorldRendererUtility.WorldRenderedNow)
     {
         targeter.TargeterUpdate();
         SelectionDrawer.DrawSelectionOverlays();
         EnvironmentStatsDrawer.DrawRoomOverlays();
         designatorManager.DesignatorManagerUpdate();
         Find.CurrentMap.roofGrid.RoofGridUpdate();
         Find.CurrentMap.fertilityGrid.FertilityGridUpdate();
         Find.CurrentMap.terrainGrid.TerrainGridUpdate();
         Find.CurrentMap.exitMapGrid.ExitMapGridUpdate();
         Find.CurrentMap.deepResourceGrid.DeepResourceGridUpdate();
         if (DebugViewSettings.drawPawnDebug)
         {
             Find.CurrentMap.pawnDestinationReservationManager.DebugDrawDestinations();
             Find.CurrentMap.reservationManager.DebugDrawReservations();
         }
         if (DebugViewSettings.drawDestReservations)
         {
             Find.CurrentMap.pawnDestinationReservationManager.DebugDrawReservations();
         }
         if (DebugViewSettings.drawFoodSearchFromMouse)
         {
             FoodUtility.DebugFoodSearchFromMouse_Update();
         }
         if (DebugViewSettings.drawPreyInfo)
         {
             FoodUtility.DebugDrawPredatorFoodSource();
         }
         if (DebugViewSettings.drawAttackTargetScores)
         {
             AttackTargetFinder.DebugDrawAttackTargetScores_Update();
         }
         MiscDebugDrawer.DebugDrawInteractionCells();
         Find.CurrentMap.debugDrawer.DebugDrawerUpdate();
         Find.CurrentMap.regionGrid.DebugDraw();
         InfestationCellFinder.DebugDraw();
         StealAIDebugDrawer.DebugDraw();
         if (DebugViewSettings.drawRiverDebug)
         {
             Find.CurrentMap.waterInfo.DebugDrawRiver();
         }
         BuildingsDamageSectionLayerUtility.DebugDraw();
     }
 }
        public static void DebugDraw()
        {
            if (!DebugViewSettings.drawStealDebug)
            {
                StealAIDebugDrawer.debugDrawLord = null;
                return;
            }
            Lord lord = StealAIDebugDrawer.debugDrawLord;

            StealAIDebugDrawer.debugDrawLord = StealAIDebugDrawer.FindHostileLord();
            if (StealAIDebugDrawer.debugDrawLord == null)
            {
                return;
            }
            StealAIDebugDrawer.CheckInitDebugDrawGrid();
            float num = StealAIUtility.StartStealingMarketValueThreshold(StealAIDebugDrawer.debugDrawLord);

            if (lord != StealAIDebugDrawer.debugDrawLord)
            {
                foreach (IntVec3 intVec in Find.CurrentMap.AllCells)
                {
                    StealAIDebugDrawer.debugDrawGrid[intVec] = (StealAIDebugDrawer.TotalMarketValueAround(intVec, Find.CurrentMap, StealAIDebugDrawer.debugDrawLord.ownedPawns.Count) > num);
                }
            }
            foreach (IntVec3 c in Find.CurrentMap.AllCells)
            {
                if (StealAIDebugDrawer.debugDrawGrid[c])
                {
                    CellRenderer.RenderCell(c, 0.5f);
                }
            }
            StealAIDebugDrawer.tmpToSteal.Clear();
            for (int i = 0; i < StealAIDebugDrawer.debugDrawLord.ownedPawns.Count; i++)
            {
                Pawn  pawn = StealAIDebugDrawer.debugDrawLord.ownedPawns[i];
                Thing thing;
                if (StealAIUtility.TryFindBestItemToSteal(pawn.Position, pawn.Map, 7f, out thing, pawn, StealAIDebugDrawer.tmpToSteal))
                {
                    GenDraw.DrawLineBetween(pawn.TrueCenter(), thing.TrueCenter());
                    StealAIDebugDrawer.tmpToSteal.Add(thing);
                }
            }
            StealAIDebugDrawer.tmpToSteal.Clear();
        }