eqemu-server/zone/zone_base_data.cpp
Alex King 8edf7a07e3
[Base Data] Remove from shared memory and simplify (#4045)
* [Base Data] Remove from shared memory and simplify

- Removes Base Data loading from shared memory and puts it into zone.
- Changes type of `level` and `class` to `uint8_t` from `uint32_t` for consistency since we're renaming fields here anyway.
- Renames `unk1` to `hp_regen` in `base_data` table.
- Renames `unk2` to `end_regen` in `base_data` table.
- These changed fields were already mapped, we just hadn't renamed them for whatever reason.
- Regenerates Base Data repository.
- Adds `#reload base_data` to reload base data in real time.

* Cleanup

* Update shareddb.h

* Cleanup.

* Update shareddb.cpp

* Update main.cpp
2024-02-05 17:11:20 -06:00

40 lines
654 B
C++

#include "zone.h"
BaseDataRepository::BaseData Zone::GetBaseData(uint8 level, uint8 class_id)
{
for (const auto& e : m_base_data) {
if (e.level == level && e.class_ == class_id) {
return e;
}
}
return BaseDataRepository::NewEntity();
}
void Zone::LoadBaseData()
{
const auto& l = BaseDataRepository::All(content_db);
m_base_data.reserve(l.size());
for (const auto& e : l) {
if (e.level < 1 || !IsPlayerClass(e.class_)) {
continue;
}
m_base_data.emplace_back(e);
}
LogInfo(
"Loaded [{}] Base Data Entr{}",
l.size(),
l.size() != 1 ? "ies" : "y"
);
}
void Zone::ReloadBaseData()
{
ClearBaseData();
LoadBaseData();
}