Error:
Quote:
Value cannot be null
Code:
public static void LoadNPCs()// working
{
lock (WriteConnection)//error line
{
MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `npc`", WriteConnection);
MySqlDataReader DR = Cmd.ExecuteReader();
while (DR.Read())
{
Game.NPC Npc = new NewestCOServer.Game.NPC();
Npc.EntityID = Convert.ToUInt32(DR["EntityID"]);
Npc.Name = Convert.ToString(DR["Name"]);
Npc.Type = Convert.ToUInt16(DR["Type"]);
Npc.Flags = Convert.ToByte(DR["Flags"]);
Npc.Avatar = Convert.ToByte(DR["Avatar"]);
Npc.Loc = new Game.Location();
Npc.Loc.Map = Convert.ToUInt16(DR["Map"]);
Npc.Loc.X = Convert.ToUInt16(DR["X"]);
Npc.Loc.Y = Convert.ToUInt16(DR["Y"]);
if (Npc.Flags == 21)
Npc.Level = (byte)((Npc.Type - 427) / 6 + 20);
if (Npc.Flags == 22)
Npc.Level = (byte)((Npc.Type - 437) / 6 + 20);
if (Npc.Type == 1500)
Npc.Level = 125;
if (Npc.Type == 1520)
Npc.Level = 125;
if (Npc.Flags == 21 || Npc.Flags == 22)
{
Npc.CurHP = 10000;
Npc.MaxHP = 10000;
}
Game.World.H_NPCs.Add(Npc.EntityID, Npc);
}
DR.Close();
}
}
Code:
public static MySqlConnection WriteConnection;






