Conflicts:
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Player/Player.h
	src/server/game/Scripting/MapScripts.cpp
	src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
	src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
	src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
	src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
	src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
	src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
	src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
	src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
	src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
	src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
	src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
	src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
	src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
	src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
This commit is contained in:
Shauren
2014-09-16 21:50:01 +02:00
545 changed files with 6733 additions and 7486 deletions
+8 -8
View File
@@ -1621,14 +1621,14 @@ CREATE TABLE `groups` (
`lootMethod` tinyint(3) unsigned NOT NULL,
`looterGuid` int(10) unsigned NOT NULL,
`lootThreshold` tinyint(3) unsigned NOT NULL,
`icon1` int(10) unsigned NOT NULL,
`icon2` int(10) unsigned NOT NULL,
`icon3` int(10) unsigned NOT NULL,
`icon4` int(10) unsigned NOT NULL,
`icon5` int(10) unsigned NOT NULL,
`icon6` int(10) unsigned NOT NULL,
`icon7` int(10) unsigned NOT NULL,
`icon8` int(10) unsigned NOT NULL,
`icon1` bigint(20) unsigned NOT NULL,
`icon2` bigint(20) unsigned NOT NULL,
`icon3` bigint(20) unsigned NOT NULL,
`icon4` bigint(20) unsigned NOT NULL,
`icon5` bigint(20) unsigned NOT NULL,
`icon6` bigint(20) unsigned NOT NULL,
`icon7` bigint(20) unsigned NOT NULL,
`icon8` bigint(20) unsigned NOT NULL,
`groupType` tinyint(3) unsigned NOT NULL,
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
`raiddifficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
@@ -0,0 +1,9 @@
ALTER TABLE `groups`
MODIFY `icon1` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon2` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon3` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon4` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon5` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon6` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon7` BIGINT(20) UNSIGNED NOT NULL,
MODIFY `icon8` BIGINT(20) UNSIGNED NOT NULL;
+3 -3
View File
@@ -164,7 +164,7 @@ void PetAI::UpdateAI(uint32 diff)
continue;
}
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE);
bool spellUsed = false;
// Some spells can target enemy or friendly (DK Ghoul's Leap)
@@ -192,7 +192,7 @@ void PetAI::UpdateAI(uint32 diff)
// No enemy, check friendly
if (!spellUsed)
{
for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
for (GuidSet::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
{
Unit* ally = ObjectAccessor::GetUnit(*me, *tar);
@@ -215,7 +215,7 @@ void PetAI::UpdateAI(uint32 diff)
}
else if (me->GetVictim() && CanAttack(me->GetVictim()) && spellInfo->CanBeUsedInCombat())
{
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE);
if (spell->CanAutoCast(me->GetVictim()))
targetSpellStore.push_back(std::make_pair(me->GetVictim(), spell));
else
+1 -1
View File
@@ -57,7 +57,7 @@ class PetAI : public CreatureAI
void UpdateAllies();
TimeTracker i_tracker;
std::set<uint64> m_AllySet;
GuidSet m_AllySet;
uint32 m_updateAlliesTimer;
Unit* SelectNextTarget(bool allowAutoSelect) const;
+2 -2
View File
@@ -35,7 +35,7 @@ int TotemAI::Permissible(Creature const* creature)
return PERMIT_BASE_NO;
}
TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0)
TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid()
{
ASSERT(c->IsTotem());
}
@@ -90,7 +90,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
me->CastSpell(victim, me->ToTotem()->GetSpell(), false);
}
else
i_victimGuid = 0;
i_victimGuid.Clear();
}
void TotemAI::AttackStart(Unit* /*victim*/)
+1 -1
View File
@@ -39,7 +39,7 @@ class TotemAI : public CreatureAI
static int Permissible(Creature const* creature);
private:
uint64 i_victimGuid;
ObjectGuid i_victimGuid;
};
#endif
+2 -2
View File
@@ -137,8 +137,8 @@ class UnitAI
virtual void DoAction(int32 /*param*/) { }
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) { }
virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) { }
virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; }
virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id*/ = 0) { }
virtual ObjectGuid GetGUID(int32 /*id*/ = 0) const { return ObjectGuid::Empty; }
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satisfying the predicate.
@@ -311,8 +311,8 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
TC_LOG_ERROR("scripts", "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.",
me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
TC_LOG_ERROR("scripts", "Creature %s Tried to teleport non-player unit (%s) to x: %f y:%f z: %f o: %f. Aborted.",
me->GetGUID().ToString().c_str(), unit->GetGUID().ToString().c_str(), x, y, z, o);
}
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
@@ -40,7 +40,7 @@ class InstanceScript;
class SummonList
{
public:
typedef std::list<uint64> StorageType;
typedef GuidList StorageType;
typedef StorageType::iterator iterator;
typedef StorageType::const_iterator const_iterator;
typedef StorageType::size_type size_type;
@@ -104,7 +104,7 @@ public:
{
// We need to use a copy of SummonList here, otherwise original SummonList would be modified
StorageType listCopy = storage_;
Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
Trinity::Containers::RandomResizeList<ObjectGuid, Predicate>(listCopy, predicate, max);
for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); )
{
Creature* summon = ObjectAccessor::GetCreature(*me, *i++);
@@ -126,7 +126,7 @@ class EntryCheckPredicate
{
public:
EntryCheckPredicate(uint32 entry) : _entry(entry) { }
bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; }
bool operator()(ObjectGuid guid) { return guid.GetEntry() == _entry; }
private:
uint32 _entry;
@@ -135,7 +135,7 @@ class EntryCheckPredicate
class DummyEntryCheckPredicate
{
public:
bool operator()(uint64) { return true; }
bool operator()(ObjectGuid) { return true; }
};
struct ScriptedAI : public CreatureAI
@@ -35,7 +35,6 @@ enum Points
};
npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
m_uiPlayerGUID(0),
m_uiWPWaitTimer(2500),
m_uiPlayerCheckTimer(1000),
m_uiEscortState(STATE_ESCORT_NONE),
@@ -430,7 +429,7 @@ void npc_escortAI::SetRun(bool on)
}
/// @todo get rid of this many variables passed in function.
void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, uint64 playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
{
if (me->GetVictim())
{
@@ -486,7 +485,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, %s", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str());
CurrentWP = WaypointList.begin();
@@ -88,7 +88,7 @@ struct npc_escortAI : public ScriptedAI
virtual void WaypointReached(uint32 pointId) = 0;
virtual void WaypointStart(uint32 /*pointId*/) { }
void Start(bool isActiveAttacker = true, bool run = false, uint64 playerGUID = 0, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
void SetRun(bool on = true);
void SetEscortPaused(bool on);
@@ -103,7 +103,7 @@ struct npc_escortAI : public ScriptedAI
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
uint64 GetEventStarterGUID() { return m_uiPlayerGUID; }
ObjectGuid GetEventStarterGUID() { return m_uiPlayerGUID; }
protected:
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
@@ -116,7 +116,7 @@ struct npc_escortAI : public ScriptedAI
void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
uint64 m_uiPlayerGUID;
ObjectGuid m_uiPlayerGUID;
uint32 m_uiWPWaitTimer;
uint32 m_uiPlayerCheckTimer;
uint32 m_uiEscortState;
@@ -36,7 +36,6 @@ enum Points
};
FollowerAI::FollowerAI(Creature* creature) : ScriptedAI(creature),
m_uiLeaderGUID(0),
m_uiUpdateFollowTimer(2500),
m_uiFollowState(STATE_FOLLOW_NONE),
m_pQuestForFollow(NULL)
@@ -320,7 +319,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (%s)", player->GetName().c_str(), m_uiLeaderGUID.ToString().c_str());
}
Player* FollowerAI::GetLeaderForFollower()
@@ -71,7 +71,7 @@ class FollowerAI : public ScriptedAI
bool AssistPlayerInCombat(Unit* who);
uint64 m_uiLeaderGUID;
ObjectGuid m_uiLeaderGUID;
uint32 m_uiUpdateFollowTimer;
uint32 m_uiFollowState;
+8 -8
View File
@@ -61,7 +61,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mDespawnState = 0;
mEscortInvokerCheckTimer = 1000;
mFollowGuid = 0;
mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -540,7 +540,7 @@ void SmartAI::JustRespawned()
mJustReset = true;
JustReachedHome();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -674,8 +674,8 @@ void SmartAI::OnCharmed(bool apply)
{
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply);
if (!apply && !me->IsInEvadeMode() && me->GetUInt64Value(UNIT_FIELD_CHARMEDBY))
if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetUInt64Value(UNIT_FIELD_CHARMEDBY)))
if (!apply && !me->IsInEvadeMode() && me->GetCharmerGUID())
if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetCharmerGUID()))
AttackStart(charmer);
}
@@ -694,11 +694,11 @@ void SmartAI::SetData(uint32 id, uint32 value)
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, NULL, id, value);
}
void SmartAI::SetGUID(uint64 /*guid*/, int32 /*id*/) { }
void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/) { }
uint64 SmartAI::GetGUID(int32 /*id*/) const
ObjectGuid SmartAI::GetGUID(int32 /*id*/) const
{
return 0;
return ObjectGuid::Empty;
}
void SmartAI::SetRun(bool run)
@@ -800,7 +800,7 @@ void SmartAI::StopFollow()
player->GroupEventHappens(mFollowCredit, me);
}
mFollowGuid = 0;
mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
+3 -3
View File
@@ -154,10 +154,10 @@ class SmartAI : public CreatureAI
void SetData(uint32 id, uint32 value) override;
// Used in scripts to share variables
void SetGUID(uint64 guid, int32 id = 0) override;
void SetGUID(ObjectGuid guid, int32 id = 0) override;
// Used in scripts to share variables
uint64 GetGUID(int32 id = 0) const override;
ObjectGuid GetGUID(int32 id = 0) const override;
//core related
static int Permissible(const Creature*);
@@ -199,7 +199,7 @@ class SmartAI : public CreatureAI
uint32 mFollowArrivedTimer;
uint32 mFollowCredit;
uint32 mFollowArrivedEntry;
uint64 mFollowGuid;
ObjectGuid mFollowGuid;
float mFollowDist;
float mFollowAngle;
+17 -20
View File
@@ -51,9 +51,6 @@ SmartScript::SmartScript()
mUseTextTimer = false;
mTalkerEntry = 0;
mTemplate = SMARTAI_TEMPLATE_BASIC;
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
isProcessingTimedActionList = false;
}
@@ -79,7 +76,7 @@ void SmartScript::OnReset()
}
}
ProcessEventsFor(SMART_EVENT_RESET);
mLastInvoker = 0;
mLastInvoker.Clear();
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
@@ -509,10 +506,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: %s: %u casts spell %u on target %u with castflags %u",
GetLogNameForGuid(me ? me->GetGUID() : go->GetGUID()), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
(me ? me->GetGUID() : go->GetGUID()).GetTypeName(), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*itr)->GetGUID().ToString().c_str());
}
delete targets;
@@ -543,7 +540,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*itr)->GetGUID().ToString().c_str());
}
delete targets;
@@ -939,9 +936,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!targets)
break;
instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID());
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: " UI64FMTD,
e.action.setInstanceData64.field, targets->front()->GetGUID());
instance->SetGuidData(e.action.setInstanceData64.field, targets->front()->GetGUID());
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: %s",
e.action.setInstanceData64.field, targets->front()->GetGUID().ToString().c_str());
delete targets;
break;
@@ -1558,20 +1555,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsCreature(*itr))
{
if (!meOrigGUID)
meOrigGUID = me ? me->GetGUID() : 0;
if (!goOrigGUID)
goOrigGUID = go ? go->GetGUID() : 0;
if (!meOrigGUID && me)
meOrigGUID = me->GetGUID();
if (!goOrigGUID && go)
goOrigGUID = go->GetGUID();
go = NULL;
me = (*itr)->ToCreature();
break;
}
else if (IsGameObject(*itr))
{
if (!meOrigGUID)
meOrigGUID = me ? me->GetGUID() : 0;
if (!goOrigGUID)
goOrigGUID = go ? go->GetGUID() : 0;
if (!meOrigGUID && me)
meOrigGUID = me->GetGUID();
if (!goOrigGUID && go)
goOrigGUID = go->GetGUID();
go = (*itr)->ToGameObject();
me = NULL;
break;
@@ -1713,7 +1710,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*it)->GetGUID().ToString().c_str());
}
}
@@ -2627,7 +2624,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (me)
{
uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID();
ObjectGuid charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID();
if (!charmerOrOwnerGuid)
charmerOrOwnerGuid = me->GetCreatorGUID();
@@ -197,14 +197,14 @@ class SmartScript
go = o;
}
}
goOrigGUID = 0;
meOrigGUID = 0;
goOrigGUID.Clear();
meOrigGUID.Clear();
}
//TIMED_ACTIONLIST (script type 9 aka script9)
void SetScript9(SmartScriptHolder& e, uint32 entry);
Unit* GetLastInvoker();
uint64 mLastInvoker;
ObjectGuid mLastInvoker;
private:
void IncPhase(int32 p = 1)
@@ -224,9 +224,9 @@ class SmartScript
SmartAIEventList mTimedActionList;
bool isProcessingTimedActionList;
Creature* me;
uint64 meOrigGUID;
ObjectGuid meOrigGUID;
GameObject* go;
uint64 goOrigGUID;
ObjectGuid goOrigGUID;
AreaTriggerEntry const* trigger;
SmartScriptType mScriptType;
uint32 mEventPhase;
@@ -1352,7 +1352,7 @@ struct SmartScriptHolder
typedef std::unordered_map<uint32, WayPoint*> WPPath;
typedef std::list<WorldObject*> ObjectList;
typedef std::list<uint64> GuidList;
class ObjectGuidList
{
ObjectList* m_objectList;
@@ -1385,7 +1385,7 @@ public:
if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr))
m_objectList->push_back(obj);
else
TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: " UI64FMTD, *itr);
TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str());
}
}
+1 -2
View File
@@ -81,8 +81,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId)
{
do
{
uint32 guidLow = (*result)[0].GetUInt32();
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
ObjectGuid guid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
// Kick if player is online
if (Player* p = ObjectAccessor::FindPlayer(guid))
+12 -12
View File
@@ -457,7 +457,7 @@ void AchievementMgr::Reset()
m_completedAchievements.clear();
m_criteriaProgress.clear();
DeleteFromDB(m_player->GetGUIDLow());
DeleteFromDB(m_player->GetGUID());
// re-fill data
CheckAllAchievementCriteria();
@@ -495,16 +495,16 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin
}
}
void AchievementMgr::DeleteFromDB(uint32 lowguid)
void AchievementMgr::DeleteFromDB(ObjectGuid guid)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT);
stmt->setUInt32(0, lowguid);
stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS);
stmt->setUInt32(0, lowguid);
stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -521,11 +521,11 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
stmt->setUInt16(0, iter->first);
stmt->setUInt32(1, GetPlayer()->GetGUID());
stmt->setUInt32(1, GetPlayer()->GetGUIDLow());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT);
stmt->setUInt32(0, GetPlayer()->GetGUID());
stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt16(1, iter->first);
stmt->setUInt32(2, uint32(iter->second.date));
trans->Append(stmt);
@@ -542,14 +542,14 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
continue;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA);
stmt->setUInt32(0, GetPlayer()->GetGUID());
stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt16(1, iter->first);
trans->Append(stmt);
if (iter->second.counter)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS);
stmt->setUInt32(0, GetPlayer()->GetGUID());
stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt16(1, iter->first);
stmt->setUInt32(2, iter->second.counter);
stmt->setUInt32(3, uint32(iter->second.date));
@@ -663,7 +663,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
}
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
data.append(GetPlayer()->GetPackGUID());
data << GetPlayer()->GetPackGUID();
data << uint32(achievement->ID);
data.AppendPackedTime(time(NULL));
data << uint32(0);
@@ -678,7 +678,7 @@ void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, C
// the counter is packed like a packed Guid
data.appendPackGUID(progress->counter);
data.append(GetPlayer()->GetPackGUID());
data << GetPlayer()->GetPackGUID();
if (!entry->timeLimit)
data << uint32(0);
else
@@ -2102,7 +2102,7 @@ void AchievementMgr::SendAllAchievementData() const
void AchievementMgr::SendRespondInspectAchievements(Player* player) const
{
WorldPacket data(SMSG_RESPOND_INSPECT_ACHIEVEMENTS, 9+m_completedAchievements.size()*8+4+m_criteriaProgress.size()*38+4);
data.append(GetPlayer()->GetPackGUID());
data << GetPlayer()->GetPackGUID();
BuildAllDataPacket(&data);
player->GetSession()->SendPacket(&data);
}
@@ -2128,7 +2128,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const
{
*data << uint32(iter->first);
data->appendPackGUID(iter->second.counter);
data->append(GetPlayer()->GetPackGUID());
*data << GetPlayer()->GetPackGUID();
*data << uint32(0);
data->AppendPackedTime(iter->second.date);
*data << uint32(0);
@@ -26,6 +26,7 @@
#include "DatabaseEnv.h"
#include "DBCEnums.h"
#include "DBCStores.h"
#include "ObjectGuid.h"
class Unit;
class Player;
@@ -268,7 +269,7 @@ class AchievementMgr
~AchievementMgr();
void Reset();
static void DeleteFromDB(uint32 lowguid);
static void DeleteFromDB(ObjectGuid lowguid);
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
void SaveToDB(SQLTransaction& trans);
void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, bool evenIfCriteriaComplete = false);
@@ -92,7 +92,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
return;
uint32 bidderAccId = 0;
uint64 bidderGuid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
ObjectGuid bidderGuid(HIGHGUID_PLAYER, auction->bidder);
Player* bidder = ObjectAccessor::FindPlayer(bidderGuid);
// data for gm.log
std::string bidderName;
@@ -115,11 +115,12 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (logGmTrade)
{
ObjectGuid ownerGuid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
std::string ownerName;
if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, ownerName))
if (!sObjectMgr->GetPlayerNameByGUID(ownerGuid, ownerName))
ownerName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner);
uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(ownerGuid);
sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
bidderName.c_str(), bidderAccId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
@@ -150,7 +151,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans)
{
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner);
Player* owner = ObjectAccessor::FindPlayer(owner_guid);
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist (online or offline)
@@ -162,7 +163,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans)
{
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner);
Player* owner = ObjectAccessor::FindPlayer(owner_guid);
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist
@@ -193,7 +194,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
if (!pItem)
return;
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner);
Player* owner = ObjectAccessor::FindPlayer(owner_guid);
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist
@@ -211,7 +212,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
//this function sends mail to old bidder
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans)
{
uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
ObjectGuid oldBidder_guid(HIGHGUID_PLAYER, auction->bidder);
Player* oldBidder = ObjectAccessor::FindPlayer(oldBidder_guid);
uint32 oldBidder_accId = 0;
@@ -233,7 +234,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
//this function sends mail, when auction is cancelled to old bidder
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans)
{
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
Player* bidder = ObjectAccessor::FindPlayer(bidder_guid);
uint32 bidder_accId = 0;
@@ -288,7 +289,7 @@ void AuctionHouseMgr::LoadAuctionItems()
}
Item* item = NewItemOrBag(proto);
if (!item->LoadFromDB(item_guid, 0, fields, itemEntry))
if (!item->LoadFromDB(item_guid, ObjectGuid::Empty, fields, itemEntry))
{
delete item;
continue;
@@ -848,7 +849,7 @@ std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint3
{
std::ostringstream strm;
strm.width(16);
strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids
strm << std::right << std::hex << ObjectGuid(HIGHGUID_PLAYER, lowGuid).GetRawValue(); // HIGHGUID_PLAYER always present, even for empty guids
strm << std::dec << ':' << bid << ':' << buyout;
strm << ':' << deposit << ':' << cut;
return strm.str();
+20 -21
View File
@@ -56,7 +56,6 @@ Battlefield::Battlefield()
m_LastResurrectTimer = 30 * IN_MILLISECONDS;
m_StartGroupingTimer = 0;
m_StartGrouping = false;
StalkerGuid = 0;
}
Battlefield::~Battlefield()
@@ -299,7 +298,7 @@ void Battlefield::KickAfkPlayers()
KickPlayerFromBattlefield(*itr);
}
void Battlefield::KickPlayerFromBattlefield(uint64 guid)
void Battlefield::KickPlayerFromBattlefield(ObjectGuid guid)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
if (player->GetZoneId() == GetZoneId())
@@ -503,17 +502,17 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive)
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
{
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
if (!group->IsFull())
return group;
return NULL;
}
Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId)
{
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
if (group->IsMember(guid))
return group;
@@ -598,7 +597,7 @@ WorldSafeLocsEntry const* Battlefield::GetClosestGraveYard(Player* player)
return NULL;
}
void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
void Battlefield::AddPlayerToResurrectQueue(ObjectGuid npcGuid, ObjectGuid playerGuid)
{
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
{
@@ -613,7 +612,7 @@ void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
}
}
void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
void Battlefield::RemovePlayerFromResurrectQueue(ObjectGuid playerGuid)
{
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
{
@@ -628,7 +627,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
}
}
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid)
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, ObjectGuid guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time = m_LastResurrectTimer; // resurrect every 30 seconds
@@ -645,8 +644,8 @@ BfGraveyard::BfGraveyard(Battlefield* battlefield)
m_Bf = battlefield;
m_GraveyardId = 0;
m_ControlTeam = TEAM_NEUTRAL;
m_SpiritGuide[0] = 0;
m_SpiritGuide[1] = 0;
m_SpiritGuide[0].Clear();
m_SpiritGuide[1].Clear();
}
void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
@@ -673,7 +672,7 @@ float BfGraveyard::GetDistance(Player* player)
return player->GetDistance2d(safeLoc->x, safeLoc->y);
}
void BfGraveyard::AddPlayer(uint64 playerGuid)
void BfGraveyard::AddPlayer(ObjectGuid playerGuid)
{
if (!m_ResurrectQueue.count(playerGuid))
{
@@ -684,7 +683,7 @@ void BfGraveyard::AddPlayer(uint64 playerGuid)
}
}
void BfGraveyard::RemovePlayer(uint64 playerGuid)
void BfGraveyard::RemovePlayer(ObjectGuid playerGuid)
{
m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
@@ -756,7 +755,7 @@ void BfGraveyard::RelocateDeadPlayers()
}
}
bool BfGraveyard::HasNpc(uint64 guid)
bool BfGraveyard::HasNpc(ObjectGuid guid)
{
if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
return false;
@@ -838,25 +837,25 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
return go;
}
Creature* Battlefield::GetCreature(uint64 GUID)
Creature* Battlefield::GetCreature(ObjectGuid guid)
{
if (!m_Map)
return NULL;
return m_Map->GetCreature(GUID);
return m_Map->GetCreature(guid);
}
GameObject* Battlefield::GetGameObject(uint64 GUID)
GameObject* Battlefield::GetGameObject(ObjectGuid guid)
{
if (!m_Map)
return NULL;
return m_Map->GetGameObject(GUID);
return m_Map->GetGameObject(guid);
}
// *******************************************************
// ******************* CapturePoint **********************
// *******************************************************
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID(0)
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID()
{
m_team = TEAM_NEUTRAL;
m_value = 0;
@@ -921,7 +920,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
TC_LOG_DEBUG("bg.battlefield", "Creating capture point %u", capturePoint->GetEntry());
m_capturePointGUID = MAKE_NEW_GUID(capturePoint->GetGUIDLow(), capturePoint->GetEntry(), HIGHGUID_GAMEOBJECT);
m_capturePointGUID = ObjectGuid(HIGHGUID_GAMEOBJECT, capturePoint->GetEntry(), capturePoint->GetGUIDLow());
// check info existence
GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
@@ -966,7 +965,7 @@ bool BfCapturePoint::DelCapturePoint()
capturePoint->Delete();
capturePoint = NULL;
}
m_capturePointGUID = 0;
m_capturePointGUID.Clear();
}
return true;
@@ -1102,7 +1101,7 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
player->SendUpdateWorldState(field, value);
}
void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
void BfCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
{
uint8 team;
switch (m_State)
+16 -17
View File
@@ -64,9 +64,8 @@ class Unit;
class Battlefield;
class BfGraveyard;
typedef std::set<uint64> GuidSet;
typedef std::vector<BfGraveyard*> GraveyardVect;
typedef std::map<uint64, time_t> PlayerTimerMap;
typedef std::map<ObjectGuid, time_t> PlayerTimerMap;
class BfCapturePoint
{
@@ -81,7 +80,7 @@ class BfCapturePoint
void SendUpdateWorldState(uint32 field, uint32 value);
// Send kill notify to players in the controlling faction
void SendObjectiveComplete(uint32 id, uint64 guid);
void SendObjectiveComplete(uint32 id, ObjectGuid guid);
// Used when player is activated/inactivated in the area
virtual bool HandlePlayerEnter(Player* player);
@@ -132,7 +131,7 @@ class BfCapturePoint
uint32 m_capturePointEntry;
// Gameobject related to that capture point
uint64 m_capturePointGUID;
ObjectGuid m_capturePointGUID;
};
class BfGraveyard
@@ -154,10 +153,10 @@ class BfGraveyard
void SetSpirit(Creature* spirit, TeamId team);
// Add a player to the graveyard
void AddPlayer(uint64 player_guid);
void AddPlayer(ObjectGuid player_guid);
// Remove a player from the graveyard
void RemovePlayer(uint64 player_guid);
void RemovePlayer(ObjectGuid player_guid);
// Resurrect players
void Resurrect();
@@ -166,10 +165,10 @@ class BfGraveyard
void RelocateDeadPlayers();
// Check if this graveyard has a spirit guide
bool HasNpc(uint64 guid);
bool HasNpc(ObjectGuid guid);
// Check if a player is in this graveyard's resurrect queue
bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
bool HasPlayer(ObjectGuid guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
// Get the graveyard's ID.
uint32 GetGraveyardId() const { return m_GraveyardId; }
@@ -177,7 +176,7 @@ class BfGraveyard
protected:
TeamId m_ControlTeam;
uint32 m_GraveyardId;
uint64 m_SpiritGuide[BG_TEAMS_COUNT];
ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT];
GuidSet m_ResurrectQueue;
Battlefield* m_Bf;
};
@@ -237,7 +236,7 @@ class Battlefield : public ZoneScript
* \brief Kick player from battlefield and teleport him to kick-point location
* \param guid : guid of player who must be kick
*/
void KickPlayerFromBattlefield(uint64 guid);
void KickPlayerFromBattlefield(ObjectGuid guid);
/// Called when player (player) enter in zone
void HandlePlayerEnterZone(Player* player, uint32 zone);
@@ -266,7 +265,7 @@ class Battlefield : public ZoneScript
*/
Group* GetFreeBfRaid(TeamId TeamId);
/// Return battlefield group where player is.
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
Group* GetGroupPlayer(ObjectGuid guid, TeamId TeamId);
/// Force player to join a battlefield group
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
@@ -274,8 +273,8 @@ class Battlefield : public ZoneScript
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
void RemovePlayerFromResurrectQueue(uint64 player_guid);
virtual void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
void RemovePlayerFromResurrectQueue(ObjectGuid player_guid);
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
BfGraveyard* GetGraveyardById(uint32 id) const;
@@ -284,8 +283,8 @@ class Battlefield : public ZoneScript
Creature* SpawnCreature(uint32 entry, Position const& pos, TeamId /*teamId*/);
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
Creature* GetCreature(uint64 GUID);
GameObject* GetGameObject(uint64 GUID);
Creature* GetCreature(ObjectGuid guid);
GameObject* GetGameObject(ObjectGuid guid);
// Script-methods
@@ -321,7 +320,7 @@ class Battlefield : public ZoneScript
/// Return if we can use mount in battlefield
bool CanFlyIn() { return !m_isActive; }
void SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid);
void SendAreaSpiritHealerQueryOpcode(Player* player, ObjectGuid guid);
void StartBattle();
void EndBattle(bool endByTimer);
@@ -342,7 +341,7 @@ class Battlefield : public ZoneScript
void InitStalker(uint32 entry, Position const& pos);
protected:
uint64 StalkerGuid;
ObjectGuid StalkerGuid;
uint32 m_Timer; // Global timer for event
bool m_IsEnabled;
bool m_isActive;
@@ -301,7 +301,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
if (m_titansRelicGUID)
if (GameObject* relic = GetGameObject(m_titansRelicGUID))
relic->RemoveFromWorld();
m_titansRelicGUID = 0;
m_titansRelicGUID.Clear();
// Remove turret
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
@@ -1065,7 +1065,6 @@ BfWGGameObjectBuilding::BfWGGameObjectBuilding(BattlefieldWG* wg)
{
m_WG = wg;
m_Team = 0;
m_BuildGUID = 0;
m_Type = 0;
m_WorldState = 0;
m_State = 0;
@@ -1119,11 +1118,11 @@ void BfWGGameObjectBuilding::Damaged()
if (m_NameId) // tower damage + name
m_WG->SendWarningToAllInZone(m_NameId);
for (uint64 guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
for (uint64 guid : m_TurretTopList)
for (ObjectGuid guid : m_TurretTopList)
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
@@ -1331,34 +1330,34 @@ void BfWGGameObjectBuilding::Init(GameObject* go, uint32 type, uint32 worldstate
void BfWGGameObjectBuilding::UpdateCreatureAndGo()
{
for (uint64 guid : m_CreatureTopList[m_WG->GetDefenderTeam()])
for (ObjectGuid guid : m_CreatureTopList[m_WG->GetDefenderTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
for (uint64 guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, true);
for (uint64 guid : m_CreatureBottomList[m_WG->GetDefenderTeam()])
for (ObjectGuid guid : m_CreatureBottomList[m_WG->GetDefenderTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
for (uint64 guid : m_CreatureBottomList[m_WG->GetAttackerTeam()])
for (ObjectGuid guid : m_CreatureBottomList[m_WG->GetAttackerTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, true);
for (uint64 guid : m_GameObjectList[m_WG->GetDefenderTeam()])
for (ObjectGuid guid : m_GameObjectList[m_WG->GetDefenderTeam()])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_ONE_DAY);
for (uint64 guid : m_GameObjectList[m_WG->GetAttackerTeam()])
for (ObjectGuid guid : m_GameObjectList[m_WG->GetAttackerTeam()])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_IMMEDIATELY);
}
void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable)
{
for (uint64 guid : m_TowerCannonBottomList)
for (ObjectGuid guid : m_TowerCannonBottomList)
{
if (Creature* creature = m_WG->GetCreature(guid))
{
@@ -1391,7 +1390,7 @@ void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable)
}
}
for (uint64 guid : m_TurretTopList)
for (ObjectGuid guid : m_TurretTopList)
{
if (Creature* creature = m_WG->GetCreature(guid))
{
@@ -1492,7 +1491,6 @@ void WGWorkshop::Save()
WintergraspWorkshopData::WintergraspWorkshopData(BattlefieldWG* wg)
{
m_WG = wg;
m_BuildGUID = 0;
m_Type = 0;
m_State = 0;
m_WorldState = 0;
@@ -1538,22 +1536,22 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init)
case BATTLEFIELD_WG_TEAM_ALLIANCE:
{
// Show Alliance creature
for (uint64 guid : m_CreatureOnPoint[TEAM_ALLIANCE])
for (ObjectGuid guid : m_CreatureOnPoint[TEAM_ALLIANCE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
// Hide Horde creature
for (uint64 guid : m_CreatureOnPoint[TEAM_HORDE])
for (ObjectGuid guid : m_CreatureOnPoint[TEAM_HORDE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
// Show Alliance gameobject
for (uint64 guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_IMMEDIATELY);
// Hide Horde gameobject
for (uint64 guid : m_GameObjectOnPoint[TEAM_HORDE])
for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_HORDE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_ONE_DAY);
@@ -1577,22 +1575,22 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init)
case BATTLEFIELD_WG_TEAM_HORDE:
{
// Show Horde creature
for (uint64 guid : m_CreatureOnPoint[TEAM_HORDE])
for (ObjectGuid guid : m_CreatureOnPoint[TEAM_HORDE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
// Hide Alliance creature
for (uint64 guid : m_CreatureOnPoint[TEAM_ALLIANCE])
for (ObjectGuid guid : m_CreatureOnPoint[TEAM_ALLIANCE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
// Hide Alliance gameobject
for (uint64 guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_ONE_DAY);
// Show Horde gameobject
for (uint64 guid : m_GameObjectOnPoint[TEAM_HORDE])
for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_HORDE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_IMMEDIATELY);
@@ -383,7 +383,7 @@ class BattlefieldWG : public Battlefield
GameObject* GetRelic() { return GetGameObject(m_titansRelicGUID); }
/// Define relic object
void SetRelic(uint64 relicGUID) { m_titansRelicGUID = relicGUID; }
void SetRelic(ObjectGuid relicGUID) { m_titansRelicGUID = relicGUID; }
/// Check if players can interact with the relic (Only if the last door has been broken)
bool CanInteractWithRelic() { return m_isRelicInteractible; }
@@ -429,7 +429,7 @@ class BattlefieldWG : public Battlefield
uint32 m_tenacityStack;
uint32 m_saveTimer;
uint64 m_titansRelicGUID;
ObjectGuid m_titansRelicGUID;
};
uint32 const VehNumWorldState[] = { 3680, 3490 };
@@ -578,7 +578,7 @@ struct WintergraspBuildingSpawnData
struct WintergraspRebuildableBuildingData
{
uint64 Guid;
ObjectGuid Guid;
uint32 entry;
uint32 WorldState;
float x;
@@ -1068,7 +1068,7 @@ struct BfWGGameObjectBuilding
BattlefieldWG* m_WG;
// Linked gameobject
uint64 m_BuildGUID;
ObjectGuid m_BuildGUID;
// eWGGameObjectBuildingType
uint32 m_Type;
@@ -1132,7 +1132,7 @@ struct WGWorkshop
struct WintergraspWorkshopData
{
BattlefieldWG* m_WG; // Pointer to wintergrasp
uint64 m_BuildGUID;
ObjectGuid m_BuildGUID;
uint32 m_Type;
uint32 m_State; // For worldstate
uint32 m_WorldState;
+3 -3
View File
@@ -60,7 +60,7 @@ void Arena::AddPlayer(Player* player)
UpdateArenaWorldState();
}
void Arena::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
void Arena::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -92,7 +92,7 @@ void Arena::HandleKillPlayer(Player* player, Player* killer)
CheckWinConditions();
}
void Arena::RemovePlayerAtLeave(uint64 guid, bool transport, bool sendPacket)
void Arena::RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket)
{
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
@@ -177,7 +177,7 @@ void Arena::EndBattleground(uint32 winner)
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
for (auto const& score : PlayerScores)
if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(score.first, 0, HIGHGUID_PLAYER)))
if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, score.first)))
{
TC_LOG_DEBUG("bg.arena", "Statistics match Type: %u for %s (GUID: %u, Team: %d, IP: %s): %s",
GetArenaType(), player->GetName().c_str(), score.first, player->GetArenaTeamId(GetArenaType() == 5 ? 2 : GetArenaType() == 3),
+2 -2
View File
@@ -42,7 +42,7 @@ class Arena : public Battleground
Arena();
void AddPlayer(Player* player) override;
void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) override;
void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) override;
void FillInitialWorldStates(WorldPacket& data) override;
void UpdateArenaWorldState();
@@ -50,7 +50,7 @@ class Arena : public Battleground
void HandleKillPlayer(Player* player, Player* killer) override;
private:
void RemovePlayerAtLeave(uint64 guid, bool transport, bool sendPacket) override;
void RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket) override;
void CheckWinConditions() override;
void EndBattleground(uint32 winner) override;
};
+1 -1
View File
@@ -26,7 +26,7 @@ struct ArenaScore : public BattlegroundScore
friend class Arena;
protected:
ArenaScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { }
ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { }
void AppendToPacket(WorldPacket& data) final override
{
+28 -28
View File
@@ -27,7 +27,7 @@
#include "Opcodes.h"
ArenaTeam::ArenaTeam()
: TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
: TeamId(0), Type(0), TeamName(), CaptainGuid(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
BorderStyle(0), BorderColor(0)
{
Stats.WeekGames = 0;
@@ -41,7 +41,7 @@ ArenaTeam::ArenaTeam()
ArenaTeam::~ArenaTeam()
{ }
bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
{
// Check if captain is present
if (!ObjectAccessor::FindPlayer(captainGuid))
@@ -63,7 +63,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa
EmblemColor = emblemColor;
BorderStyle = borderStyle;
BorderColor = borderColor;
uint32 captainLowGuid = GUID_LOPART(captainGuid);
uint32 captainLowGuid = captainGuid.GetCounter();
// Save arena team to db
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
@@ -86,7 +86,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa
return true;
}
bool ArenaTeam::AddMember(uint64 playerGuid)
bool ArenaTeam::AddMember(ObjectGuid playerGuid)
{
std::string playerName;
uint8 playerClass;
@@ -107,7 +107,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// 0 1
// SELECT name, class FROM characters WHERE guid = ?
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_CLASS);
stmt->setUInt32(0, GUID_LOPART(playerGuid));
stmt->setUInt32(0, playerGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -120,7 +120,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), playerGuid.GetCounter(), GetType());
return false;
}
@@ -134,7 +134,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Try to get player's match maker rating from db and fall back to config setting if not found
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
stmt->setUInt32(0, GUID_LOPART(playerGuid));
stmt->setUInt32(0, playerGuid.GetCounter());
stmt->setUInt8(1, GetSlot());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -165,7 +165,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Save player's arena team membership to db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
stmt->setUInt32(0, TeamId);
stmt->setUInt32(1, GUID_LOPART(playerGuid));
stmt->setUInt32(1, playerGuid.GetCounter());
CharacterDatabase.Execute(stmt);
// Inform player if online
@@ -179,7 +179,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
TC_LOG_INFO("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str());
TC_LOG_INFO("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), playerGuid.GetCounter(), GetType(), GetId(), GetName().c_str());
return true;
}
@@ -193,7 +193,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result)
TeamId = fields[0].GetUInt32();
TeamName = fields[1].GetString();
CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
CaptainGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
Type = fields[3].GetUInt8();
BackgroundColor = fields[4].GetUInt32();
EmblemStyle = fields[5].GetUInt8();
@@ -232,7 +232,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
break;
ArenaTeamMember newMember;
newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
newMember.Guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
newMember.WeekGames = fields[2].GetUInt16();
newMember.WeekWins = fields[3].GetUInt16();
newMember.SeasonGames = fields[4].GetUInt16();
@@ -245,7 +245,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
// Delete member if character information is missing
if (newMember.Name.empty())
{
TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.GetCounter());
DelMember(newMember.Guid, true);
continue;
}
@@ -282,7 +282,7 @@ bool ArenaTeam::SetName(std::string const& name)
return true;
}
void ArenaTeam::SetCaptain(uint64 guid)
void ArenaTeam::SetCaptain(ObjectGuid guid)
{
// Disable remove/promote buttons
Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain());
@@ -294,7 +294,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
// Update database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN);
stmt->setUInt32(0, GUID_LOPART(guid));
stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt32(1, GetId());
CharacterDatabase.Execute(stmt);
@@ -311,7 +311,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
}
}
void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb)
{
// Remove member from team
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
@@ -336,7 +336,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER);
stmt->setUInt32(0, GetId());
stmt->setUInt32(1, GUID_LOPART(guid));
stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -350,7 +350,7 @@ void ArenaTeam::Disband(WorldSession* session)
// Broadcast update
if (session)
{
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, ObjectGuid::Empty, 2, session->GetPlayerName(), GetName(), "");
if (Player* player = session->GetPlayer())
TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str());
@@ -471,7 +471,7 @@ void ArenaTeam::NotifyStatsChanged()
SendStats(player->GetSession());
}
void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
void ArenaTeam::Inspect(WorldSession* session, ObjectGuid guid)
{
ArenaTeamMember* member = GetMember(guid);
if (!member)
@@ -518,7 +518,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
player->GetSession()->SendPacket(packet);
}
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
{
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1);
data << uint8(event);
@@ -558,7 +558,7 @@ void ArenaTeam::MassInviteToEvent(WorldSession* session)
{
if (itr->Guid != session->GetPlayer()->GetGUID())
{
data.appendPackGUID(itr->Guid);
data << itr->Guid.WriteAsPacked();
data << uint8(0); // unk
}
}
@@ -580,7 +580,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
return 0xFF;
}
bool ArenaTeam::IsMember(uint64 guid) const
bool ArenaTeam::IsMember(ObjectGuid guid) const
{
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
if (itr->Guid == guid)
@@ -793,7 +793,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32
}
}
void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// Called for offline player after ending rated arena match!
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
@@ -860,15 +860,15 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
if (itr->WeekGames >= requiredGames)
pointsToAdd = GetPoints(itr->PersonalRating);
std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(GUID_LOPART(itr->Guid));
std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(itr->Guid.GetCounter());
if (plr_itr != playerPoints.end())
{
// Check if there is already more points
if (plr_itr->second < pointsToAdd)
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
playerPoints[itr->Guid.GetCounter()] = pointsToAdd;
}
else
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
playerPoints[itr->Guid.GetCounter()] = pointsToAdd;
}
}
@@ -898,11 +898,11 @@ void ArenaTeam::SaveToDB()
stmt->setUInt16(3, itr->SeasonGames);
stmt->setUInt16(4, itr->SeasonWins);
stmt->setUInt32(5, GetId());
stmt->setUInt32(6, GUID_LOPART(itr->Guid));
stmt->setUInt32(6, itr->Guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS);
stmt->setUInt32(0, GUID_LOPART(itr->Guid));
stmt->setUInt32(0, itr->Guid.GetCounter());
stmt->setUInt8(1, GetSlot());
stmt->setUInt16(2, itr->MatchMakerRating);
trans->Append(stmt);
@@ -944,7 +944,7 @@ ArenaTeamMember* ArenaTeam::GetMember(const std::string& name)
return NULL;
}
ArenaTeamMember* ArenaTeam::GetMember(uint64 guid)
ArenaTeamMember* ArenaTeam::GetMember(ObjectGuid guid)
{
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
if (itr->Guid == guid)
+13 -15
View File
@@ -20,6 +20,7 @@
#define TRINITYCORE_ARENATEAM_H
#include "QueryResult.h"
#include "ObjectGuid.h"
#include <list>
#include <map>
@@ -86,7 +87,7 @@ enum ArenaTeamTypes
struct ArenaTeamMember
{
uint64 Guid;
ObjectGuid Guid;
std::string Name;
uint8 Class;
uint16 WeekGames;
@@ -118,7 +119,7 @@ class ArenaTeam
ArenaTeam();
~ArenaTeam();
bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
bool Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
void Disband(WorldSession* session);
void Disband();
@@ -128,28 +129,25 @@ class ArenaTeam
uint32 GetType() const { return Type; }
uint8 GetSlot() const { return GetSlotByType(GetType()); }
static uint8 GetSlotByType(uint32 type);
uint64 GetCaptain() const { return CaptainGuid; }
ObjectGuid GetCaptain() const { return CaptainGuid; }
std::string const& GetName() const { return TeamName; }
const ArenaTeamStats& GetStats() const { return Stats; }
uint32 GetRating() const { return Stats.Rating; }
uint32 GetAverageMMR(Group* group) const;
void SetCaptain(uint64 guid);
void SetCaptain(ObjectGuid guid);
bool SetName(std::string const& name);
bool AddMember(uint64 PlayerGuid);
// Shouldn't be uint64 ed, because than can reference guid from members on Disband
// and this method removes given record from list. So invalid reference can happen.
void DelMember(uint64 guid, bool cleanDb);
bool AddMember(ObjectGuid PlayerGuid);
void DelMember(ObjectGuid guid, bool cleanDb);
size_t GetMembersSize() const { return Members.size(); }
bool Empty() const { return Members.empty(); }
MemberList::iterator m_membersBegin() { return Members.begin(); }
MemberList::iterator m_membersEnd() { return Members.end(); }
bool IsMember(uint64 guid) const;
bool IsMember(ObjectGuid guid) const;
ArenaTeamMember* GetMember(uint64 guid);
ArenaTeamMember* GetMember(ObjectGuid guid);
ArenaTeamMember* GetMember(std::string const& name);
bool IsFighting() const;
@@ -160,7 +158,7 @@ class ArenaTeam
void SaveToDB();
void BroadcastPacket(WorldPacket* packet);
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
void BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
void NotifyStatsChanged();
void MassInviteToEvent(WorldSession* session);
@@ -168,7 +166,7 @@ class ArenaTeam
void Roster(WorldSession* session);
void Query(WorldSession* session);
void SendStats(WorldSession* session);
void Inspect(WorldSession* session, uint64 guid);
void Inspect(WorldSession* session, ObjectGuid guid);
uint32 GetPoints(uint32 MemberRating);
int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
@@ -178,7 +176,7 @@ class ArenaTeam
void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
@@ -190,7 +188,7 @@ class ArenaTeam
uint32 TeamId;
uint8 Type;
std::string TeamName;
uint64 CaptainGuid;
ObjectGuid CaptainGuid;
uint32 BackgroundColor; // ARGB format
uint8 EmblemStyle; // icon id
@@ -59,7 +59,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(const std::string& arenaTeamName) co
return NULL;
}
ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const
ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
{
for (ArenaTeamContainer::const_iterator itr = ArenaTeamStore.begin(); itr != ArenaTeamStore.end(); ++itr)
if (itr->second->GetCaptain() == guid)
@@ -158,7 +158,7 @@ void ArenaTeamMgr::DistributeArenaPoints()
for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
{
// Add points to player if online
if (Player* player = HashMapHolder<Player>::Find(playerItr->first))
if (Player* player = HashMapHolder<Player>::Find(ObjectGuid(HIGHGUID_PLAYER, playerItr->first)))
player->ModifyArenaPoints(playerItr->second, trans);
else // Update database
{
+1 -1
View File
@@ -37,7 +37,7 @@ public:
ArenaTeam* GetArenaTeamById(uint32 arenaTeamId) const;
ArenaTeam* GetArenaTeamByName(std::string const& arenaTeamName) const;
ArenaTeam* GetArenaTeamByCaptain(uint64 guid) const;
ArenaTeam* GetArenaTeamByCaptain(ObjectGuid guid) const;
void LoadArenaTeams();
void AddArenaTeam(ArenaTeam* arenaTeam);
+39 -40
View File
@@ -327,10 +327,10 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
{
if (GetReviveQueueSize())
{
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{
Creature* sh = NULL;
for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
for (GuidVector::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
{
Player* player = ObjectAccessor::FindPlayer(*itr2);
if (!player)
@@ -361,7 +361,7 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
}
else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC
{
for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
for (GuidVector::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
@@ -560,7 +560,7 @@ inline void Battleground::_ProcessLeave(uint32 diff)
}
}
Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* context) const
Player* Battleground::_GetPlayer(ObjectGuid guid, bool offlineRemove, char const* context) const
{
Player* player = NULL;
if (!offlineRemove)
@@ -568,7 +568,7 @@ Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* co
player = ObjectAccessor::FindPlayer(guid);
if (!player)
TC_LOG_ERROR("bg.battleground", "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
context, GUID_LOPART(guid), m_MapId, m_InstanceID);
context, guid.GetCounter(), m_MapId, m_InstanceID);
}
return player;
}
@@ -851,7 +851,7 @@ void Battleground::BlockMovement(Player* player)
player->SetClientControl(player, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
}
void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket)
void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket)
{
uint32 team = GetPlayerTeam(guid);
bool participant = false;
@@ -865,7 +865,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
participant = true;
}
BattlegroundScoreMap::iterator itr2 = PlayerScores.find(GUID_LOPART(guid));
BattlegroundScoreMap::iterator itr2 = PlayerScores.find(guid.GetCounter());
if (itr2 != PlayerScores.end())
{
delete itr2->second; // delete player's score
@@ -1014,7 +1014,6 @@ void Battleground::AddPlayer(Player* player)
// score struct must be created in inherited class
uint64 guid = player->GetGUID();
uint32 team = player->GetBGTeam();
BattlegroundPlayer bp;
@@ -1022,7 +1021,7 @@ void Battleground::AddPlayer(Player* player)
bp.Team = team;
// Add to list/maps
m_Players[guid] = bp;
m_Players[player->GetGUID()] = bp;
UpdatePlayersCountByTeam(team, false); // +1 player
@@ -1071,7 +1070,7 @@ void Battleground::AddPlayer(Player* player)
// this method adds player to his team's bg group, or sets his correct group if player is already in bg group
void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
{
uint64 playerGuid = player->GetGUID();
ObjectGuid playerGuid = player->GetGUID();
Group* group = GetBgRaid(team);
if (!group) // first player joined
{
@@ -1102,9 +1101,9 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
// This method should be called when player logs into running battleground
void Battleground::EventPlayerLoggedIn(Player* player)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
// player is correct pointer
for (std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
for (GuidDeque::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
{
if (*itr == guid)
{
@@ -1121,7 +1120,7 @@ void Battleground::EventPlayerLoggedIn(Player* player)
// This method should be called when player logs out from running battleground
void Battleground::EventPlayerLoggedOut(Player* player)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsPlayerInBattleground(guid)) // Check if this player really is in battleground (might be a GM who teleported inside)
return;
@@ -1265,7 +1264,7 @@ bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
return true;
}
void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
void Battleground::AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid)
{
m_ReviveQueue[npc_guid].push_back(player_guid);
@@ -1276,15 +1275,15 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
}
void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
void Battleground::RemovePlayerFromResurrectQueue(ObjectGuid player_guid)
{
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{
for (std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
for (GuidVector::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
{
if (*itr2 == player_guid)
{
(itr->second).erase(itr2);
itr->second.erase(itr2);
if (Player* player = ObjectAccessor::FindPlayer(player_guid))
player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
return;
@@ -1293,14 +1292,14 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
}
}
void Battleground::RelocateDeadPlayers(uint64 queueIndex)
void Battleground::RelocateDeadPlayers(ObjectGuid guideGuid)
{
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64>& ghostList = m_ReviveQueue[queueIndex];
GuidVector& ghostList = m_ReviveQueue[guideGuid];
if (!ghostList.empty())
{
WorldSafeLocsEntry const* closestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr)
for (GuidVector::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
@@ -1388,7 +1387,7 @@ void Battleground::DoorClose(uint32 type)
}
else
TC_LOG_ERROR("bg.battleground", "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
}
void Battleground::DoorOpen(uint32 type)
@@ -1400,7 +1399,7 @@ void Battleground::DoorOpen(uint32 type)
}
else
TC_LOG_ERROR("bg.battleground", "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
}
GameObject* Battleground::GetBGObject(uint32 type, bool logError)
@@ -1410,10 +1409,10 @@ GameObject* Battleground::GetBGObject(uint32 type, bool logError)
{
if (logError)
TC_LOG_ERROR("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
else
TC_LOG_INFO("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
}
return obj;
}
@@ -1425,10 +1424,10 @@ Creature* Battleground::GetBGCreature(uint32 type, bool logError)
{
if (logError)
TC_LOG_ERROR("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID);
else
TC_LOG_INFO("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID);
}
return creature;
}
@@ -1505,13 +1504,13 @@ bool Battleground::DelCreature(uint32 type)
if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]))
{
creature->AddObjectToRemoveList();
BgCreatures[type] = 0;
BgCreatures[type].Clear();
return true;
}
TC_LOG_ERROR("bg.battleground", "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
BgCreatures[type] = 0;
type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID);
BgCreatures[type].Clear();
return false;
}
@@ -1524,12 +1523,12 @@ bool Battleground::DelObject(uint32 type)
{
obj->SetRespawnTime(0); // not save respawn time
obj->Delete();
BgObjects[type] = 0;
BgObjects[type].Clear();
return true;
}
TC_LOG_ERROR("bg.battleground", "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
BgObjects[type] = 0;
type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
BgObjects[type].Clear();
return false;
}
@@ -1540,7 +1539,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
if (Creature* creature = AddCreature(entry, type, x, y, z, o, teamId))
{
creature->setDeathState(DEAD);
creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
creature->SetChannelObjectGuid(creature->GetGUID());
// aura
/// @todo Fix display here
// creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
@@ -1637,7 +1636,7 @@ char const* Battleground::GetTrinityString(int32 entry)
// IMPORTANT NOTICE:
// buffs aren't spawned/despawned when players captures anything
// buffs are in their positions when battleground starts
void Battleground::HandleTriggerBuff(uint64 go_guid)
void Battleground::HandleTriggerBuff(ObjectGuid go_guid)
{
GameObject* obj = GetBgMap()->GetGameObject(go_guid);
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
@@ -1650,7 +1649,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid)
if (index < 0)
{
TC_LOG_ERROR("bg.battleground", "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!",
GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID);
go_guid.GetCounter(), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID);
return;
}
@@ -1710,7 +1709,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer)
// Return the player's team based on battlegroundplayer info
// Used in same faction arena matches mainly
uint32 Battleground::GetPlayerTeam(uint64 guid) const
uint32 Battleground::GetPlayerTeam(ObjectGuid guid) const
{
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
@@ -1723,7 +1722,7 @@ uint32 Battleground::GetOtherTeam(uint32 teamId) const
return teamId ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0;
}
bool Battleground::IsPlayerInBattleground(uint64 guid) const
bool Battleground::IsPlayerInBattleground(ObjectGuid guid) const
{
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
@@ -1768,13 +1767,13 @@ void Battleground::SetHoliday(bool is_holiday)
m_HonorMode = is_holiday ? BG_HOLIDAY : BG_NORMAL;
}
int32 Battleground::GetObjectType(uint64 guid)
int32 Battleground::GetObjectType(ObjectGuid guid)
{
for (uint32 i = 0; i < BgObjects.size(); ++i)
if (BgObjects[i] == guid)
return i;
TC_LOG_ERROR("bg.battleground", "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
GUID_LOPART(guid), m_MapId, m_InstanceID);
guid.GetCounter(), m_MapId, m_InstanceID);
return -1;
}
+20 -22
View File
@@ -303,7 +303,7 @@ class Battleground
bool isBattleground() const { return !m_IsArena; }
bool isRated() const { return m_IsRated; }
typedef std::map<uint64, BattlegroundPlayer> BattlegroundPlayerMap;
typedef std::map<ObjectGuid, BattlegroundPlayer> BattlegroundPlayerMap;
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
uint32 GetPlayersSize() const { return m_Players.size(); }
@@ -312,11 +312,11 @@ class Battleground
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
void RemovePlayerFromResurrectQueue(uint64 player_guid);
void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
void RemovePlayerFromResurrectQueue(ObjectGuid player_guid);
/// Relocate all players in ReviveQueue to the closest graveyard
void RelocateDeadPlayers(uint64 queueIndex);
void RelocateDeadPlayers(ObjectGuid guideGuid);
void StartBattleground();
@@ -409,7 +409,7 @@ class Battleground
virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/ = NULL) { }
// this function can be used by spell to interact with the BG map
virtual void DoAction(uint32 /*action*/, uint64 /*var*/) { }
virtual void DoAction(uint32 /*action*/, ObjectGuid /*var*/) { }
virtual void HandlePlayerResurrect(Player* /*player*/) { }
@@ -420,17 +420,15 @@ class Battleground
void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team);
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket);
// can be extended in in BG subclass
void HandleTriggerBuff(uint64 go_guid);
void HandleTriggerBuff(ObjectGuid go_guid);
void SetHoliday(bool is_holiday);
/// @todo make this protected:
typedef std::vector<uint64> BGObjects;
typedef std::vector<uint64> BGCreatures;
BGObjects BgObjects;
BGCreatures BgCreatures;
GuidVector BgObjects;
GuidVector BgCreatures;
void SpawnBGObject(uint32 type, uint32 respawntime);
virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
bool AddObject(uint32 type, uint32 entry, Position const& pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
@@ -440,7 +438,7 @@ class Battleground
bool DelObject(uint32 type);
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL);
bool AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL);
int32 GetObjectType(uint64 guid);
int32 GetObjectType(ObjectGuid guid);
void DoorOpen(uint32 type);
void DoorClose(uint32 type);
@@ -450,9 +448,9 @@ class Battleground
virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
uint32 GetPlayerTeam(uint64 guid) const;
uint32 GetPlayerTeam(ObjectGuid guid) const;
uint32 GetOtherTeam(uint32 teamId) const;
bool IsPlayerInBattleground(uint64 guid) const;
bool IsPlayerInBattleground(ObjectGuid guid) const;
bool ToBeDeleted() const { return m_SetDeleteThis; }
void SetDeleteThis() { m_SetDeleteThis = true; }
@@ -460,8 +458,8 @@ class Battleground
void RewardXPAtKill(Player* killer, Player* victim);
bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) { }
virtual ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const { return ObjectGuid::Empty; }
virtual void SetDroppedFlagGUID(ObjectGuid /*guid*/, int32 /*team*/ = -1) { }
virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) { }
virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; }
virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; }
@@ -477,7 +475,7 @@ class Battleground
void EndNow();
void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
Player* _GetPlayer(uint64 guid, bool offlineRemove, const char* context) const;
Player* _GetPlayer(ObjectGuid guid, bool offlineRemove, const char* context) const;
Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context) { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
Player* _GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const;
@@ -492,12 +490,12 @@ class Battleground
// Scorekeeping
BattlegroundScoreMap PlayerScores; // Player scores
// must be implemented in BG subclass
virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { }
virtual void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { }
// Player lists, those need to be accessible by inherited classes
BattlegroundPlayerMap m_Players;
BattlegroundPlayerMap m_Players;
// Spirit Guide guid + Player list GUIDS
std::map<uint64, std::vector<uint64> > m_ReviveQueue;
std::map<ObjectGuid, GuidVector> m_ReviveQueue;
// these are important variables used for starting messages
uint8 m_Events;
@@ -568,8 +566,8 @@ class Battleground
virtual void PostUpdateImpl(uint32 /* diff */) { }
// Player lists
std::vector<uint64> m_ResurrectQueue; // Player GUID
std::deque<uint64> m_OfflineQueue; // Player GUID
GuidVector m_ResurrectQueue; // Player GUID
GuidDeque m_OfflineQueue; // Player GUID
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
@@ -237,7 +237,7 @@ void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
*data << uint32(soundid);
}
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid)
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
*data << uint64(guid);
@@ -626,7 +626,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
TC_LOG_DEBUG("bg.battleground", "Automatic Arena Point Distribution initialized.");
}
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
{
if (!player)
return;
@@ -707,7 +707,7 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt
TC_LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str());
}
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
@@ -72,13 +72,13 @@ class BattlegroundMgr
/* Packet Building */
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid);
void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint32 arenaFaction);
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId);
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid);
/* Battlegrounds */
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
@@ -281,7 +281,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
}
//remove player from queue and from group info, if group info is empty then remove it too
void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
void BattlegroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
{
int32 bracket_id = -1; // signed for proper for-loop finish
QueuedPlayersMap::iterator itr;
@@ -293,7 +293,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
std::string playerName = "Unknown";
if (Player* player = ObjectAccessor::FindPlayer(guid))
playerName = player->GetName();
TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid));
TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), guid.GetCounter());
return;
}
@@ -328,10 +328,10 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
//player can't be in queue without group, but just in case
if (bracket_id == -1)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", guid.GetCounter());
return;
}
TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", guid.GetCounter(), (uint32)bracket_id);
// ALL variables are correctly set
// We can ignore leveling up in queue - it should not cause crash
@@ -339,7 +339,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
// if only one player there, remove group
// remove player queue info from group queue info
std::map<uint64, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
std::map<ObjectGuid, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
if (pitr != group->Players.end())
group->Players.erase(pitr);
@@ -361,7 +361,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
{
TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", guid.GetCounter(), group->OpponentsTeamRating);
if (Player* player = ObjectAccessor::FindPlayer(guid))
at->MemberLost(player, group->OpponentsMatchmakerRating);
else
@@ -402,7 +402,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
}
//returns true when player pl_guid is in queue and is invited to bgInstanceGuid
bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
bool BattlegroundQueue::IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
return (qItr != m_QueuedPlayers.end()
@@ -410,7 +410,7 @@ bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceG
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime);
}
bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo)
bool BattlegroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
if (qItr == m_QueuedPlayers.end())
@@ -446,7 +446,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME;
// loop through the players
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
for (std::map<ObjectGuid, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
// get the player
Player* player = ObjectAccessor::FindPlayer(itr->first);
@@ -40,7 +40,7 @@ struct PlayerQueueInfo // stores informatio
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
{
std::map<uint64, PlayerQueueInfo*> Players; // player queue info map
std::map<ObjectGuid, PlayerQueueInfo*> Players; // player queue info map
uint32 Team; // Player team (ALLIANCE/HORDE)
BattlegroundTypeId BgTypeId; // battleground type id
bool IsRated; // rated
@@ -79,13 +79,13 @@ class BattlegroundQueue
bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0);
void RemovePlayer(uint64 guid, bool decreaseInvitedCount);
bool IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const;
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers;
//do NOT use deque because deque.erase() invalidates ALL iterators
@@ -138,7 +138,7 @@ class BattlegroundQueue
class BGQueueInviteEvent : public BasicEvent
{
public:
BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
{ }
virtual ~BGQueueInviteEvent() { }
@@ -146,7 +146,7 @@ class BGQueueInviteEvent : public BasicEvent
virtual bool Execute(uint64 e_time, uint32 p_time) override;
virtual void Abort(uint64 e_time) override;
private:
uint64 m_PlayerGuid;
ObjectGuid m_PlayerGuid;
uint32 m_BgInstanceGUID;
BattlegroundTypeId m_BgTypeId;
uint8 m_ArenaType;
@@ -161,7 +161,7 @@ class BGQueueInviteEvent : public BasicEvent
class BGQueueRemoveEvent : public BasicEvent
{
public:
BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
BGQueueRemoveEvent(ObjectGuid pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
{ }
@@ -170,7 +170,7 @@ class BGQueueRemoveEvent : public BasicEvent
virtual bool Execute(uint64 e_time, uint32 p_time) override;
virtual void Abort(uint64 e_time) override;
private:
uint64 m_PlayerGuid;
ObjectGuid m_PlayerGuid;
uint32 m_BgInstanceGUID;
uint32 m_RemoveTime;
BattlegroundTypeId m_BgTypeId;
@@ -19,6 +19,7 @@
#define TRINITY_BATTLEGROUND_SCORE_H
#include "WorldPacket.h"
#include "ObjectGuid.h"
enum ScoreType
{
@@ -55,7 +56,7 @@ struct BattlegroundScore
friend class Battleground;
protected:
BattlegroundScore(uint64 playerGuid) : PlayerGuid(playerGuid), KillingBlows(0), Deaths(0),
BattlegroundScore(ObjectGuid playerGuid) : PlayerGuid(playerGuid), KillingBlows(0), Deaths(0),
HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0) { }
virtual ~BattlegroundScore() { }
@@ -120,7 +121,7 @@ struct BattlegroundScore
virtual uint32 GetAttr4() const { return 0; }
virtual uint32 GetAttr5() const { return 0; }
uint64 PlayerGuid;
ObjectGuid PlayerGuid;
// Default score, present in every type
uint32 KillingBlows;
@@ -227,7 +227,7 @@ void BattlegroundAB::AddPlayer(Player* player)
PlayerScores[player->GetGUIDLow()] = new BattlegroundABScore(player->GetGUID());
}
void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundAB::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)
{
}
@@ -392,7 +392,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (capturedNodes >= 4)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL; // 0-6 spirit guides
Creature* trigger = !BgCreatures[node + 7] ? GetBGCreature(node + 7) : NULL; // 0-6 spirit guides
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER, node+7, BG_AB_NodePositions[node], GetTeamIndexByTeamId(team));
@@ -242,7 +242,7 @@ struct BattlegroundABScore final : public BattlegroundScore
friend class BattlegroundAB;
protected:
BattlegroundABScore(uint64 playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { }
BattlegroundABScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -283,7 +283,7 @@ class BattlegroundAB : public Battleground
void AddPlayer(Player* player) override;
void StartingEventCloseDoors() override;
void StartingEventOpenDoors() override;
void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
bool SetupBattleground() override;
void Reset() override;
@@ -480,7 +480,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
Battleground::EndBattleground(winner);
}
void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundAV::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/)
{
if (!player)
{
@@ -1554,7 +1554,7 @@ struct BattlegroundAVScore final : public BattlegroundScore
friend class BattlegroundAV;
protected:
BattlegroundAVScore(uint64 playerGuid) : BattlegroundScore(playerGuid), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { }
BattlegroundAVScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -1615,7 +1615,7 @@ class BattlegroundAV : public Battleground
void StartingEventCloseDoors() override;
void StartingEventOpenDoors() override;
void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;
bool SetupBattleground() override;
void ResetBGSubclass() override;
@@ -46,8 +46,8 @@ BattlegroundEY::BattlegroundEY()
m_HonorScoreTics[TEAM_HORDE] = 0;
m_TeamPointsCount[TEAM_ALLIANCE] = 0;
m_TeamPointsCount[TEAM_HORDE] = 0;
m_FlagKeeper = 0;
m_DroppedFlagGUID = 0;
m_FlagKeeper.Clear();
m_DroppedFlagGUID.Clear();
m_FlagCapturedBgObjectType = 0;
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
m_FlagsTimer = 0;
@@ -171,7 +171,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!player)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (%s) not found!", m_PlayersNearPoint[EY_POINTS_MAX][j].ToString().c_str());
++j;
continue;
}
@@ -211,7 +211,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
if (!player)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (%s) not found!", m_PlayersNearPoint[i][j].ToString().c_str());
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
@@ -368,7 +368,7 @@ void BattlegroundEY::AddPlayer(Player* player)
m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
}
void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
void BattlegroundEY::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j)
@@ -385,7 +385,7 @@ void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
EventPlayerDroppedFlag(player);
else
{
SetFlagPicker(0);
SetFlagPicker(ObjectGuid::Empty);
RespawnFlag(true);
}
}
@@ -548,8 +548,8 @@ void BattlegroundEY::Reset()
m_HonorScoreTics[TEAM_HORDE] = 0;
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
m_FlagCapturedBgObjectType = 0;
m_FlagKeeper = 0;
m_DroppedFlagGUID = 0;
m_FlagKeeper.Clear();
m_DroppedFlagGUID.Clear();
m_PointAddingTimer = 0;
m_TowerCapCheckTimer = 0;
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
@@ -593,9 +593,9 @@ void BattlegroundEY::RespawnFlagAfterDrop()
if (obj)
obj->Delete();
else
TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID()));
TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %s", GetDroppedFlagGUID().ToString().c_str());
SetDroppedFlagGUID(0);
SetDroppedFlagGUID(ObjectGuid::Empty);
}
void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer)
@@ -615,7 +615,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
// just take off the aura
if (IsFlagPickedup() && GetFlagPickerGUID() == player->GetGUID())
{
SetFlagPicker(0);
SetFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
}
return;
@@ -627,7 +627,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
if (GetFlagPickerGUID() != player->GetGUID())
return;
SetFlagPicker(0);
SetFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
m_FlagState = BG_EY_FLAG_STATE_ON_GROUND;
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
@@ -795,7 +795,7 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != player->GetGUID())
return;
SetFlagPicker(0);
SetFlagPicker(ObjectGuid::Empty);
m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN;
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
@@ -328,7 +328,7 @@ struct BattlegroundEYScore final : public BattlegroundScore
friend class BattlegroundEY;
protected:
BattlegroundEYScore(uint64 playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0) { }
BattlegroundEYScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -366,15 +366,14 @@ class BattlegroundEY : public Battleground
void StartingEventOpenDoors() override;
/* BG Flags */
uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; }
void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; }
bool IsFlagPickedup() const { return m_FlagKeeper != 0; }
ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; }
void SetFlagPicker(ObjectGuid guid) { m_FlagKeeper = guid; }
bool IsFlagPickedup() const { return !m_FlagKeeper.IsEmpty(); }
uint8 GetFlagState() const { return m_FlagState; }
void RespawnFlag(bool send_message);
void RespawnFlagAfterDrop();
void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
void HandleBuffUse(uint64 buff_guid);
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
void HandleKillPlayer(Player* player, Player* killer) override;
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override;
@@ -384,8 +383,8 @@ class BattlegroundEY : public Battleground
void EndBattleground(uint32 winner) override;
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
void FillInitialWorldStates(WorldPacket& data) override;
void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid;}
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
void SetDroppedFlagGUID(ObjectGuid guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid; }
ObjectGuid GetDroppedFlagGUID() const { return m_DroppedFlagGUID; }
/* Battleground Events */
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) override;
@@ -420,8 +419,8 @@ class BattlegroundEY : public Battleground
uint32 m_Points_Trigger[EY_POINTS_MAX];
uint64 m_FlagKeeper; // keepers guid
uint64 m_DroppedFlagGUID;
ObjectGuid m_FlagKeeper; // keepers guid
ObjectGuid m_DroppedFlagGUID;
uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured
uint8 m_FlagState; // for checking flag state
int32 m_FlagsTimer;
@@ -430,8 +429,7 @@ class BattlegroundEY : public Battleground
uint32 m_PointOwnedByTeam[EY_POINTS_MAX];
uint8 m_PointState[EY_POINTS_MAX];
int32 m_PointBarStatus[EY_POINTS_MAX];
typedef std::vector<uint64> PlayersNearPointType;
PlayersNearPointType m_PlayersNearPoint[EY_POINTS_MAX + 1];
GuidVector m_PlayersNearPoint[EY_POINTS_MAX + 1];
uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX];
int32 m_PointAddingTimer;
@@ -68,7 +68,7 @@ void BattlegroundIC::HandlePlayerResurrect(Player* player)
player->CastSpell(player, SPELL_OIL_REFINERY, true);
}
void BattlegroundIC::DoAction(uint32 action, uint64 var)
void BattlegroundIC::DoAction(uint32 action, ObjectGuid var)
{
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
return;
@@ -282,7 +282,7 @@ void BattlegroundIC::AddPlayer(Player* player)
player->CastSpell(player, SPELL_OIL_REFINERY, true);
}
void BattlegroundIC::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundIC::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/)
{
if (player)
{
@@ -853,7 +853,7 @@ struct BattlegroundICScore final : public BattlegroundScore
friend class BattlegroundIC;
protected:
BattlegroundICScore(uint64 playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { }
BattlegroundICScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -897,7 +897,7 @@ class BattlegroundIC : public Battleground
void StartingEventOpenDoors() override;
void PostUpdateImpl(uint32 diff) override;
void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;
bool SetupBattleground() override;
void SpawnLeader(uint32 teamid);
@@ -913,7 +913,7 @@ class BattlegroundIC : public Battleground
/* Scorekeeping */
void FillInitialWorldStates(WorldPacket& data) override;
void DoAction(uint32 action, uint64 var) override;
void DoAction(uint32 action, ObjectGuid var) override;
void HandlePlayerResurrect(Player* player) override;
@@ -506,7 +506,7 @@ void BattlegroundSA::AddPlayer(Player* player)
}
}
void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { }
void BattlegroundSA::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { }
void BattlegroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
{
@@ -513,7 +513,7 @@ struct BattlegroundSAScore final : public BattlegroundScore
friend class BattlegroundSA;
protected:
BattlegroundSAScore(uint64 playerGuid) : BattlegroundScore(playerGuid), DemolishersDestroyed(0), GatesDestroyed(0) { }
BattlegroundSAScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), DemolishersDestroyed(0), GatesDestroyed(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -594,7 +594,7 @@ class BattlegroundSA : public Battleground
void EndBattleground(uint32 winner) override;
/// Called when a player leave battleground
void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
/* Scorekeeping */
@@ -54,10 +54,10 @@ BattlegroundWS::BattlegroundWS()
_flagSpellForceTimer = 0;
_bothFlagsKept = false;
_flagDebuffState = 0;
m_FlagKeepers[TEAM_ALLIANCE] = 0;
m_FlagKeepers[TEAM_HORDE] = 0;
m_DroppedFlagGUID[TEAM_ALLIANCE] = 0;
m_DroppedFlagGUID[TEAM_HORDE] = 0;
m_FlagKeepers[TEAM_ALLIANCE].Clear();
m_FlagKeepers[TEAM_HORDE].Clear();
m_DroppedFlagGUID[TEAM_ALLIANCE].Clear();
m_DroppedFlagGUID[TEAM_HORDE].Clear();
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
_flagsTimer[TEAM_ALLIANCE] = 0;
@@ -278,9 +278,9 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)))
obj->Delete();
else
TC_LOG_ERROR("bg.battleground", "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
TC_LOG_ERROR("bg.battleground", "unknown droped flag bg, guid: %s", GetDroppedFlagGUID(team).ToString().c_str());
SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team));
SetDroppedFlagGUID(ObjectGuid::Empty, GetTeamIndexByTeamId(team));
_bothFlagsKept = false;
}
@@ -296,7 +296,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
SetHordeFlagPicker(ObjectGuid::Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
@@ -315,7 +315,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
SetAllianceFlagPicker(ObjectGuid::Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
@@ -385,7 +385,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
{
SetHordeFlagPicker(0);
SetHordeFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
}
}
@@ -396,7 +396,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
{
SetAllianceFlagPicker(0);
SetAllianceFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
}
}
@@ -411,7 +411,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
return;
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
{
SetHordeFlagPicker(0);
SetHordeFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (_flagDebuffState == 1)
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
@@ -428,7 +428,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
return;
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
{
SetAllianceFlagPicker(0);
SetAllianceFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (_flagDebuffState == 1)
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
@@ -583,7 +583,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
void BattlegroundWS::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[TEAM_ALLIANCE] == guid)
@@ -591,7 +591,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
if (!player)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!");
SetAllianceFlagPicker(0);
SetAllianceFlagPicker(ObjectGuid::Empty);
RespawnFlag(ALLIANCE, false);
}
else
@@ -602,7 +602,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
if (!player)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!");
SetHordeFlagPicker(0);
SetHordeFlagPicker(ObjectGuid::Empty);
RespawnFlag(HORDE, false);
}
else
@@ -731,10 +731,10 @@ void BattlegroundWS::Reset()
//call parent's class reset
Battleground::Reset();
m_FlagKeepers[TEAM_ALLIANCE] = 0;
m_FlagKeepers[TEAM_HORDE] = 0;
m_DroppedFlagGUID[TEAM_ALLIANCE] = 0;
m_DroppedFlagGUID[TEAM_HORDE] = 0;
m_FlagKeepers[TEAM_ALLIANCE].Clear();
m_FlagKeepers[TEAM_HORDE].Clear();
m_DroppedFlagGUID[TEAM_ALLIANCE].Clear();
m_DroppedFlagGUID[TEAM_HORDE].Clear();
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
m_TeamScores[TEAM_ALLIANCE] = 0;
@@ -152,7 +152,7 @@ struct BattlegroundWGScore final : public BattlegroundScore
friend class BattlegroundWS;
protected:
BattlegroundWGScore(uint64 playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0), FlagReturns(0) { }
BattlegroundWGScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0), FlagReturns(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -197,16 +197,16 @@ class BattlegroundWS : public Battleground
void StartingEventOpenDoors() override;
/* BG Flags */
uint64 GetFlagPickerGUID(int32 team) const override
ObjectGuid GetFlagPickerGUID(int32 team) const override
{
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
return m_FlagKeepers[team];
return 0;
return ObjectGuid::Empty;
}
void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; }
void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_HORDE] = guid; }
bool IsAllianceFlagPickedup() const { return m_FlagKeepers[TEAM_ALLIANCE] != 0; }
bool IsHordeFlagPickedup() const { return m_FlagKeepers[TEAM_HORDE] != 0; }
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; }
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[TEAM_HORDE] = guid; }
bool IsAllianceFlagPickedup() const { return !m_FlagKeepers[TEAM_ALLIANCE].IsEmpty(); }
bool IsHordeFlagPickedup() const { return !m_FlagKeepers[TEAM_HORDE].IsEmpty(); }
void RespawnFlag(uint32 Team, bool captured);
void RespawnFlagAfterDrop(uint32 Team);
uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; }
@@ -216,7 +216,7 @@ class BattlegroundWS : public Battleground
void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) override;
void EventPlayerCapturedFlag(Player* player);
void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;
void HandleKillPlayer(Player* player, Player* killer) override;
bool SetupBattleground() override;
@@ -228,13 +228,13 @@ class BattlegroundWS : public Battleground
void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team);
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
void SetDroppedFlagGUID(uint64 guid, int32 team = -1) override
void SetDroppedFlagGUID(ObjectGuid guid, int32 team = -1) override
{
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
m_DroppedFlagGUID[team] = guid;
}
uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; }
void FillInitialWorldStates(WorldPacket& data) override;
/* Scorekeeping */
@@ -248,8 +248,8 @@ class BattlegroundWS : public Battleground
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override;
private:
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
uint64 m_DroppedFlagGUID[2];
ObjectGuid m_FlagKeepers[2]; // 0 - alliance, 1 - horde
ObjectGuid m_DroppedFlagGUID[2];
uint8 _flagState[2]; // for checking flag state
int32 _flagsTimer[2];
int32 _flagsDropTimer[2];
+31 -31
View File
@@ -58,7 +58,7 @@ void CalendarMgr::LoadFromDB()
Field* fields = result->Fetch();
uint64 eventId = fields[0].GetUInt64();
uint64 creatorGUID = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
ObjectGuid creatorGUID = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
std::string title = fields[2].GetString();
std::string description = fields[3].GetString();
CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
@@ -91,8 +91,8 @@ void CalendarMgr::LoadFromDB()
uint64 inviteId = fields[0].GetUInt64();
uint64 eventId = fields[1].GetUInt64();
uint64 invitee = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
uint64 senderGUID = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
ObjectGuid invitee = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
ObjectGuid senderGUID = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
uint32 statusTime = fields[5].GetUInt32();
CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
@@ -146,7 +146,7 @@ void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite
}
}
void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
void CalendarMgr::RemoveEvent(uint64 eventId, ObjectGuid remover)
{
CalendarEvent* calendarEvent = GetEvent(eventId);
@@ -173,7 +173,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
// guild events only? check invite status here?
// When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
if (remover && invite->GetInviteeGUID() != remover)
mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);
mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID().GetCounter()), calendarEvent, MAIL_CHECK_MASK_COPIED);
delete invite;
}
@@ -189,7 +189,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
_events.erase(calendarEvent);
}
void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover*/)
void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid /*remover*/)
{
CalendarEvent* calendarEvent = GetEvent(eventId);
@@ -228,7 +228,7 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT);
stmt->setUInt64(0, calendarEvent->GetEventId());
stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID()));
stmt->setUInt32(1, calendarEvent->GetCreatorGUID().GetCounter());
stmt->setString(2, calendarEvent->GetTitle());
stmt->setString(3, calendarEvent->GetDescription());
stmt->setUInt8(4, calendarEvent->GetType());
@@ -250,8 +250,8 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE);
stmt->setUInt64(0, invite->GetInviteId());
stmt->setUInt64(1, invite->GetEventId());
stmt->setUInt32(2, GUID_LOPART(invite->GetInviteeGUID()));
stmt->setUInt32(3, GUID_LOPART(invite->GetSenderGUID()));
stmt->setUInt32(2, invite->GetInviteeGUID().GetCounter());
stmt->setUInt32(3, invite->GetSenderGUID().GetCounter());
stmt->setUInt8(4, invite->GetStatus());
stmt->setUInt32(5, uint32(invite->GetStatusTime()));
stmt->setUInt8(6, invite->GetRank());
@@ -259,18 +259,18 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
void CalendarMgr::RemoveAllPlayerEventsAndInvites(ObjectGuid guid)
{
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
if ((*itr)->GetCreatorGUID() == guid)
RemoveEvent((*itr)->GetEventId(), 0); // don't send mail if removing a character
RemoveEvent((*itr)->GetEventId(), ObjectGuid::Empty); // don't send mail if removing a character
CalendarInviteStore playerInvites = GetPlayerInvites(guid);
for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
}
void CalendarMgr::RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId)
void CalendarMgr::RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId)
{
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
@@ -340,7 +340,7 @@ uint64 CalendarMgr::GetFreeInviteId()
return inviteId;
}
CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid)
CalendarEventStore CalendarMgr::GetPlayerEvents(ObjectGuid guid)
{
CalendarEventStore events;
@@ -363,7 +363,7 @@ CalendarInviteStore const& CalendarMgr::GetEventInvites(uint64 eventId)
return _invites[eventId];
}
CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
CalendarInviteStore CalendarMgr::GetPlayerInvites(ObjectGuid guid)
{
CalendarInviteStore invites;
@@ -375,7 +375,7 @@ CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
return invites;
}
uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid guid)
{
CalendarInviteStore const& invites = GetPlayerInvites(guid);
@@ -397,10 +397,10 @@ uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
return pendingNum;
}
std::string CalendarEvent::BuildCalendarMailSubject(uint64 remover) const
std::string CalendarEvent::BuildCalendarMailSubject(ObjectGuid remover) const
{
std::ostringstream strm;
strm << remover << ':' << _title;
strm << remover.GetRawValue() << ':' << _title;
return strm.str();
}
@@ -423,13 +423,13 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
time_t statusTime = invite.GetStatusTime();
bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00
uint64 invitee = invite.GetInviteeGUID();
ObjectGuid invitee = invite.GetInviteeGUID();
Player* player = ObjectAccessor::FindPlayer(invitee);
uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
data.appendPackGUID(invitee);
data << invitee.WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint64(invite.GetInviteId());
data << uint8(level);
@@ -474,7 +474,7 @@ void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEven
void CalendarMgr::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
data.appendPackGUID(invite.GetInviteeGUID());
data << invite.GetInviteeGUID().WriteAsPacked();
data << uint64(calendarEvent.GetEventId());
data.AppendPackedTime(calendarEvent.GetEventTime());
data << uint32(calendarEvent.GetFlags());
@@ -498,7 +498,7 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEve
void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags)
{
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
data.appendPackGUID(invite.GetInviteeGUID());
data << invite.GetInviteeGUID().WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint32(flags);
data << uint8(1); // FIXME
@@ -509,7 +509,7 @@ void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEve
void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1);
data.appendPackGUID(invite.GetInviteeGUID());
data << invite.GetInviteeGUID().WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint8(invite.GetRank());
data << uint8(1); // Unk boolean - Display to client?
@@ -529,8 +529,8 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
data << uint64(invite.GetInviteId());
data << uint8(invite.GetStatus());
data << uint8(invite.GetRank());
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data.appendPackGUID(invite.GetSenderGUID());
data << calendarEvent.GetCreatorGUID().WriteAsPacked();
data << invite.GetSenderGUID().WriteAsPacked();
if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
{
@@ -542,7 +542,7 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
player->SendDirectMessage(&data);
}
void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
@@ -552,7 +552,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
data << uint8(sendType);
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data << calendarEvent.GetCreatorGUID().WriteAsPacked();
data << uint64(calendarEvent.GetEventId());
data << calendarEvent.GetTitle();
data << calendarEvent.GetDescription();
@@ -569,13 +569,13 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
{
CalendarInvite const* calendarInvite = (*itr);
uint64 inviteeGuid = calendarInvite->GetInviteeGUID();
ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
data.appendPackGUID(inviteeGuid);
data << inviteeGuid.WriteAsPacked();
data << uint8(inviteeLevel);
data << uint8(calendarInvite->GetStatus());
data << uint8(calendarInvite->GetRank());
@@ -588,7 +588,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
player->SendDirectMessage(&data);
}
void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
void CalendarMgr::SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
@@ -602,7 +602,7 @@ void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent
}
}
void CalendarMgr::SendCalendarClearPendingAction(uint64 guid)
void CalendarMgr::SendCalendarClearPendingAction(ObjectGuid guid)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
@@ -611,7 +611,7 @@ void CalendarMgr::SendCalendarClearPendingAction(uint64 guid)
}
}
void CalendarMgr::SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param /*= NULL*/)
void CalendarMgr::SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param /*= NULL*/)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
+26 -25
View File
@@ -21,6 +21,7 @@
#include "Common.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "ObjectGuid.h"
enum CalendarMailAnswers
{
@@ -140,10 +141,10 @@ struct CalendarInvite
_text = calendarInvite.GetText();
}
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(NULL)),
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(time(NULL)),
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t statusTime,
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
_inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime),
_status(status), _rank(rank), _text(text) { }
@@ -156,11 +157,11 @@ struct CalendarInvite
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
uint64 GetSenderGUID() const { return _senderGUID; }
void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; }
ObjectGuid GetSenderGUID() const { return _senderGUID; }
void SetInvitee(uint64 guid) { _invitee = guid; }
uint64 GetInviteeGUID() const { return _invitee; }
void SetInvitee(ObjectGuid guid) { _invitee = guid; }
ObjectGuid GetInviteeGUID() const { return _invitee; }
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
time_t GetStatusTime() const { return _statusTime; }
@@ -177,8 +178,8 @@ struct CalendarInvite
private:
uint64 _inviteId;
uint64 _eventId;
uint64 _invitee;
uint64 _senderGUID;
ObjectGuid _invitee;
ObjectGuid _senderGUID;
time_t _statusTime;
CalendarInviteStatus _status;
CalendarModerationRank _rank;
@@ -202,13 +203,13 @@ struct CalendarEvent
_description = calendarEvent.GetDescription();
}
CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
CalendarEvent(uint64 eventId, ObjectGuid creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
_eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
_eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
_description(description) { }
CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
CalendarEvent() : _eventId(1), _creatorGUID(), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
_flags(0), _timezoneTime(0), _title(""), _description("") { }
~CalendarEvent();
@@ -216,8 +217,8 @@ struct CalendarEvent
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
uint64 GetCreatorGUID() const { return _creatorGUID; }
void SetCreatorGUID(ObjectGuid guid) { _creatorGUID = guid; }
ObjectGuid GetCreatorGUID() const { return _creatorGUID; }
void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; }
@@ -246,12 +247,12 @@ struct CalendarEvent
bool IsGuildEvent() const { return (_flags & CALENDAR_FLAG_GUILD_EVENT) != 0; }
bool IsGuildAnnouncement() const { return (_flags & CALENDAR_FLAG_WITHOUT_INVITES) != 0; }
std::string BuildCalendarMailSubject(uint64 remover) const;
std::string BuildCalendarMailSubject(ObjectGuid remover) const;
std::string BuildCalendarMailBody() const;
private:
uint64 _eventId;
uint64 _creatorGUID;
ObjectGuid _creatorGUID;
uint32 _guildId;
CalendarEventType _type;
int32 _dungeonId;
@@ -290,44 +291,44 @@ class CalendarMgr
CalendarEvent* GetEvent(uint64 eventId) const;
CalendarEventStore const& GetEvents() const { return _events; }
CalendarEventStore GetPlayerEvents(uint64 guid);
CalendarEventStore GetPlayerEvents(ObjectGuid guid);
CalendarInvite* GetInvite(uint64 inviteId) const;
CalendarEventInviteStore const& GetInvites() const { return _invites; }
CalendarInviteStore const& GetEventInvites(uint64 eventId);
CalendarInviteStore GetPlayerInvites(uint64 guid);
CalendarInviteStore GetPlayerInvites(ObjectGuid guid);
void FreeEventId(uint64 id);
uint64 GetFreeEventId();
void FreeInviteId(uint64 id);
uint64 GetFreeInviteId();
uint32 GetPlayerNumPending(uint64 guid);
uint32 GetPlayerNumPending(ObjectGuid guid);
void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType);
void RemoveEvent(uint64 eventId, uint64 remover);
void RemoveEvent(uint64 eventId, ObjectGuid remover);
void UpdateEvent(CalendarEvent* calendarEvent);
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans);
void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover);
void UpdateInvite(CalendarInvite* invite);
void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
void RemoveAllPlayerEventsAndInvites(uint64 guid);
void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
void RemoveAllPlayerEventsAndInvites(ObjectGuid guid);
void RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId);
void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
void SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
void SendCalendarEventInvite(CalendarInvite const& invite);
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags);
void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
void SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime);
void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarClearPendingAction(uint64 guid);
void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = NULL);
void SendCalendarClearPendingAction(ObjectGuid guid);
void SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param = NULL);
void SendPacketToAllEventRelatives(WorldPacket& packet, CalendarEvent const& calendarEvent);
};
+47 -47
View File
@@ -32,7 +32,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
_flags(0),
_channelId(channelId),
_Team(team),
_ownerGUID(0),
_ownerGUID(),
_name(name),
_password("")
{
@@ -80,10 +80,10 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
Tokenizer tokens(db_BannedList, ' ');
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
{
uint64 banned_guid = atol(*i);
ObjectGuid banned_guid(uint64(strtoull(*i, NULL, 10)));
if (banned_guid)
{
TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid);
TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore %s", name.c_str(), banned_guid.ToString().c_str());
bannedStore.insert(banned_guid);
}
}
@@ -110,7 +110,7 @@ void Channel::UpdateChannelInDB() const
std::ostringstream banlist;
BannedContainer::const_iterator iter;
for (iter = bannedStore.begin(); iter != bannedStore.end(); ++iter)
banlist << (*iter) << ' ';
banlist << iter->GetRawValue() << ' ';
std::string banListStr = banlist.str();
@@ -149,7 +149,7 @@ void Channel::CleanOldChannelsInDB()
void Channel::JoinChannel(Player* player, std::string const& pass)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (IsOn(guid))
{
// Do not send error message for built-in channels
@@ -227,7 +227,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
void Channel::LeaveChannel(Player* player, bool send)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
if (send)
@@ -269,7 +269,7 @@ void Channel::LeaveChannel(Player* player, bool send)
// If the channel owner left and there are still playersStore inside, pick a new owner
if (changeowner && _ownership && !playersStore.empty())
{
uint64 newowner = playersStore.begin()->second.player;
ObjectGuid newowner = playersStore.begin()->second.player;
playersStore[newowner].SetModerator(true);
SetOwner(newowner);
}
@@ -278,7 +278,7 @@ void Channel::LeaveChannel(Player* player, bool send)
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
uint64 good = player->GetGUID();
ObjectGuid good = player->GetGUID();
if (!IsOn(good))
{
@@ -297,7 +297,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
}
Player* bad = sObjectAccessor->FindPlayerByName(badname);
uint64 victim = bad ? bad->GetGUID() : 0;
ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim))
{
WorldPacket data;
@@ -340,7 +340,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
if (changeowner && _ownership && !playersStore.empty())
{
uint64 newowner = good;
ObjectGuid newowner = good;
playersStore[newowner].SetModerator(true);
SetOwner(newowner);
}
@@ -348,7 +348,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
void Channel::UnBan(Player const* player, std::string const& badname)
{
uint64 good = player->GetGUID();
ObjectGuid good = player->GetGUID();
if (!IsOn(good))
{
@@ -367,7 +367,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
}
Player* bad = sObjectAccessor->FindPlayerByName(badname);
uint64 victim = bad ? bad->GetGUID(): 0;
ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsBanned(victim))
{
@@ -388,7 +388,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
void Channel::Password(Player const* player, std::string const& pass)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
ChatHandler chat(player->GetSession());
if (!IsOn(guid))
@@ -418,7 +418,7 @@ void Channel::Password(Player const* player, std::string const& pass)
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -440,7 +440,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
return;
Player* newp = sObjectAccessor->FindPlayerByName(p2n);
uint64 victim = newp ? newp->GetGUID() : 0;
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim) ||
(player->GetTeam() != newp->GetTeam() &&
@@ -469,7 +469,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
void Channel::SetOwner(Player const* player, std::string const& newname)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -488,7 +488,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
}
Player* newp = sObjectAccessor->FindPlayerByName(newname);
uint64 victim = newp ? newp->GetGUID() : 0;
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim) ||
(player->GetTeam() != newp->GetTeam() &&
@@ -505,7 +505,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
SetOwner(victim);
}
void Channel::SendWhoOwner(uint64 guid)
void Channel::SendWhoOwner(ObjectGuid guid)
{
WorldPacket data;
if (IsOn(guid))
@@ -517,7 +517,7 @@ void Channel::SendWhoOwner(uint64 guid)
void Channel::List(Player const* player)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -565,7 +565,7 @@ void Channel::List(Player const* player)
void Channel::Announce(Player const* player)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -595,7 +595,7 @@ void Channel::Announce(Player const* player)
UpdateChannelInDB();
}
void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
void Channel::Say(ObjectGuid guid, std::string const& what, uint32 lang)
{
if (what.empty())
return;
@@ -626,12 +626,12 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
else
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name);
SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false);
SendToAll(&data, !playersStore[guid].IsModerator() ? guid : ObjectGuid::Empty);
}
void Channel::Invite(Player const* player, std::string const& newname)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -676,7 +676,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
return;
}
if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid)))
if (!newp->GetSocial()->HasIgnore(guid.GetCounter()))
{
WorldPacket data;
MakeInvite(&data, guid);
@@ -689,7 +689,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
SendToOne(&data, guid);
}
void Channel::SetOwner(uint64 guid, bool exclaim)
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
{
if (_ownerGUID)
{
@@ -720,15 +720,15 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
}
}
void Channel::SendToAll(WorldPacket* data, uint64 guid)
void Channel::SendToAll(WorldPacket* data, ObjectGuid guid)
{
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (Player* player = ObjectAccessor::FindPlayer(i->first))
if (!guid || !player->GetSocial()->HasIgnore(GUID_LOPART(guid)))
if (!guid || !player->GetSocial()->HasIgnore(guid.GetCounter()))
player->GetSession()->SendPacket(data);
}
void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
void Channel::SendToAllButOne(WorldPacket* data, ObjectGuid who)
{
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (i->first != who)
@@ -736,18 +736,18 @@ void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
player->GetSession()->SendPacket(data);
}
void Channel::SendToOne(WorldPacket* data, uint64 who)
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
{
if (Player* player = ObjectAccessor::FindPlayer(who))
player->GetSession()->SendPacket(data);
}
void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
@@ -759,13 +759,13 @@ void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
*data << _name;
}
void Channel::MakeJoined(WorldPacket* data, uint64 guid)
void Channel::MakeJoined(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << uint64(guid);
}
void Channel::MakeLeft(WorldPacket* data, uint64 guid)
void Channel::MakeLeft(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << uint64(guid);
@@ -801,13 +801,13 @@ void Channel::MakeNotModerator(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
}
void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid)
void Channel::MakePasswordChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << uint64(guid);
}
void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid)
void Channel::MakeOwnerChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << uint64(guid);
@@ -835,7 +835,7 @@ void Channel::MakeChannelOwner(WorldPacket* data)
*data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name);
}
void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
void Channel::MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags)
{
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
*data << uint64(guid);
@@ -843,13 +843,13 @@ void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
*data << uint8(GetPlayerFlags(guid));
}
void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid)
void Channel::MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << uint64(guid);
}
void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid)
void Channel::MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << uint64(guid);
@@ -860,7 +860,7 @@ void Channel::MakeMuted(WorldPacket* data)
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
}
void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
void Channel::MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
*data << uint64(bad);
@@ -872,14 +872,14 @@ void Channel::MakeBanned(WorldPacket* data)
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
}
void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
void Channel::MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
*data << uint64(bad);
*data << uint64(good);
}
void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
void Channel::MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
*data << uint64(bad);
@@ -892,13 +892,13 @@ void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name)
*data << name;
}
void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid)
void Channel::MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
*data << uint64(guid);
}
void Channel::MakeInvite(WorldPacket* data, uint64 guid)
void Channel::MakeInvite(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << uint64(guid);
@@ -951,19 +951,19 @@ void Channel::MakeNotInLfg(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
}
void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid)
void Channel::MakeVoiceOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << uint64(guid);
}
void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
void Channel::MakeVoiceOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
*data << uint64(guid);
}
void Channel::JoinNotify(uint64 guid)
void Channel::JoinNotify(ObjectGuid guid)
{
WorldPacket data(IsConstant() ? SMSG_USERLIST_ADD : SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(guid);
@@ -978,7 +978,7 @@ void Channel::JoinNotify(uint64 guid)
SendToAll(&data);
}
void Channel::LeaveNotify(uint64 guid)
void Channel::LeaveNotify(ObjectGuid guid)
{
WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
data << uint64(guid);
+35 -35
View File
@@ -122,7 +122,7 @@ class Channel
{
struct PlayerInfo
{
uint64 player;
ObjectGuid player;
uint8 flags;
bool HasFlag(uint8 flag) const { return (flags & flag) != 0; }
@@ -169,21 +169,21 @@ class Channel
void UnBan(Player const* player, std::string const& badname);
void Password(Player const* player, std::string const& pass);
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
void SetOwner(uint64 guid, bool exclaim = true);
void SetOwner(ObjectGuid guid, bool exclaim = true);
void SetOwner(Player const* player, std::string const& name);
void SendWhoOwner(uint64 guid);
void SendWhoOwner(ObjectGuid guid);
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
void List(Player const* player);
void Announce(Player const* player);
void Say(uint64 guid, std::string const& what, uint32 lang);
void Say(ObjectGuid guid, std::string const& what, uint32 lang);
void Invite(Player const* player, std::string const& newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
void JoinNotify(uint64 guid); // invisible notify
void LeaveNotify(uint64 guid); // invisible notify
void Voice(ObjectGuid guid1, ObjectGuid guid2);
void DeVoice(ObjectGuid guid1, ObjectGuid guid2);
void JoinNotify(ObjectGuid guid); // invisible notify
void LeaveNotify(ObjectGuid guid); // invisible notify
void SetOwnership(bool ownership) { _ownership = ownership; };
static void CleanOldChannelsInDB();
@@ -191,29 +191,29 @@ class Channel
// initial packet data (notify type and channel name)
void MakeNotifyPacket(WorldPacket* data, uint8 notify_type);
// type specific packet data
void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00
void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01
void MakeJoined(WorldPacket* data, ObjectGuid guid); //+ 0x00
void MakeLeft(WorldPacket* data, ObjectGuid guid); //+ 0x01
void MakeYouJoined(WorldPacket* data); //+ 0x02
void MakeYouLeft(WorldPacket* data); //+ 0x03
void MakeWrongPassword(WorldPacket* data); //? 0x04
void MakeNotMember(WorldPacket* data); //? 0x05
void MakeNotModerator(WorldPacket* data); //? 0x06
void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
void MakePasswordChanged(WorldPacket* data, ObjectGuid guid); //+ 0x07
void MakeOwnerChanged(WorldPacket* data, ObjectGuid guid); //? 0x08
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
void MakeNotOwner(WorldPacket* data); //? 0x0A
void MakeChannelOwner(WorldPacket* data); //? 0x0B
void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E
void MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags);//+ 0x0C
void MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid); //+ 0x0E
void MakeMuted(WorldPacket* data); //? 0x11
void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12
void MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x12
void MakeBanned(WorldPacket* data); //? 0x13
void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
void MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x14
void MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x15
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid); //+ 0x17
void MakeInvite(WorldPacket* data, ObjectGuid guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
void MakeWrongFaction(WorldPacket* data); //? 0x1A
void MakeInvalidName(WorldPacket* data); //? 0x1B
@@ -223,26 +223,26 @@ class Channel
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
void MakeVoiceOn(WorldPacket* data, ObjectGuid guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, ObjectGuid guid); //+ 0x23
void SendToAll(WorldPacket* data, uint64 guid = 0);
void SendToAllButOne(WorldPacket* data, uint64 who);
void SendToOne(WorldPacket* data, uint64 who);
void SendToAll(WorldPacket* data, ObjectGuid guid = ObjectGuid::Empty);
void SendToAllButOne(WorldPacket* data, ObjectGuid who);
void SendToOne(WorldPacket* data, ObjectGuid who);
bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); }
bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
bool IsBanned(ObjectGuid guid) const { return bannedStore.find(guid) != bannedStore.end(); }
void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const;
uint8 GetPlayerFlags(uint64 guid) const
uint8 GetPlayerFlags(ObjectGuid guid) const
{
PlayerContainer::const_iterator itr = playersStore.find(guid);
return itr != playersStore.end() ? itr->second.flags : 0;
}
void SetModerator(uint64 guid, bool set)
void SetModerator(ObjectGuid guid, bool set)
{
if (playersStore[guid].IsModerator() != set)
{
@@ -255,7 +255,7 @@ class Channel
}
}
void SetMute(uint64 guid, bool set)
void SetMute(ObjectGuid guid, bool set)
{
if (playersStore[guid].IsMuted() != set)
{
@@ -268,8 +268,8 @@ class Channel
}
}
typedef std::map<uint64, PlayerInfo> PlayerContainer;
typedef std::set<uint64> BannedContainer;
typedef std::map<ObjectGuid, PlayerInfo> PlayerContainer;
typedef GuidSet BannedContainer;
bool _announce;
bool _ownership;
@@ -277,7 +277,7 @@ class Channel
uint8 _flags;
uint32 _channelId;
uint32 _Team;
uint64 _ownerGUID;
ObjectGuid _ownerGUID;
std::string _name;
std::string _password;
PlayerContainer playersStore;
+32 -32
View File
@@ -125,7 +125,7 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const
return HasPermission(cmd.Permission);
}
bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
{
WorldSession* target_session = NULL;
uint32 target_account = 0;
@@ -345,7 +345,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st
Player* player = m_session->GetPlayer();
if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
{
uint64 guid = player->GetTarget();
ObjectGuid guid = player->GetTarget();
uint32 areaId = player->GetAreaId();
std::string areaName = "Unknown";
std::string zoneName = "Unknown";
@@ -357,14 +357,14 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st
zoneName = zone->area_name[locale];
}
sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Guid: %u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected %s: %s (GUID: %u)]",
fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (%s) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%s)]",
fullcmd.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(),
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
player->GetPositionZ(), player->GetMapId(),
player->GetMap() ? player->GetMap()->GetMapName() : "Unknown",
areaId, areaName.c_str(), zoneName.c_str(), GetLogNameForGuid(guid),
areaId, areaName.c_str(), zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
GUID_LOPART(guid));
guid.ToString().c_str());
}
}
// some commands have custom error messages. Don't send the default one in these cases.
@@ -629,7 +629,7 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd)
return ShowHelpForSubCommands(table, "", cmd);
}
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
{
@@ -653,7 +653,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
data << senderName;
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
if (receiverGUID && !IS_PLAYER_GUID(receiverGUID) && !IS_PET_GUID(receiverGUID))
if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
{
data << uint32(receiverName.length() + 1);
data << receiverName;
@@ -670,7 +670,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
case CHAT_MSG_BG_SYSTEM_HORDE:
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
if (receiverGUID && !IS_PLAYER_GUID(receiverGUID))
if (receiverGUID && !receiverGUID.IsPlayer())
{
data << uint32(receiverName.length() + 1);
data << receiverName;
@@ -712,11 +712,11 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message,
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
{
uint64 senderGUID = 0;
ObjectGuid senderGUID;
std::string senderName = "";
uint8 chatTag = 0;
bool gmMessage = false;
uint64 receiverGUID = 0;
ObjectGuid receiverGUID;
std::string receiverName = "";
if (sender)
{
@@ -743,7 +743,7 @@ Player* ChatHandler::getSelectedPlayer()
if (!m_session)
return NULL;
uint64 selected = m_session->GetPlayer()->GetTarget();
ObjectGuid selected = m_session->GetPlayer()->GetTarget();
if (!selected)
return m_session->GetPlayer();
@@ -766,9 +766,9 @@ WorldObject* ChatHandler::getSelectedObject()
if (!m_session)
return NULL;
uint64 guid = m_session->GetPlayer()->GetTarget();
ObjectGuid guid = m_session->GetPlayer()->GetTarget();
if (guid == 0)
if (!guid)
return GetNearbyGameObject();
return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid);
@@ -787,7 +787,7 @@ Player* ChatHandler::getSelectedPlayerOrSelf()
if (!m_session)
return NULL;
uint64 selected = m_session->GetPlayer()->GetTarget();
ObjectGuid selected = m_session->GetPlayer()->GetTarget();
if (!selected)
return m_session->GetPlayer();
@@ -932,7 +932,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
Player* pl = m_session->GetPlayer();
GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, entry, lowguid));
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
{
@@ -1053,7 +1053,7 @@ static char const* const guidKeys[] =
nullptr
};
uint64 ChatHandler::extractGuidFromLink(char* text)
ObjectGuid ChatHandler::extractGuidFromLink(char* text)
{
int type = 0;
@@ -1062,7 +1062,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
// |color|Hplayer:name|h[name]|h|r
char* idS = extractKeyFromLink(text, guidKeys, &type);
if (!idS)
return 0;
return ObjectGuid::Empty;
switch (type)
{
@@ -1070,38 +1070,38 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
{
std::string name = idS;
if (!normalizePlayerName(name))
return 0;
return ObjectGuid::Empty;
if (Player* player = sObjectAccessor->FindPlayerByName(name))
return player->GetGUID();
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
if (ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(name))
return guid;
return 0;
return ObjectGuid::Empty;
}
case SPELL_LINK_CREATURE:
{
uint32 lowguid = (uint32)atol(idS);
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
return ObjectGuid(HIGHGUID_UNIT, data->id, lowguid);
else
return 0;
return ObjectGuid::Empty;
}
case SPELL_LINK_GAMEOBJECT:
{
uint32 lowguid = (uint32)atol(idS);
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
return ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, lowguid);
else
return 0;
return ObjectGuid::Empty;
}
}
// unknown type?
return 0;
return ObjectGuid::Empty;
}
std::string ChatHandler::extractPlayerNameFromLink(char* text)
@@ -1118,7 +1118,7 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text)
return name;
}
bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/, std::string* player_name /*= NULL*/)
bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid /*=NULL*/, std::string* player_name /*= NULL*/)
{
if (args && *args)
{
@@ -1137,7 +1137,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
*player = pl;
// if need guid value from DB (in name case for check player existence)
uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : 0;
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : ObjectGuid::Empty;
// if allowed player guid (if no then only online players allowed)
if (player_guid)
@@ -1154,7 +1154,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
*player = pl;
// if allowed player guid (if no then only online players allowed)
if (player_guid)
*player_guid = pl ? pl->GetGUID() : 0;
*player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
if (player_name)
*player_name = pl ? pl->GetName() : "";
@@ -1277,10 +1277,10 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
return true;
}
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline)
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline)
{
player = NULL;
guid = 0;
player = NULL;
guid.Clear();
if (cname)
{
+5 -5
View File
@@ -54,7 +54,7 @@ class ChatHandler
virtual ~ChatHandler() { }
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
std::string const& senderName = "", std::string const& receiverName = "",
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
@@ -89,7 +89,7 @@ class ChatHandler
virtual LocaleConstant GetSessionDbcLocale() const;
virtual int GetSessionDbLocaleIndex() const;
bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
bool HasLowerSecurity(Player* target, ObjectGuid guid, bool strong = false);
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
void SendGlobalGMSysMessage(const char *str);
@@ -108,12 +108,12 @@ class ChatHandler
char* extractQuotedArg(char* args);
uint32 extractSpellIdFromLink(char* text);
uint64 extractGuidFromLink(char* text);
ObjectGuid extractGuidFromLink(char* text);
GameTele const* extractGameTeleFromLink(char* text);
bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false);
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false);
std::string extractPlayerNameFromLink(char* text);
// select by arg (name/link) or in-game selection online/offline player or self if a creature is selected
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL);
bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = NULL, std::string* player_name = NULL);
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
std::string GetNameLink(Player* chr) const;
+1 -1
View File
@@ -269,7 +269,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const
if (!victim)
return NULL;
uint64 const guid = victim->GetGUID();
ObjectGuid guid = victim->GetGUID();
for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
{
HostileReference* ref = (*i);
+3 -2
View File
@@ -23,6 +23,7 @@
#include "SharedDefines.h"
#include "LinkedReference/Reference.h"
#include "UnitEvents.h"
#include "ObjectGuid.h"
#include <list>
@@ -103,7 +104,7 @@ class HostileReference : public Reference<Unit, ThreatManager>
//=================================================
uint64 getUnitGuid() const { return iUnitGuid; }
ObjectGuid getUnitGuid() const { return iUnitGuid; }
//=================================================
// reference is not needed anymore. realy delete it !
@@ -132,7 +133,7 @@ class HostileReference : public Reference<Unit, ThreatManager>
private:
float iThreat;
float iTempThreatModifier; // used for taunt
uint64 iUnitGuid;
ObjectGuid iUnitGuid;
bool iOnline;
bool iAccessible;
};
+5 -2
View File
@@ -166,12 +166,15 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case INSTANCE_INFO_DATA:
condMeets = instance->GetData(ConditionValue1) == ConditionValue2;
break;
case INSTANCE_INFO_DATA64:
condMeets = instance->GetData64(ConditionValue1) == ConditionValue2;
case INSTANCE_INFO_GUID_DATA:
condMeets = instance->GetGuidData(ConditionValue1) == ObjectGuid(uint64(ConditionValue2));
break;
case INSTANCE_INFO_BOSS_STATE:
condMeets = instance->GetBossState(ConditionValue1) == EncounterState(ConditionValue2);
break;
case INSTANCE_INFO_DATA64:
condMeets = instance->GetData64(ConditionValue1) == ConditionValue2;
break;
}
}
}
+3 -2
View File
@@ -146,8 +146,9 @@ enum RelationType
enum InstanceInfo
{
INSTANCE_INFO_DATA = 0,
INSTANCE_INFO_DATA64,
INSTANCE_INFO_BOSS_STATE
INSTANCE_INFO_GUID_DATA,
INSTANCE_INFO_BOSS_STATE,
INSTANCE_INFO_DATA64
};
enum MaxConditionTargets
+4 -5
View File
@@ -19,6 +19,7 @@
#define _LFG_H
#include "Common.h"
#include "ObjectGuid.h"
namespace lfg
{
@@ -96,11 +97,9 @@ enum LfgAnswer
typedef std::set<uint32> LfgDungeonSet;
typedef std::map<uint32, uint32> LfgLockMap;
typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
typedef std::set<uint64> LfgGuidSet;
typedef std::list<uint64> LfgGuidList;
typedef std::map<uint64, uint8> LfgRolesMap;
typedef std::map<uint64, uint64> LfgGroupsMap;
typedef std::map<ObjectGuid, LfgLockMap> LfgLockPartyMap;
typedef std::map<ObjectGuid, uint8> LfgRolesMap;
typedef std::map<ObjectGuid, ObjectGuid> LfgGroupsMap;
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
std::string GetRolesString(uint8 roles);
@@ -22,7 +22,7 @@ namespace lfg
{
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
m_Leader(), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
{ }
LfgGroupData::~LfgGroupData()
@@ -54,14 +54,14 @@ void LfgGroupData::RestoreState()
m_State = m_OldState;
}
void LfgGroupData::AddPlayer(uint64 guid)
void LfgGroupData::AddPlayer(ObjectGuid guid)
{
m_Players.insert(guid);
}
uint8 LfgGroupData::RemovePlayer(uint64 guid)
uint8 LfgGroupData::RemovePlayer(ObjectGuid guid)
{
LfgGuidSet::iterator it = m_Players.find(guid);
GuidSet::iterator it = m_Players.find(guid);
if (it != m_Players.end())
m_Players.erase(it);
return uint8(m_Players.size());
@@ -72,7 +72,7 @@ void LfgGroupData::RemoveAllPlayers()
m_Players.clear();
}
void LfgGroupData::SetLeader(uint64 guid)
void LfgGroupData::SetLeader(ObjectGuid guid)
{
m_Leader = guid;
}
@@ -98,7 +98,7 @@ LfgState LfgGroupData::GetOldState() const
return m_OldState;
}
LfgGuidSet const& LfgGroupData::GetPlayers() const
GuidSet const& LfgGroupData::GetPlayers() const
{
return m_Players;
}
@@ -108,7 +108,7 @@ uint8 LfgGroupData::GetPlayerCount() const
return m_Players.size();
}
uint64 LfgGroupData::GetLeader() const
ObjectGuid LfgGroupData::GetLeader() const
{
return m_Leader;
}
@@ -42,10 +42,10 @@ class LfgGroupData
// General
void SetState(LfgState state);
void RestoreState();
void AddPlayer(uint64 guid);
uint8 RemovePlayer(uint64 guid);
void AddPlayer(ObjectGuid guid);
uint8 RemovePlayer(ObjectGuid guid);
void RemoveAllPlayers();
void SetLeader(uint64 guid);
void SetLeader(ObjectGuid guid);
// Dungeon
void SetDungeon(uint32 dungeon);
@@ -56,9 +56,9 @@ class LfgGroupData
// General
LfgState GetState() const;
LfgState GetOldState() const;
LfgGuidSet const& GetPlayers() const;
GuidSet const& GetPlayers() const;
uint8 GetPlayerCount() const;
uint64 GetLeader() const;
ObjectGuid GetLeader() const;
// Dungeon
uint32 GetDungeon(bool asId = true) const;
@@ -70,8 +70,8 @@ class LfgGroupData
// General
LfgState m_State; ///< State if group in LFG
LfgState m_OldState; ///< Old State
uint64 m_Leader; ///< Leader GUID
LfgGuidSet m_Players; ///< Players in group
ObjectGuid m_Leader; ///< Leader GUID
GuidSet m_Players; ///< Players in group
// Dungeon
uint32 m_Dungeon; ///< Dungeon entry
// Vote Kick
+154 -156
View File
@@ -50,15 +50,15 @@ LFGMgr::~LFGMgr()
delete itr->second;
}
void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid)
{
if (!fields)
return;
if (!IS_GROUP_GUID(guid))
if (!guid.IsGroup())
return;
SetLeader(guid, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
SetLeader(guid, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
uint32 dungeon = fields[17].GetUInt32();
uint8 state = fields[18].GetUInt8();
@@ -79,9 +79,9 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
}
}
void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid)
void LFGMgr::_SaveToDB(ObjectGuid guid, uint32 db_guid)
{
if (!IS_GROUP_GUID(guid))
if (!guid.IsGroup())
return;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
@@ -278,7 +278,7 @@ void LFGMgr::Update(uint32 diff)
for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles)
{
uint64 guid = itRoles->first;
ObjectGuid guid = itRoles->first;
RestoreState(guid, "Remove Obsolete RoleCheck");
SendLfgRoleCheckUpdate(guid, roleCheck);
if (guid == roleCheck.leader)
@@ -307,7 +307,7 @@ void LFGMgr::Update(uint32 diff)
boot.inProgress = false;
for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
uint64 pguid = itVotes->first;
ObjectGuid pguid = itVotes->first;
if (pguid != boot.victim)
SendLfgBootProposalUpdate(pguid, boot);
SetState(pguid, LFG_STATE_DUNGEON);
@@ -331,12 +331,12 @@ void LFGMgr::Update(uint32 diff)
uint32 proposalId = itProposal->first;
LfgProposal& proposal = ProposalsStore[proposalId];
uint64 guid = 0;
ObjectGuid guid;
for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
{
guid = itPlayers->first;
SetState(guid, LFG_STATE_PROPOSAL);
if (uint64 gguid = GetGroup(guid))
if (ObjectGuid gguid = GetGroup(guid))
{
SetState(gguid, LFG_STATE_PROPOSAL);
SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
@@ -378,10 +378,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
return;
Group* grp = player->GetGroup();
uint64 guid = player->GetGUID();
uint64 gguid = grp ? grp->GetGUID() : guid;
ObjectGuid guid = player->GetGUID();
ObjectGuid gguid = grp ? grp->GetGUID() : guid;
LfgJoinResultData joinData;
LfgGuidSet players;
GuidSet players;
uint32 rDungeonId = 0;
bool isContinue = grp && grp->isLFGGroup() && GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
@@ -493,7 +493,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
if (joinData.result != LFG_JOIN_OK)
{
TC_LOG_DEBUG("lfg.join", "%u joining with %u members. Result: %u, Dungeons: %s",
GUID_LOPART(guid), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str());
guid.GetCounter(), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str());
if (!dungeons.empty()) // Only should show lockmap when have no dungeons available
joinData.lockmap.clear();
@@ -505,7 +505,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
if (isRaid)
{
TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", GUID_LOPART(guid));
TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", guid.GetCounter());
return;
}
@@ -533,7 +533,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
{
if (Player* plrg = itr->GetSource())
{
uint64 pguid = plrg->GetGUID();
ObjectGuid pguid = plrg->GetGUID();
plrg->GetSession()->SendLfgUpdateParty(updateData);
SetState(pguid, LFG_STATE_ROLECHECK);
if (!isContinue)
@@ -571,7 +571,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
debugNames.append(player->GetName());
}
TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", GUID_LOPART(guid),
TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", guid.GetCounter(),
grp ? "group" : "player", debugNames.c_str(), uint32(dungeons.size()), ConcatenateDungeons(dungeons).c_str());
}
@@ -581,11 +581,11 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
@param[in] guid Player or group guid
*/
void LFGMgr::LeaveLfg(uint64 guid)
void LFGMgr::LeaveLfg(ObjectGuid guid)
{
uint64 gguid = IS_GROUP_GUID(guid) ? guid : GetGroup(guid);
ObjectGuid gguid = guid.IsGroup() ? guid : GetGroup(guid);
TC_LOG_DEBUG("lfg.leave", "%u left (%s)", GUID_LOPART(guid), guid == gguid ? "group" : "player");
TC_LOG_DEBUG("lfg.leave", "%u left (%s)", guid.GetCounter(), guid == gguid ? "group" : "player");
LfgState state = GetState(guid);
switch (state)
@@ -596,8 +596,8 @@ void LFGMgr::LeaveLfg(uint64 guid)
LFGQueue& queue = GetQueue(gguid);
queue.RemoveFromQueue(gguid);
SetState(gguid, LFG_STATE_NONE);
const LfgGuidSet& players = GetPlayers(gguid);
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
GuidSet const& players = GetPlayers(gguid);
for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
SetState(*it, LFG_STATE_NONE);
SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
@@ -619,7 +619,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
{
// Remove from Proposals
LfgProposalContainer::iterator it = ProposalsStore.begin();
uint64 pguid = gguid == guid ? GetLeader(gguid) : guid;
ObjectGuid pguid = gguid == guid ? GetLeader(gguid) : guid;
while (it != ProposalsStore.end())
{
LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid);
@@ -656,7 +656,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
@param[in] guid Player guid (0 = rolecheck failed)
@param[in] roles Player selected roles
*/
void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* = PLAYER_ROLE_NONE */)
void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::Empty */, uint8 roles /* = PLAYER_ROLE_NONE */)
{
if (!gguid)
return;
@@ -699,7 +699,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
LfgJoinResultData joinData = LfgJoinResultData(LFG_JOIN_FAILED, roleCheck.state);
for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{
uint64 pguid = it->first;
ObjectGuid pguid = it->first;
if (sendRoleChosen)
SendLfgRoleChosen(pguid, guid, roles);
@@ -744,12 +744,12 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
@param[in] players Set of players to check their dungeon restrictions
@param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty)
*/
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap)
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap)
{
lockMap.clear();
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{
uint64 guid = (*it);
ObjectGuid guid = (*it);
LfgLockMap const& cachedLockMap = GetLockedDungeons(guid);
for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{
@@ -845,12 +845,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
*/
void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
{
LfgGuidList players;
LfgGuidList playersToTeleport;
GuidList players;
GuidList playersToTeleport;
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 guid = it->first;
ObjectGuid guid = it->first;
if (guid == proposal.leader)
players.push_front(guid);
else
@@ -864,10 +864,10 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId);
ASSERT(dungeon);
Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL;
for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it)
Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(proposal.group.GetCounter()) : NULL;
for (GuidList::const_iterator it = players.begin(); it != players.end(); ++it)
{
uint64 pguid = (*it);
ObjectGuid pguid = (*it);
Player* player = ObjectAccessor::FindPlayer(pguid);
if (!player)
continue;
@@ -881,7 +881,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
grp = new Group();
grp->ConvertToLFG();
grp->Create(player);
uint64 gguid = grp->GetGUID();
ObjectGuid gguid = grp->GetGUID();
SetState(gguid, LFG_STATE_PROPOSAL);
sGroupMgr->AddGroup(grp);
}
@@ -897,14 +897,14 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
ASSERT(grp);
grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
uint64 gguid = grp->GetGUID();
ObjectGuid gguid = grp->GetGUID();
SetDungeon(gguid, dungeon->Entry());
SetState(gguid, LFG_STATE_DUNGEON);
_SaveToDB(gguid, grp->GetDbStoreId());
// Teleport Player
for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
for (GuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
if (Player* player = ObjectAccessor::FindPlayer(*it))
TeleportPlayer(player, false);
@@ -926,7 +926,7 @@ uint32 LFGMgr::AddProposal(LfgProposal& proposal)
@param[in] guid Player guid to update answer
@param[in] accept Player answer
*/
void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
void LFGMgr::UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept)
{
// Check if the proposal exists
LfgProposalContainer::iterator itProposal = ProposalsStore.find(proposalId);
@@ -943,7 +943,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
LfgProposalPlayer& player = itProposalPlayer->second;
player.accept = LfgAnswer(accept);
TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", GUID_LOPART(guid), proposalId, accept);
TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", guid.GetCounter(), proposalId, accept);
if (!accept)
{
RemoveProposal(itProposal, LFG_UPDATETYPE_PROPOSAL_DECLINED);
@@ -972,8 +972,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 pguid = it->first;
uint64 gguid = it->second.group;
ObjectGuid pguid = it->first;
ObjectGuid gguid = it->second.group;
uint32 dungeonId = (*GetSelectedDungeons(pguid).begin());
int32 waitTime = -1;
if (sendUpdate)
@@ -1016,7 +1016,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
}
// Remove players/groups from Queue
for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
queue.RemoveFromQueue(*it);
MakeNewGroup(proposal);
@@ -1042,13 +1042,13 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
it->second.accept = LFG_ANSWER_DENY;
// Mark players/groups to be removed
LfgGuidSet toRemove;
GuidSet toRemove;
for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
if (it->second.accept == LFG_ANSWER_AGREE)
continue;
uint64 guid = it->second.group ? it->second.group : it->first;
ObjectGuid guid = it->second.group ? it->second.group : it->first;
// Player didn't accept or still pending when no secs left
if (it->second.accept == LFG_ANSWER_DENY || type == LFG_UPDATETYPE_PROPOSAL_FAILED)
{
@@ -1060,8 +1060,8 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
// Notify players
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 guid = it->first;
uint64 gguid = it->second.group ? it->second.group : guid;
ObjectGuid guid = it->first;
ObjectGuid gguid = it->second.group ? it->second.group : guid;
SendLfgUpdateProposal(guid, proposal);
@@ -1071,12 +1071,12 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
if (it->second.accept == LFG_ANSWER_DENY)
{
updateData.updateType = type;
TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid));
TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", guid.GetCounter());
}
else
{
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid));
TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", guid.GetCounter());
}
RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
@@ -1090,7 +1090,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
}
else
{
TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", GUID_LOPART(guid));
TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", guid.GetCounter());
SetState(guid, LFG_STATE_QUEUED);
if (gguid != guid)
{
@@ -1104,17 +1104,17 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
LFGQueue& queue = GetQueue(proposal.players.begin()->first);
// Remove players/groups from queue
for (LfgGuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
for (GuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
{
uint64 guid = *it;
ObjectGuid guid = *it;
queue.RemoveFromQueue(guid);
proposal.queues.remove(guid);
}
// Readd to queue
for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
{
uint64 guid = *it;
ObjectGuid guid = *it;
queue.AddToQueue(guid);
}
@@ -1129,7 +1129,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
@param[in] victim Victim guid
@param[in] reason Kick reason
*/
void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason)
void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason)
{
SetState(gguid, LFG_STATE_BOOT);
@@ -1139,12 +1139,12 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
boot.reason = reason;
boot.victim = victim;
LfgGuidSet const& players = GetPlayers(gguid);
GuidSet const& players = GetPlayers(gguid);
// Set votes
for (LfgGuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
uint64 guid = (*itr);
ObjectGuid guid = (*itr);
SetState(guid, LFG_STATE_BOOT);
boot.votes[guid] = LFG_ANSWER_PENDING;
}
@@ -1153,7 +1153,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
boot.votes[kicker] = LFG_ANSWER_AGREE; // Kicker auto vote YES
// Notify players
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
SendLfgBootProposalUpdate(*it, boot);
}
@@ -1163,9 +1163,9 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
@param[in] guid Player who has answered
@param[in] player answer
*/
void LFGMgr::UpdateBoot(uint64 guid, bool accept)
void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept)
{
uint64 gguid = GetGroup(guid);
ObjectGuid gguid = GetGroup(guid);
if (!gguid)
return;
@@ -1200,7 +1200,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
boot.inProgress = false;
for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
uint64 pguid = itVotes->first;
ObjectGuid pguid = itVotes->first;
if (pguid != boot.victim)
{
SetState(pguid, LFG_STATE_DUNGEON);
@@ -1211,7 +1211,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
SetState(gguid, LFG_STATE_DUNGEON);
if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player
{
if (Group* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(gguid)))
if (Group* group = sGroupMgr->GetGroupByGUID(gguid.GetCounter()))
Player::RemoveFromGroup(group, boot.victim, GROUP_REMOVEMETHOD_KICK_LFG);
DecreaseKicksLeft(gguid);
}
@@ -1318,30 +1318,30 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
@param[in] guid Group guid
@param[in] dungeonId Dungeonid
*/
void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId)
{
uint32 gDungeonId = GetDungeon(gguid);
if (gDungeonId != dungeonId)
{
TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", GUID_LOPART(gguid), dungeonId, gDungeonId);
TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", gguid.GetCounter(), dungeonId, gDungeonId);
return;
}
if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times
{
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", GUID_LOPART(gguid));
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", gguid.GetCounter());
return;
}
SetState(gguid, LFG_STATE_FINISHED_DUNGEON);
const LfgGuidSet& players = GetPlayers(gguid);
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
GuidSet const& players = GetPlayers(gguid);
for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
uint64 guid = (*it);
ObjectGuid guid = (*it);
if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON)
{
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", GUID_LOPART(gguid), GUID_LOPART(guid));
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", gguid.GetCounter(), guid.GetCounter());
continue;
}
@@ -1357,14 +1357,14 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal))
{
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", GUID_LOPART(gguid), GUID_LOPART(guid), rDungeonId);
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", gguid.GetCounter(), guid.GetCounter(), rDungeonId);
continue;
}
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player || !player->IsInWorld())
{
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", GUID_LOPART(gguid), GUID_LOPART(guid));
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", gguid.GetCounter(), guid.GetCounter());
continue;
}
@@ -1373,7 +1373,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
if (player->GetMapId() != mapId)
{
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", GUID_LOPART(gguid), GUID_LOPART(guid), player->GetMapId(), mapId);
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", gguid.GetCounter(), guid.GetCounter(), player->GetMapId(), mapId);
continue;
}
@@ -1404,7 +1404,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
}
// Give rewards
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", GUID_LOPART(gguid), GUID_LOPART(guid), GetDungeon(gguid), done? " " : " not");
TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", gguid.GetCounter(), guid.GetCounter(), GetDungeon(gguid), done? " " : " not");
LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest);
player->GetSession()->SendLfgPlayerReward(data);
}
@@ -1464,48 +1464,48 @@ LfgType LFGMgr::GetDungeonType(uint32 dungeonId)
return LfgType(dungeon->type);
}
LfgState LFGMgr::GetState(uint64 guid)
LfgState LFGMgr::GetState(ObjectGuid guid)
{
LfgState state;
if (IS_GROUP_GUID(guid))
if (guid.IsGroup())
{
state = GroupsStore[guid].GetState();
TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", GUID_LOPART(guid), state);
TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", guid.GetCounter(), state);
}
else
{
state = PlayersStore[guid].GetState();
TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", GUID_LOPART(guid), state);
TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", guid.GetCounter(), state);
}
return state;
}
LfgState LFGMgr::GetOldState(uint64 guid)
LfgState LFGMgr::GetOldState(ObjectGuid guid)
{
LfgState state;
if (IS_GROUP_GUID(guid))
if (guid.IsGroup())
{
state = GroupsStore[guid].GetOldState();
TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", GUID_LOPART(guid), state);
TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", guid.GetCounter(), state);
}
else
{
state = PlayersStore[guid].GetOldState();
TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", GUID_LOPART(guid), state);
TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", guid.GetCounter(), state);
}
return state;
}
uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */)
{
uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", GUID_LOPART(guid), asId, dungeon);
TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", guid.GetCounter(), asId, dungeon);
return dungeon;
}
uint32 LFGMgr::GetDungeonMapId(uint64 guid)
uint32 LFGMgr::GetDungeonMapId(ObjectGuid guid)
{
uint32 dungeonId = GroupsStore[guid].GetDungeon(true);
uint32 mapId = 0;
@@ -1513,38 +1513,38 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid)
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
mapId = dungeon->map;
TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", GUID_LOPART(guid), mapId, dungeonId);
TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", guid.GetCounter(), mapId, dungeonId);
return mapId;
}
uint8 LFGMgr::GetRoles(uint64 guid)
uint8 LFGMgr::GetRoles(ObjectGuid guid)
{
uint8 roles = PlayersStore[guid].GetRoles();
TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", GUID_LOPART(guid), roles);
TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", guid.GetCounter(), roles);
return roles;
}
const std::string& LFGMgr::GetComment(uint64 guid)
const std::string& LFGMgr::GetComment(ObjectGuid guid)
{
TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", GUID_LOPART(guid), PlayersStore[guid].GetComment().c_str());
TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", guid.GetCounter(), PlayersStore[guid].GetComment().c_str());
return PlayersStore[guid].GetComment();
}
LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid)
LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid)
{
TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str());
TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str());
return PlayersStore[guid].GetSelectedDungeons();
}
LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid)
LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid)
{
TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", GUID_LOPART(guid));
TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", guid.GetCounter());
LfgLockMap lock;
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", GUID_LOPART(guid));
TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", guid.GetCounter());
return lock;
}
@@ -1607,20 +1607,20 @@ LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid)
return lock;
}
uint8 LFGMgr::GetKicksLeft(uint64 guid)
uint8 LFGMgr::GetKicksLeft(ObjectGuid guid)
{
uint8 kicks = GroupsStore[guid].GetKicksLeft();
TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", GUID_LOPART(guid), kicks);
TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", guid.GetCounter(), kicks);
return kicks;
}
void LFGMgr::RestoreState(uint64 guid, char const* debugMsg)
void LFGMgr::RestoreState(ObjectGuid guid, char const* debugMsg)
{
if (IS_GROUP_GUID(guid))
if (guid.IsGroup())
{
LfgGroupData& data = GroupsStore[guid];
TC_LOG_TRACE("lfg.data.group.state.restore", "Group: %u (%s), State: %s, Old state: %s",
GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(),
guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.RestoreState();
@@ -1629,20 +1629,20 @@ void LFGMgr::RestoreState(uint64 guid, char const* debugMsg)
{
LfgPlayerData& data = PlayersStore[guid];
TC_LOG_TRACE("lfg.data.player.state.restore", "Player: %u (%s), State: %s, Old state: %s",
GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(),
guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.RestoreState();
}
}
void LFGMgr::SetState(uint64 guid, LfgState state)
void LFGMgr::SetState(ObjectGuid guid, LfgState state)
{
if (IS_GROUP_GUID(guid))
if (guid.IsGroup())
{
LfgGroupData& data = GroupsStore[guid];
TC_LOG_TRACE("lfg.data.group.state.set", "Group: %u, New state: %s, Previous: %s, Old state: %s",
GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.SetState(state);
@@ -1651,64 +1651,64 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
{
LfgPlayerData& data = PlayersStore[guid];
TC_LOG_TRACE("lfg.data.player.state.set", "Player: %u, New state: %s, Previous: %s, OldState: %s",
GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.SetState(state);
}
}
void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon)
{
TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", GUID_LOPART(guid), dungeon);
TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", guid.GetCounter(), dungeon);
GroupsStore[guid].SetDungeon(dungeon);
}
void LFGMgr::SetRoles(uint64 guid, uint8 roles)
void LFGMgr::SetRoles(ObjectGuid guid, uint8 roles)
{
TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", GUID_LOPART(guid), roles);
TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", guid.GetCounter(), roles);
PlayersStore[guid].SetRoles(roles);
}
void LFGMgr::SetComment(uint64 guid, std::string const& comment)
void LFGMgr::SetComment(ObjectGuid guid, std::string const& comment)
{
TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", GUID_LOPART(guid), comment.c_str());
TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", guid.GetCounter(), comment.c_str());
PlayersStore[guid].SetComment(comment);
}
void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons)
void LFGMgr::SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons)
{
TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(dungeons).c_str());
TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(dungeons).c_str());
PlayersStore[guid].SetSelectedDungeons(dungeons);
}
void LFGMgr::DecreaseKicksLeft(uint64 guid)
void LFGMgr::DecreaseKicksLeft(ObjectGuid guid)
{
GroupsStore[guid].DecreaseKicksLeft();
TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", GUID_LOPART(guid), GroupsStore[guid].GetKicksLeft());
TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", guid.GetCounter(), GroupsStore[guid].GetKicksLeft());
}
void LFGMgr::RemovePlayerData(uint64 guid)
void LFGMgr::RemovePlayerData(ObjectGuid guid)
{
TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", GUID_LOPART(guid));
TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", guid.GetCounter());
LfgPlayerDataContainer::iterator it = PlayersStore.find(guid);
if (it != PlayersStore.end())
PlayersStore.erase(it);
}
void LFGMgr::RemoveGroupData(uint64 guid)
void LFGMgr::RemoveGroupData(ObjectGuid guid)
{
TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", GUID_LOPART(guid));
TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", guid.GetCounter());
LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
if (it == GroupsStore.end())
return;
LfgState state = GetState(guid);
// If group is being formed after proposal success do nothing more
LfgGuidSet const& players = it->second.GetPlayers();
for (uint64 playerGUID : players)
GuidSet const& players = it->second.GetPlayers();
for (ObjectGuid playerGUID : players)
{
SetGroup(playerGUID, 0);
SetGroup(playerGUID, ObjectGuid::Empty);
if (state != LFG_STATE_PROPOSAL)
{
SetState(playerGUID, LFG_STATE_NONE);
@@ -1718,29 +1718,29 @@ void LFGMgr::RemoveGroupData(uint64 guid)
GroupsStore.erase(it);
}
uint8 LFGMgr::GetTeam(uint64 guid)
uint8 LFGMgr::GetTeam(ObjectGuid guid)
{
uint8 team = PlayersStore[guid].GetTeam();
TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", GUID_LOPART(guid), team);
TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", guid.GetCounter(), team);
return team;
}
uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid)
uint8 LFGMgr::RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid)
{
return GroupsStore[gguid].RemovePlayer(guid);
}
void LFGMgr::AddPlayerToGroup(uint64 gguid, uint64 guid)
void LFGMgr::AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid)
{
GroupsStore[gguid].AddPlayer(guid);
}
void LFGMgr::SetLeader(uint64 gguid, uint64 leader)
void LFGMgr::SetLeader(ObjectGuid gguid, ObjectGuid leader)
{
GroupsStore[gguid].SetLeader(leader);
}
void LFGMgr::SetTeam(uint64 guid, uint8 team)
void LFGMgr::SetTeam(ObjectGuid guid, uint8 team)
{
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
team = 0;
@@ -1748,100 +1748,98 @@ void LFGMgr::SetTeam(uint64 guid, uint8 team)
PlayersStore[guid].SetTeam(team);
}
uint64 LFGMgr::GetGroup(uint64 guid)
ObjectGuid LFGMgr::GetGroup(ObjectGuid guid)
{
return PlayersStore[guid].GetGroup();
}
void LFGMgr::SetGroup(uint64 guid, uint64 group)
void LFGMgr::SetGroup(ObjectGuid guid, ObjectGuid group)
{
PlayersStore[guid].SetGroup(group);
}
LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid)
GuidSet const& LFGMgr::GetPlayers(ObjectGuid guid)
{
return GroupsStore[guid].GetPlayers();
}
uint8 LFGMgr::GetPlayerCount(uint64 guid)
uint8 LFGMgr::GetPlayerCount(ObjectGuid guid)
{
return GroupsStore[guid].GetPlayerCount();
}
uint64 LFGMgr::GetLeader(uint64 guid)
ObjectGuid LFGMgr::GetLeader(ObjectGuid guid)
{
return GroupsStore[guid].GetLeader();
}
bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2)
bool LFGMgr::HasIgnore(ObjectGuid guid1, ObjectGuid guid2)
{
Player* plr1 = ObjectAccessor::FindPlayer(guid1);
Player* plr2 = ObjectAccessor::FindPlayer(guid2);
uint32 low1 = GUID_LOPART(guid1);
uint32 low2 = GUID_LOPART(guid2);
return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(low2) || plr2->GetSocial()->HasIgnore(low1));
return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(guid2.GetCounter()) || plr2->GetSocial()->HasIgnore(guid1.GetCounter()));
}
void LFGMgr::SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles)
void LFGMgr::SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgRoleChosen(pguid, roles);
}
void LFGMgr::SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck)
void LFGMgr::SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
}
void LFGMgr::SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data)
void LFGMgr::SendLfgUpdatePlayer(ObjectGuid guid, LfgUpdateData const& data)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgUpdatePlayer(data);
}
void LFGMgr::SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data)
void LFGMgr::SendLfgUpdateParty(ObjectGuid guid, LfgUpdateData const& data)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgUpdateParty(data);
}
void LFGMgr::SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data)
void LFGMgr::SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgJoinResult(data);
}
void LFGMgr::SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot)
void LFGMgr::SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgBootProposalUpdate(boot);
}
void LFGMgr::SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal)
void LFGMgr::SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgUpdateProposal(proposal);
}
void LFGMgr::SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data)
void LFGMgr::SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgQueueStatus(data);
}
bool LFGMgr::IsLfgGroup(uint64 guid)
bool LFGMgr::IsLfgGroup(ObjectGuid guid)
{
return guid && IS_GROUP_GUID(guid) && GroupsStore[guid].IsLfgGroup();
return guid && guid.IsGroup() && GroupsStore[guid].IsLfgGroup();
}
LFGQueue& LFGMgr::GetQueue(uint64 guid)
LFGQueue& LFGMgr::GetQueue(ObjectGuid guid)
{
uint8 queueId = 0;
if (IS_GROUP_GUID(guid))
if (guid.IsGroup())
{
LfgGuidSet const& players = GetPlayers(guid);
uint64 pguid = players.empty() ? 0 : (*players.begin());
GuidSet const& players = GetPlayers(guid);
ObjectGuid pguid = players.empty() ? ObjectGuid::Empty : (*players.begin());
if (pguid)
queueId = GetTeam(pguid);
}
@@ -1850,12 +1848,12 @@ LFGQueue& LFGMgr::GetQueue(uint64 guid)
return QueuesStore[queueId];
}
bool LFGMgr::AllQueued(LfgGuidList const& check)
bool LFGMgr::AllQueued(GuidList const& check)
{
if (check.empty())
return false;
for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it)
if (GetState(*it) != LFG_STATE_QUEUED)
return false;
return true;
@@ -1882,7 +1880,7 @@ void LFGMgr::SetOptions(uint32 options)
m_options = options;
}
LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid)
LfgUpdateData LFGMgr::GetLfgStatus(ObjectGuid guid)
{
LfgPlayerData& playerData = PlayersStore[guid];
return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons());
@@ -1920,7 +1918,7 @@ std::string LFGMgr::DumpQueueInfo(bool full)
return o.str();
}
void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
void LFGMgr::SetupGroupMember(ObjectGuid guid, ObjectGuid gguid)
{
LfgDungeonSet dungeons;
dungeons.insert(GetDungeon(gguid));
@@ -1930,7 +1928,7 @@ void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
AddPlayerToGroup(gguid, guid);
}
bool LFGMgr::selectedRandomLfgDungeon(uint64 guid)
bool LFGMgr::selectedRandomLfgDungeon(ObjectGuid guid)
{
if (GetState(guid) != LFG_STATE_NONE)
{
@@ -1946,9 +1944,9 @@ bool LFGMgr::selectedRandomLfgDungeon(uint64 guid)
return false;
}
bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty)
bool LFGMgr::inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty)
{
if (!IS_GROUP_GUID(guid))
if (!guid.IsGroup())
guid = GetGroup(guid);
if (uint32 dungeonId = GetDungeon(guid, true))
+69 -69
View File
@@ -137,13 +137,13 @@ typedef std::map<uint8, LFGQueue> LfgQueueContainer;
typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
typedef std::map<ObjectGuid, LfgAnswer> LfgAnswerContainer;
typedef std::map<ObjectGuid, LfgRoleCheck> LfgRoleCheckContainer;
typedef std::map<uint32, LfgProposal> LfgProposalContainer;
typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
typedef std::map<ObjectGuid, LfgProposalPlayer> LfgProposalPlayerContainer;
typedef std::map<ObjectGuid, LfgPlayerBoot> LfgPlayerBootContainer;
typedef std::map<ObjectGuid, LfgGroupData> LfgGroupDataContainer;
typedef std::map<ObjectGuid, LfgPlayerData> LfgPlayerDataContainer;
typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
// Data needed by SMSG_LFG_JOIN_RESULT
@@ -215,29 +215,29 @@ struct LfgReward
/// Stores player data related to proposal to join
struct LfgProposalPlayer
{
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group() { }
uint8 role; ///< Proposed role
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
uint64 group; ///< Original group guid. 0 if no original group
ObjectGuid group; ///< Original group guid. 0 if no original group
};
/// Stores group data related to proposal to join
struct LfgProposal
{
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
group(), leader(), cancelTime(0), encounters(0), isNew(true)
{ }
uint32 id; ///< Proposal Id
uint32 dungeonId; ///< Dungeon to join
LfgProposalState state; ///< State of the proposal
uint64 group; ///< Proposal group (0 if new)
uint64 leader; ///< Leader guid.
ObjectGuid group; ///< Proposal group (0 if new)
ObjectGuid leader; ///< Leader guid.
time_t cancelTime; ///< Time when we will cancel this proposal
uint32 encounters; ///< Dungeon Encounters
bool isNew; ///< Determines if it's new group or not
LfgGuidList queues; ///< Queue Ids to remove/readd
LfgGuidList showorder; ///< Show order in update window
GuidList queues; ///< Queue Ids to remove/readd
GuidList showorder; ///< Show order in update window
LfgProposalPlayerContainer players; ///< Players data
};
@@ -249,7 +249,7 @@ struct LfgRoleCheck
LfgRoleCheckState state; ///< State of the rolecheck
LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons)
uint32 rDungeonId; ///< Random Dungeon Id.
uint64 leader; ///< Leader of the group
ObjectGuid leader; ///< Leader of the group
};
/// Stores information of a current vote to kick someone from a group
@@ -258,7 +258,7 @@ struct LfgPlayerBoot
time_t cancelTime; ///< Time left to vote
bool inProgress; ///< Vote in progress
LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
uint64 victim; ///< Player guid to be kicked (can't vote)
ObjectGuid victim; ///< Player guid to be kicked (can't vote)
std::string reason; ///< kick reason
};
@@ -307,7 +307,7 @@ class LFGMgr
// World.cpp
/// Finish the dungeon for the given group. All check are performed using internal lfg data
void FinishDungeon(uint64 gguid, uint32 dungeonId);
void FinishDungeon(ObjectGuid gguid, uint32 dungeonId);
/// Loads rewards for random dungeons
void LoadRewards();
/// Loads dungeons from dbc and adds teleport coords
@@ -315,31 +315,31 @@ class LFGMgr
// Multiple files
/// Check if given guid applied for random dungeon
bool selectedRandomLfgDungeon(uint64 guid);
bool selectedRandomLfgDungeon(ObjectGuid guid);
/// Check if given guid applied for given map and difficulty. Used to know
bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty);
bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty);
/// Get selected dungeons
LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
LfgDungeonSet const& GetSelectedDungeons(ObjectGuid guid);
/// Get current lfg state
LfgState GetState(uint64 guid);
LfgState GetState(ObjectGuid guid);
/// Get current dungeon
uint32 GetDungeon(uint64 guid, bool asId = true);
uint32 GetDungeon(ObjectGuid guid, bool asId = true);
/// Get the map id of the current dungeon
uint32 GetDungeonMapId(uint64 guid);
uint32 GetDungeonMapId(ObjectGuid guid);
/// Get kicks left in current group
uint8 GetKicksLeft(uint64 gguid);
uint8 GetKicksLeft(ObjectGuid gguid);
/// Load Lfg group info from DB
void _LoadFromDB(Field* fields, uint64 guid);
void _LoadFromDB(Field* fields, ObjectGuid guid);
/// Initializes player data after loading group data from DB
void SetupGroupMember(uint64 guid, uint64 gguid);
void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid);
/// Return Lfg dungeon entry for given dungeon id
uint32 GetLFGDungeonEntry(uint32 id);
// cs_lfg
/// Get current player roles
uint8 GetRoles(uint64 guid);
uint8 GetRoles(ObjectGuid guid);
/// Get current player comment (used for LFR)
std::string const& GetComment(uint64 gguid);
std::string const& GetComment(ObjectGuid gguid);
/// Gets current lfg options
uint32 GetOptions();
/// Sets new lfg options
@@ -353,27 +353,27 @@ class LFGMgr
// LFGScripts
/// Get leader of the group (using internal data)
uint64 GetLeader(uint64 guid);
ObjectGuid GetLeader(ObjectGuid guid);
/// Sets player team
void SetTeam(uint64 guid, uint8 team);
void SetTeam(ObjectGuid guid, uint8 team);
/// Sets player group
void SetGroup(uint64 guid, uint64 group);
void SetGroup(ObjectGuid guid, ObjectGuid group);
/// Gets player group
uint64 GetGroup(uint64 guid);
ObjectGuid GetGroup(ObjectGuid guid);
/// Sets the leader of the group
void SetLeader(uint64 gguid, uint64 leader);
void SetLeader(ObjectGuid gguid, ObjectGuid leader);
/// Removes saved group data
void RemoveGroupData(uint64 guid);
void RemoveGroupData(ObjectGuid guid);
/// Removes a player from a group
uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid);
/// Adds player to group
void AddPlayerToGroup(uint64 gguid, uint64 guid);
void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid);
// LFGHandler
/// Get locked dungeons
LfgLockMap const GetLockedDungeons(uint64 guid);
LfgLockMap const GetLockedDungeons(ObjectGuid guid);
/// Returns current lfg status
LfgUpdateData GetLfgStatus(uint64 guid);
LfgUpdateData GetLfgStatus(ObjectGuid guid);
/// Checks if Seasonal dungeon is active
bool IsSeasonActive(uint32 dungeonId);
/// Gets the random dungeon reward corresponding to given dungeon and player level
@@ -383,51 +383,51 @@ class LFGMgr
/// Teleport a player to/from selected dungeon
void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
/// Inits new proposal to boot a player
void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
void InitBoot(ObjectGuid gguid, ObjectGuid kguid, ObjectGuid vguid, std::string const& reason);
/// Updates player boot proposal with new player answer
void UpdateBoot(uint64 guid, bool accept);
void UpdateBoot(ObjectGuid guid, bool accept);
/// Updates proposal to join dungeon with player answer
void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept);
/// Updates the role check with player answer
void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE);
void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = ObjectGuid::Empty, uint8 roles = PLAYER_ROLE_NONE);
/// Sets player lfg roles
void SetRoles(uint64 guid, uint8 roles);
void SetRoles(ObjectGuid guid, uint8 roles);
/// Sets player lfr comment
void SetComment(uint64 guid, std::string const& comment);
void SetComment(ObjectGuid guid, std::string const& comment);
/// Join Lfg with selected roles, dungeons and comment
void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
/// Leaves lfg
void LeaveLfg(uint64 guid);
void LeaveLfg(ObjectGuid guid);
// LfgQueue
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
LfgState GetOldState(uint64 guid);
LfgState GetOldState(ObjectGuid guid);
/// Check if given group guid is lfg
bool IsLfgGroup(uint64 guid);
bool IsLfgGroup(ObjectGuid guid);
/// Gets the player count of given group
uint8 GetPlayerCount(uint64 guid);
uint8 GetPlayerCount(ObjectGuid guid);
/// Add a new Proposal
uint32 AddProposal(LfgProposal& proposal);
/// Checks if all players are queued
bool AllQueued(LfgGuidList const& check);
bool AllQueued(GuidList const& check);
/// Checks if given roles match, modifies given roles map with new roles
static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
/// Checks if given players are ignoring each other
static bool HasIgnore(uint64 guid1, uint64 guid2);
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
/// Sends queue status to player
static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data);
static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data);
private:
uint8 GetTeam(uint64 guid);
void RestoreState(uint64 guid, char const* debugMsg);
void ClearState(uint64 guid, char const* debugMsg);
void SetDungeon(uint64 guid, uint32 dungeon);
void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
void DecreaseKicksLeft(uint64 guid);
void SetState(uint64 guid, LfgState state);
void RemovePlayerData(uint64 guid);
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
void _SaveToDB(uint64 guid, uint32 db_guid);
uint8 GetTeam(ObjectGuid guid);
void RestoreState(ObjectGuid guid, char const* debugMsg);
void ClearState(ObjectGuid guid, char const* debugMsg);
void SetDungeon(ObjectGuid guid, uint32 dungeon);
void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons);
void DecreaseKicksLeft(ObjectGuid guid);
void SetState(ObjectGuid guid, LfgState state);
void RemovePlayerData(ObjectGuid guid);
void GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap);
void _SaveToDB(ObjectGuid guid, uint32 db_guid);
LFGDungeonData const* GetLFGDungeon(uint32 id);
// Proposals
@@ -435,19 +435,19 @@ class LFGMgr
void MakeNewGroup(LfgProposal const& proposal);
// Generic
LFGQueue &GetQueue(uint64 guid);
LFGQueue &GetQueue(ObjectGuid guid);
LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
LfgType GetDungeonType(uint32 dungeon);
void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot);
void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data);
void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles);
void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck);
void SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data);
void SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data);
void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal);
void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot);
void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data);
void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles);
void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck);
void SendLfgUpdateParty(ObjectGuid guid, LfgUpdateData const& data);
void SendLfgUpdatePlayer(ObjectGuid guid, LfgUpdateData const& data);
void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal);
LfgGuidSet const& GetPlayers(uint64 guid);
GuidSet const& GetPlayers(ObjectGuid guid);
// General variables
uint32 m_QueueTimer; ///< used to check interval of update
@@ -21,7 +21,7 @@ namespace lfg
{
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
m_Team(0), m_Group(0), m_Roles(0), m_Comment("")
m_Team(0), m_Group(), m_Roles(0), m_Comment("")
{ }
LfgPlayerData::~LfgPlayerData() { }
@@ -59,7 +59,7 @@ void LfgPlayerData::SetTeam(uint8 team)
m_Team = team;
}
void LfgPlayerData::SetGroup(uint64 group)
void LfgPlayerData::SetGroup(ObjectGuid group)
{
m_Group = group;
}
@@ -94,7 +94,7 @@ uint8 LfgPlayerData::GetTeam() const
return m_Team;
}
uint64 LfgPlayerData::GetGroup() const
ObjectGuid LfgPlayerData::GetGroup() const
{
return m_Group;
}
@@ -36,7 +36,7 @@ class LfgPlayerData
void SetState(LfgState state);
void RestoreState();
void SetTeam(uint8 team);
void SetGroup(uint64 group);
void SetGroup(ObjectGuid group);
// Queue
void SetRoles(uint8 roles);
@@ -47,7 +47,7 @@ class LfgPlayerData
LfgState GetState() const;
LfgState GetOldState() const;
uint8 GetTeam() const;
uint64 GetGroup() const;
ObjectGuid GetGroup() const;
// Queue
uint8 GetRoles() const;
@@ -60,7 +60,7 @@ class LfgPlayerData
LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
// Player
uint8 m_Team; ///< Player team - determines the queue to join
uint64 m_Group; ///< Original group of player when joined LFG
ObjectGuid m_Group; ///< Original group of player when joined LFG
// Queue
uint8 m_Roles; ///< Roles the player selected when joined LFG
+55 -53
View File
@@ -36,20 +36,20 @@ namespace lfg
@param[in] check list of guids
@returns Concatenated string
*/
std::string ConcatenateGuids(LfgGuidList const& check)
std::string ConcatenateGuids(GuidList const& check)
{
if (check.empty())
return "";
// need the guids in order to avoid duplicates
LfgGuidSet guids(check.begin(), check.end());
GuidSet guids(check.begin(), check.end());
std::ostringstream o;
LfgGuidSet::const_iterator it = guids.begin();
o << (*it);
GuidSet::const_iterator it = guids.begin();
o << it->GetRawValue();
for (++it; it != guids.end(); ++it)
o << '|' << (*it);
o << '|' << it->GetRawValue();
return o.str();
}
@@ -83,26 +83,26 @@ char const* GetCompatibleString(LfgCompatibility compatibles)
}
}
void LFGQueue::AddToQueue(uint64 guid)
void LFGQueue::AddToQueue(ObjectGuid guid)
{
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [" UI64FMTD "]", guid);
TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [%s]", guid.ToString().c_str());
return;
}
AddToNewQueue(guid);
}
void LFGQueue::RemoveFromQueue(uint64 guid)
void LFGQueue::RemoveFromQueue(ObjectGuid guid)
{
RemoveFromNewQueue(guid);
RemoveFromCurrentQueue(guid);
RemoveFromCompatibles(guid);
std::ostringstream o;
o << guid;
o << guid.GetRawValue();
std::string sguid = o.str();
LfgQueueDataContainer::iterator itDelete = QueueDataStore.end();
@@ -122,33 +122,33 @@ void LFGQueue::RemoveFromQueue(uint64 guid)
QueueDataStore.erase(itDelete);
}
void LFGQueue::AddToNewQueue(uint64 guid)
void LFGQueue::AddToNewQueue(ObjectGuid guid)
{
newToQueueStore.push_back(guid);
}
void LFGQueue::RemoveFromNewQueue(uint64 guid)
void LFGQueue::RemoveFromNewQueue(ObjectGuid guid)
{
newToQueueStore.remove(guid);
}
void LFGQueue::AddToCurrentQueue(uint64 guid)
void LFGQueue::AddToCurrentQueue(ObjectGuid guid)
{
currentQueueStore.push_back(guid);
}
void LFGQueue::RemoveFromCurrentQueue(uint64 guid)
void LFGQueue::RemoveFromCurrentQueue(ObjectGuid guid)
{
currentQueueStore.remove(guid);
}
void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
{
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
AddToQueue(guid);
}
void LFGQueue::RemoveQueueData(uint64 guid)
void LFGQueue::RemoveQueueData(ObjectGuid guid)
{
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
if (it != QueueDataStore.end())
@@ -188,13 +188,13 @@ void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId)
@param[in] guid Guid to remove from compatible cache
*/
void LFGQueue::RemoveFromCompatibles(uint64 guid)
void LFGQueue::RemoveFromCompatibles(ObjectGuid guid)
{
std::stringstream out;
out << guid;
out << guid.GetRawValue();
std::string strGuid = out.str();
TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing [" UI64FMTD "]", guid);
TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing %s", guid.ToString().c_str());
for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();)
{
LfgCompatibleContainer::iterator it = itNext++;
@@ -247,16 +247,18 @@ LfgCompatibilityData* LFGQueue::GetCompatibilityData(std::string const& key)
uint8 LFGQueue::FindGroups()
{
uint8 proposals = 0;
LfgGuidList firstNew;
GuidList firstNew;
while (!newToQueueStore.empty())
{
uint64 frontguid = newToQueueStore.front();
TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size()));
ObjectGuid frontguid = newToQueueStore.front();
TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [%s] newToQueue(%u), currentQueue(%u)", frontguid.ToString().c_str(),
uint32(newToQueueStore.size()), uint32(currentQueueStore.size()));
firstNew.clear();
firstNew.push_back(frontguid);
RemoveFromNewQueue(frontguid);
LfgGuidList temporalList = currentQueueStore;
GuidList temporalList = currentQueueStore;
LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList);
if (compatibles == LFG_COMPATIBLES_MATCH)
@@ -274,7 +276,7 @@ uint8 LFGQueue::FindGroups()
@param[in] all List of all other guids in main queue to match against
@return LfgCompatibility type of compatibility between groups
*/
LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all)
{
std::string strGuids = ConcatenateGuids(check);
LfgCompatibility compatibles = GetCompatibles(strGuids);
@@ -312,7 +314,7 @@ LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
@param[in] check List of guids to check compatibilities
@return LfgCompatibility type of compatibility
*/
LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
{
std::string strGuids = ConcatenateGuids(check);
LfgProposal proposal;
@@ -330,7 +332,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// Check all-but-new compatiblitity
if (check.size() > 2)
{
uint64 frontGuid = check.front();
ObjectGuid frontGuid = check.front();
check.pop_front();
// Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D)
@@ -347,20 +349,20 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// Check if more than one LFG group and number of players joining
uint8 numPlayers = 0;
uint8 numLfgGroups = 0;
for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
{
uint64 guid = (*it);
ObjectGuid guid = *it;
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [" UI64FMTD "] is not queued but listed as queued!", guid);
TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [%s] is not queued but listed as queued!", guid.ToString().c_str());
RemoveFromQueue(guid);
return LFG_COMPATIBILITY_PENDING;
}
// Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group)
for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0;
proposalGroups[it2->first] = itQueue->first.IsGroup() ? itQueue->first : ObjectGuid::Empty;
numPlayers += itQueue->second.roles.size();
@@ -404,16 +406,16 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
if (check.size() > 1)
{
for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it)
{
const LfgRolesMap &roles = QueueDataStore[(*it)].roles;
LfgRolesMap const& roles = QueueDataStore[(*it)].roles;
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
{
LfgRolesMap::const_iterator itPlayer;
for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer)
{
if (itRoles->first == itPlayer->first)
TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str());
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
break;
}
@@ -434,22 +436,22 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
{
std::ostringstream o;
for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it)
o << ", " << it->first << ": " << GetRolesString(it->second);
o << ", " << it->first.GetRawValue() << ": " << GetRolesString(it->second);
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str());
SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES);
return LFG_INCOMPATIBLES_NO_ROLES;
}
LfgGuidList::iterator itguid = check.begin();
GuidList::iterator itguid = check.begin();
proposalDungeons = QueueDataStore[*itguid].dungeons;
std::ostringstream o;
o << ", " << *itguid << ": (" << ConcatenateDungeons(proposalDungeons) << ")";
o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(proposalDungeons) << ")";
for (++itguid; itguid != check.end(); ++itguid)
{
LfgDungeonSet temporal;
LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons;
o << ", " << *itguid << ": (" << ConcatenateDungeons(dungeons) << ")";
LfgDungeonSet& dungeons = QueueDataStore[*itguid].dungeons;
o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(dungeons) << ")";
std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
proposalDungeons = temporal;
}
@@ -463,7 +465,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
}
else
{
uint64 gguid = *check.begin();
ObjectGuid gguid = *check.begin();
const LfgQueueData &queue = QueueDataStore[gguid];
proposalDungeons = queue.dungeons;
proposalRoles = queue.roles;
@@ -477,14 +479,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
data.roles = proposalRoles;
for (LfgGuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr)
for (GuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr)
UpdateBestCompatibleInQueue(QueueDataStore.find(*itr), strGuids, data.roles);
SetCompatibilityData(strGuids, data);
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
}
uint64 gguid = *check.begin();
ObjectGuid gguid = *check.begin();
proposal.queues = check;
proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(gguid) != LFG_STATE_DUNGEON;
@@ -498,7 +500,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// Create a new proposal
proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL;
proposal.state = LFG_PROPOSAL_INITIATING;
proposal.leader = 0;
proposal.leader.Clear();
proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons);
bool leader = false;
@@ -523,9 +525,9 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
}
// Mark proposal members as not queued (but not remove queue data)
for (LfgGuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue)
for (GuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue)
{
uint64 guid = (*itQueue);
ObjectGuid guid = (*itQueue);
RemoveFromNewQueue(guid);
RemoveFromCurrentQueue(guid);
}
@@ -581,13 +583,13 @@ void LFGQueue::UpdateQueueTimers(time_t currTime)
LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
{
uint64 pguid = itPlayer->first;
ObjectGuid pguid = itPlayer->first;
LFGMgr::SendLfgQueueStatus(pguid, queueData);
}
}
}
time_t LFGQueue::GetJoinTime(uint64 guid)
time_t LFGQueue::GetJoinTime(ObjectGuid guid)
{
return QueueDataStore[guid].joinTime;
}
@@ -600,11 +602,11 @@ std::string LFGQueue::DumpQueueInfo() const
for (uint8 i = 0; i < 2; ++i)
{
LfgGuidList const& queue = i ? newToQueueStore : currentQueueStore;
for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
GuidList const& queue = i ? newToQueueStore : currentQueueStore;
for (GuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
{
uint64 guid = *it;
if (IS_GROUP_GUID(guid))
ObjectGuid guid = *it;
if (guid.IsGroup())
{
groups++;
playersInGroup += sLFGMgr->GetPlayerCount(guid);
@@ -631,9 +633,9 @@ std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const
void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue)
{
TC_LOG_DEBUG("lfg.queue.compatibles.find", "Guid: " UI64FMTD, itrQueue->first);
TC_LOG_DEBUG("lfg.queue.compatibles.find", "%s", itrQueue->first.ToString().c_str());
std::ostringstream o;
o << itrQueue->first;
o << itrQueue->first.GetRawValue();
std::string sguid = o.str();
for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
@@ -656,8 +658,8 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu
if (size <= storedSize)
return;
TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for " UI64FMTD,
queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first);
TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for %s",
queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first.ToString().c_str());
queueData.bestCompatible = key;
queueData.tanks = LFG_TANKS_NEEDED;
+15 -16
View File
@@ -78,7 +78,7 @@ struct LfgWaitTime
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer;
typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer;
/**
Stores all data related to queue
@@ -88,10 +88,10 @@ class LFGQueue
public:
// Add/Remove from queue
void AddToQueue(uint64 guid);
void RemoveFromQueue(uint64 guid);
void AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
void RemoveQueueData(uint64 guid);
void AddToQueue(ObjectGuid guid);
void RemoveFromQueue(ObjectGuid guid);
void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
void RemoveQueueData(ObjectGuid guid);
// Update Timers (when proposal success)
void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId);
@@ -101,7 +101,7 @@ class LFGQueue
// Update Queue timers
void UpdateQueueTimers(time_t currTime);
time_t GetJoinTime(uint64 guid);
time_t GetJoinTime(ObjectGuid guid);
// Find new group
uint8 FindGroups();
@@ -112,24 +112,23 @@ class LFGQueue
private:
void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles);
LfgRolesMap const& RemoveFromQueueUpdateData(uint64 guid);
void AddToNewQueue(uint64 guid);
void AddToCurrentQueue(uint64 guid);
void RemoveFromNewQueue(uint64 guid);
void RemoveFromCurrentQueue(uint64 guid);
void AddToNewQueue(ObjectGuid guid);
void AddToCurrentQueue(ObjectGuid guid);
void RemoveFromNewQueue(ObjectGuid guid);
void RemoveFromCurrentQueue(ObjectGuid guid);
void SetCompatibles(std::string const& key, LfgCompatibility compatibles);
LfgCompatibility GetCompatibles(std::string const& key);
void RemoveFromCompatibles(uint64 guid);
void RemoveFromCompatibles(ObjectGuid guid);
void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles);
LfgCompatibilityData* GetCompatibilityData(std::string const& key);
void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles);
LfgCompatibility FindNewGroups(LfgGuidList& check, LfgGuidList& all);
LfgCompatibility CheckCompatibility(LfgGuidList check);
LfgCompatibility FindNewGroups(GuidList& check, GuidList& all);
LfgCompatibility CheckCompatibility(GuidList check);
// Queue
LfgQueueDataContainer QueueDataStore; ///< Queued groups
@@ -139,8 +138,8 @@ class LFGQueue
LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank
LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer
LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps
LfgGuidList currentQueueStore; ///< Ordered list. Used to find groups
LfgGuidList newToQueueStore; ///< New groups to add to queue
GuidList currentQueueStore; ///< Ordered list. Used to find groups
GuidList newToQueueStore; ///< New groups to add to queue
};
} // namespace lfg
+28 -23
View File
@@ -52,16 +52,16 @@ void LFGPlayerScript::OnLogin(Player* player, bool /*loginFirst*/)
return;
// Temporal: Trying to determine when group data and LFG data gets desynched
uint64 guid = player->GetGUID();
uint64 gguid = sLFGMgr->GetGroup(guid);
ObjectGuid guid = player->GetGUID();
ObjectGuid gguid = sLFGMgr->GetGroup(guid);
if (Group const* group = player->GetGroup())
{
uint64 gguid2 = group->GetGUID();
ObjectGuid gguid2 = group->GetGUID();
if (gguid != gguid2)
{
TC_LOG_ERROR("lfg", "%s on group %u but LFG has group %u saved... Fixing.",
player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
player->GetSession()->GetPlayerInfo().c_str(), gguid2.GetCounter(), gguid.GetCounter());
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
}
}
@@ -104,24 +104,24 @@ void LFGPlayerScript::OnMapChanged(Player* player)
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") { }
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
void LFGGroupScript::OnAddMember(Group* group, ObjectGuid guid)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
uint64 gguid = group->GetGUID();
uint64 leader = group->GetLeaderGUID();
ObjectGuid gguid = group->GetGUID();
ObjectGuid leader = group->GetLeaderGUID();
if (leader == guid)
{
TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
sLFGMgr->SetLeader(gguid, guid);
}
else
{
LfgState gstate = sLFGMgr->GetState(gguid);
LfgState state = sLFGMgr->GetState(guid);
TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state);
if (state == LFG_STATE_QUEUED)
sLFGMgr->LeaveLfg(guid);
@@ -134,13 +134,14 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
sLFGMgr->AddPlayerToGroup(gguid, guid);
}
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
void LFGGroupScript::OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
uint64 gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
ObjectGuid gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s",
gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : ""));
bool isLFG = group->isLFGGroup();
@@ -160,13 +161,13 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
{
// LfgData: Remove player from group
sLFGMgr->SetGroup(guid, 0);
sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
sLFGMgr->RemovePlayerFromGroup(gguid, guid);
return;
}
sLFGMgr->LeaveLfg(guid);
sLFGMgr->SetGroup(guid, 0);
sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -192,31 +193,35 @@ void LFGGroupScript::OnDisband(Group* group)
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
uint64 gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
ObjectGuid gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str());
sLFGMgr->RemoveGroupData(gguid);
}
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
void LFGGroupScript::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
uint64 gguid = group->GetGUID();
ObjectGuid gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]",
gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str());
TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
sLFGMgr->SetLeader(gguid, newLeaderGuid);
}
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
void LFGGroupScript::OnInviteMember(Group* group, ObjectGuid guid)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
uint64 gguid = group->GetGUID();
uint64 leader = group->GetLeaderGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
ObjectGuid gguid = group->GetGUID();
ObjectGuid leader = group->GetLeaderGUID();
TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]",
gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
// No gguid == new group being formed
// No leader == after group creation first invite is new leader
// leader and no gguid == first invite after leader is added to new group (this is the real invite)
+4 -4
View File
@@ -46,11 +46,11 @@ class LFGGroupScript : public GroupScript
LFGGroupScript();
// Group Hooks
void OnAddMember(Group* group, uint64 guid) override;
void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override;
void OnAddMember(Group* group, ObjectGuid guid) override;
void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) override;
void OnDisband(Group* group) override;
void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override;
void OnInviteMember(Group* group, uint64 guid) override;
void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override;
void OnInviteMember(Group* group, ObjectGuid guid) override;
};
} // namespace lfg
+6 -6
View File
@@ -88,7 +88,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask());
SetObjectScale(1);
SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID());
SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID());
_gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY());
@@ -104,7 +104,7 @@ void Corpse::SaveToDB()
uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid
stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
stmt->setUInt32(index++, GetOwnerGUID().GetCounter()); // guid
stmt->setFloat (index++, GetPositionX()); // posX
stmt->setFloat (index++, GetPositionY()); // posY
stmt->setFloat (index++, GetPositionZ()); // posZ
@@ -153,7 +153,7 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
{
// all corpses (not bones)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_CORPSES);
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
stmt->setUInt32(0, GetOwnerGUID().GetCounter());
}
trans->Append(stmt);
}
@@ -179,7 +179,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32());
SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].GetUInt8());
SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].GetUInt8());
SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(ownerGuid, 0, HIGHGUID_PLAYER));
SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid(HIGHGUID_PLAYER, ownerGuid));
m_time = time_t(fields[12].GetUInt32());
@@ -194,8 +194,8 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
if (!IsPositionValid())
{
TC_LOG_ERROR("entities.player", "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
TC_LOG_ERROR("entities.player", "Corpse (guid: %s, owner: %s) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
GetGUID().ToString().c_str(), GetOwnerGUID().ToString().c_str(), posX, posY, posZ);
return false;
}
+1 -1
View File
@@ -64,7 +64,7 @@ class Corpse : public WorldObject, public GridObject<Corpse>
void DeleteBonesFromWorld();
void DeleteFromDB(SQLTransaction& trans);
uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
time_t const& GetGhostTime() const { return m_time; }
void ResetGhostTime() { m_time = time(NULL); }
+22 -22
View File
@@ -143,7 +143,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapObject(),
m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0),
m_lootRecipient(0), m_lootRecipientGroup(0), _skinner(0), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0),
m_lootRecipient(), m_lootRecipientGroup(0), _skinner(), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0),
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE),
m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
@@ -470,17 +470,17 @@ void Creature::Update(uint32 diff)
if (!allowed) // Will be rechecked on next Update call
break;
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT);
ObjectGuid dbtableHighGuid(HIGHGUID_UNIT, GetEntry(), m_DBTableGuid);
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (!linkedRespawntime) // Can respawn
Respawn();
else // the master is dead
{
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else
m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime)+urand(5, MINUTE); // else copy time from master and add a little
m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
SaveRespawnTime(); // also save to DB immediately
}
}
@@ -531,7 +531,7 @@ void Creature::Update(uint32 diff)
if (Unit* charmer = ObjectAccessor::GetUnit(*this, LastCharmerGUID))
i_AI->AttackStart(charmer);
LastCharmerGUID = 0;
LastCharmerGUID.Clear();
}
if (!IsInEvadeMode() && IsAIEnabled)
@@ -889,7 +889,7 @@ void Creature::SetLootRecipient(Unit* unit)
if (!unit)
{
m_lootRecipient = 0;
m_lootRecipient.Clear();
m_lootRecipientGroup = 0;
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE|UNIT_DYNFLAG_TAPPED);
return;
@@ -1211,7 +1211,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
m_DBTableGuid = guid;
if (map->GetInstanceId() == 0)
{
if (map->GetCreature(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT)))
if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guid)))
return false;
}
else
@@ -1461,7 +1461,7 @@ void Creature::setDeathState(DeathState s)
if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
SaveRespawnTime();
SetTarget(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetTarget(ObjectGuid::Empty); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
setActive(false);
@@ -1522,8 +1522,8 @@ void Creature::Respawn(bool force)
if (m_DBTableGuid)
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
TC_LOG_DEBUG("entities.unit", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)",
GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
TC_LOG_DEBUG("entities.unit", "Respawning creature %s (%s)",
GetName().c_str(), GetGUID().ToString().c_str());
m_respawnTime = 0;
ResetPickPocketRefillTimer();
loot.clear();
@@ -2454,7 +2454,7 @@ bool Creature::SetWalk(bool enable)
return false;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_WALK_MODE : SMSG_SPLINE_MOVE_SET_RUN_MODE, 9);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, false);
return true;
}
@@ -2470,7 +2470,7 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/)
return true;
WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, false);
return true;
}
@@ -2484,7 +2484,7 @@ bool Creature::SetSwim(bool enable)
return true;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_START_SWIM : SMSG_SPLINE_MOVE_STOP_SWIM);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, true);
return true;
}
@@ -2498,7 +2498,7 @@ bool Creature::SetCanFly(bool enable)
return true;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, false);
return true;
}
@@ -2512,7 +2512,7 @@ bool Creature::SetWaterWalking(bool enable, bool packetOnly /* = false */)
return true;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, true);
return true;
}
@@ -2526,7 +2526,7 @@ bool Creature::SetFeatherFall(bool enable, bool packetOnly /* = false */)
return true;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, true);
return true;
}
@@ -2547,7 +2547,7 @@ bool Creature::SetHover(bool enable, bool packetOnly /*= false*/)
//! Not always a packet is sent
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9);
data.append(GetPackGUID());
data << GetPackGUID();
SendMessageToSet(&data, false);
return true;
}
@@ -2670,10 +2670,10 @@ void Creature::SetDisplayId(uint32 modelId)
}
}
void Creature::SetTarget(uint64 guid)
void Creature::SetTarget(ObjectGuid guid)
{
if (!_focusSpell)
SetUInt64Value(UNIT_FIELD_TARGET, guid);
SetGuidValue(UNIT_FIELD_TARGET, guid);
}
void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
@@ -2683,7 +2683,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
return;
_focusSpell = focusSpell;
SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID());
SetGuidValue(UNIT_FIELD_TARGET, target->GetGUID());
if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
AddUnitState(UNIT_STATE_ROTATING);
@@ -2699,9 +2699,9 @@ void Creature::ReleaseFocus(Spell const* focusSpell)
_focusSpell = NULL;
if (Unit* victim = GetVictim())
SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID());
else
SetUInt64Value(UNIT_FIELD_TARGET, 0);
SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty);
if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
ClearUnitState(UNIT_STATE_ROTATING);
+10 -10
View File
@@ -554,11 +554,11 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void StartPickPocketRefillTimer();
void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(NULL); }
void SetSkinner(uint64 guid) { _skinner = guid; }
uint64 GetSkinner() const { return _skinner; } // Returns the player who skinned this creature
void SetSkinner(ObjectGuid guid) { _skinner = guid; }
ObjectGuid GetSkinner() const { return _skinner; } // Returns the player who skinned this creature
Player* GetLootRecipient() const;
Group* GetLootRecipientGroup() const;
bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
bool hasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; }
bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
void SetLootRecipient (Unit* unit);
@@ -676,7 +676,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
bool m_isTempWorldObject; //true when possessed
// Handling caster facing during spellcast
void SetTarget(uint64 guid) override;
void SetTarget(ObjectGuid guid) override;
void FocusTarget(Spell const* focusSpell, WorldObject const* target);
void ReleaseFocus(Spell const* focusSpell);
@@ -689,9 +689,9 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
static float _GetHealthMod(int32 Rank);
uint64 m_lootRecipient;
ObjectGuid m_lootRecipient;
uint32 m_lootRecipientGroup;
uint64 _skinner;
ObjectGuid _skinner;
/// Timers
time_t _pickpocketLootRestore;
@@ -748,15 +748,15 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
class AssistDelayEvent : public BasicEvent
{
public:
AssistDelayEvent(uint64 victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
AssistDelayEvent(ObjectGuid victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
bool Execute(uint64 e_time, uint32 p_time) override;
void AddAssistant(uint64 guid) { m_assistants.push_back(guid); }
void AddAssistant(ObjectGuid guid) { m_assistants.push_back(guid); }
private:
AssistDelayEvent();
uint64 m_victim;
std::list<uint64> m_assistants;
ObjectGuid m_victim;
GuidList m_assistants;
Unit& m_owner;
};
+13 -13
View File
@@ -28,7 +28,7 @@ GossipMenu::GossipMenu()
{
_menuId = 0;
_locale = DEFAULT_LOCALE;
_senderGUID = 0;
_senderGUID.Clear();
}
GossipMenu::~GossipMenu()
@@ -188,7 +188,7 @@ void PlayerMenu::ClearMenus()
_questMenu.ClearMenu();
}
void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID)
void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
{
_gossipMenu.SetSenderGUID(objectGUID);
@@ -248,7 +248,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID)
void PlayerMenu::SendCloseGossip()
{
_gossipMenu.SetSenderGUID(0);
_gossipMenu.SetSenderGUID(ObjectGuid::Empty);
WorldPacket data(SMSG_GOSSIP_COMPLETE, 0);
_session->SendPacket(&data);
@@ -323,7 +323,7 @@ void QuestMenu::ClearMenu()
_questMenuItems.clear();
}
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID)
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID)
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size
data << uint64(npcGUID);
@@ -368,20 +368,20 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string
data.put<uint8>(count_pos, count);
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID));
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC=%s", npcGUID.ToString().c_str());
}
void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const
void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const
{
WorldPacket data(SMSG_QUESTGIVER_STATUS, 9);
data << uint64(npcGUID);
data << uint8(questStatus);
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC=%s, status=%u", npcGUID.ToString().c_str(), questStatus);
}
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
{
std::string questTitle = quest->GetTitle();
std::string questDetails = quest->GetDetails();
@@ -486,7 +486,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
}
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
@@ -626,7 +626,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId());
}
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
{
std::string questTitle = quest->GetTitle();
std::string questOfferRewardText = quest->GetOfferRewardText();
@@ -717,10 +717,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(quest->RewardFactionValueIdOverride[i]);
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const
void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
{
// We can always call to RequestItems, but this packet only goes out if there are actually
// items. Otherwise, we'll skip straight to the OfferReward
@@ -794,7 +794,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
data << uint32(0x10);
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
void PlayerMenu::AddQuestLevelToTitle(std::string &title, int32 level)
+10 -9
View File
@@ -20,6 +20,7 @@
#define TRINITYCORE_GOSSIP_H
#include "Common.h"
#include "ObjectGuid.h"
#include "QuestDef.h"
#include "NPCHandler.h"
@@ -167,8 +168,8 @@ class GossipMenu
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
uint32 GetMenuId() const { return _menuId; }
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
uint64 GetSenderGUID() const { return _senderGUID; }
void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; }
ObjectGuid GetSenderGUID() const { return _senderGUID; }
void SetLocale(LocaleConstant locale) { _locale = locale; }
LocaleConstant GetLocale() const { return _locale; }
@@ -217,7 +218,7 @@ class GossipMenu
GossipMenuItemContainer _menuItems;
GossipMenuItemDataContainer _menuItemData;
uint32 _menuId;
uint64 _senderGUID;
ObjectGuid _senderGUID;
LocaleConstant _locale;
};
@@ -267,22 +268,22 @@ class PlayerMenu
uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
void SendGossipMenu(uint32 titleTextId, uint64 objectGUID);
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID);
void SendCloseGossip();
void SendPointOfInterest(uint32 poiId) const;
/*********************************************************/
/*** QUEST SYSTEM ***/
/*********************************************************/
void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const;
void SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const;
void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID);
void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID);
void SendQuestQueryResponse(Quest const* quest) const;
void SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const;
void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const;
void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
void SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const;
void SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const;
static void AddQuestLevelToTitle(std::string &title, int32 level);
@@ -28,7 +28,9 @@ TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, boo
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
m_timer(0), m_lifetime(0)
{
m_summonerGUID = owner ? owner->GetGUID() : 0;
if (owner)
m_summonerGUID = owner->GetGUID();
m_unitTypeMask |= UNIT_MASK_SUMMON;
}
@@ -271,7 +273,7 @@ void TempSummon::RemoveFromWorld()
if (uint32 slot = m_Properties->Slot)
if (Unit* owner = GetSummoner())
if (owner->m_SummonSlot[slot] == GetGUID())
owner->m_SummonSlot[slot] = 0;
owner->m_SummonSlot[slot].Clear();
//if (GetOwnerGUID())
// TC_LOG_ERROR("entities.unit", "Unit %u has owner guid when removed from world", GetEntry());
@@ -51,7 +51,7 @@ class TempSummon : public Creature
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override { }
Unit* GetSummoner() const;
Creature* GetSummonerCreatureBase() const;
uint64 GetSummonerGUID() const { return m_summonerGUID; }
ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
uint32 GetTimer() { return m_timer; }
@@ -60,7 +60,7 @@ class TempSummon : public Creature
TempSummonType m_type;
uint32 m_timer;
uint32 m_lifetime;
uint64 m_summonerGUID;
ObjectGuid m_summonerGUID;
};
class Minion : public TempSummon
@@ -94,7 +94,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
SetEntry(spellId);
SetObjectScale(1);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
// by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
@@ -55,7 +55,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>, publ
void BindToCaster();
void UnbindFromCaster();
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
ObjectGuid GetCasterGUID() const { return GetGuidValue(DYNAMICOBJECT_CASTER); }
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
protected:
@@ -47,19 +47,16 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_respawnTime = 0;
m_respawnDelayTime = 300;
m_lootState = GO_NOT_READY;
m_lootStateUnitGUID = 0;
m_spawnedByDefault = true;
m_usetimes = 0;
m_spellId = 0;
m_cooldownTime = 0;
m_goInfo = NULL;
m_ritualOwnerGUID = 0;
m_goData = NULL;
m_DBTableGuid = 0;
m_rotation = 0;
m_lootRecipient = 0;
m_lootRecipientGroup = 0;
m_groupLootTimer = 0;
lootingGroupLowGUID = 0;
@@ -108,7 +105,7 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup)
void GameObject::RemoveFromOwner()
{
uint64 ownerGUID = GetOwnerGUID();
ObjectGuid ownerGUID = GetOwnerGUID();
if (!ownerGUID)
return;
@@ -119,15 +116,9 @@ void GameObject::RemoveFromOwner()
return;
}
const char * ownerType = "creature";
if (IS_PLAYER_GUID(ownerGUID))
ownerType = "player";
else if (IS_PET_GUID(ownerGUID))
ownerType = "pet";
TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list",
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);
SetOwnerGUID(0);
TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (%s) GO list",
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), ownerGUID.ToString().c_str());
SetOwnerGUID(ObjectGuid::Empty);
}
void GameObject::AddToWorld()
@@ -385,11 +376,11 @@ void GameObject::Update(uint32 diff)
time_t now = time(NULL);
if (m_respawnTime <= now) // timer expired
{
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
ObjectGuid dbtableHighGuid(HIGHGUID_GAMEOBJECT, GetEntry(), m_DBTableGuid);
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (linkedRespawntime) // Can't respawn, the master is dead
{
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else
@@ -594,7 +585,7 @@ void GameObject::Update(uint32 diff)
if (spellId)
{
for (std::set<uint64>::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it)
for (GuidSet::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it)
// m_unique_users can contain only player GUIDs
if (Player* owner = ObjectAccessor::GetPlayer(*this, *it))
owner->CastSpell(owner, spellId, false);
@@ -981,14 +972,15 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
return false;
// Always seen by owner and friendly units
if (uint64 guid = GetOwnerGUID())
if (ObjectGuid guid = GetOwnerGUID())
{
if (seer->GetGUID() == guid)
return true;
Unit* owner = GetOwner();
if (owner && seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(((Unit*)seer)))
return true;
if (Unit const* unitSeer = seer->ToUnit())
if (owner && owner->IsFriendlyTo(unitSeer))
return true;
}
return false;
@@ -1239,9 +1231,9 @@ void GameObject::Use(Unit* user)
{
if (info->chair.slots > 0) // sometimes chairs in DB have error in fields and we dont know number of slots
for (uint32 i = 0; i < info->chair.slots; ++i)
ChairListSlots[i] = 0; // Last user of current slot set to 0 (none sit here yet)
ChairListSlots[i].Clear(); // Last user of current slot set to 0 (none sit here yet)
else
ChairListSlots[0] = 0; // error in DB, make one default slot
ChairListSlots[0].Clear(); // error in DB, make one default slot
}
Player* player = user->ToPlayer();
@@ -1274,10 +1266,10 @@ void GameObject::Use(Unit* user)
if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
else
itr->second = 0; // This seat is unoccupied.
itr->second.Clear(); // This seat is unoccupied.
}
else
itr->second = 0; // The seat may of had an occupant, but they're offline.
itr->second.Clear(); // The seat may of had an occupant, but they're offline.
}
found_free_slot = true;
@@ -1557,7 +1549,7 @@ void GameObject::Use(Unit* user)
else
{
// reset ritual for this GO
m_ritualOwnerGUID = 0;
m_ritualOwnerGUID.Clear();
m_unique_users.clear();
m_usetimes = 0;
}
@@ -1798,7 +1790,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, bool triggered /*= true
trigger->setFaction(14);
// Set owner guid for target if no owner available - needed by trigger auras
// - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : 0);
trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : ObjectGuid::Empty);
}
}
@@ -1921,9 +1913,9 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u
if (player)
{
WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4);
data.appendPackGUID(GetGUID());
data.appendPackGUID(attackerOrHealer->GetGUID());
data.appendPackGUID(player->GetGUID());
data << GetPackGUID();
data << attackerOrHealer->GetPackGUID();
data << player->GetPackGUID();
data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event
// change >= 0 triggers SPELL_BUILDING_DAMAGE event
data << uint32(spellId);
@@ -2039,7 +2031,11 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
void GameObject::SetLootState(LootState state, Unit* unit)
{
m_lootState = state;
m_lootStateUnitGUID = unit ? unit->GetGUID() : 0;
if (unit)
m_lootStateUnitGUID = unit->GetGUID();
else
m_lootStateUnitGUID.Clear();
AI()->OnStateChanged(state, unit);
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
@@ -2134,7 +2130,7 @@ void GameObject::SetLootRecipient(Unit* unit)
if (!unit)
{
m_lootRecipient = 0;
m_lootRecipient.Clear();
m_lootRecipientGroup = 0;
return;
}
@@ -664,7 +664,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
void DeleteFromDB();
void SetOwnerGUID(uint64 owner)
void SetOwnerGUID(ObjectGuid owner)
{
// Owner already found and different than expected owner - remove object from old owner
if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
@@ -672,9 +672,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
ASSERT(false);
}
m_spawnedByDefault = false; // all object with owner is despawned after delay
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
SetGuidValue(OBJECT_FIELD_CREATED_BY, owner);
}
uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
ObjectGuid GetOwnerGUID() const { return GetGuidValue(OBJECT_FIELD_CREATED_BY); }
Unit* GetOwner() const;
void SetSpellId(uint32 id)
@@ -764,7 +764,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
Group* GetLootRecipientGroup() const;
void SetLootRecipient(Unit* unit);
bool IsLootAllowedFor(Player const* player) const;
bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; }
uint32 m_groupLootTimer; // (msecs)timer used for group loot
uint32 lootingGroupLowGUID; // used to find group which is looting
@@ -843,17 +843,17 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
LootState m_lootState;
uint64 m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*)
ObjectGuid m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*)
bool m_spawnedByDefault;
time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
// For traps this: spell casting cooldown, for doors/buttons: reset time.
std::list<uint32> m_SkillupList;
uint64 m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
std::set<uint64> m_unique_users;
ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
GuidSet m_unique_users;
uint32 m_usetimes;
typedef std::map<uint32, uint64> ChairSlotAndUser;
typedef std::map<uint32, ObjectGuid> ChairSlotAndUser;
ChairSlotAndUser ChairListSlots;
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
@@ -864,7 +864,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
uint64 m_rotation;
Position m_stationaryPosition;
uint64 m_lootRecipient;
ObjectGuid m_lootRecipient;
uint32 m_lootRecipientGroup;
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
private:
+13 -10
View File
@@ -81,8 +81,11 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
SetEntry(itemid);
SetObjectScale(1.0f);
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
if (owner)
{
SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
}
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
@@ -94,7 +97,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
// Cleaning 20 slots
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid::Empty);
m_bagslot[i] = NULL;
}
@@ -106,7 +109,7 @@ void Bag::SaveToDB(SQLTransaction& trans)
Item::SaveToDB(trans);
}
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
bool Bag::LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
{
if (!Item::LoadFromDB(guid, owner_guid, fields, entry))
return false;
@@ -116,7 +119,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid::Empty);
delete m_bagslot[i];
m_bagslot[i] = NULL;
}
@@ -151,7 +154,7 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/)
m_bagslot[slot]->SetContainer(NULL);
m_bagslot[slot] = NULL;
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0);
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid::Empty);
}
void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
@@ -161,9 +164,9 @@ void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
if (pItem && pItem->GetGUID() != this->GetGUID())
{
m_bagslot[slot] = pItem;
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID());
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
pItem->SetGuidValue(ITEM_FIELD_OWNER, GetOwnerGUID());
pItem->SetContainer(this);
pItem->SetSlot(slot);
}
@@ -225,7 +228,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem)
return count;
}
uint8 Bag::GetSlotByItemGUID(uint64 guid) const
uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
{
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] != 0)
@@ -45,7 +45,7 @@ class Bag : public Item
uint32 GetItemCount(uint32 item, Item* eItem = NULL) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const;
uint8 GetSlotByItemGUID(uint64 guid) const;
uint8 GetSlotByItemGUID(ObjectGuid guid) const;
bool IsEmpty() const;
uint32 GetFreeSlots() const;
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
@@ -54,7 +54,7 @@ class Bag : public Item
// overwrite virtual Item::SaveToDB
void SaveToDB(SQLTransaction& trans) override;
// overwrite virtual Item::LoadFromDB
bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) override;
bool LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry) override;
// overwrite virtual Item::DeleteFromDB
void DeleteFromDB(SQLTransaction& trans) override;
+23 -18
View File
@@ -262,8 +262,11 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
SetEntry(itemid);
SetObjectScale(1.0f);
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
if (owner)
{
SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
}
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
if (!itemProto)
@@ -323,9 +326,9 @@ void Item::SaveToDB(SQLTransaction& trans)
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
stmt->setUInt32( index, GetEntry());
stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR)));
stmt->setUInt32(++index, GetOwnerGUID().GetCounter());
stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
stmt->setUInt32(++index, GetCount());
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
@@ -356,7 +359,7 @@ void Item::SaveToDB(SQLTransaction& trans)
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
stmt->setUInt32(0, GetOwnerGUID().GetCounter());
stmt->setUInt32(1, guid);
trans->Append(stmt);
}
@@ -395,7 +398,7 @@ void Item::SaveToDB(SQLTransaction& trans)
CharacterDatabase.CommitTransaction(trans);
}
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
bool Item::LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
{
// 0 1 2 3 4 5 6 7 8 9 10
//result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
@@ -413,12 +416,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
return false;
// set owner (not if item is only loaded for gbank/auction/mail
if (owner_guid != 0)
if (owner_guid)
SetOwnerGUID(owner_guid);
bool need_save = false; // need explicit save data at load fixes
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER));
SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32()));
SetCount(fields[2].GetUInt32());
uint32 duration = fields[3].GetUInt32();
@@ -693,7 +696,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
if (forplayer)
{
RemoveFromUpdateQueueOf(forplayer);
forplayer->DeleteRefundReference(GetGUIDLow());
forplayer->DeleteRefundReference(GetGUID());
}
delete this;
return;
@@ -725,7 +728,8 @@ void Item::AddToUpdateQueueOf(Player* player)
if (player->GetGUID() != GetOwnerGUID())
{
TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
return;
}
@@ -745,7 +749,8 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
if (player->GetGUID() != GetOwnerGUID())
{
TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
return;
}
@@ -881,7 +886,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
return true;
}
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster /*= 0*/)
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster /*= ObjectGuid::Empty*/)
{
// Better lost small time at check in comparison lost time at item save to DB.
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
@@ -891,7 +896,7 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT)
{
if (uint32 oldEnchant = GetEnchantmentId(slot))
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), 0, GetEntry(), oldEnchant);
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetEntry(), oldEnchant);
if (id)
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id);
@@ -1075,8 +1080,8 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
if (!newItem)
return NULL;
newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR));
newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR));
newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR));
newItem->SetGuidValue(ITEM_FIELD_GIFTCREATOR, GetGuidValue(ITEM_FIELD_GIFTCREATOR));
newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FLAG_REFUNDABLE | ITEM_FLAG_BOP_TRADEABLE));
newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION));
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
@@ -1157,7 +1162,7 @@ void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransa
SetPaidExtendedCost(0);
DeleteRefundDataFromDB(trans);
owner->DeleteRefundReference(GetGUIDLow());
owner->DeleteRefundReference(GetGUID());
}
void Item::UpdatePlayedTime(Player* owner)
+4 -4
View File
@@ -217,8 +217,8 @@ class Item : public Object
ItemTemplate const* GetTemplate() const;
uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); }
ObjectGuid GetOwnerGUID() const { return GetGuidValue(ITEM_FIELD_OWNER); }
void SetOwnerGUID(ObjectGuid guid) { SetGuidValue(ITEM_FIELD_OWNER, guid); }
Player* GetOwner()const;
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, val); }
@@ -227,7 +227,7 @@ class Item : public Object
bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const;
virtual void SaveToDB(SQLTransaction& trans);
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
virtual bool LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry);
static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
virtual void DeleteFromDB(SQLTransaction& trans);
static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid);
@@ -289,7 +289,7 @@ class Item : public Object
void SetItemRandomProperties(int32 randomPropId);
void UpdateItemSuffixFactor();
static int32 GenerateItemRandomPropertyId(uint32 item_id);
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster = 0);
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
void ClearEnchantment(EnchantmentSlot slot);
+50 -31
View File
@@ -82,8 +82,6 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1)
m_inWorld = false;
m_objectUpdated = false;
m_PackGUID.appendPackGUID(0);
}
WorldObject::~WorldObject()
@@ -93,8 +91,8 @@ WorldObject::~WorldObject()
{
if (GetTypeId() == TYPEID_CORPSE)
{
TC_LOG_FATAL("misc", "Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!",
GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
TC_LOG_FATAL("misc", "Object::~Object Corpse type=%d deleted but still in map!!",
GetGUID().ToString().c_str(), ((Corpse*)this)->GetType());
ASSERT(false);
}
ResetMap();
@@ -105,7 +103,7 @@ Object::~Object()
{
if (IsInWorld())
{
TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
TC_LOG_FATAL("misc", "Object::~Object %s but still in world!!", GetGUID().ToString().c_str());
if (isType(TYPEMASK_ITEM))
TC_LOG_FATAL("misc", "Item slot %u", ((Item*)this)->GetSlot());
ASSERT(false);
@@ -114,7 +112,7 @@ Object::~Object()
if (m_objectUpdated)
{
TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
TC_LOG_FATAL("misc", "Object::~Object %s deleted but still in update list!!", GetGUID().ToString().c_str());
ASSERT(false);
sObjectAccessor->RemoveUpdateObject(this);
}
@@ -137,11 +135,10 @@ void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
{
if (!m_uint32Values) _InitValues();
uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh);
SetUInt64Value(OBJECT_FIELD_GUID, guid);
ObjectGuid guid(guidhigh, entry, guidlow);
SetGuidValue(OBJECT_FIELD_GUID, guid);
SetUInt32Value(OBJECT_FIELD_TYPE, m_objectType);
m_PackGUID.wpos(0);
m_PackGUID.appendPackGUID(GetGUID());
m_PackGUID.Set(guid);
}
std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const
@@ -181,7 +178,7 @@ void Object::BuildMovementUpdateBlock(UpdateData* data, uint32 flags) const
ByteBuffer buf(500);
buf << uint8(UPDATETYPE_MOVEMENT);
buf.append(GetPackGUID());
buf << GetPackGUID();
BuildMovementUpdate(&buf, flags);
@@ -237,7 +234,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
ByteBuffer buf(500);
buf << uint8(updateType);
buf.append(GetPackGUID());
buf << GetPackGUID();
buf << uint8(m_objectTypeId);
BuildMovementUpdate(&buf, flags);
@@ -261,7 +258,7 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) c
ByteBuffer buf(500);
buf << uint8(UPDATETYPE_VALUES);
buf.append(GetPackGUID());
buf << GetPackGUID();
BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target);
@@ -336,6 +333,12 @@ uint16 Object::GetUInt16Value(uint16 index, uint8 offset) const
return *(((uint16*)&m_uint32Values[index])+offset);
}
ObjectGuid Object::GetGuidValue(uint16 index) const
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
return *((ObjectGuid*)&(m_uint32Values[index]));
}
void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
{
Unit const* unit = NULL;
@@ -376,7 +379,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
Transport* transport = object->GetTransport();
if (transport)
data->append(transport->GetPackGUID());
*data << transport->GetPackGUID();
else
*data << uint8(0);
@@ -465,7 +468,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
{
ASSERT(unit);
if (Unit* victim = unit->GetVictim())
data->append(victim->GetPackGUID());
*data << victim->GetPackGUID();
else
*data << uint8(0);
}
@@ -687,13 +690,12 @@ void Object::SetUInt64Value(uint16 index, uint64 value)
}
}
bool Object::AddUInt64Value(uint16 index, uint64 value)
bool Object::AddGuidValue(uint16 index, ObjectGuid value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
if (value && !*((uint64*)&(m_uint32Values[index])))
if (value && !*((ObjectGuid*)&(m_uint32Values[index])))
{
m_uint32Values[index] = PAIR64_LOPART(value);
m_uint32Values[index + 1] = PAIR64_HIPART(value);
*((ObjectGuid*)&(m_uint32Values[index])) = value;
_changesMask.SetBit(index);
_changesMask.SetBit(index + 1);
@@ -709,10 +711,10 @@ bool Object::AddUInt64Value(uint16 index, uint64 value)
return false;
}
bool Object::RemoveUInt64Value(uint16 index, uint64 value)
bool Object::RemoveGuidValue(uint16 index, ObjectGuid value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
if (value && *((uint64*)&(m_uint32Values[index])) == value)
if (value && *((ObjectGuid*)&(m_uint32Values[index])) == value)
{
m_uint32Values[index] = 0;
m_uint32Values[index + 1] = 0;
@@ -796,6 +798,23 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
}
}
void Object::SetGuidValue(uint16 index, ObjectGuid value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
if (*((ObjectGuid*)&(m_uint32Values[index])) != value)
{
*((ObjectGuid*)&(m_uint32Values[index])) = value;
_changesMask.SetBit(index);
_changesMask.SetBit(index + 1);
if (m_inWorld && !m_objectUpdated)
{
sObjectAccessor->AddUpdateObject(this);
m_objectUpdated = true;
}
}
}
void Object::SetStatFloatValue(uint16 index, float value)
{
if (value < 0)
@@ -1072,7 +1091,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
void MovementInfo::OutDebug()
{
TC_LOG_INFO("misc", "MOVEMENT INFO");
TC_LOG_INFO("misc", "guid " UI64FMTD, guid);
TC_LOG_INFO("misc", "guid %s", guid.ToString().c_str());
TC_LOG_INFO("misc", "flags %u", flags);
TC_LOG_INFO("misc", "flags2 %u", flags2);
TC_LOG_INFO("misc", "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
@@ -1080,7 +1099,7 @@ void MovementInfo::OutDebug()
if (flags & MOVEMENTFLAG_ONTRANSPORT)
{
TC_LOG_INFO("misc", "TRANSPORT:");
TC_LOG_INFO("misc", "guid: " UI64FMTD, transport.guid);
TC_LOG_INFO("misc", "guid: %s", transport.guid.ToString().c_str());
TC_LOG_INFO("misc", "position: `%s`", transport.pos.ToString().c_str());
TC_LOG_INFO("misc", "seat: %i", transport.seat);
TC_LOG_INFO("misc", "time: %u", transport.time);
@@ -1892,7 +1911,7 @@ void Object::ForceValuesUpdateAtIndex(uint32 i)
void Unit::BuildHeartBeatMsg(WorldPacket* data) const
{
data->Initialize(MSG_MOVE_HEARTBEAT, 32);
data->append(GetPackGUID());
*data << GetPackGUID();
BuildMovementPacket(data);
}
@@ -1914,7 +1933,7 @@ void WorldObject::SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr
VisitNearbyWorldObject(GetVisibilityRange(), notifier);
}
void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
void WorldObject::SendObjectDeSpawnAnim(ObjectGuid guid)
{
WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8);
data << uint64(guid);
@@ -2611,7 +2630,7 @@ struct WorldObjectChangeAccumulator
{
UpdateDataMapType& i_updateDatas;
WorldObject& i_object;
std::set<uint64> plr_list;
GuidSet plr_list;
WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d) : i_updateDatas(d), i_object(obj) { }
void Visit(PlayerMapType &m)
{
@@ -2652,13 +2671,13 @@ struct WorldObjectChangeAccumulator
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
source = iter->GetSource();
uint64 guid = source->GetCasterGUID();
ObjectGuid guid = source->GetCasterGUID();
if (IS_PLAYER_GUID(guid))
if (guid.IsPlayer())
{
//Caster may be NULL if DynObj is in removelist
if (Player* caster = ObjectAccessor::FindPlayer(guid))
if (caster->GetUInt64Value(PLAYER_FARSIGHT) == source->GetGUID())
if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID())
BuildPacket(caster);
}
}
@@ -2691,9 +2710,9 @@ void WorldObject::BuildUpdate(UpdateDataMapType& data_map)
ClearUpdateMask(false);
}
uint64 WorldObject::GetTransGUID() const
ObjectGuid WorldObject::GetTransGUID() const
{
if (GetTransport())
return GetTransport()->GetGUID();
return 0;
return ObjectGuid::Empty;
}
+16 -41
View File
@@ -46,33 +46,6 @@
#define NOMINAL_MELEE_RANGE 5.0f
#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
enum TypeMask
{
TYPEMASK_OBJECT = 0x0001,
TYPEMASK_ITEM = 0x0002,
TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
TYPEMASK_UNIT = 0x0008, // creature
TYPEMASK_PLAYER = 0x0010,
TYPEMASK_GAMEOBJECT = 0x0020,
TYPEMASK_DYNAMICOBJECT = 0x0040,
TYPEMASK_CORPSE = 0x0080,
TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
};
enum TypeID
{
TYPEID_OBJECT = 0,
TYPEID_ITEM = 1,
TYPEID_CONTAINER = 2,
TYPEID_UNIT = 3,
TYPEID_PLAYER = 4,
TYPEID_GAMEOBJECT = 5,
TYPEID_DYNAMICOBJECT = 6,
TYPEID_CORPSE = 7
};
#define NUM_CLIENT_OBJECT_TYPES 8
uint32 GuidHigh2TypeId(uint32 guid_hi);
enum TempSummonType
@@ -128,11 +101,11 @@ class Object
virtual void AddToWorld();
virtual void RemoveFromWorld();
uint64 GetGUID() const { return GetUInt64Value(0); }
uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); }
uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); }
const ByteBuffer& GetPackGUID() const { return m_PackGUID; }
ObjectGuid GetGUID() const { return GetGuidValue(OBJECT_FIELD_GUID); }
uint32 GetGUIDLow() const { return GetGuidValue(OBJECT_FIELD_GUID).GetCounter(); }
uint32 GetGUIDMid() const { return GetGuidValue(OBJECT_FIELD_GUID).GetEntry(); }
uint32 GetGUIDHigh() const { return GetGuidValue(OBJECT_FIELD_GUID).GetHigh(); }
PackedGuid const& GetPackGUID() const { return m_PackGUID; }
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
@@ -157,6 +130,7 @@ class Object
float GetFloatValue(uint16 index) const;
uint8 GetByteValue(uint16 index, uint8 offset) const;
uint16 GetUInt16Value(uint16 index, uint8 offset) const;
ObjectGuid GetGuidValue(uint16 index) const;
void SetInt32Value(uint16 index, int32 value);
void SetUInt32Value(uint16 index, uint32 value);
@@ -166,11 +140,12 @@ class Object
void SetByteValue(uint16 index, uint8 offset, uint8 value);
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index, offset, (uint16)value); }
void SetGuidValue(uint16 index, ObjectGuid value);
void SetStatFloatValue(uint16 index, float value);
void SetStatInt32Value(uint16 index, int32 value);
bool AddUInt64Value(uint16 index, uint64 value);
bool RemoveUInt64Value(uint16 index, uint64 value);
bool AddGuidValue(uint16 index, ObjectGuid value);
bool RemoveGuidValue(uint16 index, ObjectGuid value);
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
@@ -265,7 +240,7 @@ class Object
private:
bool m_inWorld;
ByteBuffer m_PackGUID;
PackedGuid m_PackGUID;
// for output helpfull error messages from asserts
bool PrintIndexError(uint32 index, bool set) const;
@@ -410,7 +385,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
struct MovementInfo
{
// common
uint64 guid;
ObjectGuid guid;
uint32 flags;
uint16 flags2;
Position pos;
@@ -421,14 +396,14 @@ struct MovementInfo
{
void Reset()
{
guid = 0;
guid.Clear();
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
seat = -1;
time = 0;
time2 = 0;
}
uint64 guid;
ObjectGuid guid;
Position pos;
int8 seat;
uint32 time;
@@ -457,7 +432,7 @@ struct MovementInfo
float splineElevation;
MovementInfo() :
guid(0), flags(0), flags2(0), time(0), pitch(0.0f), fallTime(0), splineElevation(0.0f)
guid(), flags(0), flags2(0), time(0), pitch(0.0f), fallTime(0), splineElevation(0.0f)
{
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
transport.Reset();
@@ -655,7 +630,7 @@ class WorldObject : public Object, public WorldLocation
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
void SendObjectDeSpawnAnim(uint64 guid);
void SendObjectDeSpawnAnim(ObjectGuid guid);
virtual void SaveRespawnTime() { }
void AddObjectToRemoveList();
@@ -739,7 +714,7 @@ class WorldObject : public Object, public WorldLocation
float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
uint32 GetTransTime() const { return m_movementInfo.transport.time; }
int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
virtual uint64 GetTransGUID() const;
virtual ObjectGuid GetTransGUID() const;
void SetTransport(Transport* t) { m_transport = t; }
MovementInfo m_movementInfo;
+1 -185
View File
@@ -20,22 +20,7 @@
#define TRINITY_OBJECTDEFINES_H
#include "Define.h"
enum HighGuid
{
HIGHGUID_ITEM = 0x4000, // blizz 4000
HIGHGUID_CONTAINER = 0x4000, // blizz 4000
HIGHGUID_PLAYER = 0x0000, // blizz 0000
HIGHGUID_GAMEOBJECT = 0xF110, // blizz F110
HIGHGUID_TRANSPORT = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)
HIGHGUID_UNIT = 0xF130, // blizz F130
HIGHGUID_PET = 0xF140, // blizz F140
HIGHGUID_VEHICLE = 0xF150, // blizz F550
HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100
HIGHGUID_CORPSE = 0xF101, // blizz F100
HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
HIGHGUID_GROUP = 0x1F50
};
#include "ObjectGuid.h"
// used for creating values for respawn for example
inline uint64 MAKE_PAIR64(uint32 l, uint32 h);
@@ -46,35 +31,6 @@ inline uint32 MAKE_PAIR32(uint16 l, uint16 h);
inline uint16 PAIR32_HIPART(uint32 x);
inline uint16 PAIR32_LOPART(uint32 x);
inline bool IS_EMPTY_GUID(uint64 guid);
inline bool IS_CREATURE_GUID(uint64 guid);
inline bool IS_PET_GUID(uint64 guid);
inline bool IS_VEHICLE_GUID(uint64 guid);
inline bool IS_CRE_OR_VEH_GUID(uint64 guid);
inline bool IS_CRE_OR_VEH_OR_PET_GUID(uint64 guid);
inline bool IS_PLAYER_GUID(uint64 guid);
inline bool IS_UNIT_GUID(uint64 guid);
inline bool IS_ITEM_GUID(uint64 guid);
inline bool IS_GAMEOBJECT_GUID(uint64 guid);
inline bool IS_DYNAMICOBJECT_GUID(uint64 guid);
inline bool IS_CORPSE_GUID(uint64 guid);
inline bool IS_TRANSPORT_GUID(uint64 guid);
inline bool IS_MO_TRANSPORT_GUID(uint64 guid);
inline bool IS_GROUP_GUID(uint64 guid);
// l - OBJECT_FIELD_GUID
// e - OBJECT_FIELD_ENTRY for GO (except GAMEOBJECT_TYPE_MO_TRANSPORT) and creatures or UNIT_FIELD_PETNUMBER for pets
// h - OBJECT_FIELD_GUID + 1
inline uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h);
//#define GUID_HIPART(x) (uint32)((uint64(x) >> 52)) & 0x0000FFFF)
inline uint32 GUID_HIPART(uint64 guid);
inline uint32 GUID_ENPART(uint64 x);
inline uint32 GUID_LOPART(uint64 x);
inline bool IsGuidHaveEnPart(uint64 guid);
inline char const* GetLogNameForGuid(uint64 guid);
uint64 MAKE_PAIR64(uint32 l, uint32 h)
{
return uint64(l | (uint64(h) << 32));
@@ -110,144 +66,4 @@ uint16 PAIR32_LOPART(uint32 x)
return (uint16)(x & 0x0000FFFF);
}
bool IS_EMPTY_GUID(uint64 guid)
{
return guid == 0;
}
bool IS_CREATURE_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_UNIT;
}
bool IS_PET_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_PET;
}
bool IS_VEHICLE_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_VEHICLE;
}
bool IS_CRE_OR_VEH_GUID(uint64 guid)
{
return IS_CREATURE_GUID(guid) || IS_VEHICLE_GUID(guid);
}
bool IS_CRE_OR_VEH_OR_PET_GUID(uint64 guid)
{
return IS_CRE_OR_VEH_GUID(guid) || IS_PET_GUID(guid);
}
bool IS_PLAYER_GUID(uint64 guid)
{
return guid != 0 && GUID_HIPART(guid) == HIGHGUID_PLAYER;
}
bool IS_UNIT_GUID(uint64 guid)
{
return IS_CRE_OR_VEH_OR_PET_GUID(guid) || IS_PLAYER_GUID(guid);
}
bool IS_ITEM_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_ITEM;
}
bool IS_GAMEOBJECT_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_GAMEOBJECT;
}
bool IS_DYNAMICOBJECT_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_DYNAMICOBJECT;
}
bool IS_CORPSE_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_CORPSE;
}
bool IS_TRANSPORT_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_TRANSPORT;
}
bool IS_MO_TRANSPORT_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_MO_TRANSPORT;
}
bool IS_GROUP_GUID(uint64 guid)
{
return GUID_HIPART(guid) == HIGHGUID_GROUP;
}
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
{
return uint64(uint64(l) | (uint64(e) << 24) | (uint64(h) << 48));
}
uint32 GUID_HIPART(uint64 guid)
{
return (uint32)((uint64(guid) >> 48) & 0x0000FFFF);
}
uint32 GUID_ENPART(uint64 x)
{
return IsGuidHaveEnPart(x)
? (uint32)((x >> 24) & UI64LIT(0x0000000000FFFFFF))
: 0;
}
uint32 GUID_LOPART(uint64 x)
{
return IsGuidHaveEnPart(x)
? (uint32)(x & UI64LIT(0x0000000000FFFFFF))
: (uint32)(x & UI64LIT(0x00000000FFFFFFFF));
}
bool IsGuidHaveEnPart(uint64 guid)
{
switch (GUID_HIPART(guid))
{
case HIGHGUID_ITEM:
case HIGHGUID_PLAYER:
case HIGHGUID_DYNAMICOBJECT:
case HIGHGUID_CORPSE:
case HIGHGUID_GROUP:
return false;
case HIGHGUID_GAMEOBJECT:
case HIGHGUID_TRANSPORT:
case HIGHGUID_UNIT:
case HIGHGUID_PET:
case HIGHGUID_VEHICLE:
case HIGHGUID_MO_TRANSPORT:
default:
return true;
}
}
char const* GetLogNameForGuid(uint64 guid)
{
switch (GUID_HIPART(guid))
{
case HIGHGUID_ITEM: return "item";
case HIGHGUID_PLAYER: return guid ? "player" : "none";
case HIGHGUID_GAMEOBJECT: return "gameobject";
case HIGHGUID_TRANSPORT: return "transport";
case HIGHGUID_UNIT: return "creature";
case HIGHGUID_PET: return "pet";
case HIGHGUID_VEHICLE: return "vehicle";
case HIGHGUID_DYNAMICOBJECT:return "dynobject";
case HIGHGUID_CORPSE: return "corpse";
case HIGHGUID_MO_TRANSPORT: return "mo_transport";
case HIGHGUID_GROUP: return "group";
default:
return "<unknown>";
}
}
#endif
@@ -0,0 +1,105 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ObjectGuid.h"
#include "World.h"
#include "ObjectMgr.h"
#include <sstream>
#include <iomanip>
ObjectGuid const ObjectGuid::Empty = ObjectGuid();
char const* ObjectGuid::GetTypeName(HighGuid high)
{
switch (high)
{
case HIGHGUID_ITEM: return "Item";
case HIGHGUID_PLAYER: return "Player";
case HIGHGUID_GAMEOBJECT: return "Gameobject";
case HIGHGUID_TRANSPORT: return "Transport";
case HIGHGUID_UNIT: return "Creature";
case HIGHGUID_PET: return "Pet";
case HIGHGUID_VEHICLE: return "Vehicle";
case HIGHGUID_DYNAMICOBJECT: return "DynObject";
case HIGHGUID_CORPSE: return "Corpse";
case HIGHGUID_MO_TRANSPORT: return "MoTransport";
case HIGHGUID_INSTANCE: return "InstanceID";
case HIGHGUID_GROUP: return "Group";
default:
return "<unknown>";
}
}
std::string ObjectGuid::ToString() const
{
std::ostringstream str;
str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << m_guid << std::dec;
str << " Type: " << GetTypeName();
if (HasEntry())
str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";
str << " Low: " << GetCounter();
return str.str();
}
template<HighGuid high>
uint32 ObjectGuidGenerator<high>::Generate()
{
if (m_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1)
{
TC_LOG_ERROR("", "%s guid overflow!! Can't continue, shutting down server. ", ObjectGuid::GetTypeName(high));
World::StopNow(ERROR_EXIT_CODE);
}
return m_nextGuid++;
}
ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid)
{
buf << uint64(guid.GetRawValue());
return buf;
}
ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid)
{
guid.Set(buf.read<uint64>());
return buf;
}
ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid)
{
buf.append(guid.m_packedGuid);
return buf;
}
ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid)
{
buf.readPackGUID(*reinterpret_cast<uint64*>(guid.m_guidPtr));
return buf;
}
template uint32 ObjectGuidGenerator<HIGHGUID_ITEM>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_TRANSPORT>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_UNIT>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_PET>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_INSTANCE>::Generate();
template uint32 ObjectGuidGenerator<HIGHGUID_GROUP>::Generate();
@@ -0,0 +1,262 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ObjectGuid_h__
#define ObjectGuid_h__
#include "Common.h"
#include "ByteBuffer.h"
#include <functional>
enum TypeID
{
TYPEID_OBJECT = 0,
TYPEID_ITEM = 1,
TYPEID_CONTAINER = 2,
TYPEID_UNIT = 3,
TYPEID_PLAYER = 4,
TYPEID_GAMEOBJECT = 5,
TYPEID_DYNAMICOBJECT = 6,
TYPEID_CORPSE = 7
};
#define NUM_CLIENT_OBJECT_TYPES 8
enum TypeMask
{
TYPEMASK_OBJECT = 0x0001,
TYPEMASK_ITEM = 0x0002,
TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
TYPEMASK_UNIT = 0x0008, // creature
TYPEMASK_PLAYER = 0x0010,
TYPEMASK_GAMEOBJECT = 0x0020,
TYPEMASK_DYNAMICOBJECT = 0x0040,
TYPEMASK_CORPSE = 0x0080,
TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
};
enum HighGuid
{
HIGHGUID_ITEM = 0x4000, // blizz 4000
HIGHGUID_CONTAINER = 0x4000, // blizz 4000
HIGHGUID_PLAYER = 0x0000, // blizz 0000
HIGHGUID_GAMEOBJECT = 0xF110, // blizz F110
HIGHGUID_TRANSPORT = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)
HIGHGUID_UNIT = 0xF130, // blizz F130
HIGHGUID_PET = 0xF140, // blizz F140
HIGHGUID_VEHICLE = 0xF150, // blizz F550
HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100
HIGHGUID_CORPSE = 0xF101, // blizz F100
HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
HIGHGUID_INSTANCE = 0x1F40, // blizz 1F40
HIGHGUID_GROUP = 0x1F50
};
class ObjectGuid;
class PackedGuid;
struct PackedGuidReader
{
explicit PackedGuidReader(ObjectGuid& guid) : m_guidPtr(&guid) {}
ObjectGuid* m_guidPtr;
};
class ObjectGuid
{
public:
static ObjectGuid const Empty;
ObjectGuid() : m_guid(0) {}
explicit ObjectGuid(uint64 guid) : m_guid(guid) {}
ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) {}
ObjectGuid(HighGuid hi, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) {}
operator uint64() const { return m_guid; }
PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
void Set(uint64 guid) { m_guid = guid; }
void Clear() { m_guid = 0; }
PackedGuid WriteAsPacked() const;
uint64 GetRawValue() const { return m_guid; }
HighGuid GetHigh() const { return HighGuid((m_guid >> 48) & 0x0000FFFF); }
uint32 GetEntry() const { return HasEntry() ? uint32((m_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; }
uint32 GetCounter() const
{
return HasEntry()
? uint32(m_guid & UI64LIT(0x0000000000FFFFFF))
: uint32(m_guid & UI64LIT(0x00000000FFFFFFFF));
}
static uint32 GetMaxCounter(HighGuid high)
{
return HasEntry(high)
? uint32(0x00FFFFFF)
: uint32(0xFFFFFFFF);
}
uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
bool IsEmpty() const { return m_guid == 0; }
bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; }
bool IsPet() const { return GetHigh() == HIGHGUID_PET; }
bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; }
bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
bool IsPlayer() const { return !IsEmpty() && GetHigh() == HIGHGUID_PLAYER; }
bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
bool IsItem() const { return GetHigh() == HIGHGUID_ITEM; }
bool IsGameObject() const { return GetHigh() == HIGHGUID_GAMEOBJECT; }
bool IsDynamicObject() const { return GetHigh() == HIGHGUID_DYNAMICOBJECT; }
bool IsCorpse() const { return GetHigh() == HIGHGUID_CORPSE; }
bool IsTransport() const { return GetHigh() == HIGHGUID_TRANSPORT; }
bool IsMOTransport() const { return GetHigh() == HIGHGUID_MO_TRANSPORT; }
bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
bool IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; }
bool IsGroup() const { return GetHigh() == HIGHGUID_GROUP; }
static TypeID GetTypeId(HighGuid high)
{
switch (high)
{
case HIGHGUID_ITEM: return TYPEID_ITEM;
//case HIGHGUID_CONTAINER: return TYPEID_CONTAINER; HIGHGUID_CONTAINER==HIGHGUID_ITEM currently
case HIGHGUID_UNIT: return TYPEID_UNIT;
case HIGHGUID_PET: return TYPEID_UNIT;
case HIGHGUID_PLAYER: return TYPEID_PLAYER;
case HIGHGUID_GAMEOBJECT: return TYPEID_GAMEOBJECT;
case HIGHGUID_DYNAMICOBJECT: return TYPEID_DYNAMICOBJECT;
case HIGHGUID_CORPSE: return TYPEID_CORPSE;
case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT;
case HIGHGUID_VEHICLE: return TYPEID_UNIT;
// unknown
case HIGHGUID_INSTANCE:
case HIGHGUID_GROUP:
default: return TYPEID_OBJECT;
}
}
TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
bool operator!() const { return IsEmpty(); }
bool operator== (ObjectGuid const& guid) const { return GetRawValue() == guid.GetRawValue(); }
bool operator!= (ObjectGuid const& guid) const { return GetRawValue() != guid.GetRawValue(); }
bool operator< (ObjectGuid const& guid) const { return GetRawValue() < guid.GetRawValue(); }
static char const* GetTypeName(HighGuid high);
char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
std::string ToString() const;
private:
static bool HasEntry(HighGuid high)
{
switch (high)
{
case HIGHGUID_ITEM:
case HIGHGUID_PLAYER:
case HIGHGUID_DYNAMICOBJECT:
case HIGHGUID_CORPSE:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_INSTANCE:
case HIGHGUID_GROUP:
return false;
case HIGHGUID_GAMEOBJECT:
case HIGHGUID_TRANSPORT:
case HIGHGUID_UNIT:
case HIGHGUID_PET:
case HIGHGUID_VEHICLE:
default:
return true;
}
}
bool HasEntry() const { return HasEntry(GetHigh()); }
explicit ObjectGuid(uint32 const&) = delete; // no implementation, used to catch wrong type assignment
ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
uint64 m_guid;
};
// Some Shared defines
typedef std::set<ObjectGuid> GuidSet;
typedef std::list<ObjectGuid> GuidList;
typedef std::deque<ObjectGuid> GuidDeque;
typedef std::vector<ObjectGuid> GuidVector;
// minimum buffer size for packed guid is 9 bytes
#define PACKED_GUID_MIN_BUFFER_SIZE 9
class PackedGuid
{
friend ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
public: // constructors
explicit PackedGuid() : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(0); }
explicit PackedGuid(uint64 guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid); }
explicit PackedGuid(ObjectGuid guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid.GetRawValue()); }
void Set(uint64 guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid); }
void Set(ObjectGuid guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid.GetRawValue()); }
size_t size() const { return m_packedGuid.size(); }
private: // fields
ByteBuffer m_packedGuid;
};
template<HighGuid high>
class ObjectGuidGenerator
{
public: // constructors
explicit ObjectGuidGenerator(uint32 start = 1) : m_nextGuid(start) {}
void Set(uint32 val) { m_nextGuid = val; }
uint32 Generate();
uint32 GetNextAfterMaxUsed() const { return m_nextGuid; }
private: // fields
uint32 m_nextGuid;
};
ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid);
inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); }
namespace std
{
template<>
class hash<ObjectGuid>
{
public:
size_t operator()(ObjectGuid const& key) const
{
return hash<uint64>()(key.GetRawValue());
}
};
}
#endif // ObjectGuid_h__
@@ -27,12 +27,12 @@
UpdateData::UpdateData() : m_blockCount(0) { }
void UpdateData::AddOutOfRangeGUID(std::set<uint64>& guids)
void UpdateData::AddOutOfRangeGUID(GuidSet& guids)
{
m_outOfRangeGUIDs.insert(guids.begin(), guids.end());
}
void UpdateData::AddOutOfRangeGUID(uint64 guid)
void UpdateData::AddOutOfRangeGUID(ObjectGuid guid)
{
m_outOfRangeGUIDs.insert(guid);
}
@@ -109,13 +109,11 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
if (!m_outOfRangeGUIDs.empty())
{
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
buf << (uint32) m_outOfRangeGUIDs.size();
buf << uint8(UPDATETYPE_OUT_OF_RANGE_OBJECTS);
buf << uint32(m_outOfRangeGUIDs.size());
for (std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
{
buf.appendPackGUID(*i);
}
for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
buf << i->WriteAsPacked();
}
buf.append(m_data);
@@ -20,6 +20,7 @@
#define __UPDATEDATA_H
#include "ByteBuffer.h"
#include "ObjectGuid.h"
#include <set>
class WorldPacket;
@@ -59,18 +60,18 @@ class UpdateData
{
}
void AddOutOfRangeGUID(std::set<uint64>& guids);
void AddOutOfRangeGUID(uint64 guid);
void AddOutOfRangeGUID(GuidSet& guids);
void AddOutOfRangeGUID(ObjectGuid guid);
void AddUpdateBlock(const ByteBuffer &block);
bool BuildPacket(WorldPacket* packet);
bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
void Clear();
std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
GuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
protected:
uint32 m_blockCount;
std::set<uint64> m_outOfRangeGUIDs;
GuidSet m_outOfRangeGUIDs;
ByteBuffer m_data;
void Compress(void* dst, uint32 *dst_size, void* src, int src_size);
+7 -7
View File
@@ -300,8 +300,8 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (summonSpellId)
{
WorldPacket data(SMSG_SPELL_GO, (8+8+4+4+2));
data.append(owner->GetPackGUID());
data.append(owner->GetPackGUID());
data << owner->GetPackGUID();
data << owner->GetPackGUID();
data << uint8(0);
data << uint32(summonSpellId);
data << uint32(256); // CAST_FLAG_UNKNOWN3
@@ -379,7 +379,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
return;
// not save not player pets
if (!IS_PLAYER_GUID(GetOwnerGUID()))
if (!GetOwnerGUID().IsPlayer())
return;
Player* owner = GetOwner();
@@ -414,7 +414,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
// current/stable/not_in_slot
if (mode >= PET_SAVE_AS_CURRENT)
{
uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID());
uint32 ownerLowGUID = GetOwnerGUID().GetCounter();
std::string name = m_name;
CharacterDatabase.EscapeString(name);
trans = CharacterDatabase.BeginTransaction();
@@ -1262,7 +1262,7 @@ void Pet::_LoadAuras(uint32 timediff)
int32 damage[3];
int32 baseDamage[3];
Field* fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64();
ObjectGuid caster_guid(fields[0].GetUInt64());
// NULL guid stored - pet is the caster of the spell - see Pet::_SaveAuras
if (!caster_guid)
caster_guid = GetGUID();
@@ -1357,13 +1357,13 @@ void Pet::_SaveAuras(SQLTransaction& trans)
}
// don't save guid of caster in case we are caster of the spell - guid for pet is generated every pet load, so it won't match saved guid anyways
uint64 casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? 0 : itr->second->GetCasterGUID();
ObjectGuid casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? ObjectGuid::Empty : itr->second->GetCasterGUID();
uint8 index = 0;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA);
stmt->setUInt32(index++, m_charmInfo->GetPetNumber());
stmt->setUInt64(index++, casterGUID);
stmt->setUInt64(index++, casterGUID.GetRawValue());
stmt->setUInt32(index++, itr->second->GetId());
stmt->setUInt8(index++, effMask);
stmt->setUInt8(index++, recalculateMask);
File diff suppressed because it is too large Load Diff
+63 -66
View File
@@ -126,8 +126,6 @@ typedef std::unordered_map<uint32, PlayerTalent*> PlayerTalentMap;
typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap;
typedef std::list<SpellModifier*> SpellModList;
typedef std::list<uint64> WhisperListContainer;
struct SpellCooldown
{
time_t end;
@@ -999,11 +997,11 @@ struct BGData
struct TradeStatusInfo
{
TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(0), Result(EQUIP_ERR_OK),
TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(), Result(EQUIP_ERR_OK),
IsTargetResult(false), ItemLimitCategoryId(0), Slot(0) { }
TradeStatus Status;
uint64 TraderGuid;
ObjectGuid TraderGuid;
InventoryResult Result;
bool IsTargetResult;
uint32 ItemLimitCategoryId;
@@ -1015,21 +1013,21 @@ class TradeData
public: // constructors
TradeData(Player* player, Player* trader) :
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); }
m_money(0), m_spell(0), m_spellCastItem() { }
Player* GetTrader() const { return m_trader; }
TradeData* GetTraderData() const;
Item* GetItem(TradeSlots slot) const;
bool HasItem(uint64 itemGuid) const;
TradeSlots GetTradeSlotForItem(uint64 itemGuid) const;
bool HasItem(ObjectGuid itemGuid) const;
TradeSlots GetTradeSlotForItem(ObjectGuid itemGuid) const;
void SetItem(TradeSlots slot, Item* item);
uint32 GetSpell() const { return m_spell; }
void SetSpell(uint32 spell_id, Item* castItem = NULL);
Item* GetSpellCastItem() const;
bool HasSpellCastItem() const { return m_spellCastItem != 0; }
bool HasSpellCastItem() const { return !m_spellCastItem.IsEmpty(); }
uint32 GetMoney() const { return m_money; }
void SetMoney(uint32 money);
@@ -1055,9 +1053,9 @@ class TradeData
uint32 m_money; // m_player place money to trade
uint32 m_spell; // m_player apply spell to non-traded slot item
uint64 m_spellCastItem; // applied spell cast by item use
ObjectGuid m_spellCastItem; // applied spell cast by item use
uint64 m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot
ObjectGuid m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot
};
class KillRewarder
@@ -1139,8 +1137,8 @@ class Player : public Unit, public GridObject<Player>
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
bool CanInteractWithQuestGiver(Object* questGiver);
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const;
void ToggleAFK();
void ToggleDND();
@@ -1232,7 +1230,7 @@ class Player : public Unit, public GridObject<Player>
uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const;
Item* GetItemByGuid(uint64 guid) const;
Item* GetItemByGuid(ObjectGuid guid) const;
Item* GetItemByEntry(uint32 entry) const;
Item* GetItemByPos(uint16 pos) const;
Item* GetItemByPos(uint8 bag, uint8 slot) const;
@@ -1289,8 +1287,8 @@ class Player : public Unit, public GridObject<Player>
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL, uint32* itemLimitCategory = NULL) const;
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
void AddRefundReference(uint32 it);
void DeleteRefundReference(uint32 it);
void AddRefundReference(ObjectGuid it);
void DeleteRefundReference(ObjectGuid it);
void ApplyEquipCooldown(Item* pItem);
void SetAmmo(uint32 item);
@@ -1320,7 +1318,7 @@ class Player : public Unit, public GridObject<Player>
uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; }
void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0);
void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param);
void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param);
void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid, uint32 param);
void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
@@ -1328,7 +1326,7 @@ class Player : public Unit, public GridObject<Player>
bool IsUseEquipedWeapon(bool mainhand) const;
bool IsTwoHandUsed() const;
void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false);
bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
float GetReputationPriceDiscount(Creature const* creature) const;
@@ -1379,10 +1377,10 @@ class Player : public Unit, public GridObject<Player>
int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : getLevel(); }
void PrepareQuestMenu(uint64 guid);
void SendPreparedQuest(uint64 guid);
void PrepareQuestMenu(ObjectGuid guid);
void SendPreparedQuest(ObjectGuid guid);
bool IsActiveQuest(uint32 quest_id) const;
Quest const* GetNextQuest(uint64 guid, Quest const* quest);
Quest const* GetNextQuest(ObjectGuid guid, Quest const* quest);
bool CanSeeStartQuest(Quest const* quest);
bool CanTakeQuest(Quest const* quest, bool msg);
bool CanAddQuest(Quest const* quest, bool msg);
@@ -1449,11 +1447,11 @@ class Player : public Unit, public GridObject<Player>
void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
void ItemAddedQuestCheck(uint32 entry, uint32 count);
void ItemRemovedQuestCheck(uint32 entry, uint32 count);
void KilledMonster(CreatureTemplate const* cInfo, uint64 guid);
void KilledMonsterCredit(uint32 entry, uint64 guid = 0);
void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
void KilledPlayerCredit();
void KillCreditGO(uint32 entry, uint64 guid = 0);
void TalkedToCreature(uint32 entry, uint64 guid);
void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
void TalkedToCreature(uint32 entry, ObjectGuid guid);
void MoneyChanged(uint32 value);
void ReputationChanged(FactionEntry const* factionEntry);
void ReputationChanged2(FactionEntry const* factionEntry);
@@ -1470,11 +1468,11 @@ class Player : public Unit, public GridObject<Player>
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint8 msg);
void SendQuestUpdateAddItem(Quest const* quest, uint32 itemIdx, uint16 count);
void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount);
void SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount);
void SendQuestUpdateAddPlayer(Quest const* quest, uint16 oldCount, uint16 addCount);
uint64 GetDivider() const { return m_divider; }
void SetDivider(uint64 guid) { m_divider = guid; }
ObjectGuid GetDivider() const { return m_divider; }
void SetDivider(ObjectGuid guid) { m_divider = guid; }
uint32 GetInGameTime() const { return m_ingametime; }
void SetInGameTime(uint32 time) { m_ingametime = time; }
@@ -1488,15 +1486,15 @@ class Player : public Unit, public GridObject<Player>
/*** LOAD SYSTEM ***/
/*********************************************************/
bool LoadFromDB(uint32 guid, SQLQueryHolder *holder);
bool LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder);
bool isBeingLoaded() const override;
void Initialize(uint32 guid);
static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
static float GetFloatValueFromArray(Tokenizer const& data, uint16 index);
static uint32 GetZoneIdFromDB(uint64 guid);
static uint32 GetLevelFromDB(uint64 guid);
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
static uint32 GetZoneIdFromDB(ObjectGuid guid);
static uint32 GetLevelFromDB(ObjectGuid guid);
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid);
static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
@@ -1510,18 +1508,18 @@ class Player : public Unit, public GridObject<Player>
static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value);
static void SetFloatValueInArray(Tokenizer& data, uint16 index, float value);
static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid);
static void Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid);
static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
static void DeleteOldCharacters();
static void DeleteOldCharacters(uint32 keepDays);
bool m_mailsLoaded;
bool m_mailsUpdated;
void SetBindPoint(uint64 guid);
void SendTalentWipeConfirm(uint64 guid);
void SetBindPoint(ObjectGuid guid);
void SendTalentWipeConfirm(ObjectGuid guid);
void ResetPetTalents();
void CalcRage(uint32 damage, bool attacker);
void RegenerateAll();
@@ -1545,11 +1543,11 @@ class Player : public Unit, public GridObject<Player>
Unit* GetSelectedUnit() const;
Player* GetSelectedPlayer() const;
void SetTarget(uint64 /*guid*/) override { } /// Used for serverside target changes, does not apply to players
void SetSelection(uint64 guid) { SetUInt64Value(UNIT_FIELD_TARGET, guid); }
void SetTarget(ObjectGuid /*guid*/) override { } /// Used for serverside target changes, does not apply to players
void SetSelection(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_TARGET, guid); }
uint8 GetComboPoints() const { return m_comboPoints; }
uint64 GetComboTarget() const { return m_comboTarget; }
ObjectGuid GetComboTarget() const { return m_comboTarget; }
void AddComboPoints(Unit* target, int8 count, Spell* spell = NULL);
void GainSpellComboPoints(int8 count);
@@ -1626,7 +1624,7 @@ class Player : public Unit, public GridObject<Player>
void BuildPetTalentsInfoData(WorldPacket* data);
void SendTalentsInfoData(bool pet);
void LearnTalent(uint32 talentId, uint32 talentRank);
void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank);
void LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank);
bool AddTalent(uint32 spellId, uint8 spec, bool learning);
bool HasTalent(uint32 spell_id, uint8 spec) const;
@@ -1689,10 +1687,10 @@ class Player : public Unit, public GridObject<Player>
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
void UpdatePotionCooldown(Spell* spell = NULL);
void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana);
void clearResurrectRequestData() { setResurrectRequestData(0, 0, 0.0f, 0.0f, 0.0f, 0, 0); }
bool isResurrectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; }
bool isResurrectRequested() const { return m_resurrectGUID != 0; }
void setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana);
void clearResurrectRequestData() { setResurrectRequestData(ObjectGuid::Empty, 0, 0.0f, 0.0f, 0.0f, 0, 0); }
bool isResurrectRequestedBy(ObjectGuid guid) const { return m_resurrectGUID == guid; }
bool isResurrectRequested() const { return !m_resurrectGUID.IsEmpty(); }
void ResurrectUsingRequestData();
uint8 getCinematic() { return m_cinematic; }
@@ -1733,7 +1731,7 @@ class Player : public Unit, public GridObject<Player>
bool IsInSameGroupWith(Player const* p) const;
bool IsInSameRaidWith(Player const* p) const;
void UninviteFromGroup();
static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = NULL);
void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
void SendUpdateToOutOfRangeGroupMembers();
@@ -1743,16 +1741,16 @@ class Player : public Unit, public GridObject<Player>
void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
uint32 GetGuildId() const { return GetUInt32Value(PLAYER_GUILDID); }
Guild* GetGuild();
static uint32 GetGuildIdFromDB(uint64 guid);
static uint8 GetRankFromDB(uint64 guid);
static uint32 GetGuildIdFromDB(ObjectGuid guid);
static uint8 GetRankFromDB(ObjectGuid guid);
int GetGuildIdInvited() { return m_GuildIdInvited; }
static void RemovePetitionsAndSigns(uint64 guid, uint32 type);
static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type);
// Arena Team
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type);
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
static void LeaveAllArenaTeams(uint64 guid);
static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot);
static void LeaveAllArenaTeams(ObjectGuid guid);
uint32 GetArenaTeamId(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
uint32 GetArenaPersonalRating(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
@@ -1831,8 +1829,8 @@ class Player : public Unit, public GridObject<Player>
void UpdateManaRegen();
void UpdateRuneRegen(RuneType rune);
uint64 GetLootGUID() const { return m_lootGuid; }
void SetLootGUID(uint64 guid) { m_lootGuid = guid; }
ObjectGuid GetLootGUID() const { return m_lootGuid; }
void SetLootGUID(ObjectGuid guid) { m_lootGuid = guid; }
void RemovedInsignia(Player* looterPlr);
@@ -2040,9 +2038,9 @@ class Player : public Unit, public GridObject<Player>
PlayerMenu* PlayerTalkClass;
std::vector<ItemSetEffect*> ItemSetEff;
void SendLoot(uint64 guid, LootType loot_type);
void SendLootError(uint64 guid, LootError error);
void SendLootRelease(uint64 guid);
void SendLoot(ObjectGuid guid, LootType loot_type);
void SendLootError(ObjectGuid guid, LootError error);
void SendLootRelease(ObjectGuid guid);
void SendNotifyLootItemRemoved(uint8 lootSlot);
void SendNotifyLootMoneyRemoved();
@@ -2166,8 +2164,7 @@ class Player : public Unit, public GridObject<Player>
WorldLocation GetStartPosition() const;
// currently visible objects at player client
typedef std::set<uint64> ClientGUIDs;
ClientGUIDs m_clientGUIDs;
GuidSet m_clientGUIDs;
bool HaveAtClient(WorldObject const* u) const;
@@ -2322,9 +2319,9 @@ class Player : public Unit, public GridObject<Player>
bool isDebugAreaTriggers;
void ClearWhisperWhiteList() { WhisperList.clear(); }
void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); }
bool IsInWhisperWhiteList(uint64 guid);
void RemoveFromWhisperWhiteList(uint64 guid) { WhisperList.remove(guid); }
void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
bool IsInWhisperWhiteList(ObjectGuid guid);
void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
bool SetDisableGravity(bool disable, bool packetOnly /* = false */) override;
bool SetCanFly(bool apply) override;
@@ -2344,7 +2341,7 @@ class Player : public Unit, public GridObject<Player>
protected:
// Gamemaster whisper whitelist
WhisperListContainer WhisperList;
GuidList WhisperList;
uint32 m_regenTimerCount;
float m_powerFraction[MAX_POWERS];
uint32 m_contestedPvPTimer;
@@ -2380,7 +2377,7 @@ class Player : public Unit, public GridObject<Player>
QuestSet m_monthlyquests;
SeasonalEventQuestMap m_seasonalquests;
uint64 m_divider;
ObjectGuid m_divider;
uint32 m_ingametime;
/*********************************************************/
@@ -2452,7 +2449,7 @@ class Player : public Unit, public GridObject<Player>
time_t m_lastHonorUpdateTime;
void outDebugValues() const;
uint64 m_lootGuid;
ObjectGuid m_lootGuid;
uint32 m_team;
uint32 m_nextSave;
@@ -2472,7 +2469,7 @@ class Player : public Unit, public GridObject<Player>
uint32 m_ExtraFlags;
uint64 m_comboTarget;
ObjectGuid m_comboTarget;
int8 m_comboPoints;
QuestStatusMap m_QuestStatus;
@@ -2517,7 +2514,7 @@ class Player : public Unit, public GridObject<Player>
void ResetTimeSync();
void SendTimeSync();
uint64 m_resurrectGUID;
ObjectGuid m_resurrectGUID;
uint32 m_resurrectMap;
float m_resurrectX, m_resurrectY, m_resurrectZ;
uint32 m_resurrectHealth, m_resurrectMana;
@@ -2612,7 +2609,7 @@ class Player : public Unit, public GridObject<Player>
Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
std::set<uint32> m_refundableItems;
GuidSet m_refundableItems;
void SendRefundInfo(Item* item);
void RefundItem(Item* item);
@@ -205,7 +205,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
friendInfo.Level = 0;
friendInfo.Class = 0;
Player* target = ObjectAccessor::FindPlayer(friendGUID);
Player* target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friendGUID));
if (!target)
return;
@@ -290,10 +290,10 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
AccountTypes gmSecLevel = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr)
{
PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUID());
PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUIDLow());
if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND))
{
Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
Player* target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, 0, itr->first));
if (!target || !target->IsInWorld())
continue;

Some files were not shown because too many files have changed in this diff Show More