mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
Filter ground spawns [skip ci]
This commit is contained in:
parent
68a2af1bce
commit
9fbcd99be2
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "quest_parser_collection.h"
|
#include "quest_parser_collection.h"
|
||||||
#include "zonedb.h"
|
#include "zonedb.h"
|
||||||
|
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -460,7 +461,7 @@ void Object::RandomSpawn(bool send_packet) {
|
|||||||
|
|
||||||
m_data.x = zone->random.Real(m_min_x, m_max_x);
|
m_data.x = zone->random.Real(m_min_x, m_max_x);
|
||||||
m_data.y = zone->random.Real(m_min_y, m_max_y);
|
m_data.y = zone->random.Real(m_min_y, m_max_y);
|
||||||
|
|
||||||
if(m_data.z == BEST_Z_INVALID) {
|
if(m_data.z == BEST_Z_INVALID) {
|
||||||
glm::vec3 me;
|
glm::vec3 me;
|
||||||
me.x = m_data.x;
|
me.x = m_data.x;
|
||||||
@ -470,11 +471,11 @@ void Object::RandomSpawn(bool send_packet) {
|
|||||||
float best_z = zone->zonemap->FindClosestZ(me, &hit);
|
float best_z = zone->zonemap->FindClosestZ(me, &hit);
|
||||||
if (best_z != BEST_Z_INVALID) {
|
if (best_z != BEST_Z_INVALID) {
|
||||||
m_data.z = best_z + 0.1f;
|
m_data.z = best_z + 0.1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("Object::RandomSpawn([{}]): [{}] ([{}], [{}], [{}])", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z);
|
LogInfo("Object::RandomSpawn([{}]): [{}] ([{}], [{}], [{}])", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z);
|
||||||
|
|
||||||
respawn_timer.Disable();
|
respawn_timer.Disable();
|
||||||
|
|
||||||
if(send_packet) {
|
if(send_packet) {
|
||||||
@ -520,7 +521,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
|||||||
co->drop_id = 0;
|
co->drop_id = 0;
|
||||||
entity_list.QueueClients(nullptr, outapp, false);
|
entity_list.QueueClients(nullptr, outapp, false);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|
||||||
// No longer using a tradeskill object
|
// No longer using a tradeskill object
|
||||||
sender->SetTradeskillObject(nullptr);
|
sender->SetTradeskillObject(nullptr);
|
||||||
user = nullptr;
|
user = nullptr;
|
||||||
@ -681,7 +682,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
|||||||
"size = %f, tilt_x = %f, tilt_y = %f "
|
"size = %f, tilt_x = %f, tilt_y = %f "
|
||||||
"WHERE id = %i",
|
"WHERE id = %i",
|
||||||
object.zone_id, object.x, object.y, object.z, object.heading,
|
object.zone_id, object.x, object.y, object.z, object.heading,
|
||||||
item_id, charges, object_name, type, icon,
|
item_id, charges, object_name, type, icon,
|
||||||
object.size, object.tilt_x, object.tilt_y, id);
|
object.size, object.tilt_x, object.tilt_y, id);
|
||||||
safe_delete_array(object_name);
|
safe_delete_array(object_name);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
@ -698,14 +699,20 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
|||||||
//
|
//
|
||||||
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs) {
|
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs) {
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT max_x, max_y, max_z, "
|
std::string query = StringFormat(
|
||||||
"min_x, min_y, heading, name, "
|
"SELECT max_x, max_y, max_z, "
|
||||||
"item, max_allowed, respawn_timer "
|
"min_x, min_y, heading, name, "
|
||||||
"FROM ground_spawns "
|
"item, max_allowed, respawn_timer "
|
||||||
"WHERE zoneid = %i AND (version = %u OR version = -1) "
|
"FROM ground_spawns "
|
||||||
"LIMIT 50", zone_id, version);
|
"WHERE zoneid = %i AND (version = %u OR version = -1) %s "
|
||||||
auto results = QueryDatabase(query);
|
"LIMIT 50",
|
||||||
if (!results.Success()) {
|
zone_id,
|
||||||
|
version,
|
||||||
|
ContentFilterCriteria::apply().c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
if (!results.Success()) {
|
||||||
return gs;
|
return gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user