Points load and send to client; find on them needs work because the decode on the packet is very wrong.

This commit is contained in:
KimLS
2024-11-27 20:14:11 -08:00
parent d9c17511fd
commit 17e922b026
7 changed files with 667 additions and 2 deletions
+2
View File
@@ -47,6 +47,7 @@
#include "../common/repositories/lootdrop_entries_repository.h"
#include "../common/repositories/base_data_repository.h"
#include "../common/repositories/skill_caps_repository.h"
#include "../common/repositories/findable_location_repository.h"
struct EXPModifier
{
@@ -526,6 +527,7 @@ private:
std::vector<BaseDataRepository::BaseData> m_base_data = { };
// Findable Locations
std::vector<FindableLocationRepository::FindableLocation> m_findable_locations = { };
};
#endif
+29
View File
@@ -1,13 +1,42 @@
#include "zone.h"
void Zone::LoadFindableLocations() {
m_findable_locations = content_db.LoadFindableLocations(GetShortName(), GetInstanceVersion());
if (m_findable_locations.empty()) {
LogInfo("No findable loacations loaded");
return;
}
}
void Zone::ReloadFindableLocations() {
ClearFindableLocations();
LoadFindableLocations();
}
void Zone::ClearFindableLocations() {
m_findable_locations.clear();
}
void Zone::SendFindableLocations(Client* client) {
if (m_findable_locations.empty()) {
return;
}
size_t size = sizeof(uint32) + (m_findable_locations.size() * sizeof(FindableLocation_Struct));
auto outapp = new EQApplicationPacket(OP_SendFindableLocations, size);
outapp->WriteUInt32(m_findable_locations.size());
for (auto& location : m_findable_locations) {
outapp->WriteUInt32(location.type);
outapp->WriteSInt32(location.findable_id);
outapp->WriteSInt32(location.findable_sub_id);
outapp->WriteSInt32(location.zone_id);
outapp->WriteSInt32(location.zone_id_index);
outapp->WriteFloat(location.y);
outapp->WriteFloat(location.x);
outapp->WriteFloat(location.z);
}
client->FastQueuePacket(&outapp);
}
+10 -2
View File
@@ -50,9 +50,8 @@
#include "../common/repositories/character_corpses_repository.h"
#include "../common/repositories/character_corpse_items_repository.h"
#include "../common/repositories/zone_repository.h"
#include "../common/repositories/trader_repository.h"
#include "../common/repositories/findable_location_repository.h"
#include <ctime>
#include <iostream>
@@ -2875,6 +2874,15 @@ void ZoneDatabase::UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, ui
CharacterAltCurrencyRepository::ReplaceOne(*this, e);
}
std::vector<FindableLocationRepository::FindableLocation> ZoneDatabase::LoadFindableLocations(const std::string& zone_name, int16 version) {
auto findable_locations = FindableLocationRepository::GetWhere(
*this, fmt::format(
"zone = '{}' AND (version = {} OR version = -1) {} ORDER BY id ASC",
zone_name, version, ContentFilterCriteria::apply()));
return findable_locations;
}
void ZoneDatabase::SaveBuffs(Client *client)
{
CharacterBuffsRepository::DeleteWhere(
+4
View File
@@ -13,6 +13,7 @@
#include "../common/repositories/doors_repository.h"
#include "../common/races.h"
#include "../common/repositories/npc_faction_entries_repository.h"
#include "../common/repositories/findable_location_repository.h"
#include "bot_database.h"
@@ -638,6 +639,9 @@ public:
void LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> &currency);
void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value);
/* Findable Locations */
std::vector<FindableLocationRepository::FindableLocation> LoadFindableLocations(const std::string& zone_name, int16 version);
/*
* Misc stuff.
* PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD