2 using System.Collections.Generic;
16 private readonly
float commonness;
19 get {
return commonness; }
23 : base(file, element.GetAttributeIdentifier(
"identifier", element.GetAttributeIdentifier(
"name",
Identifier.Empty)))
25 string name = element.GetAttributeString(
"name",
null);
35 AllowedDialogTags =
new List<string>(element.GetAttributeStringArray(
"alloweddialogtags", Array.Empty<
string>()));
36 commonness = element.GetAttributeFloat(
"commonness", 1.0f);
41 var rand =
new MTRandom(ToolBox.StringToInt(seed));
42 return ToolBox.SelectWeightedRandom(
Traits.OrderBy(t => t.UintIdentifier), t => t.commonness, rand);
LocalizedString Fallback(LocalizedString fallback, bool useDefaultLanguageIfFound=true)
Use this text instead if the original text cannot be found.
Mersenne Twister based random
readonly List< string > AllowedDialogTags
static readonly PrefabCollection< NPCPersonalityTrait > Traits
NPCPersonalityTrait(XElement element, NPCPersonalityTraitsFile file)
readonly LocalizedString DisplayName
static NPCPersonalityTrait GetRandom(string seed)
readonly Identifier Identifier
Prefab that has a property serves as a deterministic hash of a prefab's identifier....