diff options
Diffstat (limited to 'src/server/game/Groups/Group.cpp')
-rwxr-xr-x | src/server/game/Groups/Group.cpp | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 1af656d7664..4c6b6249887 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -41,6 +41,7 @@ totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0), rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) { } + Roll::~Roll() { } @@ -170,7 +171,7 @@ void Group::LoadGroupFromDB(Field* fields) m_lootMethod = LootMethod(fields[1].GetUInt8()); m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); - m_lootThreshold = ItemQualities(fields[3].GetUInt16()); + m_lootThreshold = ItemQualities(fields[3].GetUInt8()); for (uint8 i = 0; i < TARGETICONCOUNT; ++i) m_targetIcons[i] = fields[4+i].GetUInt32(); @@ -728,13 +729,21 @@ void Group::Disband(bool hideDestroy /* = false */) if (!isBGGroup()) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM groups WHERE guid = %u", m_dbStoreId); - trans->PAppend("DELETE FROM group_member WHERE guid = %u", m_dbStoreId); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP); + stmt->setUInt32(0, m_dbStoreId); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL); + stmt->setUInt32(0, m_dbStoreId); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); + ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL); ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); stmt->setUInt32(0, m_dbStoreId); CharacterDatabase.Execute(stmt); @@ -779,7 +788,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, if (!p || !p->GetSession()) return; - WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1 )); + WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1)); data << uint64(r.itemGUID); // guid of rolled item data << uint32(mapId); // 3.3.3 mapid data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it??? @@ -843,28 +852,28 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb } } -void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r) +void Group::SendLootAllPassed(uint32 numberOfPlayers, Roll const& roll) { WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4)); - data << uint64(r.itemGUID); // Guid of the item rolled - data << uint32(NumberOfPlayers); // The number of players rolling for it??? - data << uint32(r.itemid); // The itemEntryId for the item that shall be rolled for - data << uint32(r.itemRandomPropId); // Item random property ID - data << uint32(r.itemRandomSuffix); // Item random suffix ID + data << uint64(roll.itemGUID); // Guid of the item rolled + data << uint32(numberOfPlayers); // The number of players rolling for it + data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for + data << uint32(roll.itemRandomPropId); // Item random property ID + data << uint32(roll.itemRandomSuffix); // Item random suffix ID - for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) + for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr) { - Player* p = ObjectAccessor::FindPlayer(itr->first); - if (!p || !p->GetSession()) + Player* player = ObjectAccessor::FindPlayer(itr->first); + if (!player || !player->GetSession()) continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket(&data); + player->GetSession()->SendPacket(&data); } } // notify group members which player is the allowed looter for the given creature -void Group::SendLooter(Creature* creature, Player* pLooter) +void Group::SendLooter(Creature* creature, Player* groupLooter) { ASSERT(creature); @@ -872,8 +881,8 @@ void Group::SendLooter(Creature* creature, Player* pLooter) data << uint64(creature->GetGUID()); data << uint8(0); // unk1 - if (pLooter) - data.append(pLooter->GetPackGUID()); + if (groupLooter) + data.append(groupLooter->GetPackGUID()); else data << uint8(0); @@ -1758,7 +1767,7 @@ bool Group::InCombatToInstance(uint32 instanceId) Player* player = itr->getSource(); if (player && !player->getAttackers().empty() && player->GetInstanceId() == instanceId && (player->GetMap()->IsRaidOrHeroicDungeon())) for (std::set<Unit*>::const_iterator i = player->getAttackers().begin(); i != player->getAttackers().end(); ++i) - if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) + if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) return true; } return false; @@ -2158,7 +2167,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG); stmt->setUInt8(0, slot->flags); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(1, GUID_LOPART(guid)); CharacterDatabase.Execute(stmt); |