Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/World/IWorld.h
#	src/server/game/World/World.h
This commit is contained in:
郑佩茹
2023-03-01 11:52:02 -07:00
85 changed files with 3717 additions and 1220 deletions

View File

@@ -15893,6 +15893,24 @@ bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates new
if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
{
SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
{
if (Creature* creature = _unit->ToCreature())
{
// Processing this packet needs to be delayed
_unit->m_Events.AddEventAtOffset([creature, spell_id]()
{
if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
{
WorldPacket data;
creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
}
}, 500ms);
}
}
return true;
}
}
@@ -18095,7 +18113,6 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
if (CreatureAI* ai = creature->AI())
{
ai->JustDied(killer);
sScriptMgr->OnUnitDeath(creature, killer);
}
if (TempSummon* summon = creature->ToTempSummon())
@@ -18179,6 +18196,8 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
}
}
sScriptMgr->OnUnitDeath(victim, killer);
}
void Unit::SetControlled(bool apply, UnitState state, Unit* source /*= nullptr*/, bool isFear /*= false*/)