Too be honest; it'd be faster for you to download the source and check it then to wait for me to figure out what part the mobspawn code is.
//edit I think that I know why it doesn't work. In the original code, it creates 1 mobcollection per map while in my code it keeps recreating the collection. This explains why it loads the monsters while they don't appear on the map; they are simply not part of the collection. Also more or less explains why only 1 mob gets spawned; it's the last mob in the table, in other words the last time the collection gets recreated.
//edit Behold; the most roundabout and probably most shitty way to do it:
Code:
MySqlCommand command3 = new MySqlCommand(MySqlCommandType.SELECT);
command3.Select("cq_generator");
MySqlReader reader3 = new MySqlReader(command3);
num = 0;
uint SpawnID = 0;
List<uint> UsedMaps = new List<uint>();
List<uint> SpawnIDs = new List<uint>();
// Monster Spawns (cq_generator)
while (reader3.Read())
{
uint tMapID = reader3.ReadUInt32("mapid");
if (UsedMaps.Contains(tMapID))
continue;
if (tMapID == MapID.TrainingGrounds.Id || tMapID == 1219 || tMapID == 1052 || tMapID == 4025 || tMapID == 4024 || tMapID == 4023 || tMapID == 4022 || tMapID == 4021)
continue;
UsedMaps.Add(tMapID);
MobCollection Linker = new MobCollection(tMapID, 5000);
if (Kernel.DMaps.TryGetValue(tMapID, out Linker.DMap))
Linker.DMap.Mobs = Linker;
MySqlCommand command4 = new MySqlCommand(MySqlCommandType.SELECT);
command4.Select("cq_generator");
MySqlReader reader4 = new MySqlReader(command4);
while (reader4.Read())
{
if (reader4.ReadUInt32("mapid") == tMapID)
{
SpawnID = reader4.ReadUInt32("id");
while (!SpawnIDs.Contains(SpawnID))
{
MonsterSpawn Spawn = new MonsterSpawn();
Spawn.CollectionOwner = Linker;
uint ID = reader4.ReadUInt32("npctype");
if (!MonsterFamilies.TryGetValue(ID, out Spawn.Family))
{
continue;
}
Spawn.SpawnX = reader4.ReadUInt16("bound_x");
Spawn.SpawnY = reader4.ReadUInt16("bound_y");
Spawn.MaxSpawnX = (ushort)(Spawn.SpawnX + reader4.ReadUInt16("bound_cx"));
Spawn.MaxSpawnY = (ushort)(Spawn.SpawnY + reader4.ReadUInt16("bound_cy"));
Spawn.MapID = tMapID;
Spawn.SpawnCount = reader4.ReadByte("max_per_gen");
Linker.AddSpawn(Spawn);
SpawnIDs.Add(SpawnID);
}
}
}
num += Linker.FinalizeCollection();
}
MonsterSpawn.StartSingleChildAI();
Console.WriteLine("\tLoaded {0} Monsters.", num);
}
But it works, lol