void GameSocket::SpawnPlayers() { for(Objects.pIter = Objects.Players.begin(); Objects.pIter != Objects.Players.end(); ++Objects.pIter) { if(Objects.pIter->first != Player.General.UniqueID) { CreateSpawnPacket(Objects.pIter->second); Send(Writer.Buffer, Writer.Size()); } } }
void Object::RandomSpawn(bool send_packet) { if(!m_ground_spawn) return; m_data.x = MakeRandomFloat(m_min_x, m_max_x); m_data.y = MakeRandomFloat(m_min_y, m_max_y); respawn_timer.Disable(); if(send_packet) { EQApplicationPacket app; CreateSpawnPacket(&app); entity_list.QueueClients(nullptr, &app, true); } }
// this is less than ideal, but other solutions are a bit all over the place // and hard to reason about void Aura::ProcessSpawns() { const auto &clients = entity_list.GetClientList(); for (auto &e : clients) { auto c = e.second; bool spawned = spawned_for.find(c->GetID()) != spawned_for.end(); if (ShouldISpawnFor(c)) { if (!spawned) { EQApplicationPacket app; CreateSpawnPacket(&app, this); c->QueuePacket(&app); SendArmorAppearance(c); spawned_for.insert(c->GetID()); } } else if (spawned) { EQApplicationPacket app; CreateDespawnPacket(&app, false); c->QueuePacket(&app); spawned_for.erase(c->GetID()); } } return; }
void GameSocket::SpawnMe() { CreateSpawnPacket(this); Broadcast(false); }