refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)
This commit is contained in:
@@ -51,19 +51,19 @@ public:
|
||||
|
||||
void DeleteFromDB(SQLTransaction& trans);
|
||||
|
||||
uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||
|
||||
time_t const& GetGhostTime() const { return m_time; }
|
||||
[[nodiscard]] time_t const& GetGhostTime() const { return m_time; }
|
||||
void ResetGhostTime() { m_time = time(nullptr); }
|
||||
CorpseType GetType() const { return m_type; }
|
||||
[[nodiscard]] CorpseType GetType() const { return m_type; }
|
||||
|
||||
GridCoord const& GetGridCoord() const { return _gridCoord; }
|
||||
[[nodiscard]] GridCoord const& GetGridCoord() const { return _gridCoord; }
|
||||
void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; }
|
||||
|
||||
Loot loot; // remove insignia ONLY at BG
|
||||
Player* lootRecipient;
|
||||
|
||||
bool IsExpired(time_t t) const;
|
||||
[[nodiscard]] bool IsExpired(time_t t) const;
|
||||
|
||||
private:
|
||||
CorpseType m_type;
|
||||
|
||||
@@ -133,11 +133,11 @@ struct CreatureTemplate
|
||||
uint32 flags_extra;
|
||||
uint32 ScriptID;
|
||||
WorldPacket queryData; // pussywizard
|
||||
uint32 GetRandomValidModelId() const;
|
||||
uint32 GetFirstValidModelId() const;
|
||||
[[nodiscard]] uint32 GetRandomValidModelId() const;
|
||||
[[nodiscard]] uint32 GetFirstValidModelId() const;
|
||||
|
||||
// helpers
|
||||
SkillType GetRequiredLootSkill() const
|
||||
[[nodiscard]] SkillType GetRequiredLootSkill() const
|
||||
{
|
||||
if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL)
|
||||
return SKILL_HERBALISM;
|
||||
@@ -149,12 +149,12 @@ struct CreatureTemplate
|
||||
return SKILL_SKINNING; // normal case
|
||||
}
|
||||
|
||||
bool IsExotic() const
|
||||
[[nodiscard]] bool IsExotic() const
|
||||
{
|
||||
return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0;
|
||||
}
|
||||
|
||||
bool IsTameable(bool exotic) const
|
||||
[[nodiscard]] bool IsTameable(bool exotic) const
|
||||
{
|
||||
if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0)
|
||||
return false;
|
||||
@@ -351,21 +351,21 @@ struct VendorItemData
|
||||
{
|
||||
VendorItemList m_items;
|
||||
|
||||
VendorItem* GetItem(uint32 slot) const
|
||||
[[nodiscard]] VendorItem* GetItem(uint32 slot) const
|
||||
{
|
||||
if (slot >= m_items.size())
|
||||
return nullptr;
|
||||
|
||||
return m_items[slot];
|
||||
}
|
||||
bool Empty() const { return m_items.empty(); }
|
||||
uint8 GetItemCount() const { return m_items.size(); }
|
||||
[[nodiscard]] bool Empty() const { return m_items.empty(); }
|
||||
[[nodiscard]] uint8 GetItemCount() const { return m_items.size(); }
|
||||
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost)
|
||||
{
|
||||
m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
|
||||
}
|
||||
bool RemoveItem(uint32 item_id);
|
||||
VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const;
|
||||
[[nodiscard]] VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const;
|
||||
void Clear()
|
||||
{
|
||||
for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
|
||||
@@ -402,7 +402,7 @@ struct TrainerSpell
|
||||
uint32 learnedSpell[3];
|
||||
|
||||
// helpers
|
||||
bool IsCastable() const { return learnedSpell[0] != spell; }
|
||||
[[nodiscard]] bool IsCastable() const { return learnedSpell[0] != spell; }
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
|
||||
@@ -415,7 +415,7 @@ struct TrainerSpellData
|
||||
TrainerSpellMap spellList;
|
||||
uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
|
||||
// req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
|
||||
TrainerSpell const* Find(uint32 spell_id) const;
|
||||
[[nodiscard]] TrainerSpell const* Find(uint32 spell_id) const;
|
||||
};
|
||||
|
||||
typedef std::map<uint32, time_t> CreatureSpellCooldowns;
|
||||
@@ -445,24 +445,24 @@ public:
|
||||
void SelectLevel(bool changelevel = true);
|
||||
void LoadEquipment(int8 id = 1, bool force = false);
|
||||
|
||||
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
[[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
|
||||
void Update(uint32 time) override; // overwrited Unit::Update
|
||||
void GetRespawnPosition(float& x, float& y, float& z, float* ori = NULL, float* dist = NULL) const;
|
||||
|
||||
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
|
||||
uint32 GetCorpseDelay() const { return m_corpseDelay; }
|
||||
bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
|
||||
bool IsCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
|
||||
bool IsTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
|
||||
bool IsGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
|
||||
bool CanWalk() const { return GetCreatureTemplate()->InhabitType & INHABIT_GROUND; }
|
||||
bool CanSwim() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) || IS_PLAYER_GUID(GetOwnerGUID()); }
|
||||
bool CanFly() const override { return GetCreatureTemplate()->InhabitType & INHABIT_AIR; }
|
||||
[[nodiscard]] uint32 GetCorpseDelay() const { return m_corpseDelay; }
|
||||
[[nodiscard]] bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
|
||||
[[nodiscard]] bool IsCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
|
||||
[[nodiscard]] bool IsTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
|
||||
[[nodiscard]] bool IsGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
|
||||
[[nodiscard]] bool CanWalk() const { return GetCreatureTemplate()->InhabitType & INHABIT_GROUND; }
|
||||
[[nodiscard]] bool CanSwim() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) || IS_PLAYER_GUID(GetOwnerGUID()); }
|
||||
[[nodiscard]] bool CanFly() const override { return GetCreatureTemplate()->InhabitType & INHABIT_AIR; }
|
||||
|
||||
void SetReactState(ReactStates st) { m_reactState = st; }
|
||||
ReactStates GetReactState() const { return m_reactState; }
|
||||
bool HasReactState(ReactStates state) const { return (m_reactState == state); }
|
||||
[[nodiscard]] ReactStates GetReactState() const { return m_reactState; }
|
||||
[[nodiscard]] bool HasReactState(ReactStates state) const { return (m_reactState == state); }
|
||||
void InitializeReactState();
|
||||
|
||||
///// TODO RENAME THIS!!!!!
|
||||
@@ -471,11 +471,11 @@ public:
|
||||
bool CanCreatureAttack(Unit const* victim, bool skipDistCheck = false) const;
|
||||
bool IsImmunedToSpell(SpellInfo const* spellInfo) override;
|
||||
|
||||
bool HasMechanicTemplateImmunity(uint32 mask) const;
|
||||
[[nodiscard]] bool HasMechanicTemplateImmunity(uint32 mask) const;
|
||||
// redefine Unit::IsImmunedToSpell
|
||||
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override;
|
||||
// redefine Unit::IsImmunedToSpellEffect
|
||||
bool isElite() const
|
||||
[[nodiscard]] bool isElite() const
|
||||
{
|
||||
if (IsPet())
|
||||
return false;
|
||||
@@ -484,7 +484,7 @@ public:
|
||||
return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
|
||||
}
|
||||
|
||||
bool isWorldBoss() const
|
||||
[[nodiscard]] bool isWorldBoss() const
|
||||
{
|
||||
if (IsPet())
|
||||
return false;
|
||||
@@ -492,19 +492,19 @@ public:
|
||||
return GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_BOSS_MOB;
|
||||
}
|
||||
|
||||
bool IsDungeonBoss() const;
|
||||
bool IsImmuneToKnockback() const;
|
||||
bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
|
||||
[[nodiscard]] bool IsDungeonBoss() const;
|
||||
[[nodiscard]] bool IsImmuneToKnockback() const;
|
||||
[[nodiscard]] bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
|
||||
|
||||
uint8 getLevelForTarget(WorldObject const* target) const override; // overwrite Unit::getLevelForTarget for boss level support
|
||||
|
||||
bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); }
|
||||
bool IsEvadingAttacks() const { return IsInEvadeMode() || CanNotReachTarget(); }
|
||||
[[nodiscard]] bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); }
|
||||
[[nodiscard]] bool IsEvadingAttacks() const { return IsInEvadeMode() || CanNotReachTarget(); }
|
||||
|
||||
bool AIM_Initialize(CreatureAI* ai = nullptr);
|
||||
void Motion_Initialize();
|
||||
|
||||
CreatureAI* AI() const { return (CreatureAI*)i_AI; }
|
||||
[[nodiscard]] CreatureAI* AI() const { return (CreatureAI*)i_AI; }
|
||||
|
||||
bool SetWalk(bool enable) override;
|
||||
bool SetDisableGravity(bool disable, bool packetOnly = false) override;
|
||||
@@ -514,22 +514,22 @@ public:
|
||||
bool SetFeatherFall(bool enable, bool packetOnly = false) override;
|
||||
bool SetHover(bool enable, bool packetOnly = false) override;
|
||||
|
||||
uint32 GetShieldBlockValue() const override
|
||||
[[nodiscard]] uint32 GetShieldBlockValue() const override
|
||||
{
|
||||
return (getLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
|
||||
}
|
||||
|
||||
SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; }
|
||||
[[nodiscard]] SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; }
|
||||
void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
|
||||
|
||||
void _AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time);
|
||||
void AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false) override;
|
||||
bool HasSpellCooldown(uint32 spell_id) const override;
|
||||
uint32 GetSpellCooldown(uint32 spell_id) const;
|
||||
[[nodiscard]] bool HasSpellCooldown(uint32 spell_id) const override;
|
||||
[[nodiscard]] uint32 GetSpellCooldown(uint32 spell_id) const;
|
||||
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override;
|
||||
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const;
|
||||
[[nodiscard]] bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const;
|
||||
|
||||
bool HasSpell(uint32 spellID) const override;
|
||||
[[nodiscard]] bool HasSpell(uint32 spellID) const override;
|
||||
|
||||
bool UpdateEntry(uint32 entry, const CreatureData* data = NULL, bool changelevel = true );
|
||||
bool UpdateStats(Stats stat) override;
|
||||
@@ -542,28 +542,28 @@ public:
|
||||
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
|
||||
|
||||
void SetCanDualWield(bool value) override;
|
||||
int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
|
||||
[[nodiscard]] int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
|
||||
uint8 GetCurrentEquipmentId() { return m_equipmentId; }
|
||||
void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; }
|
||||
|
||||
float GetSpellDamageMod(int32 Rank);
|
||||
|
||||
VendorItemData const* GetVendorItems() const;
|
||||
[[nodiscard]] VendorItemData const* GetVendorItems() const;
|
||||
uint32 GetVendorItemCurrentCount(VendorItem const* vItem);
|
||||
uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count);
|
||||
|
||||
TrainerSpellData const* GetTrainerSpells() const;
|
||||
[[nodiscard]] TrainerSpellData const* GetTrainerSpells() const;
|
||||
|
||||
CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
|
||||
CreatureData const* GetCreatureData() const { return m_creatureData; }
|
||||
CreatureAddon const* GetCreatureAddon() const;
|
||||
[[nodiscard]] CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
|
||||
[[nodiscard]] CreatureData const* GetCreatureData() const { return m_creatureData; }
|
||||
[[nodiscard]] CreatureAddon const* GetCreatureAddon() const;
|
||||
|
||||
std::string GetAIName() const;
|
||||
std::string GetScriptName() const;
|
||||
uint32 GetScriptId() const;
|
||||
[[nodiscard]] std::string GetAIName() const;
|
||||
[[nodiscard]] std::string GetScriptName() const;
|
||||
[[nodiscard]] uint32 GetScriptId() const;
|
||||
|
||||
// override WorldObject function for proper name localization
|
||||
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
|
||||
[[nodiscard]] std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
|
||||
|
||||
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
|
||||
|
||||
@@ -575,20 +575,20 @@ public:
|
||||
virtual void DeleteFromDB(); // overriden in Pet
|
||||
|
||||
Loot loot;
|
||||
uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
|
||||
Player* GetLootRecipient() const;
|
||||
Group* GetLootRecipientGroup() const;
|
||||
bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
[[nodiscard]] uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
|
||||
[[nodiscard]] Player* GetLootRecipient() const;
|
||||
[[nodiscard]] Group* GetLootRecipientGroup() const;
|
||||
[[nodiscard]] bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
|
||||
bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(nullptr); }
|
||||
[[nodiscard]] bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(nullptr); }
|
||||
void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(nullptr) + MINUTE + GetCorpseDelay() + GetRespawnTime(); }
|
||||
void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; }
|
||||
|
||||
void SetLootRecipient (Unit* unit, bool withGroup = true);
|
||||
void AllLootRemovedFromCorpse();
|
||||
|
||||
uint16 GetLootMode() const { return m_LootMode; }
|
||||
bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
|
||||
[[nodiscard]] uint16 GetLootMode() const { return m_LootMode; }
|
||||
[[nodiscard]] bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
|
||||
void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
|
||||
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
|
||||
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
|
||||
@@ -607,8 +607,8 @@ public:
|
||||
|
||||
void SendAIReaction(AiReaction reactionType);
|
||||
|
||||
Unit* SelectNearestTarget(float dist = 0, bool playerOnly = false) const;
|
||||
Unit* SelectNearestTargetInAttackDistance(float dist) const;
|
||||
[[nodiscard]] Unit* SelectNearestTarget(float dist = 0, bool playerOnly = false) const;
|
||||
[[nodiscard]] Unit* SelectNearestTargetInAttackDistance(float dist) const;
|
||||
|
||||
void DoFleeToGetAssistance();
|
||||
void CallForHelp(float fRadius);
|
||||
@@ -625,23 +625,23 @@ public:
|
||||
bool IsMoveInLineOfSightDisabled() { return m_moveInLineOfSightDisabled; }
|
||||
bool IsMoveInLineOfSightStrictlyDisabled() { return m_moveInLineOfSightStrictlyDisabled; }
|
||||
|
||||
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
||||
[[nodiscard]] MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
||||
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
||||
|
||||
void RemoveCorpse(bool setSpawnTime = true, bool skipVisibility = false);
|
||||
|
||||
void DespawnOrUnsummon(uint32 msTimeToDespawn = 0);
|
||||
|
||||
time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const;
|
||||
[[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
[[nodiscard]] time_t GetRespawnTimeEx() const;
|
||||
void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(nullptr) + respawn : 0; }
|
||||
void Respawn(bool force = false);
|
||||
void SaveRespawnTime() override;
|
||||
|
||||
uint32 GetRespawnDelay() const { return m_respawnDelay; }
|
||||
[[nodiscard]] uint32 GetRespawnDelay() const { return m_respawnDelay; }
|
||||
void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
|
||||
|
||||
float GetWanderDistance() const { return m_wanderDistance; }
|
||||
[[nodiscard]] float GetWanderDistance() const { return m_wanderDistance; }
|
||||
void SetWanderDistance(float dist) { m_wanderDistance = dist; }
|
||||
|
||||
uint32 m_groupLootTimer; // (msecs)timer used for group loot
|
||||
@@ -651,13 +651,13 @@ public:
|
||||
|
||||
void SetInCombatWithZone();
|
||||
|
||||
bool hasQuest(uint32 quest_id) const override;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
[[nodiscard]] bool hasQuest(uint32 quest_id) const override;
|
||||
[[nodiscard]] bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
|
||||
bool isRegeneratingHealth() { return m_regenHealth; }
|
||||
void SetRegeneratingHealth(bool c) { m_regenHealth = c; }
|
||||
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
|
||||
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
|
||||
[[nodiscard]] virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
|
||||
[[nodiscard]] virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
|
||||
{
|
||||
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
|
||||
return 0;
|
||||
@@ -666,7 +666,7 @@ public:
|
||||
}
|
||||
|
||||
void SetCannotReachTarget(bool cannotReach) { if (cannotReach == m_cannotReachTarget) return; m_cannotReachTarget = cannotReach; m_cannotReachTimer = 0; }
|
||||
bool CanNotReachTarget() const { return m_cannotReachTarget; }
|
||||
[[nodiscard]] bool CanNotReachTarget() const { return m_cannotReachTarget; }
|
||||
|
||||
void SetPosition(float x, float y, float z, float o);
|
||||
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
|
||||
@@ -674,28 +674,28 @@ public:
|
||||
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
|
||||
void SetHomePosition(const Position& pos) { m_homePosition.Relocate(pos); }
|
||||
void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); }
|
||||
Position const& GetHomePosition() const { return m_homePosition; }
|
||||
[[nodiscard]] Position const& GetHomePosition() const { return m_homePosition; }
|
||||
|
||||
void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
|
||||
void SetTransportHomePosition(const Position& pos) { m_transportHomePosition.Relocate(pos); }
|
||||
void GetTransportHomePosition(float& x, float& y, float& z, float& ori) const { m_transportHomePosition.GetPosition(x, y, z, ori); }
|
||||
Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
|
||||
[[nodiscard]] Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
|
||||
|
||||
uint32 GetWaypointPath() const { return m_path_id; }
|
||||
[[nodiscard]] uint32 GetWaypointPath() const { return m_path_id; }
|
||||
void LoadPath(uint32 pathid) { m_path_id = pathid; }
|
||||
|
||||
uint32 GetCurrentWaypointID() const { return m_waypointID; }
|
||||
[[nodiscard]] uint32 GetCurrentWaypointID() const { return m_waypointID; }
|
||||
void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
|
||||
|
||||
void SearchFormation();
|
||||
CreatureGroup* GetFormation() const { return m_formation; }
|
||||
[[nodiscard]] CreatureGroup* GetFormation() const { return m_formation; }
|
||||
void SetFormation(CreatureGroup* formation) { m_formation = formation; }
|
||||
|
||||
Unit* SelectVictim();
|
||||
|
||||
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
|
||||
bool IsReputationGainDisabled() const { return DisableReputationGain; }
|
||||
bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
|
||||
[[nodiscard]] bool IsReputationGainDisabled() const { return DisableReputationGain; }
|
||||
[[nodiscard]] bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
|
||||
void LowerPlayerDamageReq(uint32 unDamage)
|
||||
{
|
||||
if (m_PlayerDamageReq)
|
||||
@@ -704,7 +704,7 @@ public:
|
||||
void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
|
||||
uint32 m_PlayerDamageReq;
|
||||
|
||||
uint32 GetOriginalEntry() const { return m_originalEntry; }
|
||||
[[nodiscard]] uint32 GetOriginalEntry() const { return m_originalEntry; }
|
||||
void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
|
||||
|
||||
static float _GetDamageMod(int32 Rank);
|
||||
@@ -719,7 +719,7 @@ public:
|
||||
void ReleaseFocus(Spell const* focusSpell);
|
||||
|
||||
// Part of Evade mechanics
|
||||
time_t GetLastDamagedTime() const { return _lastDamagedTime; }
|
||||
[[nodiscard]] time_t GetLastDamagedTime() const { return _lastDamagedTime; }
|
||||
void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; }
|
||||
|
||||
protected:
|
||||
@@ -772,7 +772,7 @@ protected:
|
||||
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
|
||||
bool IsInvisibleDueToDespawn() const override;
|
||||
[[nodiscard]] bool IsInvisibleDueToDespawn() const override;
|
||||
bool CanAlwaysSee(WorldObject const* obj) const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -155,23 +155,23 @@ public:
|
||||
void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action);
|
||||
|
||||
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
|
||||
uint32 GetMenuId() const { return _menuId; }
|
||||
[[nodiscard]] uint32 GetMenuId() const { return _menuId; }
|
||||
void SetLocale(LocaleConstant locale) { _locale = locale; }
|
||||
LocaleConstant GetLocale() const { return _locale; }
|
||||
[[nodiscard]] LocaleConstant GetLocale() const { return _locale; }
|
||||
|
||||
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi);
|
||||
|
||||
uint32 GetMenuItemCount() const
|
||||
[[nodiscard]] uint32 GetMenuItemCount() const
|
||||
{
|
||||
return _menuItems.size();
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
[[nodiscard]] bool Empty() const
|
||||
{
|
||||
return _menuItems.empty();
|
||||
}
|
||||
|
||||
GossipMenuItem const* GetItem(uint32 id) const
|
||||
[[nodiscard]] GossipMenuItem const* GetItem(uint32 id) const
|
||||
{
|
||||
GossipMenuItemContainer::const_iterator itr = _menuItems.find(id);
|
||||
if (itr != _menuItems.end())
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GossipMenuItemData const* GetItemData(uint32 indexId) const
|
||||
[[nodiscard]] GossipMenuItemData const* GetItemData(uint32 indexId) const
|
||||
{
|
||||
GossipMenuItemDataContainer::const_iterator itr = _menuItemData.find(indexId);
|
||||
if (itr != _menuItemData.end())
|
||||
@@ -189,13 +189,13 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32 GetMenuItemSender(uint32 menuItemId) const;
|
||||
uint32 GetMenuItemAction(uint32 menuItemId) const;
|
||||
bool IsMenuItemCoded(uint32 menuItemId) const;
|
||||
[[nodiscard]] uint32 GetMenuItemSender(uint32 menuItemId) const;
|
||||
[[nodiscard]] uint32 GetMenuItemAction(uint32 menuItemId) const;
|
||||
[[nodiscard]] bool IsMenuItemCoded(uint32 menuItemId) const;
|
||||
|
||||
void ClearMenu();
|
||||
|
||||
GossipMenuItemContainer const& GetMenuItems() const
|
||||
[[nodiscard]] GossipMenuItemContainer const& GetMenuItems() const
|
||||
{
|
||||
return _menuItems;
|
||||
}
|
||||
@@ -216,19 +216,19 @@ public:
|
||||
void AddMenuItem(uint32 QuestId, uint8 Icon);
|
||||
void ClearMenu();
|
||||
|
||||
uint8 GetMenuItemCount() const
|
||||
[[nodiscard]] uint8 GetMenuItemCount() const
|
||||
{
|
||||
return _questMenuItems.size();
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
[[nodiscard]] bool Empty() const
|
||||
{
|
||||
return _questMenuItems.empty();
|
||||
}
|
||||
|
||||
bool HasItem(uint32 questId) const;
|
||||
[[nodiscard]] bool HasItem(uint32 questId) const;
|
||||
|
||||
QuestMenuItem const& GetItem(uint16 index) const
|
||||
[[nodiscard]] QuestMenuItem const& GetItem(uint16 index) const
|
||||
{
|
||||
return _questMenuItems[index];
|
||||
}
|
||||
@@ -246,12 +246,12 @@ public:
|
||||
GossipMenu& GetGossipMenu() { return _gossipMenu; }
|
||||
QuestMenu& GetQuestMenu() { return _questMenu; }
|
||||
|
||||
bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
|
||||
[[nodiscard]] bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
|
||||
|
||||
void ClearMenus();
|
||||
uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
|
||||
uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
|
||||
bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
|
||||
[[nodiscard]] uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
|
||||
[[nodiscard]] uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
|
||||
[[nodiscard]] bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
|
||||
|
||||
void SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const;
|
||||
void SendCloseGossip() const;
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
void RemoveFromWorld() override;
|
||||
void SetTempSummonType(TempSummonType type);
|
||||
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override {}
|
||||
Unit* GetSummoner() const;
|
||||
[[nodiscard]] Unit* GetSummoner() const;
|
||||
uint64 GetSummonerGUID() { return m_summonerGUID; }
|
||||
TempSummonType const& GetSummonType() { return m_type; }
|
||||
uint32 GetTimer() { return m_timer; }
|
||||
@@ -57,11 +57,11 @@ public:
|
||||
Minion(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
|
||||
void InitStats(uint32 duration) override;
|
||||
void RemoveFromWorld() override;
|
||||
Unit* GetOwner() const;
|
||||
float GetFollowAngle() const override { return m_followAngle; }
|
||||
[[nodiscard]] Unit* GetOwner() const;
|
||||
[[nodiscard]] float GetFollowAngle() const override { return m_followAngle; }
|
||||
void SetFollowAngle(float angle) { m_followAngle = angle; }
|
||||
bool IsPetGhoul() const {return GetEntry() == 26125 /*normal ghoul*/ || GetEntry() == 30230 /*Raise Ally ghoul*/;} // Ghoul may be guardian or pet
|
||||
bool IsGuardianPet() const;
|
||||
[[nodiscard]] bool IsPetGhoul() const {return GetEntry() == 26125 /*normal ghoul*/ || GetEntry() == 30230 /*Raise Ally ghoul*/;} // Ghoul may be guardian or pet
|
||||
[[nodiscard]] bool IsGuardianPet() const;
|
||||
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
|
||||
protected:
|
||||
const uint64 m_owner;
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
void Update(uint32 time) override;
|
||||
void RemoveFromWorld() override;
|
||||
protected:
|
||||
Player* GetOwner() const;
|
||||
[[nodiscard]] Player* GetOwner() const;
|
||||
const uint64 m_owner;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,19 +35,19 @@ public:
|
||||
void Update(uint32 p_time) override;
|
||||
void Remove();
|
||||
void SetDuration(int32 newDuration);
|
||||
int32 GetDuration() const;
|
||||
[[nodiscard]] int32 GetDuration() const;
|
||||
void Delay(int32 delaytime);
|
||||
void SetAura(Aura* aura);
|
||||
void RemoveAura();
|
||||
void SetCasterViewpoint();
|
||||
void RemoveCasterViewpoint();
|
||||
Unit* GetCaster() const { return _caster; }
|
||||
[[nodiscard]] Unit* GetCaster() const { return _caster; }
|
||||
void BindToCaster();
|
||||
void UnbindFromCaster();
|
||||
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
|
||||
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
|
||||
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
|
||||
bool IsViewpoint() const { return _isViewpoint; }
|
||||
[[nodiscard]] uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
|
||||
[[nodiscard]] uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
|
||||
[[nodiscard]] float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
|
||||
[[nodiscard]] bool IsViewpoint() const { return _isViewpoint; }
|
||||
|
||||
protected:
|
||||
Aura* _aura;
|
||||
|
||||
@@ -392,7 +392,7 @@ struct GameObjectTemplate
|
||||
bool IsForQuests; // pussywizard
|
||||
|
||||
// helpers
|
||||
bool IsDespawnAtAction() const
|
||||
[[nodiscard]] bool IsDespawnAtAction() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -405,7 +405,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
bool IsUsableMounted() const
|
||||
[[nodiscard]] bool IsUsableMounted() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -422,7 +422,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetLockId() const
|
||||
[[nodiscard]] uint32 GetLockId() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -453,7 +453,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
bool GetDespawnPossibility() const // despawn at targeting of cast?
|
||||
[[nodiscard]] bool GetDespawnPossibility() const // despawn at targeting of cast?
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -474,7 +474,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetCharges() const // despawn at uses amount
|
||||
[[nodiscard]] uint32 GetCharges() const // despawn at uses amount
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -488,7 +488,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetLinkedGameObjectEntry() const
|
||||
[[nodiscard]] uint32 GetLinkedGameObjectEntry() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -503,7 +503,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetAutoCloseTime() const
|
||||
[[nodiscard]] uint32 GetAutoCloseTime() const
|
||||
{
|
||||
uint32 autoCloseTime = 0;
|
||||
switch (type)
|
||||
@@ -532,7 +532,7 @@ struct GameObjectTemplate
|
||||
return autoCloseTime /* xinef: changed to milliseconds/ IN_MILLISECONDS*/; // prior to 3.0.3, conversion was / 0x10000;
|
||||
}
|
||||
|
||||
uint32 GetLootId() const
|
||||
[[nodiscard]] uint32 GetLootId() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -545,7 +545,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetGossipMenuId() const
|
||||
[[nodiscard]] uint32 GetGossipMenuId() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -558,7 +558,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetEventScriptId() const
|
||||
[[nodiscard]] uint32 GetEventScriptId() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -573,7 +573,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
|
||||
[[nodiscard]] uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -586,7 +586,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
bool IsLargeGameObject() const
|
||||
[[nodiscard]] bool IsLargeGameObject() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -611,7 +611,7 @@ struct GameObjectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
bool IsGameObjectForQuests() const
|
||||
[[nodiscard]] bool IsGameObjectForQuests() const
|
||||
{
|
||||
return IsForQuests;
|
||||
}
|
||||
@@ -741,24 +741,24 @@ public:
|
||||
|
||||
virtual bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
|
||||
void Update(uint32 p_time) override;
|
||||
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
|
||||
GameObjectTemplateAddon const* GetTemplateAddon() const;
|
||||
GameObjectData const* GetGOData() const { return m_goData; }
|
||||
GameObjectValue const* GetGOValue() const { return &m_goValue; }
|
||||
[[nodiscard]] GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
|
||||
[[nodiscard]] GameObjectTemplateAddon const* GetTemplateAddon() const;
|
||||
[[nodiscard]] GameObjectData const* GetGOData() const { return m_goData; }
|
||||
[[nodiscard]] GameObjectValue const* GetGOValue() const { return &m_goValue; }
|
||||
|
||||
bool IsTransport() const;
|
||||
bool IsDestructibleBuilding() const;
|
||||
[[nodiscard]] bool IsTransport() const;
|
||||
[[nodiscard]] bool IsDestructibleBuilding() const;
|
||||
|
||||
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
[[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
|
||||
// z_rot, y_rot, x_rot - rotation angles around z, y and x axes
|
||||
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
|
||||
void SetWorldRotation(G3D::Quat const& rot);
|
||||
void SetTransportPathRotation(float qx, float qy, float qz, float qw);
|
||||
int64 GetPackedWorldRotation() const { return m_packedRotation; }
|
||||
[[nodiscard]] int64 GetPackedWorldRotation() const { return m_packedRotation; }
|
||||
|
||||
// overwrite WorldObject function for proper name localization
|
||||
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
|
||||
[[nodiscard]] std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
|
||||
|
||||
void SaveToDB();
|
||||
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||
@@ -776,18 +776,18 @@ public:
|
||||
m_spawnedByDefault = false; // all object with owner is despawned after delay
|
||||
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
|
||||
}
|
||||
uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
|
||||
Unit* GetOwner() const;
|
||||
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
|
||||
[[nodiscard]] Unit* GetOwner() const;
|
||||
|
||||
void SetSpellId(uint32 id)
|
||||
{
|
||||
m_spawnedByDefault = false; // all summoned object is despawned after delay
|
||||
m_spellId = id;
|
||||
}
|
||||
uint32 GetSpellId() const { return m_spellId;}
|
||||
[[nodiscard]] uint32 GetSpellId() const { return m_spellId;}
|
||||
|
||||
time_t GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const
|
||||
[[nodiscard]] time_t GetRespawnTime() const { return m_respawnTime; }
|
||||
[[nodiscard]] time_t GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
if (m_respawnTime > now)
|
||||
@@ -802,26 +802,26 @@ public:
|
||||
m_respawnDelayTime = respawn > 0 ? respawn : 0;
|
||||
}
|
||||
void Respawn();
|
||||
bool isSpawned() const
|
||||
[[nodiscard]] bool isSpawned() const
|
||||
{
|
||||
return m_respawnDelayTime == 0 ||
|
||||
(m_respawnTime > 0 && !m_spawnedByDefault) ||
|
||||
(m_respawnTime == 0 && m_spawnedByDefault);
|
||||
}
|
||||
bool isSpawnedByDefault() const { return m_spawnedByDefault; }
|
||||
[[nodiscard]] bool isSpawnedByDefault() const { return m_spawnedByDefault; }
|
||||
void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
|
||||
uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
|
||||
[[nodiscard]] uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
|
||||
void Refresh();
|
||||
void Delete();
|
||||
void getFishLoot(Loot* loot, Player* loot_owner);
|
||||
void getFishLootJunk(Loot* loot, Player* loot_owner);
|
||||
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
|
||||
[[nodiscard]] GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
|
||||
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
|
||||
GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
|
||||
[[nodiscard]] GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
|
||||
void SetGoState(GOState state);
|
||||
uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
|
||||
[[nodiscard]] uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
|
||||
void SetGoArtKit(uint8 artkit);
|
||||
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
|
||||
[[nodiscard]] uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
|
||||
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
|
||||
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
|
||||
|
||||
@@ -830,19 +830,19 @@ public:
|
||||
|
||||
void Use(Unit* user);
|
||||
|
||||
LootState getLootState() const { return m_lootState; }
|
||||
[[nodiscard]] LootState getLootState() const { return m_lootState; }
|
||||
// Note: unit is only used when s = GO_ACTIVATED
|
||||
void SetLootState(LootState s, Unit* unit = nullptr);
|
||||
|
||||
uint16 GetLootMode() const { return m_LootMode; }
|
||||
bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
|
||||
[[nodiscard]] uint16 GetLootMode() const { return m_LootMode; }
|
||||
[[nodiscard]] bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
|
||||
void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
|
||||
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
|
||||
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
|
||||
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
|
||||
|
||||
void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
|
||||
bool IsInSkillupList(uint32 PlayerGuidLow) const
|
||||
[[nodiscard]] bool IsInSkillupList(uint32 PlayerGuidLow) const
|
||||
{
|
||||
for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
|
||||
if (*i == PlayerGuidLow)
|
||||
@@ -855,25 +855,25 @@ public:
|
||||
void AddUniqueUse(Player* player);
|
||||
void AddUse() { ++m_usetimes; }
|
||||
|
||||
uint32 GetUseCount() const { return m_usetimes; }
|
||||
uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
|
||||
[[nodiscard]] uint32 GetUseCount() const { return m_usetimes; }
|
||||
[[nodiscard]] uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
|
||||
|
||||
void SaveRespawnTime() override;
|
||||
|
||||
Loot loot;
|
||||
|
||||
Player* GetLootRecipient() const;
|
||||
Group* GetLootRecipientGroup() const;
|
||||
[[nodiscard]] Player* GetLootRecipient() const;
|
||||
[[nodiscard]] Group* GetLootRecipientGroup() const;
|
||||
void SetLootRecipient(Unit* unit);
|
||||
bool IsLootAllowedFor(Player const* player) const;
|
||||
bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
[[nodiscard]] bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
uint32 m_groupLootTimer; // (msecs)timer used for group loot
|
||||
uint32 lootingGroupLowGUID; // used to find group which is looting
|
||||
void SetLootGenerationTime() { m_lootGenerationTime = time(nullptr); }
|
||||
uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
|
||||
[[nodiscard]] uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
|
||||
|
||||
bool hasQuest(uint32 quest_id) const override;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
[[nodiscard]] bool hasQuest(uint32 quest_id) const override;
|
||||
[[nodiscard]] bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
bool ActivateToQuest(Player* target) const;
|
||||
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = nullptr);
|
||||
// 0 = use `gameobject`.`spawntimesecs`
|
||||
@@ -881,9 +881,9 @@ public:
|
||||
|
||||
void TriggeringLinkedGameObject(uint32 trapEntry, Unit* target);
|
||||
|
||||
bool IsNeverVisible() const override;
|
||||
[[nodiscard]] bool IsNeverVisible() const override;
|
||||
bool IsAlwaysVisibleFor(WorldObject const* seer) const override;
|
||||
bool IsInvisibleDueToDespawn() const override;
|
||||
[[nodiscard]] bool IsInvisibleDueToDespawn() const override;
|
||||
|
||||
uint8 getLevelForTarget(WorldObject const* target) const override
|
||||
{
|
||||
@@ -897,7 +897,7 @@ public:
|
||||
|
||||
void CastSpell(Unit* target, uint32 spell);
|
||||
void SendCustomAnim(uint32 anim);
|
||||
bool IsInRange(float x, float y, float z, float radius) const;
|
||||
[[nodiscard]] bool IsInRange(float x, float y, float z, float radius) const;
|
||||
|
||||
void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = nullptr) override; // pussywizard!
|
||||
|
||||
@@ -905,7 +905,7 @@ public:
|
||||
void SetDestructibleBuildingModifyState(bool allow) { m_allowModifyDestructibleBuilding = allow; }
|
||||
// sets GameObject type 33 destruction flags and optionally default health for that state
|
||||
void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = NULL, bool setHealth = false);
|
||||
GameObjectDestructibleState GetDestructibleState() const
|
||||
[[nodiscard]] GameObjectDestructibleState GetDestructibleState() const
|
||||
{
|
||||
if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED))
|
||||
return GO_DESTRUCTIBLE_DESTROYED;
|
||||
@@ -916,12 +916,12 @@ public:
|
||||
|
||||
void EventInform(uint32 eventId);
|
||||
|
||||
virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
|
||||
GameObjectAI* AI() const { return m_AI; }
|
||||
[[nodiscard]] virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
|
||||
[[nodiscard]] GameObjectAI* AI() const { return m_AI; }
|
||||
|
||||
std::string GetAIName() const;
|
||||
[[nodiscard]] std::string GetAIName() const;
|
||||
void SetDisplayId(uint32 displayid);
|
||||
uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
|
||||
[[nodiscard]] uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
|
||||
|
||||
GameObjectModel* m_model;
|
||||
void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr) const;
|
||||
@@ -929,22 +929,22 @@ public:
|
||||
void SetPosition(float x, float y, float z, float o);
|
||||
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
|
||||
|
||||
bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; }
|
||||
bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; }
|
||||
[[nodiscard]] bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; }
|
||||
[[nodiscard]] bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; }
|
||||
|
||||
Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport*>(this); else return nullptr; }
|
||||
Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }
|
||||
[[nodiscard]] Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }
|
||||
|
||||
StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport*>(this); else return nullptr; }
|
||||
StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }
|
||||
[[nodiscard]] StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }
|
||||
|
||||
MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport*>(this); else return nullptr; }
|
||||
MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return nullptr; }
|
||||
[[nodiscard]] MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return nullptr; }
|
||||
|
||||
float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); }
|
||||
float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
|
||||
float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
|
||||
float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
|
||||
[[nodiscard]] float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); }
|
||||
[[nodiscard]] float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
|
||||
[[nodiscard]] float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
|
||||
[[nodiscard]] float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
|
||||
|
||||
float GetInteractionDistance();
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@ public:
|
||||
void StoreItem(uint8 slot, Item* pItem, bool update);
|
||||
void RemoveItem(uint8 slot, bool update);
|
||||
|
||||
Item* GetItemByPos(uint8 slot) const;
|
||||
[[nodiscard]] Item* GetItemByPos(uint8 slot) const;
|
||||
uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const;
|
||||
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
|
||||
|
||||
uint8 GetSlotByItemGUID(uint64 guid) const;
|
||||
bool IsEmpty() const;
|
||||
uint32 GetFreeSlots() const;
|
||||
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
|
||||
[[nodiscard]] uint8 GetSlotByItemGUID(uint64 guid) const;
|
||||
[[nodiscard]] bool IsEmpty() const;
|
||||
[[nodiscard]] uint32 GetFreeSlots() const;
|
||||
[[nodiscard]] uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
|
||||
|
||||
// DB operations
|
||||
// overwrite virtual Item::SaveToDB
|
||||
|
||||
@@ -203,18 +203,18 @@ public:
|
||||
|
||||
virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
|
||||
|
||||
ItemTemplate const* GetTemplate() const;
|
||||
[[nodiscard]] ItemTemplate const* GetTemplate() const;
|
||||
|
||||
uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
|
||||
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
|
||||
void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); }
|
||||
Player* GetOwner() const;
|
||||
[[nodiscard]] Player* GetOwner() const;
|
||||
|
||||
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND, val); }
|
||||
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND); }
|
||||
bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_FLAG_IS_BOUND_TO_ACCOUNT) != 0; }
|
||||
[[nodiscard]] bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND); }
|
||||
[[nodiscard]] bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_FLAG_IS_BOUND_TO_ACCOUNT) != 0; }
|
||||
bool IsBindedNotWith(Player const* player) const;
|
||||
bool IsBoundByEnchant() const;
|
||||
bool IsBoundByTempEnchant() const;
|
||||
[[nodiscard]] bool IsBoundByEnchant() const;
|
||||
[[nodiscard]] bool IsBoundByTempEnchant() const;
|
||||
virtual void SaveToDB(SQLTransaction& trans);
|
||||
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
|
||||
static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
|
||||
@@ -225,49 +225,49 @@ public:
|
||||
void DeleteRefundDataFromDB(SQLTransaction* trans);
|
||||
|
||||
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; }
|
||||
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return nullptr; }
|
||||
[[nodiscard]] const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return nullptr; }
|
||||
|
||||
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
|
||||
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
|
||||
bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
|
||||
bool IsNotEmptyBag() const;
|
||||
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
|
||||
bool CanBeTraded(bool mail = false, bool trade = false) const;
|
||||
[[nodiscard]] bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
|
||||
[[nodiscard]] bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
|
||||
[[nodiscard]] bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
|
||||
[[nodiscard]] bool IsNotEmptyBag() const;
|
||||
[[nodiscard]] bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
|
||||
[[nodiscard]] bool CanBeTraded(bool mail = false, bool trade = false) const;
|
||||
void SetInTrade(bool b = true) { mb_in_trade = b; }
|
||||
bool IsInTrade() const { return mb_in_trade; }
|
||||
[[nodiscard]] bool IsInTrade() const { return mb_in_trade; }
|
||||
|
||||
bool HasEnchantRequiredSkill(const Player* player) const;
|
||||
uint32 GetEnchantRequiredLevel() const;
|
||||
[[nodiscard]] uint32 GetEnchantRequiredLevel() const;
|
||||
|
||||
bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
|
||||
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
|
||||
bool GemsFitSockets() const;
|
||||
[[nodiscard]] bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
|
||||
[[nodiscard]] bool GemsFitSockets() const;
|
||||
|
||||
uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
|
||||
[[nodiscard]] uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
|
||||
void SetCount(uint32 value) { SetUInt32Value(ITEM_FIELD_STACK_COUNT, value); }
|
||||
uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
|
||||
[[nodiscard]] uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
|
||||
// Checks if this item has sockets, whether built-in or added by an upgrade.
|
||||
bool HasSocket() const;
|
||||
uint8 GetGemCountWithID(uint32 GemID) const;
|
||||
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
|
||||
[[nodiscard]] bool HasSocket() const;
|
||||
[[nodiscard]] uint8 GetGemCountWithID(uint32 GemID) const;
|
||||
[[nodiscard]] uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
|
||||
InventoryResult CanBeMergedPartlyWith(ItemTemplate const* proto) const;
|
||||
|
||||
uint8 GetSlot() const {return m_slot;}
|
||||
[[nodiscard]] uint8 GetSlot() const {return m_slot;}
|
||||
Bag* GetContainer() { return m_container; }
|
||||
uint8 GetBagSlot() const;
|
||||
[[nodiscard]] uint8 GetBagSlot() const;
|
||||
void SetSlot(uint8 slot) { m_slot = slot; }
|
||||
uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
|
||||
[[nodiscard]] uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
|
||||
void SetContainer(Bag* container) { m_container = container; }
|
||||
|
||||
bool IsInBag() const { return m_container != nullptr; }
|
||||
bool IsEquipped() const;
|
||||
[[nodiscard]] bool IsInBag() const { return m_container != nullptr; }
|
||||
[[nodiscard]] bool IsEquipped() const;
|
||||
|
||||
uint32 GetSkill();
|
||||
uint32 GetSpell();
|
||||
|
||||
// RandomPropertyId (signed but stored as unsigned)
|
||||
int32 GetItemRandomPropertyId() const { return GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID); }
|
||||
uint32 GetItemSuffixFactor() const { return GetUInt32Value(ITEM_FIELD_PROPERTY_SEED); }
|
||||
[[nodiscard]] int32 GetItemRandomPropertyId() const { return GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID); }
|
||||
[[nodiscard]] uint32 GetItemSuffixFactor() const { return GetUInt32Value(ITEM_FIELD_PROPERTY_SEED); }
|
||||
void SetItemRandomProperties(int32 randomPropId);
|
||||
void UpdateItemSuffixFactor();
|
||||
static int32 GenerateItemRandomPropertyId(uint32 item_id);
|
||||
@@ -275,11 +275,11 @@ public:
|
||||
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
|
||||
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
|
||||
void ClearEnchantment(EnchantmentSlot slot);
|
||||
uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);}
|
||||
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
|
||||
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
|
||||
[[nodiscard]] uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);}
|
||||
[[nodiscard]] uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
|
||||
[[nodiscard]] uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
|
||||
|
||||
std::string const& GetText() const { return m_text; }
|
||||
[[nodiscard]] std::string const& GetText() const { return m_text; }
|
||||
void SetText(std::string const& text) { m_text = text; }
|
||||
|
||||
void SendUpdateSockets();
|
||||
@@ -288,30 +288,30 @@ public:
|
||||
void UpdateDuration(Player* owner, uint32 diff);
|
||||
|
||||
// spell charges (signed but stored as unsigned)
|
||||
int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
|
||||
[[nodiscard]] int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
|
||||
void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index, value); }
|
||||
|
||||
Loot loot;
|
||||
bool m_lootGenerated;
|
||||
|
||||
// Update States
|
||||
ItemUpdateState GetState() const { return uState; }
|
||||
[[nodiscard]] ItemUpdateState GetState() const { return uState; }
|
||||
void SetState(ItemUpdateState state, Player* forplayer = nullptr);
|
||||
void AddToUpdateQueueOf(Player* player);
|
||||
void RemoveFromUpdateQueueOf(Player* player);
|
||||
bool IsInUpdateQueue() const { return uQueuePos != -1; }
|
||||
uint32 GetQueuePos() const { return uQueuePos; }
|
||||
[[nodiscard]] bool IsInUpdateQueue() const { return uQueuePos != -1; }
|
||||
[[nodiscard]] uint32 GetQueuePos() const { return uQueuePos; }
|
||||
void FSetState(ItemUpdateState state) // forced
|
||||
{
|
||||
uState = state;
|
||||
}
|
||||
|
||||
bool hasQuest(uint32 quest_id) const override { return GetTemplate()->StartQuest == quest_id; }
|
||||
bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; }
|
||||
bool IsPotion() const { return GetTemplate()->IsPotion(); }
|
||||
bool IsWeaponVellum() const { return GetTemplate()->IsWeaponVellum(); }
|
||||
bool IsArmorVellum() const { return GetTemplate()->IsArmorVellum(); }
|
||||
bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
|
||||
[[nodiscard]] bool hasQuest(uint32 quest_id) const override { return GetTemplate()->StartQuest == quest_id; }
|
||||
[[nodiscard]] bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; }
|
||||
[[nodiscard]] bool IsPotion() const { return GetTemplate()->IsPotion(); }
|
||||
[[nodiscard]] bool IsWeaponVellum() const { return GetTemplate()->IsWeaponVellum(); }
|
||||
[[nodiscard]] bool IsArmorVellum() const { return GetTemplate()->IsArmorVellum(); }
|
||||
[[nodiscard]] bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
|
||||
|
||||
// Item Refund system
|
||||
void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = nullptr);
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
|
||||
void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&) override;
|
||||
|
||||
uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
|
||||
[[nodiscard]] uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
|
||||
private:
|
||||
std::string m_text;
|
||||
uint8 m_slot;
|
||||
|
||||
@@ -692,7 +692,7 @@ struct ItemTemplate
|
||||
WorldPacket queryData; // pussywizard
|
||||
|
||||
// helpers
|
||||
bool HasSignature() const
|
||||
[[nodiscard]] bool HasSignature() const
|
||||
{
|
||||
return GetMaxStackSize() == 1 &&
|
||||
Class != ITEM_CLASS_CONSUMABLE &&
|
||||
@@ -701,7 +701,7 @@ struct ItemTemplate
|
||||
ItemId != 6948; /*Hearthstone*/
|
||||
}
|
||||
|
||||
bool CanChangeEquipStateInCombat() const
|
||||
[[nodiscard]] bool CanChangeEquipStateInCombat() const
|
||||
{
|
||||
switch (InventoryType)
|
||||
{
|
||||
@@ -721,14 +721,14 @@ struct ItemTemplate
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
|
||||
[[nodiscard]] bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
|
||||
|
||||
uint32 GetMaxStackSize() const
|
||||
[[nodiscard]] uint32 GetMaxStackSize() const
|
||||
{
|
||||
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF - 1) : uint32(Stackable);
|
||||
}
|
||||
|
||||
float getDPS() const
|
||||
[[nodiscard]] float getDPS() const
|
||||
{
|
||||
if (Delay == 0)
|
||||
return 0;
|
||||
@@ -738,7 +738,7 @@ struct ItemTemplate
|
||||
return temp * 500 / Delay;
|
||||
}
|
||||
|
||||
int32 getFeralBonus(int32 extraDPS = 0) const
|
||||
[[nodiscard]] int32 getFeralBonus(int32 extraDPS = 0) const
|
||||
{
|
||||
// 0x02A5F3 - is mask for Melee weapon from ItemSubClassMask.dbc
|
||||
if (Class == ITEM_CLASS_WEAPON && (1 << SubClass) & 0x02A5F3)
|
||||
@@ -751,7 +751,7 @@ struct ItemTemplate
|
||||
return 0;
|
||||
}
|
||||
|
||||
float GetItemLevelIncludingQuality(uint8 pLevel) const
|
||||
[[nodiscard]] float GetItemLevelIncludingQuality(uint8 pLevel) const
|
||||
{
|
||||
auto itemLevel = (float)ItemLevel;
|
||||
switch (Quality)
|
||||
@@ -776,7 +776,7 @@ struct ItemTemplate
|
||||
return std::max<float>(0.f, itemLevel);
|
||||
}
|
||||
|
||||
uint32 GetSkill() const
|
||||
[[nodiscard]] uint32 GetSkill() const
|
||||
{
|
||||
const static uint32 item_weapon_skills[MAX_ITEM_SUBCLASS_WEAPON] =
|
||||
{
|
||||
@@ -811,10 +811,10 @@ struct ItemTemplate
|
||||
}
|
||||
}
|
||||
|
||||
bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
|
||||
bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
|
||||
bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
|
||||
bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); }
|
||||
[[nodiscard]] bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
|
||||
[[nodiscard]] bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
|
||||
[[nodiscard]] bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
|
||||
[[nodiscard]] bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); }
|
||||
|
||||
void InitializeQueryData();
|
||||
};
|
||||
|
||||
@@ -125,23 +125,23 @@ class Object
|
||||
public:
|
||||
virtual ~Object();
|
||||
|
||||
bool IsInWorld() const { return m_inWorld; }
|
||||
[[nodiscard]] bool IsInWorld() const { return m_inWorld; }
|
||||
|
||||
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; }
|
||||
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
[[nodiscard]] uint64 GetGUID() const { return GetUInt64Value(0); }
|
||||
[[nodiscard]] uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
|
||||
[[nodiscard]] uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); }
|
||||
[[nodiscard]] uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); }
|
||||
[[nodiscard]] const ByteBuffer& GetPackGUID() const { return m_PackGUID; }
|
||||
[[nodiscard]] uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
||||
|
||||
virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); }
|
||||
|
||||
TypeID GetTypeId() const { return m_objectTypeId; }
|
||||
bool isType(uint16 mask) const { return (mask & m_objectType); }
|
||||
[[nodiscard]] TypeID GetTypeId() const { return m_objectTypeId; }
|
||||
[[nodiscard]] bool isType(uint16 mask) const { return (mask & m_objectType); }
|
||||
|
||||
virtual void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
|
||||
void SendUpdateToPlayer(Player* player);
|
||||
@@ -152,38 +152,38 @@ public:
|
||||
|
||||
virtual void DestroyForPlayer(Player* target, bool onDeath = false) const;
|
||||
|
||||
int32 GetInt32Value(uint16 index) const
|
||||
[[nodiscard]] int32 GetInt32Value(uint16 index) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
return m_int32Values[index];
|
||||
}
|
||||
|
||||
uint32 GetUInt32Value(uint16 index) const
|
||||
[[nodiscard]] uint32 GetUInt32Value(uint16 index) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
return m_uint32Values[index];
|
||||
}
|
||||
|
||||
uint64 GetUInt64Value(uint16 index) const
|
||||
[[nodiscard]] uint64 GetUInt64Value(uint16 index) const
|
||||
{
|
||||
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
|
||||
return *((uint64*) & (m_uint32Values[index]));
|
||||
}
|
||||
|
||||
float GetFloatValue(uint16 index) const
|
||||
[[nodiscard]] float GetFloatValue(uint16 index) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
return m_floatValues[index];
|
||||
}
|
||||
|
||||
uint8 GetByteValue(uint16 index, uint8 offset) const
|
||||
[[nodiscard]] uint8 GetByteValue(uint16 index, uint8 offset) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
ASSERT(offset < 4);
|
||||
return *(((uint8*)&m_uint32Values[index]) + offset);
|
||||
}
|
||||
|
||||
uint16 GetUInt16Value(uint16 index, uint8 offset) const
|
||||
[[nodiscard]] uint16 GetUInt16Value(uint16 index, uint8 offset) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
ASSERT(offset < 2);
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
SetFlag(index, flag);
|
||||
}
|
||||
|
||||
bool HasFlag(uint16 index, uint32 flag) const
|
||||
[[nodiscard]] bool HasFlag(uint16 index, uint32 flag) const
|
||||
{
|
||||
if (index >= m_valuesCount && !PrintIndexError(index, false))
|
||||
return false;
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
SetByteFlag(index, offset, flag);
|
||||
}
|
||||
|
||||
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
|
||||
[[nodiscard]] bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
ASSERT(offset < 4);
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
SetFlag64(index, flag);
|
||||
}
|
||||
|
||||
bool HasFlag64(uint16 index, uint64 flag) const
|
||||
[[nodiscard]] bool HasFlag64(uint16 index, uint64 flag) const
|
||||
{
|
||||
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
|
||||
return (GetUInt64Value(index) & flag) != 0;
|
||||
@@ -296,10 +296,10 @@ public:
|
||||
|
||||
void ClearUpdateMask(bool remove);
|
||||
|
||||
uint16 GetValuesCount() const { return m_valuesCount; }
|
||||
[[nodiscard]] uint16 GetValuesCount() const { return m_valuesCount; }
|
||||
|
||||
virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
|
||||
virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
|
||||
[[nodiscard]] virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
|
||||
[[nodiscard]] virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
|
||||
virtual void BuildUpdate(UpdateDataMapType&, UpdatePlayerSet&) {}
|
||||
void BuildFieldsUpdate(Player*, UpdateDataMapType&) const;
|
||||
|
||||
@@ -310,20 +310,20 @@ public:
|
||||
void ForceValuesUpdateAtIndex(uint32);
|
||||
|
||||
Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return nullptr; }
|
||||
Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; }
|
||||
[[nodiscard]] Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; }
|
||||
Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return nullptr; }
|
||||
Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; }
|
||||
[[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; }
|
||||
|
||||
Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return nullptr; }
|
||||
Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return nullptr; }
|
||||
[[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return nullptr; }
|
||||
GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return nullptr; }
|
||||
GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return nullptr; }
|
||||
[[nodiscard]] GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return nullptr; }
|
||||
|
||||
Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return nullptr; }
|
||||
Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; }
|
||||
[[nodiscard]] Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; }
|
||||
|
||||
DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject*>(this); else return nullptr; }
|
||||
DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
|
||||
[[nodiscard]] DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
|
||||
|
||||
DataMap CustomData;
|
||||
|
||||
@@ -333,7 +333,7 @@ protected:
|
||||
|
||||
void _InitValues();
|
||||
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
|
||||
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
|
||||
[[nodiscard]] std::string _ConcatFields(uint16 startIndex, uint16 size) const;
|
||||
void _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count);
|
||||
|
||||
uint32 GetUpdateFieldData(Player const* target, uint32*& flags) const;
|
||||
@@ -367,7 +367,7 @@ private:
|
||||
ByteBuffer m_PackGUID;
|
||||
|
||||
// for output helpfull error messages from asserts
|
||||
bool PrintIndexError(uint32 index, bool set) const;
|
||||
[[nodiscard]] bool PrintIndexError(uint32 index, bool set) const;
|
||||
Object(const Object&); // prevent generation copy constructor
|
||||
Object& operator=(Object const&); // prevent generation assigment operator
|
||||
};
|
||||
@@ -454,10 +454,10 @@ struct Position
|
||||
m_orientation = orientation;
|
||||
}
|
||||
|
||||
float GetPositionX() const { return m_positionX; }
|
||||
float GetPositionY() const { return m_positionY; }
|
||||
float GetPositionZ() const { return m_positionZ; }
|
||||
float GetOrientation() const { return m_orientation; }
|
||||
[[nodiscard]] float GetPositionX() const { return m_positionX; }
|
||||
[[nodiscard]] float GetPositionY() const { return m_positionY; }
|
||||
[[nodiscard]] float GetPositionZ() const { return m_positionZ; }
|
||||
[[nodiscard]] float GetOrientation() const { return m_orientation; }
|
||||
|
||||
void GetPosition(float& x, float& y) const
|
||||
{
|
||||
@@ -483,7 +483,7 @@ struct Position
|
||||
pos->Relocate(m_positionX, m_positionY, m_positionZ, m_orientation);
|
||||
}
|
||||
|
||||
Position GetPosition() const { return *this; }
|
||||
[[nodiscard]] Position GetPosition() const { return *this; }
|
||||
|
||||
|
||||
Position::PositionXYZStreamer PositionXYZStream()
|
||||
@@ -495,15 +495,15 @@ struct Position
|
||||
return PositionXYZOStreamer(*this);
|
||||
}
|
||||
|
||||
bool IsPositionValid() const;
|
||||
[[nodiscard]] bool IsPositionValid() const;
|
||||
|
||||
float GetExactDist2dSq(float x, float y) const
|
||||
[[nodiscard]] float GetExactDist2dSq(float x, float y) const
|
||||
{
|
||||
float dx = m_positionX - x;
|
||||
float dy = m_positionY - y;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
float GetExactDist2d(const float x, const float y) const
|
||||
[[nodiscard]] float GetExactDist2d(const float x, const float y) const
|
||||
{
|
||||
return sqrt(GetExactDist2dSq(x, y));
|
||||
}
|
||||
@@ -517,12 +517,12 @@ struct Position
|
||||
{
|
||||
return sqrt(GetExactDist2dSq(pos));
|
||||
}
|
||||
float GetExactDistSq(float x, float y, float z) const
|
||||
[[nodiscard]] float GetExactDistSq(float x, float y, float z) const
|
||||
{
|
||||
float dz = m_positionZ - z;
|
||||
return GetExactDist2dSq(x, y) + dz * dz;
|
||||
}
|
||||
float GetExactDist(float x, float y, float z) const
|
||||
[[nodiscard]] float GetExactDist(float x, float y, float z) const
|
||||
{
|
||||
return sqrt(GetExactDistSq(x, y, z));
|
||||
}
|
||||
@@ -541,15 +541,15 @@ struct Position
|
||||
void GetPositionOffsetTo(const Position& endPos, Position& retOffset) const;
|
||||
|
||||
float GetAngle(const Position* pos) const;
|
||||
float GetAngle(float x, float y) const;
|
||||
[[nodiscard]] float GetAngle(float x, float y) const;
|
||||
float GetRelativeAngle(const Position* pos) const
|
||||
{
|
||||
return GetAngle(pos) - m_orientation;
|
||||
}
|
||||
float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
|
||||
[[nodiscard]] float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
|
||||
void GetSinCos(float x, float y, float& vsin, float& vcos) const;
|
||||
|
||||
bool IsInDist2d(float x, float y, float dist) const
|
||||
[[nodiscard]] bool IsInDist2d(float x, float y, float dist) const
|
||||
{
|
||||
return GetExactDist2dSq(x, y) < dist * dist;
|
||||
}
|
||||
@@ -557,7 +557,7 @@ struct Position
|
||||
{
|
||||
return GetExactDist2dSq(pos) < dist * dist;
|
||||
}
|
||||
bool IsInDist(float x, float y, float z, float dist) const
|
||||
[[nodiscard]] bool IsInDist(float x, float y, float z, float dist) const
|
||||
{
|
||||
return GetExactDistSq(x, y, z) < dist * dist;
|
||||
}
|
||||
@@ -566,10 +566,10 @@ struct Position
|
||||
return GetExactDistSq(pos) < dist * dist;
|
||||
}
|
||||
|
||||
bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
|
||||
[[nodiscard]] bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
|
||||
bool HasInArc(float arcangle, const Position* pos, float targetRadius = 0.0f) const;
|
||||
bool HasInLine(WorldObject const* target, float width) const;
|
||||
std::string ToString() const;
|
||||
[[nodiscard]] std::string ToString() const;
|
||||
|
||||
// modulos a radian orientation to the range of 0..2PI
|
||||
static float NormalizeOrientation(float o)
|
||||
@@ -651,15 +651,15 @@ struct MovementInfo
|
||||
jump.Reset();
|
||||
}
|
||||
|
||||
uint32 GetMovementFlags() const { return flags; }
|
||||
[[nodiscard]] uint32 GetMovementFlags() const { return flags; }
|
||||
void SetMovementFlags(uint32 flag) { flags = flag; }
|
||||
void AddMovementFlag(uint32 flag) { flags |= flag; }
|
||||
void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
|
||||
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
|
||||
[[nodiscard]] bool HasMovementFlag(uint32 flag) const { return flags & flag; }
|
||||
|
||||
uint16 GetExtraMovementFlags() const { return flags2; }
|
||||
[[nodiscard]] uint16 GetExtraMovementFlags() const { return flags2; }
|
||||
void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; }
|
||||
bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; }
|
||||
[[nodiscard]] bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; }
|
||||
|
||||
void SetFallTime(uint32 time) { fallTime = time; }
|
||||
|
||||
@@ -687,12 +687,12 @@ public:
|
||||
Relocate(loc);
|
||||
}
|
||||
|
||||
uint32 GetMapId() const
|
||||
[[nodiscard]] uint32 GetMapId() const
|
||||
{
|
||||
return m_mapId;
|
||||
}
|
||||
|
||||
WorldLocation GetWorldLocation() const
|
||||
[[nodiscard]] WorldLocation GetWorldLocation() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
@@ -704,7 +704,7 @@ template<class T>
|
||||
class GridObject
|
||||
{
|
||||
public:
|
||||
bool IsInGrid() const { return _gridRef.isValid(); }
|
||||
[[nodiscard]] bool IsInGrid() const { return _gridRef.isValid(); }
|
||||
void AddToGrid(GridRefManager<T>& m) { ASSERT(!IsInGrid()); _gridRef.link(&m, (T*)this); }
|
||||
void RemoveFromGrid() { ASSERT(IsInGrid()); _gridRef.unlink(); }
|
||||
private:
|
||||
@@ -721,12 +721,12 @@ public:
|
||||
m_flags = 0;
|
||||
}
|
||||
|
||||
T_FLAGS GetFlags() const { return m_flags; }
|
||||
bool HasFlag(FLAG_TYPE flag) const { return m_flags & (1 << flag); }
|
||||
[[nodiscard]] T_FLAGS GetFlags() const { return m_flags; }
|
||||
[[nodiscard]] bool HasFlag(FLAG_TYPE flag) const { return m_flags & (1 << flag); }
|
||||
void AddFlag(FLAG_TYPE flag) { m_flags |= (1 << flag); }
|
||||
void DelFlag(FLAG_TYPE flag) { m_flags &= ~(1 << flag); }
|
||||
|
||||
T_VALUES GetValue(FLAG_TYPE flag) const { return m_values[flag]; }
|
||||
[[nodiscard]] T_VALUES GetValue(FLAG_TYPE flag) const { return m_values[flag]; }
|
||||
void SetValue(FLAG_TYPE flag, T_VALUES value) { m_values[flag] = value; }
|
||||
void AddValue(FLAG_TYPE flag, T_VALUES value) { m_values[flag] += value; }
|
||||
|
||||
@@ -752,7 +752,7 @@ protected:
|
||||
MovableMapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) {}
|
||||
|
||||
private:
|
||||
Cell const& GetCurrentCell() const { return _currentCell; }
|
||||
[[nodiscard]] Cell const& GetCurrentCell() const { return _currentCell; }
|
||||
void SetCurrentCell(Cell const& cell) { _currentCell = cell; }
|
||||
|
||||
Cell _currentCell;
|
||||
@@ -818,12 +818,12 @@ public:
|
||||
void GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
|
||||
void GetChargeContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
|
||||
|
||||
float GetObjectSize() const
|
||||
[[nodiscard]] float GetObjectSize() const
|
||||
{
|
||||
return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE;
|
||||
}
|
||||
|
||||
virtual float GetCombatReach() const { return 0.0f; } // overridden (only) in Unit
|
||||
[[nodiscard]] virtual float GetCombatReach() const { return 0.0f; } // overridden (only) in Unit
|
||||
void UpdateGroundPositionZ(float x, float y, float& z) const;
|
||||
void UpdateAllowedPositionZ(float x, float y, float& z) const;
|
||||
|
||||
@@ -835,35 +835,35 @@ public:
|
||||
pos.Relocate(x, y, z, GetOrientation());
|
||||
}
|
||||
|
||||
uint32 GetInstanceId() const { return m_InstanceId; }
|
||||
[[nodiscard]] uint32 GetInstanceId() const { return m_InstanceId; }
|
||||
|
||||
virtual void SetPhaseMask(uint32 newPhaseMask, bool update);
|
||||
uint32 GetPhaseMask() const { return m_phaseMask; }
|
||||
[[nodiscard]] uint32 GetPhaseMask() const { return m_phaseMask; }
|
||||
bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); }
|
||||
bool InSamePhase(uint32 phasemask) const { return m_useCombinedPhases ? GetPhaseMask() & phasemask : GetPhaseMask() == phasemask; }
|
||||
[[nodiscard]] bool InSamePhase(uint32 phasemask) const { return m_useCombinedPhases ? GetPhaseMask() & phasemask : GetPhaseMask() == phasemask; }
|
||||
|
||||
virtual uint32 GetZoneId(bool forceRecalc = false) const;
|
||||
virtual uint32 GetAreaId(bool forceRecalc = false) const;
|
||||
[[nodiscard]] virtual uint32 GetZoneId(bool forceRecalc = false) const;
|
||||
[[nodiscard]] virtual uint32 GetAreaId(bool forceRecalc = false) const;
|
||||
virtual void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const;
|
||||
|
||||
InstanceScript* GetInstanceScript();
|
||||
|
||||
std::string const& GetName() const { return m_name; }
|
||||
[[nodiscard]] std::string const& GetName() const { return m_name; }
|
||||
void SetName(std::string const& newname) { m_name = newname; }
|
||||
|
||||
virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
|
||||
[[nodiscard]] virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
|
||||
|
||||
float GetDistance(const WorldObject* obj) const
|
||||
{
|
||||
float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
float GetDistance(const Position& pos) const
|
||||
[[nodiscard]] float GetDistance(const Position& pos) const
|
||||
{
|
||||
float d = GetExactDist(&pos) - GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
float GetDistance(float x, float y, float z) const
|
||||
[[nodiscard]] float GetDistance(float x, float y, float z) const
|
||||
{
|
||||
float d = GetExactDist(x, y, z) - GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
@@ -873,7 +873,7 @@ public:
|
||||
float d = GetExactDist2d(obj) - GetObjectSize() - obj->GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
float GetDistance2d(float x, float y) const
|
||||
[[nodiscard]] float GetDistance2d(float x, float y) const
|
||||
{
|
||||
float d = GetExactDist2d(x, y) - GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
@@ -892,11 +892,11 @@ public:
|
||||
return IsInWorld() && obj->IsInWorld() && (FindMap() == obj->FindMap());
|
||||
return false;
|
||||
}
|
||||
bool IsWithinDist3d(float x, float y, float z, float dist) const
|
||||
[[nodiscard]] bool IsWithinDist3d(float x, float y, float z, float dist) const
|
||||
{ return IsInDist(x, y, z, dist + GetObjectSize()); }
|
||||
bool IsWithinDist3d(const Position* pos, float dist) const
|
||||
{ return IsInDist(pos, dist + GetObjectSize()); }
|
||||
bool IsWithinDist2d(float x, float y, float dist) const
|
||||
[[nodiscard]] bool IsWithinDist2d(float x, float y, float dist) const
|
||||
{ return IsInDist2d(x, y, dist + GetObjectSize()); }
|
||||
bool IsWithinDist2d(const Position* pos, float dist) const
|
||||
{ return IsInDist2d(pos, dist + GetObjectSize()); }
|
||||
@@ -909,14 +909,14 @@ public:
|
||||
{
|
||||
return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
|
||||
}
|
||||
bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
|
||||
[[nodiscard]] bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
|
||||
bool IsWithinLOSInMap(WorldObject const* obj, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
|
||||
Position GetHitSpherePointFor(Position const& dest) const;
|
||||
[[nodiscard]] Position GetHitSpherePointFor(Position const& dest) const;
|
||||
void GetHitSpherePointFor(Position const& dest, float& x, float& y, float& z) const;
|
||||
bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) const;
|
||||
bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
|
||||
bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
|
||||
bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
|
||||
[[nodiscard]] bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
|
||||
[[nodiscard]] bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
|
||||
bool isInFront(WorldObject const* target, float arc = M_PI) const;
|
||||
bool isInBack(WorldObject const* target, float arc = M_PI) const;
|
||||
|
||||
@@ -948,8 +948,8 @@ public:
|
||||
virtual void SaveRespawnTime() {}
|
||||
void AddObjectToRemoveList();
|
||||
|
||||
float GetGridActivationRange() const;
|
||||
float GetVisibilityRange() const;
|
||||
[[nodiscard]] float GetGridActivationRange() const;
|
||||
[[nodiscard]] float GetVisibilityRange() const;
|
||||
float GetSightRange(const WorldObject* target = nullptr) const;
|
||||
//bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const;
|
||||
bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false, bool checkAlert = false) const;
|
||||
@@ -969,15 +969,15 @@ public:
|
||||
|
||||
virtual void SetMap(Map* map);
|
||||
virtual void ResetMap();
|
||||
Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }
|
||||
Map* FindMap() const { return m_currMap; }
|
||||
[[nodiscard]] Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }
|
||||
[[nodiscard]] Map* FindMap() const { return m_currMap; }
|
||||
//used to check all object's GetMap() calls when object is not in world!
|
||||
|
||||
//this function should be removed in nearest time...
|
||||
Map const* GetBaseMap() const;
|
||||
[[nodiscard]] Map const* GetBaseMap() const;
|
||||
|
||||
void SetZoneScript();
|
||||
ZoneScript* GetZoneScript() const { return m_zoneScript; }
|
||||
[[nodiscard]] ZoneScript* GetZoneScript() const { return m_zoneScript; }
|
||||
|
||||
TempSummon* SummonCreature(uint32 id, const Position& pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0, SummonPropertiesEntry const* properties = nullptr) const;
|
||||
TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, SummonPropertiesEntry const* properties = nullptr)
|
||||
@@ -995,11 +995,11 @@ public:
|
||||
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel = false, CreatureAI * (*GetAI)(Creature*) = nullptr);
|
||||
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
|
||||
|
||||
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
|
||||
GameObject* FindNearestGameObject(uint32 entry, float range) const;
|
||||
GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
|
||||
[[nodiscard]] Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
|
||||
[[nodiscard]] GameObject* FindNearestGameObject(uint32 entry, float range) const;
|
||||
[[nodiscard]] GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
|
||||
|
||||
Player* SelectNearestPlayer(float distance = 0) const;
|
||||
[[nodiscard]] Player* SelectNearestPlayer(float distance = 0) const;
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||
|
||||
@@ -1011,25 +1011,25 @@ public:
|
||||
//relocation and visibility system functions
|
||||
void AddToNotify(uint16 f);
|
||||
void RemoveFromNotify(uint16 f) { m_notifyflags &= ~f; }
|
||||
bool isNeedNotify(uint16 f) const { return m_notifyflags & f;}
|
||||
uint16 GetNotifyFlags() const { return m_notifyflags; }
|
||||
bool NotifyExecuted(uint16 f) const { return m_executed_notifies & f;}
|
||||
[[nodiscard]] bool isNeedNotify(uint16 f) const { return m_notifyflags & f;}
|
||||
[[nodiscard]] uint16 GetNotifyFlags() const { return m_notifyflags; }
|
||||
[[nodiscard]] bool NotifyExecuted(uint16 f) const { return m_executed_notifies & f;}
|
||||
void SetNotified(uint16 f) { m_executed_notifies |= f;}
|
||||
void ResetAllNotifies() { m_notifyflags = 0; m_executed_notifies = 0; }
|
||||
|
||||
bool isActiveObject() const { return m_isActive; }
|
||||
[[nodiscard]] bool isActiveObject() const { return m_isActive; }
|
||||
void setActive(bool isActiveObject);
|
||||
bool IsVisibilityOverridden() const { return m_isVisibilityDistanceOverride; }
|
||||
[[nodiscard]] bool IsVisibilityOverridden() const { return m_isVisibilityDistanceOverride; }
|
||||
void SetVisibilityDistanceOverride(bool isVisibilityDistanceOverride);
|
||||
void SetWorldObject(bool apply);
|
||||
bool IsPermanentWorldObject() const { return m_isWorldObject; }
|
||||
bool IsWorldObject() const;
|
||||
[[nodiscard]] bool IsPermanentWorldObject() const { return m_isWorldObject; }
|
||||
[[nodiscard]] bool IsWorldObject() const;
|
||||
|
||||
template<class NOTIFIER> void VisitNearbyObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); }
|
||||
template<class NOTIFIER> void VisitNearbyGridObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); }
|
||||
template<class NOTIFIER> void VisitNearbyWorldObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); }
|
||||
|
||||
bool IsInWintergrasp() const
|
||||
[[nodiscard]] bool IsInWintergrasp() const
|
||||
{
|
||||
return GetMapId() == 571 && GetPositionX() > 3733.33331f && GetPositionX() < 5866.66663f && GetPositionY() > 1599.99999f && GetPositionY() < 4799.99997f;
|
||||
}
|
||||
@@ -1045,22 +1045,22 @@ public:
|
||||
uint32 LastUsedScriptID;
|
||||
|
||||
// Transports
|
||||
Transport* GetTransport() const { return m_transport; }
|
||||
float GetTransOffsetX() const { return m_movementInfo.transport.pos.GetPositionX(); }
|
||||
float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); }
|
||||
float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); }
|
||||
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;
|
||||
[[nodiscard]] Transport* GetTransport() const { return m_transport; }
|
||||
[[nodiscard]] float GetTransOffsetX() const { return m_movementInfo.transport.pos.GetPositionX(); }
|
||||
[[nodiscard]] float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); }
|
||||
[[nodiscard]] float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); }
|
||||
[[nodiscard]] float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
|
||||
[[nodiscard]] uint32 GetTransTime() const { return m_movementInfo.transport.time; }
|
||||
[[nodiscard]] int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
|
||||
[[nodiscard]] virtual uint64 GetTransGUID() const;
|
||||
void SetTransport(Transport* t) { m_transport = t; }
|
||||
|
||||
MovementInfo m_movementInfo;
|
||||
|
||||
virtual float GetStationaryX() const { return GetPositionX(); }
|
||||
virtual float GetStationaryY() const { return GetPositionY(); }
|
||||
virtual float GetStationaryZ() const { return GetPositionZ(); }
|
||||
virtual float GetStationaryO() const { return GetOrientation(); }
|
||||
[[nodiscard]] virtual float GetStationaryX() const { return GetPositionX(); }
|
||||
[[nodiscard]] virtual float GetStationaryY() const { return GetPositionY(); }
|
||||
[[nodiscard]] virtual float GetStationaryZ() const { return GetPositionZ(); }
|
||||
[[nodiscard]] virtual float GetStationaryO() const { return GetOrientation(); }
|
||||
|
||||
protected:
|
||||
std::string m_name;
|
||||
@@ -1078,9 +1078,9 @@ protected:
|
||||
void SetLocationMapId(uint32 _mapId) { m_mapId = _mapId; }
|
||||
void SetLocationInstanceId(uint32 _instanceId) { m_InstanceId = _instanceId; }
|
||||
|
||||
virtual bool IsNeverVisible() const { return !IsInWorld(); }
|
||||
[[nodiscard]] virtual bool IsNeverVisible() const { return !IsInWorld(); }
|
||||
virtual bool IsAlwaysVisibleFor(WorldObject const* /*seer*/) const { return false; }
|
||||
virtual bool IsInvisibleDueToDespawn() const { return false; }
|
||||
[[nodiscard]] virtual bool IsInvisibleDueToDespawn() const { return false; }
|
||||
//difference from IsAlwaysVisibleFor: 1. after distance check; 2. use owner or charmer as seer
|
||||
virtual bool IsAlwaysDetectableFor(WorldObject const* /*seer*/) const { return false; }
|
||||
private:
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
void AddUpdateBlock(const ByteBuffer& block);
|
||||
void AddUpdateBlock(const UpdateData& block);
|
||||
bool BuildPacket(WorldPacket* packet);
|
||||
bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
|
||||
[[nodiscard]] bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
|
||||
void Clear();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
void SetBit(uint32 index) { _bits[index] = 1; }
|
||||
void UnsetBit(uint32 index) { _bits[index] = 0; }
|
||||
bool GetBit(uint32 index) const { return _bits[index] != 0; }
|
||||
[[nodiscard]] bool GetBit(uint32 index) const { return _bits[index] != 0; }
|
||||
|
||||
void AppendToPacket(ByteBuffer* data)
|
||||
{
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetBlockCount() const { return _blockCount; }
|
||||
uint32 GetCount() const { return _fieldCount; }
|
||||
[[nodiscard]] uint32 GetBlockCount() const { return _blockCount; }
|
||||
[[nodiscard]] uint32 GetCount() const { return _fieldCount; }
|
||||
|
||||
void SetCount(uint32 valuesCount)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -71,7 +71,7 @@ struct VehicleSeat
|
||||
Passenger.Reset();
|
||||
}
|
||||
|
||||
bool IsEmpty() const { return !Passenger.Guid; }
|
||||
[[nodiscard]] bool IsEmpty() const { return !Passenger.Guid; }
|
||||
|
||||
VehicleSeatEntry const* SeatInfo;
|
||||
PassengerInfo Passenger;
|
||||
|
||||
Reference in New Issue
Block a user