- Fixed clients using character directories to count the number of disallowed monsters, which made it possible for them to disallow incorrect monsters.

- Fixed MonsterEvent checking if the name of the character directory contains the name of the disallowed character directory, which could for example cause them to disallow "someMonsterAlt" if "someMonster" is disallowed.
This commit is contained in:
Joonas Rikkonen
2018-02-26 16:53:22 +02:00
parent 7f740c2f67
commit 1c68d5a4d7
2 changed files with 11 additions and 5 deletions
@@ -701,15 +701,16 @@ namespace Barotrauma.Networking
//monster spawn settings
if (monsterEnabled == null)
{
List<string> monsterNames1 = Directory.GetDirectories("Content/Characters").ToList();
List<string> monsterNames1 = GameMain.Config.SelectedContentPackage.GetFilesOfType(ContentType.Character);
for (int i = 0; i < monsterNames1.Count; i++)
{
monsterNames1[i] = monsterNames1[i].Replace("Content/Characters", "").Replace("/", "").Replace("\\", "");
monsterNames1[i] = Path.GetFileName(Path.GetDirectoryName(monsterNames1[i]));
}
monsterEnabled = new Dictionary<string, bool>();
foreach (string s in monsterNames1)
{
monsterEnabled.Add(s, true);
if (!monsterEnabled.ContainsKey(s)) monsterEnabled.Add(s, true);
}
}