mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 10:18:21 +00:00
fc75d6048f
* moving branch * Add deleteinven slash command * Change name of BRICKS_IN_BBB * Use string_view instead of strcmp * Clean up include tree * Remove unneeded headers from PCH files Removes unneeded headers from pre-compiled headers. This increases compile time, however reduces development time for most files. * Update Entity.h * Update EntityManager.h * Update GameMessages.cpp * There it compiles now Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#include "TreasureChestDragonServer.h"
|
|
#include "ScriptedActivityComponent.h"
|
|
#include "TeamManager.h"
|
|
#include "EntityManager.h"
|
|
#include "Loot.h"
|
|
|
|
void TreasureChestDragonServer::OnStartup(Entity* self) {
|
|
|
|
}
|
|
|
|
void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
|
|
if (self->GetVar<bool>(u"bUsed")) {
|
|
return;
|
|
}
|
|
|
|
self->SetVar<bool>(u"bUsed", true);
|
|
|
|
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
|
|
|
if (scriptedActivityComponent == nullptr) {
|
|
return;
|
|
}
|
|
|
|
auto rating = 1;
|
|
|
|
auto* team = TeamManager::Instance()->GetTeam(user->GetObjectID());
|
|
|
|
if (team != nullptr) {
|
|
rating = team->members.size();
|
|
|
|
for (const auto member : team->members) {
|
|
auto* memberObject = EntityManager::Instance()->GetEntity(member);
|
|
|
|
if (memberObject == nullptr) continue;
|
|
|
|
LootGenerator::Instance().DropActivityLoot(memberObject, self, scriptedActivityComponent->GetActivityID(), rating);
|
|
}
|
|
} else {
|
|
LootGenerator::Instance().DropActivityLoot(user, self, scriptedActivityComponent->GetActivityID(), rating);
|
|
}
|
|
|
|
self->Smash(self->GetObjectID());
|
|
}
|