Core/Loot
* Master Looter cannot freely loot items under threshold * Update round robin looter only if loot is not empty * Fixed loot bag icon appearing in raid frames when loot method was not Master Looter * Fixed changing loot method reseting current round robin looter
This commit is contained in:
1 parent
dee867547d
commit
3fd6dd6175
6 files changed
+41
-58
No files matched your search
File renamed without changes.
@@ -8796,7 +8796,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||
loot->FillLoot(lootid, LootTemplates_Gameobject, this, !groupRules, false, go->GetLootMode());
|
||||
|
||||
// get next RR player (for next loot)
|
||||
if (groupRules)
|
||||
if (groupRules && !go->loot.empty())
|
||||
group->UpdateLooterGuid(go);
|
||||
}
|
||||
|
||||
@@ -17805,10 +17805,6 @@ bool Player::isAllowedToLoot(const Creature* creature)
|
||||
|
||||
return loot->hasItemFor(this);
|
||||
case MASTER_LOOT:
|
||||
// may loot if the player is the master looter
|
||||
if (thisGroup->GetMasterLooterGuid() == GetGUID())
|
||||
return true;
|
||||
// fall-through
|
||||
case GROUP_LOOT:
|
||||
case NEED_BEFORE_GREED:
|
||||
// may only loot if the player is the loot roundrobin player
|
||||
|
||||
@@ -15159,8 +15159,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
data << uint64(victim->GetGUID()); // victim
|
||||
|
||||
Player* looter = player;
|
||||
Group* group = player->GetGroup();
|
||||
bool hasLooterGuid = false;
|
||||
|
||||
if (Group* group = player->GetGroup())
|
||||
if (group)
|
||||
{
|
||||
group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID()));
|
||||
|
||||
@@ -15172,16 +15174,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
|
||||
if (looter)
|
||||
{
|
||||
hasLooterGuid = true;
|
||||
creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
|
||||
group->SendLooter(creature, looter);
|
||||
}
|
||||
else
|
||||
group->SendLooter(creature, NULL);
|
||||
}
|
||||
else
|
||||
group->SendLooter(creature, NULL);
|
||||
|
||||
group->UpdateLooterGuid(creature);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -15198,6 +15194,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
}
|
||||
}
|
||||
|
||||
// Generate loot before updating looter
|
||||
if (creature)
|
||||
{
|
||||
Loot* loot = &creature->loot;
|
||||
@@ -15209,6 +15206,18 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode());
|
||||
|
||||
loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold);
|
||||
|
||||
if (group)
|
||||
{
|
||||
if (hasLooterGuid)
|
||||
group->SendLooter(creature, looter);
|
||||
else
|
||||
group->SendLooter(creature, NULL);
|
||||
|
||||
// Update round robin looter only if the creature had loot
|
||||
if (!creature->loot.empty())
|
||||
group->UpdateLooterGuid(creature);
|
||||
}
|
||||
}
|
||||
|
||||
player->RewardPlayerAndGroupAtKill(victim, false);
|
||||
|
||||
@@ -895,7 +895,7 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
|
||||
WorldPacket data(SMSG_LOOT_LIST, (8+8));
|
||||
data << uint64(creature->GetGUID());
|
||||
|
||||
if (GetLootMethod() == MASTER_LOOT)
|
||||
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
|
||||
data.appendPackGUID(GetMasterLooterGuid());
|
||||
else
|
||||
data << uint8(0);
|
||||
@@ -1549,7 +1549,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
|
||||
if (m_lootMethod == MASTER_LOOT)
|
||||
data << uint64(m_masterLooterGuid); // master looter guid
|
||||
else
|
||||
data << uint64(m_looterGuid); // looter guid
|
||||
data << uint64(0);
|
||||
|
||||
data << uint8(m_lootThreshold); // loot threshold
|
||||
data << uint8(m_dungeonDifficulty); // Dungeon Difficulty
|
||||
|
||||
@@ -439,7 +439,6 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
|
||||
// everything's fine, do it
|
||||
group->SetLootMethod((LootMethod)lootMethod);
|
||||
group->SetMasterLooterGuid(lootMaster);
|
||||
group->SetLooterGuid(lootMaster);
|
||||
group->SetLootThreshold((ItemQualities)lootThreshold);
|
||||
group->SendUpdate();
|
||||
}
|
||||
|
||||
@@ -879,6 +879,8 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||
switch (lv.permission)
|
||||
{
|
||||
case GROUP_PERMISSION:
|
||||
case MASTER_PERMISSION:
|
||||
case RESTRICTED_PERMISSION:
|
||||
{
|
||||
// if you are not the round-robin group looter, you can only see
|
||||
// blocked rolled items and quest items, and !ffa items
|
||||
@@ -888,9 +890,24 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||
{
|
||||
uint8 slot_type;
|
||||
|
||||
if (l.items[i].is_blocked)
|
||||
slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING;
|
||||
else if (l.roundRobinPlayer == 0 || !l.items[i].is_underthreshold || lv.viewer->GetGUID() == l.roundRobinPlayer)
|
||||
if (l.items[i].is_blocked) // for ML & restricted is_blocked = !is_underthreshold
|
||||
{
|
||||
switch (lv.permission)
|
||||
{
|
||||
case GROUP_PERMISSION:
|
||||
slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING;
|
||||
break;
|
||||
case MASTER_PERMISSION:
|
||||
slot_type = LOOT_SLOT_TYPE_MASTER;
|
||||
break;
|
||||
case RESTRICTED_PERMISSION:
|
||||
slot_type = LOOT_SLOT_TYPE_LOCKED;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold)
|
||||
{
|
||||
// no round robin owner or he has released the loot
|
||||
// or it IS the round robin group owner
|
||||
@@ -926,22 +943,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||
break;
|
||||
}
|
||||
case ALL_PERMISSION:
|
||||
case MASTER_PERMISSION:
|
||||
case OWNER_PERMISSION:
|
||||
{
|
||||
uint8 slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
|
||||
switch (lv.permission)
|
||||
{
|
||||
case MASTER_PERMISSION:
|
||||
slot_type = LOOT_SLOT_TYPE_MASTER;
|
||||
break;
|
||||
case OWNER_PERMISSION:
|
||||
slot_type = LOOT_SLOT_TYPE_OWNER;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint8 slot_type = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
|
||||
for (uint8 i = 0; i < l.items.size(); ++i)
|
||||
{
|
||||
if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
|
||||
@@ -953,31 +957,6 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RESTRICTED_PERMISSION:
|
||||
{
|
||||
for (uint8 i = 0; i < l.items.size(); ++i)
|
||||
{
|
||||
if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
|
||||
{
|
||||
uint8 slot_type;
|
||||
|
||||
if (l.items[i].is_blocked)
|
||||
slot_type = LOOT_SLOT_TYPE_LOCKED;
|
||||
else
|
||||
{
|
||||
if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer)
|
||||
slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
|
||||
else
|
||||
continue; // item shall not be displayed
|
||||
}
|
||||
|
||||
b << uint8(i) << l.items[i];
|
||||
b << uint8(slot_type);
|
||||
++itemsShown;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return b;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user