Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-12-31 17:18:40 +08:00
102 changed files with 2247 additions and 409 deletions

View File

@@ -274,6 +274,11 @@ void TempSummon::InitSummon()
}
}
void TempSummon::UpdateObjectVisibilityOnCreate()
{
WorldObject::UpdateObjectVisibility(true);
}
void TempSummon::SetTempSummonType(TempSummonType type)
{
m_type = type;

View File

@@ -45,6 +45,7 @@ public:
virtual void InitStats(uint32 lifetime);
virtual void InitSummon();
virtual void UnSummon(uint32 msTime = 0);
void UpdateObjectVisibilityOnCreate() override;
void RemoveFromWorld() override;
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override {}

View File

@@ -2274,7 +2274,9 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
summon->InitSummon();
//ObjectAccessor::UpdateObjectVisibility(summon);
// call MoveInLineOfSight for nearby creatures
Acore::AIRelocationNotifier notifier(*summon);
Cell::VisitAllObjects(summon, notifier, GetVisibilityRange());
return summon;
}

View File

@@ -558,6 +558,7 @@ public:
void DestroyForNearbyPlayers();
virtual void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false);
virtual void UpdateObjectVisibilityOnCreate() { UpdateObjectVisibility(true); }
void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& player_set) override;
void GetCreaturesWithEntryInRange(std::list<Creature*>& creatureList, float radius, uint32 entry);

View File

@@ -1362,11 +1362,11 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
}
case NPC_ARMY_OF_THE_DEAD:
{
AddAura(SPELL_HUNTER_PET_SCALING_04, this);
AddAura(SPELL_DK_PET_SCALING_01, this);
AddAura(SPELL_DK_ARMY_OF_THE_DEAD_PASSIVE, this);
AddAura(SPELL_DK_PET_SCALING_02, this);
AddAura(SPELL_DK_PET_SCALING_03, this);
AddAura(SPELL_PET_AVOIDANCE, this);
AddAura(SPELL_DK_AVOIDANCE, this);
AddAura(SPELL_PET_SCALING_MASTER_06, this);
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));

View File

@@ -134,7 +134,9 @@ enum NPCEntries
enum PetScalingSpells
{
SPELL_PET_AVOIDANCE = 32233,
SPELL_PET_SCALING_MASTER_06 = 67561, // Serverside - Pet Scaling - Master Spell 06 - Spell Hit, Expertise, Spell Penetration
// Hunter
SPELL_HUNTER_PET_SCALING_01 = 34902,
SPELL_HUNTER_PET_SCALING_02 = 34903,
SPELL_HUNTER_PET_SCALING_03 = 34904,
@@ -190,9 +192,11 @@ enum PetScalingSpells
// Death Knight
SPELL_ORC_RACIAL_COMMAND_DK = 65221,
SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE = 62137,
SPELL_DK_PET_SCALING_01 = 51996,
SPELL_DK_PET_SCALING_02 = 54566,
SPELL_DK_PET_SCALING_03 = 61697
SPELL_DK_PET_SCALING_01 = 54566,
SPELL_DK_PET_SCALING_02 = 51996,
SPELL_DK_PET_SCALING_03 = 61697,
SPELL_DK_AVOIDANCE = 65220,
SPELL_DK_ARMY_OF_THE_DEAD_PASSIVE = 49040,
};
#define PET_FOLLOW_DIST 1.0f

View File

@@ -2419,7 +2419,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
// Favored experience increase START
uint32 zone = GetZoneId();
float favored_exp_mult = 0;
if ((zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) && (HasAura(32096) || HasAura(32098)))
if ((zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) && HasAnyAuras(32096 /*Thrallmar's Favor*/, 32098 /*Honor Hold's Favor*/))
favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor
xp = uint32(xp * (1 + favored_exp_mult));

View File

@@ -444,7 +444,7 @@ struct Runes
struct EnchantDuration
{
EnchantDuration() = default;;
EnchantDuration() = default;
EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
leftduration(_leftduration) { ASSERT(item); };

View File

@@ -38,7 +38,7 @@ void Player::_LoadCharacterSettings(PreparedQueryResult result)
{
Field* fields = result->Fetch();
std::string source = fields[0].Get<std::string>();;
std::string source = fields[0].Get<std::string>();
std::string data = fields[1].Get<std::string>();
std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);

View File

@@ -6723,7 +6723,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
{
GetSession()->SendAreaTriggerMessage("%s", GetSession()->GetAcoreString(LANG_INSTANCE_CLOSED));
GetSession()->SendAreaTriggerMessage("{}", GetSession()->GetAcoreString(LANG_INSTANCE_CLOSED));
return false;
}

View File

@@ -5695,6 +5695,29 @@ uint32 Unit::GetAuraCount(uint32 spellId) const
return count;
}
bool Unit::HasAuras(SearchMethod sm, std::vector<uint32>& spellIds) const
{
if (sm == SearchMethod::MatchAll)
{
for (auto const& spellId : spellIds)
if (!HasAura(spellId))
return false;
return true;
}
else if (sm == SearchMethod::MatchAny)
{
for (auto const& spellId : spellIds)
if (HasAura(spellId))
return true;
return false;
}
else
{
LOG_ERROR("entities.unit", "Unit::HasAuras using non-supported SearchMethod {}", sm);
return false;
}
}
bool Unit::HasAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
@@ -21307,7 +21330,7 @@ bool Unit::IsInDisallowedMountForm() const
return true;
}
if (!(shapeshift->flags1 & 0x1))
if (!(shapeshift->flags1 & SHAPESHIFT_FLAG_STANCE))
{
return true;
}

View File

@@ -558,6 +558,12 @@ enum CommandStates : uint8
COMMAND_ABANDON = 3
};
enum class SearchMethod
{
MatchAll,
MatchAny
};
typedef std::list<Player*> SharedVisionList;
struct AttackPosition {
@@ -1367,6 +1373,50 @@ public:
[[nodiscard]] bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const;
[[nodiscard]] uint32 GetAuraCount(uint32 spellId) const;
/**
* @brief Check if unit has ANY or ALL specified auras.
*
* @param sm The search method to use
* - SearchMethod::MatchAll : The function checks for all of the spell id's on the unit.
* - SearchMethod::MatchAny : The function checks for any of the spell id's on the unit.
*
* @param spellIds List of spell id's to check for on the unit.
*
* @return Returns true if the search method condition is met. Otherwise false.
*/
bool HasAuras(SearchMethod sm, std::vector<uint32>& spellIds) const;
/**
* @brief Checks if the unit has ANY specified auras.
*
* @tparam Auras Can be any type convertible to uint32.
* @param spellIds List of spell id's to check for on the unit.
*
* @return Returns true if the unit has ANY of the specified auras. Otherwise false.
*/
template <typename... Auras>
bool HasAnyAuras(Auras... spellIds) const
{
std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
return HasAuras(SearchMethod::MatchAny, spellList);
}
/**
* @brief Checks if the unit has ALL specified auras.
*
* @tparam Auras Can be any type convertible to uint32.
* @param spellIds List of spell id's to check for on the unit.
*
* @return Returns true if the unit has ALL of the specified auras. Otherwise false.
*/
template <typename... Auras>
bool HasAllAuras(Auras... spellIds) const
{
std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
return HasAuras(SearchMethod::MatchAll, spellList);
}
[[nodiscard]] bool HasAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const;
[[nodiscard]] bool HasAuraType(AuraType auraType) const;
[[nodiscard]] bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const;

View File

@@ -99,6 +99,27 @@ enum ShapeshiftForm
FORM_SPIRITOFREDEMPTION = 0x20
};
enum ShapeshiftFlags
{
SHAPESHIFT_FLAG_STANCE = 0x00000001, // Form allows various player activities, which normally cause "You can't X while shapeshifted." errors (npc/go interaction, item use, etc)
SHAPESHIFT_FLAG_NOT_TOGGLEABLE = 0x00000002, // NYI
SHAPESHIFT_FLAG_PERSIST_ON_DEATH = 0x00000004, // NYI
SHAPESHIFT_FLAG_CAN_NPC_INTERACT = 0x00000008, // Form unconditionally allows talking to NPCs while shapeshifted (even if other activities are disabled)
SHAPESHIFT_FLAG_DONT_USE_WEAPON = 0x00000010, // NYI
SHAPESHIFT_FLAG_AGILITY_ATTACK_BONUS = 0x00000020, // Druid Cat form
SHAPESHIFT_FLAG_CAN_USE_EQUIPPED_ITEMS = 0x00000040, // NYI
SHAPESHIFT_FLAG_CAN_USE_ITEMS = 0x00000080, // NYI
SHAPESHIFT_FLAG_DONT_AUTO_UNSHIFT = 0x00000100, // Handled at client side
SHAPESHIFT_FLAG_CONSIDERED_DEAD = 0x00000200, // NYI
SHAPESHIFT_FLAG_CAN_ONLY_CAST_SHAPESHIFT_SPELLS = 0x00000400, // NYI
SHAPESHIFT_FLAG_STANCE_CANCEL_AT_FLIGHTMASTER = 0x00000800, // NYI
SHAPESHIFT_FLAG_NO_EMOTE_SOUNDS = 0x00001000, // NYI
SHAPESHIFT_FLAG_NO_TRIGGER_TELEPORT = 0x00002000, // NYI
SHAPESHIFT_FLAG_CANNOT_CHANGE_EQUIPPED_ITEMS = 0x00004000, // NYI
SHAPESHIFT_FLAG_RESUMMON_PETS_ON_UNSHIFT = 0x00008000, // NYI
SHAPESHIFT_FLAG_CANNOT_USE_GAME_OBJECTS = 0x00010000, // NYI
};
// low byte (0 from 0..3) of UNIT_FIELD_BYTES_2
enum SheathState
{