diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 24 | ||||
-rw-r--r-- | src/server/game/Groups/Group.cpp | 156 | ||||
-rw-r--r-- | src/server/game/Groups/Group.h | 1 | ||||
-rw-r--r-- | src/server/game/Handlers/GroupHandler.cpp | 12 | ||||
-rw-r--r-- | src/server/game/Loot/LootMgr.cpp | 24 | ||||
-rw-r--r-- | src/server/game/Loot/LootMgr.h | 3 |
6 files changed, 15 insertions, 205 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ffd7740f258..7c9670bd732 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8130,9 +8130,6 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) // GroupLoot: rolls items over threshold. Items with quality < threshold, round robin group->GroupLoot(loot, go); break; - case NEED_BEFORE_GREED: - group->NeedBeforeGreed(loot, go); - break; case MASTER_LOOT: group->MasterLoot(loot, go); break; @@ -8157,9 +8154,6 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) case FREE_FOR_ALL: permission = ALL_PERMISSION; break; - case ROUND_ROBIN: - permission = ROUND_ROBIN_PERMISSION; - break; default: permission = GROUP_PERMISSION; break; @@ -8306,9 +8300,6 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) // GroupLoot: rolls items over threshold. Items with quality < threshold, round robin group->GroupLoot(loot, creature); break; - case NEED_BEFORE_GREED: - group->NeedBeforeGreed(loot, creature); - break; case MASTER_LOOT: group->MasterLoot(loot, creature); break; @@ -8346,9 +8337,6 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) case FREE_FOR_ALL: permission = ALL_PERMISSION; break; - case ROUND_ROBIN: - permission = ROUND_ROBIN_PERMISSION; - break; default: permission = GROUP_PERMISSION; break; @@ -11355,7 +11343,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const InventoryResult Player::CanUseItem(ItemTemplate const* proto) const { - // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player + // Used by group, function GroupLoot, to know if a prototype can be used by a player if (!proto) return EQUIP_ERR_ITEM_NOT_FOUND; @@ -11415,7 +11403,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje if (!proto) return EQUIP_ERR_ITEM_NOT_FOUND; - // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player + // Used by group, function GroupLoot, to know if a prototype can be used by a player if ((proto->GetAllowableClass() & getClassMask()) == 0 || (proto->GetAllowableRace() & getRaceMask()) == 0) return EQUIP_ERR_CANT_EQUIP_EVER; @@ -17821,15 +17809,7 @@ bool Player::isAllowedToLoot(const Creature* creature) case MASTER_LOOT: case FREE_FOR_ALL: return true; - case ROUND_ROBIN: - // may only loot if the player is the loot roundrobin player - // or if there are free/quest/conditional item for the player - if (loot->roundRobinPlayer.IsEmpty() || loot->roundRobinPlayer == GetGUID()) - return true; - - return loot->hasItemFor(this); case GROUP_LOOT: - case NEED_BEFORE_GREED: // may only loot if the player is the loot roundrobin player // or item over threshold (so roll(s) can be launched) // or if there are free/quest/conditional item for the player diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 594284d8fc8..bd19b6bb04c 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -227,7 +227,7 @@ void Group::LoadMemberFromDB(ObjectGuid::LowType guidLow, uint8 memberFlags, uin void Group::ConvertToLFG() { m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_LFG_RESTRICTED); - m_lootMethod = NEED_BEFORE_GREED; + m_lootMethod = GROUP_LOOT; if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE); @@ -978,159 +978,7 @@ void Group::SendLooter(Creature* creature, Player* groupLooter) BroadcastPacket(lootList.Write(), false); } -void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) -{ - std::vector<LootItem>::iterator i; - ItemTemplate const* item; - uint8 itemSlot = 0; - - for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) - { - if (i->freeforall) - continue; - - item = sObjectMgr->GetItemTemplate(i->itemid); - if (!item) - { - //TC_LOG_DEBUG("misc", "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); - continue; - } - - //roll for over-threshold item if it's one-player loot - if (item->GetQuality() >= uint32(m_lootThreshold)) - { - ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate()); - Roll* r = new Roll(newitemGUID, *i); - - //a vector is filled with only near party members - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* member = itr->GetSource(); - if (!member || !member->GetSession()) - continue; - if (i->AllowedForPlayer(member)) - { - if (member->IsAtGroupRewardDistance(pLootedObject)) - { - r->totalPlayersRolling++; - - if (member->GetPassOnGroupLoot()) - { - r->playerVote[member->GetGUID()] = PASS; - r->totalPass++; - // can't broadcast the pass now. need to wait until all rolling players are known. - } - else - r->playerVote[member->GetGUID()] = NOT_EMITED_YET; - } - } - } - - if (r->totalPlayersRolling > 0) - { - r->setLoot(loot); - r->itemSlot = itemSlot; - if (item->DisenchantID && m_maxEnchantingLevel >= item->RequiredDisenchantSkill) - r->rollVoteMask |= ROLL_FLAG_TYPE_DISENCHANT; - - loot->items[itemSlot].is_blocked = true; - - // If there is any "auto pass", broadcast the pass now. - if (r->totalPass) - { - for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr) - { - Player* p = ObjectAccessor::FindConnectedPlayer(itr->first); - if (!p || !p->GetSession()) - continue; - - if (itr->second == PASS) - SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r); - } - } - - SendLootStartRoll(60000, pLootedObject->GetMapId(), *r); - - RollId.push_back(r); - - if (Creature* creature = pLootedObject->ToCreature()) - { - creature->m_groupLootTimer = 60000; - creature->lootingGroupLowGUID = GetGUID(); - } - else if (GameObject* go = pLootedObject->ToGameObject()) - { - go->m_groupLootTimer = 60000; - go->lootingGroupLowGUID = GetGUID(); - } - } - else - delete r; - } - else - i->is_underthreshold = true; - } - - for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot) - { - if (!i->follow_loot_rules) - continue; - - item = sObjectMgr->GetItemTemplate(i->itemid); - if (!item) - { - //TC_LOG_DEBUG("misc", "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); - continue; - } - - ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate()); - Roll* r = new Roll(newitemGUID, *i); - - //a vector is filled with only near party members - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* member = itr->GetSource(); - if (!member || !member->GetSession()) - continue; - - if (i->AllowedForPlayer(member)) - { - if (member->IsAtGroupRewardDistance(pLootedObject)) - { - r->totalPlayersRolling++; - r->playerVote[member->GetGUID()] = NOT_EMITED_YET; - } - } - } - - if (r->totalPlayersRolling > 0) - { - r->setLoot(loot); - r->itemSlot = itemSlot; - - loot->quest_items[itemSlot - loot->items.size()].is_blocked = true; - - SendLootStartRoll(60000, pLootedObject->GetMapId(), *r); - - RollId.push_back(r); - - if (Creature* creature = pLootedObject->ToCreature()) - { - creature->m_groupLootTimer = 60000; - creature->lootingGroupLowGUID = GetGUID(); - } - else if (GameObject* go = pLootedObject->ToGameObject()) - { - go->m_groupLootTimer = 60000; - go->lootingGroupLowGUID = GetGUID(); - } - } - else - delete r; - } -} - -void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) +void Group::GroupLoot(Loot* loot, WorldObject* lootedObject) { ItemTemplate const* item; uint8 itemSlot = 0; diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index a417138a2b2..1f0515c8d8f 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -360,7 +360,6 @@ class TC_GAME_API Group void SendLootAllPassed(Roll const& roll); void SendLooter(Creature* creature, Player* pLooter); void GroupLoot(Loot* loot, WorldObject* pLootedObject); - void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject); void MasterLoot(Loot* loot, WorldObject* pLootedObject); Rolls::iterator GetRoll(ObjectGuid Guid); void CountTheRoll(Rolls::iterator roll); diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 89c41496827..7a148ff624c 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -348,8 +348,16 @@ void WorldSession::HandleSetLootMethodOpcode(WorldPackets::Party::SetLootMethod& if (!group->IsLeader(GetPlayer()->GetGUID())) return; - if (packet.LootMethod > PERSONAL_LOOT) - return; + switch (packet.LootMethod) + { + case FREE_FOR_ALL: + case MASTER_LOOT: + case GROUP_LOOT: + case PERSONAL_LOOT: + break; + default: + return; + } if (packet.LootThreshold < ITEM_QUALITY_UNCOMMON || packet.LootThreshold > ITEM_QUALITY_ARTIFACT) return; diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index abf20d1920a..40b08e5f57d 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -576,7 +576,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) // increase once if one looter only, looter-times if free for all if (item.freeforall || !item.is_blocked) ++unlootedCount; - if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT && player->GetGroup()->GetLootMethod() != ROUND_ROBIN)) + if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT)) item.is_blocked = true; if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS) @@ -922,26 +922,6 @@ void Loot::BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* v } break; } - case ROUND_ROBIN_PERMISSION: - { - for (uint8 i = 0; i < items.size(); ++i) - { - if (!items[i].is_looted && !items[i].freeforall && items[i].conditions.empty() && items[i].AllowedForPlayer(viewer)) - { - if (!roundRobinPlayer.IsEmpty() && viewer->GetGUID() != roundRobinPlayer) - // item shall not be displayed. - continue; - - WorldPackets::Loot::LootItemData lootItem; - lootItem.LootListID = packet.Items.size()+1; - lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT; - lootItem.Quantity = items[i].count; - lootItem.Loot.Initialize(items[i]); - packet.Items.push_back(lootItem); - } - } - break; - } case ALL_PERMISSION: case OWNER_PERMISSION: { @@ -990,7 +970,6 @@ void Loot::BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* v lootItem.UIType = item.is_blocked ? LOOT_SLOT_TYPE_LOCKED : LOOT_SLOT_TYPE_ALLOW_LOOT; break; case GROUP_PERMISSION: - case ROUND_ROBIN_PERMISSION: if (!item.is_blocked) lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT; else @@ -1055,7 +1034,6 @@ void Loot::BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* v lootItem.UIType = item.is_blocked ? LOOT_SLOT_TYPE_LOCKED : LOOT_SLOT_TYPE_ALLOW_LOOT; break; case GROUP_PERMISSION: - case ROUND_ROBIN_PERMISSION: if (!item.is_blocked) lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT; else diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index f7c1085eaad..4fea6967ef4 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -65,10 +65,8 @@ enum RollMask enum LootMethod : uint8 { FREE_FOR_ALL = 0, - ROUND_ROBIN = 1, MASTER_LOOT = 2, GROUP_LOOT = 3, - NEED_BEFORE_GREED = 4, PERSONAL_LOOT = 5 }; @@ -78,7 +76,6 @@ enum PermissionTypes GROUP_PERMISSION = 1, MASTER_PERMISSION = 2, RESTRICTED_PERMISSION = 3, - ROUND_ROBIN_PERMISSION = 4, OWNER_PERMISSION = 5, NONE_PERMISSION = 6 }; |