mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 21:56:22 +00:00
feat(Core/Hooks): added collection of hooks to extends AC (#3047)
This collection of hooks comes from the Maelstrom project. It allows to release modules such as : - 3v3-soloqueue - 1v1 arena - pvestats and many others
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#include "QuestDef.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Formulas.h"
|
||||
#include "Player.h"
|
||||
|
||||
GossipMenu::GossipMenu()
|
||||
{
|
||||
@@ -420,7 +422,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
|
||||
}
|
||||
|
||||
data << uint32(quest->GetRewOrReqMoney());
|
||||
data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
|
||||
data << uint32(quest->XPValue(_session->GetPlayer()) * _session->GetPlayer()->GetQuestRate());
|
||||
}
|
||||
|
||||
// rewarded honor points. Multiply with 10 to satisfy client
|
||||
@@ -650,7 +652,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
|
||||
}
|
||||
|
||||
data << uint32(quest->GetRewOrReqMoney());
|
||||
data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
|
||||
data << uint32(quest->XPValue(_session->GetPlayer()) * _session->GetPlayer()->GetQuestRate());
|
||||
|
||||
// rewarded honor points. Multiply with 10 to satisfy client
|
||||
data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
|
||||
|
||||
@@ -91,7 +91,11 @@ void AddItemsSetItem(Player* player, Item* item)
|
||||
}
|
||||
|
||||
// spell casted only if fit form requirement, in other case will casted at form change
|
||||
player->ApplyEquipSpell(spellInfo, nullptr, true);
|
||||
if (sScriptMgr->CanItemApplyEquipSpell(player, item))
|
||||
{
|
||||
player->ApplyEquipSpell(spellInfo, nullptr, true);
|
||||
}
|
||||
|
||||
eff->spells[y] = spellInfo;
|
||||
break;
|
||||
}
|
||||
@@ -266,6 +270,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration);
|
||||
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
|
||||
sScriptMgr->OnItemCreate(this, itemProto, owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -423,7 +428,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32());
|
||||
// Remove bind flag for items vs NO_BIND set
|
||||
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
||||
if (IsSoulBound() && proto->Bonding == NO_BIND && sScriptMgr->CanApplySoulboundFlag(this, proto))
|
||||
{
|
||||
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND, false);
|
||||
need_save = true;
|
||||
|
||||
@@ -87,6 +87,8 @@ Object::Object() : m_PackGUID(sizeof(uint64) + 1)
|
||||
m_objectUpdated = false;
|
||||
|
||||
m_PackGUID.appendPackGUID(0);
|
||||
|
||||
sScriptMgr->OnConstructObject(this);
|
||||
}
|
||||
|
||||
WorldObject::~WorldObject()
|
||||
@@ -110,6 +112,8 @@ WorldObject::~WorldObject()
|
||||
|
||||
Object::~Object()
|
||||
{
|
||||
sScriptMgr->OnDestructObject(this);
|
||||
|
||||
if (IsInWorld())
|
||||
{
|
||||
sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -1073,6 +1074,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
}
|
||||
}
|
||||
|
||||
sScriptMgr->OnInitStatsForLevel(this, petlevel);
|
||||
|
||||
UpdateAllStats();
|
||||
|
||||
SetFullHealth();
|
||||
@@ -1585,7 +1588,7 @@ void Pet::InitLevelupSpellsForLevel()
|
||||
for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr)
|
||||
{
|
||||
// will called first if level down
|
||||
if (itr->first > level)
|
||||
if (itr->first > level && sScriptMgr->CanUnlearnSpellSet(this, itr->first, itr->second))
|
||||
unlearnSpell(itr->second, true); // will learn prev rank if any
|
||||
// will called if level up
|
||||
else
|
||||
@@ -1605,7 +1608,7 @@ void Pet::InitLevelupSpellsForLevel()
|
||||
continue;
|
||||
|
||||
// will called first if level down
|
||||
if (spellEntry->SpellLevel > level)
|
||||
if (spellEntry->SpellLevel > level && sScriptMgr->CanUnlearnSpellDefault(this, spellEntry))
|
||||
unlearnSpell(spellEntry->Id, true);
|
||||
// will called if level up
|
||||
else
|
||||
@@ -1710,6 +1713,9 @@ bool Pet::resetTalents()
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
if (!sScriptMgr->CanResetTalents(this))
|
||||
return false;
|
||||
|
||||
// not need after this call
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||
@@ -1863,16 +1869,17 @@ void Pet::InitTalentForLevel()
|
||||
{
|
||||
uint8 level = getLevel();
|
||||
uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
|
||||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// Reset talents in case low level (on level down) or wrong points for level (hunter can unlearn TP increase talent)
|
||||
if (talentPointsForLevel == 0 || m_usedTalentCount > talentPointsForLevel)
|
||||
resetTalents(); // Remove all talent points
|
||||
|
||||
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
|
||||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (!m_loading)
|
||||
owner->ToPlayer()->SendTalentsInfoData(true);
|
||||
}
|
||||
@@ -1883,6 +1890,9 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint8 level)
|
||||
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
|
||||
if (Unit* owner = GetOwner())
|
||||
points += owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
|
||||
|
||||
sScriptMgr->OnCalculateMaxTalentPointsForLevel(this, level, points);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
|
||||
@@ -611,9 +611,9 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
|
||||
// Give reputation and kill credit only in PvE.
|
||||
if (!_isPvP || _isBattleGround)
|
||||
{
|
||||
const float rate = _group ?
|
||||
_groupRate * float(player->getLevel()) / _sumLevel : // Group rate depends on summary level.
|
||||
1.0f; // Personal rate is 100%.
|
||||
float rate = _group ? _groupRate * float(player->getLevel()) / _sumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on summary level.
|
||||
|
||||
sScriptMgr->OnRewardKillRewarder(player, isDungeon, rate); // Personal rate is 100%.
|
||||
if (_xp)
|
||||
// 4.2. Give XP.
|
||||
_RewardXP(player, rate);
|
||||
@@ -976,10 +976,14 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
m_applyResilience = true;
|
||||
|
||||
m_isInstantFlightOn = true;
|
||||
|
||||
sScriptMgr->OnConstructPlayer(this);
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
{
|
||||
sScriptMgr->OnDestructPlayer(this);
|
||||
|
||||
// it must be unloaded already in PlayerLogout and accessed only for loggined player
|
||||
//m_social = nullptr;
|
||||
|
||||
@@ -3389,7 +3393,8 @@ void Player::GiveLevel(uint8 level)
|
||||
if (Pet* pet = GetPet())
|
||||
pet->SynchronizeLevelWithOwner();
|
||||
|
||||
if (MailLevelReward const* mailReward = sObjectMgr->GetMailLevelReward(level, getRaceMask()))
|
||||
MailLevelReward const* mailReward = sObjectMgr->GetMailLevelReward(level, getRaceMask());
|
||||
if (mailReward && sScriptMgr->CanGiveMailRewardAtGiveLevel(this, level))
|
||||
{
|
||||
//- TODO: Poor design of mail system
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
@@ -5144,6 +5149,8 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
stmt->setUInt32(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
sScriptMgr->OnDeleteFromDB(trans, guid);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
break;
|
||||
}
|
||||
@@ -5713,6 +5720,9 @@ void Player::RepopAtGraveyard()
|
||||
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetAreaId());
|
||||
|
||||
if (!sScriptMgr->CanRepopAtGraveyard(this))
|
||||
return;
|
||||
|
||||
// Such zones are considered unreachable as a ghost and the player must be automatically revived
|
||||
// Xinef: Get Transport Check is not needed
|
||||
if ((!IsAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) /*|| GetTransport()*/ || GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
|
||||
@@ -6803,6 +6813,7 @@ uint16 Player::GetMaxSkillValue(uint32 skill) const
|
||||
uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
|
||||
|
||||
int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
|
||||
sScriptMgr->OnGetMaxSkillValue(const_cast<Player*>(this), skill, result, false);
|
||||
result += SKILL_TEMP_BONUS(bonus);
|
||||
result += SKILL_PERM_BONUS(bonus);
|
||||
return result < 0 ? 0 : result;
|
||||
@@ -6817,7 +6828,11 @@ uint16 Player::GetPureMaxSkillValue(uint32 skill) const
|
||||
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
|
||||
return 0;
|
||||
|
||||
return SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
|
||||
int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
|
||||
|
||||
sScriptMgr->OnGetMaxSkillValue(const_cast<Player*>(this), skill, result, true);
|
||||
|
||||
return result < 0 ? 0 : result;
|
||||
}
|
||||
|
||||
uint16 Player::GetBaseSkillValue(uint32 skill) const
|
||||
@@ -7075,6 +7090,9 @@ void Player::CheckAreaExploreAndOutdoor()
|
||||
if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && !isOutdoor)
|
||||
RemoveAurasWithAttribute(SPELL_ATTR0_OUTDOORS_ONLY);
|
||||
|
||||
if (!sScriptMgr->CanAreaExploreAndOutdoor(this))
|
||||
return;
|
||||
|
||||
if (!areaId)
|
||||
return;
|
||||
|
||||
@@ -7466,6 +7484,8 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
|
||||
// [29..38] Other title and player name
|
||||
// [39+] Nothing
|
||||
uint32 victim_title = victim->GetUInt32Value(PLAYER_CHOSEN_TITLE);
|
||||
uint32 killer_title = 0;
|
||||
sScriptMgr->OnVictimRewardBefore(this, victim, killer_title, victim_title);
|
||||
// Get Killer titles, CharTitlesEntry::bit_index
|
||||
// Ranks:
|
||||
// title[1..14] -> rank[5..18]
|
||||
@@ -7492,6 +7512,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, GetAreaId());
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, 1, 0, victim);
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim);
|
||||
sScriptMgr->OnVictimRewardAfter(this, victim, killer_title, victim_rank, honor_f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7646,14 +7667,6 @@ uint32 Player::GetArenaTeamIdFromStorage(uint32 guid, uint8 slot)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
|
||||
{
|
||||
if (slot < MAX_ARENA_SLOT)
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID);
|
||||
@@ -8081,6 +8094,12 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
|
||||
// req. check at equip, but allow use for extended range if range limit max level, set proper level
|
||||
uint32 ssd_level = getLevel();
|
||||
uint32 CustomScalingStatValue = 0;
|
||||
|
||||
sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
|
||||
|
||||
uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
|
||||
|
||||
if (ssd && ssd_level > ssd->MaxLevel)
|
||||
ssd_level = ssd->MaxLevel;
|
||||
|
||||
@@ -8093,17 +8112,30 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
uint32 statType = 0;
|
||||
int32 val = 0;
|
||||
// If set ScalingStatDistribution need get stats and values from it
|
||||
if (ssd && ssv)
|
||||
if (ssv)
|
||||
{
|
||||
if (ssd->StatMod[i] < 0)
|
||||
continue;
|
||||
statType = ssd->StatMod[i];
|
||||
val = (ssv->getssdMultiplier(proto->ScalingStatValue) * ssd->Modifier[i]) / 10000;
|
||||
if (ssd)
|
||||
{
|
||||
if (ssd->StatMod[i] < 0)
|
||||
continue;
|
||||
|
||||
statType = ssd->StatMod[i];
|
||||
val = (ssv->getssdMultiplier(ScalingStatValue) * ssd->Modifier[i]) / 10000;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i >= proto->StatsCount)
|
||||
continue;
|
||||
|
||||
// OnCustomScalingStatValue(Player* player, ItemTemplate const* proto, uint32& statType, int32& val, uint8 itemProtoStatNumber, uint32 ScalingStatValue, ScalingStatValuesEntry const* ssv)
|
||||
sScriptMgr->OnCustomScalingStatValue(this, proto, statType, val, i, ScalingStatValue, ssv);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i >= proto->StatsCount)
|
||||
continue;
|
||||
|
||||
statType = proto->ItemStat[i].ItemStatType;
|
||||
val = proto->ItemStat[i].ItemStatValue;
|
||||
}
|
||||
@@ -8262,15 +8294,16 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
|
||||
// Apply Spell Power from ScalingStatValue if set
|
||||
if (ssv)
|
||||
if (int32 spellbonus = ssv->getSpellBonus(proto->ScalingStatValue))
|
||||
if (int32 spellbonus = ssv->getSpellBonus(ScalingStatValue))
|
||||
ApplySpellPowerBonus(spellbonus, apply);
|
||||
|
||||
// If set ScalingStatValue armor get it or use item armor
|
||||
uint32 armor = proto->Armor;
|
||||
if (ssv)
|
||||
{
|
||||
if (uint32 ssvarmor = ssv->getArmorMod(proto->ScalingStatValue))
|
||||
armor = ssvarmor;
|
||||
if (uint32 ssvarmor = ssv->getArmorMod(ScalingStatValue))
|
||||
if (proto->ScalingStatValue > 0 || ssvarmor < proto->Armor) //Check to avoid higher values than stat itself (heirloom OR items with correct armor value)
|
||||
armor = ssvarmor;
|
||||
}
|
||||
else if (armor && proto->ArmorDamageModifier)
|
||||
armor -= uint32(proto->ArmorDamageModifier);
|
||||
@@ -8295,7 +8328,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
}
|
||||
|
||||
// Add armor bonus from ArmorDamageModifier if > 0
|
||||
if (proto->ArmorDamageModifier > 0)
|
||||
if (proto->ArmorDamageModifier > 0 && sScriptMgr->CanArmorDamageModifier(this))
|
||||
HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->ArmorDamageModifier), apply);
|
||||
|
||||
if (proto->Block)
|
||||
@@ -8342,11 +8375,12 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
int32 feral_bonus = 0;
|
||||
if (ssv)
|
||||
{
|
||||
dpsMod = ssv->getDPSMod(proto->ScalingStatValue);
|
||||
feral_bonus += ssv->getFeralBonus(proto->ScalingStatValue);
|
||||
dpsMod = ssv->getDPSMod(ScalingStatValue);
|
||||
feral_bonus += ssv->getFeralBonus(ScalingStatValue);
|
||||
}
|
||||
|
||||
feral_bonus += proto->getFeralBonus(dpsMod);
|
||||
sScriptMgr->OnGetFeralApBonus(this, feral_bonus, dpsMod, proto, ssv);
|
||||
if (feral_bonus)
|
||||
ApplyFeralAPBonus(feral_bonus, apply);
|
||||
}
|
||||
@@ -8354,6 +8388,27 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
|
||||
void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply)
|
||||
{
|
||||
uint32 CustomScalingStatValue = 0;
|
||||
|
||||
sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
|
||||
|
||||
uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
|
||||
|
||||
// following part fix disarm issue
|
||||
// that doesn't apply the scaling after disarmed
|
||||
if (!ssv)
|
||||
{
|
||||
ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr;
|
||||
|
||||
// req. check at equip, but allow use for extended range if range limit max level, set proper level
|
||||
uint32 ssd_level = getLevel();
|
||||
|
||||
if (ssd && ssd_level > ssd->MaxLevel)
|
||||
ssd_level = ssd->MaxLevel;
|
||||
|
||||
ssv = ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr;
|
||||
}
|
||||
|
||||
WeaponAttackType attType = BASE_ATTACK;
|
||||
float damage = 0.0f;
|
||||
|
||||
@@ -8374,7 +8429,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
|
||||
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
|
||||
if (ssv)
|
||||
{
|
||||
int32 extraDPS = ssv->getDPSMod(proto->ScalingStatValue);
|
||||
int32 extraDPS = ssv->getDPSMod(ScalingStatValue);
|
||||
if (extraDPS)
|
||||
{
|
||||
float average = extraDPS * proto->Delay / 1000.0f;
|
||||
@@ -8438,6 +8493,9 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attac
|
||||
if (aura->GetSpellInfo()->EquippedItemClass == -1)
|
||||
return;
|
||||
|
||||
if (!sScriptMgr->CanApplyWeaponDependentAuraDamageMod(this, item, attackType, aura, apply))
|
||||
return;
|
||||
|
||||
BaseModGroup mod = BASEMOD_END;
|
||||
switch (attackType)
|
||||
{
|
||||
@@ -8548,6 +8606,9 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
if (!sScriptMgr->CanApplyEquipSpell(this, spellInfo, item, apply, form_change))
|
||||
return;
|
||||
|
||||
// Cannot be used in this stance/form
|
||||
if (spellInfo->CheckShapeshift(GetShapeshiftForm()) != SPELL_CAST_OK)
|
||||
return;
|
||||
@@ -8619,6 +8680,8 @@ void Player::UpdateEquipSpellsAtFormChange()
|
||||
continue;
|
||||
|
||||
ApplyEquipSpell(spellInfo, nullptr, false, true); // remove spells that not fit to form
|
||||
if (!sScriptMgr->CanApplyEquipSpellsItemSet(this, eff))
|
||||
break;
|
||||
ApplyEquipSpell(spellInfo, nullptr, true, true); // add spells that fit form but not active
|
||||
}
|
||||
}
|
||||
@@ -8671,6 +8734,9 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
|
||||
|
||||
void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto)
|
||||
{
|
||||
if (!sScriptMgr->CanCastItemCombatSpell(this, target, attType, procVictim, procEx, item, proto))
|
||||
return;
|
||||
|
||||
// Can do effect if any damage done to target
|
||||
if (procVictim & PROC_FLAG_TAKEN_DAMAGE)
|
||||
//if (damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)
|
||||
@@ -8794,6 +8860,9 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
|
||||
|
||||
void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex)
|
||||
{
|
||||
if (!sScriptMgr->CanCastItemUseSpell(this, item, targets, cast_count, glyphIndex))
|
||||
return;
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
// special learning case
|
||||
if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
|
||||
@@ -9056,6 +9125,8 @@ void Player::_ApplyAmmoBonuses()
|
||||
else
|
||||
currentAmmoDPS = (ammo_proto->Damage[0].DamageMin + ammo_proto->Damage[0].DamageMax) / 2;
|
||||
|
||||
sScriptMgr->OnApplyAmmoBonuses(this, ammo_proto, currentAmmoDPS);
|
||||
|
||||
if (currentAmmoDPS == GetAmmoDPS())
|
||||
return;
|
||||
|
||||
@@ -12047,6 +12118,9 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
|
||||
ItemTemplate const* pProto = pItem->GetTemplate();
|
||||
if (pProto)
|
||||
{
|
||||
if (!sScriptMgr->CanEquipItem(const_cast<Player*>(this), slot, dest, pItem, swap, not_loading))
|
||||
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
|
||||
|
||||
// item used
|
||||
if (pItem->m_lootGenerated)
|
||||
return EQUIP_ERR_ALREADY_LOOTED;
|
||||
@@ -12208,6 +12282,9 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
|
||||
|
||||
InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const
|
||||
{
|
||||
if (!sScriptMgr->CanUnequipItem(const_cast<Player*>(this), pos, swap))
|
||||
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
|
||||
|
||||
// Applied only to equipped items and bank bags
|
||||
if (!IsEquipmentPos(pos) && !IsBagPos(pos))
|
||||
return EQUIP_ERR_OK;
|
||||
@@ -12529,6 +12606,11 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
|
||||
if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
|
||||
InventoryResult result = EQUIP_ERR_OK;
|
||||
|
||||
if (!sScriptMgr->CanUseItem(const_cast<Player*>(this), proto, result))
|
||||
return result;
|
||||
|
||||
if (getLevel() < proto->RequiredLevel)
|
||||
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
||||
|
||||
@@ -12872,7 +12954,11 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
|
||||
|
||||
Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update)
|
||||
{
|
||||
if (Item* pItem = Item::CreateItem(item, 1, this))
|
||||
Item* _item = Item::CreateItem(item, 1, this);
|
||||
if (!_item)
|
||||
return nullptr;
|
||||
|
||||
if (!IsEquipmentPos(pos) || sScriptMgr->CanSaveEquipNewItem(this, _item, pos, update))
|
||||
{
|
||||
// pussywizard: obtaining blue or better items saves to db
|
||||
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item))
|
||||
@@ -12881,10 +12967,9 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update)
|
||||
|
||||
ItemAddedQuestCheck(item, 1);
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1);
|
||||
return EquipItem(pos, pItem, update);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return EquipItem(pos, _item, update);
|
||||
}
|
||||
|
||||
Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
||||
@@ -14497,6 +14582,9 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
|
||||
if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill))
|
||||
return;
|
||||
|
||||
if (!sScriptMgr->CanApplyEnchantment(this, item, slot, apply, apply_dur, ignore_condition))
|
||||
return;
|
||||
|
||||
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
|
||||
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
|
||||
if ((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
|
||||
@@ -16096,7 +16184,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest();
|
||||
|
||||
// Not give XP in case already completed once repeatable quest
|
||||
uint32 XP = rewarded ? 0 : uint32(quest->XPValue(this) * sWorld->getRate(RATE_XP_QUEST));
|
||||
uint32 XP = rewarded ? 0 : uint32(quest->XPValue(this) * GetQuestRate());
|
||||
|
||||
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
|
||||
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
|
||||
@@ -17252,6 +17340,9 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
|
||||
if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()) ||
|
||||
(qInfo->IsPVPQuest() && (GetGroup()->isBFGroup() || GetGroup()->isBGGroup()))))
|
||||
{
|
||||
if (!sScriptMgr->PassedQuestKilledMonsterCredit(this, qInfo, entry, real_entry, guid))
|
||||
continue;
|
||||
|
||||
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST)*/)
|
||||
{
|
||||
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
|
||||
@@ -17801,8 +17892,8 @@ void Player::_LoadArenaTeamInfo()
|
||||
{
|
||||
memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32) * MAX_ARENA_SLOT * ARENA_TEAM_END);
|
||||
|
||||
for (uint8 slot = 0; slot < MAX_ARENA_SLOT; ++slot)
|
||||
if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUIDLow(), slot))
|
||||
for (auto const& itr : ArenaTeam::ArenaSlotByType)
|
||||
if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUIDLow(), itr.second))
|
||||
{
|
||||
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
|
||||
if (!arenaTeam) // some shit, should be assert, but just ignore
|
||||
@@ -17811,6 +17902,8 @@ void Player::_LoadArenaTeamInfo()
|
||||
if (!member) // some shit, should be assert, but just ignore
|
||||
continue;
|
||||
|
||||
uint8 slot = itr.second;
|
||||
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_ID, arenaTeamId);
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, arenaTeam->GetType());
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_MEMBER, (arenaTeam->GetCaptain() == GetGUID()) ? 0 : 1);
|
||||
@@ -18874,7 +18967,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
||||
else if (IsEquipmentPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
{
|
||||
uint16 dest;
|
||||
err = CanEquipItem(slot, dest, item, false, false);
|
||||
if (sScriptMgr->CheckItemInSlotAtLoadInventory(this, item, slot, err, dest))
|
||||
err = CanEquipItem(slot, dest, item, false, false);
|
||||
if (err == EQUIP_ERR_OK)
|
||||
QuickEquipItem(dest, item);
|
||||
}
|
||||
@@ -19858,6 +19952,9 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
|
||||
|| missingPlayerItems.size() || missingPlayerQuests.size() || missingPlayerAchievements.size()
|
||||
|| missingLeaderItems.size() || missingLeaderQuests.size() || missingLeaderAchievements.size())
|
||||
{
|
||||
if (!sScriptMgr->NotAvoidSatisfy(partyLeader, ar, target_map, report))
|
||||
return true;
|
||||
|
||||
if (report)
|
||||
{
|
||||
uint8 requirementPrintMode = sWorld->getIntConfig(CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE);
|
||||
@@ -22020,36 +22117,6 @@ void Player::LeaveAllArenaTeams(uint64 guid)
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaTeamId(uint8 slot) const
|
||||
{
|
||||
uint32 rtVal = 0;
|
||||
if (slot >= MAX_ARENA_SLOT)
|
||||
{
|
||||
sScriptMgr->GetCustomGetArenaTeamId(this, slot, rtVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtVal = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID);
|
||||
}
|
||||
|
||||
return rtVal;
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaPersonalRating(uint8 slot) const
|
||||
{
|
||||
uint32 rtVal = 0;
|
||||
if (slot >= MAX_ARENA_SLOT)
|
||||
{
|
||||
sScriptMgr->GetCustomGetArenaTeamId(this, slot, rtVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtVal = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
|
||||
}
|
||||
|
||||
return rtVal;
|
||||
}
|
||||
|
||||
void Player::SetRestBonus(float rest_bonus_new)
|
||||
{
|
||||
// Prevent resting on max level
|
||||
@@ -22492,9 +22559,9 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
}
|
||||
}
|
||||
|
||||
Item* it = bStore ?
|
||||
StoreNewItem(vDest, item, true) :
|
||||
EquipNewItem(uiDest, item, true);
|
||||
sScriptMgr->OnBeforeStoreOrEquipNewItem(this, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
|
||||
|
||||
Item* it = bStore ? StoreNewItem(vDest, item, true) : EquipNewItem(uiDest, item, true);
|
||||
if (it)
|
||||
{
|
||||
uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, pProto->BuyCount * count);
|
||||
@@ -22520,6 +22587,9 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
AddRefundReference(it->GetGUIDLow());
|
||||
}
|
||||
}
|
||||
|
||||
sScriptMgr->OnAfterStoreOrEquipNewItem(this, vendorslot, it, count, bag, slot, pProto, pVendor, crItem, bStore);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23371,6 +23441,9 @@ bool Player::IsVisibleGloballyFor(Player const* u) const
|
||||
if (!AccountMgr::IsPlayerAccount(u->GetSession()->GetSecurity()))
|
||||
return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity();
|
||||
|
||||
if (!sScriptMgr->NotVisibleGloballyFor(const_cast<Player*>(this), u))
|
||||
return true;
|
||||
|
||||
// non faction visibility non-breakable for non-GMs
|
||||
return false;
|
||||
}
|
||||
@@ -28457,3 +28530,77 @@ void Player::RemoveRestFlag(RestFlag restFlag)
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
|
||||
{
|
||||
if (sScriptMgr->NotSetArenaTeamInfoField(this, slot, type, value))
|
||||
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaPersonalRating(uint8 slot) const
|
||||
{
|
||||
uint32 result = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
|
||||
|
||||
sScriptMgr->OnGetArenaPersonalRating(const_cast<Player*>(this), slot, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaTeamId(uint8 slot) const
|
||||
{
|
||||
uint32 result = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID);
|
||||
|
||||
sScriptMgr->OnGetArenaTeamId(const_cast<Player*>(this), slot, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Player::IsFFAPvP()
|
||||
{
|
||||
bool result = Unit::IsFFAPvP();
|
||||
|
||||
sScriptMgr->OnIsFFAPvP(this, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Player::IsPvP()
|
||||
{
|
||||
bool result = Unit::IsPvP();
|
||||
|
||||
sScriptMgr->OnIsPvP(this, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint16 Player::GetMaxSkillValueForLevel() const
|
||||
{
|
||||
uint16 result = Unit::GetMaxSkillValueForLevel();
|
||||
|
||||
sScriptMgr->OnGetMaxSkillValueForLevel(const_cast<Player*>(this), result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
float Player::GetQuestRate()
|
||||
{
|
||||
float result = sWorld->getRate(RATE_XP_QUEST);
|
||||
|
||||
sScriptMgr->OnGetQuestRate(this, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Player::SetServerSideVisibility(ServerSideVisibilityType type, AccountTypes sec)
|
||||
{
|
||||
sScriptMgr->OnSetServerSideVisibility(this, type, sec);
|
||||
|
||||
m_serverSideVisibility.SetValue(type, sec);
|
||||
}
|
||||
|
||||
void Player::SetServerSideVisibilityDetect(ServerSideVisibilityType type, AccountTypes sec)
|
||||
{
|
||||
sScriptMgr->OnSetServerSideVisibilityDetect(this, type, sec);
|
||||
|
||||
m_serverSideVisibilityDetect.SetValue(type, sec);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "DBCStores.h"
|
||||
#include "GroupReference.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "Item.h"
|
||||
#include "MapReference.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -705,19 +706,6 @@ enum InstanceResetWarningType
|
||||
RAID_INSTANCE_EXPIRED = 5
|
||||
};
|
||||
|
||||
// PLAYER_FIELD_ARENA_TEAM_INFO_1_1 offsets
|
||||
enum ArenaTeamInfoType
|
||||
{
|
||||
ARENA_TEAM_ID = 0,
|
||||
ARENA_TEAM_TYPE = 1, // new in 3.2 - team type?
|
||||
ARENA_TEAM_MEMBER = 2, // 0 - captain, 1 - member
|
||||
ARENA_TEAM_GAMES_WEEK = 3,
|
||||
ARENA_TEAM_GAMES_SEASON = 4,
|
||||
ARENA_TEAM_WINS_SEASON = 5,
|
||||
ARENA_TEAM_PERSONAL_RATING = 6,
|
||||
ARENA_TEAM_END = 7
|
||||
};
|
||||
|
||||
class InstanceSave;
|
||||
|
||||
enum RestFlag
|
||||
@@ -1466,7 +1454,7 @@ public:
|
||||
void RemoveRewardedQuest(uint32 questId, bool update = true);
|
||||
void SendQuestUpdate(uint32 questId);
|
||||
QuestGiverStatus GetQuestDialogStatus(Object* questGiver);
|
||||
|
||||
float GetQuestRate();
|
||||
void SetDailyQuestStatus(uint32 quest_id);
|
||||
bool IsDailyQuestDone(uint32 quest_id);
|
||||
void SetWeeklyQuestStatus(uint32 quest_id);
|
||||
@@ -1616,6 +1604,7 @@ public:
|
||||
|
||||
[[nodiscard]] RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
|
||||
QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }
|
||||
QuestStatusSaveMap& GetQuestStatusSaveMap() { return m_QuestStatusSave; }
|
||||
|
||||
[[nodiscard]] size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
|
||||
[[nodiscard]] bool IsQuestRewarded(uint32 quest_id) const
|
||||
@@ -1915,10 +1904,10 @@ public:
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
|
||||
}
|
||||
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
|
||||
uint32 GetArenaPersonalRating(uint8 slot) const;
|
||||
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
|
||||
static void LeaveAllArenaTeams(uint64 guid);
|
||||
[[nodiscard]] uint32 GetArenaTeamId(uint8 slot) const;
|
||||
[[nodiscard]] uint32 GetArenaPersonalRating(uint8 slot) const;
|
||||
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
|
||||
uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
|
||||
|
||||
@@ -2443,6 +2432,10 @@ public:
|
||||
void SendCinematicStart(uint32 CinematicSequenceId);
|
||||
void SendMovieStart(uint32 MovieId);
|
||||
|
||||
uint16 GetMaxSkillValueForLevel() const;
|
||||
bool IsFFAPvP();
|
||||
bool IsPvP();
|
||||
|
||||
/*********************************************************/
|
||||
/*** INSTANCE SYSTEM ***/
|
||||
/*********************************************************/
|
||||
@@ -2619,6 +2612,9 @@ public:
|
||||
[[nodiscard]] uint32 GetNextSave() const { return m_nextSave; }
|
||||
[[nodiscard]] SpellModList const& GetSpellModList(uint32 type) const { return m_spellMods[type]; }
|
||||
|
||||
void SetServerSideVisibility(ServerSideVisibilityType type, AccountTypes sec);
|
||||
void SetServerSideVisibilityDetect(ServerSideVisibilityType type, AccountTypes sec);
|
||||
|
||||
static std::unordered_map<int, bgZoneRef> bgZoneIdToFillWorldStates; // zoneId -> FillInitialWorldStates
|
||||
|
||||
// Cinematic camera data and remote sight functions
|
||||
|
||||
@@ -4363,6 +4363,8 @@ void Unit::RemoveAura(AuraApplicationMap::iterator& i, AuraRemoveMode mode)
|
||||
// Remove aura - for Area and Target auras
|
||||
if (aura->GetOwner() == this)
|
||||
aura->Remove(mode);
|
||||
|
||||
sScriptMgr->OnAuraRemove(this, aurApp, mode);
|
||||
}
|
||||
|
||||
void Unit::RemoveAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
@@ -9687,6 +9689,11 @@ ReputationRank Unit::GetReactionTo(Unit const* target) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReputationRank repRank = REP_HATED;
|
||||
|
||||
if (!sScriptMgr->IfNormalReaction(this, target, repRank))
|
||||
return ReputationRank(repRank);
|
||||
// do checks dependant only on our faction
|
||||
return GetFactionReactionTo(GetFactionTemplateEntry(), target);
|
||||
}
|
||||
@@ -10782,6 +10789,9 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da
|
||||
if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
|
||||
continue;
|
||||
|
||||
if (!sScriptMgr->IsNeedModSpellDamagePercent(this, *i, DoneTotalMod, spellProto))
|
||||
continue;
|
||||
|
||||
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
@@ -11784,8 +11794,13 @@ float Unit::SpellPctHealingModsDone(Unit* victim, SpellInfo const* spellProto, D
|
||||
|
||||
// Healing done percent
|
||||
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
for (auto const& auraEff : mHealingDonePct)
|
||||
{
|
||||
if (!sScriptMgr->IsNeedModHealPercent(this, auraEff, DoneTotalMod, spellProto))
|
||||
continue;
|
||||
|
||||
AddPct(DoneTotalMod, auraEff->GetAmount());
|
||||
}
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
Unit* owner = GetOwner() ? GetOwner() : this;
|
||||
@@ -12400,6 +12415,9 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
|
||||
if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
|
||||
continue;
|
||||
|
||||
if (!sScriptMgr->IsNeedModMeleeDamagePercent(this, *i, DoneTotalMod, spellProto))
|
||||
continue;
|
||||
|
||||
if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()) && !((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
@@ -18230,6 +18248,9 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
// pussywizard: goign to other phase (valithria, algalon) should not remove such auras
|
||||
//RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
|
||||
|
||||
if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
|
||||
return;
|
||||
|
||||
// modify hostile references for new phasemask, some special cases deal with hostile references themselves
|
||||
if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
|
||||
{
|
||||
@@ -20077,7 +20098,10 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
|
||||
fieldBuffer << (uint32)target->getFaction();
|
||||
}
|
||||
else
|
||||
fieldBuffer << m_uint32Values[index];
|
||||
if (!sScriptMgr->IsCustomBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
|
||||
{
|
||||
fieldBuffer << m_uint32Values[index];
|
||||
}
|
||||
}
|
||||
else
|
||||
// send in current format (float as float, uint32 as uint32)
|
||||
|
||||
Reference in New Issue
Block a user