// Token: 0x06000011 RID: 17 RVA: 0x00002740 File Offset: 0x00000940
        public static void DrawCamoOverlay(Pawn pawn)
        {
            bool   flag = false;
            string text = "";

            if (CamoUtility.IsCamoActive(pawn, out Apparel apparel) && apparel != null)
            {
                float activeCamoEff = ThingCompUtility.TryGetComp <CompGearCamo>(apparel).Props.ActiveCamoEff;
                if (ThingCompUtility.TryGetComp <CompGearCamo>(apparel).Props.StealthCamoChance > 0 && activeCamoEff > 0f)
                {
                    text = "Mote_CASStealth";
                    flag = true;
                }
                else if (activeCamoEff > 0f)
                {
                    text = CamoDrawTools.GetMoteToUse(activeCamoEff);
                    flag = true;
                }
            }
            if (!flag && CamoGearUtility.GetCurCamoEff(pawn, out string text2, out float num) && num > 0f)
            {
                text = CamoDrawTools.GetMoteToUse(num);
                flag = true;
            }
            if (flag && text != "")
            {
                CamoDrawTools.DoCamoOverlay(pawn, text);
            }
        }
        // Token: 0x06000011 RID: 17 RVA: 0x00002740 File Offset: 0x00000940
        public static void DrawCamoOverlay(Pawn pawn)
        {
            var b    = false;
            var text = "";

            if (CamoUtility.IsCamoActive(pawn, out var apparel) && apparel != null)
            {
                var activeCamoEff = apparel.TryGetComp <CompGearCamo>().Props.ActiveCamoEff;
                if (apparel.TryGetComp <CompGearCamo>().Props.StealthCamoChance > 0 && activeCamoEff > 0f)
                {
                    text = "Mote_CASStealth";
                    b    = true;
                }
                else if (activeCamoEff > 0f)
                {
                    text = GetMoteToUse(activeCamoEff);
                    b    = true;
                }
            }

            if (!b && CamoGearUtility.GetCurCamoEff(pawn, out _, out var num) && num > 0f)
            {
                text = GetMoteToUse(num);
                b    = true;
            }

            if (b && text != "")
            {
                DoCamoOverlay(pawn, text);
            }
        }
        // Token: 0x06000064 RID: 100 RVA: 0x00006618 File Offset: 0x00004818
        public override string CompInspectStringExtra()
        {
            if (CamoUtility.IsCamoActive(Pawn, out var apparel))
            {
                if (apparel == null)
                {
                    return(null);
                }

                var    activeCamoEff = apparel.TryGetComp <CompGearCamo>().Props.ActiveCamoEff;
                string text          = "CompCamo.Active".Translate();
                if (apparel.TryGetComp <CompGearCamo>().Props.StealthCamoChance > 0 && activeCamoEff > 0f)
                {
                    text = "CompCamo.Stealth".Translate();
                }

                return("CompCamo.CamouflageDesc".Translate(text, activeCamoEff.ToStringPercent()));
            }

            if (!CamoGearUtility.GetCurCamoEff(Pawn, out var a, out var num))
            {
                return(null);
            }

            string text2 = "CompCamo.Undefined".Translate();

            switch (a)
            {
            case "Arctic":
                text2 = "CompCamo.Arctic".Translate();
                break;

            case "Desert":
                text2 = "CompCamo.Desert".Translate();
                break;

            case "Jungle":
                text2 = "CompCamo.Jungle".Translate();
                break;

            case "Stone":
                text2 = "CompCamo.Stone".Translate();
                break;

            case "Urban":
                text2 = "CompCamo.Urban".Translate();
                break;

            case "Woodland":
                text2 = "CompCamo.Woodland".Translate();
                break;
            }

            return("CompCamo.CamouflageDesc".Translate(text2, num.ToStringPercent()));
        }
Example #4
0
 // Token: 0x06000064 RID: 100 RVA: 0x00006618 File Offset: 0x00004818
 public override string CompInspectStringExtra()
 {
     if (CamoUtility.IsCamoActive(this.Pawn, out Apparel apparel))
     {
         if (apparel != null)
         {
             float  activeCamoEff = ThingCompUtility.TryGetComp <CompGearCamo>(apparel).Props.ActiveCamoEff;
             string text          = Translator.Translate("CompCamo.Active");
             if (ThingCompUtility.TryGetComp <CompGearCamo>(apparel).Props.StealthCamoChance > 0 && activeCamoEff > 0f)
             {
                 text = Translator.Translate("CompCamo.Stealth");
             }
             return(TranslatorFormattedStringExtensions.Translate("CompCamo.CamouflageDesc", text, GenText.ToStringPercent(activeCamoEff)));
         }
     }
     else if (CamoGearUtility.GetCurCamoEff(this.Pawn, out string a, out float num))
     {
         string text2 = Translator.Translate("CompCamo.Undefined");
         if (!(a == "Arctic"))
         {
             if (!(a == "Desert"))
             {
                 if (!(a == "Jungle"))
                 {
                     if (!(a == "Stone"))
                     {
                         if (!(a == "Urban"))
                         {
                             if (a == "Woodland")
                             {
                                 text2 = Translator.Translate("CompCamo.Woodland");
                             }
                         }
                         else
                         {
                             text2 = Translator.Translate("CompCamo.Urban");
                         }
                     }
                     else
                     {
                         text2 = Translator.Translate("CompCamo.Stone");
                     }
                 }
                 else
                 {
                     text2 = Translator.Translate("CompCamo.Jungle");
                 }
             }
             else
             {
                 text2 = Translator.Translate("CompCamo.Desert");
             }
         }
         else
         {
             text2 = Translator.Translate("CompCamo.Arctic");
         }
         return(TranslatorFormattedStringExtensions.Translate("CompCamo.CamouflageDesc", text2, GenText.ToStringPercent(num)));
     }
     return(null);
 }
Example #5
0
        // Token: 0x06000016 RID: 22 RVA: 0x000028CC File Offset: 0x00000ACC
        public static bool IsTargetHidden(Pawn target, Pawn seer)
        {
            if (target == null || seer == null)
            {
                Log.Message("Target/Seer Null");
                return(false);
            }

            if (target == seer)
            {
                return(false);
            }

            if (TryGetCamoHidValue(seer, target, out var result))
            {
                return(result);
            }

            if (!target.Spawned)
            {
                return(false);
            }

            var     isCamoActive = false;
            Apparel apparel      = null;

            if (!IsDebugMode() || !Controller.Settings.forcePassive)
            {
                isCamoActive = IsCamoActive(target, out var apparel2);
                if (apparel2 != null)
                {
                    apparel = apparel2;
                }
            }

            if ((!isCamoActive || seer.CurrentEffectiveVerb.IsMeleeAttack) && SimplyTooClose(seer, target))
            {
                TryAddCamoHidValue(seer, target, false);
                return(false);
            }

            if (isCamoActive || IsDebugMode() && Controller.Settings.forceActive)
            {
                if (!seer.Spawned)
                {
                    return(false);
                }

                if (target.Map == null || seer.Map == null || target.Map != seer.Map ||
                    seer.InMentalState && target.InMentalState)
                {
                    TryAddCamoHidValue(seer, target, false);
                    return(false);
                }

                if (!GenSight.LineOfSight(seer.Position, target.Position, seer.Map))
                {
                    return(true);
                }

                var  num  = 0.75f;
                var  num2 = 0;
                bool settingsForceStealth;
                if (IsDebugMode() && Controller.Settings.forceActive)
                {
                    apparel = null;
                    settingsForceStealth = Controller.Settings.forceStealth;
                    if (settingsForceStealth)
                    {
                        num2 = 5;
                    }
                }
                else
                {
                    num  = apparel.TryGetComp <CompGearCamo>().Props.ActiveCamoEff;
                    num2 = apparel.TryGetComp <CompGearCamo>().Props.StealthCamoChance;
                    settingsForceStealth = num2 > 0 && num > 0f;
                }

                if (CamoEffectWorked(target, seer, apparel, num, true, settingsForceStealth, num2, out var chance,
                                     out var scaler))
                {
                    DoCamoMote(seer, target, true, chance, num, scaler);
                    TryAddCamoHidValue(seer, target, true);
                    CamoAIUtility.CorrectLordForCamo(seer, target);
                    return(true);
                }

                DoCamoMote(seer, target, false, chance, num, scaler);
                TryAddCamoHidValue(seer, target, false);
                return(false);
            }

            if (!seer.Spawned)
            {
                return(false);
            }

            if (!CamoGearUtility.GetCurCamoEff(target, out var str, out var camoEff))
            {
                TryAddCamoHidValue(seer, target, false);
                return(false);
            }

            if (IsDebugMode())
            {
                if (Controller.Settings.forcePassive)
                {
                    camoEff = 0.75f;
                }

                Log.Message("Camo: " + str + " : " + camoEff.ToString("F2"));
            }

            if (target.Map == null || seer.Map == null || target.Map != seer.Map ||
                seer.InMentalState && target.InMentalState)
            {
                TryAddCamoHidValue(seer, target, false);
                return(false);
            }

            if (!GenSight.LineOfSight(seer.Position, target.Position, seer.Map))
            {
                return(true);
            }

            if (CamoEffectWorked(target, seer, null, camoEff, false, false, 0, out var chance2,
                                 out var scaler2))
            {
                DoCamoMote(seer, target, true, chance2, camoEff, scaler2);
                TryAddCamoHidValue(seer, target, true);
                CamoAIUtility.CorrectLordForCamo(seer, target);
                return(true);
            }

            DoCamoMote(seer, target, false, chance2, camoEff, scaler2);
            TryAddCamoHidValue(seer, target, false);
            return(false);
        }
Example #6
0
 // Token: 0x06000016 RID: 22 RVA: 0x000028CC File Offset: 0x00000ACC
 public static bool IsTargetHidden(Pawn target, Pawn seer)
 {
     if (target == null || seer == null)
     {
         Log.Message("Target/Seer Null", false);
         return(false);
     }
     if (target != null && seer != null)
     {
         if (target == seer)
         {
             return(false);
         }
         if (CamoUtility.TryGetCamoHidValue(seer, target, out bool result))
         {
             return(result);
         }
     }
     if (target != null && target.Spawned)
     {
         bool    flag    = false;
         Apparel apparel = null;
         if (!CamoUtility.IsDebugMode() || !Controller.Settings.forcePassive)
         {
             flag = CamoUtility.IsCamoActive(target, out Apparel apparel2);
             if (apparel2 != null)
             {
                 apparel = apparel2;
             }
         }
         if ((!flag || (flag && seer.CurrentEffectiveVerb.IsMeleeAttack)) && CamoUtility.SimplyTooClose(seer, target))
         {
             CamoUtility.TryAddCamoHidValue(seer, target, false);
             return(false);
         }
         if (flag || (CamoUtility.IsDebugMode() && Controller.Settings.forceActive))
         {
             if (seer == null || !seer.Spawned)
             {
                 return(false);
             }
             if ((target?.Map) == null || (seer?.Map) == null || target.Map != seer.Map || (seer.InMentalState && target.InMentalState))
             {
                 CamoUtility.TryAddCamoHidValue(seer, target, false);
                 return(false);
             }
             if (!GenSight.LineOfSight(seer.Position, target.Position, seer.Map, false, null, 0, 0))
             {
                 return(true);
             }
             float num  = 0.75f;
             int   num2 = 0;
             bool  flag2;
             if (CamoUtility.IsDebugMode() && Controller.Settings.forceActive)
             {
                 apparel = null;
                 flag2   = Controller.Settings.forceStealth;
                 if (flag2)
                 {
                     num2 = 5;
                 }
             }
             else
             {
                 num   = ThingCompUtility.TryGetComp <CompGearCamo>(apparel).Props.ActiveCamoEff;
                 num2  = ThingCompUtility.TryGetComp <CompGearCamo>(apparel).Props.StealthCamoChance;
                 flag2 = (num2 > 0 && num > 0f);
             }
             if (CamoUtility.CamoEffectWorked(target, seer, apparel, num, true, flag2, num2, out int chance, out float scaler))
             {
                 CamoUtility.DoCamoMote(seer, target, true, chance, num, scaler);
                 CamoUtility.TryAddCamoHidValue(seer, target, true);
                 CamoAIUtility.CorrectLordForCamo(seer, target);
                 return(true);
             }
             CamoUtility.DoCamoMote(seer, target, false, chance, num, scaler);
             CamoUtility.TryAddCamoHidValue(seer, target, false);
             return(false);
         }
         else if (seer != null && seer.Spawned)
         {
             if (!CamoGearUtility.GetCurCamoEff(target, out string str, out float camoEff))
             {
                 CamoUtility.TryAddCamoHidValue(seer, target, false);
                 return(false);
             }
             if (CamoUtility.IsDebugMode())
             {
                 if (Controller.Settings.forcePassive)
                 {
                     camoEff = 0.75f;
                 }
                 Log.Message("Camo: " + str + " : " + camoEff.ToString("F2"), false);
             }
             if ((target?.Map) == null || (seer?.Map) == null || target.Map != seer.Map || (seer.InMentalState && target.InMentalState))
             {
                 CamoUtility.TryAddCamoHidValue(seer, target, false);
                 return(false);
             }
             if (!GenSight.LineOfSight(seer.Position, target.Position, seer.Map, false, null, 0, 0))
             {
                 return(true);
             }
             if (CamoUtility.CamoEffectWorked(target, seer, null, camoEff, false, false, 0, out int chance2, out float scaler2))
             {
                 CamoUtility.DoCamoMote(seer, target, true, chance2, camoEff, scaler2);
                 CamoUtility.TryAddCamoHidValue(seer, target, true);
                 CamoAIUtility.CorrectLordForCamo(seer, target);
                 return(true);
             }
             CamoUtility.DoCamoMote(seer, target, false, chance2, camoEff, scaler2);
             CamoUtility.TryAddCamoHidValue(seer, target, false);
             return(false);
         }
     }
     return(false);
 }