mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
Merge branch 'master' into Playerbot
# Conflicts: # src/server/game/World/IWorld.h # src/server/game/World/World.h
This commit is contained in:
@@ -2805,6 +2805,16 @@ void Creature::AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_t
|
||||
{
|
||||
_AddCreatureSpellCooldown(spellInfo->Id, 0, spellcooldown);
|
||||
}
|
||||
|
||||
if (sSpellMgr->HasSpellCooldownOverride(spellInfo->Id))
|
||||
{
|
||||
if (IsCharmed() && GetCharmer()->IsPlayer())
|
||||
{
|
||||
WorldPacket data;
|
||||
BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, spellcooldown);
|
||||
GetCharmer()->ToPlayer()->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Creature::GetSpellCooldown(uint32 spell_id) const
|
||||
|
||||
@@ -664,16 +664,22 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
|
||||
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
{
|
||||
if (sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
|
||||
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
|
||||
{
|
||||
DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true, true);
|
||||
if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM && !quest->IsRepeatable() && !HasQuestForItem(quest->RequiredItemId[i], quest_id, true))
|
||||
DestroyItemCount(quest->RequiredItemId[i], 9999, true);
|
||||
else
|
||||
DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
|
||||
}
|
||||
}
|
||||
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
|
||||
{
|
||||
if (sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
|
||||
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
|
||||
{
|
||||
DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true, true);
|
||||
if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM && !quest->IsRepeatable() && !HasQuestForItem(quest->ItemDrop[i], quest_id))
|
||||
DestroyItemCount(quest->ItemDrop[i], 9999, true);
|
||||
else
|
||||
DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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*/)
|
||||
|
||||
Reference in New Issue
Block a user