mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-02 01:47:13 +00:00
fix(loot): drop the coins before the items
Live sent a drop's currency DropClientLoot before its item drops in 1498 of 1502 live drop groups that had both. DLU sent the coins last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -363,31 +363,7 @@ void DropLoot(Entity* player, const LWOOBJID source, const std::map<LOT, LootDro
|
|||||||
if (info.count > 0) EconomyLedger::RecordMapEvent(IEconomyLedger::eMapEvent::ITEM_DROPS, lootLot, spawnPosition, info.count, player);
|
if (info.count > 0) EconomyLedger::RecordMapEvent(IEconomyLedger::eMapEvent::ITEM_DROPS, lootLot, spawnPosition, info.count, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr LOT TOKEN_PROXY = 13763;
|
// Live sent the coins before the items (1498 of 1502 live drops with both)
|
||||||
// Go through the drops 1 at a time to drop them
|
|
||||||
for (auto it = rolledItems.begin(); it != rolledItems.end(); it++) {
|
|
||||||
auto& [lootLot, info] = *it;
|
|
||||||
for (int i = 0; i < info.count; i++) {
|
|
||||||
GameMessages::DropClientLoot lootMsg{};
|
|
||||||
lootMsg.spawnPos = spawnPosition;
|
|
||||||
lootMsg.sourceID = source;
|
|
||||||
lootMsg.item = lootLot;
|
|
||||||
lootMsg.count = 1;
|
|
||||||
lootMsg.currency = 0;
|
|
||||||
const CDObjects& object = objectsTable->GetByID(lootLot);
|
|
||||||
|
|
||||||
if (lootLot == TOKEN_PROXY) {
|
|
||||||
team ? DropFactionLoot(*team, lootMsg, noTeamLootOnDeath) : DropFactionLoot(*player, lootMsg);
|
|
||||||
} else if (info.table.MissionDrop) {
|
|
||||||
team ? DropMissionLoot(*team, lootMsg, noTeamLootOnDeath) : DropMissionLoot(*player, lootMsg);
|
|
||||||
} else if (object.type == "Powerup") {
|
|
||||||
team ? DropPowerupLoot(*team, lootMsg, noTeamLootOnDeath) : DropPowerupLoot(*player, lootMsg);
|
|
||||||
} else {
|
|
||||||
team ? DropRegularLoot(*team, lootMsg, noTeamLootOnDeath) : DropRegularLoot(*player, lootMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out dead player if we need to
|
// Filter out dead player if we need to
|
||||||
std::vector<LWOOBJID> lootEarners;
|
std::vector<LWOOBJID> lootEarners;
|
||||||
if (team) {
|
if (team) {
|
||||||
@@ -429,6 +405,32 @@ void DropLoot(Entity* player, const LWOOBJID source, const std::map<LOT, LootDro
|
|||||||
const auto* const memberEntity = Game::entityManager->GetEntity(member);
|
const auto* const memberEntity = Game::entityManager->GetEntity(member);
|
||||||
if (memberEntity) lootMsg.Send(memberEntity->GetSystemAddress());
|
if (memberEntity) lootMsg.Send(memberEntity->GetSystemAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr LOT TOKEN_PROXY = 13763;
|
||||||
|
// Go through the drops 1 at a time to drop them
|
||||||
|
for (auto it = rolledItems.begin(); it != rolledItems.end(); it++) {
|
||||||
|
auto& [lootLot, info] = *it;
|
||||||
|
for (int i = 0; i < info.count; i++) {
|
||||||
|
GameMessages::DropClientLoot lootMsg{};
|
||||||
|
lootMsg.spawnPos = spawnPosition;
|
||||||
|
lootMsg.sourceID = source;
|
||||||
|
lootMsg.item = lootLot;
|
||||||
|
lootMsg.count = 1;
|
||||||
|
lootMsg.currency = 0;
|
||||||
|
const CDObjects& object = objectsTable->GetByID(lootLot);
|
||||||
|
|
||||||
|
if (lootLot == TOKEN_PROXY) {
|
||||||
|
team ? DropFactionLoot(*team, lootMsg, noTeamLootOnDeath) : DropFactionLoot(*player, lootMsg);
|
||||||
|
} else if (info.table.MissionDrop) {
|
||||||
|
team ? DropMissionLoot(*team, lootMsg, noTeamLootOnDeath) : DropMissionLoot(*player, lootMsg);
|
||||||
|
} else if (object.type == "Powerup") {
|
||||||
|
team ? DropPowerupLoot(*team, lootMsg, noTeamLootOnDeath) : DropPowerupLoot(*player, lootMsg);
|
||||||
|
} else {
|
||||||
|
team ? DropRegularLoot(*team, lootMsg, noTeamLootOnDeath) : DropRegularLoot(*player, lootMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loot::DropItem(Entity& player, GameMessages::DropClientLoot& lootMsg, bool useTeam, bool forceFfa) {
|
void Loot::DropItem(Entity& player, GameMessages::DropClientLoot& lootMsg, bool useTeam, bool forceFfa) {
|
||||||
|
|||||||
Reference in New Issue
Block a user