38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -11,31 +12,53 @@ namespace Barotrauma
|
||||
public readonly List<string> ItemNames;
|
||||
|
||||
public List<SkillPrefab> Skills;
|
||||
|
||||
[Serialize("1,1,1,1", false)]
|
||||
public Color UIColor
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//the number of these characters in the crew the player starts with
|
||||
public readonly int InitialCount;
|
||||
[Serialize("notfound", false)]
|
||||
public string Identifier
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize("notfound", false)]
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize("", false)]
|
||||
public string Description
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//the number of these characters in the crew the player starts with in the single player campaign
|
||||
[Serialize(0, false)]
|
||||
public int InitialCount
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//if set to true, a client that has chosen this as their preferred job will get it no matter what
|
||||
[Serialize(false, false)]
|
||||
public bool AllowAlways
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//how many crew members can have the job (only one captain etc)
|
||||
//how many crew members can have the job (only one captain etc)
|
||||
[Serialize(100, false)]
|
||||
public int MaxNumber
|
||||
{
|
||||
get;
|
||||
@@ -44,39 +67,46 @@ namespace Barotrauma
|
||||
|
||||
//how many crew members are REQUIRED to have the job
|
||||
//(i.e. if one captain is required, one captain is chosen even if all the players have set captain to lowest preference)
|
||||
[Serialize(0, false)]
|
||||
public int MinNumber
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(0.0f, false)]
|
||||
public float MinKarma
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(10.0f, false)]
|
||||
public float Commonness
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//how much the vitality of the character is increased/reduced from the default value
|
||||
[Serialize(0.0f, false)]
|
||||
public float VitalityModifier
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public XElement ClothingElement { get; private set; }
|
||||
|
||||
public JobPrefab(XElement element)
|
||||
{
|
||||
Name = element.GetAttributeString("name", "name not found");
|
||||
SerializableProperty.DeserializeProperties(this, element);
|
||||
|
||||
Description = element.GetAttributeString("description", "");
|
||||
string translatedName = TextManager.Get("JobName." + Identifier, true);
|
||||
if (!string.IsNullOrEmpty(translatedName)) Name = translatedName;
|
||||
|
||||
MinNumber = element.GetAttributeInt("minnumber", 0);
|
||||
MaxNumber = element.GetAttributeInt("maxnumber", 10);
|
||||
MinKarma = element.GetAttributeFloat("minkarma", 0.0f);
|
||||
|
||||
InitialCount = element.GetAttributeInt("initialcount", 0);
|
||||
|
||||
Commonness = element.GetAttributeInt("commonness", 10);
|
||||
|
||||
AllowAlways = element.GetAttributeBool("allowalways", false);
|
||||
string translatedDescription = TextManager.Get("JobDescription." + Identifier, true);
|
||||
if (!string.IsNullOrEmpty(translatedDescription)) Description = translatedDescription;
|
||||
|
||||
ItemNames = new List<string>();
|
||||
|
||||
@@ -90,8 +120,32 @@ namespace Barotrauma
|
||||
Items = subElement;
|
||||
foreach (XElement itemElement in subElement.Elements())
|
||||
{
|
||||
string itemName = itemElement.GetAttributeString("name", "");
|
||||
if (!string.IsNullOrWhiteSpace(itemName)) ItemNames.Add(itemName);
|
||||
if (itemElement.Element("name") != null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in job config \"" + Name + "\" - use identifiers instead of names to configure the items.");
|
||||
ItemNames.Add(itemElement.GetAttributeString("name", ""));
|
||||
continue;
|
||||
}
|
||||
|
||||
string itemIdentifier = itemElement.GetAttributeString("identifier", "");
|
||||
if (string.IsNullOrWhiteSpace(itemIdentifier))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in job config \"" + Name + "\" - item with no identifier.");
|
||||
ItemNames.Add("");
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefab = MapEntityPrefab.Find(null, itemIdentifier) as ItemPrefab;
|
||||
if (prefab == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in job config \"" + Name + "\" - item prefab \""+itemIdentifier+"\" not found.");
|
||||
ItemNames.Add("");
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemNames.Add(prefab.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "skills":
|
||||
@@ -104,6 +158,12 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Skills.Sort((x,y) => y.LevelRange.X.CompareTo(x.LevelRange.X));
|
||||
|
||||
ClothingElement = element.Element("PortraitClothing");
|
||||
if (ClothingElement == null)
|
||||
{
|
||||
ClothingElement = element.Element("portraitclothing");
|
||||
}
|
||||
}
|
||||
|
||||
public static JobPrefab Random()
|
||||
@@ -111,7 +171,7 @@ namespace Barotrauma
|
||||
return List[Rand.Int(List.Count)];
|
||||
}
|
||||
|
||||
public static void LoadAll(List<string> filePaths)
|
||||
public static void LoadAll(IEnumerable<string> filePaths)
|
||||
{
|
||||
List = new List<JobPrefab>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user