Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-07-21 09:06:44 -06:00
committed by GitHub
79 changed files with 3887 additions and 3815 deletions

View File

@@ -1020,7 +1020,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
// Xinef: called in add to world
//Motion_Initialize();
i_AI = ai ? ai : FactorySelector::selectAI(this);
i_AI = ai ? ai : FactorySelector::SelectAI(this);
delete oldAI;
IsAIEnabled = true;
i_AI->InitializeAI();
@@ -2861,7 +2861,7 @@ uint8 Creature::getLevelForTarget(WorldObject const* target) const
return uint8(level);
}
std::string Creature::GetAIName() const
std::string const& Creature::GetAIName() const
{
return sObjectMgr->GetCreatureTemplate(GetEntry())->AIName;
}

View File

@@ -198,7 +198,7 @@ public:
void SetDetectionDistance(float dist){ m_detectionDistance = dist; }
[[nodiscard]] CreatureAddon const* GetCreatureAddon() const;
[[nodiscard]] std::string GetAIName() const;
[[nodiscard]] std::string const& GetAIName() const;
[[nodiscard]] std::string GetScriptName() const;
[[nodiscard]] uint32 GetScriptId() const;

View File

@@ -96,7 +96,7 @@ bool GameObject::AIM_Initialize()
return true;
}
std::string GameObject::GetAIName() const
std::string const& GameObject::GetAIName() const
{
return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
}

View File

@@ -1001,7 +1001,7 @@ public:
[[nodiscard]] virtual uint32 GetScriptId() const;
[[nodiscard]] GameObjectAI* AI() const { return m_AI; }
[[nodiscard]] std::string GetAIName() const;
[[nodiscard]] std::string const& GetAIName() const;
void SetDisplayId(uint32 displayid);
[[nodiscard]] uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }

View File

@@ -12573,8 +12573,13 @@ void Player::SetMover(Unit* target)
LOG_INFO("misc", "Player::SetMover (B2) - {}, {}, {}, {}, {}, {}, {}, {}", target->GetGUID().ToString(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0);
}
m_mover->m_movedByPlayer = nullptr;
if (m_mover->GetTypeId() == TYPEID_UNIT)
m_mover->GetMotionMaster()->Initialize();
m_mover = target;
m_mover->m_movedByPlayer = this;
if (m_mover->GetTypeId() == TYPEID_UNIT)
m_mover->GetMotionMaster()->Initialize();
}
uint32 Player::GetCorpseReclaimDelay(bool pvp) const

View File

@@ -108,12 +108,11 @@ void Player::_SavePlayerSettings(CharacterDatabaseTransaction trans)
void Player::UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
{
auto itr = m_charSettingsMap.find(source);
uint8 size = index + 1;
if (itr == m_charSettingsMap.end())
{
// Settings not found, initialize a new entry.
uint8 size = index ? index : index + 1;
PlayerSettingVector setting;
setting.resize(size);
@@ -129,6 +128,10 @@ void Player::UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
}
else
{
if (size > itr->second.size())
{
itr->second.resize(size);
}
itr->second[index].value = value;
}
}