Core/Loot: Reverted part of revision fe39cb058b75, fixes skinning loot

Core/Loot: Some logic fixes for group looting
Buildsystem/MSVC: Fixed compile warning
Config: Added missing description for Rate.Drop.Item.ReferencedAmount

Closes issue #4004.

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-09-15 13:44:40 +02:00
parent e550494338
commit a72fc44f9a
5 changed files with 31 additions and 25 deletions

View File

@@ -11,7 +11,7 @@
if( CMAKE_COMPILER_IS_GNUCXX )
add_definitions(--no-warnings)
elseif( MSVC )
add_definitions( /w )
add_definitions(/W0)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")

View File

@@ -946,8 +946,16 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3
Player *Creature::GetLootRecipient() const
{
if (!m_lootRecipient) return NULL;
else return ObjectAccessor::FindPlayer(m_lootRecipient);
if (!m_lootRecipient)
return NULL;
return ObjectAccessor::FindPlayer(m_lootRecipient);
}
Group *Creature::GetLootRecipientGroup() const
{
if (!m_lootRecipientGroup)
return NULL;
return sObjectMgr.GetGroupByGUID(m_lootRecipientGroup);
}
void Creature::SetLootRecipient(Unit *unit)
@@ -971,6 +979,9 @@ void Creature::SetLootRecipient(Unit *unit)
return;
m_lootRecipient = player->GetGUID();
if (Group *group = player->GetGroup())
m_lootRecipientGroup = group->GetLowGUID();
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED);
}
@@ -980,17 +991,9 @@ bool Creature::isTappedBy(Player *player) const
if (player->GetGUID() == m_lootRecipient)
return true;
Player* recipient = GetLootRecipient();
if (!recipient)
return false; // recipient exist but is offline. can't check any further.
Group* recipientGroup = recipient->GetGroup();
if (!recipientGroup)
return (player == recipient);
Group* playerGroup = player->GetGroup();
if (!playerGroup || playerGroup != recipientGroup)
return false;
if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
return false; // if creature doesnt have group bound it means it was solo killed by someone else
return true;
}

View File

@@ -541,7 +541,8 @@ class Creature : public Unit, public GridObject<Creature>
bool lootForPickPocketed;
bool lootForBody;
Player *GetLootRecipient() const;
bool hasLootRecipient() const { return m_lootRecipient != 0; }
Group *GetLootRecipientGroup() const;
bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
bool isTappedBy(Player *player) const; // return true if the creature is tapped by the player or a member of his party.
void SetLootRecipient (Unit* unit);
@@ -682,6 +683,7 @@ class Creature : public Unit, public GridObject<Creature>
uint32 m_lootMoney;
uint64 m_lootRecipient;
uint32 m_lootRecipientGroup;
/// Timers
time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance

View File

@@ -8458,10 +8458,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
}
else
{
// the player whose group may loot the corpse
Player *recipient = creature->GetLootRecipient();
if (!recipient)
return;
{
creature->SetLootRecipient(this);
recipient = this;
}
if (!creature->lootForBody)
{
@@ -16488,16 +16491,10 @@ bool Player::isAllowedToLoot(const Creature* creature)
if (loot->isLooted()) // nothing to loot or everything looted.
return false;
Player* recipient = creature->GetLootRecipient();
if (!recipient)
return false;
Group* recipientGroup = recipient->GetGroup();
if (!recipientGroup)
return (this == recipient);
Group* thisGroup = GetGroup();
if (!thisGroup || thisGroup != recipientGroup)
if (!thisGroup)
return this == creature->GetLootRecipient();
else if (thisGroup != creature->GetLootRecipientGroup())
return false;
switch(thisGroup->GetLootMethod())

View File

@@ -1489,6 +1489,10 @@ Visibility.Notify.Period.InBGArenas = 1000
# Drop rates (items by quality and money)
# Default: 1
#
# Rate.Drop.Item.ReferencedAmount
# Multiplier for referenced loot
# Default: 1
#
# Rate.Drop.Money
# Drop rates
# Default: 1