Exemple #1
0
 // Token: 0x06000018 RID: 24 RVA: 0x00002C58 File Offset: 0x00000E58
 public static bool TryGetCamoHidValue(Pawn seer, Pawn target, out bool hid)
 {
     hid = false;
     if (seer != null)
     {
         PawnCamoData pawnCamoData = ThingCompUtility.TryGetComp <PawnCamoData>(seer);
         if (pawnCamoData != null)
         {
             int           ticksGame = Find.TickManager.TicksGame;
             List <string> list      = pawnCamoData?.PawnHidTickList;
             if (list != null && list.Count > 0)
             {
                 foreach (string valuesStr in list)
                 {
                     if (CamoGearUtility.GetIntValue(valuesStr, 1) + CamoUtility.TickElapse >= ticksGame)
                     {
                         int intValue = CamoGearUtility.GetIntValue(valuesStr, 0);
                         if (target != null && target != null)
                         {
                             int thingIDNumber = target.thingIDNumber;
                             if (intValue == target.thingIDNumber)
                             {
                                 string strValue = CamoGearUtility.GetStrValue(valuesStr, 2);
                                 hid = (strValue == "1");
                                 return(true);
                             }
                         }
                     }
                 }
                 return(false);
             }
         }
     }
     return(false);
 }
        // Token: 0x06000038 RID: 56 RVA: 0x00003F58 File Offset: 0x00002158
        internal static bool GetCurCamoEff(Pawn pawn, out string type, out float CamoEff)
        {
            CamoEff = 0f;
            type    = CamoGearUtility.GetCamoType(pawn);
            PawnCamoData pawnCamoData = ThingCompUtility.TryGetComp <PawnCamoData>(pawn);

            if (pawnCamoData != null)
            {
                string a = type;
                if (!(a == "Arctic"))
                {
                    if (!(a == "Desert"))
                    {
                        if (!(a == "Jungle"))
                        {
                            if (!(a == "Stone"))
                            {
                                if (!(a == "Woodland"))
                                {
                                    if (!(a == "Urban"))
                                    {
                                        CamoEff = pawnCamoData.PawnnotDefinedCamo;
                                    }
                                    else
                                    {
                                        CamoEff = pawnCamoData.PawnUrbanCamo;
                                    }
                                }
                                else
                                {
                                    CamoEff = pawnCamoData.PawnWoodlandCamo;
                                }
                            }
                            else
                            {
                                CamoEff = pawnCamoData.PawnStoneCamo;
                            }
                        }
                        else
                        {
                            CamoEff = pawnCamoData.PawnJungleCamo;
                        }
                    }
                    else
                    {
                        CamoEff = pawnCamoData.PawnDesertCamo;
                    }
                }
                else
                {
                    CamoEff = pawnCamoData.PawnArcticCamo;
                }
            }
            return(CamoEff > 0f);
        }
Exemple #3
0
 // Token: 0x06000057 RID: 87 RVA: 0x00005FB0 File Offset: 0x000041B0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     if (respawningAfterLoad && this.Props.ActiveCamoEff > 0f && this.Props.CamoEnergyMax > 0f)
     {
         Thing parent = this.parent;
         if (parent.GetType() != typeof(ActiveCamoApparel) && parent.def.thingClass == typeof(ActiveCamoApparel) && parent.Spawned && (parent?.Map) != null)
         {
             PawnCamoData.CorrectActiveApparel(parent as Apparel, null);
         }
     }
 }
Exemple #4
0
 // Token: 0x06000019 RID: 25 RVA: 0x00002D30 File Offset: 0x00000F30
 public static void TryAddCamoHidValue(Pawn seer, Pawn target, bool value)
 {
     if (seer != null)
     {
         bool         flag         = false;
         PawnCamoData pawnCamoData = ThingCompUtility.TryGetComp <PawnCamoData>(seer);
         if (pawnCamoData != null)
         {
             int           ticksGame       = Find.TickManager.TicksGame;
             List <string> list            = new List <string>();
             List <string> pawnHidTickList = pawnCamoData.PawnHidTickList;
             if (pawnHidTickList != null && pawnHidTickList.Count > 0)
             {
                 foreach (string text in pawnHidTickList)
                 {
                     if (CamoGearUtility.GetIntValue(text, 1) + CamoUtility.TickElapse >= ticksGame)
                     {
                         GenCollection.AddDistinct <string>(list, text);
                         int intValue = CamoGearUtility.GetIntValue(text, 0);
                         if (target != null && target != null)
                         {
                             int thingIDNumber = target.thingIDNumber;
                             if (intValue == target.thingIDNumber)
                             {
                                 flag = true;
                             }
                         }
                     }
                 }
             }
             if (!flag)
             {
                 string text2 = string.Concat(new string[]
                 {
                     target.thingIDNumber.ToString(),
                     ";",
                     ticksGame.ToString(),
                     ";",
                     value ? "1" : "0"
                 });
                 GenCollection.AddDistinct <string>(list, text2);
             }
             pawnCamoData.PawnHidTickList = list;
         }
     }
 }
        // Token: 0x06000057 RID: 87 RVA: 0x00005FB0 File Offset: 0x000041B0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);
            if (!respawningAfterLoad || !(Props.ActiveCamoEff > 0f) || !(Props.CamoEnergyMax > 0f))
            {
                return;
            }

            Thing thingWithComps = parent;

            if (thingWithComps.GetType() != typeof(ActiveCamoApparel) &&
                thingWithComps.def.thingClass == typeof(ActiveCamoApparel) && thingWithComps.Spawned &&
                thingWithComps.Map != null)
            {
                PawnCamoData.CorrectActiveApparel(thingWithComps as Apparel);
            }
        }
Exemple #6
0
 // Token: 0x06000063 RID: 99 RVA: 0x0000650C File Offset: 0x0000470C
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     if (respawningAfterLoad)
     {
         Pawn pawn = this.Pawn;
         if ((pawn?.apparel) != null && this.Pawn.apparel.WornApparelCount > 0)
         {
             foreach (Apparel apparel in this.Pawn.apparel.WornApparel)
             {
                 CompGearCamo compGearCamo = ThingCompUtility.TryGetComp <CompGearCamo>(apparel);
                 if (compGearCamo != null && compGearCamo.Props.ActiveCamoEff > 0f && compGearCamo.Props.CamoEnergyMax > 0f && apparel.GetType() != typeof(ActiveCamoApparel) && apparel.def.thingClass == typeof(ActiveCamoApparel))
                 {
                     PawnCamoData.CorrectActiveApparel(apparel, this.Pawn);
                     break;
                 }
             }
         }
     }
     CamoGearUtility.CalcAndSetCamoEff(this.Pawn);
 }
        // Token: 0x06000037 RID: 55 RVA: 0x00003D60 File Offset: 0x00001F60
        internal static void CalcAndSetCamoEff(Pawn pawn)
        {
            float num;
            float num2;
            float num3;
            float num4;
            float num5;
            float num6;
            float num7;

            if (StealthyBox.IsWearingStealthBox(pawn, out Apparel apparel))
            {
                CompGearCamo compGearCamo = ThingCompUtility.TryGetComp <CompGearCamo>(apparel);
                if (compGearCamo != null)
                {
                    num  = compGearCamo.Props.ArcticCamoEff;
                    num2 = compGearCamo.Props.DesertCamoEff;
                    num3 = compGearCamo.Props.JungleCamoEff;
                    num4 = compGearCamo.Props.StoneCamoEff;
                    num5 = compGearCamo.Props.WoodlandCamoEff;
                    num6 = compGearCamo.Props.UrbanCamoEff;
                    num7 = (compGearCamo.Props.ArcticCamoEff + compGearCamo.Props.DesertCamoEff + compGearCamo.Props.JungleCamoEff + compGearCamo.Props.StoneCamoEff + compGearCamo.Props.WoodlandCamoEff + compGearCamo.Props.UrbanCamoEff) / 6f;
                }
                else
                {
                    num  = 1f;
                    num2 = 1f;
                    num3 = 1f;
                    num4 = 1f;
                    num5 = 1f;
                    num6 = 1f;
                    num7 = 1f;
                }
            }
            else
            {
                CamoGearUtility.WearingCamoGear(pawn, out float num8, out float num9, out float num10, out float num11, out float num12, out float num13, out float num14);
                num  = num8;
                num2 = num9;
                num3 = num10;
                num4 = num11;
                num5 = num12;
                num6 = num13;
                num7 = num14;
            }
            float        pawnArcticCamo     = num;
            float        pawnDesertCamo     = num2;
            float        pawnJungleCamo     = num3;
            float        pawnStoneCamo      = num4;
            float        pawnWoodlandCamo   = num5;
            float        pawnUrbanCamo      = num6;
            float        pawnnotDefinedCamo = num7;
            PawnCamoData pawnCamoData       = ThingCompUtility.TryGetComp <PawnCamoData>(pawn);

            if (pawnCamoData != null)
            {
                pawnCamoData.PawnArcticCamo     = pawnArcticCamo;
                pawnCamoData.PawnDesertCamo     = pawnDesertCamo;
                pawnCamoData.PawnJungleCamo     = pawnJungleCamo;
                pawnCamoData.PawnStoneCamo      = pawnStoneCamo;
                pawnCamoData.PawnWoodlandCamo   = pawnWoodlandCamo;
                pawnCamoData.PawnUrbanCamo      = pawnUrbanCamo;
                pawnCamoData.PawnnotDefinedCamo = pawnnotDefinedCamo;
            }
        }