mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-20 09:38:21 +00:00
Make spawn2 enabled/disabled instance aware
This commit is contained in:
+2
-2
@@ -359,7 +359,7 @@ Mob *QuestManager::spawn_from_spawn2(uint32 spawn2_id)
|
||||
|
||||
void QuestManager::enable_spawn2(uint32 spawn2_id)
|
||||
{
|
||||
database.UpdateSpawn2Status(spawn2_id, 1);
|
||||
database.UpdateSpawn2Status(spawn2_id, 1, zone->GetInstanceID());
|
||||
auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct));
|
||||
ServerSpawnStatusChange_Struct* ssc = (ServerSpawnStatusChange_Struct*) pack->pBuffer;
|
||||
ssc->id = spawn2_id;
|
||||
@@ -370,7 +370,7 @@ void QuestManager::enable_spawn2(uint32 spawn2_id)
|
||||
|
||||
void QuestManager::disable_spawn2(uint32 spawn2_id)
|
||||
{
|
||||
database.UpdateSpawn2Status(spawn2_id, 0);
|
||||
database.UpdateSpawn2Status(spawn2_id, 0, zone->GetInstanceID());
|
||||
auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct));
|
||||
ServerSpawnStatusChange_Struct* ssc = (ServerSpawnStatusChange_Struct*) pack->pBuffer;
|
||||
ssc->id = spawn2_id;
|
||||
|
||||
+4
-3
@@ -486,12 +486,13 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
}
|
||||
|
||||
std::vector<Spawn2DisabledRepository::Spawn2Disabled> disabled_spawns = {};
|
||||
if (spawn2_ids.size() > 0) {
|
||||
if (!spawn2_ids.empty()) {
|
||||
disabled_spawns = Spawn2DisabledRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"spawn2_id IN ({})",
|
||||
Strings::Join(spawn2_ids, ",")
|
||||
"spawn2_id IN ({}) and instance_id = {}",
|
||||
Strings::Join(spawn2_ids, ","),
|
||||
zone->GetInstanceID()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
+10
-5
@@ -172,20 +172,25 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id)
|
||||
|
||||
}
|
||||
|
||||
void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status)
|
||||
void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status, uint32 instance_id)
|
||||
{
|
||||
auto spawns = Spawn2DisabledRepository::GetWhere(*this, fmt::format("spawn2_id = {}", id));
|
||||
auto spawns = Spawn2DisabledRepository::GetWhere(
|
||||
*this,
|
||||
fmt::format("spawn2_id = {} and instance_id = {}", id, instance_id)
|
||||
);
|
||||
if (!spawns.empty()) {
|
||||
auto spawn = spawns[0];
|
||||
// 1 = enabled 0 = disabled
|
||||
spawn.disabled = new_status ? 0 : 1;
|
||||
spawn.disabled = new_status ? 0 : 1;
|
||||
spawn.instance_id = instance_id;
|
||||
Spawn2DisabledRepository::UpdateOne(*this, spawn);
|
||||
return;
|
||||
}
|
||||
|
||||
auto spawn = Spawn2DisabledRepository::NewEntity();
|
||||
spawn.spawn2_id = id;
|
||||
spawn.disabled = new_status ? 0 : 1;
|
||||
spawn.spawn2_id = id;
|
||||
spawn.instance_id = instance_id;
|
||||
spawn.disabled = new_status ? 0 : 1;
|
||||
Spawn2DisabledRepository::InsertOne(*this, spawn);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -529,7 +529,7 @@ public:
|
||||
bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, const glm::vec4& position, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value);
|
||||
void UpdateRespawnTime(uint32 id, uint16 instance_id,uint32 timeleft);
|
||||
uint32 GetSpawnTimeLeft(uint32 id, uint16 instance_id);
|
||||
void UpdateSpawn2Status(uint32 id, uint8 new_status);
|
||||
void UpdateSpawn2Status(uint32 id, uint8 new_status, uint32 instance_id);
|
||||
|
||||
/* Grids/Paths */
|
||||
uint32 GetFreeGrid(uint16 zoneid);
|
||||
|
||||
Reference in New Issue
Block a user