예제 #1
0
 public static List <JoyKindDef> JoyKindsOnMapTempList(Map map)
 {
     for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++)
     {
         JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i];
         if (!joyKindDef.needsThing)
         {
             JoyUtility.tempKindList.Add(joyKindDef);
         }
     }
     foreach (Thing current in JoyUtility.JoySourceBuildings(map))
     {
         if (!JoyUtility.tempKindList.Contains(current.def.building.joyKind))
         {
             JoyUtility.tempKindList.Add(current.def.building.joyKind);
         }
     }
     foreach (Thing current2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug))
     {
         if (current2.def.IsIngestible && current2.def.ingestible.joyKind != null && !JoyUtility.tempKindList.Contains(current2.def.ingestible.joyKind) && !current2.Position.Fogged(map))
         {
             JoyUtility.tempKindList.Add(current2.def.ingestible.joyKind);
         }
     }
     foreach (Thing current3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree))
     {
         if (current3.def.IsIngestible && current3.def.ingestible.joyKind != null && !JoyUtility.tempKindList.Contains(current3.def.ingestible.joyKind) && !current3.Position.Fogged(map))
         {
             JoyUtility.tempKindList.Add(current3.def.ingestible.joyKind);
         }
     }
     return(JoyUtility.tempKindList);
 }
예제 #2
0
        public string TolerancesString()
        {
            StringBuilder     stringBuilder         = new StringBuilder();
            List <JoyKindDef> allDefsListForReading = DefDatabase <JoyKindDef> .AllDefsListForReading;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                JoyKindDef joyKindDef = allDefsListForReading[i];
                float      num        = tolerances[joyKindDef];
                if (num > 0.01f)
                {
                    if (stringBuilder.Length == 0)
                    {
                        stringBuilder.AppendLine("JoyTolerances".Translate() + ":");
                    }
                    string text = "   " + joyKindDef.LabelCap + ": " + num.ToStringPercent();
                    if (bored[joyKindDef])
                    {
                        text = text + " (" + "bored".Translate() + ")";
                    }
                    stringBuilder.AppendLine(text);
                }
            }
            return(stringBuilder.ToString().TrimEndNewlines());
        }
예제 #3
0
        public static string JoyKindsOnMapString(Map map)
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++)
            {
                JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i];
                if (!joyKindDef.needsThing)
                {
                    JoyUtility.CheckAppendJoyKind(stringBuilder, null, joyKindDef, map);
                }
            }
            foreach (Thing current in JoyUtility.JoySourceBuildings(map))
            {
                JoyUtility.CheckAppendJoyKind(stringBuilder, current, current.def.building.joyKind, map);
            }
            foreach (Thing current2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug))
            {
                if (current2.def.IsIngestible && current2.def.ingestible.joyKind != null)
                {
                    JoyUtility.CheckAppendJoyKind(stringBuilder, current2, current2.def.ingestible.joyKind, map);
                }
            }
            foreach (Thing current3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree))
            {
                if (current3.def.IsIngestible && current3.def.ingestible.joyKind != null)
                {
                    JoyUtility.CheckAppendJoyKind(stringBuilder, current3, current3.def.ingestible.joyKind, map);
                }
            }
            JoyUtility.listedJoyKinds.Clear();
            return(stringBuilder.ToString().TrimEndNewlines());
        }
예제 #4
0
 private static void CheckAppendJoyKind(StringBuilder sb, Thing t, JoyKindDef kind, Map map)
 {
     if (JoyUtility.listedJoyKinds.Contains(kind))
     {
         return;
     }
     if (t == null)
     {
         sb.AppendLine("   " + kind.LabelCap);
     }
     else
     {
         if (t.def.category == ThingCategory.Item && t.Position.Fogged(map))
         {
             return;
         }
         sb.AppendLine(string.Concat(new string[]
         {
             "   ",
             kind.LabelCap,
             " (",
             t.def.label,
             ")"
         }));
     }
     JoyUtility.listedJoyKinds.Add(kind);
 }
예제 #5
0
 public static List <JoyKindDef> JoyKindsOnMapTempList(Map map)
 {
     for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++)
     {
         JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i];
         if (!joyKindDef.needsThing)
         {
             tempKindList.Add(joyKindDef);
         }
     }
     foreach (Building item in map.listerBuildings.allBuildingsColonist)
     {
         if (item.def.building.joyKind != null && !tempKindList.Contains(item.def.building.joyKind))
         {
             tempKindList.Add(item.def.building.joyKind);
         }
     }
     foreach (Thing item2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug))
     {
         if (item2.def.IsIngestible && item2.def.ingestible.joyKind != null && !tempKindList.Contains(item2.def.ingestible.joyKind) && !item2.Position.Fogged(map))
         {
             tempKindList.Add(item2.def.ingestible.joyKind);
         }
     }
     foreach (Thing item3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree))
     {
         if (item3.def.IsIngestible && item3.def.ingestible.joyKind != null && !tempKindList.Contains(item3.def.ingestible.joyKind) && !item3.Position.Fogged(map))
         {
             tempKindList.Add(item3.def.ingestible.joyKind);
         }
     }
     return(tempKindList);
 }
예제 #6
0
        public static string JoyKindsNotOnMapString(Map map)
        {
            List <JoyKindDef> allDefsListForReading = DefDatabase <JoyKindDef> .AllDefsListForReading;
            List <JoyKindDef> list = JoyUtility.JoyKindsOnMapTempList(map);
            string            result;

            if (allDefsListForReading.Count == list.Count)
            {
                result = "(" + "None".Translate() + ")";
            }
            else
            {
                string text = "";
                for (int i = 0; i < allDefsListForReading.Count; i++)
                {
                    JoyKindDef joyKindDef = allDefsListForReading[i];
                    if (!list.Contains(joyKindDef))
                    {
                        text = text + "   " + joyKindDef.LabelCap + "\n";
                    }
                }
                list.Clear();
                result = text.TrimEndNewlines();
            }
            return(result);
        }
예제 #7
0
 public float this[JoyKindDef d]
 {
     get
     {
         return(tolerances[d]);
     }
 }
예제 #8
0
 public bool JoyKindDisabled(JoyKindDef joyKind)
 {
     if (disabledJoyKinds == null)
     {
         return(false);
     }
     return(disabledJoyKinds.Contains(joyKind));
 }
예제 #9
0
        public void Notify_JoyGained(float amount, JoyKindDef joyKind)
        {
            float num = Mathf.Min(tolerances[joyKind] + amount * 0.65f, 1f);

            tolerances[joyKind] = num;
            if (num > 0.5f)
            {
                bored[joyKind] = true;
            }
        }
예제 #10
0
 public void GainJoy(float amount, JoyKindDef joyKind)
 {
     if (!(amount <= 0f))
     {
         amount      *= tolerances.JoyFactorFromTolerance(joyKind);
         amount       = Mathf.Min(amount, 1f - CurLevel);
         curLevelInt += amount;
         if (joyKind != null)
         {
             tolerances.Notify_JoyGained(amount, joyKind);
         }
         lastGainTick = Find.TickManager.TicksGame;
     }
 }
예제 #11
0
 public void GainJoy(float amount, JoyKindDef joyKind)
 {
     if (amount <= 0f)
     {
         return;
     }
     amount           *= this.tolerances.JoyFactorFromTolerance(joyKind);
     amount            = Mathf.Min(amount, 1f - this.CurLevel);
     this.curLevelInt += amount;
     if (joyKind != null)
     {
         this.tolerances.Notify_JoyGained(amount, joyKind);
     }
     this.lastGainTick = Find.TickManager.TicksGame;
 }
예제 #12
0
        public string TolerancesString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("\n" + "JoyTolerances".Translate() + ":");
            List <JoyKindDef> allDefsListForReading = DefDatabase <JoyKindDef> .AllDefsListForReading;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                JoyKindDef joyKindDef = allDefsListForReading[i];
                float      num        = this.tolerances[joyKindDef];
                if (num > 0.0099999997764825821)
                {
                    stringBuilder.AppendLine("   -" + joyKindDef.label + ": " + num.ToStringPercent());
                }
            }
            return(stringBuilder.ToString());
        }
예제 #13
0
 public void GainJoy(float amount, JoyKindDef joyKind)
 {
     if (joyKind == null)
     {
         Log.Error("No joyKind!");
     }
     else
     {
         amount *= this.tolerances.JoyFactorFromTolerance(joyKind);
     }
     amount            = Mathf.Min(amount, (float)(1.0 - this.CurLevel));
     base.curLevelInt += amount;
     if (joyKind != null)
     {
         this.tolerances.Notify_JoyGained(amount, joyKind);
     }
     this.lastGainTick = Find.TickManager.TicksGame;
 }
예제 #14
0
 private static void CheckAppendJoyKind(StringBuilder sb, Thing t, JoyKindDef kind, Map map)
 {
     if (!listedJoyKinds.Contains(kind))
     {
         if (t == null)
         {
             sb.AppendLine("   " + kind.LabelCap);
         }
         else
         {
             if (t.def.category == ThingCategory.Item && t.Position.Fogged(map))
             {
                 return;
             }
             sb.AppendLine("   " + kind.LabelCap + " (" + t.def.label + ")");
         }
         listedJoyKinds.Add(kind);
     }
 }
예제 #15
0
        public static string JoyKindsOnMapString(Map map)
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < DefDatabase <JoyKindDef> .AllDefsListForReading.Count; i++)
            {
                JoyKindDef joyKindDef = DefDatabase <JoyKindDef> .AllDefsListForReading[i];
                if (!joyKindDef.needsThing)
                {
                    CheckAppendJoyKind(stringBuilder, null, joyKindDef, map);
                }
            }
            foreach (Building item in map.listerBuildings.allBuildingsColonist)
            {
                if (item.def.building.joyKind != null)
                {
                    CheckAppendJoyKind(stringBuilder, item, item.def.building.joyKind, map);
                }
            }
            foreach (Thing item2 in map.listerThings.ThingsInGroup(ThingRequestGroup.Drug))
            {
                if (item2.def.IsIngestible && item2.def.ingestible.joyKind != null)
                {
                    CheckAppendJoyKind(stringBuilder, item2, item2.def.ingestible.joyKind, map);
                }
            }
            foreach (Thing item3 in map.listerThings.ThingsInGroup(ThingRequestGroup.FoodSourceNotPlantOrTree))
            {
                if (item3.def.IsIngestible && item3.def.ingestible.joyKind != null)
                {
                    CheckAppendJoyKind(stringBuilder, item3, item3.def.ingestible.joyKind, map);
                }
            }
            listedJoyKinds.Clear();
            return(stringBuilder.ToString().TrimEndNewlines());
        }
예제 #16
0
 public void Notify_JoyGained(float amount, JoyKindDef joyKind)
 {
     this.tolerances[joyKind] = Mathf.Min(this.tolerances[joyKind] + amount * 0.4f, 1f);
 }
예제 #17
0
 public float JoyFactorFromTolerance(JoyKindDef joyKind)
 {
     return((float)(1.0 - this.tolerances[joyKind]));
 }
 public float this[JoyKindDef d] => tolerances[d];
예제 #19
0
 public float JoyFactorFromTolerance(JoyKindDef joyKind)
 {
     return(1f - tolerances[joyKind]);
 }
예제 #20
0
 public bool BoredOf(JoyKindDef def)
 {
     return(bored[def]);
 }
예제 #21
0
 public void Notify_JoyGained(float amount, JoyKindDef joyKind)
 {
     this.tolerances[joyKind] = Mathf.Min((float)(this.tolerances[joyKind] + amount * 0.40000000596046448), 1f);
 }