Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2025-01-15 20:49:11 +08:00
45 changed files with 1025 additions and 84 deletions
@@ -2334,6 +2334,12 @@ void Player::ProcessSpellQueue()
{
PendingSpellCastRequest& request = SpellQueue.front(); // Peek at the first spell
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(request.spellId);
if (!spellInfo)
{
LOG_ERROR("entities.player", "Player::ProcessSpellQueue: Invalid spell {}", request.spellId);
SpellQueue.clear();
break;
}
if (CanExecutePendingSpellCastRequest(spellInfo))
{
ExecuteOrCancelSpellCastRequest(&request);
-2
View File
@@ -9673,8 +9673,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
}
// Cast positive spell on enemy target
case 7099: // Curse of Mending
case 39703: // Curse of Mending
case 20233: // Improved Lay on Hands (cast on target)
{
target = victim;
@@ -184,6 +184,9 @@ public:
//Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player* /*player*/) {}
//Called when a player successfully leaves the instance.
virtual void OnPlayerLeave(Player* /*player*/) {}
virtual void OnPlayerAreaUpdate(Player* /*player*/, uint32 /*oldArea*/, uint32 /*newArea*/) {}
//Called when a player enters/leaves water bodies.
+2
View File
@@ -3046,6 +3046,8 @@ void InstanceMap::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread
void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
{
if (instance_data)
instance_data->OnPlayerLeave(player);
// pussywizard: moved m_unloadTimer to InstanceMap::AfterPlayerUnlinkFromMap(), in this function if 2 players run out at the same time the instance won't close
//if (!m_unloadTimer && m_mapRefMgr.getSize() == 1)
// m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
+4 -1
View File
@@ -1145,7 +1145,10 @@ enum AcoreStrings
LANG_CMD_GO_RESPAWN = 5085,
// Room for more strings 5086-9999
LANG_CMD_NO_DOOR_FOUND = 5086,
LANG_CMD_DOOR_OPENED = 5087,
// Room for more strings 5088-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,
+14 -14
View File
@@ -2892,27 +2892,27 @@ void World::UpdateRealmCharCount(uint32 accountId)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_COUNT);
stmt->SetData(0, accountId);
_queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&World::_UpdateRealmCharCount, this, std::placeholders::_1)));
_queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&World::_UpdateRealmCharCount, this, std::placeholders::_1,accountId)));
}
void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount)
void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount,uint32 accountId)
{
uint8 charCount{0};
if (resultCharCount)
{
Field* fields = resultCharCount->Fetch();
uint32 accountId = fields[0].Get<uint32>();
uint8 charCount = uint8(fields[1].Get<uint64>());
LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_REALM_CHARACTERS);
stmt->SetData(0, charCount);
stmt->SetData(1, accountId);
stmt->SetData(2, realm.Id.Realm);
trans->Append(stmt);
LoginDatabase.CommitTransaction(trans);
charCount = uint8(fields[1].Get<uint64>());
}
LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_REALM_CHARACTERS);
stmt->SetData(0, charCount);
stmt->SetData(1, accountId);
stmt->SetData(2, realm.Id.Realm);
trans->Append(stmt);
LoginDatabase.CommitTransaction(trans);
}
void World::InitWeeklyQuestResetTime()
+1 -1
View File
@@ -350,7 +350,7 @@ public:
protected:
void _UpdateGameTime();
// callback for UpdateRealmCharacters
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount);
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount,uint32 accountId);
void InitDailyQuestResetTime();
void InitWeeklyQuestResetTime();