private static void FormatValue(HasSkillNode hasSkillNode, out Color color, out String suffix) { Single playerValue = Game.World.Player.CharacterComponent.Character.Stats.GetSkill(hasSkillNode.skill); Int32 requiredValue = hasSkillNode.value; color = playerValue >= requiredValue ? Color.green : Color.red; suffix = $" {playerValue} / {requiredValue}{ColorTagEnd}"; }
private static void FormatSegments(HasSkillNode skillNode, out Color color) { Single playerValue = Game.World.Player.CharacterComponent.Character.Stats.GetSkill(skillNode.skill); Int32 requiredValue = skillNode.value; Int32 inaccuracy = Configuration.Dialog.DisplayChanceAbsoluteInaccuracy + Configuration.Dialog.DisplayChanceRelativeInaccuracy * requiredValue / 100; Int32 minValue = requiredValue - inaccuracy; Int32 maxValue = requiredValue + inaccuracy; if (playerValue < minValue) { color = Color.red; } else if (playerValue > maxValue) { color = Color.green; } else { color = Color.yellow; } }
private static void FormatChance(String ownerId, HasSkillNode skillNode, DialogChanceRepresentation displayChanceMode, out Color color, ref String suffix) { Single playerValue = Game.World.Player.CharacterComponent.Character.Stats.GetSkill(skillNode.skill); Int32 requiredValue = skillNode.value; Int32 inaccuracy = Configuration.Dialog.DisplayChanceAbsoluteInaccuracy + Configuration.Dialog.DisplayChanceRelativeInaccuracy * requiredValue / 100; // Randomize requiredValue += PersistentRandom.Get(ownerId, -inaccuracy / 2, inaccuracy / 2 + 1); Int32 minValue = requiredValue - inaccuracy; Int32 maxValue = requiredValue + inaccuracy; Single probability = Mathf.Clamp((playerValue - minValue) / (maxValue - minValue), 0, 1); color = probability < 0.5 ? new Color(1.0f, probability / 0.5f, 0.0f) : new Color(1.0f - (probability - 0.5f) / 0.75f, 1.0f, 0.0f); if (displayChanceMode == DialogChanceRepresentation.Percent) { Int32 percent = (Int32)(probability * 100); suffix = $" {percent}%{ColorTagEnd}"; } }