mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 03:31:08 +00:00
[Spawn] Split spawn2 enabled into its own state table
This commit is contained in:
+14
-2
@@ -21,6 +21,7 @@
|
||||
#include "../common/repositories/character_pet_info_repository.h"
|
||||
#include "../common/repositories/character_buffs_repository.h"
|
||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||
#include "../common/repositories/spawn2_disabled_repository.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
@@ -173,8 +174,19 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id)
|
||||
|
||||
void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status)
|
||||
{
|
||||
std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id);
|
||||
QueryDatabase(query);
|
||||
auto spawns = Spawn2DisabledRepository::GetWhere(*this, fmt::format("spawn2_id = {}", id));
|
||||
if (!spawns.empty()) {
|
||||
auto spawn = spawns[0];
|
||||
// 1 = enabled 0 = disabled
|
||||
spawn.disabled = new_status ? 0 : 1;
|
||||
Spawn2DisabledRepository::UpdateOne(*this, spawn);
|
||||
return;
|
||||
}
|
||||
|
||||
auto spawn = Spawn2DisabledRepository::NewEntity();
|
||||
spawn.spawn2_id = id;
|
||||
spawn.disabled = new_status ? 0 : 1;
|
||||
Spawn2DisabledRepository::InsertOne(*this, spawn);
|
||||
}
|
||||
|
||||
bool ZoneDatabase::SetSpecialAttkFlag(uint8 id, const char* flag) {
|
||||
|
||||
Reference in New Issue
Block a user