public void MoverThreadProcess() { Output.WriteLine("[WORLD SERVER]MoverThread started"); // Moove the Mobs a little bit around int npcCount = WorldSocket.npcs.Count; lock (WorldSocket.npcs.SyncRoot) { for (int i = 0; i < npcCount; i++) { npc thismob = (npc)WorldSocket.npcs[i]; // Check if Client has a view for this mob if (thismob.getIsSpawned() == true) { thismob.doTick(); } } } // ToDo: This is the Mover Update Thread to update objects like NPCs every interval Thread.Sleep(1000); }
private static void updateMob(WorldClient client, ref npc thismob, ClientView mobView) { bool clientUpdate = thismob.doTick(); if (clientUpdate == true) { // Needs to send the packet to every spawned client who has this view byte[] updateData = thismob.getAndResetUpdateData(); ServerPackets pak = new ServerPackets(); pak.sendNPCUpdateData(mobView.ViewID, client, updateData); } }