fix(Core/Loot): (#7452)

- Players that did not participate in killing dungeon boss are not eligible to get loot.
- Players that are too far away from the looted object are not eligible to get loot.
- Players that released spirit and were outside the dungeon when the loot has been released are eligible to get loot.
- Players that have pending bind are not eligible to get loot.
- Properly get loot recipient for some chests in dungeons.
- All above fixes should work in any loot mode (group loot, master loot, etc.)
- Closes #2104.
This commit is contained in:
UltraNix
2021-08-24 23:48:22 +02:00
committed by GitHub
parent a594bf5b29
commit 1b7d3708a6
19 changed files with 197 additions and 97 deletions

View File

@@ -425,17 +425,10 @@ public:
cacheEntry = GO_CRUSADERS_CACHE_25_H;
break;
}
if (GameObject* go = c->SummonGameObject(cacheEntry, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 630000000))
{
Map::PlayerList const& pl = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* plr = itr->GetSource())
if (Group* g = plr->GetGroup())
if (!plr->IsGameMaster() && g->GetLeaderGUID() == plr->GetGUID())
{
go->SetLootRecipient(plr);
break;
}
go->SetLootRecipient(instance);
}
}
@@ -1375,16 +1368,7 @@ public:
if (GameObject* chest = c->SummonGameObject(tributeChest, 665.12f, 143.78f, 142.12f, 0.0f, 0, 0, 0, 0, 90000000))
{
chest->SetRespawnTime(chest->GetRespawnDelay());
Map::PlayerList const& pl = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* plr = itr->GetSource())
if (Group* g = plr->GetGroup())
if (!plr->IsGameMaster() && g->GetLeaderGUID() == plr->GetGUID())
{
chest->SetLootRecipient(plr);
break;
}
chest->SetLootRecipient(instance);
}
}
}

View File

@@ -760,7 +760,7 @@ public:
case GO_CACHE_OF_THE_DREAMWALKER_10H:
case GO_CACHE_OF_THE_DREAMWALKER_25H:
if (Creature* valithria = instance->GetCreature(ValithriaDreamwalkerGUID))
go->SetLootRecipient(valithria->GetLootRecipient());
go->SetLootRecipient(valithria);
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN);
break;
case GO_SCOURGE_TRANSPORTER_LK:
@@ -1029,14 +1029,7 @@ public:
{
if (GameObject* loot = instance->GetGameObject(GunshipArmoryGUID))
{
Map::PlayerList const& pl = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* p = itr->GetSource())
if (!p->IsGameMaster() && p->GetGroup() && p->GetGroup()->isRaidGroup())
{
loot->SetLootRecipient(p);
break;
}
loot->SetLootRecipient(instance);
loot->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN);
}
}
@@ -1050,7 +1043,7 @@ public:
if (GameObject* loot = instance->GetGameObject(DeathbringersCacheGUID))
{
if (Creature* deathbringer = instance->GetCreature(DeathbringerSaurfangGUID))
loot->SetLootRecipient(deathbringer->GetLootRecipient());
loot->SetLootRecipient(deathbringer);
loot->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN);
}
[[fallthrough]];

View File

@@ -211,7 +211,7 @@ public:
c->SetLootMode(1);
c->loot.clear();
if (uint32 lootid = c->GetCreatureTemplate()->lootid)
c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode());
c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode(), c);
if (c->GetLootMode())
c->loot.generateMoneyLoot(c->GetCreatureTemplate()->mingold, c->GetCreatureTemplate()->maxgold);
c->DestroyForNearbyPlayers();
@@ -226,7 +226,7 @@ public:
c->SetLootMode(1);
c->loot.clear();
if (uint32 lootid = c->GetCreatureTemplate()->lootid)
c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode());
c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode(), c);
if (c->GetLootMode())
c->loot.generateMoneyLoot(c->GetCreatureTemplate()->mingold, c->GetCreatureTemplate()->maxgold);
c->DestroyForNearbyPlayers();