Skip to content

Commit

Permalink
Fixed items despawning when looting money from reward chest.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchyDev committed Oct 24, 2023
1 parent ad6b0d7 commit 7a2ad09
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scripts/ToSInstanceScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ void ToSInstanceScript::PopulateRewardChest()
}

Position* tempPos = new Position(255.194, -99.974, 18.677, 6.270);
if ((rewardChest = instance->SummonGameObject(TOS_GOB_REWARD_CHEST, *tempPos)))
if ((rewardChest = instance->SummonGameObject(TOS_GOB_REWARD_CHEST, *tempPos, 0.0, 0.0, 0.0, 0.0, 0, true)))
{
rewardChest->loot.clear();
rewardChest->SetLootRecipient(instance);
Expand All @@ -731,6 +731,8 @@ void ToSInstanceScript::PopulateRewardChest()
lootItem.itemid = rewardTemplate->itemEntry;
lootItem.count = urand(rewardTemplate->countMin, rewardTemplate->countMax);

rewardChest->loot.unlootedCount += 1;

rewardChest->loot.items.push_back(lootItem);
}

Expand Down Expand Up @@ -875,7 +877,7 @@ void ToSInstanceScript::CleanupGameObjects()
if (rewardChest &&
rewardChest->IsInWorld())
{
rewardChest->DespawnOrUnsummon();
rewardChest->Delete();
rewardChest = nullptr;
}
}
Expand Down

0 comments on commit 7a2ad09

Please sign in to comment.