try fix garr ui
This commit is contained in:
@@ -720,6 +720,10 @@ void BGScriptBase::EngageTarget(::Player* bot, ::Unit* target)
|
||||
if (!bot || !target || !bot->IsInWorld() || !target->IsAlive())
|
||||
return;
|
||||
|
||||
// Additional safety check to prevent spell crashes
|
||||
if (!bot->IsValidAttackTarget(target))
|
||||
return;
|
||||
|
||||
bot->SetSelection(target->GetGUID());
|
||||
if (!bot->IsInCombat() || bot->GetVictim() != target)
|
||||
bot->Attack(target, true);
|
||||
|
||||
@@ -379,20 +379,21 @@ void BattlegroundAI::FallbackBehavior(::Player* player)
|
||||
if (player->GetVictim())
|
||||
return;
|
||||
|
||||
// Try to find a nearby enemy player
|
||||
if (Player* enemy = player->SelectNearestPlayer(30.0f))
|
||||
{
|
||||
// Additional safety checks
|
||||
if (enemy->IsInWorld() && enemy->IsAlive() && !enemy->IsGameMaster() &&
|
||||
player->IsHostileTo(enemy) && player->IsValidAttackTarget(enemy))
|
||||
{
|
||||
if (player->AI())
|
||||
{
|
||||
player->AI()->AttackStart(enemy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// For now, just move randomly to avoid looking frozen
|
||||
// TODO: Re-enable attacking once spell crash is resolved
|
||||
// if (Player* enemy = player->SelectNearestPlayer(30.0f))
|
||||
// {
|
||||
// // Additional safety checks
|
||||
// if (enemy->IsInWorld() && enemy->IsAlive() && !enemy->IsGameMaster() &&
|
||||
// player->IsHostileTo(enemy) && player->IsValidAttackTarget(enemy))
|
||||
// {
|
||||
// if (player->AI())
|
||||
// {
|
||||
// player->AI()->AttackStart(enemy);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// No enemies nearby - just wander a bit to avoid looking frozen
|
||||
BotMovementUtil::MoveRandomAround(player, 10.0f);
|
||||
|
||||
@@ -192,17 +192,34 @@ void WorldSession::HandleOpenMissionNpc(WorldPackets::Garrison::OpenMissionNpc&
|
||||
if (!garrison)
|
||||
return;
|
||||
|
||||
// Send expired mission cleanup results for all garrison types
|
||||
for (auto const& [type, garr] : _player->GetGarrisons())
|
||||
garr->SendDeleteExpiredMissionsResult();
|
||||
garr->SendTroopQualityRefresh();
|
||||
|
||||
WorldPackets::Garrison::GetGarrisonInfoResult garrisonInfo;
|
||||
garrisonInfo.FactionIndex = Garrison::GetFaction(_player->GetTeam());
|
||||
|
||||
for (auto const& [type, garr] : _player->GetGarrisons())
|
||||
garrison->BuildInfoPacket(garrisonInfo.Garrisons.emplace_back());
|
||||
|
||||
garrisonInfo.FollowerSoftCaps = {
|
||||
{ FOLLOWER_TYPE_GARRISON, 20 },
|
||||
{ FOLLOWER_TYPE_SHIPYARD, 6 },
|
||||
{ FOLLOWER_TYPE_CLASS_ORDER, 6 },
|
||||
{ FOLLOWER_TYPE_WAR_CAMPAIGN, 30 },
|
||||
{ FOLLOWER_TYPE_COVENANT, 100 }
|
||||
};
|
||||
|
||||
SendPacket(garrisonInfo.Write());
|
||||
|
||||
for (auto const& [type, garr] : _player->GetGarrisons())
|
||||
{
|
||||
garr->SendDeleteExpiredMissionsResult();
|
||||
garr->SendMissionStartConditionUpdate();
|
||||
}
|
||||
|
||||
// Remove expired offers (sends GarrisonDeleteMissionResult per expired mission)
|
||||
// and generate new missions (sends GarrisonAddMissionResult per new mission).
|
||||
// Individual targeted packets are sent instead of a full GetGarrisonInfoResult.
|
||||
garrison->RemoveExpiredMissions();
|
||||
garrison->GenerateAvailableMissions();
|
||||
|
||||
// Send mission start condition update
|
||||
garrison->SendMissionStartConditionUpdate();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user