Core: Use new SpellInfo class in core. Sadly, this commit is not compatibile with some of the custom code. To make your code work again you may need to change:
*SpellEntry is now SpellInfo *GetSpellProto is now GetSpellInfo *SpellEntry::Effect*[effIndex] is now avalible under SpellInfo.Effects[effIndex].* *sSpellStore.LookupEntry is no longer valid, use sSpellMgr->GetSpellInfo() *SpellFunctions from SpellMgr.h like DoSpellStuff(spellId) are now: spellInfo->DoStuff() *SpellMgr::CalculateEffectValue and similar functions are now avalible in SpellEffectInfo class. *GET_SPELL macro is removed, code which used it is moved to SpellMgr::LoadDbcDataCorrections *code which affected dbc data in SpellMgr::LoadSpellCustomAttr is now moved to LoadDbcDataCorrections
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "Unit.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
HostileRefManager::~HostileRefManager()
|
||||
{
|
||||
@@ -32,7 +33,7 @@ HostileRefManager::~HostileRefManager()
|
||||
// The pVictim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
|
||||
void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
|
||||
void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellInfo const *pThreatSpell, bool pSingleTarget)
|
||||
{
|
||||
HostileReference* ref;
|
||||
|
||||
@@ -40,7 +41,7 @@ void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry co
|
||||
ref = getFirst();
|
||||
while (ref != NULL)
|
||||
{
|
||||
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
|
||||
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? pThreatSpell->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
|
||||
if (pVictim == getOwner())
|
||||
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
|
||||
else
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
class Unit;
|
||||
class ThreatManager;
|
||||
class HostileReference;
|
||||
struct SpellEntry;
|
||||
class SpellInfo;
|
||||
|
||||
//=================================================
|
||||
|
||||
@@ -42,7 +42,7 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
|
||||
// send threat to all my hateres for the pVictim
|
||||
// The pVictim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false);
|
||||
void threatAssist(Unit *pVictim, float fThreat, SpellInfo const *threatSpell = 0, bool pSingleTarget = false);
|
||||
|
||||
void addTempThreat(float fThreat, bool apply);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
//==============================================================
|
||||
|
||||
// The pHatingUnit is not used yet
|
||||
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
|
||||
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellInfo const *pThreatSpell)
|
||||
{
|
||||
if (pThreatSpell)
|
||||
{
|
||||
@@ -355,7 +355,7 @@ void ThreatManager::clearReferences()
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
|
||||
void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellInfo const *pThreatSpell)
|
||||
{
|
||||
//function deals with adding threat and adding players and pets into ThreatList
|
||||
//mobs, NPCs, guards have ThreatList and HateOfflineList
|
||||
@@ -386,7 +386,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho
|
||||
Unit *unit = pVictim->GetMisdirectionTarget();
|
||||
if (unit)
|
||||
if (Aura* pAura = unit->GetAura(63326)) // Glyph of Vigilance
|
||||
reducedThreadPercent += SpellMgr::CalculateSpellEffectAmount(pAura->GetSpellProto(), 0);
|
||||
reducedThreadPercent += pAura->GetSpellInfo()->Effects[0].CalcValue();
|
||||
|
||||
float reducedThreat = threat * reducedThreadPercent / 100;
|
||||
threat -= reducedThreat;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class Unit;
|
||||
class Creature;
|
||||
class ThreatManager;
|
||||
struct SpellEntry;
|
||||
class SpellInfo;
|
||||
|
||||
#define THREAT_UPDATE_INTERVAL 1 * IN_MILLISECONDS // Server should send threat update to client periodically each second
|
||||
|
||||
@@ -42,7 +42,7 @@ struct SpellEntry;
|
||||
class ThreatCalcHelper
|
||||
{
|
||||
public:
|
||||
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
|
||||
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
@@ -195,7 +195,7 @@ class ThreatManager
|
||||
|
||||
void clearReferences();
|
||||
|
||||
void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
|
||||
void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
|
||||
void modifyThreatPercent(Unit *pVictim, int32 iPercent);
|
||||
|
||||
float getThreat(Unit *pVictim, bool pAlsoSearchOfflineList = false);
|
||||
|
||||
Reference in New Issue
Block a user