115 m_caster->SendMessageToSet(&data,
true);
145 bool apply_direct_bonus =
true;
155 if (ihit->effectMask & (1 << effIndex))
225 if (
uint32 combo = player->GetComboPoints())
234 else if (
m_spellInfo->SpellFamilyFlags[0] & 0x00020000)
238 if (
uint32 combo = player->GetComboPoints())
241 damage += std::rand() %
int32(ap * combo * 0.07f) +
int32(ap * combo * 0.03f);
281 if (effIndex < EFFECT_0 || effIndex >
EFFECT_31)
298 float gainMultiplier = 0.0f;
305 int32 gain =
int32(newDamage * gainMultiplier);
317 if (effIndex < EFFECT_0 || effIndex >
EFFECT_31)
344 newDamage =
int32(newDamage * dmgMultiplier);
369 int damageAmount = 0;
373 damageAmount += aurEff->GetAmount();
374 m_caster->RemoveAurasDueToSpell(stackAuraSpellId);
377 addhealth += damageAmount;
392 for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
395 && (*i)->GetSpellInfo()->SpellFamilyFlags[0] & 0x50)
422 addhealth += tickheal * tickcount;
517 uint32 newitemid = itemtype;
555 float additionalCreateChance = 0.0f;
557 uint8 additionalMaxNum = 0;
562 while (
roll_chance_f(additionalCreateChance) && items_count <= additionalMaxNum)
567 num_to_add *= items_count;
577 num_to_add -= no_space;
635 if (effIndex < EFFECT_0 || effIndex >
EFFECT_31)
644 int level_multiplier = 0;
649 level_diff =
int32(
m_caster->getLevel()) - scalingRule->BaseLevel;
650 level_multiplier = scalingRule->LevelMultiplier;
662 damage -= level_multiplier * level_diff;
675 if (
AuraEffect* aurEff = player->GetAuraEffect(
686 bool guardianFound =
false;
687 bool battleFound =
false;
689 for (Unit::AuraApplicationMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
691 uint32 spell_id = itr->second->GetBase()->GetId();
694 guardianFound =
true;
698 if (battleFound && guardianFound)
703 std::set<uint32> avalibleElixirs;
708 for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end();)
712 avalibleElixirs.erase(itr++);
714 avalibleElixirs.erase(itr++);
716 avalibleElixirs.erase(itr++);
721 if (!avalibleElixirs.empty())
739 if (effIndex < EFFECT_0 || effIndex >
EFFECT_31)
766 SF_LOG_ERROR(
"spells",
"Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!",
844 if (dispel_list.empty())
852 for (
int32 count = 0; count <
damage && !dispel_list.empty();)
855 DispelChargesList::iterator itr = dispel_list.begin();
856 std::advance(itr, std::rand() % dispel_list.size());
862 dispel_list.erase(itr);
869 bool alreadyListed =
false;
870 for (DispelChargesList::iterator successItr = success_list.begin(); successItr != success_list.end(); ++successItr)
872 if (successItr->first->GetId() == itr->first->GetId())
874 ++successItr->second;
875 alreadyListed =
true;
879 success_list.push_back(std::make_pair(itr->first, 1));
881 if (itr->second <= 0)
882 dispel_list.erase(itr);
894 dataFail <<
uint32(itr->first->GetId());
901 m_caster->SendMessageToSet(&dataFail,
true);
903 if (success_list.empty())
916 dataSuccess.
WriteBits(success_list.size(), 22);
920 for (DispelChargesList::iterator itr = success_list.begin(); itr != success_list.end(); ++itr)
934 for (DispelChargesList::iterator itr = success_list.begin(); itr != success_list.end(); ++itr)
938 dataSuccess <<
uint32(itr->first->GetId());
953 m_caster->SendMessageToSet(&dataSuccess,
true);
963 if (owner->GetAura(56249))
964 owner->CastCustomSpell(owner, 19658, &heal_amount, NULL, NULL,
true);
996 if (
unitTarget->getThreatManager().getCurrentVictim())
999 float itsThreat =
unitTarget->getThreatManager().getCurrentVictim()->getThreat();
1000 if (itsThreat > myThreat)
1005 if (!
unitTarget->getThreatManager().getOnlineContainer().empty())
1007 unitTarget->getThreatManager().setCurrentVictim(forcedVictim);
1038 float totalDamagePercentMod = 1.0f;
1039 int32 fixed_bonus = 0;
1040 int32 spell_bonus = 0;
1056 if (
int32 num = (needCast ? 0 : 1))
1057 aur->ModStackAmount(num);
1072 totalDamagePercentMod *= 1.45f;
1096 AddPct(totalDamagePercentMod, rendAndTear->GetAmount());
1115 AddPct(bonusPct, aurEff->GetAmount());
1116 AddPct(totalDamagePercentMod, bonusPct);
1126 AddPct(totalDamagePercentMod, runic);
1135 AddPct(bonusPct, aurEff->GetAmount());
1136 AddPct(totalDamagePercentMod, bonusPct);
1151 AddPct(bonusPct, aurEff->GetAmount());
1153 AddPct(totalDamagePercentMod, bonusPct);
1160 bool normalized =
false;
1161 float weaponDamagePercentMod = 1.0f;
1183 if (fixed_bonus || spell_bonus)
1194 float weapon_total_pct = 1.0f;
1199 fixed_bonus =
int32(fixed_bonus * weapon_total_pct);
1201 spell_bonus =
int32(spell_bonus * weapon_total_pct);
1217 weaponDamage += fixed_bonus;
1222 weaponDamage =
int32(weaponDamage * weaponDamagePercentMod);
1231 weaponDamage += spell_bonus;
1233 if (totalDamagePercentMod != 1.0f)
1234 weaponDamage =
int32(weaponDamage * totalDamagePercentMod);
1237 uint32 eff_damage(std::max(weaponDamage, 0));
1267 int32 addhealth = 0;
1271 addhealth =
m_caster->GetMaxHealth();
1293 SpellInfo const* curSpellInfo = spell->m_spellInfo;
1321 unitTarget->getHostileRefManager().UpdateVisibility();
1324 for (Unit::AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
1327 (*(itr++))->AttackStop();
1341 if (
m_caster->ToPlayer()->HasSpell(58426))
1385 m_caster->ToPlayer()->SetCanDodge(
true);
1394 m_caster->ToPlayer()->SetCanParry(
true);
1403 m_caster->ToPlayer()->SetCanBlock(
true);
1416 std::queue < std::pair < uint32, uint64 > > dispel_list;
1419 for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
1421 Aura* aura = itr->second;
1429 for (; dispel_list.size(); dispel_list.pop())
1461 for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
1463 Aura* aura = itr->second;
1480 steal_list.push_back(std::make_pair(aura, charges));
1484 if (steal_list.empty())
1492 for (
int32 count = 0; count <
damage && !steal_list.empty();)
1495 DispelChargesList::iterator itr = steal_list.begin();
1496 std::advance(itr, std::rand() % steal_list.size());
1502 steal_list.erase(itr);
1509 success_list.push_back(std::make_pair(itr->first->GetId(), itr->first->GetCasterGUID()));
1511 if (itr->second <= 0)
1512 steal_list.erase(itr);
1524 dataFail <<
uint32(itr->first->GetId());
1531 m_caster->SendMessageToSet(&dataFail,
true);
1533 if (success_list.empty())
1540 dataSuccess <<
uint8(0);
1541 dataSuccess <<
uint32(success_list.size());
1542 for (DispelList::iterator itr = success_list.begin(); itr != success_list.end(); ++itr)
1544 dataSuccess <<
uint32(itr->first);
1545 dataSuccess <<
uint8(0);
1548 m_caster->SendMessageToSet(&dataSuccess,
true);
1568 if (count == 0) count = 1;
1569 for (
uint32 j = 0; j < MAX_RUNES && count > 0; ++j)
1623 m_caster->ToPlayer()->SetCanTitanGrip(
true);
#define MAX_SPELL_EFFECTS
uint32 const MinNewsItemLevel[MAX_CONTENT]
@ GUILD_NEWS_ITEM_CRAFTED
@ EQUIP_ERR_ITEM_NOT_FOUND
@ EQUIP_ERR_ITEM_MAX_COUNT
@ ITEM_SUBCLASS_WEAPON_DAGGER
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
ScriptMapMap sEventScripts
std::vector< ItemPosCount > ItemPosCountVec
@ GAMEOBJECT_TYPE_SPELL_FOCUS
@ GAMEOBJECT_TYPE_QUESTGIVER
@ SPELL_EFFECT_WEAPON_DAMAGE
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
@ SPELL_EFFECT_WEAPON_PERCENT_DAMAGE
@ SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL
@ SPELL_PREVENTION_TYPE_SILENCE
@ SPELL_PREVENTION_TYPE_UNK
@ SPELL_ATTR7_DISPEL_CHARGES
@ SPELL_ATTR4_NOT_STEALABLE
@ SPELLFAMILY_DEATHKNIGHT
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_FAILED_DONT_REPORT
@ SPELL_EFFECT_HANDLE_LAUNCH_TARGET
@ SPELL_EFFECT_HANDLE_LAUNCH
@ SPELL_EFFECT_HANDLE_HIT
@ SPELL_EFFECT_HANDLE_HIT_TARGET
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_HEAL
std::list< std::pair< uint32, uint64 > > DispelList
@ SPELL_ATTR0_CU_SHARE_DAMAGE
@ SPELLFAMILYFLAG0_ROGUE_VANISH
@ SPELL_GROUP_ELIXIR_SHATTRATH
@ SPELL_GROUP_ELIXIR_BATTLE
@ SPELL_GROUP_ELIXIR_GUARDIAN
@ SPELL_GROUP_ELIXIR_UNSTABLE
@ SPELLCATEGORY_DEVOUR_MAGIC
@ CHANNEL_INTERRUPT_FLAG_INTERRUPT
@ UNIT_MOD_DAMAGE_OFFHAND
@ UNIT_MOD_DAMAGE_MAINHAND
#define CURRENT_FIRST_NON_MELEE_SPELL
@ AURA_REMOVE_BY_ENEMY_SPELL
@ CURRENT_CHANNELED_SPELL
@ CURRENT_AUTOREPEAT_SPELL
@ SPELL_INTERRUPT_FLAG_INTERRUPT
std::list< std::pair< Aura *, uint8 > > DispelChargesList
bool roll_chance_f(float chance)
bool roll_chance_i(int chance)
T ApplyPct(T &base, U pct)
T CalculatePct(T base, U pct)
SpellInfo const * GetSpellInfo() const
uint64 GetCasterGUID() const
uint64 GetCasterGUID() const
const AuraApplication * GetApplicationOfTarget(uint64 guid) const
int32 GetDuration() const
int32 CalcDispelChance(Unit *auraTarget, bool offensive) const
uint8 GetStackAmount() const
SpellInfo const * GetSpellInfo() const
void WriteGuidBytes(const ObjectGuid &guid, Offsets... offsets)
bool WriteBit(uint32 bit)
void WriteGuidMask(const ObjectGuid &guid, Offsets... offsets)
void WriteBits(T value, size_t bits)
void WriteByteSeq(uint8 b)
ItemTemplate const * GetTemplate() const
static int32 GenerateItemRandomPropertyId(uint32 item_id)
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
uint32 GetGUIDLow() const
void SetUInt32Value(uint16 index, uint32 value)
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=NULL, uint32 itemid=0)
void SetRuneCooldown(uint8 index, uint32 cooldown)
bool UpdateCraftSkill(uint32 spellid)
void SendPreparedGossip(WorldObject *source)
void ResyncRunes(uint8 count)
uint32 GetRuneCooldown(uint8 index) const
RuneType GetCurrentRune(uint8 index) const
bool IsGameMaster() const
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=NULL) const
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, AllowedLooterSet const &allowedLooters=AllowedLooterSet())
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false)
void SendLoot(uint64 guid, LootType loot_type, bool isAoE=false)
RuneType GetBaseRune(uint8 index) const
void EffectHealPct(SpellEffIndex effIndex)
void EffectPowerBurn(SpellEffIndex effIndex)
GameObject * gameObjTarget
void EffectModifyThreatPercent(SpellEffIndex effIndex)
void EffectDamageFromMaxHealthPCT(SpellEffIndex effIndex)
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, Opcodes opcode=SMSG_CAST_FAILED)
void EffectStealBeneficialBuff(SpellEffIndex effIndex)
SpellEffectHandleMode effectHandleMode
void EffectDodge(SpellEffIndex effIndex)
void EffectThreat(SpellEffIndex effIndex)
void EffectEnergizePct(SpellEffIndex effIndex)
void EffectTitanGrip(SpellEffIndex effIndex)
Spell(Unit *caster, SpellInfo const *info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID=0, bool skipCheck=false)
WeaponAttackType m_attackType
void EffectRemoveAura(SpellEffIndex effIndex)
uint64 m_originalCasterGUID
void EffectBlock(SpellEffIndex effIndex)
void EffectParry(SpellEffIndex effIndex)
void ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit *target, uint32 powerType, uint32 powerTaken, float gainMultiplier)
int32 CalculateDamage(uint8 i, Unit const *target) const
void EffectInterruptCast(SpellEffIndex effIndex)
void EffectHealthLeech(SpellEffIndex effIndex)
void EffectDispel(SpellEffIndex effIndex)
void EffectPowerDrain(SpellEffIndex effIndex)
void EffectSchoolDMG(SpellEffIndex effIndex)
void EffectHealMechanical(SpellEffIndex effIndex)
void EffectAddExtraAttacks(SpellEffIndex effIndex)
std::list< TargetInfo > m_UniqueTargetInfo
void EffectEnergize(SpellEffIndex effIndex)
void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit *victim, uint32 spellId)
void EffectWeaponDmg(SpellEffIndex effIndex)
void EffectEnvironmentalDMG(SpellEffIndex effIndex)
void EffectRedirectThreat(SpellEffIndex effIndex)
void EffectInstaKill(SpellEffIndex effIndex)
void EffectDualWield(SpellEffIndex effIndex)
void SendLoot(uint64 guid, LootType loottype)
void EffectHealMaxHealth(SpellEffIndex effIndex)
void EffectSanctuary(SpellEffIndex effIndex)
void DoCreateItem(uint32 i, uint32 itemtype)
void EffectAddComboPoints(SpellEffIndex effIndex)
void EffectHeal(SpellEffIndex effIndex)
void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit *victim, uint32 attCount)
void EffectDispelMechanic(SpellEffIndex effIndex)
void finish(bool ok=true)
void EffectActivateRune(SpellEffIndex effIndex)
SpellInfo const *const m_spellInfo
void EffectTaunt(SpellEffIndex effIndex)
uint32 ChannelInterruptFlags
uint32 GetDispelMask() const
SpellSchoolMask GetSchoolMask() const
uint32 GetAllEffectsMechanicMask() const
std::multimap< uint32, AuraApplication * > AuraApplicationMap
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1) const
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
std::multimap< uint32, Aura * > AuraMap
std::set< Unit * > AttackerSet
uint32 CountPctFromMaxHealth(int32 pct) const
std::list< AuraEffect * > AuraEffectList
std::string const & GetName() const
C::value_type const & SelectRandomContainerElement(C const &container)
bool IsEmpowerRuneWeaponSpell(uint32 spellId)
bool IsMadAlchemistsPotionSpell(uint32 spellId)
GenericSchoolDamageRule GetGenericSchoolDamageRule(uint32 spellId)
bool IsVesselOfTheNaaruHealSpell(uint32 spellId)
uint32 GetStanceOfTheFierceTigerAuraSpellId()
uint32 GetConsumptionDamage(uint32 difficulty)
bool IsPrimalWisdomEnergizeSpell(uint32 spellId)
int32 GetGargoyleStrikeDamageForLevel(uint32 level)
@ GENERIC_SCHOOL_DAMAGE_GARGOYLE_STRIKE
@ GENERIC_SCHOOL_DAMAGE_CONSUMPTION
@ GENERIC_SCHOOL_DAMAGE_ARCANE_CHARGE
@ GENERIC_SCHOOL_DAMAGE_THUNDERCRASH
uint32 GetThundercrashMinimumDamage()
bool IsVictoryRushDamageSpell(uint32 spellId)
uint32 GetEngineeringHealingBonusPct()
bool IsManaBurnSpell(uint32 spellId)
bool IsArcaneChargeAllowedCreatureType(uint32 creatureType)
uint32 GetVesselOfTheNaaruStackAuraSpellId()
bool IsRunicManaInjectorSpell(uint32 spellId)
bool IsBloodTapRuneSpell(uint32 spellId)
bool IsJabEnergizeSpell(uint32 spellId)
bool IsShockwaveDamageSpell(uint32 spellId)
EnergizeLevelScalingRule const * GetEnergizeLevelScalingRule(uint32 spellId)
bool IsRunicHealingInjectorSpell(uint32 spellId)
bool HasMechanic(uint32 mask, uint32 mechanic)
uint32 GetMaxStackSize() const