public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { var pawn = req.Thing as Pawn; if (pawn == null || pawn.story == null) return 0; return stat.defaultBaseValue + pawn.skills.GetSkill(SkillDefOf.Social).level/8f; }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { var pawn = req.Thing as Pawn; if (pawn == null || pawn.story==null) return 0; var isAbrasive = pawn.story.traits.HasTrait(TraitDefOf.Abrasive); var abrasiveFactor = isAbrasive ? 0.5f : 1f; return 1 - abrasiveFactor*base.GetValueUnfinalized(req, applyPostProcess); }
public override string GetExplanation(StatRequest req, ToStringNumberSense numberSense) { if (!req.HasThing || !(req.Thing is Pawn)) return base.GetExplanation(req, numberSense); var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("StatsReport_BaseValue".Translate()); float statValueAbstract = stat.defaultBaseValue; stringBuilder.AppendLine(" " + stat.ValueToString(statValueAbstract, numberSense)); var pawn = req.Thing as Pawn; stringBuilder.AppendLine(); stringBuilder.AppendLine(string.Format("{0}: x{1} {2}", "StatsReport_CharacterQuality".Translate(), PriceUtility.PawnQualityPriceFactor(pawn).ToStringPercent(), -stat.defaultBaseValue)); return stringBuilder.ToString(); }
public override string GetExplanation(StatRequest req, ToStringNumberSense numberSense) { var stringBuilder = new StringBuilder(); stringBuilder.Append(base.GetExplanation(req, numberSense)); var pawn = req.Thing as Pawn; if (pawn == null || pawn.story == null) return stringBuilder.ToString(); var isAbrasive = pawn.story.traits.HasTrait(TraitDefOf.Abrasive); var abrasiveFactor = isAbrasive ? 0.5f : 1f; if (isAbrasive) { stringBuilder.AppendLine(); stringBuilder.AppendLine(string.Format(" {0}: x{1}", TraitDefOf.Abrasive.label.CapitalizeFirst(), abrasiveFactor.ToStringPercent())); } return stringBuilder.ToString(); }
public override string GetExplanation(StatRequest req, ToStringNumberSense numberSense) { if (!req.HasThing || !(req.Thing is Pawn)) return base.GetExplanation(req, numberSense); var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("StatsReport_BaseValue".Translate()); float statValueAbstract = stat.defaultBaseValue; stringBuilder.AppendLine(" " + stat.ValueToString(statValueAbstract, numberSense)); var pawn = req.Thing as Pawn; stringBuilder.AppendLine(); stringBuilder.AppendLine("StatsReport_Skills".Translate()); int level = pawn.skills.GetSkill(SkillDefOf.Social).level; stringBuilder.AppendLine(string.Format(" {0} ({1}): +{2}", SkillDefOf.Social.LabelCap, level, (level/8f).ToStringPercent())); return stringBuilder.ToString(); }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { // market value for crafted things if (req.HasThing) { var compCraftedValue = req.Thing?.TryGetComp<CompCraftedValue>(); if (compCraftedValue != null) { return compCraftedValue.marketValue != -1 ? compCraftedValue.marketValue : compCraftedValue.PredictMarketValue(); } } else if (Current.ProgramState != ProgramState.Entry) { var def = req.Def as ThingDef; var compProps = def?.CompDefFor<CompCraftedValue>() as CompCraftedValue_Properties; if (compProps != null) return CompCraftedValue.PredictBaseMarketValue(def, compProps); } return base.GetValueUnfinalized(req, applyPostProcess); }
// Token: 0x06003564 RID: 13668 RVA: 0x001237EE File Offset: 0x001219EE public override IEnumerable <StatDrawEntry> SpecialDisplayStats(ThingDef parentDef) { if (parentDef.IsDrug && this.chance >= 1f) { foreach (StatDrawEntry statDrawEntry in this.hediffDef.SpecialDisplayStats(StatRequest.ForEmpty())) { yield return(statDrawEntry); } IEnumerator <StatDrawEntry> enumerator = null; } yield break; yield break; }
public override bool ShouldShowFor(StatRequest req) => req.Def is ThingDef def && def.IsRangedWeapon && def.Verbs?[0]?.defaultProjectile != null &&
public override string GetStatDrawEntryLabel(StatDef stat, float value, ToStringNumberSense numberSense, StatRequest optionalReq, bool finalized = true) { Building_TurretGun turret = GetTurret(optionalReq); RangedWeaponStats weaponStats = GetTurretStats(optionalReq); int optimalRange = (int)weaponStats.FindOptimalRange(turret); return(string.Format("{0} ({1})", value.ToStringByStyle(stat.toStringStyle, numberSense), string.Format("StatsReport_RangedDPSOptimalRange".Translate(), optimalRange))); }
public override IEnumerable <Dialog_InfoCard.Hyperlink> GetInfoCardHyperlinks(StatRequest statRequest) { yield return(new Dialog_InfoCard.Hyperlink()); }
public override bool ShouldShowFor(StatRequest req) { return(base.ShouldShowFor(req) || !Settings.CombatStore.RangedCooldownEffectsEnabled.Value); }
public override string GetStatDrawEntryLabel(StatDef statDef, float value, ToStringNumberSense numberSense, StatRequest optionalReq, bool finalized = true) { return($"x{GetValueUnfinalized(optionalReq).ToStringPercent()}"); }
public override void TransformValue(StatRequest req, ref float val) { this.TransformValue(req, ref val, StatDefOf.Beauty); }
private static void DrawStatRows(List <StatDef> stats, List <TSPWQuality> pairs, Rect startRect, int from, int to, out float rollingY, List <List <StatDrawInfo> > listHolder = null, bool specialStats = false) { float startX = startRect.x; for (int i = 0; i < stats.Count; i++) { List <StatDrawInfo> statInfoList = new List <StatDrawInfo>(); if (!specialStats) { statInfoList = new List <StatDrawInfo>(); // Retrieve stat value and create a view model, StatDrawInfo, for drawing. for (int j = from; j < to && j < pairs.Count; j++) { TSPWQuality pair = pairs[j]; StatDrawInfo drawInfo = new StatDrawInfo(); Thing tempThing = pair.MakeThingWithoutID(); StatRequest statRequest = StatRequest.For(tempThing); if ((stats[i].Worker.ShouldShowFor(statRequest) && !stats[i].Worker.IsDisabledFor(tempThing)) || stats[i] == StatDefOf.MaxHitPoints || stats[i] == StatDefOf.MeleeWeapon_CooldownMultiplier) { drawInfo.StatRequest = statRequest; drawInfo.Value = GetCachedValue(_statCache, () => stats[i].Worker.GetValue(drawInfo.StatRequest), pair, stats[i]); drawInfo.Tip = GetCachedValue(_statTipCache, () => stats[i].Worker.GetExplanationFull(drawInfo.StatRequest, stats[i].toStringNumberSense, drawInfo.Value), pair, stats[i]); } else { drawInfo.Value = -1; drawInfo.Tip = string.Empty; } statInfoList.Add(drawInfo); } if (statInfoList.Count > 1) { // Highlight highest stat value. List <StatDrawInfo> orderedList = statInfoList.OrderByDescending(t => t.Value).ToList(); foreach (StatDrawInfo statDrawInfo in orderedList) { if (statDrawInfo.Value == orderedList[0].Value) { statDrawInfo.Color = Color.green; } } } } else { statInfoList = listHolder[i]; } #pragma warning disable SA1118 // Parameter should not span multiple lines // Draw stat for each stuff choice. Text.Anchor = TextAnchor.MiddleCenter; foreach (StatDrawInfo info in statInfoList) { GUI.color = info.Color; Widgets.Label( startRect, specialStats ? info.ValueString : info.Value == -1 ? "-" : stats[i].Worker.ValueToString(info.Value, true, stats[i].toStringNumberSense)); Widgets.DrawHighlightIfMouseover(startRect); Text.Anchor = TextAnchor.MiddleLeft; TooltipHandler.TipRegion(startRect, info.Tip); Text.Anchor = TextAnchor.MiddleCenter; startRect = startRect.ReplaceX(startRect.xMax); } #pragma warning restore SA1118 // Parameter should not span multiple lines startRect = new Rect(startX, startRect.yMax, startRect.width, startRect.height); } rollingY = startRect.y; Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; }
protected static RangedWeaponStats GetTurretStats(StatRequest req) { return(GetTurretStats(GetTurret(req))); }
protected static Thing GetTurretWeapon(StatRequest req) { return(GetTurret(req).gun); }
public static string UpgradeReadoutReportText(StatRequest req) { var tDef = (ThingDef)req.Def; var upgradeProps = tDef.GetCompProperties <CompProperties_Upgradable>(); // First paragraph var reportBuilder = new StringBuilder(); reportBuilder.AppendLine("TurretExtensions.TurretUpgradeBenefitsMain".Translate()); reportBuilder.AppendLine(); // Upgradable if (upgradeProps != null) { var upgradeComp = req.Thing?.TryGetComp <CompUpgradable>(); var extensionValues = TurretFrameworkExtension.Get(tDef); var defaultStuff = GenStuff.DefaultStuffFor(tDef); var hasThing = req.HasThing; // Description reportBuilder.AppendLine($"{"Description".Translate()}: {upgradeProps.description}"); // Resource requirements if (upgradeProps.costStuffCount > 0 || !upgradeProps.costList.NullOrEmpty()) { reportBuilder.AppendLine(); reportBuilder.AppendLine($"{"TurretExtensions.TurretResourceRequirements".Translate()}:"); var usedCostList = upgradeComp != null ? upgradeComp.finalCostList : upgradeProps.costList; foreach (var curCost in usedCostList) { reportBuilder.AppendLine($"- {curCost.count}x {curCost.thingDef.LabelCap}"); } if (!hasThing && upgradeProps.costStuffCount > 0) { reportBuilder.AppendLine($"- {upgradeProps.costStuffCount}x {"StatsReport_Material".Translate()}"); } } // Construction skill requirement if (upgradeProps.constructionSkillPrerequisite > 0) { reportBuilder.AppendLine(); reportBuilder.AppendLine($"{"ConstructionNeeded".Translate()}: {upgradeProps.constructionSkillPrerequisite}"); } // Research requirements if (!upgradeProps.researchPrerequisites.NullOrEmpty()) { reportBuilder.AppendLine(); reportBuilder.AppendLine($"{"ResearchPrerequisites".Translate()}:"); foreach (var rpd in upgradeProps.researchPrerequisites) { reportBuilder.AppendLine($"- {rpd.LabelCap}"); } } // Upgrade bonuses reportBuilder.AppendLine(); reportBuilder.AppendLine($"{"TurretExtensions.TurretUpgradeBenefitsUpgradable".Translate()}:"); // Weapon if (upgradeProps.turretGunDef != null) { reportBuilder.AppendLine($"- {"Stat_Weapon_Name".Translate()}: {tDef.building.turretGunDef.LabelCap} => {upgradeProps.turretGunDef.LabelCap}"); } // Stat modifiers var statsModified = new List <StatDef>(); if (!upgradeProps.statOffsets.NullOrEmpty()) { statsModified.AddRange(upgradeProps.statOffsets.Select(s => s.stat)); } if (!upgradeProps.statFactors.NullOrEmpty()) { statsModified.AddRange(upgradeProps.statFactors.Select(s => s.stat)); } if (statsModified.Any()) { statsModified = statsModified.Distinct().ToList(); statsModified.SortBy(s => s.LabelCap.RawText); foreach (var curStat in statsModified) { var stringStyle = curStat.toStringStyle; var numberSense = curStat.toStringNumberSense; var preStatValue = hasThing ? req.Thing.GetStatValue(curStat) : tDef.GetStatValueAbstract(curStat, defaultStuff); var postStatValue = preStatValue; if (upgradeProps.statOffsets?.StatListContains(curStat) == true) { postStatValue += upgradeProps.statOffsets.GetStatOffsetFromList(curStat); } if (upgradeProps.statFactors?.StatListContains(curStat) == true) { postStatValue *= upgradeProps.statFactors.GetStatFactorFromList(curStat); } reportBuilder.AppendLine( $"- {curStat.LabelCap}: {preStatValue.ToStringByStyle(stringStyle, numberSense)} => {postStatValue.ToStringByStyle(stringStyle, numberSense)}"); } } // Fuel capacity if (upgradeProps.fuelCapacityFactor != 1 && tDef.GetCompProperties <CompProperties_Refuelable>() is CompProperties_Refuelable refuelProps) { reportBuilder.AppendLine( $"- {refuelProps.FuelGizmoLabel}: {refuelProps.fuelCapacity} => {Mathf.Round(refuelProps.fuelCapacity * upgradeProps.fuelCapacityFactor)}"); } // Power consumption if (upgradeProps.basePowerConsumptionFactor != 1 && tDef.GetCompProperties <CompProperties_Power>() is CompProperties_Power powerProps) { reportBuilder.AppendLine($"- {"PowerConsumption".Translate()}: {powerProps.basePowerConsumption.ToString("F0")} =>" + $" {Mathf.Round(powerProps.basePowerConsumption * upgradeProps.basePowerConsumptionFactor)}"); } // Warmup if (upgradeProps.turretBurstWarmupTimeFactor != 1) { reportBuilder.AppendLine( $"- {"WarmupTime".Translate()}: {upgradeProps.turretBurstWarmupTimeFactor.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Factor)}"); } // Cooldown if (upgradeProps.turretBurstCooldownTimeFactor != 1) { reportBuilder.AppendLine( $"- {"StatsReport_Cooldown".Translate()}: {upgradeProps.turretBurstCooldownTimeFactor.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Factor)}"); } // Firing arc if (upgradeProps.FiringArc != extensionValues.FiringArc) { reportBuilder.AppendLine( $"- {"TurretExtensions.FiringArc".Translate()}: {extensionValues.FiringArc.ToStringDegrees()} => {upgradeProps.FiringArc.ToStringDegrees()}"); } // User accuracy modifier if ((extensionValues.manningPawnShootingAccuracyOffset != 0 || upgradeProps.manningPawnShootingAccuracyOffset != 0) && tDef.HasComp(typeof(CompMannable))) { reportBuilder.AppendLine($"- {"TurretExtensions.UserShootingAccuracyModifier".Translate()}: " + $"{extensionValues.manningPawnShootingAccuracyOffset.ToStringByStyle(ToStringStyle.FloatOne, ToStringNumberSense.Offset)} => " + $"{upgradeProps.manningPawnShootingAccuracyOffset.ToStringByStyle(ToStringStyle.FloatOne, ToStringNumberSense.Offset)}"); } // Manually controllable if (extensionValues.canForceAttack != upgradeProps.canForceAttack && !tDef.HasComp(typeof(CompMannable))) { reportBuilder.AppendLine(upgradeProps.canForceAttack.Value ? $"- {"TurretExtensions.TurretManuallyControllable".Translate()}" : $"- {"TurretExtensions.TurretNotManuallyControllable".Translate()}"); } } // Not upgradable :( else { reportBuilder.AppendLine("TurretExtensions.TurretUpgradeBenefitsNotUpgradable".Translate()); } // Return report text return(reportBuilder.ToString()); }
public override string GetStatDrawEntryLabel(StatDef stat, float value, ToStringNumberSense numberSense, StatRequest optionalReq) { return((optionalReq.Def as ThingDef)?.GetCompProperties <CompProperties_AmmoUser>().ammoSet.LabelCap); }
public override bool ShouldShowFor(StatRequest req) { return(base.ShouldShowFor(req) && req.Thing?.TryGetComp <CompAmmoUser>()?.Props.ammoSet != null); }
//private static void NamedPipeDataTransfer(StatRequest request) //{ // Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); // NamedPipeClientStream namedPipeClient = null; // Datacontext _dataContext = Datacontext.GetInstance(); // bool sendData = true; // try // { // if (request == StatRequest.Show || request == StatRequest.Open) // { // var statprocess = Process.GetProcessesByName("StatTickerFive"); // if (statprocess == null || statprocess.Length == 0 || (statprocess != null && statprocess.Length != 0 && !statprocess.Any(x => x.Id.ToString().Trim().Contains(_dataContext.StatProcessId.ToString())))) // { // string[] args = { "UserName:"******"Password:"******"AppName:" + _dataContext.ApplicationName, // "Host:" + (string.IsNullOrEmpty(_dataContext.HostNameSelectedValue) ? _dataContext.HostNameText : _dataContext.HostNameSelectedValue), // "Port:" + (string.IsNullOrEmpty(_dataContext.PortSelectedValue) ? _dataContext.PortText : _dataContext.PortSelectedValue), // "Place:" + _dataContext.Place }; // var statProcess = Process.Start(Environment.CurrentDirectory + @"\StatTickerFive.exe", string.Join(",", args)); // //var statProcess = Process.Start(@"C:\Program Files\Pointel Inc.,\Agent Interaction Desktop V5.0.3.11\StatTickerFive.exe", string.Join(",", args)); // _dataContext.StatProcessId = statProcess.Id; // sendData = false; // } // } // if (sendData) // { // namedPipeClient = new NamedPipeClientStream(".", "AIDPipe_" + _dataContext.UserName, PipeDirection.Out, PipeOptions.Asynchronous); // namedPipeClient.Connect(1000); // if (namedPipeClient.IsConnected) // { // byte[] msgBuff = System.Text.Encoding.UTF8.GetBytes(((int)request).ToString()); // namedPipeClient.Write(msgBuff, 0, msgBuff.Length); // namedPipeClient.Flush(); // namedPipeClient.Close(); // namedPipeClient.Dispose(); // } // } // } // catch (Exception generalException) // { // //System.Windows.MessageBox.Show("Stat Request : " + request.ToString() + "Error occurred as " + generalException.Message); // logger.Error("Error occurred as " + generalException.Message); // } // finally // { // if (namedPipeClient != null) // { // if (namedPipeClient.IsConnected) // { // namedPipeClient.Close(); // } // namedPipeClient.Dispose(); // namedPipeClient = null; // } // logger = null; // } //} private static void NamedPipeDataTransfer(StatRequest request) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); NamedPipeClientStream namedPipeClient = null; Datacontext _dataContext = Datacontext.GetInstance(); bool sendData = true; try { if (request == StatRequest.Show || request == StatRequest.Open) { var statprocess = Process.GetProcessesByName("StatTickerFive"); if (statprocess == null || statprocess.Length == 0 || (statprocess != null && statprocess.Length != 0 && !statprocess.Any(x => x.Id.ToString().Trim().Contains(_dataContext.StatProcessId.ToString())))) { //string isGadgetShow = "true"; //if (request == StatRequest.QueueConfig) // isGadgetShow = "false"; string[] args = { "UserName:"******"Password:"******"AppName:" + _dataContext.ApplicationName, "Host:" + (string.IsNullOrEmpty(_dataContext.HostNameSelectedValue) ? _dataContext.HostNameText : _dataContext.HostNameSelectedValue), "Port:" + (string.IsNullOrEmpty(_dataContext.PortSelectedValue) ? _dataContext.PortText : _dataContext.PortSelectedValue), "Place:" + _dataContext.Place, "AddpServerTimeOut:" + 0, "AddpClientTimeOut:" + 0, "IsConfigQueue:" + false, "IsGadgetShow:" + true }; var statProcess = Process.Start(Environment.CurrentDirectory + @"\StatTickerFive.exe", string.Join(",", args)); //var statProcess = Process.Start(@"C:\Program Files\Pointel Inc.,\Agent Interaction Desktop V5.0.3.11\StatTickerFive.exe", string.Join(",", args)); _dataContext.StatProcessId = statProcess.Id; sendData = false; } } if (sendData) { namedPipeClient = new NamedPipeClientStream(".", "AIDPipe_" + _dataContext.UserName, PipeDirection.Out, PipeOptions.Asynchronous); namedPipeClient.Connect(); if (namedPipeClient.IsConnected) { byte[] msgBuff = System.Text.Encoding.UTF8.GetBytes(((int)request).ToString()); namedPipeClient.Write(msgBuff, 0, msgBuff.Length); namedPipeClient.Flush(); namedPipeClient.Close(); namedPipeClient.Dispose(); } } } catch (Exception generalException) { //System.Windows.MessageBox.Show("Stat Request : " + request.ToString() + "Error occurred as " + generalException.Message); logger.Error("Error occurred as " + generalException.Message); } finally { //if (namedPipeClient != null) //{ // if (namedPipeClient.IsConnected) // { // namedPipeClient.Close(); // } // namedPipeClient.Dispose(); // namedPipeClient = null; //} logger = null; } }
public override string ExplanationPart(StatRequest req) { return(ExplanationPart(req, StatDefOf.MaxHitPoints)); }
public override void FinalizeValue(StatRequest req, ref float val, bool applyPostProcess) { base.FinalizeValue(req, ref val, applyPostProcess); }
public override void TransformValue(StatRequest req, ref float val) { this.TransformValue(req, ref val, StatDefOf.MaxHitPoints); }
public override string GetStatDrawEntryLabel(StatDef stat, float value, ToStringNumberSense numberSense, StatRequest optionalReq, bool finalized = true) { return(new SEB("StatsReport_RWHS", "TemperaturePerSecond").ValueNoFormat(GetValueUnfinalized(optionalReq).ToString("0.###")).ToString()); }
public override string ExplanationPart(StatRequest req) { return(ExplanationPart(req, StatDefOf.Beauty)); }
static void Postfix(Verse.Corpse __instance, ref IEnumerable <StatDrawEntry> __result) { // Create a modifyable list List <StatDrawEntry> NewList = new List <StatDrawEntry>(); // copy vanilla entries into the new list foreach (StatDrawEntry entry in __result) { // it's possible to discard entries here if needed NewList.Add(entry); } // custom code to modify list contents // add vanilla leather line just to verify that output is modified StatDef BoneAmount = DefDatabase <StatDef> .GetNamed("BoneAmount", true); float pawnBoneCount = __instance.InnerPawn.GetStatValue(BoneAmount, true) * BoneModSettings.boneFactor; NewList.Add(new StatDrawEntry(BoneAmount.category, BoneAmount, pawnBoneCount, StatRequest.For(__instance.InnerPawn), ToStringNumberSense.Undefined)); // convert list to IEnumerable to match the caller's expectations IEnumerable <StatDrawEntry> output = NewList; // make caller use the list __result = output; }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { var pawn = (Pawn)req.Thing; return(pawn.HealthScale * HealthScaleFactor); }
public StatRequestModel(StatRequest statRequest, bool applyPostProcess, StatDef stat) { StatRequest = statRequest; ApplyPostProcess = applyPostProcess; Stat = stat; }
public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) { var pawn = (Pawn)req.Thing; return($"Health scale: {pawn.HealthScale} x {HealthScaleFactor}"); }
private void DrawForagedFoodPerDay(Rect rect, TransferableOneWay trad) { if (!trad.HasAnyThing) { return; } if (!(trad.AnyThing is Pawn p)) { return; } float foragedNutritionPerDay = ForagedFoodPerDayCalculator.GetBaseForagedNutritionPerDay(p, out bool flag); if (flag) { return; } Widgets.DrawHighlightIfMouseover(rect); GUI.color = ((foragedNutritionPerDay == 0f) ? Color.gray : Color.green); Widgets.Label(rect, "+" + foragedNutritionPerDay.ToString("0.##")); GUI.color = Color.white; if (Mouse.IsOver(rect)) { TooltipHandler.TipRegion(rect, () => "NutritionForagedPerDayTip".Translate(StatDefOf.ForagedNutritionPerDay.Worker.GetExplanationFull(StatRequest.For(p), StatDefOf.ForagedNutritionPerDay.toStringNumberSense, foragedNutritionPerDay)), trad.GetHashCode() ^ 1958671422); } }
protected abstract new float GetBaseValueFor(StatRequest req);
public static StatRequest For(ToolType toolType, ThingDef stuffDef, QualityCategory quality = QualityCategory.Normal) { return(StatRequest.ForEmpty()); }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { var factor = req.HasThing && req.Thing is Pawn ? PriceUtility.PawnQualityPriceFactor((Pawn) req.Thing) : 0; return factor*stat.defaultBaseValue+-stat.defaultBaseValue; }
public override string GetStatDrawEntryLabel(StatDef stat, float value, ToStringNumberSense numberSense, StatRequest optionalReq) { var skilledDamageVariationMin = damageVariationMin; var skilledDamageVariationMax = damageVariationMax; if (optionalReq.Thing?.ParentHolder is Pawn_EquipmentTracker tracker) { skilledDamageVariationMin = GetDamageVariationMin(tracker.pawn); skilledDamageVariationMax = GetDamageVariationMax(tracker.pawn); } var tools = (optionalReq.Def as ThingDef)?.tools; if (tools.NullOrEmpty()) { return(""); } if (tools.Any(x => !(x is ToolCE))) { Log.Error($"Trying to get stat MeleeDamage from {optionalReq.Def.defName} which has no support for Combat Extended."); return(""); } float lowestDamage = Int32.MaxValue; float highestDamage = 0f; foreach (ToolCE tool in tools) { var toolDamage = GetAdjustedDamage(tool, optionalReq.Thing); if (toolDamage > highestDamage) { highestDamage = toolDamage; } if (toolDamage < lowestDamage) { lowestDamage = toolDamage; } } return((lowestDamage * skilledDamageVariationMin).ToStringByStyle(ToStringStyle.FloatMaxTwo) + " - " + (highestDamage * skilledDamageVariationMax).ToStringByStyle(ToStringStyle.FloatMaxTwo)); }
public virtual IEnumerable <StatDrawEntry> SpecialDisplayStats(StatRequest req) { yield break; }
public override bool ShouldShowFor(StatRequest req) { return(base.ShouldShowFor(req) && req.Thing is Pawn); }
public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) { return(string.Empty); }