mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-22 15:28:07 +00:00
feat: Loot rework (#1909)
* feat: Loot rework * Allow dupe powerup pickups * change default team loot to shared
This commit is contained in:
@@ -15,11 +15,6 @@ void ScriptedPowerupSpawner::OnTimerDone(Entity* self, std::string message) {
|
||||
|
||||
const auto itemLOT = self->GetVar<LOT>(u"lootLOT");
|
||||
|
||||
// Build drop table
|
||||
std::unordered_map<LOT, int32_t> drops;
|
||||
|
||||
drops.emplace(itemLOT, 1);
|
||||
|
||||
// Spawn the required number of powerups
|
||||
auto* owner = Game::entityManager->GetEntity(self->GetSpawnerID());
|
||||
if (owner != nullptr) {
|
||||
@@ -28,8 +23,19 @@ void ScriptedPowerupSpawner::OnTimerDone(Entity* self, std::string message) {
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(0, u"cast", "N_cast");
|
||||
}
|
||||
GameMessages::GetPosition posMsg{};
|
||||
posMsg.target = self->GetObjectID();
|
||||
posMsg.Send();
|
||||
|
||||
Loot::DropLoot(owner, self->GetObjectID(), drops, 0, 0);
|
||||
GameMessages::DropClientLoot lootMsg{};
|
||||
lootMsg.target = owner->GetObjectID();
|
||||
lootMsg.ownerID = owner->GetObjectID();
|
||||
lootMsg.sourceID = self->GetObjectID();
|
||||
lootMsg.spawnPos = posMsg.pos;
|
||||
lootMsg.item = itemLOT;
|
||||
lootMsg.count = 1;
|
||||
lootMsg.currency = 0;
|
||||
Loot::DropItem(*owner, lootMsg, true, true);
|
||||
}
|
||||
|
||||
// Increment the current cycle
|
||||
|
@@ -10,8 +10,21 @@ void AgPicnicBlanket::OnUse(Entity* self, Entity* user) {
|
||||
return;
|
||||
self->SetVar<bool>(u"active", true);
|
||||
|
||||
auto lootTable = std::unordered_map<LOT, int32_t>{ {935, 3} };
|
||||
Loot::DropLoot(user, self->GetObjectID(), lootTable, 0, 0);
|
||||
GameMessages::GetPosition posMsg{};
|
||||
posMsg.target = self->GetObjectID();
|
||||
posMsg.Send();
|
||||
|
||||
for (int32_t i = 0; i < 3; i++) {
|
||||
GameMessages::DropClientLoot lootMsg{};
|
||||
lootMsg.target = user->GetObjectID();
|
||||
lootMsg.ownerID = user->GetObjectID();
|
||||
lootMsg.sourceID = self->GetObjectID();
|
||||
lootMsg.item = 935;
|
||||
lootMsg.count = 1;
|
||||
lootMsg.spawnPos = posMsg.pos;
|
||||
lootMsg.currency = 0;
|
||||
Loot::DropItem(*user, lootMsg, true);
|
||||
}
|
||||
|
||||
self->AddCallbackTimer(5.0f, [self]() {
|
||||
self->SetVar<bool>(u"active", false);
|
||||
|
@@ -415,9 +415,7 @@ void SGCannon::SpawnNewModel(Entity* self) {
|
||||
}
|
||||
|
||||
if (lootMatrix != 0) {
|
||||
std::unordered_map<LOT, int32_t> toDrop = {};
|
||||
toDrop = Loot::RollLootMatrix(player, lootMatrix);
|
||||
|
||||
const auto toDrop = Loot::RollLootMatrix(player, lootMatrix);
|
||||
for (const auto [lot, count] : toDrop) {
|
||||
GameMessages::SetModelToBuild modelToBuild{};
|
||||
modelToBuild.modelLot = lot;
|
||||
|
Reference in New Issue
Block a user