feat: add messaging system for manager and add example usage to Loot (#1837)

tested that loot still drops at the entities position
This commit is contained in:
David Markowitz
2025-06-29 00:22:41 -07:00
committed by GitHub
parent c697f8ad97
commit 48510b7315
22 changed files with 62 additions and 32 deletions

View File

@@ -33,10 +33,10 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
if (memberObject == nullptr) continue;
Loot::DropActivityLoot(memberObject, self, scriptedActivityComponent->GetActivityID(), rating);
Loot::DropActivityLoot(memberObject, self->GetObjectID(), scriptedActivityComponent->GetActivityID(), rating);
}
} else {
Loot::DropActivityLoot(user, self, scriptedActivityComponent->GetActivityID(), rating);
Loot::DropActivityLoot(user, self->GetObjectID(), scriptedActivityComponent->GetActivityID(), rating);
}
self->Smash(self->GetObjectID());

View File

@@ -45,7 +45,7 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
if (renderComponent != nullptr)
renderComponent->PlayEffect(7730, u"cast", "bootyshine");
Loot::DropLoot(player, self, 231, 75, 75);
Loot::DropLoot(player, self->GetObjectID(), 231, 75, 75);
}
}
} else if (args == "ChestDead") {

View File

@@ -22,7 +22,7 @@ void BaseInteractDropLootServer::BaseUse(Entity* self, Entity* user) {
self->SetNetworkVar(u"bInUse", true);
Loot::DropLoot(user, self, lootMatrix, 0, 0);
Loot::DropLoot(user, self->GetObjectID(), lootMatrix, 0, 0);
self->AddCallbackTimer(cooldownTime, [this, self]() {
self->SetNetworkVar(u"bInUse", false);

View File

@@ -13,7 +13,7 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s
const auto mission1 = self->GetVar<int32_t>(u"missionID");
const auto mission2 = self->GetVar<int32_t>(u"missionID2");
Loot::DropActivityLoot(target, self, self->GetLOT(), 0);
Loot::DropActivityLoot(target, self->GetObjectID(), self->GetLOT(), 0);
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {

View File

@@ -23,7 +23,7 @@ void WishingWellServer::OnUse(Entity* self, Entity* user) {
Loot::DropActivityLoot(
user,
self,
self->GetObjectID(),
static_cast<uint32_t>(scriptedActivity->GetActivityID()),
GeneralUtils::GenerateRandomNumber<int32_t>(1, 1000)
);

View File

@@ -6,7 +6,7 @@
#include "eTerminateType.h"
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
Loot::DropActivityLoot(user, self, 12551);
Loot::DropActivityLoot(user, self->GetObjectID(), 12551);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (inventoryComponent != nullptr) {

View File

@@ -14,6 +14,6 @@ void NjDragonEmblemChestServer::OnUse(Entity* self, Entity* user) {
auto* destroyable = self->GetComponent<DestroyableComponent>();
if (destroyable != nullptr) {
Loot::DropLoot(user, self, destroyable->GetLootMatrixID(), 0, 0);
Loot::DropLoot(user, self->GetObjectID(), destroyable->GetLootMatrixID(), 0, 0);
}
}

View File

@@ -27,7 +27,7 @@ void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) {
if (self->GetLOT() == frakjawChestId) activityRating = team->members.size();
Loot::DropActivityLoot(teamMember, self, sac->GetActivityID(), activityRating);
Loot::DropActivityLoot(teamMember, self->GetObjectID(), sac->GetActivityID(), activityRating);
}
}
} else {
@@ -35,7 +35,7 @@ void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) {
if (self->GetLOT() == frakjawChestId) activityRating = 1;
Loot::DropActivityLoot(user, self, sac->GetActivityID(), activityRating);
Loot::DropActivityLoot(user, self->GetObjectID(), sac->GetActivityID(), activityRating);
}
sac->PlayerRemove(user->GetObjectID());

View File

@@ -72,7 +72,7 @@ void ActivityManager::StopActivity(Entity* self, const LWOOBJID playerID, const
SetActivityValue(self, playerID, 1, value1);
SetActivityValue(self, playerID, 2, value2);
Loot::GiveActivityLoot(player, self, gameID, CalculateActivityRating(self, playerID));
Loot::GiveActivityLoot(player, self->GetObjectID(), gameID, CalculateActivityRating(self, playerID));
if (sac != nullptr) {
sac->PlayerRemove(player->GetObjectID());

View File

@@ -29,7 +29,7 @@ void ScriptedPowerupSpawner::OnTimerDone(Entity* self, std::string message) {
renderComponent->PlayEffect(0, u"cast", "N_cast");
}
Loot::DropLoot(owner, self, drops, 0, 0);
Loot::DropLoot(owner, self->GetObjectID(), drops, 0, 0);
}
// Increment the current cycle

View File

@@ -11,7 +11,7 @@ void AgPicnicBlanket::OnUse(Entity* self, Entity* user) {
self->SetVar<bool>(u"active", true);
auto lootTable = std::unordered_map<LOT, int32_t>{ {935, 3} };
Loot::DropLoot(user, self, lootTable, 0, 0);
Loot::DropLoot(user, self->GetObjectID(), lootTable, 0, 0);
self->AddCallbackTimer(5.0f, [self]() {
self->SetVar<bool>(u"active", false);

View File

@@ -572,7 +572,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_CannonLot, 0, "", self->GetVar<int32_t>(TotalScoreVariable));
}
Loot::GiveActivityLoot(player, self, GetGameID(self), self->GetVar<int32_t>(TotalScoreVariable));
Loot::GiveActivityLoot(player, self->GetObjectID(), GetGameID(self), self->GetVar<int32_t>(TotalScoreVariable));
SaveScore(self, player->GetObjectID(),
static_cast<float>(self->GetVar<int32_t>(TotalScoreVariable)), static_cast<float>(self->GetVar<uint32_t>(MaxStreakVariable)), percentage);