(77d1794a) Tester's build January 10th, 2020

This commit is contained in:
juanjp600
2020-01-10 14:42:38 -03:00
parent c02da46ef5
commit e6a08d715b
4529 changed files with 1145046 additions and 218950 deletions
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Barotrauma
{
class NPCPersonalityTrait
{
private static List<NPCPersonalityTrait> list = new List<NPCPersonalityTrait>();
public static List<NPCPersonalityTrait> List
{
get { return list; }
}
public readonly string FilePath;
public readonly string Name;
public readonly List<string> AllowedDialogTags;
private float commonness;
public float Commonness
{
get { return commonness; }
}
public NPCPersonalityTrait(XElement element, string filePath)
{
FilePath = filePath;
Name = element.GetAttributeString("name", "");
AllowedDialogTags = new List<string>(element.GetAttributeStringArray("alloweddialogtags", new string[0]));
commonness = element.GetAttributeFloat("commonness", 1.0f);
list.Add(this);
}
public static NPCPersonalityTrait GetRandom(string seed)
{
var rand = new MTRandom(ToolBox.StringToInt(seed));
return ToolBox.SelectWeightedRandom(list, list.Select(t => t.commonness).ToList(), rand);
}
}
}