[Zones] Convert IDLE_WHEN_EMPTY to a Zone Column (#3891)

* [Rules] Convert IDLE_WHEN_EMPTY to a rule

# Notes
- Converts `IDLE_WHEN_EMPTY` to `Zone:ZonesIdleWhenEmpty` so that we can change this on the fly or on a zone-by-zone basis instead of having to recompile to do this.
- Especially helpful for those using release binaries that do not compile their own source.

* Convert to zone column.

* Update ruletypes.h

* Update ruletypes.h

* Update entity.cpp

* Update entity.cpp

* Rename.

* Update database_update_manifest.cpp

* Update base_zone_repository.h

* Update zone.cpp

* seconds_before_idle

* Update database_update_manifest.cpp

* Getter/Setters/Private

* Update base_zone_repository.h

* IsIdle()/SetIsIdle()

* Update entity.cpp
This commit is contained in:
Alex King
2024-01-13 02:21:40 -05:00
committed by GitHub
parent d41bd8f963
commit 742b437f2c
14 changed files with 373 additions and 179 deletions
+42 -3
View File
@@ -974,7 +974,6 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
default_ruleset = 0;
is_zone_time_localized = false;
process_mobs_while_empty = false;
loglevelvar = 0;
merchantvar = 0;
@@ -984,13 +983,17 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
short_name = strcpy(new char[strlen(in_short_name)+1], in_short_name);
strlwr(short_name);
memset(file_name, 0, sizeof(file_name));
long_name = 0;
aggroedmobs =0;
long_name = 0;
aggroedmobs = 0;
m_graveyard_id = 0;
pgraveyard_zoneid = 0;
m_max_clients = 0;
pvpzone = false;
SetIdleWhenEmpty(true);
SetSecondsBeforeIdle(60);
if (database.GetServerType() == 1) {
pvpzone = true;
}
@@ -1006,6 +1009,9 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
m_graveyard_id = z->graveyard_id;
m_max_clients = z->maxclients;
SetIdleWhenEmpty(z->idle_when_empty);
SetSecondsBeforeIdle(z->seconds_before_idle);
if (z->file_name.empty()) {
strcpy(file_name, short_name);
}
@@ -1391,6 +1397,9 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_version)
m_graveyard_id = z->graveyard_id;
m_max_clients = z->maxclients;
SetIdleWhenEmpty(z->idle_when_empty);
SetSecondsBeforeIdle(z->seconds_before_idle);
// safe coordinates
m_safe_points.x = z->safe_x;
m_safe_points.y = z->safe_y;
@@ -3230,3 +3239,33 @@ void Zone::SetEXPModifier(Client* c, float exp_modifier)
m
);
}
bool Zone::IsIdleWhenEmpty() const
{
return m_idle_when_empty;
}
void Zone::SetIdleWhenEmpty(bool idle_when_empty)
{
Zone::m_idle_when_empty = idle_when_empty;
}
uint32 Zone::GetSecondsBeforeIdle() const
{
return m_seconds_before_idle;
}
void Zone::SetSecondsBeforeIdle(uint32 seconds_before_idle)
{
Zone::m_seconds_before_idle = seconds_before_idle;
}
bool Zone::IsIdle() const
{
return m_is_idle;
}
void Zone::SetIsIdle(bool m_is_idle)
{
Zone::m_is_idle = m_is_idle;
}