I did exactly as this guide said, but server.exe crashes instantly when I try to run it.
Error report:
db.data.Descriptors.cs (lines 581-611):
Code:
public TileDesc(XElement elem)
{
CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
ci.NumberFormat.CurrencyDecimalSeparator = ".";
XElement n;
ObjectType = (short)Utils.FromString(elem.Attribute("type").Value);
ObjectId = elem.Attribute("id").Value;
NoWalk = elem.Element("NoWalk") != null;
if ((n = elem.Element("MinDamage")) != null)
{
MinDamage = Utils.FromString(n.Value);
Damaging = true;
}
if ((n = elem.Element("MaxDamage")) != null)
{
MaxDamage = Utils.FromString(n.Value);
Damaging = true;
}
if ((n = elem.Element("Speed")) != null)
Speed = float.Parse(n.Value); //line 600
Push = elem.Element("Push") != null;
if (Push)
{
var anim = elem.Element("Animate");
if (anim.Attribute("dx") != null)
PushX = float.Parse(anim.Attribute("dx").Value, NumberStyles.Any, ci);
if (elem.Attribute("dy") != null)
PushY = float.Parse(anim.Attribute("dy").Value, NumberStyles.Any, ci);
}
}
}
db.data.XmlDatas.cs (lines 201-255):
Code:
static void ProcessXml(Stream stream)
{
XElement root = XElement.Load(stream);
foreach (var elem in root.Elements("Ground"))
{
short type = (short)Utils.FromString(elem.Attribute("type").Value);
string id = elem.Attribute("id").Value;
UsedIds.Add(type);
TypeToId[type] = id;
IdToType[id] = type;
TypeToElement[type] = elem;
TileDescs[type] = new TileDesc(elem); //line 215
}
foreach (var elem in root.Elements("Object"))
{
if (elem.Element("Class") == null) continue;
string cls = elem.Element("Class").Value;
short type = (short)Utils.FromString(elem.Attribute("type").Value);
string id = elem.Attribute("id").Value;
UsedIds.Add(type);
TypeToId[type] = id;
IdToType[id] = type;
TypeToElement[type] = elem;
if (cls == "Equipment" || cls == "Dye" || cls == "Pet")
{
ItemDescs[type] = new Item(elem);
if (elem.Element("Shop") != null)
{
XElement shop = elem.Element("Shop");
ItemShops[type] = shop.Element("Name").Value;
ItemPrices[type] = Utils.FromString(shop.Element("Price").Value);
}
}
if (cls == "Character" || cls == "GameObject" || cls == "Wall" ||
cls == "ConnectedWall" || cls == "CaveWall" || cls == "Portal")
ObjectDescs[type] = new ObjectDesc(elem);
if (cls == "Portal")
{
try
{
PortalDescs[type] = new PortalDesc(elem);
}
catch (Exception e)
{
Console.WriteLine("Error for portal: " + type + " id: " + id);
/*3392,1792,1795,1796,1805,1806,1810,1825 -- no location, assume nexus?*
* Tomb Portal of Cowardice, Dungeon Portal, Portal of Cowardice, Realm Portal, Glowing Portal of Cowardice, Glowing Realm Portal, Nexus Portal, Locked Wine Cellar Portal*/
}
}
XElement key = elem.Element("Key");
if (key != null)
{
Keys.Add(type);
KeyPrices[type] = Utils.FromString(key.Value);
}
}
foreach (var elem in root.Elements("Dungeon"))
{
string name = elem.Attribute("name").Value;
short portalid = (short)Utils.FromString(elem.Attribute("type").Value);
IdToDungeon[portalid] = name;
DungeonDescs[name] = new DungeonDesc(elem);
}
}
db.data.XmlDatas.cs: (lines 11-74)
Code:
public class XmlDatas
{
const int XML_COUNT = 36;
public static bool behaviors = true;
static string ds = Path.DirectorySeparatorChar.ToString();
static XmlDatas()
{
ReadXmls(); //line 21
Mods.InitMods(behaviors);
}
public static void DoSomething()
{ }
public static void ReadXmls()
{
TypeToId = new Dictionary<short, string>();
IdToType = new Dictionary<string, short>();
IdToDungeon = new Dictionary<short, string>();
KeyPrices = new Dictionary<short, int>();
TypeToElement = new Dictionary<short, XElement>();
TileDescs = new Dictionary<short, TileDesc>();
ItemDescs = new Dictionary<short, Item>();
ObjectDescs = new Dictionary<short, ObjectDesc>();
PortalDescs = new Dictionary<short, PortalDesc>();
DungeonDescs = new Dictionary<string, DungeonDesc>();
ModTextures = new Dictionary<string, byte[]>();
ItemIds = new Dictionary<string,short>();
UsedIds = new List<short>();
ItemPrices = new Dictionary<short, int>();
ItemShops = new Dictionary<int, string>();
Keys = new List<short>();
Stream stream;
for (int i = 0; i < XML_COUNT; i++)
{
stream = typeof(XmlDatas).Assembly.GetManifestResourceStream("db.data.dat" + i + ".xml");
ProcessXml(stream); //line 54
}
stream = typeof(XmlDatas).Assembly.GetManifestResourceStream("db.data.item.xml");
ProcessXml(stream);
stream.Position = 0;
using (StreamReader rdr = new StreamReader(stream))
ExtraXml.Add(rdr.ReadToEnd());
stream = typeof(XmlDatas).Assembly.GetManifestResourceStream("db.data.addition2.xml");
ProcessXml(stream);
stream.Position = 0;
using (StreamReader rdr = new StreamReader(stream))
ExtraXml.Add(rdr.ReadToEnd());
stream = typeof(XmlDatas).Assembly.GetManifestResourceStream("db.data.addition.xml");
ProcessXml(stream);
stream.Position = 0;
using (StreamReader rdr = new StreamReader(stream))
ExtraXml.Add(rdr.ReadToEnd());
}
Is there something still wrong with the mod system or am I doing something wrong? I expect that at least @
Club559 knows