aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <none@none>2010-09-15 13:44:40 +0200
committerShauren <none@none>2010-09-15 13:44:40 +0200
commita72fc44f9a86d5016b00dbb472e6e4f795a59a17 (patch)
tree102ce1b1ac44f57698e04c9722f7eff7a44798e6 /src
parente55049433818c5b7250f87a2ee9f97b58502df19 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp27
-rw-r--r--src/server/game/Entities/Creature/Creature.h4
-rw-r--r--src/server/game/Entities/Player/Player.cpp19
-rw-r--r--src/server/worldserver/worldserver.conf.dist4
4 files changed, 30 insertions, 24 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 749cfbc310e..6cc80f74fd6 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -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;
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index eb4f15e19ce..13c9639687c 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -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
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 6cdadb9a989..8223959fc14 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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())
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 451ab7efb9b..5ca53cdf61e 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -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