[Loot] Add #lootsim (Loot Simulator) command (#2375)

* [Loot] Add #lootsim (Loot Simulator) command

* Validation

* Add global loot
This commit is contained in:
Chris Miles
2022-08-20 01:16:09 -07:00
committed by GitHub
parent 6232a64cdb
commit 607871a7ac
6 changed files with 252 additions and 5 deletions
+33
View File
@@ -264,6 +264,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
HasAISpell = false;
HasAISpellEffects = false;
innate_proc_spell_id = 0;
m_record_loot_stats = false;
if (GetClass() == MERCENARY_MASTER && RuleB(Mercs, AllowMercs)) {
LoadMercTypes();
@@ -3689,3 +3690,35 @@ std::vector<int> NPC::GetLootList() {
}
return npc_items;
}
bool NPC::IsRecordLootStats() const
{
return m_record_loot_stats;
}
void NPC::SetRecordLootStats(bool record_loot_stats)
{
NPC::m_record_loot_stats = record_loot_stats;
}
void NPC::FlushLootStats()
{
m_rolled_items = {};
}
const std::vector<uint32> &NPC::GetRolledItems() const
{
return m_rolled_items;
}
int NPC::GetRolledItemCount(uint32 item_id)
{
int rolled_count = 0;
for (auto &e: m_rolled_items) {
if (item_id == e) {
rolled_count++;
}
}
return rolled_count;
}