mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 07:36:23 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
@@ -654,8 +654,12 @@ void ThreatMgr::ResetAllThreat()
|
||||
if (threatList.empty())
|
||||
return;
|
||||
|
||||
for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
(*itr)->SetThreat(0);
|
||||
for (HostileReference* ref : threatList)
|
||||
{
|
||||
// Reset temp threat before setting threat back to 0.
|
||||
ref->resetTempThreat();
|
||||
ref->SetThreat(0.f);
|
||||
}
|
||||
|
||||
setDirty(true);
|
||||
}
|
||||
|
||||
@@ -1670,8 +1670,8 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
|
||||
// xinef: fix from db
|
||||
if ((addToMap || gridLoad) && !data->overwrittenZ)
|
||||
{
|
||||
float tz = map->GetHeight(data->posX, data->posY, data->posZ + 1.0f, true);
|
||||
if (tz >= data->posZ && tz - data->posZ <= 1.0f)
|
||||
float tz = map->GetHeight(data->posX, data->posY, data->posZ + 0.42f, true);
|
||||
if (tz >= data->posZ && tz - data->posZ <= 0.42f)
|
||||
const_cast<CreatureData*>(data)->posZ = tz + 0.1f;
|
||||
|
||||
const_cast<CreatureData*>(data)->overwrittenZ = true;
|
||||
|
||||
@@ -369,6 +369,14 @@ void ScriptMgr::OnPlayerLoadFromDB(Player* player)
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforePlayerLogout(Player* player)
|
||||
{
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
script->OnBeforeLogout(player);
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerLogout(Player* player)
|
||||
{
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
|
||||
@@ -133,6 +133,9 @@ public:
|
||||
// Called when a player logs in.
|
||||
virtual void OnLogin(Player* /*player*/) { }
|
||||
|
||||
// Called before the player is logged out
|
||||
virtual void OnBeforeLogout(Player* /*player*/) { }
|
||||
|
||||
// Called when a player logs out.
|
||||
virtual void OnLogout(Player* /*player*/) { }
|
||||
|
||||
|
||||
@@ -362,6 +362,7 @@ public: /* PlayerScript */
|
||||
void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck);
|
||||
void OnPlayerLogin(Player* player);
|
||||
void OnPlayerLoadFromDB(Player* player);
|
||||
void OnBeforePlayerLogout(Player* player);
|
||||
void OnPlayerLogout(Player* player);
|
||||
void OnPlayerCreate(Player* player);
|
||||
void OnPlayerSave(Player* player);
|
||||
|
||||
@@ -601,6 +601,9 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
|
||||
if (_player)
|
||||
{
|
||||
//! Call script hook before other logout events
|
||||
sScriptMgr->OnBeforePlayerLogout(_player);
|
||||
|
||||
if (ObjectGuid lguid = _player->GetLootGUID())
|
||||
DoLootRelease(lguid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user