Ejemplo n.º 1
0
 public static void Postfix(LineOfSight __instance, ref float __result, AbstractActor source)
 {
     if (__instance != null && source != null)
     {
         __result = SensorLockHelper.GetSensorsRange(source);
     }
 }
        private static string BuildToolTip(AbstractActor actor)
        {
            //Mod.Log.Debug?.Write($"EW State for actor:{CombatantUtils.Label(actor)} = {ewState}");

            List <string> details = new List <string>();

            // Visuals check
            float visualLockRange = VisualLockHelper.GetVisualLockRange(actor);
            float visualScanRange = VisualLockHelper.GetVisualScanRange(actor);

            details.Add(
                new Text(Mod.LocalizedText.StatusPanel[ModText.LT_PANEL_VISUALS],
                         new object[] { visualLockRange, visualScanRange, ModState.GetMapConfig().UILabel() })
                .ToString()
                );

            // Sensors check
            EWState ewState = new EWState(actor);

            int            totalDetails = ewState.GetCurrentEWCheck() + ewState.AdvancedSensorsMod();
            SensorScanType checkLevel   = SensorScanTypeHelper.DetectionLevelForCheck(totalDetails);

            float rawRangeMulti = SensorLockHelper.GetAllSensorRangeMultipliers(actor);
            float rangeMulti    = rawRangeMulti + ewState.GetSensorsRangeMulti();

            float  sensorsRange = SensorLockHelper.GetSensorsRange(actor);
            string sensorColor  = ewState.GetCurrentEWCheck() >= 0 ? "00FF00" : "FF0000";

            details.Add(
                new Text(Mod.LocalizedText.StatusPanel[ModText.LT_PANEL_SENSORS],
                         new object[] { sensorColor, sensorsRange, sensorColor, rangeMulti, checkLevel.Label() })
                .ToString()
                );

            // Details
            //{ LT_PANEL_DETAILS, "  Total: <color=#{0}>{1:+0;-#}</color><size=90%> Roll: <color=#{2}>{3:+0;-#}</color> Tactics: <color=#00FF00>{4:+0;-#}</color> AdvSen: <color=#{5}>{6:+0;-#}</color>\n"
            string totalColor  = totalDetails >= 0 ? "00FF00" : "FF0000";
            string checkColor  = ewState.GetRawCheck() >= 0 ? "00FF00" : "FF0000";
            string advSenColor = ewState.AdvancedSensorsMod() >= 0 ? "00FF00" : "FF0000";

            details.Add(
                new Text(Mod.LocalizedText.StatusPanel[ModText.LT_PANEL_DETAILS],
                         new object[] { totalColor, totalDetails, checkColor, ewState.GetRawCheck(), ewState.GetRawTactics(), advSenColor, ewState.AdvancedSensorsMod() })
                .ToString()
                );

            //  Heat Vision
            if (ewState.GetRawHeatVision() != null)
            {
                // { LT_PANEL_HEAT, "<b>Thermals</b><size=90%> Mod:<color=#{0}>{1:+0;-#}</color> / {2} heat Range:{3}m\n" },
                HeatVision heatVis = ewState.GetRawHeatVision();
                // Positive is bad, negative is good
                string modColor = heatVis.AttackMod >= 0 ? "FF0000" : "00FF00";
                details.Add(
                    new Text(Mod.LocalizedText.StatusPanel[ModText.LT_PANEL_HEAT],
                             new object[] { modColor, heatVis.AttackMod, heatVis.HeatDivisor, heatVis.MaximumRange })
                    .ToString()
                    );
            }

            //  Zoom Vision
            if (ewState.GetRawZoomVision() != null)
            {
                // { LT_PANEL_ZOOM, "<b>Zoom</b><size=90%> Mod:<color=#{0}>{1:+0;-#}</color? Cap:<color=#{2}>{3:+0;-#}</color> Range:{4}m\n" },
                ZoomVision zoomVis = ewState.GetRawZoomVision();
                // Positive is bad, negative is good
                string modColor = zoomVis.AttackMod >= 0 ? "FF0000" : "00FF00";
                string capColor = zoomVis.AttackCap >= 0 ? "FF0000" : "00FF00";
                details.Add(
                    new Text(Mod.LocalizedText.StatusPanel[ModText.LT_PANEL_ZOOM],
                             new object[] { modColor, zoomVis.AttackMod, capColor, zoomVis.AttackCap, zoomVis.MaximumRange })
                    .ToString()
                    );
            }

            string tooltipText = String.Join("", details.ToArray());

            return(tooltipText);
        }