fix: Remove hard coded groups for spawners (#1454)

* fix macros not trimming newline

* Remove hardcoded spawner groups

Was just missing an inline script implementation and using the wrong name
This commit is contained in:
David Markowitz 2024-02-10 22:38:21 -08:00 committed by GitHub
parent f7e4a32621
commit ddaac276fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 16 deletions

View File

@ -631,6 +631,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (infile.good()) { if (infile.good()) {
std::string line; std::string line;
while (std::getline(infile, line)) { while (std::getline(infile, line)) {
// Do this in two separate calls to catch both \n and \r\n
line.erase(std::remove(line.begin(), line.end(), '\n'), line.end());
line.erase(std::remove(line.begin(), line.end(), '\r'), line.end());
SlashCommandHandler::HandleChatCommand(GeneralUtils::ASCIIToUTF16(line), entity, sysAddr); SlashCommandHandler::HandleChatCommand(GeneralUtils::ASCIIToUTF16(line), entity, sysAddr);
} }
} else { } else {

View File

@ -179,7 +179,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
std::vector<LWOOBJID> spiderEggs{}; std::vector<LWOOBJID> spiderEggs{};
auto spooders = Game::entityManager->GetEntitiesInGroup("EGG"); auto spooders = Game::entityManager->GetEntitiesInGroup("SpiderEggs");
for (auto spodder : spooders) { for (auto spodder : spooders) {
spiderEggs.push_back(spodder->GetObjectID()); spiderEggs.push_back(spodder->GetObjectID());
} }

View File

@ -1,6 +1,7 @@
#include "NpcCowboyServer.h" #include "NpcCowboyServer.h"
#include "eMissionState.h" #include "eMissionState.h"
#include "InventoryComponent.h" #include "InventoryComponent.h"
#include "dZoneManager.h"
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1880) { if (missionID != 1880) {
@ -23,4 +24,17 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { } else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(14378, 1); inventoryComponent->RemoveItem(14378, 1);
} }
// Next up hide or show the samples based on the mission state
int32_t visible = 1;
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
visible = 0;
}
auto spawners = Game::zoneManager->GetSpawnersByName("PlungerGunTargets");
for (auto* spawner : spawners) {
for (const auto entity : spawner->GetSpawnedObjectIDs())
GameMessages::SendNotifyClientObject(entity, u"SetVisibility", visible, 0,
target->GetObjectID(), "", target->GetSystemAddress());
}
} }

View File

@ -1,9 +1,10 @@
#include "NpcWispServer.h" #include "NpcWispServer.h"
#include "InventoryComponent.h" #include "InventoryComponent.h"
#include "EntityManager.h" #include "dZoneManager.h"
#include "Entity.h" #include "Entity.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "eMissionState.h" #include "eMissionState.h"
#include "Spawner.h"
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1849 && missionID != 1883) if (missionID != 1849 && missionID != 1883)
@ -25,7 +26,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
} }
// Next up hide or show the samples based on the mission state // Next up hide or show the samples based on the mission state
auto visible = 1; int32_t visible = 1;
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
visible = 0; visible = 0;
} }
@ -35,9 +36,10 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" }; : std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
for (const auto& group : groups) { for (const auto& group : groups) {
auto samples = Game::entityManager->GetEntitiesInGroup(group); auto spawners = Game::zoneManager->GetSpawnersByName(group);
for (auto* sample : samples) { for (const auto* spawner : spawners) {
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0, for (const auto objId : spawner->GetSpawnedObjectIDs())
GameMessages::SendNotifyClientObject(objId, u"SetVisibility", visible, 0,
target->GetObjectID(), "", target->GetSystemAddress()); target->GetObjectID(), "", target->GetSystemAddress());
} }
} }

View File

@ -25,16 +25,6 @@ Spawner::Spawner(const SpawnerInfo info) {
m_Start = m_Info.noTimedSpawn; m_Start = m_Info.noTimedSpawn;
//ssssh...
if (m_EntityInfo.lot == 14718) { //AG - MAELSTROM SAMPLE
m_Info.groups.emplace_back("MaelstromSamples");
}
if (m_EntityInfo.lot == 14375) //AG - SPIDER BOSS EGG
{
m_Info.groups.emplace_back("EGG");
}
int timerCount = m_Info.amountMaintained; int timerCount = m_Info.amountMaintained;
if (m_Info.amountMaintained > m_Info.nodes.size()) { if (m_Info.amountMaintained > m_Info.nodes.size()) {