So yeah, I've started on it and talked to Ultimation about it and he said he's in, so I guess that decides it. I've already started coding it. Oh joy the database system is a bitch to code. I've reworked the way I handle the database. It still uses ini-files, but looks quite different and is
significantly faster than before.
i.e.
Code:
private static DBMap dbGameDefaults = new DBMap()
{
{"GM", 0},
{"Name", string.Empty},
{"SpouseAccount", string.Empty},
{"MapId", 1002},
{"X", 400},
{"Y", 400},
{"Level", 130},
{"Mesh", 3},
{"Sex", 1},
{"Avatar", 0},
{"Reborn", 2},
{"HairStyle", 421},
{"Nobility", 0},
{"PKPoints", 0},
{"Job", 15},
{"Money", 0},
{"ConquerPoints", 0},
{"MP", 0},
{"HP", 1},
{"GuildId", 0},
{"GuildRank", 0},
{"GuildWarTime", DateTime.Now},
{"Strength", 5},
{"Agility", 2},
{"Vitality", 3},
{"Spirit", 0},
{"AttributePoints", 422-(5+2+3+0)}
};
Code:
public static void LoadCharacter(User user, int loginId, int passwordId, out string replyMsg)
{
try
{
AuthenticationUser auth = AuthenticationSocket.Select(loginId);
user.Account = auth.Account;
user.Password = auth.Password;
if (user.Password.GetHashCode() != passwordId)
{
replyMsg = "Hahahaha, nice try. Fag.";
return;
}
DBMap map = SelectFile("accounts", user.Account + ".db")["game"];
map.Defaults = dbGameDefaults;
user.Name = map["Name"];
if (user.Name == map.Defaults["Name"])
{
replyMsg = "NEW_ROLE";
}
else
{
user.GM = map["GM"];
user.SpouseAccount = map["SpouseAccount"];
if (user.SpouseAccount != map.Defaults["SpouseAccount"])
{
DBNode spouse = SelectFile("accounts", user.SpouseAccount + ".db")["game"];
user.Spouse = spouse.ReadString("Name", "None", 16);
}
else
{
user.Spouse = "None";
}
user.MapID = map["MapId"];
user.X = map["X"];
user.Y = map["Y"];
user.Level = map["Level"];
user.ConstructModel(map["Mesh"], map["Sex"], map["Avatar"], 0);
user.Reborn = map["Reborn"];
user.HairStyle = map["HairStyle"];
user.Nobility = map["Nobility"];
user.PKPoints = map["PKPoints"];
user.Job = map["Job"];
user.Money = map["Money"];
user.ConquerPoints = map["ConquerPoints"];
user.MP = map["MP"];
user.HP = map["HP"];
user.GuildId = map["GuildId"];
user.GuildRank = map["GuildRank"];
user.GuildWarTime = map["GuildWarTime"];
user.Strength = map["Strength"];
user.Agility = map["Agility"];
user.Spirit = map["Spirit"];
user.Vitality = map["Vitality"];
user.AttributePoints = map["AttributePoints"];
replyMsg = "ANSWER_OK";
}
}
catch (Exception ex)
{
replyMsg = ex.Message;
}
}
Resembles more what you SQL-folks do, no?