mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 10:45:27 +00:00
refactor(component): the mission offer loads its missions in LoadDataFromTemplate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,12 +43,16 @@ bool OfferedMission::GetAcceptsMission() const {
|
|||||||
|
|
||||||
MissionOfferComponent::MissionOfferComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
MissionOfferComponent::MissionOfferComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
RegisterMsg(&MissionOfferComponent::OnRequestUse);
|
RegisterMsg(&MissionOfferComponent::OnRequestUse);
|
||||||
if (componentID != -1) {
|
}
|
||||||
|
|
||||||
|
// The MissionNPCComponent rows: the missions this offers and accepts
|
||||||
|
void MissionOfferComponent::LoadDataFromTemplate() {
|
||||||
|
if (m_ComponentID != -1) {
|
||||||
// Now lookup the missions in the MissionNPCComponent table
|
// Now lookup the missions in the MissionNPCComponent table
|
||||||
auto* missionNpcComponentTable = CDClientManager::GetTable<CDMissionNPCComponentTable>();
|
auto* missionNpcComponentTable = CDClientManager::GetTable<CDMissionNPCComponentTable>();
|
||||||
|
|
||||||
auto missions = missionNpcComponentTable->Query([componentID](const CDMissionNPCComponent& entry) {
|
auto missions = missionNpcComponentTable->Query([this](const CDMissionNPCComponent& entry) {
|
||||||
return entry.id == static_cast<unsigned>(componentID);
|
return entry.id == static_cast<unsigned>(m_ComponentID);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto& mission : missions) {
|
for (auto& mission : missions) {
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ public:
|
|||||||
|
|
||||||
MissionOfferComponent(Entity* parent, const int32_t componentID);
|
MissionOfferComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
|
void LoadDataFromTemplate() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a RequestUse triggered by some entity, determines which missions to show based on what they may
|
* Handles a RequestUse triggered by some entity, determines which missions to show based on what they may
|
||||||
* hand in now and what they may start based on their mission history.
|
* hand in now and what they may start based on their mission history.
|
||||||
|
|||||||
Reference in New Issue
Block a user