Core/Loot: Skinning improvements

* Set skinnable flag only after all loot was taken
* Creatures are skinnable only once - after skinning, the player only has to loot the creature again if he did not take all skinning loot
This commit is contained in:
Shauren committed 2014-06-26 22:01:55 +02:00
1 parent 224b5c08df
commit 74850abcfc
8 files changed
+51 -74

No files matched your search

+15 -14
View File
@@ -8969,9 +8969,8 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (loot_type == LOOT_PICKPOCKETING)
{
if (!creature->lootForPickPocketed)
if (loot->loot_type != LOOT_PICKPOCKETING)
{
creature->lootForPickPocketed = true;
creature->StartPickPocketRefillTimer();
loot->clear();
@@ -8992,12 +8991,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (!recipient)
return;
if (!creature->lootForBody)
if (loot->loot_type == LOOT_NONE)
{
creature->lootForBody = true;
// for creature, loot is filled when creature is killed.
if (Group* group = recipient->GetGroup())
{
switch (group->GetLootMethod())
@@ -9018,15 +9014,17 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
}
}
// possible only if creature->lootForBody && loot->empty() at spell cast check
if (loot_type == LOOT_SKINNING)
// if loot is already skinning loot then don't do anything else
if (loot->loot_type == LOOT_SKINNING)
{
if (!creature->lootForSkinned)
{
creature->lootForSkinned = true;
loot->clear();
loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true);
}
loot_type = LOOT_SKINNING;
permission = creature->GetSkinner() == GetGUID() ? OWNER_PERMISSION : NONE_PERMISSION;
}
else if (loot_type == LOOT_SKINNING)
{
loot->clear();
loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true);
creature->SetSkinner(GetGUID());
permission = OWNER_PERMISSION;
}
// set group rights only for loot_type != LOOT_SKINNING
@@ -17835,6 +17833,9 @@ bool Player::isAllowedToLoot(const Creature* creature)
if (loot->isLooted()) // nothing to loot or everything looted.
return false;
if (loot->loot_type == LOOT_SKINNING)
return creature->GetSkinner() == GetGUID();
Group* thisGroup = GetGroup();
if (!thisGroup)
return this == creature->GetLootRecipient();