mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
[Zone] Zone State Improvements (Continued) (#4768)
* [Zone] Zone State Improvements (Continued) * Ignore a few events when we resume from suspend * Add is_zone field * Update database_update_manifest.cpp * Update database_update_manifest.cpp * Update database_update_manifest.cpp * Update zone_save_state.cpp * Update zone_save_state.cpp * Add Zone Variables * Update methods * Update zone_save_state.cpp * Update zone_save_state.cpp --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
@@ -3218,5 +3218,72 @@ void Zone::DisableRespawnTimers()
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::ClearVariables()
|
||||
{
|
||||
m_zone_variables.clear();
|
||||
}
|
||||
|
||||
bool Zone::DeleteVariable(const std::string& variable_name)
|
||||
{
|
||||
if (m_zone_variables.empty() || variable_name.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto v = m_zone_variables.find(variable_name);
|
||||
if (v == m_zone_variables.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_zone_variables.erase(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Zone::GetVariable(const std::string& variable_name)
|
||||
{
|
||||
if (m_zone_variables.empty() || variable_name.empty()) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const auto& v = m_zone_variables.find(variable_name);
|
||||
|
||||
return v != m_zone_variables.end() ? v->second : std::string();
|
||||
}
|
||||
|
||||
std::vector<std::string> Zone::GetVariables()
|
||||
{
|
||||
std::vector<std::string> l;
|
||||
|
||||
if (m_zone_variables.empty()) {
|
||||
return l;
|
||||
}
|
||||
|
||||
l.reserve(m_zone_variables.size());
|
||||
|
||||
for (const auto& v : m_zone_variables) {
|
||||
l.emplace_back(v.first);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
void Zone::SetVariable(const std::string& variable_name, const std::string& variable_value)
|
||||
{
|
||||
if (variable_name.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_zone_variables[variable_name] = variable_value;
|
||||
}
|
||||
|
||||
bool Zone::VariableExists(const std::string& variable_name)
|
||||
{
|
||||
if (m_zone_variables.empty() || variable_name.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_zone_variables.find(variable_name) != m_zone_variables.end();
|
||||
}
|
||||
|
||||
#include "zone_save_state.cpp"
|
||||
#include "zone_loot.cpp"
|
||||
|
||||
Reference in New Issue
Block a user