Groups are now stored by low guid in map

Creatures and gameobjects also store looting group by low guid instead of full guid

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-08-02 17:28:47 +02:00
parent 21db4757a9
commit 46c1a4640d
10 changed files with 36 additions and 52 deletions
@@ -140,7 +140,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
Creature::Creature() :
Unit(),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupGUID(0),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLowGUID(0),
m_lootMoney(0), m_lootRecipient(0),
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f),
m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false),
@@ -472,18 +472,18 @@ void Creature::Update(uint32 diff)
if (m_isDeadByDefault)
break;
if (m_groupLootTimer && lootingGroupGUID)
if (m_groupLootTimer && lootingGroupLowGUID)
{
// for delayed spells
m_Events.Update(diff);
if (m_groupLootTimer <= diff)
{
Group* group = objmgr.GetGroupByGUID(lootingGroupGUID);
Group* group = objmgr.GetGroupByGUID(lootingGroupLowGUID);
if (group)
group->EndRoll(&loot);
m_groupLootTimer = 0;
lootingGroupGUID = 0;
lootingGroupLowGUID = 0;
}
else m_groupLootTimer -= diff;
}
+1 -1
View File
@@ -611,7 +611,7 @@ class Creature : public Unit, public GridObject<Creature>
const CreatureData* GetLinkedRespawnCreatureData() const;
uint32 m_groupLootTimer; // (msecs)timer used for group loot
uint64 lootingGroupGUID; // used to find group which is looting corpse
uint32 lootingGroupLowGUID; // used to find group which is looting corpse
void SendZoneUnderAttackMessage(Player* attacker);
@@ -63,7 +63,7 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue)
m_rotation = 0;
m_groupLootTimer = 0;
lootingGroupGUID = 0;
lootingGroupLowGUID = 0;
ResetLootMode(); // restore default loot mode
}
@@ -444,11 +444,11 @@ void GameObject::Update(uint32 diff)
{
if (m_groupLootTimer <= diff)
{
Group* group = objmgr.GetGroupByGUID(lootingGroupGUID);
Group* group = objmgr.GetGroupByGUID(lootingGroupLowGUID);
if (group)
group->EndRoll(&loot);
m_groupLootTimer = 0;
lootingGroupGUID = 0;
lootingGroupLowGUID = 0;
}
else m_groupLootTimer -= diff;
}
@@ -719,7 +719,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
Loot loot;
uint32 m_groupLootTimer; // (msecs)timer used for group loot
uint64 lootingGroupGUID; // used to find group which is looting
uint32 lootingGroupLowGUID; // used to find group which is looting
bool hasQuest(uint32 quest_id) const;
bool hasInvolvedQuest(uint32 quest_id) const;
+1 -1
View File
@@ -628,7 +628,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
dynamicFlags &= ~UNIT_DYNFLAG_TAPPED_BY_PLAYER;
}
if (!target->isAllowedToLoot(ToCreature()))
if (!target->isAllowedToLoot(creature))
dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
}
+2 -6
View File
@@ -4384,11 +4384,8 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// the player was uninvited already on logout so just remove from group
QueryResult_AutoPtr resultGroup = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", guid);
if (resultGroup)
{
uint64 guid = MAKE_NEW_GUID((*resultGroup)[0].GetUInt32(), 0, HIGHGUID_GROUP);
if (Group* group = objmgr.GetGroupByGUID(guid))
if (Group* group = objmgr.GetGroupByGUID((*resultGroup)[0].GetUInt32()))
RemoveFromGroup(group, playerguid);
}
// Remove signs from petitions (also remove petitions if owner);
RemovePetitionsAndSigns(playerguid, 10);
@@ -17203,8 +17200,7 @@ void Player::_LoadGroup(QueryResult_AutoPtr result)
//QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", GetGUIDLow());
if (result)
{
uint64 guid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_GROUP);
if (Group* group = objmgr.GetGroupByGUID(guid))
if (Group* group = objmgr.GetGroupByGUID((*result)[0].GetUInt32()))
{
uint8 subgroup = group->GetMemberGroup(GetGUID());
SetGroup(group, subgroup);