refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
parent
e99b526e17
commit
a2b26272d2
338 changed files with 52196 additions and 50944 deletions
|
|
@ -64,7 +64,7 @@ void CombatAI::EnterCombat(Unit* who)
|
|||
if (AISpellInfo[*i].condition == AICOND_AGGRO)
|
||||
me->CastSpell(who, *i, false);
|
||||
else if (AISpellInfo[*i].condition == AICOND_COMBAT)
|
||||
events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand()%AISpellInfo[*i].cooldown);
|
||||
events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand() % AISpellInfo[*i].cooldown);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ void CombatAI::UpdateAI(uint32 diff)
|
|||
if (uint32 spellId = events.ExecuteEvent())
|
||||
{
|
||||
DoCast(spellId);
|
||||
events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand()%AISpellInfo[spellId].cooldown);
|
||||
events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand() % AISpellInfo[spellId].cooldown);
|
||||
}
|
||||
else
|
||||
DoMeleeAttackIfReady();
|
||||
|
|
@ -108,7 +108,7 @@ void CasterAI::EnterCombat(Unit* who)
|
|||
if (spells.empty())
|
||||
return;
|
||||
|
||||
uint32 spell = rand()%spells.size();
|
||||
uint32 spell = rand() % spells.size();
|
||||
uint32 count = 0;
|
||||
for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr, ++count)
|
||||
{
|
||||
|
|
@ -219,7 +219,7 @@ bool TurretAI::CanAIAttack(const Unit* /*who*/) const
|
|||
{
|
||||
// TODO: use one function to replace it
|
||||
if (!me->IsWithinCombatRange(me->GetVictim(), me->m_CombatDistance)
|
||||
|| (m_minRange && me->IsWithinCombatRange(me->GetVictim(), m_minRange)))
|
||||
|| (m_minRange && me->IsWithinCombatRange(me->GetVictim(), m_minRange)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,94 +15,94 @@ class Creature;
|
|||
|
||||
class AggressorAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit AggressorAI(Creature* c) : CreatureAI(c) {}
|
||||
public:
|
||||
explicit AggressorAI(Creature* c) : CreatureAI(c) {}
|
||||
|
||||
void UpdateAI(uint32);
|
||||
static int Permissible(const Creature*);
|
||||
void UpdateAI(uint32);
|
||||
static int Permissible(const Creature*);
|
||||
};
|
||||
|
||||
typedef std::vector<uint32> SpellVct;
|
||||
|
||||
class CombatAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit CombatAI(Creature* c) : CreatureAI(c) {}
|
||||
public:
|
||||
explicit CombatAI(Creature* c) : CreatureAI(c) {}
|
||||
|
||||
void InitializeAI();
|
||||
void Reset();
|
||||
void EnterCombat(Unit* who);
|
||||
void JustDied(Unit* killer);
|
||||
void UpdateAI(uint32 diff);
|
||||
void InitializeAI();
|
||||
void Reset();
|
||||
void EnterCombat(Unit* who);
|
||||
void JustDied(Unit* killer);
|
||||
void UpdateAI(uint32 diff);
|
||||
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
|
||||
protected:
|
||||
EventMap events;
|
||||
SpellVct spells;
|
||||
protected:
|
||||
EventMap events;
|
||||
SpellVct spells;
|
||||
};
|
||||
|
||||
class CasterAI : public CombatAI
|
||||
{
|
||||
public:
|
||||
explicit CasterAI(Creature* c) : CombatAI(c) { m_attackDist = MELEE_RANGE; }
|
||||
void InitializeAI();
|
||||
void AttackStart(Unit* victim) { AttackStartCaster(victim, m_attackDist); }
|
||||
void UpdateAI(uint32 diff);
|
||||
void EnterCombat(Unit* /*who*/);
|
||||
private:
|
||||
float m_attackDist;
|
||||
public:
|
||||
explicit CasterAI(Creature* c) : CombatAI(c) { m_attackDist = MELEE_RANGE; }
|
||||
void InitializeAI();
|
||||
void AttackStart(Unit* victim) { AttackStartCaster(victim, m_attackDist); }
|
||||
void UpdateAI(uint32 diff);
|
||||
void EnterCombat(Unit* /*who*/);
|
||||
private:
|
||||
float m_attackDist;
|
||||
};
|
||||
|
||||
struct ArcherAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit ArcherAI(Creature* c);
|
||||
void AttackStart(Unit* who);
|
||||
void UpdateAI(uint32 diff);
|
||||
public:
|
||||
explicit ArcherAI(Creature* c);
|
||||
void AttackStart(Unit* who);
|
||||
void UpdateAI(uint32 diff);
|
||||
|
||||
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
|
||||
protected:
|
||||
float m_minRange;
|
||||
protected:
|
||||
float m_minRange;
|
||||
};
|
||||
|
||||
struct TurretAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit TurretAI(Creature* c);
|
||||
bool CanAIAttack(const Unit* who) const;
|
||||
void AttackStart(Unit* who);
|
||||
void UpdateAI(uint32 diff);
|
||||
public:
|
||||
explicit TurretAI(Creature* c);
|
||||
bool CanAIAttack(const Unit* who) const;
|
||||
void AttackStart(Unit* who);
|
||||
void UpdateAI(uint32 diff);
|
||||
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
|
||||
protected:
|
||||
float m_minRange;
|
||||
protected:
|
||||
float m_minRange;
|
||||
};
|
||||
|
||||
#define VEHICLE_CONDITION_CHECK_TIME 1000
|
||||
#define VEHICLE_DISMISS_TIME 5000
|
||||
struct VehicleAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit VehicleAI(Creature* creature);
|
||||
public:
|
||||
explicit VehicleAI(Creature* creature);
|
||||
|
||||
void UpdateAI(uint32 diff);
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void OnCharmed(bool apply);
|
||||
void UpdateAI(uint32 diff);
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void OnCharmed(bool apply);
|
||||
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
|
||||
private:
|
||||
void LoadConditions();
|
||||
void CheckConditions(uint32 diff);
|
||||
ConditionList conditions;
|
||||
uint32 m_ConditionsTimer;
|
||||
bool m_DoDismiss;
|
||||
uint32 m_DismissTimer;
|
||||
private:
|
||||
void LoadConditions();
|
||||
void CheckConditions(uint32 diff);
|
||||
ConditionList conditions;
|
||||
uint32 m_ConditionsTimer;
|
||||
bool m_DoDismiss;
|
||||
uint32 m_DismissTimer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,49 +16,49 @@
|
|||
|
||||
class GameObjectAI
|
||||
{
|
||||
protected:
|
||||
GameObject* const go;
|
||||
public:
|
||||
explicit GameObjectAI(GameObject* g) : go(g) {}
|
||||
virtual ~GameObjectAI() {}
|
||||
protected:
|
||||
GameObject* const go;
|
||||
public:
|
||||
explicit GameObjectAI(GameObject* g) : go(g) {}
|
||||
virtual ~GameObjectAI() {}
|
||||
|
||||
virtual void UpdateAI(uint32 /*diff*/) {}
|
||||
virtual void UpdateAI(uint32 /*diff*/) {}
|
||||
|
||||
virtual void InitializeAI() { Reset(); }
|
||||
virtual void InitializeAI() { Reset(); }
|
||||
|
||||
virtual void Reset() { }
|
||||
virtual void Reset() { }
|
||||
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param = 0 */) {}
|
||||
virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {}
|
||||
virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param = 0 */) {}
|
||||
virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {}
|
||||
virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
|
||||
|
||||
static int Permissible(GameObject const* go);
|
||||
static int Permissible(GameObject const* go);
|
||||
|
||||
virtual bool GossipHello(Player* /*player*/, bool /*reportUse*/) { return false; }
|
||||
virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
|
||||
virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; }
|
||||
virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; }
|
||||
virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
|
||||
virtual uint32 GetDialogStatus(Player* /*player*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
|
||||
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
|
||||
virtual uint32 GetData(uint32 /*id*/) const { return 0; }
|
||||
virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
|
||||
virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
|
||||
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
|
||||
virtual void EventInform(uint32 /*eventId*/) {}
|
||||
virtual void SpellHit(Unit* /*unit*/, const SpellInfo* /*spellInfo*/) {}
|
||||
virtual bool GossipHello(Player* /*player*/, bool /*reportUse*/) { return false; }
|
||||
virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
|
||||
virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; }
|
||||
virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; }
|
||||
virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
|
||||
virtual uint32 GetDialogStatus(Player* /*player*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
|
||||
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
|
||||
virtual uint32 GetData(uint32 /*id*/) const { return 0; }
|
||||
virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
|
||||
virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
|
||||
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
|
||||
virtual void EventInform(uint32 /*eventId*/) {}
|
||||
virtual void SpellHit(Unit* /*unit*/, const SpellInfo* /*spellInfo*/) {}
|
||||
};
|
||||
|
||||
class NullGameObjectAI : public GameObjectAI
|
||||
{
|
||||
public:
|
||||
explicit NullGameObjectAI(GameObject* g);
|
||||
public:
|
||||
explicit NullGameObjectAI(GameObject* g);
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) {}
|
||||
void UpdateAI(uint32 /*diff*/) {}
|
||||
|
||||
static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
|
||||
static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ class Creature;
|
|||
|
||||
class GuardAI : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
explicit GuardAI(Creature* creature);
|
||||
public:
|
||||
explicit GuardAI(Creature* creature);
|
||||
|
||||
static int Permissible(Creature const* creature);
|
||||
static int Permissible(Creature const* creature);
|
||||
|
||||
void Reset();
|
||||
void EnterEvadeMode();
|
||||
void JustDied(Unit* killer);
|
||||
void Reset();
|
||||
void EnterEvadeMode();
|
||||
void JustDied(Unit* killer);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,65 +12,65 @@
|
|||
|
||||
class PassiveAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit PassiveAI(Creature* c);
|
||||
public:
|
||||
explicit PassiveAI(Creature* c);
|
||||
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void UpdateAI(uint32);
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void UpdateAI(uint32);
|
||||
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
class PossessedAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit PossessedAI(Creature* c);
|
||||
public:
|
||||
explicit PossessedAI(Creature* c);
|
||||
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit* target);
|
||||
void UpdateAI(uint32);
|
||||
void EnterEvadeMode() {}
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit* target);
|
||||
void UpdateAI(uint32);
|
||||
void EnterEvadeMode() {}
|
||||
|
||||
void JustDied(Unit*);
|
||||
void KilledUnit(Unit* victim);
|
||||
void JustDied(Unit*);
|
||||
void KilledUnit(Unit* victim);
|
||||
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
class NullCreatureAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit NullCreatureAI(Creature* c);
|
||||
public:
|
||||
explicit NullCreatureAI(Creature* c);
|
||||
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void UpdateAI(uint32) {}
|
||||
void EnterEvadeMode() {}
|
||||
void OnCharmed(bool /*apply*/) {}
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void UpdateAI(uint32) {}
|
||||
void EnterEvadeMode() {}
|
||||
void OnCharmed(bool /*apply*/) {}
|
||||
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
class CritterAI : public PassiveAI
|
||||
{
|
||||
public:
|
||||
explicit CritterAI(Creature* c) : PassiveAI(c) { _combatTimer = 0; }
|
||||
public:
|
||||
explicit CritterAI(Creature* c) : PassiveAI(c) { _combatTimer = 0; }
|
||||
|
||||
void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask);
|
||||
void EnterEvadeMode();
|
||||
void UpdateAI(uint32);
|
||||
void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask);
|
||||
void EnterEvadeMode();
|
||||
void UpdateAI(uint32);
|
||||
|
||||
// Xinef: Added
|
||||
private:
|
||||
uint32 _combatTimer;
|
||||
private:
|
||||
uint32 _combatTimer;
|
||||
};
|
||||
|
||||
class TriggerAI : public NullCreatureAI
|
||||
{
|
||||
public:
|
||||
explicit TriggerAI(Creature* c) : NullCreatureAI(c) {}
|
||||
void IsSummonedBy(Unit* summoner);
|
||||
public:
|
||||
explicit TriggerAI(Creature* c) : NullCreatureAI(c) {}
|
||||
void IsSummonedBy(Unit* summoner);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ bool PetAI::_needToStop()
|
|||
return true;
|
||||
|
||||
// xinef: dont allow to follow targets out of visibility range
|
||||
if (me->GetExactDist(me->GetVictim()) > me->GetVisibilityRange()-5.0f)
|
||||
if (me->GetExactDist(me->GetVictim()) > me->GetVisibilityRange() - 5.0f)
|
||||
return true;
|
||||
|
||||
// dont allow pets to follow targets far away from owner
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
if (owner->GetExactDist(me) >= (owner->GetVisibilityRange()-10.0f))
|
||||
if (owner->GetExactDist(me) >= (owner->GetVisibilityRange() - 10.0f))
|
||||
return true;
|
||||
|
||||
if (!me->_CanDetectFeignDeathOf(me->GetVictim()))
|
||||
|
|
@ -95,39 +95,39 @@ bool PetAI::_canMeleeAttack()
|
|||
case ENTRY_IMP:
|
||||
case ENTRY_WATER_ELEMENTAL:
|
||||
case ENTRY_WATER_ELEMENTAL_PERM:
|
||||
{
|
||||
for (uint8 i = 0; i < me->GetPetAutoSpellSize(); ++i)
|
||||
{
|
||||
uint32 spellID = me->GetPetAutoSpellOnPos(i);
|
||||
switch (spellID)
|
||||
for (uint8 i = 0; i < me->GetPetAutoSpellSize(); ++i)
|
||||
{
|
||||
case IMP_FIREBOLT_RANK_1:
|
||||
case IMP_FIREBOLT_RANK_2:
|
||||
case IMP_FIREBOLT_RANK_3:
|
||||
case IMP_FIREBOLT_RANK_4:
|
||||
case IMP_FIREBOLT_RANK_5:
|
||||
case IMP_FIREBOLT_RANK_6:
|
||||
case IMP_FIREBOLT_RANK_7:
|
||||
case IMP_FIREBOLT_RANK_8:
|
||||
case IMP_FIREBOLT_RANK_9:
|
||||
case WATER_ELEMENTAL_WATERBOLT_1:
|
||||
case WATER_ELEMENTAL_WATERBOLT_2:
|
||||
uint32 spellID = me->GetPetAutoSpellOnPos(i);
|
||||
switch (spellID)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
|
||||
int32 mana = me->GetPower(POWER_MANA);
|
||||
case IMP_FIREBOLT_RANK_1:
|
||||
case IMP_FIREBOLT_RANK_2:
|
||||
case IMP_FIREBOLT_RANK_3:
|
||||
case IMP_FIREBOLT_RANK_4:
|
||||
case IMP_FIREBOLT_RANK_5:
|
||||
case IMP_FIREBOLT_RANK_6:
|
||||
case IMP_FIREBOLT_RANK_7:
|
||||
case IMP_FIREBOLT_RANK_8:
|
||||
case IMP_FIREBOLT_RANK_9:
|
||||
case WATER_ELEMENTAL_WATERBOLT_1:
|
||||
case WATER_ELEMENTAL_WATERBOLT_2:
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
|
||||
int32 mana = me->GetPower(POWER_MANA);
|
||||
|
||||
if (mana >= spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
|
||||
{
|
||||
combatRange = spellInfo->GetMaxRange();
|
||||
return true;
|
||||
}
|
||||
if (mana >= spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
|
||||
{
|
||||
combatRange = spellInfo->GetMaxRange();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ void PetAI::UpdateAllies()
|
|||
Unit* owner = me->GetCharmerOrOwner();
|
||||
Group* group = nullptr;
|
||||
|
||||
m_updateAlliesTimer = 10*IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
|
||||
m_updateAlliesTimer = 10 * IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
|
||||
|
||||
if (!owner)
|
||||
return;
|
||||
|
|
@ -622,29 +622,29 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
|
|||
switch (moveType)
|
||||
{
|
||||
case POINT_MOTION_TYPE:
|
||||
{
|
||||
// Pet is returning to where stay was clicked. data should be
|
||||
// pet's GUIDLow since we set that as the waypoint ID
|
||||
if (data == me->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsAtStay(true);
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
// Pet is returning to where stay was clicked. data should be
|
||||
// pet's GUIDLow since we set that as the waypoint ID
|
||||
if (data == me->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsAtStay(true);
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FOLLOW_MOTION_TYPE:
|
||||
{
|
||||
// If data is owner's GUIDLow then we've reached follow point,
|
||||
// otherwise we're probably chasing a creature
|
||||
if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsFollowing(true);
|
||||
// If data is owner's GUIDLow then we've reached follow point,
|
||||
// otherwise we're probably chasing a creature
|
||||
if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsFollowing(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -698,7 +698,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
|
|||
// Stay - can attack if target is within range or commanded to
|
||||
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
|
||||
return (me->IsWithinMeleeRange(target) || me->GetCharmInfo()->IsCommandAttack());
|
||||
|
||||
|
||||
// Pets attacking something (or chasing) should only switch targets if owner tells them to
|
||||
if (me->GetVictim() && me->GetVictim() != target)
|
||||
{
|
||||
|
|
@ -708,14 +708,14 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
|
|||
ownerTarget = owner->GetSelectedUnit();
|
||||
else
|
||||
ownerTarget = me->GetCharmerOrOwner()->GetVictim();
|
||||
|
||||
|
||||
if (ownerTarget && me->GetCharmInfo()->IsCommandAttack())
|
||||
return (target->GetGUID() == ownerTarget->GetGUID());
|
||||
}
|
||||
|
||||
// Follow
|
||||
if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
|
||||
return !me->GetCharmInfo()->IsReturning();
|
||||
return !me->GetCharmInfo()->IsReturning();
|
||||
|
||||
// default, though we shouldn't ever get here
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -34,47 +34,47 @@ enum SpecialPets
|
|||
|
||||
class PetAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
explicit PetAI(Creature* c);
|
||||
explicit PetAI(Creature* c);
|
||||
|
||||
void UpdateAI(uint32);
|
||||
static int Permissible(const Creature*);
|
||||
void UpdateAI(uint32);
|
||||
static int Permissible(const Creature*);
|
||||
|
||||
void KilledUnit(Unit* /*victim*/);
|
||||
void AttackStart(Unit* target);
|
||||
void MovementInform(uint32 moveType, uint32 data);
|
||||
void OwnerAttackedBy(Unit* attacker);
|
||||
void OwnerAttacked(Unit* target);
|
||||
void AttackedBy(Unit* attacker);
|
||||
void ReceiveEmote(Player* player, uint32 textEmote);
|
||||
void KilledUnit(Unit* /*victim*/);
|
||||
void AttackStart(Unit* target);
|
||||
void MovementInform(uint32 moveType, uint32 data);
|
||||
void OwnerAttackedBy(Unit* attacker);
|
||||
void OwnerAttacked(Unit* target);
|
||||
void AttackedBy(Unit* attacker);
|
||||
void ReceiveEmote(Player* player, uint32 textEmote);
|
||||
|
||||
// The following aren't used by the PetAI but need to be defined to override
|
||||
// default CreatureAI functions which interfere with the PetAI
|
||||
//
|
||||
void MoveInLineOfSight(Unit* /*who*/) {} // CreatureAI interferes with returning pets
|
||||
void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets
|
||||
void EnterEvadeMode() {} // For fleeing, pets don't use this type of Evade mechanic
|
||||
void SpellHit(Unit* caster, const SpellInfo* spellInfo);
|
||||
// The following aren't used by the PetAI but need to be defined to override
|
||||
// default CreatureAI functions which interfere with the PetAI
|
||||
//
|
||||
void MoveInLineOfSight(Unit* /*who*/) {} // CreatureAI interferes with returning pets
|
||||
void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets
|
||||
void EnterEvadeMode() {} // For fleeing, pets don't use this type of Evade mechanic
|
||||
void SpellHit(Unit* caster, const SpellInfo* spellInfo);
|
||||
|
||||
private:
|
||||
bool _isVisible(Unit*) const;
|
||||
bool _needToStop(void);
|
||||
void _stopAttack(void);
|
||||
void _doMeleeAttack();
|
||||
bool _canMeleeAttack();
|
||||
private:
|
||||
bool _isVisible(Unit*) const;
|
||||
bool _needToStop(void);
|
||||
void _stopAttack(void);
|
||||
void _doMeleeAttack();
|
||||
bool _canMeleeAttack();
|
||||
|
||||
void UpdateAllies();
|
||||
void UpdateAllies();
|
||||
|
||||
TimeTracker i_tracker;
|
||||
std::set<uint64> m_AllySet;
|
||||
uint32 m_updateAlliesTimer;
|
||||
float combatRange;
|
||||
TimeTracker i_tracker;
|
||||
std::set<uint64> m_AllySet;
|
||||
uint32 m_updateAlliesTimer;
|
||||
float combatRange;
|
||||
|
||||
Unit* SelectNextTarget(bool allowAutoSelect) const;
|
||||
void HandleReturnMovement();
|
||||
void DoAttack(Unit* target, bool chase);
|
||||
bool CanAttack(Unit* target, const SpellInfo* spellInfo = nullptr);
|
||||
void ClearCharmInfoFlags();
|
||||
Unit* SelectNextTarget(bool allowAutoSelect) const;
|
||||
void HandleReturnMovement();
|
||||
void DoAttack(Unit* target, bool chase);
|
||||
bool CanAttack(Unit* target, const SpellInfo* spellInfo = nullptr);
|
||||
void ClearCharmInfoFlags();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ class Unit;
|
|||
|
||||
class ReactorAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
explicit ReactorAI(Creature* c) : CreatureAI(c) {}
|
||||
explicit ReactorAI(Creature* c) : CreatureAI(c) {}
|
||||
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void UpdateAI(uint32 diff);
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void UpdateAI(uint32 diff);
|
||||
|
||||
static int Permissible(const Creature*);
|
||||
static int Permissible(const Creature*);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
|
|||
|
||||
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
|
||||
if (!victim ||
|
||||
!victim->isTargetableForAttack(true, me) || !me->IsWithinDistInMap(victim, max_range) ||
|
||||
me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim))
|
||||
!victim->isTargetableForAttack(true, me) || !me->IsWithinDistInMap(victim, max_range) ||
|
||||
me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim))
|
||||
{
|
||||
victim = nullptr;
|
||||
acore::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range);
|
||||
|
|
@ -96,7 +96,7 @@ void TotemAI::AttackStart(Unit* /*victim*/)
|
|||
// Sentry totem sends ping on attack
|
||||
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
WorldPacket data(MSG_MINIMAP_PING, (8+4+4));
|
||||
WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4));
|
||||
data << me->GetGUID();
|
||||
data << me->GetPositionX();
|
||||
data << me->GetPositionY();
|
||||
|
|
|
|||
|
|
@ -15,35 +15,35 @@ class Totem;
|
|||
|
||||
class TotemAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
explicit TotemAI(Creature* c);
|
||||
explicit TotemAI(Creature* c);
|
||||
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
void AttackStart(Unit* victim);
|
||||
void EnterEvadeMode();
|
||||
void SpellHit(Unit* /*caster*/, const SpellInfo* /*spellInfo*/);
|
||||
void DoAction(int32 param);
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
void AttackStart(Unit* victim);
|
||||
void EnterEvadeMode();
|
||||
void SpellHit(Unit* /*caster*/, const SpellInfo* /*spellInfo*/);
|
||||
void DoAction(int32 param);
|
||||
|
||||
void UpdateAI(uint32 diff);
|
||||
static int Permissible(Creature const* creature);
|
||||
void UpdateAI(uint32 diff);
|
||||
static int Permissible(Creature const* creature);
|
||||
|
||||
private:
|
||||
uint64 i_victimGuid;
|
||||
private:
|
||||
uint64 i_victimGuid;
|
||||
};
|
||||
|
||||
class KillMagnetEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
KillMagnetEvent(Unit& self) : _self(self) { }
|
||||
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
_self.setDeathState(JUST_DIED);
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
KillMagnetEvent(Unit& self) : _self(self) { }
|
||||
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
_self.setDeathState(JUST_DIED);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
Unit& _self;
|
||||
protected:
|
||||
Unit& _self;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void UnitAI::DoMeleeAttackIfReady()
|
|||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
Unit *victim = me->GetVictim();
|
||||
Unit* victim = me->GetVictim();
|
||||
if (!victim || !victim->IsInWorld())
|
||||
return;
|
||||
|
||||
|
|
@ -130,32 +130,40 @@ void UnitAI::DoCast(uint32 spellId)
|
|||
switch (AISpellInfo[spellId].target)
|
||||
{
|
||||
default:
|
||||
case AITARGET_SELF: target = me; break;
|
||||
case AITARGET_VICTIM: target = me->GetVictim(); break;
|
||||
case AITARGET_SELF:
|
||||
target = me;
|
||||
break;
|
||||
case AITARGET_VICTIM:
|
||||
target = me->GetVictim();
|
||||
break;
|
||||
case AITARGET_ENEMY:
|
||||
{
|
||||
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
bool playerOnly = spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS);
|
||||
//float range = GetSpellMaxRange(spellInfo, false);
|
||||
target = SelectTarget(SELECT_TARGET_RANDOM, 0, spellInfo->GetMaxRange(false), playerOnly);
|
||||
{
|
||||
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
bool playerOnly = spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS);
|
||||
//float range = GetSpellMaxRange(spellInfo, false);
|
||||
target = SelectTarget(SELECT_TARGET_RANDOM, 0, spellInfo->GetMaxRange(false), playerOnly);
|
||||
break;
|
||||
}
|
||||
case AITARGET_ALLY:
|
||||
target = me;
|
||||
break;
|
||||
case AITARGET_BUFF:
|
||||
target = me;
|
||||
break;
|
||||
}
|
||||
case AITARGET_ALLY: target = me; break;
|
||||
case AITARGET_BUFF: target = me; break;
|
||||
case AITARGET_DEBUFF:
|
||||
{
|
||||
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
bool playerOnly = spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS);
|
||||
float range = spellInfo->GetMaxRange(false);
|
||||
{
|
||||
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
bool playerOnly = spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS);
|
||||
float range = spellInfo->GetMaxRange(false);
|
||||
|
||||
DefaultTargetSelector targetSelector(me, range, playerOnly, -(int32)spellId);
|
||||
if (!(spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_VICTIM)
|
||||
&& targetSelector(me->GetVictim()))
|
||||
target = me->GetVictim();
|
||||
else
|
||||
target = SelectTarget(SELECT_TARGET_RANDOM, 0, targetSelector);
|
||||
break;
|
||||
}
|
||||
DefaultTargetSelector targetSelector(me, range, playerOnly, -(int32)spellId);
|
||||
if (!(spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_VICTIM)
|
||||
&& targetSelector(me->GetVictim()))
|
||||
target = me->GetVictim();
|
||||
else
|
||||
target = SelectTarget(SELECT_TARGET_RANDOM, 0, targetSelector);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (target)
|
||||
|
|
@ -213,27 +221,27 @@ void UnitAI::FillAISpellInfo()
|
|||
|
||||
if (!spellInfo->GetMaxRange(false))
|
||||
UPDATE_TARGET(AITARGET_SELF)
|
||||
else
|
||||
{
|
||||
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
else
|
||||
{
|
||||
uint32 targetType = spellInfo->Effects[j].TargetA.GetTarget();
|
||||
|
||||
if (targetType == TARGET_UNIT_TARGET_ENEMY
|
||||
|| targetType == TARGET_DEST_TARGET_ENEMY)
|
||||
UPDATE_TARGET(AITARGET_VICTIM)
|
||||
else if (targetType == TARGET_UNIT_DEST_AREA_ENEMY)
|
||||
UPDATE_TARGET(AITARGET_ENEMY)
|
||||
|
||||
if (spellInfo->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
|
||||
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
{
|
||||
if (targetType == TARGET_UNIT_TARGET_ENEMY)
|
||||
UPDATE_TARGET(AITARGET_DEBUFF)
|
||||
else if (spellInfo->IsPositive())
|
||||
UPDATE_TARGET(AITARGET_BUFF)
|
||||
uint32 targetType = spellInfo->Effects[j].TargetA.GetTarget();
|
||||
|
||||
if (targetType == TARGET_UNIT_TARGET_ENEMY
|
||||
|| targetType == TARGET_DEST_TARGET_ENEMY)
|
||||
UPDATE_TARGET(AITARGET_VICTIM)
|
||||
else if (targetType == TARGET_UNIT_DEST_AREA_ENEMY)
|
||||
UPDATE_TARGET(AITARGET_ENEMY)
|
||||
|
||||
if (spellInfo->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
|
||||
{
|
||||
if (targetType == TARGET_UNIT_TARGET_ENEMY)
|
||||
UPDATE_TARGET(AITARGET_DEBUFF)
|
||||
else if (spellInfo->IsPositive())
|
||||
UPDATE_TARGET(AITARGET_BUFF)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AIInfo->realCooldown = spellInfo->RecoveryTime + spellInfo->StartRecoveryTime;
|
||||
AIInfo->maxRange = spellInfo->GetMaxRange(false) * 3 / 4;
|
||||
}
|
||||
|
|
@ -247,7 +255,7 @@ void PlayerAI::OnCharmed(bool apply)
|
|||
|
||||
void SimpleCharmedAI::UpdateAI(uint32 /*diff*/)
|
||||
{
|
||||
Creature* charmer = me->GetCharmer()->ToCreature();
|
||||
Creature* charmer = me->GetCharmer()->ToCreature();
|
||||
|
||||
//kill self if charm aura has infinite duration
|
||||
if (charmer->IsInEvadeMode())
|
||||
|
|
|
|||
|
|
@ -80,13 +80,13 @@ struct DefaultTargetSelector : public acore::unary_function<Unit*, bool>
|
|||
// TODO: Add more checks from Spell::CheckCast
|
||||
struct SpellTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
{
|
||||
public:
|
||||
SpellTargetSelector(Unit* caster, uint32 spellId);
|
||||
bool operator()(Unit const* target) const;
|
||||
public:
|
||||
SpellTargetSelector(Unit* caster, uint32 spellId);
|
||||
bool operator()(Unit const* target) const;
|
||||
|
||||
private:
|
||||
Unit const* _caster;
|
||||
SpellInfo const* _spellInfo;
|
||||
private:
|
||||
Unit const* _caster;
|
||||
SpellInfo const* _spellInfo;
|
||||
};
|
||||
|
||||
// Very simple target selector, will just skip main target
|
||||
|
|
@ -94,13 +94,13 @@ struct SpellTargetSelector : public acore::unary_function<Unit*, bool>
|
|||
// because tank will not be in the temporary list
|
||||
struct NonTankTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
{
|
||||
public:
|
||||
NonTankTargetSelector(Creature* source, bool playerOnly = true) : _source(source), _playerOnly(playerOnly) { }
|
||||
bool operator()(Unit const* target) const;
|
||||
public:
|
||||
NonTankTargetSelector(Creature* source, bool playerOnly = true) : _source(source), _playerOnly(playerOnly) { }
|
||||
bool operator()(Unit const* target) const;
|
||||
|
||||
private:
|
||||
Creature const* _source;
|
||||
bool _playerOnly;
|
||||
private:
|
||||
Creature const* _source;
|
||||
bool _playerOnly;
|
||||
};
|
||||
|
||||
// Simple selector for units using mana
|
||||
|
|
@ -165,165 +165,165 @@ private:
|
|||
|
||||
class UnitAI
|
||||
{
|
||||
protected:
|
||||
Unit* const me;
|
||||
public:
|
||||
explicit UnitAI(Unit* unit) : me(unit) {}
|
||||
virtual ~UnitAI() {}
|
||||
protected:
|
||||
Unit* const me;
|
||||
public:
|
||||
explicit UnitAI(Unit* unit) : me(unit) {}
|
||||
virtual ~UnitAI() {}
|
||||
|
||||
virtual bool CanAIAttack(Unit const* /*target*/) const { return true; }
|
||||
virtual void AttackStart(Unit* /*target*/);
|
||||
virtual void UpdateAI(uint32 diff) = 0;
|
||||
virtual bool CanAIAttack(Unit const* /*target*/) const { return true; }
|
||||
virtual void AttackStart(Unit* /*target*/);
|
||||
virtual void UpdateAI(uint32 diff) = 0;
|
||||
|
||||
virtual void InitializeAI() { if (!me->isDead()) Reset(); }
|
||||
virtual void InitializeAI() { if (!me->isDead()) Reset(); }
|
||||
|
||||
virtual void Reset() {};
|
||||
virtual void Reset() {};
|
||||
|
||||
// Called when unit is charmed
|
||||
virtual void OnCharmed(bool apply) = 0;
|
||||
// Called when unit is charmed
|
||||
virtual void OnCharmed(bool apply) = 0;
|
||||
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param*/) {}
|
||||
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {}
|
||||
virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; }
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param*/) {}
|
||||
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {}
|
||||
virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; }
|
||||
|
||||
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
// Select the targets satifying the predicate.
|
||||
// predicate shall extend acore::unary_function<Unit*, bool>
|
||||
template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
|
||||
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
// Select the targets satifying the predicate.
|
||||
// predicate shall extend acore::unary_function<Unit*, bool>
|
||||
template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
|
||||
{
|
||||
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
|
||||
if (position >= threatlist.size())
|
||||
return nullptr;
|
||||
|
||||
std::list<Unit*> targetList;
|
||||
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
if (predicate((*itr)->getTarget()))
|
||||
targetList.push_back((*itr)->getTarget());
|
||||
|
||||
if (position >= targetList.size())
|
||||
return nullptr;
|
||||
|
||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||
targetList.sort(acore::ObjectDistanceOrderPred(me));
|
||||
|
||||
switch (targetType)
|
||||
{
|
||||
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
|
||||
if (position >= threatlist.size())
|
||||
return nullptr;
|
||||
|
||||
std::list<Unit*> targetList;
|
||||
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
if (predicate((*itr)->getTarget()))
|
||||
targetList.push_back((*itr)->getTarget());
|
||||
|
||||
if (position >= targetList.size())
|
||||
return nullptr;
|
||||
|
||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||
targetList.sort(acore::ObjectDistanceOrderPred(me));
|
||||
|
||||
switch (targetType)
|
||||
{
|
||||
case SELECT_TARGET_NEAREST:
|
||||
case SELECT_TARGET_TOPAGGRO:
|
||||
case SELECT_TARGET_NEAREST:
|
||||
case SELECT_TARGET_TOPAGGRO:
|
||||
{
|
||||
std::list<Unit*>::iterator itr = targetList.begin();
|
||||
std::advance(itr, position);
|
||||
return *itr;
|
||||
}
|
||||
case SELECT_TARGET_FARTHEST:
|
||||
case SELECT_TARGET_BOTTOMAGGRO:
|
||||
case SELECT_TARGET_FARTHEST:
|
||||
case SELECT_TARGET_BOTTOMAGGRO:
|
||||
{
|
||||
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
|
||||
std::advance(ritr, position);
|
||||
return *ritr;
|
||||
}
|
||||
case SELECT_TARGET_RANDOM:
|
||||
case SELECT_TARGET_RANDOM:
|
||||
{
|
||||
std::list<Unit*>::iterator itr = targetList.begin();
|
||||
std::advance(itr, urand(position, targetList.size() - 1));
|
||||
return *itr;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Select the targets satifying the predicate.
|
||||
// predicate shall extend acore::unary_function<Unit*, bool>
|
||||
template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
|
||||
{
|
||||
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
|
||||
if (threatlist.empty())
|
||||
return;
|
||||
void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
|
||||
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
if (predicate((*itr)->getTarget()))
|
||||
targetList.push_back((*itr)->getTarget());
|
||||
// Select the targets satifying the predicate.
|
||||
// predicate shall extend acore::unary_function<Unit*, bool>
|
||||
template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
|
||||
{
|
||||
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
|
||||
if (threatlist.empty())
|
||||
return;
|
||||
|
||||
if (targetList.size() < maxTargets)
|
||||
return;
|
||||
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
if (predicate((*itr)->getTarget()))
|
||||
targetList.push_back((*itr)->getTarget());
|
||||
|
||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||
targetList.sort(acore::ObjectDistanceOrderPred(me));
|
||||
if (targetList.size() < maxTargets)
|
||||
return;
|
||||
|
||||
if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO)
|
||||
targetList.reverse();
|
||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||
targetList.sort(acore::ObjectDistanceOrderPred(me));
|
||||
|
||||
if (targetType == SELECT_TARGET_RANDOM)
|
||||
acore::Containers::RandomResizeList(targetList, maxTargets);
|
||||
else
|
||||
targetList.resize(maxTargets);
|
||||
}
|
||||
if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO)
|
||||
targetList.reverse();
|
||||
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
virtual void DamageDealt(Unit* /*victim*/, uint32& /*damage*/, DamageEffectType /*damageType*/) { }
|
||||
if (targetType == SELECT_TARGET_RANDOM)
|
||||
acore::Containers::RandomResizeList(targetList, maxTargets);
|
||||
else
|
||||
targetList.resize(maxTargets);
|
||||
}
|
||||
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
// Note: it for recalculation damage or special reaction at damage
|
||||
// for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also
|
||||
virtual void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/ ) {}
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
virtual void DamageDealt(Unit* /*victim*/, uint32& /*damage*/, DamageEffectType /*damageType*/) { }
|
||||
|
||||
// Called when the creature receives heal
|
||||
virtual void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) {}
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
// Note: it for recalculation damage or special reaction at damage
|
||||
// for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also
|
||||
virtual void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/ ) {}
|
||||
|
||||
// Called when the unit heals
|
||||
virtual void HealDone(Unit* /*done_to*/, uint32& /*addhealth*/) {}
|
||||
// Called when the creature receives heal
|
||||
virtual void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) {}
|
||||
|
||||
void AttackStartCaster(Unit* victim, float dist);
|
||||
// Called when the unit heals
|
||||
virtual void HealDone(Unit* /*done_to*/, uint32& /*addhealth*/) {}
|
||||
|
||||
void DoAddAuraToAllHostilePlayers(uint32 spellid);
|
||||
void DoCast(uint32 spellId);
|
||||
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
|
||||
inline void DoCastSelf(uint32 spellId, bool triggered = false) { DoCast(me, spellId, triggered); }
|
||||
void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false);
|
||||
void DoCastVictim(uint32 spellId, bool triggered = false);
|
||||
void DoCastAOE(uint32 spellId, bool triggered = false);
|
||||
void AttackStartCaster(Unit* victim, float dist);
|
||||
|
||||
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
|
||||
void DoAddAuraToAllHostilePlayers(uint32 spellid);
|
||||
void DoCast(uint32 spellId);
|
||||
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
|
||||
inline void DoCastSelf(uint32 spellId, bool triggered = false) { DoCast(me, spellId, triggered); }
|
||||
void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false);
|
||||
void DoCastVictim(uint32 spellId, bool triggered = false);
|
||||
void DoCastAOE(uint32 spellId, bool triggered = false);
|
||||
|
||||
void DoMeleeAttackIfReady();
|
||||
bool DoSpellAttackIfReady(uint32 spell);
|
||||
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
|
||||
|
||||
static AISpellInfoType* AISpellInfo;
|
||||
static void FillAISpellInfo();
|
||||
void DoMeleeAttackIfReady();
|
||||
bool DoSpellAttackIfReady(uint32 spell);
|
||||
|
||||
virtual void sGossipHello(Player* /*player*/) {}
|
||||
virtual void sGossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {}
|
||||
virtual void sGossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) {}
|
||||
virtual void sQuestAccept(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestSelect(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestComplete(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {}
|
||||
virtual void sOnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
|
||||
static AISpellInfoType* AISpellInfo;
|
||||
static void FillAISpellInfo();
|
||||
|
||||
virtual void sGossipHello(Player* /*player*/) {}
|
||||
virtual void sGossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {}
|
||||
virtual void sGossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) {}
|
||||
virtual void sQuestAccept(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestSelect(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestComplete(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {}
|
||||
virtual void sOnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
|
||||
};
|
||||
|
||||
class PlayerAI : public UnitAI
|
||||
{
|
||||
protected:
|
||||
Player* const me;
|
||||
public:
|
||||
explicit PlayerAI(Player* player) : UnitAI((Unit*)player), me(player) {}
|
||||
protected:
|
||||
Player* const me;
|
||||
public:
|
||||
explicit PlayerAI(Player* player) : UnitAI((Unit*)player), me(player) {}
|
||||
|
||||
void OnCharmed(bool apply);
|
||||
void OnCharmed(bool apply);
|
||||
};
|
||||
|
||||
class SimpleCharmedAI : public PlayerAI
|
||||
{
|
||||
public:
|
||||
void UpdateAI(uint32 diff);
|
||||
SimpleCharmedAI(Player* player): PlayerAI(player) {}
|
||||
public:
|
||||
void UpdateAI(uint32 diff);
|
||||
SimpleCharmedAI(Player* player): PlayerAI(player) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
|
|||
// pussywizard: civilian, non-combat pet or any other NOT HOSTILE TO ANYONE (!)
|
||||
if (me->IsMoveInLineOfSightDisabled())
|
||||
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return
|
||||
!who->IsInCombat() || // if not in combat, nothing more to do
|
||||
!me->IsWithinDist(who, ATTACK_DISTANCE)) // if in combat and in dist - neutral to all can actually assist other creatures
|
||||
!who->IsInCombat() || // if not in combat, nothing more to do
|
||||
!me->IsWithinDist(who, ATTACK_DISTANCE)) // if in combat and in dist - neutral to all can actually assist other creatures
|
||||
return;
|
||||
|
||||
if (me->CanStartAttack(who))
|
||||
|
|
|
|||
|
|
@ -53,122 +53,122 @@ enum SCEquip
|
|||
|
||||
class CreatureAI : public UnitAI
|
||||
{
|
||||
protected:
|
||||
Creature* const me;
|
||||
protected:
|
||||
Creature* const me;
|
||||
|
||||
bool UpdateVictim();
|
||||
bool UpdateVictimWithGaze();
|
||||
bool UpdateVictim();
|
||||
bool UpdateVictimWithGaze();
|
||||
|
||||
void SetGazeOn(Unit* target);
|
||||
void SetGazeOn(Unit* target);
|
||||
|
||||
Creature* DoSummon(uint32 entry, Position const& pos, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
Creature* DoSummon(uint32 entry, WorldObject* obj, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
Creature* DoSummon(uint32 entry, Position const& pos, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
Creature* DoSummon(uint32 entry, WorldObject* obj, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
|
||||
public:
|
||||
void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
|
||||
explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) {}
|
||||
public:
|
||||
void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
|
||||
explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) {}
|
||||
|
||||
virtual ~CreatureAI() {}
|
||||
virtual ~CreatureAI() {}
|
||||
|
||||
/// == Reactions At =================================
|
||||
/// == Reactions At =================================
|
||||
|
||||
// Called if IsVisible(Unit* who) is true at each who move, reaction at visibility zone enter
|
||||
void MoveInLineOfSight_Safe(Unit* who);
|
||||
// Called if IsVisible(Unit* who) is true at each who move, reaction at visibility zone enter
|
||||
void MoveInLineOfSight_Safe(Unit* who);
|
||||
|
||||
// Trigger Creature "Alert" state (creature can see stealthed unit)
|
||||
void TriggerAlert(Unit const* who) const;
|
||||
// Trigger Creature "Alert" state (creature can see stealthed unit)
|
||||
void TriggerAlert(Unit const* who) const;
|
||||
|
||||
// Called in Creature::Update when deathstate = DEAD. Inherited classes may maniuplate the ability to respawn based on scripted events.
|
||||
virtual bool CanRespawn() { return true; }
|
||||
// Called in Creature::Update when deathstate = DEAD. Inherited classes may maniuplate the ability to respawn based on scripted events.
|
||||
virtual bool CanRespawn() { return true; }
|
||||
|
||||
// Called for reaction at stopping attack at no attackers or targets
|
||||
virtual void EnterEvadeMode();
|
||||
// Called for reaction at stopping attack at no attackers or targets
|
||||
virtual void EnterEvadeMode();
|
||||
|
||||
// Called for reaction at enter to combat if not in combat yet (enemy can be nullptr)
|
||||
virtual void EnterCombat(Unit* /*victim*/) {}
|
||||
// Called for reaction at enter to combat if not in combat yet (enemy can be nullptr)
|
||||
virtual void EnterCombat(Unit* /*victim*/) {}
|
||||
|
||||
// Called when the creature is killed
|
||||
virtual void JustDied(Unit* /*killer*/) {}
|
||||
// Called when the creature is killed
|
||||
virtual void JustDied(Unit* /*killer*/) {}
|
||||
|
||||
// Called when the creature kills a unit
|
||||
virtual void KilledUnit(Unit* /*victim*/) {}
|
||||
// Called when the creature kills a unit
|
||||
virtual void KilledUnit(Unit* /*victim*/) {}
|
||||
|
||||
// Called when the creature summon successfully other creature
|
||||
virtual void JustSummoned(Creature* /*summon*/) {}
|
||||
virtual void IsSummonedBy(Unit* /*summoner*/) {}
|
||||
// Called when the creature summon successfully other creature
|
||||
virtual void JustSummoned(Creature* /*summon*/) {}
|
||||
virtual void IsSummonedBy(Unit* /*summoner*/) {}
|
||||
|
||||
virtual void SummonedCreatureDespawn(Creature* /*summon*/) {}
|
||||
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) {}
|
||||
virtual void SummonedCreatureDespawn(Creature* /*summon*/) {}
|
||||
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) {}
|
||||
|
||||
// Called when hit by a spell
|
||||
virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) {}
|
||||
// Called when hit by a spell
|
||||
virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) {}
|
||||
|
||||
// Called when spell hits a target
|
||||
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
|
||||
// Called when spell hits a target
|
||||
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
|
||||
|
||||
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
|
||||
virtual void AttackedBy(Unit* /*attacker*/) {}
|
||||
virtual bool IsEscorted() { return false; }
|
||||
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
|
||||
virtual void AttackedBy(Unit* /*attacker*/) {}
|
||||
virtual bool IsEscorted() { return false; }
|
||||
|
||||
// Called when creature is spawned or respawned (for reseting variables)
|
||||
virtual void JustRespawned() { Reset(); }
|
||||
// Called when creature is spawned or respawned (for reseting variables)
|
||||
virtual void JustRespawned() { Reset(); }
|
||||
|
||||
// Called at waypoint reached or point movement finished
|
||||
virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) {}
|
||||
// Called at waypoint reached or point movement finished
|
||||
virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) {}
|
||||
|
||||
void OnCharmed(bool apply);
|
||||
void OnCharmed(bool apply);
|
||||
|
||||
// Called at reaching home after evade
|
||||
virtual void JustReachedHome() {}
|
||||
// Called at reaching home after evade
|
||||
virtual void JustReachedHome() {}
|
||||
|
||||
void DoZoneInCombat(Creature* creature = NULL, float maxRangeToNearestTarget = 50.0f);
|
||||
void DoZoneInCombat(Creature* creature = NULL, float maxRangeToNearestTarget = 50.0f);
|
||||
|
||||
// Called at text emote receive from player
|
||||
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}
|
||||
// Called at text emote receive from player
|
||||
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}
|
||||
|
||||
// Called when owner takes damage
|
||||
virtual void OwnerAttackedBy(Unit* /*attacker*/) {}
|
||||
// Called when owner takes damage
|
||||
virtual void OwnerAttackedBy(Unit* /*attacker*/) {}
|
||||
|
||||
// Called when owner attacks something
|
||||
virtual void OwnerAttacked(Unit* /*target*/) {}
|
||||
// Called when owner attacks something
|
||||
virtual void OwnerAttacked(Unit* /*target*/) {}
|
||||
|
||||
/// == Triggered Actions Requested ==================
|
||||
/// == Triggered Actions Requested ==================
|
||||
|
||||
// Called when creature attack expected (if creature can and no have current victim)
|
||||
// Note: for reaction at hostile action must be called AttackedBy function.
|
||||
//virtual void AttackStart(Unit*) {}
|
||||
// Called when creature attack expected (if creature can and no have current victim)
|
||||
// Note: for reaction at hostile action must be called AttackedBy function.
|
||||
//virtual void AttackStart(Unit*) {}
|
||||
|
||||
// Called at World update tick
|
||||
//virtual void UpdateAI(uint32 /*diff*/) {}
|
||||
// Called at World update tick
|
||||
//virtual void UpdateAI(uint32 /*diff*/) {}
|
||||
|
||||
/// == State checks =================================
|
||||
/// == State checks =================================
|
||||
|
||||
// Is unit visible for MoveInLineOfSight
|
||||
//virtual bool IsVisible(Unit*) const { return false; }
|
||||
// Is unit visible for MoveInLineOfSight
|
||||
//virtual bool IsVisible(Unit*) const { return false; }
|
||||
|
||||
// called when the corpse of this creature gets removed
|
||||
virtual void CorpseRemoved(uint32& /*respawnDelay*/) {}
|
||||
// called when the corpse of this creature gets removed
|
||||
virtual void CorpseRemoved(uint32& /*respawnDelay*/) {}
|
||||
|
||||
// Called when victim entered water and creature can not enter water
|
||||
//virtual bool CanReachByRangeAttack(Unit*) { return false; }
|
||||
// Called when victim entered water and creature can not enter water
|
||||
//virtual bool CanReachByRangeAttack(Unit*) { return false; }
|
||||
|
||||
/// == Fields =======================================
|
||||
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {}
|
||||
/// == Fields =======================================
|
||||
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {}
|
||||
|
||||
virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { }
|
||||
virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { }
|
||||
|
||||
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
|
||||
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
|
||||
|
||||
virtual bool CanBeSeen(Player const* /*seer*/) { return true; }
|
||||
virtual bool CanBeSeen(Player const* /*seer*/) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void MoveInLineOfSight(Unit* /*who*/);
|
||||
protected:
|
||||
virtual void MoveInLineOfSight(Unit* /*who*/);
|
||||
|
||||
bool _EnterEvadeMode();
|
||||
bool _EnterEvadeMode();
|
||||
|
||||
private:
|
||||
bool m_MoveInLineOfSight_locked;
|
||||
private:
|
||||
bool m_MoveInLineOfSight_locked;
|
||||
};
|
||||
|
||||
enum Permitions
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include <type_traits>
|
||||
|
||||
template<typename First, typename Second, typename... Rest>
|
||||
static inline First const& RAND(First const& first, Second const& second, Rest const&... rest)
|
||||
static inline First const& RAND(First const& first, Second const& second, Rest const& ... rest)
|
||||
{
|
||||
std::reference_wrapper<typename std::add_const<First>::type> const pack[] = { first, second, rest... };
|
||||
return pack[urand(0, sizeof...(rest) + 1)].get();
|
||||
|
|
@ -44,7 +44,7 @@ enum AICondition
|
|||
struct AISpellInfoType
|
||||
{
|
||||
AISpellInfoType() : target(AITARGET_SELF), condition(AICOND_COMBAT)
|
||||
, cooldown(AI_DEFAULT_COOLDOWN), realCooldown(0), maxRange(0.0f){}
|
||||
, cooldown(AI_DEFAULT_COOLDOWN), realCooldown(0), maxRange(0.0f) {}
|
||||
AITarget target;
|
||||
AICondition condition;
|
||||
uint32 cooldown;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace FactorySelector
|
|||
return scriptedAI;
|
||||
|
||||
// AIname in db
|
||||
std::string ainame=creature->GetAIName();
|
||||
std::string ainame = creature->GetAIName();
|
||||
if (!ai_factory && !ainame.empty())
|
||||
ai_factory = ai_registry.GetRegistryItem(ainame);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
||||
*
|
||||
*
|
||||
*
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
|
@ -211,7 +211,7 @@ void ScriptedAI::DoPlayMusic(uint32 soundId, bool zone)
|
|||
|
||||
if (me && me->FindMap())
|
||||
{
|
||||
Map::PlayerList const &players = me->GetMap()->GetPlayers();
|
||||
Map::PlayerList const& players = me->GetMap()->GetPlayers();
|
||||
targets = new ObjectList();
|
||||
|
||||
if (!players.isEmpty())
|
||||
|
|
@ -278,11 +278,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
|
|||
|
||||
// Targets and Effects checked first as most used restrictions
|
||||
//Check the spell targets if specified
|
||||
if (targets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (targets-1))))
|
||||
if (targets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (targets - 1))))
|
||||
continue;
|
||||
|
||||
//Check the type of spell if we are looking for a specific spell type
|
||||
if (effects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (effects-1))))
|
||||
if (effects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (effects - 1))))
|
||||
continue;
|
||||
|
||||
//Check for school if specified
|
||||
|
|
@ -482,7 +482,7 @@ Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura
|
|||
tList.push_back(itr->GetSource());
|
||||
}
|
||||
if (!tList.empty())
|
||||
return tList[urand(0,tList.size()-1)];
|
||||
return tList[urand(0, tList.size() - 1)];
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public:
|
|||
void DespawnAll();
|
||||
|
||||
template <typename T>
|
||||
void DespawnIf(T const &predicate)
|
||||
void DespawnIf(T const& predicate)
|
||||
{
|
||||
storage_.remove_if(predicate);
|
||||
}
|
||||
|
|
@ -135,25 +135,25 @@ private:
|
|||
|
||||
class EntryCheckPredicate
|
||||
{
|
||||
public:
|
||||
EntryCheckPredicate(uint32 entry) : _entry(entry) {}
|
||||
bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; }
|
||||
public:
|
||||
EntryCheckPredicate(uint32 entry) : _entry(entry) {}
|
||||
bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; }
|
||||
|
||||
private:
|
||||
uint32 _entry;
|
||||
private:
|
||||
uint32 _entry;
|
||||
};
|
||||
|
||||
class PlayerOrPetCheck
|
||||
{
|
||||
public:
|
||||
bool operator() (WorldObject* unit) const
|
||||
{
|
||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID()))
|
||||
return true;
|
||||
public:
|
||||
bool operator() (WorldObject* unit) const
|
||||
{
|
||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
struct ScriptedAI : public CreatureAI
|
||||
|
|
@ -353,92 +353,92 @@ struct ScriptedAI : public CreatureAI
|
|||
|
||||
Player* SelectTargetFromPlayerList(float maxdist, uint32 excludeAura = 0, bool mustBeInLOS = false) const;
|
||||
|
||||
private:
|
||||
Difficulty _difficulty;
|
||||
uint32 _evadeCheckCooldown;
|
||||
bool _isCombatMovementAllowed;
|
||||
bool _isHeroic;
|
||||
private:
|
||||
Difficulty _difficulty;
|
||||
uint32 _evadeCheckCooldown;
|
||||
bool _isCombatMovementAllowed;
|
||||
bool _isHeroic;
|
||||
};
|
||||
|
||||
class BossAI : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
BossAI(Creature* creature, uint32 bossId);
|
||||
virtual ~BossAI() {}
|
||||
public:
|
||||
BossAI(Creature* creature, uint32 bossId);
|
||||
virtual ~BossAI() {}
|
||||
|
||||
InstanceScript* const instance;
|
||||
BossBoundaryMap const* GetBoundary() const { return _boundary; }
|
||||
InstanceScript* const instance;
|
||||
BossBoundaryMap const* GetBoundary() const { return _boundary; }
|
||||
|
||||
void JustSummoned(Creature* summon);
|
||||
void SummonedCreatureDespawn(Creature* summon);
|
||||
void JustSummoned(Creature* summon);
|
||||
void SummonedCreatureDespawn(Creature* summon);
|
||||
|
||||
virtual void UpdateAI(uint32 diff);
|
||||
virtual void UpdateAI(uint32 diff);
|
||||
|
||||
// Hook used to execute events scheduled into EventMap without the need
|
||||
// to override UpdateAI
|
||||
// note: You must re-schedule the event within this method if the event
|
||||
// is supposed to run more than once
|
||||
virtual void ExecuteEvent(uint32 /*eventId*/) { }
|
||||
// Hook used to execute events scheduled into EventMap without the need
|
||||
// to override UpdateAI
|
||||
// note: You must re-schedule the event within this method if the event
|
||||
// is supposed to run more than once
|
||||
virtual void ExecuteEvent(uint32 /*eventId*/) { }
|
||||
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
|
||||
void JustDied(Unit* /*killer*/) { _JustDied(); }
|
||||
void JustReachedHome() { _JustReachedHome(); }
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
|
||||
void JustDied(Unit* /*killer*/) { _JustDied(); }
|
||||
void JustReachedHome() { _JustReachedHome(); }
|
||||
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
void _JustReachedHome() { me->setActive(false); }
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
void _JustReachedHome() { me->setActive(false); }
|
||||
|
||||
bool CheckInRoom()
|
||||
{
|
||||
if (CheckBoundary(me))
|
||||
return true;
|
||||
bool CheckInRoom()
|
||||
{
|
||||
if (CheckBoundary(me))
|
||||
return true;
|
||||
|
||||
EnterEvadeMode();
|
||||
return false;
|
||||
}
|
||||
EnterEvadeMode();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckBoundary(Unit* who);
|
||||
void TeleportCheaters();
|
||||
bool CheckBoundary(Unit* who);
|
||||
void TeleportCheaters();
|
||||
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
|
||||
private:
|
||||
BossBoundaryMap const* const _boundary;
|
||||
uint32 const _bossId;
|
||||
private:
|
||||
BossBoundaryMap const* const _boundary;
|
||||
uint32 const _bossId;
|
||||
};
|
||||
|
||||
class WorldBossAI : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
WorldBossAI(Creature* creature);
|
||||
virtual ~WorldBossAI() {}
|
||||
public:
|
||||
WorldBossAI(Creature* creature);
|
||||
virtual ~WorldBossAI() {}
|
||||
|
||||
void JustSummoned(Creature* summon);
|
||||
void SummonedCreatureDespawn(Creature* summon);
|
||||
void JustSummoned(Creature* summon);
|
||||
void SummonedCreatureDespawn(Creature* summon);
|
||||
|
||||
virtual void UpdateAI(uint32 diff);
|
||||
virtual void UpdateAI(uint32 diff);
|
||||
|
||||
// Hook used to execute events scheduled into EventMap without the need
|
||||
// to override UpdateAI
|
||||
// note: You must re-schedule the event within this method if the event
|
||||
// is supposed to run more than once
|
||||
virtual void ExecuteEvent(uint32 /*eventId*/) { }
|
||||
// Hook used to execute events scheduled into EventMap without the need
|
||||
// to override UpdateAI
|
||||
// note: You must re-schedule the event within this method if the event
|
||||
// is supposed to run more than once
|
||||
virtual void ExecuteEvent(uint32 /*eventId*/) { }
|
||||
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
|
||||
void JustDied(Unit* /*killer*/) { _JustDied(); }
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
|
||||
void JustDied(Unit* /*killer*/) { _JustDied(); }
|
||||
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
};
|
||||
|
||||
// SD2 grid searchers.
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void npc_escortAI::JustDied(Unit* /*killer*/)
|
|||
|
||||
void npc_escortAI::JustRespawned()
|
||||
{
|
||||
RemoveEscortState(STATE_ESCORT_ESCORTING|STATE_ESCORT_RETURNING|STATE_ESCORT_PAUSED);
|
||||
RemoveEscortState(STATE_ESCORT_ESCORTING | STATE_ESCORT_RETURNING | STATE_ESCORT_PAUSED);
|
||||
|
||||
if (!IsCombatMovementAllowed())
|
||||
SetCombatMovement(true);
|
||||
|
|
@ -432,7 +432,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
|
|||
if (WaypointList.empty())
|
||||
{
|
||||
sLog->outErrorDb("TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
|
||||
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
|
||||
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +556,7 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points)
|
|||
uint32 startingWaypointId = CurrentWP->id;
|
||||
|
||||
// Flying unit, just fill array
|
||||
if (me->m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY)))
|
||||
if (me->m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY)))
|
||||
{
|
||||
// xinef: first point in vector is unit real position
|
||||
points->clear();
|
||||
|
|
@ -571,7 +571,7 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points)
|
|||
std::vector<G3D::Vector3> pVector;
|
||||
// xinef: first point in vector is unit real position
|
||||
pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
|
||||
uint32 length = (WaypointList.size() - startingWaypointId)*size;
|
||||
uint32 length = (WaypointList.size() - startingWaypointId) * size;
|
||||
|
||||
uint32 cnt = 0;
|
||||
for (std::list<Escort_Waypoint>::const_iterator itr = CurrentWP; itr != WaypointList.end() && cnt <= length; ++itr, ++cnt)
|
||||
|
|
@ -579,11 +579,11 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points)
|
|||
|
||||
if (pVector.size() > 2) // more than source + dest
|
||||
{
|
||||
G3D::Vector3 middle = (pVector[0] + pVector[pVector.size()-1]) / 2.f;
|
||||
G3D::Vector3 middle = (pVector[0] + pVector[pVector.size() - 1]) / 2.f;
|
||||
G3D::Vector3 offset;
|
||||
|
||||
bool continueLoop = false;
|
||||
for (uint32 i = 1; i < pVector.size()-1; ++i)
|
||||
for (uint32 i = 1; i < pVector.size() - 1; ++i)
|
||||
{
|
||||
offset = middle - pVector[i];
|
||||
if (fabs(offset.x) >= 0xFF || fabs(offset.y) >= 0xFF || fabs(offset.z) >= 0x7F)
|
||||
|
|
@ -599,6 +599,6 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points)
|
|||
// everything ok
|
||||
*points = pVector;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,92 +38,92 @@ enum eEscortState
|
|||
|
||||
struct npc_escortAI : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
explicit npc_escortAI(Creature* creature);
|
||||
~npc_escortAI() {}
|
||||
public:
|
||||
explicit npc_escortAI(Creature* creature);
|
||||
~npc_escortAI() {}
|
||||
|
||||
// CreatureAI functions
|
||||
void AttackStart(Unit* who);
|
||||
// CreatureAI functions
|
||||
void AttackStart(Unit* who);
|
||||
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
|
||||
void JustDied(Unit*);
|
||||
void JustDied(Unit*);
|
||||
|
||||
void JustRespawned();
|
||||
void JustRespawned();
|
||||
|
||||
void ReturnToLastPoint();
|
||||
void ReturnToLastPoint();
|
||||
|
||||
void EnterEvadeMode();
|
||||
void EnterEvadeMode();
|
||||
|
||||
void UpdateAI(uint32 diff); //the "internal" update, calls UpdateEscortAI()
|
||||
virtual void UpdateEscortAI(uint32 diff); //used when it's needed to add code in update (abilities, scripted events, etc)
|
||||
void UpdateAI(uint32 diff); //the "internal" update, calls UpdateEscortAI()
|
||||
virtual void UpdateEscortAI(uint32 diff); //used when it's needed to add code in update (abilities, scripted events, etc)
|
||||
|
||||
void MovementInform(uint32, uint32);
|
||||
void MovementInform(uint32, uint32);
|
||||
|
||||
// EscortAI functions
|
||||
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime = 0); // waitTime is in ms
|
||||
// EscortAI functions
|
||||
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime = 0); // waitTime is in ms
|
||||
|
||||
//this will set the current position to x/y/z/o, and the current WP to pointId.
|
||||
bool SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation);
|
||||
//this will set the current position to x/y/z/o, and the current WP to pointId.
|
||||
bool SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation);
|
||||
|
||||
//this will set the current position to WP start position (if setPosition == true),
|
||||
//and the current WP to pointId
|
||||
bool SetNextWaypoint(uint32 pointId, bool setPosition = true);
|
||||
//this will set the current position to WP start position (if setPosition == true),
|
||||
//and the current WP to pointId
|
||||
bool SetNextWaypoint(uint32 pointId, bool setPosition = true);
|
||||
|
||||
bool GetWaypointPosition(uint32 pointId, float& x, float& y, float& z);
|
||||
bool GetWaypointPosition(uint32 pointId, float& x, float& y, float& z);
|
||||
|
||||
void GenerateWaypointArray(Movement::PointsArray* points);
|
||||
void GenerateWaypointArray(Movement::PointsArray* points);
|
||||
|
||||
virtual void WaypointReached(uint32 pointId) = 0;
|
||||
virtual void WaypointStart(uint32 /*pointId*/) {}
|
||||
virtual void WaypointReached(uint32 pointId) = 0;
|
||||
virtual void WaypointStart(uint32 /*pointId*/) {}
|
||||
|
||||
void Start(bool isActiveAttacker = true, bool run = false, uint64 playerGUID = 0, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
|
||||
void Start(bool isActiveAttacker = true, bool run = false, uint64 playerGUID = 0, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
|
||||
|
||||
void SetRun(bool on = true);
|
||||
void SetEscortPaused(bool on);
|
||||
void SetRun(bool on = true);
|
||||
void SetEscortPaused(bool on);
|
||||
|
||||
bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState); }
|
||||
virtual bool IsEscorted() { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
|
||||
bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState); }
|
||||
virtual bool IsEscorted() { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
|
||||
|
||||
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
|
||||
float GetMaxPlayerDistance() { return MaxPlayerDistance; }
|
||||
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
|
||||
float GetMaxPlayerDistance() { return MaxPlayerDistance; }
|
||||
|
||||
void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
|
||||
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
|
||||
bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
|
||||
void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
|
||||
uint64 GetEventStarterGUID() { return m_uiPlayerGUID; }
|
||||
void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
|
||||
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
|
||||
bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
|
||||
void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
|
||||
uint64 GetEventStarterGUID() { return m_uiPlayerGUID; }
|
||||
|
||||
void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
|
||||
void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
|
||||
void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
|
||||
void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
|
||||
|
||||
protected:
|
||||
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
|
||||
protected:
|
||||
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
|
||||
|
||||
private:
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
bool IsPlayerOrGroupInRange();
|
||||
void FillPointMovementListForCreature();
|
||||
private:
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
bool IsPlayerOrGroupInRange();
|
||||
void FillPointMovementListForCreature();
|
||||
|
||||
uint64 m_uiPlayerGUID;
|
||||
uint32 m_uiWPWaitTimer;
|
||||
uint32 m_uiPlayerCheckTimer;
|
||||
uint32 m_uiEscortState;
|
||||
float MaxPlayerDistance;
|
||||
uint64 m_uiPlayerGUID;
|
||||
uint32 m_uiWPWaitTimer;
|
||||
uint32 m_uiPlayerCheckTimer;
|
||||
uint32 m_uiEscortState;
|
||||
float MaxPlayerDistance;
|
||||
|
||||
Quest const* m_pQuestForEscort; //generally passed in Start() when regular escort script.
|
||||
Quest const* m_pQuestForEscort; //generally passed in Start() when regular escort script.
|
||||
|
||||
std::list<Escort_Waypoint> WaypointList;
|
||||
std::list<Escort_Waypoint>::iterator CurrentWP;
|
||||
std::list<Escort_Waypoint> WaypointList;
|
||||
std::list<Escort_Waypoint>::iterator CurrentWP;
|
||||
|
||||
bool m_bIsActiveAttacker; //obsolete, determined by faction.
|
||||
bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK)
|
||||
bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used)
|
||||
bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests.
|
||||
bool DespawnAtEnd;
|
||||
bool DespawnAtFar;
|
||||
bool ScriptWP;
|
||||
bool HasImmuneToNPCFlags;
|
||||
bool m_bIsActiveAttacker; //obsolete, determined by faction.
|
||||
bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK)
|
||||
bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used)
|
||||
bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests.
|
||||
bool DespawnAtEnd;
|
||||
bool DespawnAtFar;
|
||||
bool ScriptWP;
|
||||
bool HasImmuneToNPCFlags;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -21,48 +21,48 @@ enum eFollowState
|
|||
|
||||
class FollowerAI : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
explicit FollowerAI(Creature* creature);
|
||||
~FollowerAI() {}
|
||||
public:
|
||||
explicit FollowerAI(Creature* creature);
|
||||
~FollowerAI() {}
|
||||
|
||||
//virtual void WaypointReached(uint32 uiPointId) = 0;
|
||||
//virtual void WaypointReached(uint32 uiPointId) = 0;
|
||||
|
||||
void MovementInform(uint32 motionType, uint32 pointId);
|
||||
void MovementInform(uint32 motionType, uint32 pointId);
|
||||
|
||||
void AttackStart(Unit*);
|
||||
void AttackStart(Unit*);
|
||||
|
||||
void MoveInLineOfSight(Unit*);
|
||||
void MoveInLineOfSight(Unit*);
|
||||
|
||||
void EnterEvadeMode();
|
||||
void EnterEvadeMode();
|
||||
|
||||
void JustDied(Unit*);
|
||||
void JustDied(Unit*);
|
||||
|
||||
void JustRespawned();
|
||||
void JustRespawned();
|
||||
|
||||
void UpdateAI(uint32); //the "internal" update, calls UpdateFollowerAI()
|
||||
virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc)
|
||||
void UpdateAI(uint32); //the "internal" update, calls UpdateFollowerAI()
|
||||
virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc)
|
||||
|
||||
void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = nullptr);
|
||||
void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = nullptr);
|
||||
|
||||
void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow
|
||||
void SetFollowComplete(bool bWithEndEvent = false);
|
||||
void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow
|
||||
void SetFollowComplete(bool bWithEndEvent = false);
|
||||
|
||||
bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState); }
|
||||
bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState); }
|
||||
|
||||
protected:
|
||||
Player* GetLeaderForFollower();
|
||||
protected:
|
||||
Player* GetLeaderForFollower();
|
||||
|
||||
private:
|
||||
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
|
||||
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
|
||||
private:
|
||||
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
|
||||
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
|
||||
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
|
||||
uint64 m_uiLeaderGUID;
|
||||
uint32 m_uiUpdateFollowTimer;
|
||||
uint32 m_uiFollowState;
|
||||
uint64 m_uiLeaderGUID;
|
||||
uint32 m_uiUpdateFollowTimer;
|
||||
uint32 m_uiFollowState;
|
||||
|
||||
const Quest* m_pQuestForFollow; //normally we have a quest
|
||||
const Quest* m_pQuestForFollow; //normally we have a quest
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points)
|
|||
return;
|
||||
|
||||
// Flying unit, just fill array
|
||||
if (me->m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY)))
|
||||
if (me->m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY)))
|
||||
{
|
||||
// xinef: first point in vector is unit real position
|
||||
points->clear();
|
||||
|
|
@ -132,7 +132,7 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points)
|
|||
std::vector<G3D::Vector3> pVector;
|
||||
// xinef: first point in vector is unit real position
|
||||
pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
|
||||
uint32 length = (mWayPoints->size() - mCurrentWPID)*size;
|
||||
uint32 length = (mWayPoints->size() - mCurrentWPID) * size;
|
||||
|
||||
uint32 cnt = 0;
|
||||
uint32 wpCounter = mCurrentWPID;
|
||||
|
|
@ -145,11 +145,11 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points)
|
|||
|
||||
if (pVector.size() > 2) // more than source + dest
|
||||
{
|
||||
G3D::Vector3 middle = (pVector[0] + pVector[pVector.size()-1]) / 2.f;
|
||||
G3D::Vector3 middle = (pVector[0] + pVector[pVector.size() - 1]) / 2.f;
|
||||
G3D::Vector3 offset;
|
||||
|
||||
bool continueLoop = false;
|
||||
for (uint32 i = 1; i < pVector.size()-1; ++i)
|
||||
for (uint32 i = 1; i < pVector.size() - 1; ++i)
|
||||
{
|
||||
offset = middle - pVector[i];
|
||||
if (fabs(offset.x) >= 0xFF || fabs(offset.y) >= 0xFF || fabs(offset.z) >= 0x7F)
|
||||
|
|
@ -516,7 +516,7 @@ bool SmartAI::IsEscortInvokerInRange()
|
|||
ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
|
||||
if (targets)
|
||||
{
|
||||
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST;
|
||||
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST * 2 : SMART_ESCORT_MAX_PLAYER_DIST;
|
||||
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
|
||||
{
|
||||
Player* player = (*targets->begin())->ToPlayer();
|
||||
|
|
@ -616,7 +616,7 @@ void SmartAI::EnterEvadeMode()
|
|||
// xinef: fixes strange jumps when charming SmartAI npc
|
||||
if (!me->IsAlive() || me->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
|
||||
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
{
|
||||
me->AttackStop();
|
||||
|
|
@ -653,7 +653,7 @@ void SmartAI::EnterEvadeMode()
|
|||
else
|
||||
{
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
|
||||
// xinef: do not forget to reset scripts as we wont call reached home
|
||||
if (!me->HasUnitState(UNIT_STATE_EVADE))
|
||||
GetScript()->OnReset();
|
||||
|
|
@ -1027,7 +1027,7 @@ void SmartAI::StopFollow(bool complete)
|
|||
mFollowArrivedTimer = 1000;
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
|
||||
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->StopMoving();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
|
|
@ -1177,23 +1177,23 @@ void SmartGameObjectAI::SpellHit(Unit* unit, const SpellInfo* spellInfo)
|
|||
|
||||
class SmartTrigger : public AreaTriggerScript
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
SmartTrigger() : AreaTriggerScript("SmartTrigger") {}
|
||||
SmartTrigger() : AreaTriggerScript("SmartTrigger") {}
|
||||
|
||||
bool OnTrigger(Player* player, AreaTrigger const* trigger)
|
||||
{
|
||||
if (!player->IsAlive())
|
||||
return false;
|
||||
bool OnTrigger(Player* player, AreaTrigger const* trigger)
|
||||
{
|
||||
if (!player->IsAlive())
|
||||
return false;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->entry);
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->entry);
|
||||
#endif
|
||||
SmartScript script;
|
||||
script.OnInitialize(nullptr, trigger);
|
||||
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->entry);
|
||||
return true;
|
||||
}
|
||||
SmartScript script;
|
||||
script.OnInitialize(nullptr, trigger);
|
||||
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->entry);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_SmartScripts()
|
||||
|
|
|
|||
|
|
@ -33,231 +33,231 @@ enum SmartEscortVars
|
|||
|
||||
class SmartAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
~SmartAI(){};
|
||||
explicit SmartAI(Creature* c);
|
||||
public:
|
||||
~SmartAI() {};
|
||||
explicit SmartAI(Creature* c);
|
||||
|
||||
// Start moving to the desired MovePoint
|
||||
void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr);
|
||||
bool LoadPath(uint32 entry);
|
||||
void PausePath(uint32 delay, bool forced = false);
|
||||
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
|
||||
void EndPath(bool fail = false);
|
||||
void ResumePath();
|
||||
WayPoint* GetNextWayPoint();
|
||||
void GenerateWayPointArray(Movement::PointsArray* points);
|
||||
bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); }
|
||||
void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
|
||||
virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); }
|
||||
void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
|
||||
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
|
||||
void SetCombatMove(bool on);
|
||||
bool CanCombatMove() { return mCanCombatMove; }
|
||||
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0, bool aliveState = true);
|
||||
void StopFollow(bool complete);
|
||||
// Start moving to the desired MovePoint
|
||||
void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr);
|
||||
bool LoadPath(uint32 entry);
|
||||
void PausePath(uint32 delay, bool forced = false);
|
||||
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
|
||||
void EndPath(bool fail = false);
|
||||
void ResumePath();
|
||||
WayPoint* GetNextWayPoint();
|
||||
void GenerateWayPointArray(Movement::PointsArray* points);
|
||||
bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); }
|
||||
void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
|
||||
virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); }
|
||||
void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
|
||||
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
|
||||
void SetCombatMove(bool on);
|
||||
bool CanCombatMove() { return mCanCombatMove; }
|
||||
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0, bool aliveState = true);
|
||||
void StopFollow(bool complete);
|
||||
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
|
||||
SmartScript* GetScript() { return &mScript; }
|
||||
bool IsEscortInvokerInRange();
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
|
||||
SmartScript* GetScript() { return &mScript; }
|
||||
bool IsEscortInvokerInRange();
|
||||
|
||||
// Called when creature is spawned or respawned
|
||||
void JustRespawned();
|
||||
// Called when creature is spawned or respawned
|
||||
void JustRespawned();
|
||||
|
||||
// Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables
|
||||
void JustReachedHome();
|
||||
// Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables
|
||||
void JustReachedHome();
|
||||
|
||||
// Called for reaction at enter to combat if not in combat yet (enemy can be nullptr)
|
||||
void EnterCombat(Unit* enemy);
|
||||
// Called for reaction at enter to combat if not in combat yet (enemy can be nullptr)
|
||||
void EnterCombat(Unit* enemy);
|
||||
|
||||
// Called for reaction at stopping attack at no attackers or targets
|
||||
void EnterEvadeMode();
|
||||
// Called for reaction at stopping attack at no attackers or targets
|
||||
void EnterEvadeMode();
|
||||
|
||||
// Called when the creature is killed
|
||||
void JustDied(Unit* killer);
|
||||
// Called when the creature is killed
|
||||
void JustDied(Unit* killer);
|
||||
|
||||
// Called when the creature kills a unit
|
||||
void KilledUnit(Unit* victim);
|
||||
// Called when the creature kills a unit
|
||||
void KilledUnit(Unit* victim);
|
||||
|
||||
// Called when the creature summon successfully other creature
|
||||
void JustSummoned(Creature* creature);
|
||||
// Called when the creature summon successfully other creature
|
||||
void JustSummoned(Creature* creature);
|
||||
|
||||
// Tell creature to attack and follow the victim
|
||||
void AttackStart(Unit* who);
|
||||
// Tell creature to attack and follow the victim
|
||||
void AttackStart(Unit* who);
|
||||
|
||||
// Called if IsVisible(Unit* who) is true at each *who move, reaction at visibility zone enter
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
// Called if IsVisible(Unit* who) is true at each *who move, reaction at visibility zone enter
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
|
||||
// Called when hit by a spell
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
// Called when hit by a spell
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
|
||||
// Called when spell hits a target
|
||||
void SpellHitTarget(Unit* target, const SpellInfo* spellInfo);
|
||||
// Called when spell hits a target
|
||||
void SpellHitTarget(Unit* target, const SpellInfo* spellInfo);
|
||||
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
void DamageTaken(Unit* done_by, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask);
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
void DamageTaken(Unit* done_by, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask);
|
||||
|
||||
// Called when the creature receives heal
|
||||
void HealReceived(Unit* doneBy, uint32& addhealth);
|
||||
// Called when the creature receives heal
|
||||
void HealReceived(Unit* doneBy, uint32& addhealth);
|
||||
|
||||
// Called at World update tick
|
||||
void UpdateAI(uint32 diff);
|
||||
// Called at World update tick
|
||||
void UpdateAI(uint32 diff);
|
||||
|
||||
// Called at text emote receive from player
|
||||
void ReceiveEmote(Player* player, uint32 textEmote);
|
||||
// Called at text emote receive from player
|
||||
void ReceiveEmote(Player* player, uint32 textEmote);
|
||||
|
||||
// Called at waypoint reached or point movement finished
|
||||
void MovementInform(uint32 MovementType, uint32 Data);
|
||||
// Called at waypoint reached or point movement finished
|
||||
void MovementInform(uint32 MovementType, uint32 Data);
|
||||
|
||||
// Called when creature is summoned by another unit
|
||||
void IsSummonedBy(Unit* summoner);
|
||||
// Called when creature is summoned by another unit
|
||||
void IsSummonedBy(Unit* summoner);
|
||||
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
void DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType damagetyp);
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
void DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType damagetyp);
|
||||
|
||||
// Called when a summoned creature dissapears (UnSommoned)
|
||||
void SummonedCreatureDespawn(Creature* unit);
|
||||
// Called when a summoned creature dissapears (UnSommoned)
|
||||
void SummonedCreatureDespawn(Creature* unit);
|
||||
|
||||
// called when the corpse of this creature gets removed
|
||||
void CorpseRemoved(uint32& respawnDelay);
|
||||
// called when the corpse of this creature gets removed
|
||||
void CorpseRemoved(uint32& respawnDelay);
|
||||
|
||||
// Called at World update tick if creature is charmed
|
||||
void UpdateAIWhileCharmed(const uint32 diff);
|
||||
// Called at World update tick if creature is charmed
|
||||
void UpdateAIWhileCharmed(const uint32 diff);
|
||||
|
||||
// Called when a Player/Creature enters the creature (vehicle)
|
||||
void PassengerBoarded(Unit* who, int8 seatId, bool apply);
|
||||
// Called when a Player/Creature enters the creature (vehicle)
|
||||
void PassengerBoarded(Unit* who, int8 seatId, bool apply);
|
||||
|
||||
// Called when gets initialized, when creature is added to world
|
||||
void InitializeAI();
|
||||
// Called when gets initialized, when creature is added to world
|
||||
void InitializeAI();
|
||||
|
||||
// Called when creature gets charmed by another unit
|
||||
void OnCharmed(bool apply);
|
||||
// Called when creature gets charmed by another unit
|
||||
void OnCharmed(bool apply);
|
||||
|
||||
// Called when victim is in line of sight
|
||||
bool CanAIAttack(const Unit* who) const;
|
||||
// Called when victim is in line of sight
|
||||
bool CanAIAttack(const Unit* who) const;
|
||||
|
||||
// Used in scripts to share variables
|
||||
void DoAction(int32 param = 0);
|
||||
// Used in scripts to share variables
|
||||
void DoAction(int32 param = 0);
|
||||
|
||||
// Used in scripts to share variables
|
||||
uint32 GetData(uint32 id = 0) const;
|
||||
// Used in scripts to share variables
|
||||
uint32 GetData(uint32 id = 0) const;
|
||||
|
||||
// Used in scripts to share variables
|
||||
void SetData(uint32 id, uint32 value);
|
||||
// Used in scripts to share variables
|
||||
void SetData(uint32 id, uint32 value);
|
||||
|
||||
// Used in scripts to share variables
|
||||
void SetGUID(uint64 guid, int32 id = 0);
|
||||
// Used in scripts to share variables
|
||||
void SetGUID(uint64 guid, int32 id = 0);
|
||||
|
||||
// Used in scripts to share variables
|
||||
uint64 GetGUID(int32 id = 0) const;
|
||||
// Used in scripts to share variables
|
||||
uint64 GetGUID(int32 id = 0) const;
|
||||
|
||||
//core related
|
||||
static int32 Permissible(const Creature*);
|
||||
//core related
|
||||
static int32 Permissible(const Creature*);
|
||||
|
||||
// Called at movepoint reached
|
||||
void MovepointReached(uint32 id);
|
||||
// Called at movepoint reached
|
||||
void MovepointReached(uint32 id);
|
||||
|
||||
// Makes the creature run/walk
|
||||
void SetRun(bool run = true);
|
||||
// Makes the creature run/walk
|
||||
void SetRun(bool run = true);
|
||||
|
||||
void SetFly(bool fly = true);
|
||||
void SetFly(bool fly = true);
|
||||
|
||||
void SetSwim(bool swim = true);
|
||||
void SetSwim(bool swim = true);
|
||||
|
||||
void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; }
|
||||
void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; }
|
||||
|
||||
void sGossipHello(Player* player);
|
||||
void sGossipSelect(Player* player, uint32 sender, uint32 action);
|
||||
void sGossipSelectCode(Player* player, uint32 sender, uint32 action, const char* code);
|
||||
void sQuestAccept(Player* player, Quest const* quest);
|
||||
//void sQuestSelect(Player* player, Quest const* quest);
|
||||
//void sQuestComplete(Player* player, Quest const* quest);
|
||||
void sQuestReward(Player* player, Quest const* quest, uint32 opt);
|
||||
void sOnGameEvent(bool start, uint16 eventId);
|
||||
void sGossipHello(Player* player);
|
||||
void sGossipSelect(Player* player, uint32 sender, uint32 action);
|
||||
void sGossipSelectCode(Player* player, uint32 sender, uint32 action, const char* code);
|
||||
void sQuestAccept(Player* player, Quest const* quest);
|
||||
//void sQuestSelect(Player* player, Quest const* quest);
|
||||
//void sQuestComplete(Player* player, Quest const* quest);
|
||||
void sQuestReward(Player* player, Quest const* quest, uint32 opt);
|
||||
void sOnGameEvent(bool start, uint16 eventId);
|
||||
|
||||
uint32 mEscortQuestID;
|
||||
uint32 mEscortQuestID;
|
||||
|
||||
void SetDespawnTime (uint32 t)
|
||||
{
|
||||
mDespawnTime = t;
|
||||
mDespawnState = t ? 1 : 0;
|
||||
}
|
||||
void StartDespawn() { mDespawnState = 2; }
|
||||
void SetDespawnTime (uint32 t)
|
||||
{
|
||||
mDespawnTime = t;
|
||||
mDespawnState = t ? 1 : 0;
|
||||
}
|
||||
void StartDespawn() { mDespawnState = 2; }
|
||||
|
||||
void OnSpellClick(Unit* clicker, bool& result);
|
||||
void OnSpellClick(Unit* clicker, bool& result);
|
||||
|
||||
// Xinef
|
||||
void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
|
||||
void SetForcedCombatMove(float dist);
|
||||
// Xinef
|
||||
void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
|
||||
void SetForcedCombatMove(float dist);
|
||||
|
||||
private:
|
||||
uint32 mFollowCreditType;
|
||||
uint32 mFollowArrivedTimer;
|
||||
uint32 mFollowCredit;
|
||||
uint32 mFollowArrivedEntry;
|
||||
bool mFollowArrivedAlive;
|
||||
uint64 mFollowGuid;
|
||||
float mFollowDist;
|
||||
float mFollowAngle;
|
||||
private:
|
||||
uint32 mFollowCreditType;
|
||||
uint32 mFollowArrivedTimer;
|
||||
uint32 mFollowCredit;
|
||||
uint32 mFollowArrivedEntry;
|
||||
bool mFollowArrivedAlive;
|
||||
uint64 mFollowGuid;
|
||||
float mFollowDist;
|
||||
float mFollowAngle;
|
||||
|
||||
void ReturnToLastOOCPos();
|
||||
void UpdatePath(const uint32 diff);
|
||||
SmartScript mScript;
|
||||
WPPath* mWayPoints;
|
||||
uint32 mEscortState;
|
||||
uint32 mCurrentWPID;
|
||||
bool mWPReached;
|
||||
bool mOOCReached;
|
||||
uint32 mWPPauseTimer;
|
||||
WayPoint* mLastWP;
|
||||
uint32 mEscortNPCFlags;
|
||||
uint32 GetWPCount() { return mWayPoints ? mWayPoints->size() : 0; }
|
||||
bool mCanRepeatPath;
|
||||
bool mRun;
|
||||
bool mCanAutoAttack;
|
||||
bool mCanCombatMove;
|
||||
bool mForcedPaused;
|
||||
uint32 mInvincibilityHpLevel;
|
||||
void ReturnToLastOOCPos();
|
||||
void UpdatePath(const uint32 diff);
|
||||
SmartScript mScript;
|
||||
WPPath* mWayPoints;
|
||||
uint32 mEscortState;
|
||||
uint32 mCurrentWPID;
|
||||
bool mWPReached;
|
||||
bool mOOCReached;
|
||||
uint32 mWPPauseTimer;
|
||||
WayPoint* mLastWP;
|
||||
uint32 mEscortNPCFlags;
|
||||
uint32 GetWPCount() { return mWayPoints ? mWayPoints->size() : 0; }
|
||||
bool mCanRepeatPath;
|
||||
bool mRun;
|
||||
bool mCanAutoAttack;
|
||||
bool mCanCombatMove;
|
||||
bool mForcedPaused;
|
||||
uint32 mInvincibilityHpLevel;
|
||||
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
|
||||
uint32 mDespawnTime;
|
||||
uint32 mDespawnState;
|
||||
void UpdateDespawn(const uint32 diff);
|
||||
uint32 mEscortInvokerCheckTimer;
|
||||
bool mJustReset;
|
||||
uint32 mDespawnTime;
|
||||
uint32 mDespawnState;
|
||||
void UpdateDespawn(const uint32 diff);
|
||||
uint32 mEscortInvokerCheckTimer;
|
||||
bool mJustReset;
|
||||
|
||||
// Xinef: Vehicle conditions
|
||||
void CheckConditions(const uint32 diff);
|
||||
ConditionList conditions;
|
||||
uint32 m_ConditionsTimer;
|
||||
// Xinef: Vehicle conditions
|
||||
void CheckConditions(const uint32 diff);
|
||||
ConditionList conditions;
|
||||
uint32 m_ConditionsTimer;
|
||||
};
|
||||
|
||||
class SmartGameObjectAI : public GameObjectAI
|
||||
{
|
||||
public:
|
||||
SmartGameObjectAI(GameObject* g) : GameObjectAI(g) {}
|
||||
~SmartGameObjectAI() {}
|
||||
public:
|
||||
SmartGameObjectAI(GameObject* g) : GameObjectAI(g) {}
|
||||
~SmartGameObjectAI() {}
|
||||
|
||||
void UpdateAI(uint32 diff);
|
||||
void InitializeAI();
|
||||
void Reset();
|
||||
SmartScript* GetScript() { return &mScript; }
|
||||
static int32 Permissible(const GameObject* g);
|
||||
void UpdateAI(uint32 diff);
|
||||
void InitializeAI();
|
||||
void Reset();
|
||||
SmartScript* GetScript() { return &mScript; }
|
||||
static int32 Permissible(const GameObject* g);
|
||||
|
||||
bool GossipHello(Player* player, bool reportUse);
|
||||
bool GossipSelect(Player* player, uint32 sender, uint32 action);
|
||||
bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/);
|
||||
bool QuestAccept(Player* player, Quest const* quest);
|
||||
bool QuestReward(Player* player, Quest const* quest, uint32 opt);
|
||||
void Destroyed(Player* player, uint32 eventId);
|
||||
void SetData(uint32 id, uint32 value);
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
|
||||
void OnGameEvent(bool start, uint16 eventId);
|
||||
void OnStateChanged(uint32 state, Unit* unit);
|
||||
void EventInform(uint32 eventId);
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
bool GossipHello(Player* player, bool reportUse);
|
||||
bool GossipSelect(Player* player, uint32 sender, uint32 action);
|
||||
bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/);
|
||||
bool QuestAccept(Player* player, Quest const* quest);
|
||||
bool QuestReward(Player* player, Quest const* quest, uint32 opt);
|
||||
void Destroyed(Player* player, uint32 eventId);
|
||||
void SetData(uint32 id, uint32 value);
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
|
||||
void OnGameEvent(bool start, uint16 eventId);
|
||||
void OnStateChanged(uint32 state, Unit* unit);
|
||||
void EventInform(uint32 eventId);
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
|
||||
protected:
|
||||
SmartScript mScript;
|
||||
protected:
|
||||
SmartScript mScript;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,314 +19,314 @@
|
|||
|
||||
class SmartScript
|
||||
{
|
||||
public:
|
||||
SmartScript();
|
||||
~SmartScript();
|
||||
public:
|
||||
SmartScript();
|
||||
~SmartScript();
|
||||
|
||||
void OnInitialize(WorldObject* obj, AreaTrigger const* at = nullptr);
|
||||
void GetScript();
|
||||
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at);
|
||||
void OnInitialize(WorldObject* obj, AreaTrigger const* at = nullptr);
|
||||
void GetScript();
|
||||
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at);
|
||||
|
||||
void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
bool CheckTimer(SmartScriptHolder const& e) const;
|
||||
void RecalcTimer(SmartScriptHolder& e, uint32 min, uint32 max);
|
||||
void UpdateTimer(SmartScriptHolder& e, uint32 const diff);
|
||||
void InitTimer(SmartScriptHolder& e);
|
||||
void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
void ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = nullptr);
|
||||
ObjectList* GetWorldObjectsInDist(float dist);
|
||||
void InstallTemplate(SmartScriptHolder const& e);
|
||||
SmartScriptHolder CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, uint32 event_param5, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 target_param4, uint32 phaseMask);
|
||||
void AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, uint32 event_param5, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 target_param4, uint32 phaseMask);
|
||||
void SetPathId(uint32 id) { mPathId = id; }
|
||||
uint32 GetPathId() const { return mPathId; }
|
||||
WorldObject* GetBaseObject()
|
||||
void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
bool CheckTimer(SmartScriptHolder const& e) const;
|
||||
void RecalcTimer(SmartScriptHolder& e, uint32 min, uint32 max);
|
||||
void UpdateTimer(SmartScriptHolder& e, uint32 const diff);
|
||||
void InitTimer(SmartScriptHolder& e);
|
||||
void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
void ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr);
|
||||
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = nullptr);
|
||||
ObjectList* GetWorldObjectsInDist(float dist);
|
||||
void InstallTemplate(SmartScriptHolder const& e);
|
||||
SmartScriptHolder CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, uint32 event_param5, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 target_param4, uint32 phaseMask);
|
||||
void AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, uint32 event_param5, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 target_param4, uint32 phaseMask);
|
||||
void SetPathId(uint32 id) { mPathId = id; }
|
||||
uint32 GetPathId() const { return mPathId; }
|
||||
WorldObject* GetBaseObject()
|
||||
{
|
||||
WorldObject* obj = nullptr;
|
||||
if (me)
|
||||
obj = me;
|
||||
else if (go)
|
||||
obj = go;
|
||||
return obj;
|
||||
}
|
||||
|
||||
bool IsUnit(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
|
||||
}
|
||||
|
||||
bool IsPlayer(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && obj->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool IsCreature(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && obj->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
bool IsGameObject(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && obj->GetTypeId() == TYPEID_GAMEOBJECT;
|
||||
}
|
||||
|
||||
void OnUpdate(const uint32 diff);
|
||||
void OnMoveInLineOfSight(Unit* who);
|
||||
|
||||
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff);
|
||||
void DoFindFriendlyCC(std::list<Creature*>& _list, float range);
|
||||
void DoFindFriendlyMissingBuff(std::list<Creature*>& list, float range, uint32 spellid);
|
||||
Unit* DoFindClosestFriendlyInRange(float range, bool playerOnly);
|
||||
|
||||
void StoreTargetList(ObjectList* targets, uint32 id)
|
||||
{
|
||||
if (!targets)
|
||||
return;
|
||||
|
||||
if (mTargetStorage->find(id) != mTargetStorage->end())
|
||||
{
|
||||
WorldObject* obj = nullptr;
|
||||
if (me)
|
||||
obj = me;
|
||||
else if (go)
|
||||
obj = go;
|
||||
return obj;
|
||||
}
|
||||
|
||||
bool IsUnit(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
|
||||
}
|
||||
|
||||
bool IsPlayer(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && obj->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool IsCreature(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && obj->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
bool IsGameObject(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->IsInWorld() && obj->GetTypeId() == TYPEID_GAMEOBJECT;
|
||||
}
|
||||
|
||||
void OnUpdate(const uint32 diff);
|
||||
void OnMoveInLineOfSight(Unit* who);
|
||||
|
||||
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff);
|
||||
void DoFindFriendlyCC(std::list<Creature*>& _list, float range);
|
||||
void DoFindFriendlyMissingBuff(std::list<Creature*>& list, float range, uint32 spellid);
|
||||
Unit* DoFindClosestFriendlyInRange(float range, bool playerOnly);
|
||||
|
||||
void StoreTargetList(ObjectList* targets, uint32 id)
|
||||
{
|
||||
if (!targets)
|
||||
// check if already stored
|
||||
if ((*mTargetStorage)[id]->Equals(targets))
|
||||
return;
|
||||
|
||||
if (mTargetStorage->find(id) != mTargetStorage->end())
|
||||
delete (*mTargetStorage)[id];
|
||||
}
|
||||
|
||||
(*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject());
|
||||
}
|
||||
|
||||
bool IsSmart(Creature* c = nullptr)
|
||||
{
|
||||
bool smart = true;
|
||||
if (c && c->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!me || me->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!smart)
|
||||
sLog->outErrorDb("SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
bool IsSmartGO(GameObject* g = nullptr)
|
||||
{
|
||||
bool smart = true;
|
||||
if (g && g->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
|
||||
if (!go || go->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
if (!smart)
|
||||
sLog->outErrorDb("SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
ObjectList* GetTargetList(uint32 id)
|
||||
{
|
||||
ObjectListMap::iterator itr = mTargetStorage->find(id);
|
||||
if (itr != mTargetStorage->end())
|
||||
return (*itr).second->GetObjectList();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void StoreCounter(uint32 id, uint32 value, uint32 reset)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
{
|
||||
if (reset == 0)
|
||||
itr->second += value;
|
||||
else
|
||||
itr->second = value;
|
||||
}
|
||||
else
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
|
||||
ProcessEventsFor(SMART_EVENT_COUNTER_SET, NULL, id);
|
||||
}
|
||||
|
||||
uint32 GetCounterValue(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const
|
||||
{
|
||||
GameObject* gameObject = nullptr;
|
||||
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::GameObjectWithDbGUIDCheck goCheck(guid);
|
||||
acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck> checker(searchObject, gameObject, goCheck);
|
||||
|
||||
TypeContainerVisitor<acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker);
|
||||
cell.Visit(p, objectChecker, *searchObject->GetMap(), *searchObject, searchObject->GetVisibilityRange());
|
||||
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const
|
||||
{
|
||||
Creature* creature = nullptr;
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::CreatureWithDbGUIDCheck target_check(guid);
|
||||
acore::CreatureSearcher<acore::CreatureWithDbGUIDCheck> checker(searchObject, creature, target_check);
|
||||
|
||||
TypeContainerVisitor<acore::CreatureSearcher <acore::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
|
||||
cell.Visit(p, unit_checker, *searchObject->GetMap(), *searchObject, searchObject->GetVisibilityRange());
|
||||
|
||||
return creature;
|
||||
}
|
||||
|
||||
ObjectListMap* mTargetStorage;
|
||||
|
||||
void OnReset();
|
||||
void ResetBaseObject()
|
||||
{
|
||||
if (meOrigGUID)
|
||||
{
|
||||
if (Creature* m = HashMapHolder<Creature>::Find(meOrigGUID))
|
||||
{
|
||||
// check if already stored
|
||||
if ((*mTargetStorage)[id]->Equals(targets))
|
||||
me = m;
|
||||
go = nullptr;
|
||||
}
|
||||
}
|
||||
if (goOrigGUID)
|
||||
{
|
||||
if (GameObject* o = HashMapHolder<GameObject>::Find(goOrigGUID))
|
||||
{
|
||||
me = nullptr;
|
||||
go = o;
|
||||
}
|
||||
}
|
||||
goOrigGUID = 0;
|
||||
meOrigGUID = 0;
|
||||
}
|
||||
|
||||
//TIMED_ACTIONLIST (script type 9 aka script9)
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry);
|
||||
Unit* GetLastInvoker(Unit* invoker = nullptr);
|
||||
uint64 mLastInvoker;
|
||||
typedef std::unordered_map<uint32, uint32> CounterMap;
|
||||
CounterMap mCounterList;
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; }
|
||||
void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; }
|
||||
uint32 GetActualCombatDist() const { return mActualCombatDist; }
|
||||
uint32 GetMaxCombatDist() const { return mMaxCombatDist; }
|
||||
|
||||
// Xinef: SmartCasterAI, replace above
|
||||
void SetCasterActualDist(float dist) { smartCasterActualDist = dist; }
|
||||
void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; }
|
||||
Powers GetCasterPowerType() const { return smartCasterPowerType; }
|
||||
float GetCasterActualDist() const { return smartCasterActualDist; }
|
||||
float GetCasterMaxDist() const { return smartCasterMaxDist; }
|
||||
|
||||
bool AllowPhaseReset() const { return _allowPhaseReset; }
|
||||
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
|
||||
|
||||
private:
|
||||
void IncPhase(uint32 p)
|
||||
{
|
||||
// Xinef: protect phase from overflowing
|
||||
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
|
||||
}
|
||||
|
||||
void DecPhase(uint32 p)
|
||||
{
|
||||
if (p >= mEventPhase)
|
||||
mEventPhase = 0;
|
||||
else
|
||||
mEventPhase -= p;
|
||||
}
|
||||
bool IsInPhase(uint32 p) const
|
||||
{
|
||||
if (mEventPhase == 0)
|
||||
return false;
|
||||
return (1 << (mEventPhase - 1)) & p;
|
||||
}
|
||||
void SetPhase(uint32 p = 0) { mEventPhase = p; }
|
||||
|
||||
SmartAIEventList mEvents;
|
||||
SmartAIEventList mInstallEvents;
|
||||
SmartAIEventList mTimedActionList;
|
||||
bool isProcessingTimedActionList;
|
||||
Creature* me;
|
||||
uint64 meOrigGUID;
|
||||
GameObject* go;
|
||||
uint64 goOrigGUID;
|
||||
AreaTrigger const* trigger;
|
||||
SmartScriptType mScriptType;
|
||||
uint32 mEventPhase;
|
||||
|
||||
std::unordered_map<int32, int32> mStoredDecimals;
|
||||
uint32 mPathId;
|
||||
SmartAIEventStoredList mStoredEvents;
|
||||
std::list<uint32> mRemIDs;
|
||||
|
||||
uint32 mTextTimer;
|
||||
uint32 mLastTextID;
|
||||
uint32 mTalkerEntry;
|
||||
bool mUseTextTimer;
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
uint32 mActualCombatDist;
|
||||
uint32 mMaxCombatDist;
|
||||
|
||||
// Xinef: SmartCasterAI, replace above in future
|
||||
uint32 smartCasterActualDist;
|
||||
uint32 smartCasterMaxDist;
|
||||
Powers smartCasterPowerType;
|
||||
|
||||
// Xinef: misc
|
||||
bool _allowPhaseReset;
|
||||
|
||||
SMARTAI_TEMPLATE mTemplate;
|
||||
void InstallEvents();
|
||||
|
||||
void RemoveStoredEvent (uint32 id)
|
||||
{
|
||||
if (!mStoredEvents.empty())
|
||||
{
|
||||
for (SmartAIEventStoredList::iterator i = mStoredEvents.begin(); i != mStoredEvents.end(); ++i)
|
||||
{
|
||||
if (i->event_id == id)
|
||||
{
|
||||
mStoredEvents.erase(i);
|
||||
return;
|
||||
|
||||
delete (*mTargetStorage)[id];
|
||||
}
|
||||
|
||||
(*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject());
|
||||
}
|
||||
|
||||
bool IsSmart(Creature* c = nullptr)
|
||||
{
|
||||
bool smart = true;
|
||||
if (c && c->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!me || me->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!smart)
|
||||
sLog->outErrorDb("SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
bool IsSmartGO(GameObject* g = nullptr)
|
||||
{
|
||||
bool smart = true;
|
||||
if (g && g->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
|
||||
if (!go || go->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
if (!smart)
|
||||
sLog->outErrorDb("SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
ObjectList* GetTargetList(uint32 id)
|
||||
{
|
||||
ObjectListMap::iterator itr = mTargetStorage->find(id);
|
||||
if (itr != mTargetStorage->end())
|
||||
return (*itr).second->GetObjectList();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void StoreCounter(uint32 id, uint32 value, uint32 reset)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
{
|
||||
if (reset == 0)
|
||||
itr->second += value;
|
||||
else
|
||||
itr->second = value;
|
||||
}
|
||||
else
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
|
||||
ProcessEventsFor(SMART_EVENT_COUNTER_SET, NULL, id);
|
||||
}
|
||||
|
||||
uint32 GetCounterValue(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const
|
||||
{
|
||||
GameObject* gameObject = nullptr;
|
||||
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::GameObjectWithDbGUIDCheck goCheck(guid);
|
||||
acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck> checker(searchObject, gameObject, goCheck);
|
||||
|
||||
TypeContainerVisitor<acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker);
|
||||
cell.Visit(p, objectChecker, *searchObject->GetMap(), *searchObject, searchObject->GetVisibilityRange());
|
||||
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const
|
||||
{
|
||||
Creature* creature = nullptr;
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::CreatureWithDbGUIDCheck target_check(guid);
|
||||
acore::CreatureSearcher<acore::CreatureWithDbGUIDCheck> checker(searchObject, creature, target_check);
|
||||
|
||||
TypeContainerVisitor<acore::CreatureSearcher <acore::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
|
||||
cell.Visit(p, unit_checker, *searchObject->GetMap(), *searchObject, searchObject->GetVisibilityRange());
|
||||
|
||||
return creature;
|
||||
}
|
||||
|
||||
ObjectListMap* mTargetStorage;
|
||||
|
||||
void OnReset();
|
||||
void ResetBaseObject()
|
||||
{
|
||||
if (meOrigGUID)
|
||||
{
|
||||
if (Creature* m = HashMapHolder<Creature>::Find(meOrigGUID))
|
||||
{
|
||||
me = m;
|
||||
go = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
if (goOrigGUID)
|
||||
}
|
||||
}
|
||||
SmartScriptHolder FindLinkedEvent (uint32 link)
|
||||
{
|
||||
if (!mEvents.empty())
|
||||
{
|
||||
for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i)
|
||||
{
|
||||
if (GameObject* o = HashMapHolder<GameObject>::Find(goOrigGUID))
|
||||
if (i->event_id == link)
|
||||
{
|
||||
me = nullptr;
|
||||
go = o;
|
||||
return (*i);
|
||||
}
|
||||
}
|
||||
goOrigGUID = 0;
|
||||
meOrigGUID = 0;
|
||||
}
|
||||
|
||||
//TIMED_ACTIONLIST (script type 9 aka script9)
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry);
|
||||
Unit* GetLastInvoker(Unit* invoker = nullptr);
|
||||
uint64 mLastInvoker;
|
||||
typedef std::unordered_map<uint32, uint32> CounterMap;
|
||||
CounterMap mCounterList;
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; }
|
||||
void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; }
|
||||
uint32 GetActualCombatDist() const { return mActualCombatDist; }
|
||||
uint32 GetMaxCombatDist() const { return mMaxCombatDist; }
|
||||
|
||||
// Xinef: SmartCasterAI, replace above
|
||||
void SetCasterActualDist(float dist) { smartCasterActualDist = dist; }
|
||||
void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; }
|
||||
Powers GetCasterPowerType() const { return smartCasterPowerType; }
|
||||
float GetCasterActualDist() const { return smartCasterActualDist; }
|
||||
float GetCasterMaxDist() const { return smartCasterMaxDist; }
|
||||
|
||||
bool AllowPhaseReset() const { return _allowPhaseReset; }
|
||||
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
|
||||
|
||||
private:
|
||||
void IncPhase(uint32 p)
|
||||
{
|
||||
// Xinef: protect phase from overflowing
|
||||
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
|
||||
}
|
||||
|
||||
void DecPhase(uint32 p)
|
||||
{
|
||||
if (p >= mEventPhase)
|
||||
mEventPhase = 0;
|
||||
else
|
||||
mEventPhase -= p;
|
||||
}
|
||||
bool IsInPhase(uint32 p) const
|
||||
{
|
||||
if (mEventPhase == 0)
|
||||
return false;
|
||||
return (1 << (mEventPhase - 1)) & p;
|
||||
}
|
||||
void SetPhase(uint32 p = 0) { mEventPhase = p; }
|
||||
|
||||
SmartAIEventList mEvents;
|
||||
SmartAIEventList mInstallEvents;
|
||||
SmartAIEventList mTimedActionList;
|
||||
bool isProcessingTimedActionList;
|
||||
Creature* me;
|
||||
uint64 meOrigGUID;
|
||||
GameObject* go;
|
||||
uint64 goOrigGUID;
|
||||
AreaTrigger const* trigger;
|
||||
SmartScriptType mScriptType;
|
||||
uint32 mEventPhase;
|
||||
|
||||
std::unordered_map<int32, int32> mStoredDecimals;
|
||||
uint32 mPathId;
|
||||
SmartAIEventStoredList mStoredEvents;
|
||||
std::list<uint32> mRemIDs;
|
||||
|
||||
uint32 mTextTimer;
|
||||
uint32 mLastTextID;
|
||||
uint32 mTalkerEntry;
|
||||
bool mUseTextTimer;
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
uint32 mActualCombatDist;
|
||||
uint32 mMaxCombatDist;
|
||||
|
||||
// Xinef: SmartCasterAI, replace above in future
|
||||
uint32 smartCasterActualDist;
|
||||
uint32 smartCasterMaxDist;
|
||||
Powers smartCasterPowerType;
|
||||
|
||||
// Xinef: misc
|
||||
bool _allowPhaseReset;
|
||||
|
||||
SMARTAI_TEMPLATE mTemplate;
|
||||
void InstallEvents();
|
||||
|
||||
void RemoveStoredEvent (uint32 id)
|
||||
{
|
||||
if (!mStoredEvents.empty())
|
||||
{
|
||||
for (SmartAIEventStoredList::iterator i = mStoredEvents.begin(); i != mStoredEvents.end(); ++i)
|
||||
{
|
||||
if (i->event_id == id)
|
||||
{
|
||||
mStoredEvents.erase(i);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
SmartScriptHolder FindLinkedEvent (uint32 link)
|
||||
{
|
||||
if (!mEvents.empty())
|
||||
{
|
||||
for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i)
|
||||
{
|
||||
if (i->event_id == link)
|
||||
{
|
||||
return (*i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
SmartScriptHolder s;
|
||||
return s;
|
||||
}
|
||||
SmartScriptHolder s;
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ void SmartWaypointMgr::LoadFromDB()
|
|||
|
||||
last_entry = entry;
|
||||
total++;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
|
|
@ -141,32 +140,32 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
|||
switch (source_type)
|
||||
{
|
||||
case SMART_SCRIPT_TYPE_CREATURE:
|
||||
{
|
||||
if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
|
||||
continue;
|
||||
if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_SCRIPT_TYPE_GAMEOBJECT:
|
||||
{
|
||||
if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
|
||||
continue;
|
||||
if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_SCRIPT_TYPE_AREATRIGGER:
|
||||
{
|
||||
if (!sObjectMgr->GetAreaTrigger((uint32)temp.entryOrGuid))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
|
||||
continue;
|
||||
if (!sObjectMgr->GetAreaTrigger((uint32)temp.entryOrGuid))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST:
|
||||
break;//nothing to check, really
|
||||
default:
|
||||
|
|
@ -269,8 +268,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
|||
}
|
||||
// store the new event
|
||||
mEventMap[source_type][temp.entryOrGuid].push_back(temp);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
|
|
@ -284,46 +282,46 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
|
|||
{
|
||||
case SMART_TARGET_CREATURE_DISTANCE:
|
||||
case SMART_TARGET_CREATURE_RANGE:
|
||||
{
|
||||
if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
|
||||
return false;
|
||||
if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_GAMEOBJECT_DISTANCE:
|
||||
case SMART_TARGET_GAMEOBJECT_RANGE:
|
||||
{
|
||||
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
|
||||
return false;
|
||||
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_CREATURE_GUID:
|
||||
{
|
||||
if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_GAMEOBJECT_GUID:
|
||||
{
|
||||
if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_PLAYER_DISTANCE:
|
||||
case SMART_TARGET_CLOSEST_PLAYER:
|
||||
{
|
||||
if (e.target.playerDistance.dist == 0)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
if (e.target.playerDistance.dist == 0)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_PLAYER_RANGE:
|
||||
case SMART_TARGET_SELF:
|
||||
case SMART_TARGET_VICTIM:
|
||||
|
|
@ -369,8 +367,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
return false;
|
||||
}
|
||||
if (e.action.type <= 0
|
||||
|| (e.action.type >= SMART_ACTION_TC_END && e.action.type <= SMART_ACTION_AC_START)
|
||||
|| e.action.type >= SMART_ACTION_AC_END)
|
||||
|| (e.action.type >= SMART_ACTION_TC_END && e.action.type <= SMART_ACTION_AC_START)
|
||||
|| e.action.type >= SMART_ACTION_AC_END)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
|
||||
return false;
|
||||
|
|
@ -402,12 +400,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
if (e.target.type < 0 || (e.target.type >= SMART_TARGET_TC_END && e.target.type < SMART_TARGET_AC_START) || e.target.type >= SMART_TARGET_AC_END)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid target type (%u), skipped.",
|
||||
e.entryOrGuid, e.event_id, e.GetTargetType());
|
||||
e.entryOrGuid, e.event_id, e.GetTargetType());
|
||||
return false;
|
||||
}
|
||||
if (e.target.type == SMART_TARGET_LOOT_RECIPIENTS || e.target.type == SMART_TARGET_VEHICLE_PASSENGER) {
|
||||
if (e.target.type == SMART_TARGET_LOOT_RECIPIENTS || e.target.type == SMART_TARGET_VEHICLE_PASSENGER)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has a target type that is not yet supported on AzerothCore (%u), skipped.",
|
||||
e.entryOrGuid, e.event_id, e.GetTargetType());
|
||||
e.entryOrGuid, e.event_id, e.GetTargetType());
|
||||
return false;
|
||||
}
|
||||
if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)
|
||||
|
|
@ -472,7 +471,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
break;
|
||||
case SMART_EVENT_OOC_LOS:
|
||||
case SMART_EVENT_IC_LOS:
|
||||
if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax)) {
|
||||
if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -501,17 +501,17 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
return false;
|
||||
break;
|
||||
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
|
||||
{
|
||||
if (!IsSpellValid(e, e.event.missingBuff.spell))
|
||||
return false;
|
||||
{
|
||||
if (!IsSpellValid(e, e.event.missingBuff.spell))
|
||||
return false;
|
||||
|
||||
if (!NotNULL(e, e.event.missingBuff.radius))
|
||||
return false;
|
||||
if (!NotNULL(e, e.event.missingBuff.radius))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_KILL:
|
||||
if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax))
|
||||
return false;
|
||||
|
|
@ -548,84 +548,84 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
return false;
|
||||
break;
|
||||
case SMART_EVENT_RECEIVE_EMOTE:
|
||||
{
|
||||
if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote))
|
||||
return false;
|
||||
{
|
||||
if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_HAS_AURA:
|
||||
case SMART_EVENT_TARGET_BUFFED:
|
||||
{
|
||||
if (!IsSpellValid(e, e.event.aura.spell))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_TRANSPORT_ADDCREATURE:
|
||||
{
|
||||
if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_MOVEMENTINFORM:
|
||||
{
|
||||
if (e.event.movementInform.type > NULL_MOTION_TYPE)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
|
||||
return false;
|
||||
if (!IsSpellValid(e, e.event.aura.spell))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_TRANSPORT_ADDCREATURE:
|
||||
{
|
||||
if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_MOVEMENTINFORM:
|
||||
{
|
||||
if (e.event.movementInform.type > NULL_MOTION_TYPE)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_DATA_SET:
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_AREATRIGGER_ONTRIGGER:
|
||||
{
|
||||
if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_TEXT_OVER:
|
||||
//if (e.event.textOver.textGroupID && !IsTextValid(e, e.event.textOver.textGroupID)) return false;// 0 is a valid text group!
|
||||
break;
|
||||
case SMART_EVENT_LINK:
|
||||
{
|
||||
if (e.link && e.link == e.event_id)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
return false;
|
||||
if (e.link && e.link == e.event_id)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_GAME_EVENT_START:
|
||||
case SMART_EVENT_GAME_EVENT_END:
|
||||
{
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_ACTION_DONE:
|
||||
{
|
||||
if (e.event.doAction.eventId > EVENT_CHARGE)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
|
||||
return false;
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_ACTION_DONE:
|
||||
{
|
||||
if (e.event.doAction.eventId > EVENT_CHARGE)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_FRIENDLY_HEALTH_PCT:
|
||||
if (!IsMinMaxValid(e, e.event.friendlyHealthPct.repeatMin, e.event.friendlyHealthPct.repeatMax))
|
||||
return false;
|
||||
|
|
@ -898,7 +898,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
case SMART_ACTION_SET_EVENT_PHASE:
|
||||
if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1);
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
|
@ -921,21 +921,21 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
case SMART_ACTION_RANDOM_PHASE:
|
||||
{
|
||||
if (e.action.randomPhase.phase1 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase2 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase3 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase4 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
|
||||
e.action.randomPhase.phase2 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase3 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase4 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
if (e.action.randomPhase.phase1 == 0 &&
|
||||
e.action.randomPhase.phase2 == 0 &&
|
||||
e.action.randomPhase.phase3 == 0 &&
|
||||
e.action.randomPhase.phase4 == 0 &&
|
||||
e.action.randomPhase.phase5 == 0 &&
|
||||
e.action.randomPhase.phase6 == 0)
|
||||
e.action.randomPhase.phase2 == 0 &&
|
||||
e.action.randomPhase.phase3 == 0 &&
|
||||
e.action.randomPhase.phase4 == 0 &&
|
||||
e.action.randomPhase.phase5 == 0 &&
|
||||
e.action.randomPhase.phase6 == 0)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
|
|
@ -945,7 +945,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
case SMART_ACTION_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
|
||||
{
|
||||
if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX ||
|
||||
e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX)
|
||||
e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
|
|
@ -1034,20 +1034,20 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
break;
|
||||
}
|
||||
case SMART_ACTION_CREATE_TIMED_EVENT:
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max))
|
||||
return false;
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST:
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_POWER:
|
||||
case SMART_ACTION_ADD_POWER:
|
||||
case SMART_ACTION_REMOVE_POWER:
|
||||
|
|
@ -1058,82 +1058,82 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||
}
|
||||
break;
|
||||
case SMART_ACTION_GAME_EVENT_STOP:
|
||||
{
|
||||
return false;
|
||||
uint32 eventId = e.action.gameEventStop.id;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
if (eventId < 1 || eventId >= events.size())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
|
||||
return false;
|
||||
}
|
||||
uint32 eventId = e.action.gameEventStop.id;
|
||||
|
||||
GameEventData const& eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_GAME_EVENT_START:
|
||||
{
|
||||
return false;
|
||||
uint32 eventId = e.action.gameEventStart.id;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
if (eventId < 1 || eventId >= events.size())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameEventData const& eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_EQUIP:
|
||||
{
|
||||
|
||||
if (e.GetScriptType() == SMART_SCRIPT_TYPE_CREATURE)
|
||||
{
|
||||
int8 equipId = (int8)e.action.equip.entry;
|
||||
|
||||
if (equipId)
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
if (eventId < 1 || eventId >= events.size())
|
||||
{
|
||||
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.entryOrGuid, equipId);
|
||||
if (!einfo)
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameEventData const& eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_GAME_EVENT_START:
|
||||
{
|
||||
return false;
|
||||
uint32 eventId = e.action.gameEventStart.id;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
if (eventId < 1 || eventId >= events.size())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameEventData const& eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_EQUIP:
|
||||
{
|
||||
|
||||
if (e.GetScriptType() == SMART_SCRIPT_TYPE_CREATURE)
|
||||
{
|
||||
int8 equipId = (int8)e.action.equip.entry;
|
||||
|
||||
if (equipId)
|
||||
{
|
||||
sLog->outError("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u, skipped.", equipId, e.entryOrGuid);
|
||||
return false;
|
||||
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.entryOrGuid, equipId);
|
||||
if (!einfo)
|
||||
{
|
||||
sLog->outError("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u, skipped.", equipId, e.entryOrGuid);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_LOAD_GRID:
|
||||
{
|
||||
if (!acore::IsValidMapCoord(e.target.x, e.target.y))
|
||||
{
|
||||
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
|
||||
return false;
|
||||
if (!acore::IsValidMapCoord(e.target.x, e.target.y))
|
||||
{
|
||||
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE:
|
||||
{
|
||||
if (e.GetScriptType() == SMART_SCRIPT_TYPE_GAMEOBJECT)
|
||||
{
|
||||
sLog->outErrorDb("SmartScript: action_type %u is not allowed with source_type %u. Entry %u, skipped.", e.GetActionType(), e.GetScriptType(), e.entryOrGuid);
|
||||
return false;
|
||||
if (e.GetScriptType() == SMART_SCRIPT_TYPE_GAMEOBJECT)
|
||||
{
|
||||
sLog->outErrorDb("SmartScript: action_type %u is not allowed with source_type %u. Entry %u, skipped.", e.GetActionType(), e.GetScriptType(), e.entryOrGuid);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_START_CLOSEST_WAYPOINT:
|
||||
case SMART_ACTION_FOLLOW:
|
||||
case SMART_ACTION_SET_ORIENTATION:
|
||||
|
|
|
|||
|
|
@ -1227,12 +1227,14 @@ struct SmartAction
|
|||
uint32 coneAngle;
|
||||
} coneSummon;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
uint32 textId;
|
||||
uint32 flag;
|
||||
} playerTalk;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
uint32 spell;
|
||||
uint32 flags;
|
||||
uint32 bp1;
|
||||
|
|
@ -1240,7 +1242,8 @@ struct SmartAction
|
|||
uint32 bp3;
|
||||
} castCustom;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
uint32 summonEntry;
|
||||
uint32 summonDuration;
|
||||
uint32 a;
|
||||
|
|
@ -1653,8 +1656,8 @@ enum SmartEventFlags
|
|||
SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build
|
||||
SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset()
|
||||
|
||||
SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3),
|
||||
SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET)
|
||||
SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0 | SMART_EVENT_FLAG_DIFFICULTY_1 | SMART_EVENT_FLAG_DIFFICULTY_2 | SMART_EVENT_FLAG_DIFFICULTY_3),
|
||||
SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE | SMART_EVENT_FLAG_DIFFICULTY_ALL | SMART_EVENT_FLAG_RESERVED_5 | SMART_EVENT_FLAG_RESERVED_6 | SMART_EVENT_FLAG_DEBUG_ONLY | SMART_EVENT_FLAG_DONT_RESET)
|
||||
};
|
||||
|
||||
enum SmartCastFlags
|
||||
|
|
@ -1684,11 +1687,11 @@ struct SmartScriptHolder
|
|||
SmartAction action;
|
||||
SmartTarget target;
|
||||
|
||||
public:
|
||||
uint32 GetScriptType() const { return (uint32)source_type; }
|
||||
uint32 GetEventType() const { return (uint32)event.type; }
|
||||
uint32 GetActionType() const { return (uint32)action.type; }
|
||||
uint32 GetTargetType() const { return (uint32)target.type; }
|
||||
public:
|
||||
uint32 GetScriptType() const { return (uint32)source_type; }
|
||||
uint32 GetEventType() const { return (uint32)event.type; }
|
||||
uint32 GetActionType() const { return (uint32)action.type; }
|
||||
uint32 GetTargetType() const { return (uint32)target.type; }
|
||||
|
||||
uint32 timer;
|
||||
bool active;
|
||||
|
|
@ -1758,22 +1761,22 @@ typedef std::unordered_map<uint32, ObjectGuidList*> ObjectListMap;
|
|||
class SmartWaypointMgr
|
||||
{
|
||||
SmartWaypointMgr() {}
|
||||
public:
|
||||
~SmartWaypointMgr();
|
||||
public:
|
||||
~SmartWaypointMgr();
|
||||
|
||||
static SmartWaypointMgr* instance();
|
||||
static SmartWaypointMgr* instance();
|
||||
|
||||
void LoadFromDB();
|
||||
void LoadFromDB();
|
||||
|
||||
WPPath* GetPath(uint32 id)
|
||||
{
|
||||
if (waypoint_map.find(id) != waypoint_map.end())
|
||||
return waypoint_map[id];
|
||||
else return 0;
|
||||
}
|
||||
WPPath* GetPath(uint32 id)
|
||||
{
|
||||
if (waypoint_map.find(id) != waypoint_map.end())
|
||||
return waypoint_map[id];
|
||||
else return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<uint32, WPPath*> waypoint_map;
|
||||
private:
|
||||
std::unordered_map<uint32, WPPath*> waypoint_map;
|
||||
};
|
||||
|
||||
// all events for a single entry
|
||||
|
|
@ -1785,167 +1788,167 @@ typedef std::unordered_map<int32, SmartAIEventList> SmartAIEventMap;
|
|||
|
||||
class SmartAIMgr
|
||||
{
|
||||
SmartAIMgr(){};
|
||||
public:
|
||||
~SmartAIMgr(){};
|
||||
SmartAIMgr() {};
|
||||
public:
|
||||
~SmartAIMgr() {};
|
||||
|
||||
static SmartAIMgr* instance();
|
||||
static SmartAIMgr* instance();
|
||||
|
||||
void LoadSmartAIFromDB();
|
||||
void LoadSmartAIFromDB();
|
||||
|
||||
SmartAIEventList GetScript(int32 entry, SmartScriptType type)
|
||||
SmartAIEventList GetScript(int32 entry, SmartScriptType type)
|
||||
{
|
||||
SmartAIEventList temp;
|
||||
if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
|
||||
return mEventMap[uint32(type)][entry];
|
||||
else
|
||||
{
|
||||
SmartAIEventList temp;
|
||||
if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
|
||||
return mEventMap[uint32(type)][entry];
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (entry > 0) //first search is for guid (negative), do not drop error if not found
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
|
||||
if (entry > 0) //first search is for guid (negative), do not drop error if not found
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
|
||||
#endif
|
||||
return temp;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
//event stores
|
||||
SmartAIEventMap mEventMap[SMART_SCRIPT_TYPE_MAX];
|
||||
private:
|
||||
//event stores
|
||||
SmartAIEventMap mEventMap[SMART_SCRIPT_TYPE_MAX];
|
||||
|
||||
bool IsEventValid(SmartScriptHolder& e);
|
||||
bool IsTargetValid(SmartScriptHolder const& e);
|
||||
bool IsEventValid(SmartScriptHolder& e);
|
||||
bool IsTargetValid(SmartScriptHolder const& e);
|
||||
|
||||
/*inline bool IsTargetValid(SmartScriptHolder e, int32 target)
|
||||
/*inline bool IsTargetValid(SmartScriptHolder e, int32 target)
|
||||
{
|
||||
if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END)
|
||||
{
|
||||
if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max)
|
||||
{
|
||||
if (max < min)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
/*inline bool IsPercentValid(SmartScriptHolder e, int32 pct)
|
||||
bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max)
|
||||
{
|
||||
if (max < min)
|
||||
{
|
||||
if (pct < -100 || pct > 100)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
bool NotNULL(SmartScriptHolder const& e, uint32 data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry)
|
||||
/*inline bool IsPercentValid(SmartScriptHolder e, int32 pct)
|
||||
{
|
||||
if (pct < -100 || pct > 100)
|
||||
{
|
||||
if (!sObjectMgr->GetCreatureTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
bool IsQuestValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool NotNULL(SmartScriptHolder const& e, uint32 data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
if (!sObjectMgr->GetQuestTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetCreatureTemplate(entry))
|
||||
{
|
||||
if (!sObjectMgr->GetGameObjectTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSpellValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsQuestValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetQuestTemplate(entry))
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsItemValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetGameObjectTemplate(entry))
|
||||
{
|
||||
if (!sObjectMgr->GetItemTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsSpellValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(entry))
|
||||
{
|
||||
if (!sEmotesTextStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsItemValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetItemTemplate(entry))
|
||||
{
|
||||
if (!sEmotesStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sEmotesTextStore.LookupEntry(entry))
|
||||
{
|
||||
if (!sObjectMgr->GetAreaTrigger(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSoundValid(SmartScriptHolder const& e, uint32 entry)
|
||||
bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sEmotesStore.LookupEntry(entry))
|
||||
{
|
||||
if (!sSoundEntriesStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool IsTextValid(SmartScriptHolder const& e, uint32 id);
|
||||
bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetAreaTrigger(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSoundValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sSoundEntriesStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool IsTextValid(SmartScriptHolder const& e, uint32 id);
|
||||
};
|
||||
|
||||
#define sSmartScriptMgr SmartAIMgr::instance()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -29,11 +29,12 @@ struct CriteriaProgress
|
|||
};
|
||||
|
||||
enum AchievementCriteriaDataType
|
||||
{ // value1 value2 comment
|
||||
{
|
||||
// value1 value2 comment
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0, // 0 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE = 1, // creature_id 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE = 2, // class_id race_id
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH= 3, // health_percent 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH = 3, // health_percent 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD = 4, // own_team 0 not corpse (not released body), own_team == false if enemy team expected
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA = 5, // spell_id effect_idx
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA = 6, // area id 0
|
||||
|
|
@ -58,7 +59,7 @@ enum AchievementCriteriaDataType
|
|||
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 24 // maximum value in AchievementCriteriaDataType enum
|
||||
|
||||
enum AchievementCommonCategories
|
||||
{
|
||||
{
|
||||
ACHIEVEMENT_CATEOGRY_GENERAL = -1,
|
||||
ACHIEVEMENT_CATEGORY_STATISTICS = 1
|
||||
};
|
||||
|
|
@ -205,14 +206,14 @@ struct AchievementCriteriaData
|
|||
|
||||
struct AchievementCriteriaDataSet
|
||||
{
|
||||
AchievementCriteriaDataSet() : criteria_id(0) {}
|
||||
typedef std::vector<AchievementCriteriaData> Storage;
|
||||
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
|
||||
bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
|
||||
void SetCriteriaId(uint32 id) {criteria_id = id;}
|
||||
private:
|
||||
uint32 criteria_id;
|
||||
Storage storage;
|
||||
AchievementCriteriaDataSet() : criteria_id(0) {}
|
||||
typedef std::vector<AchievementCriteriaData> Storage;
|
||||
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
|
||||
bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
|
||||
void SetCriteriaId(uint32 id) {criteria_id = id;}
|
||||
private:
|
||||
uint32 criteria_id;
|
||||
Storage storage;
|
||||
};
|
||||
|
||||
typedef std::map<uint32, AchievementCriteriaDataSet> AchievementCriteriaDataMap;
|
||||
|
|
@ -252,140 +253,140 @@ class WorldPacket;
|
|||
|
||||
class AchievementMgr
|
||||
{
|
||||
public:
|
||||
AchievementMgr(Player* player);
|
||||
~AchievementMgr();
|
||||
public:
|
||||
AchievementMgr(Player* player);
|
||||
~AchievementMgr();
|
||||
|
||||
void Reset();
|
||||
static void DeleteFromDB(uint32 lowguid);
|
||||
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
|
||||
void SaveToDB(SQLTransaction& trans);
|
||||
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete = false);
|
||||
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr);
|
||||
void CompletedAchievement(AchievementEntry const* entry);
|
||||
void CheckAllAchievementCriteria();
|
||||
void SendAllAchievementData() const;
|
||||
void SendRespondInspectAchievements(Player* player) const;
|
||||
bool HasAchieved(uint32 achievementId) const;
|
||||
Player* GetPlayer() const { return m_player; }
|
||||
void UpdateTimedAchievements(uint32 timeDiff);
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
|
||||
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
|
||||
void Reset();
|
||||
static void DeleteFromDB(uint32 lowguid);
|
||||
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
|
||||
void SaveToDB(SQLTransaction& trans);
|
||||
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete = false);
|
||||
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr);
|
||||
void CompletedAchievement(AchievementEntry const* entry);
|
||||
void CheckAllAchievementCriteria();
|
||||
void SendAllAchievementData() const;
|
||||
void SendRespondInspectAchievements(Player* player) const;
|
||||
bool HasAchieved(uint32 achievementId) const;
|
||||
Player* GetPlayer() const { return m_player; }
|
||||
void UpdateTimedAchievements(uint32 timeDiff);
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
|
||||
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
|
||||
|
||||
void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry);
|
||||
private:
|
||||
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST, PROGRESS_RESET };
|
||||
void SendAchievementEarned(AchievementEntry const* achievement) const;
|
||||
void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) const;
|
||||
CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry);
|
||||
void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET);
|
||||
void CompletedCriteriaFor(AchievementEntry const* achievement);
|
||||
bool IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement);
|
||||
bool IsCompletedAchievement(AchievementEntry const* entry);
|
||||
bool CanUpdateCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement);
|
||||
void BuildAllDataPacket(WorldPacket* data, bool inspect = false) const;
|
||||
void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry);
|
||||
private:
|
||||
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST, PROGRESS_RESET };
|
||||
void SendAchievementEarned(AchievementEntry const* achievement) const;
|
||||
void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) const;
|
||||
CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry);
|
||||
void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET);
|
||||
void CompletedCriteriaFor(AchievementEntry const* achievement);
|
||||
bool IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement);
|
||||
bool IsCompletedAchievement(AchievementEntry const* entry);
|
||||
bool CanUpdateCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement);
|
||||
void BuildAllDataPacket(WorldPacket* data, bool inspect = false) const;
|
||||
|
||||
Player* m_player;
|
||||
CriteriaProgressMap m_criteriaProgress;
|
||||
CompletedAchievementMap m_completedAchievements;
|
||||
typedef std::map<uint32, uint32> TimedAchievementMap;
|
||||
TimedAchievementMap m_timedAchievements; // Criteria id/time left in MS
|
||||
Player* m_player;
|
||||
CriteriaProgressMap m_criteriaProgress;
|
||||
CompletedAchievementMap m_completedAchievements;
|
||||
typedef std::map<uint32, uint32> TimedAchievementMap;
|
||||
TimedAchievementMap m_timedAchievements; // Criteria id/time left in MS
|
||||
};
|
||||
|
||||
class AchievementGlobalMgr
|
||||
{
|
||||
AchievementGlobalMgr() {}
|
||||
~AchievementGlobalMgr() {}
|
||||
AchievementGlobalMgr() {}
|
||||
~AchievementGlobalMgr() {}
|
||||
|
||||
public:
|
||||
static AchievementGlobalMgr* instance();
|
||||
public:
|
||||
static AchievementGlobalMgr* instance();
|
||||
|
||||
bool IsStatisticCriteria(AchievementCriteriaEntry const* achievementCriteria) const;
|
||||
bool isStatisticAchievement(AchievementEntry const* achievement) const;
|
||||
|
||||
AchievementCriteriaEntryList const* GetAchievementCriteriaByType(AchievementCriteriaTypes type) const
|
||||
{
|
||||
return &m_AchievementCriteriasByType[type];
|
||||
}
|
||||
bool IsStatisticCriteria(AchievementCriteriaEntry const* achievementCriteria) const;
|
||||
bool isStatisticAchievement(AchievementEntry const* achievement) const;
|
||||
|
||||
AchievementCriteriaEntryList const* GetSpecialAchievementCriteriaByType(AchievementCriteriaTypes type, uint32 val)
|
||||
{
|
||||
if (m_SpecialList[type].find(val) != m_SpecialList[type].end())
|
||||
return &m_SpecialList[type][val];
|
||||
return nullptr;
|
||||
}
|
||||
AchievementCriteriaEntryList const* GetAchievementCriteriaByType(AchievementCriteriaTypes type) const
|
||||
{
|
||||
return &m_AchievementCriteriasByType[type];
|
||||
}
|
||||
|
||||
AchievementCriteriaEntryList const* GetAchievementCriteriaByCondition(AchievementCriteriaCondition condition, uint32 val)
|
||||
{
|
||||
if (m_AchievementCriteriasByCondition[condition].find(val) != m_AchievementCriteriasByCondition[condition].end())
|
||||
return &m_AchievementCriteriasByCondition[condition][val];
|
||||
return nullptr;
|
||||
}
|
||||
AchievementCriteriaEntryList const* GetSpecialAchievementCriteriaByType(AchievementCriteriaTypes type, uint32 val)
|
||||
{
|
||||
if (m_SpecialList[type].find(val) != m_SpecialList[type].end())
|
||||
return &m_SpecialList[type][val];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const
|
||||
{
|
||||
return m_AchievementCriteriasByTimedType[type];
|
||||
}
|
||||
AchievementCriteriaEntryList const* GetAchievementCriteriaByCondition(AchievementCriteriaCondition condition, uint32 val)
|
||||
{
|
||||
if (m_AchievementCriteriasByCondition[condition].find(val) != m_AchievementCriteriasByCondition[condition].end())
|
||||
return &m_AchievementCriteriasByCondition[condition][val];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) const
|
||||
{
|
||||
AchievementCriteriaListByAchievement::const_iterator itr = m_AchievementCriteriaListByAchievement.find(id);
|
||||
return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : nullptr;
|
||||
}
|
||||
AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const
|
||||
{
|
||||
return m_AchievementCriteriasByTimedType[type];
|
||||
}
|
||||
|
||||
AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const
|
||||
{
|
||||
AchievementListByReferencedId::const_iterator itr = m_AchievementListByReferencedId.find(id);
|
||||
return itr != m_AchievementListByReferencedId.end() ? &itr->second : nullptr;
|
||||
}
|
||||
AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) const
|
||||
{
|
||||
AchievementCriteriaListByAchievement::const_iterator itr = m_AchievementCriteriaListByAchievement.find(id);
|
||||
return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : nullptr;
|
||||
}
|
||||
|
||||
AchievementReward const* GetAchievementReward(AchievementEntry const* achievement) const
|
||||
{
|
||||
AchievementRewards::const_iterator iter = m_achievementRewards.find(achievement->ID);
|
||||
return iter != m_achievementRewards.end() ? &iter->second : nullptr;
|
||||
}
|
||||
AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const
|
||||
{
|
||||
AchievementListByReferencedId::const_iterator itr = m_AchievementListByReferencedId.find(id);
|
||||
return itr != m_AchievementListByReferencedId.end() ? &itr->second : nullptr;
|
||||
}
|
||||
|
||||
AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement) const
|
||||
{
|
||||
AchievementRewardLocales::const_iterator iter = m_achievementRewardLocales.find(achievement->ID);
|
||||
return iter != m_achievementRewardLocales.end() ? &iter->second : nullptr;
|
||||
}
|
||||
AchievementReward const* GetAchievementReward(AchievementEntry const* achievement) const
|
||||
{
|
||||
AchievementRewards::const_iterator iter = m_achievementRewards.find(achievement->ID);
|
||||
return iter != m_achievementRewards.end() ? &iter->second : nullptr;
|
||||
}
|
||||
|
||||
AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const* achievementCriteria) const
|
||||
{
|
||||
AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID);
|
||||
return iter != m_criteriaDataMap.end() ? &iter->second : nullptr;
|
||||
}
|
||||
AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement) const
|
||||
{
|
||||
AchievementRewardLocales::const_iterator iter = m_achievementRewardLocales.find(achievement->ID);
|
||||
return iter != m_achievementRewardLocales.end() ? &iter->second : nullptr;
|
||||
}
|
||||
|
||||
bool IsRealmCompleted(AchievementEntry const* achievement) const;
|
||||
void SetRealmCompleted(AchievementEntry const* achievement);
|
||||
AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const* achievementCriteria) const
|
||||
{
|
||||
AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID);
|
||||
return iter != m_criteriaDataMap.end() ? &iter->second : nullptr;
|
||||
}
|
||||
|
||||
void LoadAchievementCriteriaList();
|
||||
void LoadAchievementCriteriaData();
|
||||
void LoadAchievementReferenceList();
|
||||
void LoadCompletedAchievements();
|
||||
void LoadRewards();
|
||||
void LoadRewardLocales();
|
||||
private:
|
||||
AchievementCriteriaDataMap m_criteriaDataMap;
|
||||
bool IsRealmCompleted(AchievementEntry const* achievement) const;
|
||||
void SetRealmCompleted(AchievementEntry const* achievement);
|
||||
|
||||
// store achievement criterias by type to speed up lookup
|
||||
AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
|
||||
AchievementCriteriaEntryList m_AchievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX];
|
||||
// store achievement criterias by achievement to speed up lookup
|
||||
AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement;
|
||||
// store achievements by referenced achievement id to speed up lookup
|
||||
AchievementListByReferencedId m_AchievementListByReferencedId;
|
||||
void LoadAchievementCriteriaList();
|
||||
void LoadAchievementCriteriaData();
|
||||
void LoadAchievementReferenceList();
|
||||
void LoadCompletedAchievements();
|
||||
void LoadRewards();
|
||||
void LoadRewardLocales();
|
||||
private:
|
||||
AchievementCriteriaDataMap m_criteriaDataMap;
|
||||
|
||||
typedef std::unordered_map<uint32 /*achievementId*/, std::chrono::system_clock::time_point /*completionTime*/> AllCompletedAchievements;
|
||||
AllCompletedAchievements m_allCompletedAchievements;
|
||||
// store achievement criterias by type to speed up lookup
|
||||
AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
|
||||
AchievementCriteriaEntryList m_AchievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX];
|
||||
// store achievement criterias by achievement to speed up lookup
|
||||
AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement;
|
||||
// store achievements by referenced achievement id to speed up lookup
|
||||
AchievementListByReferencedId m_AchievementListByReferencedId;
|
||||
|
||||
AchievementRewards m_achievementRewards;
|
||||
AchievementRewardLocales m_achievementRewardLocales;
|
||||
typedef std::unordered_map<uint32 /*achievementId*/, std::chrono::system_clock::time_point /*completionTime*/> AllCompletedAchievements;
|
||||
AllCompletedAchievements m_allCompletedAchievements;
|
||||
|
||||
// pussywizard:
|
||||
std::map<uint32, AchievementCriteriaEntryList> m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
|
||||
std::map<uint32, AchievementCriteriaEntryList> m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL];
|
||||
AchievementRewards m_achievementRewards;
|
||||
AchievementRewardLocales m_achievementRewardLocales;
|
||||
|
||||
// pussywizard:
|
||||
std::map<uint32, AchievementCriteriaEntryList> m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
|
||||
std::map<uint32, AchievementCriteriaEntryList> m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL];
|
||||
};
|
||||
|
||||
#define sAchievementMgr AchievementGlobalMgr::instance()
|
||||
|
|
|
|||
|
|
@ -15,106 +15,105 @@
|
|||
namespace AddonMgr
|
||||
{
|
||||
|
||||
// Anonymous namespace ensures file scope of all the stuff inside it, even
|
||||
// if you add something more to this namespace somewhere else.
|
||||
namespace
|
||||
{
|
||||
// List of saved addons (in DB).
|
||||
typedef std::list<SavedAddon> SavedAddonsList;
|
||||
|
||||
SavedAddonsList m_knownAddons;
|
||||
BannedAddonList m_bannedAddons;
|
||||
}
|
||||
|
||||
void LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
|
||||
if (!result)
|
||||
// Anonymous namespace ensures file scope of all the stuff inside it, even
|
||||
// if you add something more to this namespace somewhere else.
|
||||
namespace
|
||||
{
|
||||
sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!");
|
||||
sLog->outString();
|
||||
return;
|
||||
// List of saved addons (in DB).
|
||||
typedef std::list<SavedAddon> SavedAddonsList;
|
||||
|
||||
SavedAddonsList m_knownAddons;
|
||||
BannedAddonList m_bannedAddons;
|
||||
}
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
void LoadFromDB()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
std::string name = fields[0].GetString();
|
||||
uint32 crc = fields[1].GetUInt32();
|
||||
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
|
||||
if (!result)
|
||||
{
|
||||
sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!");
|
||||
sLog->outString();
|
||||
return;
|
||||
}
|
||||
|
||||
m_knownAddons.push_back(SavedAddon(name, crc));
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
|
||||
oldMSTime = getMSTime();
|
||||
result = CharacterDatabase.Query("SELECT id, name, version, UNIX_TIMESTAMP(timestamp) FROM banned_addons");
|
||||
if (result)
|
||||
{
|
||||
uint32 count = 0;
|
||||
uint32 offset = 102;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
BannedAddon addon;
|
||||
addon.Id = fields[0].GetUInt32() + offset;
|
||||
addon.Timestamp = uint32(fields[3].GetUInt64());
|
||||
std::string name = fields[0].GetString();
|
||||
uint32 crc = fields[1].GetUInt32();
|
||||
|
||||
std::string name = fields[1].GetString();
|
||||
std::string version = fields[2].GetString();
|
||||
|
||||
MD5(reinterpret_cast<uint8 const*>(name.c_str()), name.length(), addon.NameMD5);
|
||||
MD5(reinterpret_cast<uint8 const*>(version.c_str()), version.length(), addon.VersionMD5);
|
||||
|
||||
m_bannedAddons.push_back(addon);
|
||||
m_knownAddons.push_back(SavedAddon(name, crc));
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
sLog->outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
|
||||
oldMSTime = getMSTime();
|
||||
result = CharacterDatabase.Query("SELECT id, name, version, UNIX_TIMESTAMP(timestamp) FROM banned_addons");
|
||||
if (result)
|
||||
{
|
||||
uint32 count = 0;
|
||||
uint32 offset = 102;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
BannedAddon addon;
|
||||
addon.Id = fields[0].GetUInt32() + offset;
|
||||
addon.Timestamp = uint32(fields[3].GetUInt64());
|
||||
|
||||
std::string name = fields[1].GetString();
|
||||
std::string version = fields[2].GetString();
|
||||
|
||||
MD5(reinterpret_cast<uint8 const*>(name.c_str()), name.length(), addon.NameMD5);
|
||||
MD5(reinterpret_cast<uint8 const*>(version.c_str()), version.length(), addon.VersionMD5);
|
||||
|
||||
m_bannedAddons.push_back(addon);
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SaveAddon(AddonInfo const& addon)
|
||||
{
|
||||
std::string name = addon.Name;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ADDON);
|
||||
|
||||
stmt->setString(0, name);
|
||||
stmt->setUInt32(1, addon.CRC);
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
m_knownAddons.push_back(SavedAddon(addon.Name, addon.CRC));
|
||||
}
|
||||
|
||||
SavedAddon const* GetAddonInfo(const std::string& name)
|
||||
{
|
||||
for (SavedAddonsList::const_iterator it = m_knownAddons.begin(); it != m_knownAddons.end(); ++it)
|
||||
void SaveAddon(AddonInfo const& addon)
|
||||
{
|
||||
SavedAddon const& addon = (*it);
|
||||
if (addon.Name == name)
|
||||
return &addon;
|
||||
std::string name = addon.Name;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ADDON);
|
||||
|
||||
stmt->setString(0, name);
|
||||
stmt->setUInt32(1, addon.CRC);
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
m_knownAddons.push_back(SavedAddon(addon.Name, addon.CRC));
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
SavedAddon const* GetAddonInfo(const std::string& name)
|
||||
{
|
||||
for (SavedAddonsList::const_iterator it = m_knownAddons.begin(); it != m_knownAddons.end(); ++it)
|
||||
{
|
||||
SavedAddon const& addon = (*it);
|
||||
if (addon.Name == name)
|
||||
return &addon;
|
||||
}
|
||||
|
||||
BannedAddonList const* GetBannedAddons()
|
||||
{
|
||||
return &m_bannedAddons;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BannedAddonList const* GetBannedAddons()
|
||||
{
|
||||
return &m_bannedAddons;
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace ArenaSpectator
|
|||
void CreatePacket(WorldPacket& data, const char* m)
|
||||
{
|
||||
size_t len = strlen(m);
|
||||
data.Initialize(SMSG_MESSAGECHAT, 1+4+8+4+8+4+1+len+1);
|
||||
data.Initialize(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + 8 + 4 + 1 + len + 1);
|
||||
data << uint8(CHAT_MSG_WHISPER);
|
||||
data << uint32(LANG_ADDON);
|
||||
data << uint64(0);
|
||||
|
|
@ -87,7 +87,7 @@ namespace ArenaSpectator
|
|||
bg->SpectatorsSendPacket(data);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
template<class T>
|
||||
void SendCommand_String(T* o, uint64 targetGUID, const char* prefix, const char* c)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
|
|
@ -163,29 +163,29 @@ namespace ArenaSpectator
|
|||
SendCommand_UInt32Value(p, itr->first, "STA", plr->IsAlive() ? 1 : 0);
|
||||
Powers ptype = plr->getPowerType();
|
||||
SendCommand_UInt32Value(p, itr->first, "PWT", ptype);
|
||||
SendCommand_UInt32Value(p, itr->first, "MPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetMaxPower(ptype)/10 : plr->GetMaxPower(ptype));
|
||||
SendCommand_UInt32Value(p, itr->first, "CPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetPower(ptype)/10 : plr->GetPower(ptype));
|
||||
SendCommand_UInt32Value(p, itr->first, "MPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetMaxPower(ptype) / 10 : plr->GetMaxPower(ptype));
|
||||
SendCommand_UInt32Value(p, itr->first, "CPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetPower(ptype) / 10 : plr->GetPower(ptype));
|
||||
Pet* pet = plr->GetPet();
|
||||
SendCommand_UInt32Value(p, itr->first, "PHP", pet && pet->GetCreatureTemplate()->family ? (uint32)pet->GetHealthPct() : 0);
|
||||
SendCommand_UInt32Value(p, itr->first, "PET", pet ? pet->GetCreatureTemplate()->family : 0);
|
||||
SendCommand_GUID(p, itr->first, "TRG", plr->GetTarget());
|
||||
SendCommand_UInt32Value(p, itr->first, "RES", 1);
|
||||
SendCommand_UInt32Value(p, itr->first, "CDC", 1);
|
||||
SendCommand_UInt32Value(p, itr->first, "TIM", (bg->GetStartTime() < 46*MINUTE*IN_MILLISECONDS) ? (46*MINUTE*IN_MILLISECONDS-bg->GetStartTime())/IN_MILLISECONDS : 0);
|
||||
SendCommand_UInt32Value(p, itr->first, "TIM", (bg->GetStartTime() < 46 * MINUTE * IN_MILLISECONDS) ? (46 * MINUTE * IN_MILLISECONDS - bg->GetStartTime()) / IN_MILLISECONDS : 0);
|
||||
// "SPE" not here (only possible to send starting a new cast)
|
||||
|
||||
// send all "CD"
|
||||
SpellCooldowns const& sc = plr->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itrc = sc.begin(); itrc != sc.end(); ++itrc)
|
||||
if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS)
|
||||
if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end)/1000))
|
||||
SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration/1000);
|
||||
if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN * IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX * IN_MILLISECONDS)
|
||||
if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end) / 1000))
|
||||
SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration / 1000);
|
||||
|
||||
// send all visible "AUR"
|
||||
Unit::VisibleAuraMap const *visibleAuras = plr->GetVisibleAuras();
|
||||
Unit::VisibleAuraMap const* visibleAuras = plr->GetVisibleAuras();
|
||||
for (Unit::VisibleAuraMap::const_iterator aitr = visibleAuras->begin(); aitr != visibleAuras->end(); ++aitr)
|
||||
{
|
||||
Aura *aura = aitr->second->GetBase();
|
||||
Aura* aura = aitr->second->GetBase();
|
||||
if (ShouldSendAura(aura, aitr->second->GetEffectMask(), plr->GetGUID(), false))
|
||||
SendCommand_Aura(p, itr->first, "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), false);
|
||||
}
|
||||
|
|
@ -200,13 +200,13 @@ namespace ArenaSpectator
|
|||
if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
|
||||
return true;
|
||||
|
||||
for(uint8 i=EFFECT_0; i<MAX_SPELL_EFFECTS; ++i)
|
||||
for(uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (effMask & (1<<i))
|
||||
if (effMask & (1 << i))
|
||||
{
|
||||
AuraType at = aura->GetEffect(i)->GetAuraType();
|
||||
if ((aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID())) ||
|
||||
at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY)
|
||||
if ((aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID())) ||
|
||||
at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
|||
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_WON), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, 0, 0))
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
|
||||
|
|
@ -139,7 +139,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans
|
|||
sScriptMgr->OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(this, auction, owner, owner_accId, sendMail);
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_SALE_PENDING), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,10 +169,10 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
|
|||
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_SUCCESSFUL), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.AddMoney(profit)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
|
||||
.AddMoney(profit)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
|
||||
|
||||
if (auction->bid >= 500*GOLD)
|
||||
if (auction->bid >= 500 * GOLD)
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder))
|
||||
{
|
||||
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
|
|
@ -184,7 +184,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
|
|||
owner_name = gpd_owner->name;
|
||||
owner_level = gpd_owner->level;
|
||||
}
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<AH> profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit/GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount);
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<AH> profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit / GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -211,8 +211,8 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
|
|||
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
|
||||
}
|
||||
else
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
|
||||
|
|
@ -238,8 +238,8 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
|
|||
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,8 +259,8 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
|
|||
sScriptMgr->OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(this, auction, bidder, bidder_accId, sendMail);
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, 0))
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -314,8 +314,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
AddAItem(item);
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
|
|
@ -404,29 +403,49 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
|
|||
// but no easy way convert creature faction to player race faction for specific city
|
||||
switch (factionTemplateId)
|
||||
{
|
||||
case 12: houseid = 1; break; // human
|
||||
case 29: houseid = 6; break; // orc, and generic for horde
|
||||
case 55: houseid = 2; break; // dwarf, and generic for alliance
|
||||
case 68: houseid = 4; break; // undead
|
||||
case 80: houseid = 3; break; // n-elf
|
||||
case 104: houseid = 5; break; // trolls
|
||||
case 120: houseid = 7; break; // booty bay, neutral
|
||||
case 474: houseid = 7; break; // gadgetzan, neutral
|
||||
case 855: houseid = 7; break; // everlook, neutral
|
||||
case 1604: houseid = 6; break; // b-elfs,
|
||||
case 12:
|
||||
houseid = 1;
|
||||
break; // human
|
||||
case 29:
|
||||
houseid = 6;
|
||||
break; // orc, and generic for horde
|
||||
case 55:
|
||||
houseid = 2;
|
||||
break; // dwarf, and generic for alliance
|
||||
case 68:
|
||||
houseid = 4;
|
||||
break; // undead
|
||||
case 80:
|
||||
houseid = 3;
|
||||
break; // n-elf
|
||||
case 104:
|
||||
houseid = 5;
|
||||
break; // trolls
|
||||
case 120:
|
||||
houseid = 7;
|
||||
break; // booty bay, neutral
|
||||
case 474:
|
||||
houseid = 7;
|
||||
break; // gadgetzan, neutral
|
||||
case 855:
|
||||
houseid = 7;
|
||||
break; // everlook, neutral
|
||||
case 1604:
|
||||
houseid = 6;
|
||||
break; // b-elfs,
|
||||
default: // for unknown case
|
||||
{
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
if (!u_entry)
|
||||
houseid = 7; // goblin auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
||||
houseid = 1; // human auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
||||
houseid = 6; // orc auction house
|
||||
else
|
||||
houseid = 7; // goblin auction house
|
||||
break;
|
||||
}
|
||||
{
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
if (!u_entry)
|
||||
houseid = 7; // goblin auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
||||
houseid = 1; // human auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
||||
houseid = 6; // orc auction house
|
||||
else
|
||||
houseid = 7; // goblin auction house
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -530,9 +549,9 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
|||
}
|
||||
|
||||
bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player,
|
||||
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount, uint8 /*getAll*/)
|
||||
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount, uint8 /*getAll*/)
|
||||
{
|
||||
uint32 itrcounter = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ struct AuctionEntry
|
|||
uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
|
||||
uint32 GetAuctionCut() const;
|
||||
uint32 GetAuctionOutBid() const;
|
||||
bool BuildAuctionInfo(WorldPacket & data) const;
|
||||
bool BuildAuctionInfo(WorldPacket& data) const;
|
||||
void DeleteFromDB(SQLTransaction& trans) const;
|
||||
void SaveToDB(SQLTransaction& trans) const;
|
||||
bool LoadFromDB(Field* fields);
|
||||
|
|
@ -85,7 +85,7 @@ struct AuctionEntry
|
|||
//this class is used as auctionhouse instance
|
||||
class AuctionHouseObject
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// Initialize storage
|
||||
AuctionHouseObject() { next = AuctionsMap.begin(); }
|
||||
~AuctionHouseObject()
|
||||
|
|
@ -116,11 +116,11 @@ class AuctionHouseObject
|
|||
void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
bool BuildListAuctionItems(WorldPacket& data, Player* player,
|
||||
std::wstring const& searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount, uint8 getAll);
|
||||
std::wstring const& searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount, uint8 getAll);
|
||||
|
||||
private:
|
||||
private:
|
||||
AuctionEntryMap AuctionsMap;
|
||||
|
||||
// storage for "next" auction item for next Update()
|
||||
|
|
@ -129,57 +129,57 @@ class AuctionHouseObject
|
|||
|
||||
class AuctionHouseMgr
|
||||
{
|
||||
private:
|
||||
AuctionHouseMgr();
|
||||
~AuctionHouseMgr();
|
||||
private:
|
||||
AuctionHouseMgr();
|
||||
~AuctionHouseMgr();
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
typedef std::unordered_map<uint32, Item*> ItemMap;
|
||||
typedef std::unordered_map<uint32, Item*> ItemMap;
|
||||
|
||||
static AuctionHouseMgr* instance();
|
||||
static AuctionHouseMgr* instance();
|
||||
|
||||
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
|
||||
|
||||
Item* GetAItem(uint32 id)
|
||||
{
|
||||
ItemMap::const_iterator itr = mAitems.find(id);
|
||||
if (itr != mAitems.end())
|
||||
return itr->second;
|
||||
Item* GetAItem(uint32 id)
|
||||
{
|
||||
ItemMap::const_iterator itr = mAitems.find(id);
|
||||
if (itr != mAitems.end())
|
||||
return itr->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//auction messages
|
||||
void SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification = true, bool updateAchievementCriteria = true, bool sendMail = true);
|
||||
void SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans, bool sendMail = true);
|
||||
void SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification = true, bool updateAchievementCriteria = true, bool sendMail = true);
|
||||
void SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification = true, bool sendMail = true);
|
||||
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans, bool sendNotification = true, bool sendMail = true);
|
||||
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, bool sendMail = true);
|
||||
//auction messages
|
||||
void SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification = true, bool updateAchievementCriteria = true, bool sendMail = true);
|
||||
void SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans, bool sendMail = true);
|
||||
void SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification = true, bool updateAchievementCriteria = true, bool sendMail = true);
|
||||
void SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification = true, bool sendMail = true);
|
||||
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans, bool sendNotification = true, bool sendMail = true);
|
||||
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, bool sendMail = true);
|
||||
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
//load first auction items, because of check if item exists, when loading
|
||||
void LoadAuctionItems();
|
||||
void LoadAuctions();
|
||||
//load first auction items, because of check if item exists, when loading
|
||||
void LoadAuctionItems();
|
||||
void LoadAuctions();
|
||||
|
||||
void AddAItem(Item* it);
|
||||
bool RemoveAItem(uint32 id, bool deleteFromDB = false);
|
||||
void AddAItem(Item* it);
|
||||
bool RemoveAItem(uint32 id, bool deleteFromDB = false);
|
||||
|
||||
void Update();
|
||||
void Update();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
AuctionHouseObject mHordeAuctions;
|
||||
AuctionHouseObject mAllianceAuctions;
|
||||
AuctionHouseObject mNeutralAuctions;
|
||||
AuctionHouseObject mHordeAuctions;
|
||||
AuctionHouseObject mAllianceAuctions;
|
||||
AuctionHouseObject mNeutralAuctions;
|
||||
|
||||
ItemMap mAitems;
|
||||
ItemMap mAitems;
|
||||
};
|
||||
|
||||
#define sAuctionMgr AuctionHouseMgr::instance()
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
|||
// Xinef: do not invite players on taxi
|
||||
if (!player->IsInFlight())
|
||||
{
|
||||
// If battle is started,
|
||||
// If battle is started,
|
||||
// If not full of players > invite player to join the war
|
||||
// If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
|
||||
if (IsWarTime())
|
||||
|
|
@ -77,7 +77,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
|||
else // No more vacant places
|
||||
{
|
||||
// TODO: Send a packet to announce it to player
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + (player->IsGameMaster() ? 30*MINUTE : 10);
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + (player->IsGameMaster() ? 30 * MINUTE : 10);
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
}
|
||||
|
|
@ -424,11 +424,14 @@ void Battlefield::PlayerAcceptInviteToWar(Player* player)
|
|||
|
||||
void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
||||
{
|
||||
if (spellId > 0) {
|
||||
if (spellId > 0)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->CastSpell(player, uint32(spellId), true);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->RemoveAuraFromStack(uint32(-spellId));
|
||||
|
|
@ -591,7 +594,7 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GraveyardStruct const * Battlefield::GetClosestGraveyard(Player* player)
|
||||
GraveyardStruct const* Battlefield::GetClosestGraveyard(Player* player)
|
||||
{
|
||||
BfGraveyard* closestGY = nullptr;
|
||||
float maxdist = -1;
|
||||
|
|
@ -647,7 +650,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
|||
}
|
||||
}
|
||||
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid)
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
||||
|
|
@ -875,9 +878,9 @@ GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
|||
{
|
||||
if (GameObject* go = GetCapturePointGo(player))
|
||||
player->SendUpdateWorldState(go->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
|
||||
|
||||
GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||
|
||||
|
||||
if (current == m_activePlayers[player->GetTeamId()].end())
|
||||
return current; // return end()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ enum BattlefieldTypes
|
|||
|
||||
enum BattlefieldIDs
|
||||
{
|
||||
BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
|
||||
BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
|
||||
};
|
||||
|
||||
enum BattlefieldObjectiveStates
|
||||
|
|
@ -72,356 +72,356 @@ typedef std::map<uint64, time_t> PlayerTimerMap;
|
|||
|
||||
class BfCapturePoint
|
||||
{
|
||||
public:
|
||||
BfCapturePoint(Battlefield* bf);
|
||||
public:
|
||||
BfCapturePoint(Battlefield* bf);
|
||||
|
||||
virtual ~BfCapturePoint() { }
|
||||
virtual ~BfCapturePoint() { }
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
|
||||
// Send world state update to all players present
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
// Send world state update to all players present
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
// Send kill notify to players in the controlling faction
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
// Send kill notify to players in the controlling faction
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
|
||||
// Used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
||||
//virtual void HandlePlayerActivityChanged(Player* player);
|
||||
// Used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
||||
//virtual void HandlePlayerActivityChanged(Player* player);
|
||||
|
||||
// Checks if player is in range of a capture credit marker
|
||||
bool IsInsideObjective(Player* player) const;
|
||||
// Checks if player is in range of a capture credit marker
|
||||
bool IsInsideObjective(Player* player) const;
|
||||
|
||||
// Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
|
||||
virtual bool Update(uint32 diff);
|
||||
virtual void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||
virtual void SendChangePhase();
|
||||
// Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
|
||||
virtual bool Update(uint32 diff);
|
||||
virtual void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||
virtual void SendChangePhase();
|
||||
|
||||
bool SetCapturePointData(GameObject* capturePoint);
|
||||
GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)NULL); }
|
||||
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
|
||||
bool SetCapturePointData(GameObject* capturePoint);
|
||||
GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)NULL); }
|
||||
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
|
||||
|
||||
TeamId GetTeamId() { return m_team; }
|
||||
protected:
|
||||
bool DelCapturePoint();
|
||||
TeamId GetTeamId() { return m_team; }
|
||||
protected:
|
||||
bool DelCapturePoint();
|
||||
|
||||
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||
GuidSet m_activePlayers[2];
|
||||
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||
GuidSet m_activePlayers[2];
|
||||
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
float m_minValue;
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
float m_minValue;
|
||||
|
||||
// Maximum speed of capture
|
||||
float m_maxSpeed;
|
||||
// Maximum speed of capture
|
||||
float m_maxSpeed;
|
||||
|
||||
// The status of the objective
|
||||
float m_value;
|
||||
TeamId m_team;
|
||||
// The status of the objective
|
||||
float m_value;
|
||||
TeamId m_team;
|
||||
|
||||
// Objective states
|
||||
BattlefieldObjectiveStates m_OldState;
|
||||
BattlefieldObjectiveStates m_State;
|
||||
// Objective states
|
||||
BattlefieldObjectiveStates m_OldState;
|
||||
BattlefieldObjectiveStates m_State;
|
||||
|
||||
// Neutral value on capture bar
|
||||
uint32 m_neutralValuePct;
|
||||
// Neutral value on capture bar
|
||||
uint32 m_neutralValuePct;
|
||||
|
||||
// Pointer to the Battlefield this objective belongs to
|
||||
Battlefield* m_Bf;
|
||||
// Pointer to the Battlefield this objective belongs to
|
||||
Battlefield* m_Bf;
|
||||
|
||||
// Capture point entry
|
||||
uint32 m_capturePointEntry;
|
||||
// Capture point entry
|
||||
uint32 m_capturePointEntry;
|
||||
|
||||
// Gameobject related to that capture point
|
||||
uint64 m_capturePoint;
|
||||
// Gameobject related to that capture point
|
||||
uint64 m_capturePoint;
|
||||
};
|
||||
|
||||
class BfGraveyard
|
||||
{
|
||||
public:
|
||||
BfGraveyard(Battlefield* Bf);
|
||||
public:
|
||||
BfGraveyard(Battlefield* Bf);
|
||||
|
||||
// Method to changing who controls the graveyard
|
||||
void GiveControlTo(TeamId team);
|
||||
TeamId GetControlTeamId() const { return m_ControlTeam; }
|
||||
// Method to changing who controls the graveyard
|
||||
void GiveControlTo(TeamId team);
|
||||
TeamId GetControlTeamId() const { return m_ControlTeam; }
|
||||
|
||||
// Find the nearest graveyard to a player
|
||||
float GetDistance(Player* player);
|
||||
// Find the nearest graveyard to a player
|
||||
float GetDistance(Player* player);
|
||||
|
||||
// Initialize the graveyard
|
||||
void Initialize(TeamId startcontrol, uint32 gy);
|
||||
// Initialize the graveyard
|
||||
void Initialize(TeamId startcontrol, uint32 gy);
|
||||
|
||||
// Set spirit service for the graveyard
|
||||
void SetSpirit(Creature* spirit, TeamId team);
|
||||
// Set spirit service for the graveyard
|
||||
void SetSpirit(Creature* spirit, TeamId team);
|
||||
|
||||
// Add a player to the graveyard
|
||||
void AddPlayer(uint64 player_guid);
|
||||
// Add a player to the graveyard
|
||||
void AddPlayer(uint64 player_guid);
|
||||
|
||||
// Remove a player from the graveyard
|
||||
void RemovePlayer(uint64 player_guid);
|
||||
// Remove a player from the graveyard
|
||||
void RemovePlayer(uint64 player_guid);
|
||||
|
||||
// Resurrect players
|
||||
void Resurrect();
|
||||
// Resurrect players
|
||||
void Resurrect();
|
||||
|
||||
// Move players waiting to that graveyard on the nearest one
|
||||
void RelocateDeadPlayers();
|
||||
// Move players waiting to that graveyard on the nearest one
|
||||
void RelocateDeadPlayers();
|
||||
|
||||
// Check if this graveyard has a spirit guide
|
||||
bool HasNpc(uint64 guid)
|
||||
{
|
||||
if (!m_SpiritGuide[0] && !m_SpiritGuide[1])
|
||||
return false;
|
||||
// Check if this graveyard has a spirit guide
|
||||
bool HasNpc(uint64 guid)
|
||||
{
|
||||
if (!m_SpiritGuide[0] && !m_SpiritGuide[1])
|
||||
return false;
|
||||
|
||||
// performance
|
||||
/*if (!ObjectAccessor::FindUnit(m_SpiritGuide[0]) &&
|
||||
!ObjectAccessor::FindUnit(m_SpiritGuide[1]))
|
||||
return false;*/
|
||||
// performance
|
||||
/*if (!ObjectAccessor::FindUnit(m_SpiritGuide[0]) &&
|
||||
!ObjectAccessor::FindUnit(m_SpiritGuide[1]))
|
||||
return false;*/
|
||||
|
||||
return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
|
||||
}
|
||||
return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
|
||||
}
|
||||
|
||||
// Check if a player is in this graveyard's resurrect queue
|
||||
bool HasPlayer(uint64 guid) const { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||
// Check if a player is in this graveyard's resurrect queue
|
||||
bool HasPlayer(uint64 guid) const { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||
|
||||
// Get the graveyard's ID.
|
||||
uint32 GetGraveyardId() const { return m_GraveyardId; }
|
||||
// Get the graveyard's ID.
|
||||
uint32 GetGraveyardId() const { return m_GraveyardId; }
|
||||
|
||||
protected:
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
uint64 m_SpiritGuide[2];
|
||||
GuidSet m_ResurrectQueue;
|
||||
Battlefield* m_Bf;
|
||||
protected:
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
uint64 m_SpiritGuide[2];
|
||||
GuidSet m_ResurrectQueue;
|
||||
Battlefield* m_Bf;
|
||||
};
|
||||
|
||||
class Battlefield : public ZoneScript
|
||||
{
|
||||
friend class BattlefieldMgr;
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
Battlefield();
|
||||
/// Destructor
|
||||
virtual ~Battlefield();
|
||||
public:
|
||||
/// Constructor
|
||||
Battlefield();
|
||||
/// Destructor
|
||||
virtual ~Battlefield();
|
||||
|
||||
/// typedef of map witch store capturepoint and the associate gameobject entry
|
||||
typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
|
||||
/// typedef of map witch store capturepoint and the associate gameobject entry
|
||||
typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
|
||||
|
||||
/// Call this to init the Battlefield
|
||||
virtual bool SetupBattlefield() { return true; }
|
||||
/// Call this to init the Battlefield
|
||||
virtual bool SetupBattlefield() { return true; }
|
||||
|
||||
/// Update data of a worldstate to all players present in zone
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
/// Update data of a worldstate to all players present in zone
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
/**
|
||||
* \brief Called every time for update bf data and time
|
||||
* - Update timer for start/end battle
|
||||
* - Invite player in zone to queue m_StartGroupingTimer minutes before start
|
||||
* - Kick Afk players
|
||||
* \param diff : time ellapsed since last call (in ms)
|
||||
*/
|
||||
virtual bool Update(uint32 diff);
|
||||
/**
|
||||
* \brief Called every time for update bf data and time
|
||||
* - Update timer for start/end battle
|
||||
* - Invite player in zone to queue m_StartGroupingTimer minutes before start
|
||||
* - Kick Afk players
|
||||
* \param diff : time ellapsed since last call (in ms)
|
||||
*/
|
||||
virtual bool Update(uint32 diff);
|
||||
|
||||
/// Invite all players in zone to join the queue, called x minutes before battle start in Update()
|
||||
void InvitePlayersInZoneToQueue();
|
||||
/// Invite all players in queue to join battle on battle start
|
||||
void InvitePlayersInQueueToWar();
|
||||
/// Invite all players in zone to join battle on battle start
|
||||
void InvitePlayersInZoneToWar();
|
||||
/// Invite all players in zone to join the queue, called x minutes before battle start in Update()
|
||||
void InvitePlayersInZoneToQueue();
|
||||
/// Invite all players in queue to join battle on battle start
|
||||
void InvitePlayersInQueueToWar();
|
||||
/// Invite all players in zone to join battle on battle start
|
||||
void InvitePlayersInZoneToWar();
|
||||
|
||||
/// Called when a Unit is kill in battlefield zone
|
||||
virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
|
||||
/// Called when a Unit is kill in battlefield zone
|
||||
virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
|
||||
|
||||
uint32 GetTypeId() { return m_TypeId; }
|
||||
uint32 GetZoneId() { return m_ZoneId; }
|
||||
uint32 GetTypeId() { return m_TypeId; }
|
||||
uint32 GetZoneId() { return m_ZoneId; }
|
||||
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
|
||||
/// Return true if battle is start, false if battle is not started
|
||||
bool IsWarTime() { return m_isActive; }
|
||||
/// Return true if battle is start, false if battle is not started
|
||||
bool IsWarTime() { return m_isActive; }
|
||||
|
||||
/// Enable or Disable battlefield
|
||||
void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
|
||||
/// Return if battlefield is enable
|
||||
bool IsEnabled() { return m_IsEnabled; }
|
||||
/// Enable or Disable battlefield
|
||||
void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
|
||||
/// Return if battlefield is enable
|
||||
bool IsEnabled() { return m_IsEnabled; }
|
||||
|
||||
/**
|
||||
* \brief Kick player from battlefield and teleport him to kick-point location
|
||||
* \param guid : guid of player who must be kick
|
||||
*/
|
||||
void KickPlayerFromBattlefield(uint64 guid);
|
||||
/**
|
||||
* \brief Kick player from battlefield and teleport him to kick-point location
|
||||
* \param guid : guid of player who must be kick
|
||||
*/
|
||||
void KickPlayerFromBattlefield(uint64 guid);
|
||||
|
||||
/// Called when player (player) enter in zone
|
||||
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
/// Called when player (player) leave the zone
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
/// Called when player (player) enter in zone
|
||||
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
/// Called when player (player) leave the zone
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
|
||||
// All-purpose data storage 64 bit
|
||||
virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; }
|
||||
virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
|
||||
// All-purpose data storage 64 bit
|
||||
virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; }
|
||||
virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
|
||||
|
||||
// All-purpose data storage 32 bit
|
||||
virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; }
|
||||
virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
|
||||
virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
|
||||
// All-purpose data storage 32 bit
|
||||
virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; }
|
||||
virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
|
||||
virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
|
||||
|
||||
// Battlefield - generic methods
|
||||
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
||||
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
||||
TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
|
||||
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
||||
// Battlefield - generic methods
|
||||
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
||||
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
||||
TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
|
||||
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
||||
|
||||
// Group methods
|
||||
/**
|
||||
* \brief Find a not full battlefield group, if there is no, create one
|
||||
* \param TeamId : Id of player team for who we search a group (player->GetTeamId())
|
||||
*/
|
||||
Group* GetFreeBfRaid(TeamId TeamId);
|
||||
/// Return battlefield group where player is.
|
||||
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
|
||||
/// Force player to join a battlefield group
|
||||
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
|
||||
// Group methods
|
||||
/**
|
||||
* \brief Find a not full battlefield group, if there is no, create one
|
||||
* \param TeamId : Id of player team for who we search a group (player->GetTeamId())
|
||||
*/
|
||||
Group* GetFreeBfRaid(TeamId TeamId);
|
||||
/// Return battlefield group where player is.
|
||||
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
|
||||
/// Force player to join a battlefield group
|
||||
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
|
||||
|
||||
// Graveyard methods
|
||||
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
||||
GraveyardStruct const * GetClosestGraveyard(Player* player);
|
||||
// Graveyard methods
|
||||
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||
BfGraveyard* GetGraveyardById(uint32 id) const;
|
||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||
BfGraveyard* GetGraveyardById(uint32 id) const;
|
||||
|
||||
// Misc methods
|
||||
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId teamId);
|
||||
Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId);
|
||||
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||
// Misc methods
|
||||
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId teamId);
|
||||
Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId);
|
||||
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
// Script-methods
|
||||
// Script-methods
|
||||
|
||||
/// Called on start
|
||||
virtual void OnBattleStart() {};
|
||||
/// Called at the end of battle
|
||||
virtual void OnBattleEnd(bool /*endByTimer*/) {};
|
||||
/// Called x minutes before battle start when player in zone are invite to join queue
|
||||
virtual void OnStartGrouping() {};
|
||||
/// Called when a player accept to join the battle
|
||||
virtual void OnPlayerJoinWar(Player* /*player*/) {};
|
||||
/// Called when a player leave the battle
|
||||
virtual void OnPlayerLeaveWar(Player* /*player*/) {};
|
||||
/// Called when a player leave battlefield zone
|
||||
virtual void OnPlayerLeaveZone(Player* /*player*/) {};
|
||||
/// Called when a player enter in battlefield zone
|
||||
virtual void OnPlayerEnterZone(Player* /*player*/) {};
|
||||
/// Called on start
|
||||
virtual void OnBattleStart() {};
|
||||
/// Called at the end of battle
|
||||
virtual void OnBattleEnd(bool /*endByTimer*/) {};
|
||||
/// Called x minutes before battle start when player in zone are invite to join queue
|
||||
virtual void OnStartGrouping() {};
|
||||
/// Called when a player accept to join the battle
|
||||
virtual void OnPlayerJoinWar(Player* /*player*/) {};
|
||||
/// Called when a player leave the battle
|
||||
virtual void OnPlayerLeaveWar(Player* /*player*/) {};
|
||||
/// Called when a player leave battlefield zone
|
||||
virtual void OnPlayerLeaveZone(Player* /*player*/) {};
|
||||
/// Called when a player enter in battlefield zone
|
||||
virtual void OnPlayerEnterZone(Player* /*player*/) {};
|
||||
|
||||
void SendWarningToAllInZone(uint32 entry);
|
||||
void SendWarningToPlayer(Player* player, uint32 entry);
|
||||
void SendWarningToAllInZone(uint32 entry);
|
||||
void SendWarningToPlayer(Player* player, uint32 entry);
|
||||
|
||||
void PlayerAcceptInviteToQueue(Player* player);
|
||||
void PlayerAcceptInviteToWar(Player* player);
|
||||
uint32 GetBattleId() { return m_BattleId; }
|
||||
void AskToLeaveQueue(Player* player);
|
||||
void PlayerAskToLeave(Player* player);
|
||||
void PlayerAcceptInviteToQueue(Player* player);
|
||||
void PlayerAcceptInviteToWar(Player* player);
|
||||
uint32 GetBattleId() { return m_BattleId; }
|
||||
void AskToLeaveQueue(Player* player);
|
||||
void PlayerAskToLeave(Player* player);
|
||||
|
||||
//virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
|
||||
//virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
|
||||
|
||||
/// Send all worldstate data to all player in zone.
|
||||
virtual void SendInitWorldStatesToAll() = 0;
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
|
||||
/// Send all worldstate data to all player in zone.
|
||||
virtual void SendInitWorldStatesToAll() = 0;
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
|
||||
|
||||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid);
|
||||
|
||||
void StartBattle();
|
||||
void EndBattle(bool endByTimer);
|
||||
void StartBattle();
|
||||
void EndBattle(bool endByTimer);
|
||||
|
||||
void HideNpc(Creature* creature);
|
||||
void ShowNpc(Creature* creature, bool aggressive);
|
||||
void HideNpc(Creature* creature);
|
||||
void ShowNpc(Creature* creature, bool aggressive);
|
||||
|
||||
GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
|
||||
GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
|
||||
|
||||
uint32 GetTimer() { return m_Timer; }
|
||||
void SetTimer(uint32 timer) { m_Timer = timer; }
|
||||
uint32 GetTimer() { return m_Timer; }
|
||||
void SetTimer(uint32 timer) { m_Timer = timer; }
|
||||
|
||||
void DoPlaySoundToAll(uint32 SoundID);
|
||||
void DoPlaySoundToAll(uint32 SoundID);
|
||||
|
||||
void InvitePlayerToQueue(Player* player);
|
||||
void InvitePlayerToWar(Player* player);
|
||||
void InvitePlayerToQueue(Player* player);
|
||||
void InvitePlayerToWar(Player* player);
|
||||
|
||||
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
||||
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
protected:
|
||||
uint64 StalkerGuid;
|
||||
uint32 m_Timer; // Global timer for event
|
||||
bool m_IsEnabled;
|
||||
bool m_isActive;
|
||||
TeamId m_DefenderTeam;
|
||||
protected:
|
||||
uint64 StalkerGuid;
|
||||
uint32 m_Timer; // Global timer for event
|
||||
bool m_IsEnabled;
|
||||
bool m_isActive;
|
||||
TeamId m_DefenderTeam;
|
||||
|
||||
// Map of the objectives belonging to this OutdoorPvP
|
||||
BfCapturePointMap m_capturePoints;
|
||||
// Map of the objectives belonging to this OutdoorPvP
|
||||
BfCapturePointMap m_capturePoints;
|
||||
|
||||
// Players info maps
|
||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
|
||||
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
|
||||
// Players info maps
|
||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
|
||||
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
|
||||
|
||||
// Variables that must exist for each battlefield
|
||||
uint32 m_TypeId; // See enum BattlefieldTypes
|
||||
uint32 m_BattleId; // BattleID (for packet)
|
||||
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
|
||||
uint32 m_MapId; // MapId where is Battlefield
|
||||
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
|
||||
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
|
||||
uint32 m_MinLevel; // Required level to participate at Battlefield
|
||||
uint32 m_BattleTime; // Length of a battle
|
||||
uint32 m_NoWarBattleTime; // Time between two battles
|
||||
uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
|
||||
uint32 m_TimeForAcceptInvite;
|
||||
uint32 m_uiKickDontAcceptTimer;
|
||||
WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
|
||||
// Variables that must exist for each battlefield
|
||||
uint32 m_TypeId; // See enum BattlefieldTypes
|
||||
uint32 m_BattleId; // BattleID (for packet)
|
||||
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
|
||||
uint32 m_MapId; // MapId where is Battlefield
|
||||
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
|
||||
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
|
||||
uint32 m_MinLevel; // Required level to participate at Battlefield
|
||||
uint32 m_BattleTime; // Length of a battle
|
||||
uint32 m_NoWarBattleTime; // Time between two battles
|
||||
uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
|
||||
uint32 m_TimeForAcceptInvite;
|
||||
uint32 m_uiKickDontAcceptTimer;
|
||||
WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
|
||||
|
||||
uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
|
||||
uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
|
||||
|
||||
// Graveyard variables
|
||||
GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
|
||||
uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
|
||||
// Graveyard variables
|
||||
GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
|
||||
uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
|
||||
|
||||
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
|
||||
bool m_StartGrouping; // bool for know if all players in area has been invited
|
||||
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
|
||||
bool m_StartGrouping; // bool for know if all players in area has been invited
|
||||
|
||||
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||
|
||||
std::vector<uint64> m_Data64;
|
||||
std::vector<uint32> m_Data32;
|
||||
std::vector<uint64> m_Data64;
|
||||
std::vector<uint32> m_Data32;
|
||||
|
||||
void KickAfkPlayers();
|
||||
void KickAfkPlayers();
|
||||
|
||||
// use for switch off all worldstate for client
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
// use for switch off all worldstate for client
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
|
||||
// use for send a packet for all player list
|
||||
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
// use for send a packet for all player list
|
||||
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp, GameObject* go) { m_capturePoints[go->GetEntry()] = cp; }
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp, GameObject* go) { m_capturePoints[go->GetEntry()] = cp; }
|
||||
|
||||
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||
{
|
||||
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||
{
|
||||
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player* player) const;
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player* player) const;
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
//Param3:(time) Time in second that the player have for accept
|
||||
void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
|
||||
{
|
||||
//Send packet
|
||||
//Send packet
|
||||
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
|
||||
data << uint32(BattleId);
|
||||
data << uint32(ZoneId);
|
||||
|
|
@ -49,22 +49,22 @@ void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
|
|||
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
|
||||
//Param3:(CanQueue) if able to queue
|
||||
//Param4:(Full) on log in is full
|
||||
void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
|
||||
void WorldSession::SendBfQueueInviteResponse(uint32 BattleId, uint32 ZoneId, bool CanQueue, bool Full)
|
||||
{
|
||||
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
|
||||
data << uint32(BattleId);
|
||||
data << uint32(ZoneId);
|
||||
data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
|
||||
data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
|
||||
data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
|
||||
data << uint8(1); //Warmup
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
//This is call when player accept to join war
|
||||
//This is call when player accept to join war
|
||||
//Param1:(BattleId) the BattleId of Bf
|
||||
void WorldSession::SendBfEntered(uint32 BattleId)
|
||||
{
|
||||
// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
|
||||
// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
|
||||
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
|
||||
data << uint32(BattleId);
|
||||
data << uint8(1); //unk
|
||||
|
|
@ -84,7 +84,7 @@ void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
|
|||
}
|
||||
|
||||
//Send by client when he click on accept for queue
|
||||
void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData)
|
||||
void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
|
||||
{
|
||||
uint32 BattleId;
|
||||
uint8 Accepted;
|
||||
|
|
@ -102,7 +102,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData)
|
|||
}
|
||||
|
||||
//Send by client on clicking in accept or refuse of invitation windows for join game
|
||||
void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData)
|
||||
void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
|
||||
{
|
||||
uint32 BattleId;
|
||||
uint8 Accepted;
|
||||
|
|
@ -125,7 +125,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleBfExitRequest(WorldPacket & recvData)
|
||||
void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
|
||||
{
|
||||
uint32 BattleId;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,26 +50,26 @@ void BattlefieldMgr::InitBattlefield()
|
|||
// respawn, init variables
|
||||
if(!pBf->SetupBattlefield())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
|
||||
#endif
|
||||
#endif
|
||||
delete pBf;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BattlefieldSet.push_back(pBf);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
|
||||
#endif
|
||||
#endif
|
||||
} */
|
||||
}
|
||||
|
||||
void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
|
||||
void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield* handle)
|
||||
{
|
||||
m_BattlefieldMap[zoneid] = handle;
|
||||
}
|
||||
|
||||
void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
|
||||
void BattlefieldMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
|
||||
if (itr == m_BattlefieldMap.end())
|
||||
|
|
@ -84,7 +84,7 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
|
|||
#endif
|
||||
}
|
||||
|
||||
void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
|
||||
void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
|
||||
if (itr == m_BattlefieldMap.end())
|
||||
|
|
@ -99,7 +99,7 @@ void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
|
|||
#endif
|
||||
}
|
||||
|
||||
Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
||||
Battlefield* BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
|
||||
if (itr == m_BattlefieldMap.end())
|
||||
|
|
@ -112,7 +112,7 @@ Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
|||
return itr->second;
|
||||
}
|
||||
|
||||
Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
|
||||
Battlefield* BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
|
||||
{
|
||||
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
||||
{
|
||||
|
|
@ -129,12 +129,12 @@ void BattlefieldMgr::Update(uint32 diff)
|
|||
{
|
||||
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
||||
//if ((*itr)->IsEnabled())
|
||||
(*itr)->Update(m_UpdateTimer);
|
||||
(*itr)->Update(m_UpdateTimer);
|
||||
m_UpdateTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
|
||||
ZoneScript* BattlefieldMgr::GetZoneScript(uint32 zoneId)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
|
||||
if (itr != m_BattlefieldMap.end())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct GossipMenuItems;
|
|||
// class to handle player enter / leave / areatrigger / GO use events
|
||||
class BattlefieldMgr
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// ctor
|
||||
BattlefieldMgr();
|
||||
// dtor
|
||||
|
|
@ -29,33 +29,33 @@ class BattlefieldMgr
|
|||
// create battlefield events
|
||||
void InitBattlefield();
|
||||
// called when a player enters an battlefield area
|
||||
void HandlePlayerEnterZone(Player * player, uint32 areaflag);
|
||||
void HandlePlayerEnterZone(Player* player, uint32 areaflag);
|
||||
// called when player leaves an battlefield area
|
||||
void HandlePlayerLeaveZone(Player * player, uint32 areaflag);
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
|
||||
// called when player resurrects
|
||||
void HandlePlayerResurrects(Player * player, uint32 areaflag);
|
||||
void HandlePlayerResurrects(Player* player, uint32 areaflag);
|
||||
// return assigned battlefield
|
||||
Battlefield* GetBattlefieldToZoneId(uint32 zoneid);
|
||||
Battlefield* GetBattlefieldByBattleId(uint32 battleid);
|
||||
|
||||
ZoneScript* GetZoneScript(uint32 zoneId);
|
||||
|
||||
void AddZone(uint32 zoneid, Battlefield * handle);
|
||||
void AddZone(uint32 zoneid, Battlefield* handle);
|
||||
|
||||
void Update(uint32 diff);
|
||||
|
||||
void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
|
||||
void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
|
||||
bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
|
||||
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems gso);
|
||||
|
||||
void HandleDropFlag(Player * player, uint32 spellId);
|
||||
void HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
typedef std::vector < Battlefield * >BattlefieldSet;
|
||||
typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
|
||||
private:
|
||||
typedef std::vector < Battlefield* >BattlefieldSet;
|
||||
typedef std::map < uint32 /* zoneid */, Battlefield* >BattlefieldMap;
|
||||
private:
|
||||
// contains all initiated battlefield events
|
||||
// used when initing / cleaning up
|
||||
BattlefieldSet m_BattlefieldSet;
|
||||
BattlefieldSet m_BattlefieldSet;
|
||||
// maps the zone ids to an battlefield event
|
||||
// used in player event handling
|
||||
BattlefieldMap m_BattlefieldMap;
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
// Update portal defender faction
|
||||
for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
|
||||
(*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
|
||||
|
||||
|
||||
// Saving data
|
||||
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
|
||||
{
|
||||
|
|
@ -433,7 +433,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
{
|
||||
// Victory in Wintergrasp
|
||||
player->AreaExploredOrEventHappens(GetDefenderTeam() ? 13183 : 13181); // HORDE / ALLY win wg quest id
|
||||
|
||||
|
||||
player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
|
||||
player->CastSpell(player, SPELL_VICTORY_REWARD, true);
|
||||
RemoveAurasFromPlayer(player);
|
||||
|
|
@ -542,17 +542,17 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
|||
{
|
||||
case NPC_DWARVEN_SPIRIT_GUIDE:
|
||||
case NPC_TAUNKA_SPIRIT_GUIDE:
|
||||
{
|
||||
TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId(true));
|
||||
// xinef: little workaround, there are 2 spirit guides in same area
|
||||
if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f))
|
||||
graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW;
|
||||
{
|
||||
TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId(true));
|
||||
// xinef: little workaround, there are 2 spirit guides in same area
|
||||
if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f))
|
||||
graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW;
|
||||
|
||||
if (m_GraveyardList[graveyardId])
|
||||
m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
|
||||
break;
|
||||
}
|
||||
if (m_GraveyardList[graveyardId])
|
||||
m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// untested code - not sure if it is valid.
|
||||
|
|
@ -564,92 +564,92 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
|||
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
{
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
|
||||
Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
|
||||
if (!creator)
|
||||
return;
|
||||
TeamId team = creator->GetTeamId();
|
||||
|
||||
if (team == TEAM_HORDE)
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
|
||||
Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
|
||||
if (!creator)
|
||||
return;
|
||||
TeamId team = creator->GetTeamId();
|
||||
|
||||
if (team == TEAM_HORDE)
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
|
||||
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
|
||||
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
|
||||
creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
|
||||
creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE:
|
||||
{
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
{
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
|
||||
if (Unit* owner = creature->ToTempSummon()->GetSummoner())
|
||||
creature->setFaction(owner->getFaction());
|
||||
break;
|
||||
}
|
||||
if (Unit* owner = creature->ToTempSummon()->GetSummoner())
|
||||
creature->setFaction(owner->getFaction());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
|
||||
{
|
||||
/* possibly can be used later
|
||||
if (IsWarTime())
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
/* possibly can be used later
|
||||
if (IsWarTime())
|
||||
{
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
uint8 team;
|
||||
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
team = TEAM_ALLIANCE;
|
||||
else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
|
||||
team = TEAM_HORDE;
|
||||
else
|
||||
return;
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
{
|
||||
uint8 team;
|
||||
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
team = TEAM_ALLIANCE;
|
||||
else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
|
||||
team = TEAM_HORDE;
|
||||
else
|
||||
return;
|
||||
|
||||
m_vehicles[team].erase(creature->GetGUID());
|
||||
if (team == TEAM_HORDE)
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
UpdateVehicleCountWG();
|
||||
m_vehicles[team].erase(creature->GetGUID());
|
||||
if (team == TEAM_HORDE)
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
UpdateVehicleCountWG();
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnGameObjectCreate(GameObject* go)
|
||||
|
|
@ -729,9 +729,9 @@ bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
|
|||
{
|
||||
//m_vehicles[itr].erase(vehicle->GetGUID());
|
||||
if (itr == TEAM_HORDE)
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -813,7 +813,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player)
|
|||
else
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
|
||||
}
|
||||
SendInitWorldStatesTo(player);
|
||||
}
|
||||
|
|
@ -927,15 +927,15 @@ void BattlefieldWG::SendInitWorldStatesToAll()
|
|||
|
||||
void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
|
||||
{
|
||||
// might be some use for this in the future. old code commented out below. KL
|
||||
/* if (team == GetDefenderTeam())
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
// might be some use for this in the future. old code commented out below. KL
|
||||
/* if (team == GetDefenderTeam())
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
|
||||
}
|
||||
}*/
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// Called when a tower is broke
|
||||
|
|
@ -989,7 +989,7 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go)
|
|||
}
|
||||
}
|
||||
|
||||
void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
|
||||
void BattlefieldWG::ProcessEvent(WorldObject* obj, uint32 eventId)
|
||||
{
|
||||
if (!obj || !IsWarTime())
|
||||
return;
|
||||
|
|
@ -1004,7 +1004,7 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
|
|||
{
|
||||
if (CanInteractWithRelic())
|
||||
EndBattle(false);
|
||||
else if (GameObject*go = GetRelic())
|
||||
else if (GameObject* go = GetRelic())
|
||||
go->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,13 +122,13 @@ enum WintergraspAreaIds
|
|||
|
||||
class BfGraveyardWG : public BfGraveyard
|
||||
{
|
||||
public:
|
||||
BfGraveyardWG(BattlefieldWG *Bf);
|
||||
public:
|
||||
BfGraveyardWG(BattlefieldWG* Bf);
|
||||
|
||||
void SetTextId(uint32 textid) { m_GossipTextId = textid; }
|
||||
uint32 GetTextId() { return m_GossipTextId; }
|
||||
protected:
|
||||
uint32 m_GossipTextId;
|
||||
void SetTextId(uint32 textid) { m_GossipTextId = textid; }
|
||||
uint32 GetTextId() { return m_GossipTextId; }
|
||||
protected:
|
||||
uint32 m_GossipTextId;
|
||||
};
|
||||
|
||||
enum WGGraveyardId
|
||||
|
|
@ -222,12 +222,14 @@ struct BfWGCoordGY
|
|||
TeamId startcontrol;
|
||||
};
|
||||
|
||||
const uint32 WGQuest[2][6] = {
|
||||
const uint32 WGQuest[2][6] =
|
||||
{
|
||||
{ 13186, 13181, 13222, 13538, 13177, 13179 },
|
||||
{ 13185, 13183, 13223, 13539, 13178, 13180 },
|
||||
};
|
||||
// 7 in sql, 7 in header
|
||||
const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = {
|
||||
const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
|
||||
{
|
||||
{ 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
|
||||
{ 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
|
||||
{ 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
|
||||
|
|
@ -243,16 +245,16 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = {
|
|||
|
||||
class WintergraspCapturePoint : public BfCapturePoint
|
||||
{
|
||||
public:
|
||||
WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
|
||||
public:
|
||||
WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
|
||||
|
||||
void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
|
||||
void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
|
||||
|
||||
void ChangeTeam(TeamId oldteam);
|
||||
TeamId GetTeam() const { return m_team; }
|
||||
void ChangeTeam(TeamId oldteam);
|
||||
TeamId GetTeam() const { return m_team; }
|
||||
|
||||
protected:
|
||||
WGWorkshop* m_Workshop;
|
||||
protected:
|
||||
WGWorkshop* m_Workshop;
|
||||
};
|
||||
|
||||
/* ######################### *
|
||||
|
|
@ -261,206 +263,206 @@ class WintergraspCapturePoint : public BfCapturePoint
|
|||
|
||||
class BattlefieldWG : public Battlefield
|
||||
{
|
||||
public:
|
||||
~BattlefieldWG();
|
||||
/**
|
||||
* \brief Called when the battle start
|
||||
* - Spawn relic and turret
|
||||
* - Rebuild tower and wall
|
||||
* - Invite player to war
|
||||
*/
|
||||
void OnBattleStart();
|
||||
public:
|
||||
~BattlefieldWG();
|
||||
/**
|
||||
* \brief Called when the battle start
|
||||
* - Spawn relic and turret
|
||||
* - Rebuild tower and wall
|
||||
* - Invite player to war
|
||||
*/
|
||||
void OnBattleStart();
|
||||
|
||||
/**
|
||||
* \brief Called when battle end
|
||||
* - Remove relic and turret
|
||||
* - Change banner/npc in keep if it needed
|
||||
* - Saving battlestate
|
||||
* - Reward honor/mark to player
|
||||
* - Remove vehicle
|
||||
* \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
|
||||
*/
|
||||
void OnBattleEnd(bool endByTimer);
|
||||
/**
|
||||
* \brief Called when battle end
|
||||
* - Remove relic and turret
|
||||
* - Change banner/npc in keep if it needed
|
||||
* - Saving battlestate
|
||||
* - Reward honor/mark to player
|
||||
* - Remove vehicle
|
||||
* \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
|
||||
*/
|
||||
void OnBattleEnd(bool endByTimer);
|
||||
|
||||
/**
|
||||
* \brief Called when grouping starts (15 minutes before battlestart)
|
||||
* - Invite all player in zone to join queue
|
||||
*/
|
||||
void OnStartGrouping();
|
||||
/**
|
||||
* \brief Called when grouping starts (15 minutes before battlestart)
|
||||
* - Invite all player in zone to join queue
|
||||
*/
|
||||
void OnStartGrouping();
|
||||
|
||||
/**
|
||||
* \brief Called when player accept invite to join battle
|
||||
* - Update aura
|
||||
* - Teleport if it needed
|
||||
* - Update worldstate
|
||||
* - Update tenacity
|
||||
* \param player: Player who accepted invite
|
||||
*/
|
||||
void OnPlayerJoinWar(Player* player);
|
||||
/**
|
||||
* \brief Called when player accept invite to join battle
|
||||
* - Update aura
|
||||
* - Teleport if it needed
|
||||
* - Update worldstate
|
||||
* - Update tenacity
|
||||
* \param player: Player who accepted invite
|
||||
*/
|
||||
void OnPlayerJoinWar(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player left the battle
|
||||
* - Update player aura
|
||||
* \param player : Player who left the battle
|
||||
*/
|
||||
void OnPlayerLeaveWar(Player* player);
|
||||
/**
|
||||
* \brief Called when player left the battle
|
||||
* - Update player aura
|
||||
* \param player : Player who left the battle
|
||||
*/
|
||||
void OnPlayerLeaveWar(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player left the WG zone
|
||||
* \param player : Player who left the zone
|
||||
*/
|
||||
void OnPlayerLeaveZone(Player* player);
|
||||
/**
|
||||
* \brief Called when player left the WG zone
|
||||
* \param player : Player who left the zone
|
||||
*/
|
||||
void OnPlayerLeaveZone(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player enters in WG zone
|
||||
* - Update aura
|
||||
* - Update worldstate
|
||||
* \param player : Player who enters the zone
|
||||
*/
|
||||
void OnPlayerEnterZone(Player* player);
|
||||
/**
|
||||
* \brief Called when player enters in WG zone
|
||||
* - Update aura
|
||||
* - Update worldstate
|
||||
* \param player : Player who enters the zone
|
||||
*/
|
||||
void OnPlayerEnterZone(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called for update battlefield data
|
||||
* - Save battle timer in database every minutes
|
||||
* - Update imunity aura from graveyard
|
||||
* \param diff : time elapsed since the last call (in ms)
|
||||
*/
|
||||
bool Update(uint32 diff);
|
||||
/**
|
||||
* \brief Called for update battlefield data
|
||||
* - Save battle timer in database every minutes
|
||||
* - Update imunity aura from graveyard
|
||||
* \param diff : time elapsed since the last call (in ms)
|
||||
*/
|
||||
bool Update(uint32 diff);
|
||||
|
||||
/**
|
||||
* \brief Called when a creature is created
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureCreate(Creature* creature);
|
||||
/**
|
||||
* \brief Called when a creature is created
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureCreate(Creature* creature);
|
||||
|
||||
/**
|
||||
* \brief Called when a creature is removed
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureRemove(Creature* creature);
|
||||
/**
|
||||
* \brief Called when a creature is removed
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureRemove(Creature* creature);
|
||||
|
||||
/**
|
||||
* \brief Called when a gameobject is created
|
||||
*/
|
||||
void OnGameObjectCreate(GameObject* go);
|
||||
/**
|
||||
* \brief Called when a gameobject is created
|
||||
*/
|
||||
void OnGameObjectCreate(GameObject* go);
|
||||
|
||||
/**
|
||||
* \brief Called when a wall/tower is broken
|
||||
* - Update quest
|
||||
*/
|
||||
void BrokenWallOrTower(TeamId team);
|
||||
/**
|
||||
* \brief Called when a wall/tower is broken
|
||||
* - Update quest
|
||||
*/
|
||||
void BrokenWallOrTower(TeamId team);
|
||||
|
||||
/**
|
||||
* \brief Called when a tower is damaged
|
||||
* - Update tower count (for reward calcul)
|
||||
*/
|
||||
void UpdateDamagedTowerCount(TeamId team);
|
||||
/**
|
||||
* \brief Called when a tower is damaged
|
||||
* - Update tower count (for reward calcul)
|
||||
*/
|
||||
void UpdateDamagedTowerCount(TeamId team);
|
||||
|
||||
/**
|
||||
* \brief Called when tower is broken
|
||||
* - Update tower buff
|
||||
* - check if three south tower is down for remove 10 minutes to wg
|
||||
*/
|
||||
void UpdatedDestroyedTowerCount(TeamId team, GameObject* go);
|
||||
/**
|
||||
* \brief Called when tower is broken
|
||||
* - Update tower buff
|
||||
* - check if three south tower is down for remove 10 minutes to wg
|
||||
*/
|
||||
void UpdatedDestroyedTowerCount(TeamId team, GameObject* go);
|
||||
|
||||
//void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
|
||||
|
||||
void RemoveAurasFromPlayer(Player* player);
|
||||
//void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
|
||||
|
||||
/**
|
||||
* \brief Called when battlefield is setup, at server start
|
||||
*/
|
||||
bool SetupBattlefield();
|
||||
void RemoveAurasFromPlayer(Player* player);
|
||||
|
||||
/// Return pointer to relic object
|
||||
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); }
|
||||
/**
|
||||
* \brief Called when battlefield is setup, at server start
|
||||
*/
|
||||
bool SetupBattlefield();
|
||||
|
||||
/// Define relic object
|
||||
//void SetRelic(GameObject* relic) { m_titansRelic = relic; }
|
||||
/// Return pointer to relic object
|
||||
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); }
|
||||
|
||||
/// Check if players can interact with the relic (Only if the last door has been broken)
|
||||
bool CanInteractWithRelic() { return m_isRelicInteractible; }
|
||||
/// Define relic object
|
||||
//void SetRelic(GameObject* relic) { m_titansRelic = relic; }
|
||||
|
||||
/// Define if player can interact with the relic
|
||||
void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
|
||||
/// Check if players can interact with the relic (Only if the last door has been broken)
|
||||
bool CanInteractWithRelic() { return m_isRelicInteractible; }
|
||||
|
||||
/// Vehicle world states update
|
||||
void UpdateCounterVehicle(bool init);
|
||||
void UpdateVehicleCountWG();
|
||||
void CapturePointTaken(uint32 areaId);
|
||||
/// Define if player can interact with the relic
|
||||
void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
|
||||
|
||||
void SendInitWorldStatesTo(Player* player);
|
||||
void SendInitWorldStatesToAll();
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
/// Vehicle world states update
|
||||
void UpdateCounterVehicle(bool init);
|
||||
void UpdateVehicleCountWG();
|
||||
void CapturePointTaken(uint32 areaId);
|
||||
|
||||
void HandleKill(Player* killer, Unit* victim);
|
||||
void OnUnitDeath(Unit* unit);
|
||||
void PromotePlayer(Player* killer);
|
||||
void SendInitWorldStatesTo(Player* player);
|
||||
void SendInitWorldStatesToAll();
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
uint32 GetHonorBuff(int32 stack) const;
|
||||
void UpdateTenacity();
|
||||
void AddUpdateTenacity(Player* player);
|
||||
void RemoveUpdateTenacity(Player* player);
|
||||
void ProcessEvent(WorldObject *obj, uint32 eventId);
|
||||
void HandleKill(Player* killer, Unit* victim);
|
||||
void OnUnitDeath(Unit* unit);
|
||||
void PromotePlayer(Player* killer);
|
||||
|
||||
bool FindAndRemoveVehicleFromList(Unit* vehicle);
|
||||
uint32 GetHonorBuff(int32 stack) const;
|
||||
void UpdateTenacity();
|
||||
void AddUpdateTenacity(Player* player);
|
||||
void RemoveUpdateTenacity(Player* player);
|
||||
void ProcessEvent(WorldObject* obj, uint32 eventId);
|
||||
|
||||
// returns the graveyardId in the specified area.
|
||||
uint8 GetSpiritGraveyardId(uint32 areaId) const;
|
||||
uint32 GetAreaByGraveyardId(uint8 gId) const;
|
||||
bool FindAndRemoveVehicleFromList(Unit* vehicle);
|
||||
|
||||
uint32 GetData(uint32 data) const;
|
||||
// returns the graveyardId in the specified area.
|
||||
uint8 GetSpiritGraveyardId(uint32 areaId) const;
|
||||
uint32 GetAreaByGraveyardId(uint8 gId) const;
|
||||
|
||||
bool IsKeepNpc(uint32 entry)
|
||||
uint32 GetData(uint32 data) const;
|
||||
|
||||
bool IsKeepNpc(uint32 entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
case BATTLEFIELD_WG_NPC_GUARD_H:
|
||||
case BATTLEFIELD_WG_NPC_GUARD_A:
|
||||
case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER:
|
||||
case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH:
|
||||
case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR:
|
||||
case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON:
|
||||
case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN:
|
||||
case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA:
|
||||
case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI:
|
||||
case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS:
|
||||
case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER:
|
||||
case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL:
|
||||
case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF:
|
||||
case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE:
|
||||
case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT:
|
||||
case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA:
|
||||
case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP:
|
||||
case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case BATTLEFIELD_WG_NPC_GUARD_H:
|
||||
case BATTLEFIELD_WG_NPC_GUARD_A:
|
||||
case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER:
|
||||
case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH:
|
||||
case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR:
|
||||
case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON:
|
||||
case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN:
|
||||
case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA:
|
||||
case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI:
|
||||
case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS:
|
||||
case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER:
|
||||
case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL:
|
||||
case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF:
|
||||
case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE:
|
||||
case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT:
|
||||
case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA:
|
||||
case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP:
|
||||
case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO:
|
||||
return true;
|
||||
}
|
||||
protected:
|
||||
bool m_isRelicInteractible;
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
bool m_isRelicInteractible;
|
||||
|
||||
Workshop WorkshopsList;
|
||||
Workshop WorkshopsList;
|
||||
|
||||
GameObjectSet DefenderPortalList;
|
||||
GameObjectSet m_KeepGameObject[2];
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
GameObjectSet DefenderPortalList;
|
||||
GameObjectSet m_KeepGameObject[2];
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
|
||||
GuidSet m_vehicles[2];
|
||||
GuidSet CanonList;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
GuidSet m_updateTenacityList;
|
||||
GuidSet m_vehicles[2];
|
||||
GuidSet CanonList;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
GuidSet m_updateTenacityList;
|
||||
|
||||
int32 m_tenacityStack;
|
||||
uint32 m_tenacityUpdateTimer;
|
||||
uint32 m_saveTimer;
|
||||
int32 m_tenacityStack;
|
||||
uint32 m_tenacityUpdateTimer;
|
||||
uint32 m_saveTimer;
|
||||
|
||||
uint64 m_titansRelic;
|
||||
uint64 m_titansRelic;
|
||||
};
|
||||
|
||||
const uint8 WG_MAX_OBJ = 32;
|
||||
|
|
@ -593,7 +595,8 @@ struct WintergraspBuildingSpawnData
|
|||
uint32 destroyText;
|
||||
};
|
||||
|
||||
const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
|
||||
const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] =
|
||||
{
|
||||
// Wall (Not spawned in db)
|
||||
// Entry WS X Y Z O type NameID
|
||||
{ 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0, 0 },
|
||||
|
|
@ -640,7 +643,8 @@ const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
|
|||
{ 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0, 0 },
|
||||
};
|
||||
|
||||
const Position WGTurret[WG_MAX_TURRET] = {
|
||||
const Position WGTurret[WG_MAX_TURRET] =
|
||||
{
|
||||
{ 5391.19f, 3060.8f, 419.616f, 1.69557f },
|
||||
{ 5266.75f, 2976.5f, 421.067f, 3.20354f },
|
||||
{ 5234.86f, 2948.8f, 420.88f, 1.61311f },
|
||||
|
|
@ -784,7 +788,8 @@ struct WintergraspTowerData
|
|||
uint8 const WG_MAX_ATTACKTOWERS = 3;
|
||||
// 192414 : 0 in sql, 1 in header
|
||||
// 192278 : 0 in sql, 3 in header
|
||||
const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = {
|
||||
const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] =
|
||||
{
|
||||
// West tower
|
||||
{
|
||||
190356,
|
||||
|
|
@ -1072,7 +1077,7 @@ const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
|
|||
// Structure for different buildings that can be destroyed during battle
|
||||
struct BfWGGameObjectBuilding
|
||||
{
|
||||
BfWGGameObjectBuilding(BattlefieldWG *WG)
|
||||
BfWGGameObjectBuilding(BattlefieldWG* WG)
|
||||
{
|
||||
m_WG = WG;
|
||||
m_Team = TEAM_ALLIANCE;
|
||||
|
|
@ -1088,7 +1093,7 @@ struct BfWGGameObjectBuilding
|
|||
TeamId m_Team;
|
||||
|
||||
// WG object
|
||||
BattlefieldWG *m_WG;
|
||||
BattlefieldWG* m_WG;
|
||||
|
||||
// Linked gameobject
|
||||
uint64 m_Build;
|
||||
|
|
@ -1206,7 +1211,7 @@ struct BfWGGameObjectBuilding
|
|||
m_WG->BrokenWallOrTower(TeamId(m_Team));
|
||||
}
|
||||
|
||||
void Init(GameObject *gobj, uint32 type, uint32 worldstate, uint8 damageText, uint8 destroyText)
|
||||
void Init(GameObject* gobj, uint32 type, uint32 worldstate, uint8 damageText, uint8 destroyText)
|
||||
{
|
||||
// GameObject associated to object
|
||||
m_Build = gobj->GetGUID();
|
||||
|
|
@ -1335,7 +1340,7 @@ struct BfWGGameObjectBuilding
|
|||
{
|
||||
Position towerCannonPos;
|
||||
TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
|
||||
if (Creature *turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
|
||||
if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
|
||||
{
|
||||
m_TurretTopList.insert(turret->GetGUID());
|
||||
m_WG->HideNpc(turret);
|
||||
|
|
@ -1459,31 +1464,31 @@ struct WGWorkshop
|
|||
switch (team)
|
||||
{
|
||||
case TEAM_NEUTRAL:
|
||||
{
|
||||
// Send warning message to all player to inform a faction attack to a workshop
|
||||
// alliance / horde attacking a workshop
|
||||
bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
|
||||
break;
|
||||
}
|
||||
{
|
||||
// Send warning message to all player to inform a faction attack to a workshop
|
||||
// alliance / horde attacking a workshop
|
||||
bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
|
||||
break;
|
||||
}
|
||||
case TEAM_ALLIANCE:
|
||||
case TEAM_HORDE:
|
||||
{
|
||||
// Updating worldstate
|
||||
state = team == TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
|
||||
bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
|
||||
{
|
||||
// Updating worldstate
|
||||
state = team == TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
|
||||
bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
|
||||
|
||||
// Warning message
|
||||
if (!init) // workshop taken - alliance
|
||||
bf->SendWarningToAllInZone(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
|
||||
// Warning message
|
||||
if (!init) // workshop taken - alliance
|
||||
bf->SendWarningToAllInZone(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
|
||||
|
||||
// Found associate graveyard and update it
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (bf->GetGraveyardById(workshopId))
|
||||
bf->GetGraveyardById(workshopId)->GiveControlTo(team);
|
||||
// Found associate graveyard and update it
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (bf->GetGraveyardById(workshopId))
|
||||
bf->GetGraveyardById(workshopId)->GiveControlTo(team);
|
||||
|
||||
teamControl = team;
|
||||
break;
|
||||
}
|
||||
teamControl = team;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!init)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
ArenaTeam::ArenaTeam()
|
||||
: TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
|
||||
BorderStyle(0), BorderColor(0)
|
||||
BorderStyle(0), BorderColor(0)
|
||||
{
|
||||
Stats.WeekGames = 0;
|
||||
Stats.SeasonGames = 0;
|
||||
|
|
@ -250,8 +250,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
|||
// Put the player in the team
|
||||
Members.push_back(newMember);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
if (Empty() || !captainPresentInTeam)
|
||||
{
|
||||
|
|
@ -434,7 +433,7 @@ void ArenaTeam::Roster(WorldSession* session)
|
|||
|
||||
void ArenaTeam::Query(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+GetName().size()+1);
|
||||
WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4 * 7 + GetName().size() + 1);
|
||||
data << uint32(GetId()); // team id
|
||||
data << GetName(); // team name
|
||||
data << uint32(GetType()); // arena team type (2=2x2, 3=3x3 or 5=5x5)
|
||||
|
|
@ -451,7 +450,7 @@ void ArenaTeam::Query(WorldSession* session)
|
|||
|
||||
void ArenaTeam::SendStats(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7);
|
||||
WorldPacket data(SMSG_ARENA_TEAM_STATS, 4 * 7);
|
||||
data << uint32(GetId()); // team id
|
||||
data << uint32(Stats.Rating); // rating
|
||||
data << uint32(Stats.WeekGames); // games this week
|
||||
|
|
@ -477,7 +476,7 @@ void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
|
|||
if (!member)
|
||||
return;
|
||||
|
||||
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6);
|
||||
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8 + 1 + 4 * 6);
|
||||
data << uint64(guid); // player guid
|
||||
data << uint8(GetSlot()); // slot (0...2)
|
||||
data << uint32(GetId()); // arena team id
|
||||
|
|
@ -530,7 +529,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
|||
|
||||
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1);
|
||||
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1 + 1 + 1);
|
||||
data << uint8(event);
|
||||
data << uint8(strCount);
|
||||
switch (strCount)
|
||||
|
|
@ -582,9 +581,12 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
|
|||
{
|
||||
switch (type)
|
||||
{
|
||||
case ARENA_TEAM_2v2: return 0;
|
||||
case ARENA_TEAM_3v3: return 1;
|
||||
case ARENA_TEAM_5v5: return 2;
|
||||
case ARENA_TEAM_2v2:
|
||||
return 0;
|
||||
case ARENA_TEAM_3v3:
|
||||
return 1;
|
||||
case ARENA_TEAM_5v5:
|
||||
return 2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -803,8 +805,8 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32
|
|||
itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());
|
||||
|
||||
// Update personal played stats
|
||||
itr->WeekGames +=1;
|
||||
itr->SeasonGames +=1;
|
||||
itr->WeekGames += 1;
|
||||
itr->SeasonGames += 1;
|
||||
|
||||
// update the unit fields
|
||||
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
|
||||
|
|
@ -833,8 +835,8 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32
|
|||
}
|
||||
|
||||
// update personal stats
|
||||
itr->WeekGames +=1;
|
||||
itr->SeasonGames +=1;
|
||||
itr->WeekGames += 1;
|
||||
itr->SeasonGames += 1;
|
||||
itr->SeasonWins += 1;
|
||||
itr->WeekWins += 1;
|
||||
// update unit fields
|
||||
|
|
|
|||
|
|
@ -104,91 +104,91 @@ struct ArenaTeamStats
|
|||
|
||||
class ArenaTeam
|
||||
{
|
||||
public:
|
||||
ArenaTeam();
|
||||
~ArenaTeam();
|
||||
public:
|
||||
ArenaTeam();
|
||||
~ArenaTeam();
|
||||
|
||||
bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
|
||||
void Disband(WorldSession* session);
|
||||
void Disband();
|
||||
bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
|
||||
void Disband(WorldSession* session);
|
||||
void Disband();
|
||||
|
||||
typedef std::list<ArenaTeamMember> MemberList;
|
||||
typedef std::list<ArenaTeamMember> MemberList;
|
||||
|
||||
uint32 GetId() const { return TeamId; }
|
||||
uint32 GetType() const { return Type; }
|
||||
uint8 GetSlot() const { return GetSlotByType(GetType()); }
|
||||
static uint8 GetSlotByType(uint32 type);
|
||||
uint64 GetCaptain() const { return CaptainGuid; }
|
||||
std::string const& GetName() const { return TeamName; }
|
||||
const ArenaTeamStats& GetStats() const { return Stats; }
|
||||
uint32 GetId() const { return TeamId; }
|
||||
uint32 GetType() const { return Type; }
|
||||
uint8 GetSlot() const { return GetSlotByType(GetType()); }
|
||||
static uint8 GetSlotByType(uint32 type);
|
||||
uint64 GetCaptain() const { return CaptainGuid; }
|
||||
std::string const& GetName() const { return TeamName; }
|
||||
const ArenaTeamStats& GetStats() const { return Stats; }
|
||||
|
||||
uint32 GetRating() const { return Stats.Rating; }
|
||||
uint32 GetAverageMMR(Group* group) const;
|
||||
uint32 GetRating() const { return Stats.Rating; }
|
||||
uint32 GetAverageMMR(Group* group) const;
|
||||
|
||||
void SetCaptain(uint64 guid);
|
||||
bool SetName(std::string const& name);
|
||||
bool AddMember(uint64 playerGuid);
|
||||
void SetCaptain(uint64 guid);
|
||||
bool SetName(std::string const& name);
|
||||
bool AddMember(uint64 playerGuid);
|
||||
|
||||
// Shouldn't be uint64 ed, because than can reference guid from members on Disband
|
||||
// and this method removes given record from list. So invalid reference can happen.
|
||||
void DelMember(uint64 guid, bool cleanDb);
|
||||
// Shouldn't be uint64 ed, because than can reference guid from members on Disband
|
||||
// and this method removes given record from list. So invalid reference can happen.
|
||||
void DelMember(uint64 guid, bool cleanDb);
|
||||
|
||||
size_t GetMembersSize() const { return Members.size(); }
|
||||
bool Empty() const { return Members.empty(); }
|
||||
MemberList::iterator m_membersBegin() { return Members.begin(); }
|
||||
MemberList::iterator m_membersEnd() { return Members.end(); }
|
||||
bool IsMember(uint64 guid) const;
|
||||
size_t GetMembersSize() const { return Members.size(); }
|
||||
bool Empty() const { return Members.empty(); }
|
||||
MemberList::iterator m_membersBegin() { return Members.begin(); }
|
||||
MemberList::iterator m_membersEnd() { return Members.end(); }
|
||||
bool IsMember(uint64 guid) const;
|
||||
|
||||
ArenaTeamMember* GetMember(uint64 guid);
|
||||
ArenaTeamMember* GetMember(std::string const& name);
|
||||
ArenaTeamMember* GetMember(uint64 guid);
|
||||
ArenaTeamMember* GetMember(std::string const& name);
|
||||
|
||||
bool IsFighting() const;
|
||||
bool IsFighting() const;
|
||||
|
||||
bool LoadArenaTeamFromDB(QueryResult arenaTeamDataResult);
|
||||
bool LoadMembersFromDB(QueryResult arenaTeamMembersResult);
|
||||
void LoadStatsFromDB(uint32 ArenaTeamId);
|
||||
void SaveToDB();
|
||||
bool LoadArenaTeamFromDB(QueryResult arenaTeamDataResult);
|
||||
bool LoadMembersFromDB(QueryResult arenaTeamMembersResult);
|
||||
void LoadStatsFromDB(uint32 ArenaTeamId);
|
||||
void SaveToDB();
|
||||
|
||||
void BroadcastPacket(WorldPacket* packet);
|
||||
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
|
||||
void NotifyStatsChanged();
|
||||
void BroadcastPacket(WorldPacket* packet);
|
||||
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
|
||||
void NotifyStatsChanged();
|
||||
|
||||
void MassInviteToEvent(WorldSession* session);
|
||||
void MassInviteToEvent(WorldSession* session);
|
||||
|
||||
void Roster(WorldSession* session);
|
||||
void Query(WorldSession* session);
|
||||
void SendStats(WorldSession* session);
|
||||
void Inspect(WorldSession* session, uint64 guid);
|
||||
void Roster(WorldSession* session);
|
||||
void Query(WorldSession* session);
|
||||
void SendStats(WorldSession* session);
|
||||
void Inspect(WorldSession* session, uint64 guid);
|
||||
|
||||
uint32 GetPoints(uint32 MemberRating);
|
||||
int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
|
||||
int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap);
|
||||
void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
|
||||
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap);
|
||||
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
|
||||
uint32 GetPoints(uint32 MemberRating);
|
||||
int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
|
||||
int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap);
|
||||
void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
|
||||
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap);
|
||||
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
|
||||
|
||||
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
|
||||
void UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints);
|
||||
|
||||
void FinishWeek();
|
||||
void FinishGame(int32 mod, const Map* bgMap);
|
||||
void FinishWeek();
|
||||
void FinishGame(int32 mod, const Map* bgMap);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
uint32 TeamId;
|
||||
uint8 Type;
|
||||
std::string TeamName;
|
||||
uint64 CaptainGuid;
|
||||
uint32 TeamId;
|
||||
uint8 Type;
|
||||
std::string TeamName;
|
||||
uint64 CaptainGuid;
|
||||
|
||||
uint32 BackgroundColor; // ARGB format
|
||||
uint8 EmblemStyle; // icon id
|
||||
uint32 EmblemColor; // ARGB format
|
||||
uint8 BorderStyle; // border image id
|
||||
uint32 BorderColor; // ARGB format
|
||||
uint32 BackgroundColor; // ARGB format
|
||||
uint8 EmblemStyle; // icon id
|
||||
uint32 EmblemColor; // ARGB format
|
||||
uint8 BorderStyle; // border image id
|
||||
uint32 BorderColor; // ARGB format
|
||||
|
||||
MemberList Members;
|
||||
ArenaTeamStats Stats;
|
||||
MemberList Members;
|
||||
ArenaTeamStats Stats;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ void ArenaTeamMgr::LoadArenaTeams()
|
|||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult result = CharacterDatabase.Query("SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, "
|
||||
// 9 10 11 12 13 14
|
||||
"rating, weekGames, weekWins, seasonGames, seasonWins, `rank` FROM arena_team ORDER BY arenaTeamId ASC");
|
||||
// 9 10 11 12 13 14
|
||||
"rating, weekGames, weekWins, seasonGames, seasonWins, `rank` FROM arena_team ORDER BY arenaTeamId ASC");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -105,12 +105,12 @@ void ArenaTeamMgr::LoadArenaTeams()
|
|||
}
|
||||
|
||||
QueryResult result2 = CharacterDatabase.Query(
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
"SELECT arenaTeamId, atm.guid, atm.weekGames, atm.weekWins, atm.seasonGames, atm.seasonWins, c.name, class, personalRating, matchMakerRating, maxMMR FROM arena_team_member atm"
|
||||
" INNER JOIN arena_team ate USING (arenaTeamId)"
|
||||
" LEFT JOIN characters AS c ON atm.guid = c.guid"
|
||||
" LEFT JOIN character_arena_stats AS cas ON c.guid = cas.guid AND (cas.slot = 0 AND ate.type = 2 OR cas.slot = 1 AND ate.type = 3 OR cas.slot = 2 AND ate.type = 5)"
|
||||
" ORDER BY atm.arenateamid ASC");
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
"SELECT arenaTeamId, atm.guid, atm.weekGames, atm.weekWins, atm.seasonGames, atm.seasonWins, c.name, class, personalRating, matchMakerRating, maxMMR FROM arena_team_member atm"
|
||||
" INNER JOIN arena_team ate USING (arenaTeamId)"
|
||||
" LEFT JOIN characters AS c ON atm.guid = c.guid"
|
||||
" LEFT JOIN character_arena_stats AS cas ON c.guid = cas.guid AND (cas.slot = 0 AND ate.type = 2 OR cas.slot = 1 AND ate.type = 3 OR cas.slot = 2 AND ate.type = 5)"
|
||||
" ORDER BY atm.arenateamid ASC");
|
||||
|
||||
uint32 count = 0;
|
||||
do
|
||||
|
|
@ -127,8 +127,7 @@ void ArenaTeamMgr::LoadArenaTeams()
|
|||
AddArenaTeam(newArenaTeam);
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
|
|
|
|||
|
|
@ -40,65 +40,65 @@ namespace acore
|
|||
{
|
||||
class BattlegroundChatBuilder
|
||||
{
|
||||
public:
|
||||
BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = nullptr)
|
||||
: _msgtype(msgtype), _textId(textId), _source(source), _args(args) { }
|
||||
public:
|
||||
BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = nullptr)
|
||||
: _msgtype(msgtype), _textId(textId), _source(source), _args(args) { }
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
char const* text = sObjectMgr->GetAcoreString(_textId, loc_idx);
|
||||
if (_args)
|
||||
{
|
||||
char const* text = sObjectMgr->GetAcoreString(_textId, loc_idx);
|
||||
if (_args)
|
||||
{
|
||||
// we need copy va_list before use or original va_list will corrupted
|
||||
va_list ap;
|
||||
va_copy(ap, *_args);
|
||||
// we need copy va_list before use or original va_list will corrupted
|
||||
va_list ap;
|
||||
va_copy(ap, *_args);
|
||||
|
||||
char str[2048];
|
||||
vsnprintf(str, 2048, text, ap);
|
||||
va_end(ap);
|
||||
char str[2048];
|
||||
vsnprintf(str, 2048, text, ap);
|
||||
va_end(ap);
|
||||
|
||||
do_helper(data, &str[0]);
|
||||
}
|
||||
else
|
||||
do_helper(data, text);
|
||||
do_helper(data, &str[0]);
|
||||
}
|
||||
else
|
||||
do_helper(data, text);
|
||||
}
|
||||
|
||||
private:
|
||||
void do_helper(WorldPacket& data, char const* text)
|
||||
{
|
||||
ChatHandler::BuildChatPacket(data, _msgtype, LANG_UNIVERSAL, _source, _source, text);
|
||||
}
|
||||
private:
|
||||
void do_helper(WorldPacket& data, char const* text)
|
||||
{
|
||||
ChatHandler::BuildChatPacket(data, _msgtype, LANG_UNIVERSAL, _source, _source, text);
|
||||
}
|
||||
|
||||
ChatMsg _msgtype;
|
||||
uint32 _textId;
|
||||
Player const* _source;
|
||||
va_list* _args;
|
||||
ChatMsg _msgtype;
|
||||
uint32 _textId;
|
||||
Player const* _source;
|
||||
va_list* _args;
|
||||
};
|
||||
|
||||
class Battleground2ChatBuilder
|
||||
{
|
||||
public:
|
||||
Battleground2ChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, int32 arg1, int32 arg2)
|
||||
: _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) {}
|
||||
public:
|
||||
Battleground2ChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, int32 arg1, int32 arg2)
|
||||
: _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) {}
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
char const* text = sObjectMgr->GetAcoreString(_textId, loc_idx);
|
||||
char const* arg1str = _arg1 ? sObjectMgr->GetAcoreString(_arg1, loc_idx) : "";
|
||||
char const* arg2str = _arg2 ? sObjectMgr->GetAcoreString(_arg2, loc_idx) : "";
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
char const* text = sObjectMgr->GetAcoreString(_textId, loc_idx);
|
||||
char const* arg1str = _arg1 ? sObjectMgr->GetAcoreString(_arg1, loc_idx) : "";
|
||||
char const* arg2str = _arg2 ? sObjectMgr->GetAcoreString(_arg2, loc_idx) : "";
|
||||
|
||||
char str[2048];
|
||||
snprintf(str, 2048, text, arg1str, arg2str);
|
||||
char str[2048];
|
||||
snprintf(str, 2048, text, arg1str, arg2str);
|
||||
|
||||
ChatHandler::BuildChatPacket(data, _msgtype, LANG_UNIVERSAL, _source, _source, str);
|
||||
}
|
||||
ChatHandler::BuildChatPacket(data, _msgtype, LANG_UNIVERSAL, _source, _source, str);
|
||||
}
|
||||
|
||||
private:
|
||||
ChatMsg _msgtype;
|
||||
uint32 _textId;
|
||||
Player const* _source;
|
||||
uint32 _arg1;
|
||||
uint32 _arg2;
|
||||
private:
|
||||
ChatMsg _msgtype;
|
||||
uint32 _textId;
|
||||
Player const* _source;
|
||||
uint32 _arg1;
|
||||
uint32 _arg2;
|
||||
};
|
||||
} // namespace acore
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ Battleground::Battleground()
|
|||
m_PlayersCount[TEAM_ALLIANCE] = 0;
|
||||
m_PlayersCount[TEAM_HORDE] = 0;
|
||||
|
||||
m_BgInvitedPlayers[TEAM_ALLIANCE]= 0;
|
||||
m_BgInvitedPlayers[TEAM_ALLIANCE] = 0;
|
||||
m_BgInvitedPlayers[TEAM_HORDE] = 0;
|
||||
|
||||
m_TeamScores[TEAM_ALLIANCE] = 0;
|
||||
|
|
@ -256,7 +256,7 @@ void Battleground::Update(uint32 diff)
|
|||
case STATUS_IN_PROGRESS:
|
||||
if (isArena())
|
||||
{
|
||||
if (GetStartTime() >= 46*MINUTE*IN_MILLISECONDS) // pussywizard: 1min startup + 45min allowed duration
|
||||
if (GetStartTime() >= 46 * MINUTE * IN_MILLISECONDS) // pussywizard: 1min startup + 45min allowed duration
|
||||
{
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaAfterTimerConditions();
|
||||
|
|
@ -529,16 +529,16 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
|||
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
player->ResetAllPowers();
|
||||
// remove auras with duration lower than 30s
|
||||
Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras();
|
||||
Unit::AuraApplicationMap& auraMap = player->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
|
||||
{
|
||||
AuraApplication * aurApp = iter->second;
|
||||
AuraApplication* aurApp = iter->second;
|
||||
Aura* aura = aurApp->GetBase();
|
||||
if (!aura->IsPermanent()
|
||||
&& aura->GetDuration() <= 30*IN_MILLISECONDS
|
||||
&& aurApp->IsPositive()
|
||||
// && (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)) Xinef: bullshit condition, ALL buffs should be removed
|
||||
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
|
||||
&& aura->GetDuration() <= 30 * IN_MILLISECONDS
|
||||
&& aurApp->IsPositive()
|
||||
// && (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)) Xinef: bullshit condition, ALL buffs should be removed
|
||||
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
|
||||
player->RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
|
|
@ -564,10 +564,10 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
|||
|
||||
p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
|
||||
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4);
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4);
|
||||
data << uint64(t->GetGUID());
|
||||
data << uint32(t->GetZoneId());
|
||||
data << uint32(15*IN_MILLISECONDS);
|
||||
data << uint32(15 * IN_MILLISECONDS);
|
||||
p->GetSession()->SendPacket(&data);
|
||||
}
|
||||
m_ToBeTeleported.clear();
|
||||
|
|
@ -673,17 +673,17 @@ void Battleground::RewardHonorToTeam(uint32 honor, TeamId teamId)
|
|||
|
||||
void Battleground::RewardReputationToTeam(uint32 factionId, uint32 reputation, TeamId teamId)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (itr->second->GetBgTeamId() == teamId)
|
||||
{
|
||||
uint32 realFactionId = GetRealRepFactionForPlayer(factionId, itr->second);
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (itr->second->GetBgTeamId() == teamId)
|
||||
{
|
||||
uint32 realFactionId = GetRealRepFactionForPlayer(factionId, itr->second);
|
||||
|
||||
uint32 repGain = reputation;
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, realFactionId));
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(realFactionId))
|
||||
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
|
||||
}
|
||||
uint32 repGain = reputation;
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, realFactionId));
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(realFactionId))
|
||||
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Battleground::GetRealRepFactionForPlayer(uint32 factionId, Player* player)
|
||||
|
|
@ -738,7 +738,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
|||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
uint32 startDelay = GetStartDelayTime();
|
||||
bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs
|
||||
bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay + 15000; // pussywizard: only if arena lasted at least 15 secs
|
||||
SetStatus(STATUS_WAIT_LEAVE);
|
||||
|
||||
ArenaTeam* winnerArenaTeam = nullptr;
|
||||
|
|
@ -825,7 +825,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
|||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, m_ArenaType);
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
|
||||
stmt->setUInt32(3, winnerArenaTeam->GetId());
|
||||
stmt->setUInt32(4, loserArenaTeam->GetId());
|
||||
stmt->setUInt16(5, (uint16)winnerTeamRating);
|
||||
|
|
@ -884,7 +884,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
|||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, m_ArenaType);
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
|
||||
stmt->setUInt32(3, winnerArenaTeam->GetId());
|
||||
stmt->setUInt32(4, loserArenaTeam->GetId());
|
||||
stmt->setUInt16(5, (uint16)winnerTeamRating);
|
||||
|
|
@ -1364,7 +1364,7 @@ bool Battleground::HasFreeSlots() const
|
|||
{
|
||||
if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS)
|
||||
return false;
|
||||
for (uint8 i=0; i<BG_TEAMS_COUNT; ++i)
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
if (GetFreeSlotsForTeam((TeamId)i) > 0)
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -1382,12 +1382,12 @@ void Battleground::ReadyMarkerClicked(Player* p)
|
|||
return;
|
||||
readyMarkerClickedSet.insert(p->GetGUIDLow());
|
||||
uint32 count = readyMarkerClickedSet.size();
|
||||
uint32 req = GetArenaType()*2;
|
||||
uint32 req = GetArenaType() * 2;
|
||||
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
|
||||
if (count == req)
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_2;
|
||||
m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S;
|
||||
m_StartTime += GetStartDelayTime() - BG_START_DELAY_15S;
|
||||
SetStartDelayTime(BG_START_DELAY_15S);
|
||||
}
|
||||
}
|
||||
|
|
@ -1427,7 +1427,7 @@ void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
|
|||
itr->second->BonusHonor += value;
|
||||
}
|
||||
break;
|
||||
// used only in EY, but in MSG_PVP_LOG_DATA opcode
|
||||
// used only in EY, but in MSG_PVP_LOG_DATA opcode
|
||||
case SCORE_DAMAGE_DONE: // Damage Done
|
||||
itr->second->DamageDone += value;
|
||||
if (isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
|
|
@ -1448,7 +1448,7 @@ void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
|
|||
break;
|
||||
default:
|
||||
sLog->outError("Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
|
||||
type, m_MapId, m_InstanceID);
|
||||
type, m_MapId, m_InstanceID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1512,37 +1512,37 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
// So we must create it specific for this instance
|
||||
GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
|
||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
|
||||
PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, goState))
|
||||
PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, goState))
|
||||
{
|
||||
sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
entry, m_MapId, m_InstanceID);
|
||||
entry, m_MapId, m_InstanceID);
|
||||
sLog->outError("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
entry, m_MapId, m_InstanceID);
|
||||
entry, m_MapId, m_InstanceID);
|
||||
delete go;
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
uint32 guid = go->GetGUIDLow();
|
||||
/*
|
||||
uint32 guid = go->GetGUIDLow();
|
||||
|
||||
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
|
||||
// iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
|
||||
GameObjectData& data = sObjectMgr->NewGOData(guid);
|
||||
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
|
||||
// iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
|
||||
GameObjectData& data = sObjectMgr->NewGOData(guid);
|
||||
|
||||
data.id = entry;
|
||||
data.mapid = GetMapId();
|
||||
data.posX = x;
|
||||
data.posY = y;
|
||||
data.posZ = z;
|
||||
data.orientation = o;
|
||||
data.rotation0 = rotation0;
|
||||
data.rotation1 = rotation1;
|
||||
data.rotation2 = rotation2;
|
||||
data.rotation3 = rotation3;
|
||||
data.spawntimesecs = respawnTime;
|
||||
data.spawnMask = 1;
|
||||
data.animprogress = 100;
|
||||
data.go_state = 1;
|
||||
*/
|
||||
data.id = entry;
|
||||
data.mapid = GetMapId();
|
||||
data.posX = x;
|
||||
data.posY = y;
|
||||
data.posZ = z;
|
||||
data.orientation = o;
|
||||
data.rotation0 = rotation0;
|
||||
data.rotation1 = rotation1;
|
||||
data.rotation2 = rotation2;
|
||||
data.rotation3 = rotation3;
|
||||
data.spawntimesecs = respawnTime;
|
||||
data.spawnMask = 1;
|
||||
data.animprogress = 100;
|
||||
data.go_state = 1;
|
||||
*/
|
||||
// Add to world, so it can be later looked up from HashMapHolder
|
||||
if (!map->AddToMap(go))
|
||||
{
|
||||
|
|
@ -1568,7 +1568,7 @@ void Battleground::DoorClose(uint32 type)
|
|||
}
|
||||
else
|
||||
sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
}
|
||||
|
||||
void Battleground::DoorOpen(uint32 type)
|
||||
|
|
@ -1580,7 +1580,7 @@ void Battleground::DoorOpen(uint32 type)
|
|||
}
|
||||
else
|
||||
sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
}
|
||||
|
||||
GameObject* Battleground::GetBGObject(uint32 type)
|
||||
|
|
@ -1588,7 +1588,7 @@ GameObject* Battleground::GetBGObject(uint32 type)
|
|||
GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]);
|
||||
if (!obj)
|
||||
sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
@ -1597,7 +1597,7 @@ Creature* Battleground::GetBGCreature(uint32 type)
|
|||
Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]);
|
||||
if (!creature)
|
||||
sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
|
||||
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
|
||||
return creature;
|
||||
}
|
||||
|
||||
|
|
@ -1608,10 +1608,9 @@ void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
|
|||
{
|
||||
if (respawntime)
|
||||
obj->SetLootState(GO_JUST_DEACTIVATED);
|
||||
else
|
||||
if (obj->getLootState() == GO_JUST_DEACTIVATED)
|
||||
// Change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
|
||||
obj->SetLootState(GO_READY);
|
||||
else if (obj->getLootState() == GO_JUST_DEACTIVATED)
|
||||
// Change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
|
||||
obj->SetLootState(GO_READY);
|
||||
obj->SetRespawnTime(respawntime);
|
||||
map->AddToMap(obj);
|
||||
}
|
||||
|
|
@ -1643,7 +1642,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
|
|||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
{
|
||||
sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
entry, m_MapId, m_InstanceID);
|
||||
entry, m_MapId, m_InstanceID);
|
||||
delete creature;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -1654,7 +1653,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
|
|||
if (!cinfo)
|
||||
{
|
||||
sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
|
||||
entry, m_MapId, m_InstanceID);
|
||||
entry, m_MapId, m_InstanceID);
|
||||
delete creature;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -1693,7 +1692,7 @@ bool Battleground::DelCreature(uint32 type)
|
|||
}
|
||||
|
||||
sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
|
||||
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
|
||||
BgCreatures[type] = 0;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1711,7 +1710,7 @@ bool Battleground::DelObject(uint32 type)
|
|||
return true;
|
||||
}
|
||||
sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
BgObjects[type] = 0;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1735,7 +1734,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
|
|||
return true;
|
||||
}
|
||||
sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
type, entry, m_MapId, m_InstanceID);
|
||||
type, entry, m_MapId, m_InstanceID);
|
||||
EndNow();
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1923,7 +1922,7 @@ int32 Battleground::GetObjectType(uint64 guid)
|
|||
if (BgObjects[i] == guid)
|
||||
return i;
|
||||
sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
|
||||
GUID_LOPART(guid), m_MapId, m_InstanceID);
|
||||
GUID_LOPART(guid), m_MapId, m_InstanceID);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ struct BattlegroundObjectInfo
|
|||
{
|
||||
BattlegroundObjectInfo() : object(nullptr), timer(0), spellid(0) {}
|
||||
|
||||
GameObject *object;
|
||||
GameObject* object;
|
||||
int32 timer;
|
||||
uint32 spellid;
|
||||
};
|
||||
|
|
@ -271,25 +271,25 @@ struct BattlegroundScore
|
|||
|
||||
class ArenaLogEntryData
|
||||
{
|
||||
public:
|
||||
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
|
||||
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
Guid = guid;
|
||||
Acc = acc;
|
||||
ArenaTeamId = arenaTeamId;
|
||||
IP = ip;
|
||||
}
|
||||
public:
|
||||
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
|
||||
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
Guid = guid;
|
||||
Acc = acc;
|
||||
ArenaTeamId = arenaTeamId;
|
||||
IP = ip;
|
||||
}
|
||||
|
||||
std::string Name;
|
||||
uint32 Guid;
|
||||
uint32 Acc;
|
||||
uint32 ArenaTeamId;
|
||||
std::string IP;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
uint32 KillingBlows;
|
||||
std::string Name;
|
||||
uint32 Guid;
|
||||
uint32 Acc;
|
||||
uint32 ArenaTeamId;
|
||||
std::string IP;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
uint32 KillingBlows;
|
||||
};
|
||||
|
||||
enum BGHonorMode
|
||||
|
|
@ -320,430 +320,430 @@ enum BattlegroundQueueInvitationType
|
|||
|
||||
class Battleground
|
||||
{
|
||||
public:
|
||||
Battleground();
|
||||
virtual ~Battleground();
|
||||
|
||||
void Update(uint32 diff);
|
||||
|
||||
virtual bool SetupBattleground() // must be implemented in BG subclass
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual void Init();
|
||||
virtual void StartingEventCloseDoors() { }
|
||||
virtual void StartingEventOpenDoors() { }
|
||||
virtual void ResetBGSubclass() { } // must be implemented in BG subclass
|
||||
|
||||
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
/* achievement req. */
|
||||
virtual bool AllNodesConrolledByTeam(TeamId /*teamId*/) const { return false; }
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
|
||||
|
||||
/* Battleground */
|
||||
// Get methods:
|
||||
char const* GetName() const { return m_Name; }
|
||||
BattlegroundTypeId GetBgTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_RealTypeID; }
|
||||
uint32 GetInstanceID() const { return m_InstanceID; }
|
||||
BattlegroundStatus GetStatus() const { return m_Status; }
|
||||
uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
|
||||
uint32 GetStartTime() const { return m_StartTime; }
|
||||
uint32 GetEndTime() const { return m_EndTime; }
|
||||
uint32 GetLastResurrectTime() const { return m_LastResurrectTime; }
|
||||
|
||||
uint32 GetMinLevel() const { return m_LevelMin; }
|
||||
uint32 GetMaxLevel() const { return m_LevelMax; }
|
||||
|
||||
uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
|
||||
uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
|
||||
|
||||
int32 GetStartDelayTime() const { return m_StartDelayTime; }
|
||||
uint8 GetArenaType() const { return m_ArenaType; }
|
||||
TeamId GetWinner() const { return m_WinnerId; }
|
||||
uint32 GetScriptId() const { return ScriptId; }
|
||||
uint32 GetBonusHonorFromKill(uint32 kills) const;
|
||||
|
||||
bool IsRandom() { return m_IsRandom; }
|
||||
|
||||
// Set methods:
|
||||
void SetName(char const* Name) { m_Name = Name; }
|
||||
void SetBgTypeID(BattlegroundTypeId TypeID) { m_RealTypeID = TypeID; }
|
||||
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
|
||||
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
|
||||
void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
|
||||
void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
|
||||
void SetStartTime(uint32 Time) { m_StartTime = Time; }
|
||||
void SetEndTime(uint32 Time) { m_EndTime = Time; }
|
||||
void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; }
|
||||
void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; }
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
|
||||
void SetWinner(TeamId winner) { m_WinnerId = winner; }
|
||||
void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
|
||||
void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
||||
|
||||
void ModifyStartDelayTime(int32 diff) { m_StartDelayTime -= diff; }
|
||||
void SetStartDelayTime(int32 Time) { m_StartDelayTime = Time; }
|
||||
|
||||
void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
|
||||
void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
|
||||
|
||||
void DecreaseInvitedCount(TeamId teamId) { if (m_BgInvitedPlayers[teamId]) --m_BgInvitedPlayers[teamId]; }
|
||||
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
|
||||
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
|
||||
|
||||
bool HasFreeSlots() const;
|
||||
uint32 GetFreeSlotsForTeam(TeamId teamId) const;
|
||||
uint32 GetMaxFreeSlots() const;
|
||||
|
||||
typedef std::set<Player*> SpectatorList;
|
||||
typedef std::map<uint64, uint64> ToBeTeleportedMap;
|
||||
void AddSpectator(Player* p) { m_Spectators.insert(p); }
|
||||
void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
|
||||
bool HaveSpectators() { return !m_Spectators.empty(); }
|
||||
const SpectatorList& GetSpectators() const { return m_Spectators; }
|
||||
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
|
||||
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
|
||||
void SpectatorsSendPacket(WorldPacket& data);
|
||||
|
||||
bool isArena() const { return m_IsArena; }
|
||||
bool isBattleground() const { return !m_IsArena; }
|
||||
bool isRated() const { return m_IsRated; }
|
||||
|
||||
typedef std::map<uint64, Player*> BattlegroundPlayerMap;
|
||||
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
|
||||
uint32 GetPlayersSize() const { return m_Players.size(); }
|
||||
|
||||
void ReadyMarkerClicked(Player* p); // pussywizard
|
||||
std::set<uint32> readyMarkerClickedSet; // pussywizard
|
||||
|
||||
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::map<uint64, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
|
||||
ArenaLogEntryDataMap ArenaLogEntries; // pussywizard
|
||||
BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
|
||||
BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
|
||||
uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
|
||||
|
||||
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
|
||||
|
||||
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(Player* player);
|
||||
|
||||
/// Relocate all players in ReviveQueue to the closest graveyard
|
||||
void RelocateDeadPlayers(uint64 queueIndex);
|
||||
|
||||
void StartBattleground();
|
||||
|
||||
GameObject* GetBGObject(uint32 type);
|
||||
Creature* GetBGCreature(uint32 type);
|
||||
|
||||
// Location
|
||||
void SetMapId(uint32 MapID) { m_MapId = MapID; }
|
||||
uint32 GetMapId() const { return m_MapId; }
|
||||
|
||||
// Map pointers
|
||||
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
|
||||
BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
|
||||
BattlegroundMap* FindBgMap() const { return m_Map; }
|
||||
|
||||
void SetTeamStartLoc(TeamId teamId, float X, float Y, float Z, float O);
|
||||
void GetTeamStartLoc(TeamId teamId, float &X, float &Y, float &Z, float &O) const
|
||||
{
|
||||
X = m_TeamStartLocX[teamId];
|
||||
Y = m_TeamStartLocY[teamId];
|
||||
Z = m_TeamStartLocZ[teamId];
|
||||
O = m_TeamStartLocO[teamId];
|
||||
}
|
||||
|
||||
void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
|
||||
float GetStartMaxDist() const { return m_StartMaxDist; }
|
||||
|
||||
// Packet Transfer
|
||||
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
void SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender = NULL, bool self = true);
|
||||
void SendPacketToAll(WorldPacket* packet);
|
||||
void YellToAll(Creature* creature, const char* text, uint32 language);
|
||||
|
||||
template<class Do>
|
||||
void BroadcastWorker(Do& _do);
|
||||
|
||||
void PlaySoundToAll(uint32 soundId);
|
||||
void CastSpellOnTeam(uint32 spellId, TeamId teamId);
|
||||
void RemoveAuraOnTeam(uint32 spellId, TeamId teamId);
|
||||
void RewardHonorToTeam(uint32 honor, TeamId teamId);
|
||||
void RewardReputationToTeam(uint32 factionId, uint32 reputation, TeamId teamId);
|
||||
uint32 GetRealRepFactionForPlayer(uint32 factionId, Player* player);
|
||||
|
||||
void UpdateWorldState(uint32 Field, uint32 Value);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player);
|
||||
|
||||
virtual void EndBattleground(TeamId winnerTeamId);
|
||||
void BlockMovement(Player* player);
|
||||
|
||||
void SendWarningToAll(uint32 entry, ...);
|
||||
void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr);
|
||||
void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
|
||||
|
||||
// specialized version with 2 string id args
|
||||
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
|
||||
|
||||
// Raid Group
|
||||
Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
|
||||
void SetBgRaid(TeamId teamId, Group* bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
uint32 GetPlayersCountByTeam(TeamId teamId) const { return m_PlayersCount[teamId]; }
|
||||
uint32 GetAlivePlayersCountByTeam(TeamId teamId) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
|
||||
void UpdatePlayersCountByTeam(TeamId teamId, bool remove)
|
||||
{
|
||||
if (remove)
|
||||
--m_PlayersCount[teamId];
|
||||
else
|
||||
++m_PlayersCount[teamId];
|
||||
}
|
||||
|
||||
// used for rated arena battles
|
||||
void SetArenaTeamIdForTeam(TeamId teamId, uint32 ArenaTeamId) { m_ArenaTeamIds[teamId] = ArenaTeamId; }
|
||||
uint32 GetArenaTeamIdForTeam(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
|
||||
void SetArenaTeamRatingChangeForTeam(TeamId teamId, int32 RatingChange) { m_ArenaTeamRatingChanges[teamId] = RatingChange; }
|
||||
int32 GetArenaTeamRatingChangeForTeam(TeamId teamId) const { return m_ArenaTeamRatingChanges[teamId]; }
|
||||
void SetArenaMatchmakerRating(TeamId teamId, uint32 MMR) { m_ArenaTeamMMR[teamId] = MMR; }
|
||||
uint32 GetArenaMatchmakerRating(TeamId teamId) const { return m_ArenaTeamMMR[teamId]; }
|
||||
void CheckArenaAfterTimerConditions();
|
||||
void CheckArenaWinConditions();
|
||||
virtual void UpdateArenaWorldState();
|
||||
public:
|
||||
Battleground();
|
||||
virtual ~Battleground();
|
||||
|
||||
void Update(uint32 diff);
|
||||
|
||||
virtual bool SetupBattleground() // must be implemented in BG subclass
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual void Init();
|
||||
virtual void StartingEventCloseDoors() { }
|
||||
virtual void StartingEventOpenDoors() { }
|
||||
virtual void ResetBGSubclass() { } // must be implemented in BG subclass
|
||||
|
||||
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
/* achievement req. */
|
||||
virtual bool AllNodesConrolledByTeam(TeamId /*teamId*/) const { return false; }
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
|
||||
|
||||
/* Battleground */
|
||||
// Get methods:
|
||||
char const* GetName() const { return m_Name; }
|
||||
BattlegroundTypeId GetBgTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_RealTypeID; }
|
||||
uint32 GetInstanceID() const { return m_InstanceID; }
|
||||
BattlegroundStatus GetStatus() const { return m_Status; }
|
||||
uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
|
||||
uint32 GetStartTime() const { return m_StartTime; }
|
||||
uint32 GetEndTime() const { return m_EndTime; }
|
||||
uint32 GetLastResurrectTime() const { return m_LastResurrectTime; }
|
||||
|
||||
uint32 GetMinLevel() const { return m_LevelMin; }
|
||||
uint32 GetMaxLevel() const { return m_LevelMax; }
|
||||
|
||||
uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
|
||||
uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
|
||||
|
||||
int32 GetStartDelayTime() const { return m_StartDelayTime; }
|
||||
uint8 GetArenaType() const { return m_ArenaType; }
|
||||
TeamId GetWinner() const { return m_WinnerId; }
|
||||
uint32 GetScriptId() const { return ScriptId; }
|
||||
uint32 GetBonusHonorFromKill(uint32 kills) const;
|
||||
|
||||
bool IsRandom() { return m_IsRandom; }
|
||||
|
||||
// Set methods:
|
||||
void SetName(char const* Name) { m_Name = Name; }
|
||||
void SetBgTypeID(BattlegroundTypeId TypeID) { m_RealTypeID = TypeID; }
|
||||
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
|
||||
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
|
||||
void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
|
||||
void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
|
||||
void SetStartTime(uint32 Time) { m_StartTime = Time; }
|
||||
void SetEndTime(uint32 Time) { m_EndTime = Time; }
|
||||
void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; }
|
||||
void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; }
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
|
||||
void SetWinner(TeamId winner) { m_WinnerId = winner; }
|
||||
void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
|
||||
void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
||||
|
||||
void ModifyStartDelayTime(int32 diff) { m_StartDelayTime -= diff; }
|
||||
void SetStartDelayTime(int32 Time) { m_StartDelayTime = Time; }
|
||||
|
||||
void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
|
||||
void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
|
||||
|
||||
void DecreaseInvitedCount(TeamId teamId) { if (m_BgInvitedPlayers[teamId]) --m_BgInvitedPlayers[teamId]; }
|
||||
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
|
||||
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
|
||||
|
||||
bool HasFreeSlots() const;
|
||||
uint32 GetFreeSlotsForTeam(TeamId teamId) const;
|
||||
uint32 GetMaxFreeSlots() const;
|
||||
|
||||
typedef std::set<Player*> SpectatorList;
|
||||
typedef std::map<uint64, uint64> ToBeTeleportedMap;
|
||||
void AddSpectator(Player* p) { m_Spectators.insert(p); }
|
||||
void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
|
||||
bool HaveSpectators() { return !m_Spectators.empty(); }
|
||||
const SpectatorList& GetSpectators() const { return m_Spectators; }
|
||||
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
|
||||
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
|
||||
void SpectatorsSendPacket(WorldPacket& data);
|
||||
|
||||
bool isArena() const { return m_IsArena; }
|
||||
bool isBattleground() const { return !m_IsArena; }
|
||||
bool isRated() const { return m_IsRated; }
|
||||
|
||||
typedef std::map<uint64, Player*> BattlegroundPlayerMap;
|
||||
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
|
||||
uint32 GetPlayersSize() const { return m_Players.size(); }
|
||||
|
||||
void ReadyMarkerClicked(Player* p); // pussywizard
|
||||
std::set<uint32> readyMarkerClickedSet; // pussywizard
|
||||
|
||||
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::map<uint64, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
|
||||
ArenaLogEntryDataMap ArenaLogEntries; // pussywizard
|
||||
BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
|
||||
BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
|
||||
uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
|
||||
|
||||
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
|
||||
|
||||
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(Player* player);
|
||||
|
||||
/// Relocate all players in ReviveQueue to the closest graveyard
|
||||
void RelocateDeadPlayers(uint64 queueIndex);
|
||||
|
||||
void StartBattleground();
|
||||
|
||||
GameObject* GetBGObject(uint32 type);
|
||||
Creature* GetBGCreature(uint32 type);
|
||||
|
||||
// Location
|
||||
void SetMapId(uint32 MapID) { m_MapId = MapID; }
|
||||
uint32 GetMapId() const { return m_MapId; }
|
||||
|
||||
// Map pointers
|
||||
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
|
||||
BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
|
||||
BattlegroundMap* FindBgMap() const { return m_Map; }
|
||||
|
||||
void SetTeamStartLoc(TeamId teamId, float X, float Y, float Z, float O);
|
||||
void GetTeamStartLoc(TeamId teamId, float& X, float& Y, float& Z, float& O) const
|
||||
{
|
||||
X = m_TeamStartLocX[teamId];
|
||||
Y = m_TeamStartLocY[teamId];
|
||||
Z = m_TeamStartLocZ[teamId];
|
||||
O = m_TeamStartLocO[teamId];
|
||||
}
|
||||
|
||||
void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
|
||||
float GetStartMaxDist() const { return m_StartMaxDist; }
|
||||
|
||||
// Packet Transfer
|
||||
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
void SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender = NULL, bool self = true);
|
||||
void SendPacketToAll(WorldPacket* packet);
|
||||
void YellToAll(Creature* creature, const char* text, uint32 language);
|
||||
|
||||
template<class Do>
|
||||
void BroadcastWorker(Do& _do);
|
||||
|
||||
void PlaySoundToAll(uint32 soundId);
|
||||
void CastSpellOnTeam(uint32 spellId, TeamId teamId);
|
||||
void RemoveAuraOnTeam(uint32 spellId, TeamId teamId);
|
||||
void RewardHonorToTeam(uint32 honor, TeamId teamId);
|
||||
void RewardReputationToTeam(uint32 factionId, uint32 reputation, TeamId teamId);
|
||||
uint32 GetRealRepFactionForPlayer(uint32 factionId, Player* player);
|
||||
|
||||
void UpdateWorldState(uint32 Field, uint32 Value);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player);
|
||||
|
||||
virtual void EndBattleground(TeamId winnerTeamId);
|
||||
void BlockMovement(Player* player);
|
||||
|
||||
void SendWarningToAll(uint32 entry, ...);
|
||||
void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr);
|
||||
void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
|
||||
|
||||
// specialized version with 2 string id args
|
||||
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
|
||||
|
||||
// Raid Group
|
||||
Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
|
||||
void SetBgRaid(TeamId teamId, Group* bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
uint32 GetPlayersCountByTeam(TeamId teamId) const { return m_PlayersCount[teamId]; }
|
||||
uint32 GetAlivePlayersCountByTeam(TeamId teamId) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
|
||||
void UpdatePlayersCountByTeam(TeamId teamId, bool remove)
|
||||
{
|
||||
if (remove)
|
||||
--m_PlayersCount[teamId];
|
||||
else
|
||||
++m_PlayersCount[teamId];
|
||||
}
|
||||
|
||||
// used for rated arena battles
|
||||
void SetArenaTeamIdForTeam(TeamId teamId, uint32 ArenaTeamId) { m_ArenaTeamIds[teamId] = ArenaTeamId; }
|
||||
uint32 GetArenaTeamIdForTeam(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
|
||||
void SetArenaTeamRatingChangeForTeam(TeamId teamId, int32 RatingChange) { m_ArenaTeamRatingChanges[teamId] = RatingChange; }
|
||||
int32 GetArenaTeamRatingChangeForTeam(TeamId teamId) const { return m_ArenaTeamRatingChanges[teamId]; }
|
||||
void SetArenaMatchmakerRating(TeamId teamId, uint32 MMR) { m_ArenaTeamMMR[teamId] = MMR; }
|
||||
uint32 GetArenaMatchmakerRating(TeamId teamId) const { return m_ArenaTeamMMR[teamId]; }
|
||||
void CheckArenaAfterTimerConditions();
|
||||
void CheckArenaWinConditions();
|
||||
virtual void UpdateArenaWorldState();
|
||||
|
||||
// Triggers handle
|
||||
// must be implemented in BG subclass
|
||||
virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/) {}
|
||||
// must be implemented in BG subclass if need AND call base class generic code
|
||||
virtual void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/);
|
||||
// Triggers handle
|
||||
// must be implemented in BG subclass
|
||||
virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/) {}
|
||||
// must be implemented in BG subclass if need AND call base class generic code
|
||||
virtual void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/);
|
||||
|
||||
// Battleground events
|
||||
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
||||
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*gameObject*/) {}
|
||||
virtual void EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/) {}
|
||||
virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/){}
|
||||
// Battleground events
|
||||
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
||||
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*gameObject*/) {}
|
||||
virtual void EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/) {}
|
||||
virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
// this function can be used by spell to interact with the BG map
|
||||
virtual void DoAction(uint32 /*action*/, uint64 /*var*/) {}
|
||||
|
||||
virtual void HandlePlayerResurrect(Player* /*player*/) {}
|
||||
|
||||
// Death related
|
||||
virtual GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
virtual void AddPlayer(Player* player); // must be implemented in BG subclass
|
||||
|
||||
void AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId);
|
||||
|
||||
void RemovePlayerAtLeave(Player* player);
|
||||
// can be extended in in BG subclass
|
||||
|
||||
void HandleTriggerBuff(GameObject* gameObject);
|
||||
void SetHoliday(bool is_holiday);
|
||||
|
||||
// TODO: make this protected:
|
||||
typedef std::vector<uint64> BGObjects;
|
||||
typedef std::vector<uint64> BGCreatures;
|
||||
BGObjects BgObjects;
|
||||
BGCreatures BgCreatures;
|
||||
void SpawnBGObject(uint32 type, uint32 respawntime);
|
||||
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0, GOState goState = GO_STATE_READY);
|
||||
Creature* AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime = 0, MotionTransport* transport = nullptr);
|
||||
bool DelCreature(uint32 type);
|
||||
bool DelObject(uint32 type);
|
||||
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId);
|
||||
int32 GetObjectType(uint64 guid);
|
||||
|
||||
void DoorOpen(uint32 type);
|
||||
void DoorClose(uint32 type);
|
||||
//to be removed
|
||||
const char* GetAcoreString(int32 entry);
|
||||
|
||||
virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
|
||||
|
||||
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
||||
static TeamId GetOtherTeamId(TeamId teamId);
|
||||
bool IsPlayerInBattleground(uint64 guid) const;
|
||||
|
||||
bool ToBeDeleted() const { return m_SetDeleteThis; }
|
||||
//void SetDeleteThis() { m_SetDeleteThis = true; }
|
||||
|
||||
void RewardXPAtKill(Player* killer, Player* victim);
|
||||
|
||||
virtual uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return 0; }
|
||||
virtual void SetDroppedFlagGUID(uint64 /*guid*/, TeamId /*teamId*/ = TEAM_NEUTRAL) {}
|
||||
uint32 GetTeamScore(TeamId teamId) const;
|
||||
|
||||
virtual TeamId GetPrematureWinner();
|
||||
|
||||
// because BattleGrounds with different types and same level range has different m_BracketId
|
||||
uint8 GetUniqueBracketId() const;
|
||||
|
||||
BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return nullptr; }
|
||||
BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return nullptr; }
|
||||
BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return nullptr; }
|
||||
BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return nullptr; }
|
||||
BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return nullptr; }
|
||||
BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return nullptr; }
|
||||
BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return nullptr; }
|
||||
BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return nullptr; }
|
||||
BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return nullptr; }
|
||||
BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return nullptr; }
|
||||
BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return nullptr; }
|
||||
BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return nullptr; }
|
||||
|
||||
protected:
|
||||
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
|
||||
void EndNow();
|
||||
void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
|
||||
|
||||
void _ProcessResurrect(uint32 diff);
|
||||
void _ProcessProgress(uint32 diff);
|
||||
void _ProcessLeave(uint32 diff);
|
||||
void _ProcessJoin(uint32 diff);
|
||||
void _CheckSafePositions(uint32 diff);
|
||||
|
||||
// Scorekeeping
|
||||
BattlegroundScoreMap PlayerScores; // Player scores
|
||||
// must be implemented in BG subclass
|
||||
virtual void RemovePlayer(Player* /*player*/) {}
|
||||
|
||||
// Player lists, those need to be accessible by inherited classes
|
||||
BattlegroundPlayerMap m_Players;
|
||||
// Spirit Guide guid + Player list GUIDS
|
||||
std::map<uint64, std::vector<uint64> > m_ReviveQueue;
|
||||
|
||||
// these are important variables used for starting messages
|
||||
uint8 m_Events;
|
||||
BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT];
|
||||
// this must be filled in constructors!
|
||||
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT];
|
||||
|
||||
bool m_BuffChange;
|
||||
bool m_IsRandom;
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
|
||||
// pussywizard:
|
||||
uint32 m_UpdateTimer;
|
||||
private:
|
||||
// Battleground
|
||||
BattlegroundTypeId m_RealTypeID;
|
||||
BattlegroundTypeId m_RandomTypeID; // TypeID created from Random Battleground list
|
||||
uint32 m_InstanceID; // Battleground Instance's GUID!
|
||||
BattlegroundStatus m_Status;
|
||||
uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
|
||||
uint32 m_StartTime;
|
||||
uint32 m_ResetStatTimer;
|
||||
uint32 m_ValidStartPositionTimer;
|
||||
int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
|
||||
uint32 m_LastResurrectTime;
|
||||
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||
bool m_IsArena;
|
||||
TeamId m_WinnerId;
|
||||
int32 m_StartDelayTime;
|
||||
bool m_IsRated; // is this battle rated?
|
||||
bool m_PrematureCountDown;
|
||||
uint32 m_PrematureCountDownTimer;
|
||||
char const* m_Name;
|
||||
|
||||
/* Pre- and post-update hooks */
|
||||
|
||||
/**
|
||||
* @brief Pre-update hook.
|
||||
*
|
||||
* Will be called before battleground update is started. Depending on
|
||||
* the result of this call actual update body may be skipped.
|
||||
*
|
||||
* @param diff a time difference between two worldserver update loops in
|
||||
* milliseconds.
|
||||
*
|
||||
* @return @c true if update must be performed, @c false otherwise.
|
||||
*
|
||||
* @see Update(), PostUpdateImpl().
|
||||
*/
|
||||
virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
|
||||
|
||||
/**
|
||||
* @brief Post-update hook.
|
||||
*
|
||||
* Will be called after battleground update has passed. May be used to
|
||||
* implement custom update effects in subclasses.
|
||||
*
|
||||
* @param diff a time difference between two worldserver update loops in
|
||||
* milliseconds.
|
||||
*
|
||||
* @see Update(), PreUpdateImpl().
|
||||
*/
|
||||
virtual void PostUpdateImpl(uint32 /* diff */) { }
|
||||
|
||||
// Player lists
|
||||
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
||||
std::deque<uint64> m_OfflineQueue; // Player GUID
|
||||
|
||||
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
|
||||
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
|
||||
// Invited players counters
|
||||
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
|
||||
|
||||
// Raid Group
|
||||
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
|
||||
SpectatorList m_Spectators;
|
||||
ToBeTeleportedMap m_ToBeTeleported;
|
||||
|
||||
// Players count by team
|
||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||
|
||||
// Arena team ids by team
|
||||
uint32 m_ArenaTeamIds[BG_TEAMS_COUNT];
|
||||
|
||||
int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT];
|
||||
|
||||
// Limits
|
||||
uint32 m_LevelMin;
|
||||
uint32 m_LevelMax;
|
||||
uint32 m_MaxPlayersPerTeam;
|
||||
uint32 m_MinPlayersPerTeam;
|
||||
|
||||
// Start location
|
||||
uint32 m_MapId;
|
||||
BattlegroundMap* m_Map;
|
||||
float m_TeamStartLocX[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocY[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocZ[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocO[BG_TEAMS_COUNT];
|
||||
float m_StartMaxDist;
|
||||
uint32 ScriptId;
|
||||
// this function can be used by spell to interact with the BG map
|
||||
virtual void DoAction(uint32 /*action*/, uint64 /*var*/) {}
|
||||
|
||||
virtual void HandlePlayerResurrect(Player* /*player*/) {}
|
||||
|
||||
// Death related
|
||||
virtual GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
virtual void AddPlayer(Player* player); // must be implemented in BG subclass
|
||||
|
||||
void AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId);
|
||||
|
||||
void RemovePlayerAtLeave(Player* player);
|
||||
// can be extended in in BG subclass
|
||||
|
||||
void HandleTriggerBuff(GameObject* gameObject);
|
||||
void SetHoliday(bool is_holiday);
|
||||
|
||||
// TODO: make this protected:
|
||||
typedef std::vector<uint64> BGObjects;
|
||||
typedef std::vector<uint64> BGCreatures;
|
||||
BGObjects BgObjects;
|
||||
BGCreatures BgCreatures;
|
||||
void SpawnBGObject(uint32 type, uint32 respawntime);
|
||||
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0, GOState goState = GO_STATE_READY);
|
||||
Creature* AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime = 0, MotionTransport* transport = nullptr);
|
||||
bool DelCreature(uint32 type);
|
||||
bool DelObject(uint32 type);
|
||||
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId);
|
||||
int32 GetObjectType(uint64 guid);
|
||||
|
||||
void DoorOpen(uint32 type);
|
||||
void DoorClose(uint32 type);
|
||||
//to be removed
|
||||
const char* GetAcoreString(int32 entry);
|
||||
|
||||
virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
|
||||
|
||||
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
||||
static TeamId GetOtherTeamId(TeamId teamId);
|
||||
bool IsPlayerInBattleground(uint64 guid) const;
|
||||
|
||||
bool ToBeDeleted() const { return m_SetDeleteThis; }
|
||||
//void SetDeleteThis() { m_SetDeleteThis = true; }
|
||||
|
||||
void RewardXPAtKill(Player* killer, Player* victim);
|
||||
|
||||
virtual uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return 0; }
|
||||
virtual void SetDroppedFlagGUID(uint64 /*guid*/, TeamId /*teamId*/ = TEAM_NEUTRAL) {}
|
||||
uint32 GetTeamScore(TeamId teamId) const;
|
||||
|
||||
virtual TeamId GetPrematureWinner();
|
||||
|
||||
// because BattleGrounds with different types and same level range has different m_BracketId
|
||||
uint8 GetUniqueBracketId() const;
|
||||
|
||||
BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return nullptr; }
|
||||
BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return nullptr; }
|
||||
BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return nullptr; }
|
||||
BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return nullptr; }
|
||||
BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return nullptr; }
|
||||
BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return nullptr; }
|
||||
BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return nullptr; }
|
||||
BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return nullptr; }
|
||||
BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return nullptr; }
|
||||
BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return nullptr; }
|
||||
BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return nullptr; }
|
||||
|
||||
BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return nullptr; }
|
||||
BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return nullptr; }
|
||||
|
||||
protected:
|
||||
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
|
||||
void EndNow();
|
||||
void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
|
||||
|
||||
void _ProcessResurrect(uint32 diff);
|
||||
void _ProcessProgress(uint32 diff);
|
||||
void _ProcessLeave(uint32 diff);
|
||||
void _ProcessJoin(uint32 diff);
|
||||
void _CheckSafePositions(uint32 diff);
|
||||
|
||||
// Scorekeeping
|
||||
BattlegroundScoreMap PlayerScores; // Player scores
|
||||
// must be implemented in BG subclass
|
||||
virtual void RemovePlayer(Player* /*player*/) {}
|
||||
|
||||
// Player lists, those need to be accessible by inherited classes
|
||||
BattlegroundPlayerMap m_Players;
|
||||
// Spirit Guide guid + Player list GUIDS
|
||||
std::map<uint64, std::vector<uint64> > m_ReviveQueue;
|
||||
|
||||
// these are important variables used for starting messages
|
||||
uint8 m_Events;
|
||||
BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT];
|
||||
// this must be filled in constructors!
|
||||
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT];
|
||||
|
||||
bool m_BuffChange;
|
||||
bool m_IsRandom;
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
|
||||
// pussywizard:
|
||||
uint32 m_UpdateTimer;
|
||||
private:
|
||||
// Battleground
|
||||
BattlegroundTypeId m_RealTypeID;
|
||||
BattlegroundTypeId m_RandomTypeID; // TypeID created from Random Battleground list
|
||||
uint32 m_InstanceID; // Battleground Instance's GUID!
|
||||
BattlegroundStatus m_Status;
|
||||
uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
|
||||
uint32 m_StartTime;
|
||||
uint32 m_ResetStatTimer;
|
||||
uint32 m_ValidStartPositionTimer;
|
||||
int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
|
||||
uint32 m_LastResurrectTime;
|
||||
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||
bool m_IsArena;
|
||||
TeamId m_WinnerId;
|
||||
int32 m_StartDelayTime;
|
||||
bool m_IsRated; // is this battle rated?
|
||||
bool m_PrematureCountDown;
|
||||
uint32 m_PrematureCountDownTimer;
|
||||
char const* m_Name;
|
||||
|
||||
/* Pre- and post-update hooks */
|
||||
|
||||
/**
|
||||
* @brief Pre-update hook.
|
||||
*
|
||||
* Will be called before battleground update is started. Depending on
|
||||
* the result of this call actual update body may be skipped.
|
||||
*
|
||||
* @param diff a time difference between two worldserver update loops in
|
||||
* milliseconds.
|
||||
*
|
||||
* @return @c true if update must be performed, @c false otherwise.
|
||||
*
|
||||
* @see Update(), PostUpdateImpl().
|
||||
*/
|
||||
virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
|
||||
|
||||
/**
|
||||
* @brief Post-update hook.
|
||||
*
|
||||
* Will be called after battleground update has passed. May be used to
|
||||
* implement custom update effects in subclasses.
|
||||
*
|
||||
* @param diff a time difference between two worldserver update loops in
|
||||
* milliseconds.
|
||||
*
|
||||
* @see Update(), PreUpdateImpl().
|
||||
*/
|
||||
virtual void PostUpdateImpl(uint32 /* diff */) { }
|
||||
|
||||
// Player lists
|
||||
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
||||
std::deque<uint64> m_OfflineQueue; // Player GUID
|
||||
|
||||
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
|
||||
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
|
||||
// Invited players counters
|
||||
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
|
||||
|
||||
// Raid Group
|
||||
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
|
||||
SpectatorList m_Spectators;
|
||||
ToBeTeleportedMap m_ToBeTeleported;
|
||||
|
||||
// Players count by team
|
||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||
|
||||
// Arena team ids by team
|
||||
uint32 m_ArenaTeamIds[BG_TEAMS_COUNT];
|
||||
|
||||
int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT];
|
||||
|
||||
// Limits
|
||||
uint32 m_LevelMin;
|
||||
uint32 m_LevelMax;
|
||||
uint32 m_MaxPlayersPerTeam;
|
||||
uint32 m_MinPlayersPerTeam;
|
||||
|
||||
// Start location
|
||||
uint32 m_MapId;
|
||||
BattlegroundMap* m_Map;
|
||||
float m_TeamStartLocX[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocY[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocZ[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocO[BG_TEAMS_COUNT];
|
||||
float m_StartMaxDist;
|
||||
uint32 ScriptId;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
/*********************************************************/
|
||||
|
||||
BattlegroundMgr::BattlegroundMgr() : m_ArenaTesting(false), m_Testing(false),
|
||||
m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_AutoDistributionTimeChecker(0), m_NextPeriodicQueueUpdateTime(5*IN_MILLISECONDS)
|
||||
m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_AutoDistributionTimeChecker(0), m_NextPeriodicQueueUpdateTime(5 * IN_MILLISECONDS)
|
||||
{
|
||||
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
|
||||
|
|
@ -124,7 +124,7 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), false, 0);
|
||||
|
||||
m_NextPeriodicQueueUpdateTime = 5*IN_MILLISECONDS;
|
||||
m_NextPeriodicQueueUpdateTime = 5 * IN_MILLISECONDS;
|
||||
}
|
||||
else
|
||||
m_NextPeriodicQueueUpdateTime -= diff;
|
||||
|
|
@ -143,7 +143,7 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||
m_AutoDistributionTimeChecker = 600000; // 10 minutes check
|
||||
}
|
||||
else
|
||||
m_AutoDistributionTimeChecker -= diff;
|
||||
m_AutoDistributionTimeChecker -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -154,13 +154,13 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
|
|||
|
||||
if (StatusID == STATUS_NONE || !bg)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEFIELD_STATUS, 4+8);
|
||||
data->Initialize(SMSG_BATTLEFIELD_STATUS, 4 + 8);
|
||||
*data << uint32(QueueSlot);
|
||||
*data << uint64(0);
|
||||
return;
|
||||
}
|
||||
|
||||
data->Initialize(SMSG_BATTLEFIELD_STATUS, (4+8+1+1+4+1+4+4+4));
|
||||
data->Initialize(SMSG_BATTLEFIELD_STATUS, (4 + 8 + 1 + 1 + 4 + 1 + 4 + 4 + 4));
|
||||
*data << uint32(QueueSlot);
|
||||
// The following segment is read as uint64 in client but can be appended as their original type.
|
||||
*data << uint8(arenatype);
|
||||
|
|
@ -203,13 +203,13 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
|||
{
|
||||
uint8 type = (bg->isArena() ? 1 : 0);
|
||||
|
||||
data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize()));
|
||||
data->Initialize(MSG_PVP_LOG_DATA, (1 + 1 + 4 + 40 * bg->GetPlayerScoresSize()));
|
||||
*data << uint8(type); // type (battleground=0/arena=1)
|
||||
|
||||
if (type) // arena
|
||||
{
|
||||
// it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId+1))
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId + 1))
|
||||
{
|
||||
// Xinef: oryginally this was looping in reverse order, loop order was changed so we have to change checked teamId
|
||||
int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId));
|
||||
|
|
@ -222,10 +222,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
|||
*data << uint32(pointsGained); // Rating gained
|
||||
*data << uint32(MatchmakerRating); // Matchmaking Value
|
||||
}
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId+1))
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId + 1))
|
||||
{
|
||||
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(bg->GetArenaTeamIdForTeam(Battleground::GetOtherTeamId(iTeamId))))
|
||||
*data << at->GetName();
|
||||
* data << at->GetName();
|
||||
else
|
||||
*data << uint8(0);
|
||||
}
|
||||
|
|
@ -362,9 +362,9 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
|||
break;
|
||||
}
|
||||
// should never happen
|
||||
if (++scoreCount >= bg->GetMaxPlayersPerTeam()*2 && itr != bg->GetPlayerScoresEnd())
|
||||
if (++scoreCount >= bg->GetMaxPlayersPerTeam() * 2 && itr != bg->GetPlayerScoresEnd())
|
||||
{
|
||||
sLog->outMisc("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bgTypeId, bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam()*2);
|
||||
sLog->outMisc("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bgTypeId, bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam() * 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -382,7 +382,7 @@ void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Grou
|
|||
|
||||
void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value)
|
||||
{
|
||||
data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4);
|
||||
data->Initialize(SMSG_UPDATE_WORLD_STATE, 4 + 4);
|
||||
*data << uint32(field);
|
||||
*data << uint32(value);
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ Battleground* BattlegroundMgr::GetBattleground(uint32 instanceId)
|
|||
|
||||
BattlegroundContainer::const_iterator itr = m_Battlegrounds.find(instanceId);
|
||||
if (itr != m_Battlegrounds.end())
|
||||
return itr->second;
|
||||
return itr->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -446,7 +446,8 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original
|
|||
|
||||
Battleground* bg = nullptr;
|
||||
// create a copy of the BG template
|
||||
if (BattlegroundMgr::bgTypeToTemplate.find(bgTypeId) == BattlegroundMgr::bgTypeToTemplate.end()) {
|
||||
if (BattlegroundMgr::bgTypeToTemplate.find(bgTypeId) == BattlegroundMgr::bgTypeToTemplate.end())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -572,14 +573,14 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
|||
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
|
||||
{
|
||||
sLog->outError("Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
|
||||
data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
|
||||
data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax)
|
||||
{
|
||||
sLog->outError("Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
|
||||
data.bgTypeId, data.LevelMin, data.LevelMax);
|
||||
data.bgTypeId, data.LevelMin, data.LevelMax);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -634,8 +635,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
|||
_battlegroundMapTemplates[bl->mapid[0]] = &_battlegroundTemplates[BattlegroundTypeId(bgTypeId)];
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
|
@ -655,7 +655,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
|||
}
|
||||
else
|
||||
m_NextAutoDistributionTime = wstime;
|
||||
sLog->outString("AzerothCore Battleground: Automatic Arena Point Distribution initialized.");
|
||||
sLog->outString("AzerothCore Battleground: Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
|
||||
|
|
@ -739,17 +739,19 @@ void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battlegrou
|
|||
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
return bgTypeId == BATTLEGROUND_AA
|
||||
|| bgTypeId == BATTLEGROUND_BE
|
||||
|| bgTypeId == BATTLEGROUND_NA
|
||||
|| bgTypeId == BATTLEGROUND_DS
|
||||
|| bgTypeId == BATTLEGROUND_RV
|
||||
|| bgTypeId == BATTLEGROUND_RL;
|
||||
|| bgTypeId == BATTLEGROUND_BE
|
||||
|| bgTypeId == BATTLEGROUND_NA
|
||||
|| bgTypeId == BATTLEGROUND_DS
|
||||
|| bgTypeId == BATTLEGROUND_RV
|
||||
|| bgTypeId == BATTLEGROUND_RL;
|
||||
}
|
||||
|
||||
BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
|
||||
{
|
||||
if (arenaType) {
|
||||
switch (arenaType) {
|
||||
if (arenaType)
|
||||
{
|
||||
switch (arenaType)
|
||||
{
|
||||
case ARENA_TYPE_2v2:
|
||||
return BATTLEGROUND_QUEUE_2v2;
|
||||
case ARENA_TYPE_3v3:
|
||||
|
|
@ -761,7 +763,8 @@ BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgType
|
|||
}
|
||||
}
|
||||
|
||||
if (BattlegroundMgr::bgToQueue.find(bgTypeId) == BattlegroundMgr::bgToQueue.end()) {
|
||||
if (BattlegroundMgr::bgToQueue.find(bgTypeId) == BattlegroundMgr::bgToQueue.end())
|
||||
{
|
||||
return BATTLEGROUND_QUEUE_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -770,7 +773,8 @@ BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgType
|
|||
|
||||
BattlegroundTypeId BattlegroundMgr::BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
if (BattlegroundMgr::queueToBg.find(bgQueueTypeId) == BattlegroundMgr::queueToBg.end()) {
|
||||
if (BattlegroundMgr::queueToBg.find(bgQueueTypeId) == BattlegroundMgr::queueToBg.end())
|
||||
{
|
||||
return BattlegroundTypeId(0);
|
||||
}
|
||||
|
||||
|
|
@ -891,8 +895,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
|
|||
}
|
||||
|
||||
mBattleMastersMap[entry] = BattlegroundTypeId(bgTypeId);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
CheckBattleMasters();
|
||||
|
||||
|
|
@ -917,13 +920,20 @@ HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId
|
|||
{
|
||||
switch (bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_AV: return HOLIDAY_CALL_TO_ARMS_AV;
|
||||
case BATTLEGROUND_EY: return HOLIDAY_CALL_TO_ARMS_EY;
|
||||
case BATTLEGROUND_WS: return HOLIDAY_CALL_TO_ARMS_WS;
|
||||
case BATTLEGROUND_SA: return HOLIDAY_CALL_TO_ARMS_SA;
|
||||
case BATTLEGROUND_AB: return HOLIDAY_CALL_TO_ARMS_AB;
|
||||
case BATTLEGROUND_IC: return HOLIDAY_CALL_TO_ARMS_IC;
|
||||
default: return HOLIDAY_NONE;
|
||||
case BATTLEGROUND_AV:
|
||||
return HOLIDAY_CALL_TO_ARMS_AV;
|
||||
case BATTLEGROUND_EY:
|
||||
return HOLIDAY_CALL_TO_ARMS_EY;
|
||||
case BATTLEGROUND_WS:
|
||||
return HOLIDAY_CALL_TO_ARMS_WS;
|
||||
case BATTLEGROUND_SA:
|
||||
return HOLIDAY_CALL_TO_ARMS_SA;
|
||||
case BATTLEGROUND_AB:
|
||||
return HOLIDAY_CALL_TO_ARMS_AB;
|
||||
case BATTLEGROUND_IC:
|
||||
return HOLIDAY_CALL_TO_ARMS_IC;
|
||||
default:
|
||||
return HOLIDAY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -931,13 +941,20 @@ BattlegroundTypeId BattlegroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
|
|||
{
|
||||
switch (holiday)
|
||||
{
|
||||
case HOLIDAY_CALL_TO_ARMS_AV: return BATTLEGROUND_AV;
|
||||
case HOLIDAY_CALL_TO_ARMS_EY: return BATTLEGROUND_EY;
|
||||
case HOLIDAY_CALL_TO_ARMS_WS: return BATTLEGROUND_WS;
|
||||
case HOLIDAY_CALL_TO_ARMS_SA: return BATTLEGROUND_SA;
|
||||
case HOLIDAY_CALL_TO_ARMS_AB: return BATTLEGROUND_AB;
|
||||
case HOLIDAY_CALL_TO_ARMS_IC: return BATTLEGROUND_IC;
|
||||
default: return BATTLEGROUND_TYPE_NONE;
|
||||
case HOLIDAY_CALL_TO_ARMS_AV:
|
||||
return BATTLEGROUND_AV;
|
||||
case HOLIDAY_CALL_TO_ARMS_EY:
|
||||
return BATTLEGROUND_EY;
|
||||
case HOLIDAY_CALL_TO_ARMS_WS:
|
||||
return BATTLEGROUND_WS;
|
||||
case HOLIDAY_CALL_TO_ARMS_SA:
|
||||
return BATTLEGROUND_SA;
|
||||
case HOLIDAY_CALL_TO_ARMS_AB:
|
||||
return BATTLEGROUND_AB;
|
||||
case HOLIDAY_CALL_TO_ARMS_IC:
|
||||
return BATTLEGROUND_IC;
|
||||
default:
|
||||
return BATTLEGROUND_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1052,7 +1069,8 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
|||
|
||||
// init/update unordered_map
|
||||
// Battlegrounds
|
||||
std::unordered_map<int, BattlegroundQueueTypeId> BattlegroundMgr::bgToQueue = {
|
||||
std::unordered_map<int, BattlegroundQueueTypeId> BattlegroundMgr::bgToQueue =
|
||||
{
|
||||
{ BATTLEGROUND_AV, BATTLEGROUND_QUEUE_AV},
|
||||
{ BATTLEGROUND_WS, BATTLEGROUND_QUEUE_WS},
|
||||
{ BATTLEGROUND_AB, BATTLEGROUND_QUEUE_AB},
|
||||
|
|
@ -1069,7 +1087,8 @@ std::unordered_map<int, BattlegroundQueueTypeId> BattlegroundMgr::bgToQueue = {
|
|||
{ BATTLEGROUND_RV, BattlegroundQueueTypeId(0)}, // Ring of Valor
|
||||
};
|
||||
|
||||
std::unordered_map<int, BattlegroundTypeId> BattlegroundMgr::queueToBg = {
|
||||
std::unordered_map<int, BattlegroundTypeId> BattlegroundMgr::queueToBg =
|
||||
{
|
||||
{ BATTLEGROUND_QUEUE_NONE, BATTLEGROUND_TYPE_NONE },
|
||||
{ BATTLEGROUND_QUEUE_AV, BATTLEGROUND_AV },
|
||||
{ BATTLEGROUND_QUEUE_WS, BATTLEGROUND_WS },
|
||||
|
|
@ -1083,7 +1102,8 @@ std::unordered_map<int, BattlegroundTypeId> BattlegroundMgr::queueToBg = {
|
|||
{ BATTLEGROUND_QUEUE_5v5, BATTLEGROUND_AA },
|
||||
};
|
||||
|
||||
std::unordered_map<int, Battleground*> BattlegroundMgr::bgtypeToBattleground = {
|
||||
std::unordered_map<int, Battleground*> BattlegroundMgr::bgtypeToBattleground =
|
||||
{
|
||||
{ BATTLEGROUND_AV, new BattlegroundAV },
|
||||
{ BATTLEGROUND_WS, new BattlegroundWS },
|
||||
{ BATTLEGROUND_AB, new BattlegroundAB },
|
||||
|
|
@ -1099,29 +1119,31 @@ std::unordered_map<int, Battleground*> BattlegroundMgr::bgtypeToBattleground = {
|
|||
{ BATTLEGROUND_RB, new Battleground },
|
||||
};
|
||||
|
||||
std::unordered_map<int, bgRef> BattlegroundMgr::bgTypeToTemplate = {
|
||||
{ BATTLEGROUND_AV, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundAV(*(BattlegroundAV*)bg_t); } },
|
||||
{ BATTLEGROUND_WS, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundWS(*(BattlegroundWS*)bg_t); } },
|
||||
{ BATTLEGROUND_AB, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundAB(*(BattlegroundAB*)bg_t); } },
|
||||
{ BATTLEGROUND_NA, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundNA(*(BattlegroundNA*)bg_t); } },
|
||||
{ BATTLEGROUND_BE, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundBE(*(BattlegroundBE*)bg_t); } },
|
||||
{ BATTLEGROUND_EY, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundEY(*(BattlegroundEY*)bg_t); } },
|
||||
{ BATTLEGROUND_RL, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundRL(*(BattlegroundRL*)bg_t); } },
|
||||
{ BATTLEGROUND_SA, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundSA(*(BattlegroundSA*)bg_t); } },
|
||||
{ BATTLEGROUND_DS, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundDS(*(BattlegroundDS*)bg_t); } },
|
||||
{ BATTLEGROUND_RV, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundRV(*(BattlegroundRV*)bg_t); } },
|
||||
{ BATTLEGROUND_IC, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundIC(*(BattlegroundIC*)bg_t); } },
|
||||
std::unordered_map<int, bgRef> BattlegroundMgr::bgTypeToTemplate =
|
||||
{
|
||||
{ BATTLEGROUND_AV, [](Battleground * bg_t) -> Battleground* { return new BattlegroundAV(*(BattlegroundAV*)bg_t); } },
|
||||
{ BATTLEGROUND_WS, [](Battleground * bg_t) -> Battleground* { return new BattlegroundWS(*(BattlegroundWS*)bg_t); } },
|
||||
{ BATTLEGROUND_AB, [](Battleground * bg_t) -> Battleground* { return new BattlegroundAB(*(BattlegroundAB*)bg_t); } },
|
||||
{ BATTLEGROUND_NA, [](Battleground * bg_t) -> Battleground* { return new BattlegroundNA(*(BattlegroundNA*)bg_t); } },
|
||||
{ BATTLEGROUND_BE, [](Battleground * bg_t) -> Battleground* { return new BattlegroundBE(*(BattlegroundBE*)bg_t); } },
|
||||
{ BATTLEGROUND_EY, [](Battleground * bg_t) -> Battleground* { return new BattlegroundEY(*(BattlegroundEY*)bg_t); } },
|
||||
{ BATTLEGROUND_RL, [](Battleground * bg_t) -> Battleground* { return new BattlegroundRL(*(BattlegroundRL*)bg_t); } },
|
||||
{ BATTLEGROUND_SA, [](Battleground * bg_t) -> Battleground* { return new BattlegroundSA(*(BattlegroundSA*)bg_t); } },
|
||||
{ BATTLEGROUND_DS, [](Battleground * bg_t) -> Battleground* { return new BattlegroundDS(*(BattlegroundDS*)bg_t); } },
|
||||
{ BATTLEGROUND_RV, [](Battleground * bg_t) -> Battleground* { return new BattlegroundRV(*(BattlegroundRV*)bg_t); } },
|
||||
{ BATTLEGROUND_IC, [](Battleground * bg_t) -> Battleground* { return new BattlegroundIC(*(BattlegroundIC*)bg_t); } },
|
||||
|
||||
{ BATTLEGROUND_RB, [](Battleground *bg_t) -> Battleground*{ return new Battleground(*bg_t); }, },
|
||||
{ BATTLEGROUND_AA, [](Battleground *bg_t) -> Battleground*{ return new Battleground(*bg_t); }, },
|
||||
{ BATTLEGROUND_RB, [](Battleground * bg_t) -> Battleground* { return new Battleground(*bg_t); }, },
|
||||
{ BATTLEGROUND_AA, [](Battleground * bg_t) -> Battleground* { return new Battleground(*bg_t); }, },
|
||||
};
|
||||
|
||||
std::unordered_map<int, bgMapRef> BattlegroundMgr::getBgFromMap = {};
|
||||
|
||||
std::unordered_map<int, bgTypeRef> BattlegroundMgr::getBgFromTypeID = {
|
||||
std::unordered_map<int, bgTypeRef> BattlegroundMgr::getBgFromTypeID =
|
||||
{
|
||||
{
|
||||
BATTLEGROUND_RB,
|
||||
[](WorldPacket* data, Battleground::BattlegroundScoreMap::const_iterator itr2, Battleground* bg)
|
||||
[](WorldPacket * data, Battleground::BattlegroundScoreMap::const_iterator itr2, Battleground * bg)
|
||||
{
|
||||
if (BattlegroundMgr::getBgFromMap.find(bg->GetMapId()) == BattlegroundMgr::getBgFromMap.end()) // this should not happen
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
typedef std::map<uint32, Battleground*> BattlegroundContainer;
|
||||
typedef std::unordered_map<uint32, BattlegroundTypeId> BattleMastersMap;
|
||||
typedef Battleground*(*bgRef)(Battleground*);
|
||||
typedef Battleground* (*bgRef)(Battleground*);
|
||||
|
||||
typedef void(*bgMapRef)(WorldPacket*, Battleground::BattlegroundScoreMap::const_iterator);
|
||||
typedef void(*bgTypeRef)(WorldPacket*, Battleground::BattlegroundScoreMap::const_iterator, Battleground*);
|
||||
|
|
@ -50,126 +50,126 @@ struct GroupQueueInfo;
|
|||
|
||||
class BattlegroundMgr
|
||||
{
|
||||
private:
|
||||
BattlegroundMgr();
|
||||
~BattlegroundMgr();
|
||||
private:
|
||||
BattlegroundMgr();
|
||||
~BattlegroundMgr();
|
||||
|
||||
public:
|
||||
static BattlegroundMgr* instance();
|
||||
public:
|
||||
static BattlegroundMgr* instance();
|
||||
|
||||
void Update(uint32 diff);
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* Packet Building */
|
||||
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
|
||||
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
|
||||
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
|
||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, TeamId teamId, bool isRated = false, BattlegroundTypeId forceBgTypeId = BATTLEGROUND_TYPE_NONE);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
|
||||
/* Packet Building */
|
||||
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
|
||||
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
|
||||
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
|
||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, TeamId teamId, bool isRated = false, BattlegroundTypeId forceBgTypeId = BATTLEGROUND_TYPE_NONE);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
|
||||
|
||||
/* Battlegrounds */
|
||||
Battleground* GetBattleground(uint32 InstanceID);
|
||||
Battleground* GetBattlegroundTemplate(BattlegroundTypeId bgTypeId);
|
||||
Battleground* CreateNewBattleground(BattlegroundTypeId bgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated);
|
||||
/* Battlegrounds */
|
||||
Battleground* GetBattleground(uint32 InstanceID);
|
||||
Battleground* GetBattlegroundTemplate(BattlegroundTypeId bgTypeId);
|
||||
Battleground* CreateNewBattleground(BattlegroundTypeId bgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated);
|
||||
|
||||
void AddBattleground(Battleground* bg);
|
||||
void RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId);
|
||||
void AddBattleground(Battleground* bg);
|
||||
void RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId);
|
||||
|
||||
void CreateInitialBattlegrounds();
|
||||
void DeleteAllBattlegrounds();
|
||||
void CreateInitialBattlegrounds();
|
||||
void DeleteAllBattlegrounds();
|
||||
|
||||
void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||
void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||
|
||||
/* Battleground queues */
|
||||
BattlegroundQueue& GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[bgQueueTypeId]; }
|
||||
void ScheduleArenaQueueUpdate(uint32 arenaRatedTeamId, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundBracketId bracket_id);
|
||||
uint32 GetPrematureFinishTime() const;
|
||||
/* Battleground queues */
|
||||
BattlegroundQueue& GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[bgQueueTypeId]; }
|
||||
void ScheduleArenaQueueUpdate(uint32 arenaRatedTeamId, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundBracketId bracket_id);
|
||||
uint32 GetPrematureFinishTime() const;
|
||||
|
||||
static void InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId);
|
||||
static void InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId);
|
||||
|
||||
void ToggleArenaTesting();
|
||||
void ToggleTesting();
|
||||
void ToggleArenaTesting();
|
||||
void ToggleTesting();
|
||||
|
||||
void SetHolidayWeekends(uint32 mask);
|
||||
void SetHolidayWeekends(uint32 mask);
|
||||
|
||||
bool isArenaTesting() const { return m_ArenaTesting; }
|
||||
bool isTesting() const { return m_Testing; }
|
||||
bool isArenaTesting() const { return m_ArenaTesting; }
|
||||
bool isTesting() const { return m_Testing; }
|
||||
|
||||
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
static bool IsArenaType(BattlegroundTypeId bgTypeId);
|
||||
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
static bool IsArenaType(BattlegroundTypeId bgTypeId);
|
||||
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
|
||||
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId);
|
||||
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
|
||||
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId);
|
||||
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
|
||||
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void LoadBattleMastersEntry();
|
||||
void CheckBattleMasters();
|
||||
BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||
{
|
||||
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
||||
if (itr != mBattleMastersMap.end())
|
||||
return itr->second;
|
||||
return BATTLEGROUND_TYPE_NONE;
|
||||
}
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void LoadBattleMastersEntry();
|
||||
void CheckBattleMasters();
|
||||
BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||
{
|
||||
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
||||
if (itr != mBattleMastersMap.end())
|
||||
return itr->second;
|
||||
return BATTLEGROUND_TYPE_NONE;
|
||||
}
|
||||
|
||||
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
|
||||
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
|
||||
|
||||
static std::unordered_map<int, BattlegroundQueueTypeId> bgToQueue; // BattlegroundTypeId -> BattlegroundQueueTypeId
|
||||
static std::unordered_map<int, BattlegroundTypeId> queueToBg; // BattlegroundQueueTypeId -> BattlegroundTypeId
|
||||
static std::unordered_map<int, Battleground*> bgtypeToBattleground; // BattlegroundTypeId -> Battleground*
|
||||
static std::unordered_map<int, bgRef> bgTypeToTemplate; // BattlegroundTypeId -> bgRef
|
||||
static std::unordered_map<int, bgMapRef> getBgFromMap; // BattlegroundMapID -> bgMapRef
|
||||
static std::unordered_map<int, bgTypeRef> getBgFromTypeID; // BattlegroundTypeID -> bgTypeRef
|
||||
static std::unordered_map<int, BattlegroundQueueTypeId> bgToQueue; // BattlegroundTypeId -> BattlegroundQueueTypeId
|
||||
static std::unordered_map<int, BattlegroundTypeId> queueToBg; // BattlegroundQueueTypeId -> BattlegroundTypeId
|
||||
static std::unordered_map<int, Battleground*> bgtypeToBattleground; // BattlegroundTypeId -> Battleground*
|
||||
static std::unordered_map<int, bgRef> bgTypeToTemplate; // BattlegroundTypeId -> bgRef
|
||||
static std::unordered_map<int, bgMapRef> getBgFromMap; // BattlegroundMapID -> bgMapRef
|
||||
static std::unordered_map<int, bgTypeRef> getBgFromTypeID; // BattlegroundTypeID -> bgTypeRef
|
||||
|
||||
private:
|
||||
bool CreateBattleground(CreateBattlegroundData& data);
|
||||
uint32 GetNextClientVisibleInstanceId();
|
||||
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id);
|
||||
private:
|
||||
bool CreateBattleground(CreateBattlegroundData& data);
|
||||
uint32 GetNextClientVisibleInstanceId();
|
||||
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id);
|
||||
|
||||
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
|
||||
BattlegroundTemplateContainer m_BattlegroundTemplates;
|
||||
BattlegroundContainer m_Battlegrounds;
|
||||
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
|
||||
BattlegroundTemplateContainer m_BattlegroundTemplates;
|
||||
BattlegroundContainer m_Battlegrounds;
|
||||
|
||||
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES];
|
||||
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES];
|
||||
|
||||
std::vector<uint64> m_ArenaQueueUpdateScheduler;
|
||||
bool m_ArenaTesting;
|
||||
bool m_Testing;
|
||||
uint32 m_lastClientVisibleInstanceId;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
std::vector<uint64> m_ArenaQueueUpdateScheduler;
|
||||
bool m_ArenaTesting;
|
||||
bool m_Testing;
|
||||
uint32 m_lastClientVisibleInstanceId;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
|
||||
CreateBattlegroundData const* GetBattlegroundTemplateByTypeId(BattlegroundTypeId id)
|
||||
{
|
||||
BattlegroundTemplateMap::const_iterator itr = _battlegroundTemplates.find(id);
|
||||
if (itr != _battlegroundTemplates.end())
|
||||
return &itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
CreateBattlegroundData const* GetBattlegroundTemplateByTypeId(BattlegroundTypeId id)
|
||||
{
|
||||
BattlegroundTemplateMap::const_iterator itr = _battlegroundTemplates.find(id);
|
||||
if (itr != _battlegroundTemplates.end())
|
||||
return &itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreateBattlegroundData const* GetBattlegroundTemplateByMapId(uint32 mapId)
|
||||
{
|
||||
BattlegroundMapTemplateContainer::const_iterator itr = _battlegroundMapTemplates.find(mapId);
|
||||
if (itr != _battlegroundMapTemplates.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
CreateBattlegroundData const* GetBattlegroundTemplateByMapId(uint32 mapId)
|
||||
{
|
||||
BattlegroundMapTemplateContainer::const_iterator itr = _battlegroundMapTemplates.find(mapId);
|
||||
if (itr != _battlegroundMapTemplates.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
typedef std::map<BattlegroundTypeId, uint8 /*weight*/> BattlegroundSelectionWeightMap;
|
||||
typedef std::map<BattlegroundTypeId, uint8 /*weight*/> BattlegroundSelectionWeightMap;
|
||||
|
||||
typedef std::map<BattlegroundTypeId, CreateBattlegroundData> BattlegroundTemplateMap;
|
||||
typedef std::map<uint32 /*mapId*/, CreateBattlegroundData*> BattlegroundMapTemplateContainer;
|
||||
BattlegroundTemplateMap _battlegroundTemplates;
|
||||
BattlegroundMapTemplateContainer _battlegroundMapTemplates;
|
||||
typedef std::map<BattlegroundTypeId, CreateBattlegroundData> BattlegroundTemplateMap;
|
||||
typedef std::map<uint32 /*mapId*/, CreateBattlegroundData*> BattlegroundMapTemplateContainer;
|
||||
BattlegroundTemplateMap _battlegroundTemplates;
|
||||
BattlegroundMapTemplateContainer _battlegroundMapTemplates;
|
||||
};
|
||||
|
||||
#define sBattlegroundMgr BattlegroundMgr::instance()
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ BattlegroundQueue::~BattlegroundQueue()
|
|||
m_events.KillAllEvents(false);
|
||||
|
||||
m_QueuedPlayers.clear();
|
||||
for (auto & m_QueuedGroup : m_QueuedGroups)
|
||||
for (auto& m_QueuedGroup : m_QueuedGroups)
|
||||
{
|
||||
for (auto & j : m_QueuedGroup)
|
||||
for (auto& j : m_QueuedGroup)
|
||||
{
|
||||
for (auto & itr : j)
|
||||
for (auto& itr : j)
|
||||
delete itr;
|
||||
j.clear();
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ bool BattlegroundQueue::SelectionPool::KickGroup(const uint32 size)
|
|||
}
|
||||
|
||||
// returns true if added or desired count not yet reached
|
||||
bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo * ginfo, uint32 desiredCount)
|
||||
bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount)
|
||||
{
|
||||
// add if we don't exceed desiredCount
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size())
|
||||
|
|
@ -114,7 +114,7 @@ bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo * ginfo, uint32 d
|
|||
/*********************************************************/
|
||||
|
||||
// add group or player (grp == nullptr) to bg queue with the given leader and bg specifications
|
||||
GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDifficultyEntry const* bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid)
|
||||
GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDifficultyEntry const* bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid)
|
||||
{
|
||||
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||
return ginfo;
|
||||
}
|
||||
|
||||
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo * ginfo)
|
||||
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo)
|
||||
{
|
||||
uint32 timeInQueue = std::max<uint32>(1, getMSTimeDiff(ginfo->JoinTime, World::GetGameTimeMS()));
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo *
|
|||
return;
|
||||
|
||||
// pointer to last index
|
||||
uint32 * lastIndex = &m_WaitTimeLastIndex[team_index][ginfo->_bracketId];
|
||||
uint32* lastIndex = &m_WaitTimeLastIndex[team_index][ginfo->_bracketId];
|
||||
|
||||
// set time at index to new value
|
||||
m_WaitTimes[team_index][ginfo->_bracketId][*lastIndex] = timeInQueue;
|
||||
|
|
@ -216,7 +216,7 @@ void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo *
|
|||
(*lastIndex) %= COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME;
|
||||
}
|
||||
|
||||
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo * ginfo) const
|
||||
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const
|
||||
{
|
||||
// team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE
|
||||
uint8 team_index;
|
||||
|
|
@ -246,7 +246,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
{
|
||||
// pussywizard: leave queue packet
|
||||
if (playerQueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
if (Player * p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, nullptr, playerQueueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
|
||||
|
|
@ -291,7 +291,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
// if invited to bg, then always decrease invited count when removed from queue
|
||||
// sending player to bg will increase it again
|
||||
if (groupInfo->IsInvitedToBGInstanceGUID)
|
||||
if (Battleground * bg = sBattlegroundMgr->GetBattleground(groupInfo->IsInvitedToBGInstanceGUID))
|
||||
if (Battleground* bg = sBattlegroundMgr->GetBattleground(groupInfo->IsInvitedToBGInstanceGUID))
|
||||
bg->DecreaseInvitedCount(groupInfo->teamId);
|
||||
|
||||
// remove player queue info
|
||||
|
|
@ -299,14 +299,14 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
|
||||
// announce to world if arena team left queue for rated match, show only once
|
||||
if (groupInfo->ArenaType && groupInfo->IsRated && groupInfo->Players.empty() && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
|
||||
if (ArenaTeam * team = sArenaTeamMgr->GetArenaTeamById(groupInfo->ArenaTeamId))
|
||||
if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(groupInfo->ArenaTeamId))
|
||||
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, team->GetName().c_str(), groupInfo->ArenaType, groupInfo->ArenaType, groupInfo->ArenaTeamRating);
|
||||
|
||||
// if player leaves queue and he is invited to a rated arena match, then count it as he lost
|
||||
if (groupInfo->IsInvitedToBGInstanceGUID && groupInfo->IsRated && !sentToBg)
|
||||
if (ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(groupInfo->ArenaTeamId))
|
||||
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(groupInfo->ArenaTeamId))
|
||||
{
|
||||
if (Player * player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
at->MemberLost(player, groupInfo->OpponentsMatchmakerRating);
|
||||
at->SaveToDB();
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
{
|
||||
uint32 queueSlot = PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
|
||||
if (Player * plr = ObjectAccessor::FindPlayerInOrOutOfWorld(*(groupInfo->Players.begin())))
|
||||
if (Player* plr = ObjectAccessor::FindPlayerInOrOutOfWorld(*(groupInfo->Players.begin())))
|
||||
{
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(groupInfo->BgTypeId, groupInfo->ArenaType);
|
||||
queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
|
|
@ -337,7 +337,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
}
|
||||
}
|
||||
|
||||
void BattlegroundQueue::AddEvent(BasicEvent * Event, uint64 e_time)
|
||||
void BattlegroundQueue::AddEvent(BasicEvent* Event, uint64 e_time)
|
||||
{
|
||||
m_events.AddEvent(Event, m_events.CalculateTime(e_time));
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceG
|
|||
return qItr != m_QueuedPlayers.end() && qItr->second->IsInvitedToBGInstanceGUID == bgInstanceGuid && qItr->second->RemoveInviteTime == removeTime;
|
||||
}
|
||||
|
||||
bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo * ginfo)
|
||||
bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo)
|
||||
{
|
||||
auto qItr = m_QueuedPlayers.find(guid);
|
||||
if (qItr == m_QueuedPlayers.end())
|
||||
|
|
@ -377,7 +377,7 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, c
|
|||
// quick check if nothing we can do:
|
||||
if (!sBattlegroundMgr->isTesting())
|
||||
if ((aliFree > hordeFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty()) ||
|
||||
(hordeFree > aliFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()))
|
||||
(hordeFree > aliFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()))
|
||||
return;
|
||||
|
||||
// ally: at first fill as much as possible
|
||||
|
|
@ -399,15 +399,15 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, c
|
|||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
{
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
break;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
break;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// balance the teams based on the difference allowed
|
||||
|
|
@ -454,7 +454,7 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int3
|
|||
// quick check if nothing we can do:
|
||||
if (!sBattlegroundMgr->isTesting())
|
||||
if ((m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty()) ||
|
||||
(m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty()))
|
||||
(m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty()))
|
||||
return;
|
||||
|
||||
// copy groups from both queues to new joined container
|
||||
|
|
@ -482,15 +482,15 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int3
|
|||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
{
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
break;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
break;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// if free space differs too much, ballance
|
||||
|
|
@ -580,7 +580,7 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
|||
}
|
||||
|
||||
// this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
|
||||
bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
|
||||
bool BattlegroundQueue::CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
|
||||
{
|
||||
uint32 Coef = 1;
|
||||
|
||||
|
|
@ -596,17 +596,17 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, Battleground
|
|||
|
||||
switch (sWorld->getIntConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE))
|
||||
{
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE: // in this case, as soon as both teams have > mincount, start
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE: // in this case, as soon as both teams have > mincount, start
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED: // check difference between selection pools - if = 1 or less start.
|
||||
return abs(static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount())) <= 1 && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED: // check difference between selection pools - if = 1 or less start.
|
||||
return abs(static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount())) <= 1 && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN: // if both counts are same then it's an even match
|
||||
return (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() == m_SelectionPools[TEAM_HORDE].GetPlayerCount()) && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN: // if both counts are same then it's an even match
|
||||
return (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() == m_SelectionPools[TEAM_HORDE].GetPlayerCount()) && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
|
||||
default: // same as unbalanced (in case wrong setting is entered...)
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
default: // same as unbalanced (in case wrong setting is entered...)
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -693,7 +693,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
{
|
||||
Battleground* bg = itr.second;
|
||||
if (!BattlegroundMgr::IsArenaType(bg->GetBgTypeID()) && (bg->GetBgTypeID(true) == m_bgTypeId || m_bgTypeId == BATTLEGROUND_RB) &&
|
||||
bg->HasFreeSlots() && bg->GetMinLevel() <= bracketEntry->minLevel && bg->GetMaxLevel() >= bracketEntry->maxLevel)
|
||||
bg->HasFreeSlots() && bg->GetMinLevel() <= bracketEntry->minLevel && bg->GetMaxLevel() >= bracketEntry->maxLevel)
|
||||
bgsToCheck.insert(bg);
|
||||
}
|
||||
|
||||
|
|
@ -738,7 +738,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (auto & SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
for (auto& SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
|
||||
bg->StartBattleground();
|
||||
|
|
@ -751,7 +751,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (auto & SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
for (auto& SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
}
|
||||
}
|
||||
|
|
@ -760,7 +760,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
if (!isRated)
|
||||
{
|
||||
if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) ||
|
||||
(bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)))
|
||||
(bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)))
|
||||
{
|
||||
BattlegroundTypeId newBgTypeId = m_bgTypeId;
|
||||
uint32 minLvl = bracketEntry->minLevel;
|
||||
|
|
@ -773,7 +773,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (auto & SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
for (auto& SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
|
||||
bg->StartBattleground();
|
||||
|
|
@ -849,24 +849,32 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
if (currMSTime - (*itr)->JoinTime >= 20 * MINUTE * IN_MILLISECONDS && (oponentValid < 3 || MMRDiff < minOponentMMRDiff)) // after 20 minutes of waiting, pair with closest mmr, regardless the difference
|
||||
{
|
||||
oponentValid = 3;
|
||||
minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j;
|
||||
minOponentMMRDiff = MMRDiff;
|
||||
oponentItr = itr2;
|
||||
oponentQueue = j;
|
||||
}
|
||||
else if (MMR1 >= 2000 && MMR2 >= 2000 && longerWaitTime >= 2 * discardTime && (oponentValid < 2 || MMRDiff < minOponentMMRDiff)) // after 6 minutes of waiting, pair any 2000+ vs 2000+
|
||||
{
|
||||
oponentValid = 2;
|
||||
minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j;
|
||||
minOponentMMRDiff = MMRDiff;
|
||||
oponentItr = itr2;
|
||||
oponentQueue = j;
|
||||
}
|
||||
else if (oponentValid < 2 && MMRDiff < minOponentMMRDiff)
|
||||
{
|
||||
if (!oponentValid)
|
||||
{
|
||||
minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j;
|
||||
minOponentMMRDiff = MMRDiff;
|
||||
oponentItr = itr2;
|
||||
oponentQueue = j;
|
||||
if (MMRDiff <= maxAllowedDiff)
|
||||
oponentValid = 1;
|
||||
}
|
||||
if ((MMR1 < 1800 || MMR2 < 1800) && MaxPlayersPerTeam == 2 && MMRDiff <= maxDefaultRatingDifference) // in 2v2 below 1800 mmr - priority for default allowed difference
|
||||
{
|
||||
minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j;
|
||||
minOponentMMRDiff = MMRDiff;
|
||||
oponentItr = itr2;
|
||||
oponentQueue = j;
|
||||
brk = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -939,8 +947,8 @@ uint32 BattlegroundQueue::GetPlayersCountInGroupsQueue(BattlegroundBracketId bra
|
|||
uint32 playersCount = 0;
|
||||
|
||||
for (auto const& itr : m_QueuedGroups[bracketId][bgqueue])
|
||||
if (!itr->IsInvitedToBGInstanceGUID)
|
||||
playersCount += static_cast<uint32>(itr->Players.size());
|
||||
if (!itr->IsInvitedToBGInstanceGUID)
|
||||
playersCount += static_cast<uint32>(itr->Players.size());
|
||||
|
||||
return playersCount;
|
||||
}
|
||||
|
|
@ -974,7 +982,7 @@ void BattlegroundQueue::SendMessageQueue(Player* leader, Battleground* bg, PvPDi
|
|||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) || (bg->isArena() && !sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)))
|
||||
{
|
||||
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
|
||||
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
||||
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
||||
}
|
||||
else if (!bg->isArena()) // Show queue status to server (when joining battleground queue)
|
||||
{
|
||||
|
|
@ -1055,7 +1063,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
{
|
||||
// track if player leaves the BG by not clicking enter button
|
||||
if (bg && bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS) &&
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, player->GetGUIDLow());
|
||||
|
|
|
|||
|
|
@ -51,75 +51,75 @@ enum BattlegroundQueueGroupTypes
|
|||
class Battleground;
|
||||
class BattlegroundQueue
|
||||
{
|
||||
public:
|
||||
BattlegroundQueue();
|
||||
~BattlegroundQueue();
|
||||
|
||||
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId);
|
||||
void UpdateEvents(uint32 diff);
|
||||
|
||||
void FillPlayersToBG(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||
void FillPlayersToBGWithSpecific(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
|
||||
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||
bool CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
GroupQueueInfo* AddGroup(Player* leader, Group* group, PvPDifficultyEntry const* bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId);
|
||||
void RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQueueSlot);
|
||||
bool IsPlayerInvitedToRatedArena(uint64 pl_guid);
|
||||
bool IsPlayerInvited(uint64 pl_guid, uint32 bgInstanceGuid, uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
|
||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||
uint32 GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue);
|
||||
bool IsAllQueuesEmpty(BattlegroundBracketId bracket_id);
|
||||
void SendMessageQueue(Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||
|
||||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||
|
||||
typedef std::map<uint64, GroupQueueInfo*> QueuedPlayersMap;
|
||||
QueuedPlayersMap m_QueuedPlayers;
|
||||
|
||||
//do NOT use deque because deque.erase() invalidates ALL iterators
|
||||
typedef std::list<GroupQueueInfo*> GroupsQueueType;
|
||||
|
||||
/*
|
||||
This two dimensional array is used to store All queued groups
|
||||
First dimension specifies the bgTypeId
|
||||
Second dimension specifies the player's group types -
|
||||
BG_QUEUE_PREMADE_ALLIANCE is used for premade alliance groups and alliance rated arena teams
|
||||
BG_QUEUE_PREMADE_HORDE is used for premade horde groups and horde rated arena teams
|
||||
BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches
|
||||
BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches
|
||||
*/
|
||||
GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_MAX];
|
||||
|
||||
// class to select and invite groups to bg
|
||||
class SelectionPool
|
||||
{
|
||||
public:
|
||||
BattlegroundQueue();
|
||||
~BattlegroundQueue();
|
||||
|
||||
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId);
|
||||
void UpdateEvents(uint32 diff);
|
||||
|
||||
void FillPlayersToBG(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||
void FillPlayersToBGWithSpecific(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
|
||||
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||
bool CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
GroupQueueInfo* AddGroup(Player* leader, Group* group, PvPDifficultyEntry const* bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId);
|
||||
void RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQueueSlot);
|
||||
bool IsPlayerInvitedToRatedArena(uint64 pl_guid);
|
||||
bool IsPlayerInvited(uint64 pl_guid, uint32 bgInstanceGuid, uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
|
||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||
uint32 GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue);
|
||||
bool IsAllQueuesEmpty(BattlegroundBracketId bracket_id);
|
||||
void SendMessageQueue(Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||
|
||||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||
|
||||
typedef std::map<uint64, GroupQueueInfo*> QueuedPlayersMap;
|
||||
QueuedPlayersMap m_QueuedPlayers;
|
||||
|
||||
//do NOT use deque because deque.erase() invalidates ALL iterators
|
||||
typedef std::list<GroupQueueInfo*> GroupsQueueType;
|
||||
|
||||
/*
|
||||
This two dimensional array is used to store All queued groups
|
||||
First dimension specifies the bgTypeId
|
||||
Second dimension specifies the player's group types -
|
||||
BG_QUEUE_PREMADE_ALLIANCE is used for premade alliance groups and alliance rated arena teams
|
||||
BG_QUEUE_PREMADE_HORDE is used for premade horde groups and horde rated arena teams
|
||||
BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches
|
||||
BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches
|
||||
*/
|
||||
GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_MAX];
|
||||
|
||||
// class to select and invite groups to bg
|
||||
class SelectionPool
|
||||
{
|
||||
public:
|
||||
SelectionPool(): PlayerCount(0) {};
|
||||
void Init();
|
||||
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||
bool KickGroup(uint32 size);
|
||||
[[nodiscard]] uint32 GetPlayerCount() const { return PlayerCount; }
|
||||
public:
|
||||
GroupsQueueType SelectedGroups;
|
||||
private:
|
||||
uint32 PlayerCount;
|
||||
};
|
||||
|
||||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
SelectionPool(): PlayerCount(0) {};
|
||||
void Init();
|
||||
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||
bool KickGroup(uint32 size);
|
||||
[[nodiscard]] uint32 GetPlayerCount() const { return PlayerCount; }
|
||||
public:
|
||||
GroupsQueueType SelectedGroups;
|
||||
private:
|
||||
uint32 PlayerCount;
|
||||
};
|
||||
|
||||
BattlegroundTypeId m_bgTypeId;
|
||||
ArenaType m_arenaType;
|
||||
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastIndex[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
private:
|
||||
|
||||
// Event handler
|
||||
EventProcessor m_events;
|
||||
BattlegroundTypeId m_bgTypeId;
|
||||
ArenaType m_arenaType;
|
||||
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastIndex[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
|
||||
// Event handler
|
||||
EventProcessor m_events;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -128,20 +128,20 @@ class BattlegroundQueue
|
|||
*/
|
||||
class BGQueueInviteEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||
{ }
|
||||
~BGQueueInviteEvent() override = default;
|
||||
public:
|
||||
BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||
{ }
|
||||
~BGQueueInviteEvent() override = default;
|
||||
|
||||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void Abort(uint64 e_time) override;
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
BattlegroundTypeId m_BgTypeId;
|
||||
uint8 m_ArenaType;
|
||||
uint32 m_RemoveTime;
|
||||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void Abort(uint64 e_time) override;
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
BattlegroundTypeId m_BgTypeId;
|
||||
uint8 m_ArenaType;
|
||||
uint32 m_RemoveTime;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -151,20 +151,20 @@ class BGQueueInviteEvent : public BasicEvent
|
|||
*/
|
||||
class BGQueueRemoveEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
|
||||
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgQueueTypeId(bgQueueTypeId)
|
||||
{}
|
||||
public:
|
||||
BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
|
||||
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgQueueTypeId(bgQueueTypeId)
|
||||
{}
|
||||
|
||||
~BGQueueRemoveEvent() override = default;
|
||||
~BGQueueRemoveEvent() override = default;
|
||||
|
||||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void Abort(uint64 e_time) override;
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
uint32 m_RemoveTime;
|
||||
BattlegroundQueueTypeId m_BgQueueTypeId;
|
||||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void Abort(uint64 e_time) override;
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
uint32 m_RemoveTime;
|
||||
BattlegroundQueueTypeId m_BgQueueTypeId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
|||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
_bgEvents.Update(diff);
|
||||
while (uint32 eventId =_bgEvents.ExecuteEvent())
|
||||
while (uint32 eventId = _bgEvents.ExecuteEvent())
|
||||
switch (eventId)
|
||||
{
|
||||
case BG_AB_EVENT_UPDATE_BANNER_STABLE:
|
||||
|
|
@ -56,59 +56,59 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
|||
case BG_AB_EVENT_CAPTURE_BLACKSMITH:
|
||||
case BG_AB_EVENT_CAPTURE_LUMBERMILL:
|
||||
case BG_AB_EVENT_CAPTURE_GOLDMINE:
|
||||
{
|
||||
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
|
||||
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
DeleteBanner(node);
|
||||
_capturePointInfo[node]._ownerTeamId = teamId;
|
||||
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
|
||||
_capturePointInfo[node]._captured = true;
|
||||
|
||||
CreateBanner(node, false);
|
||||
NodeOccupied(node);
|
||||
SendNodeUpdate(node);
|
||||
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, nullptr, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
|
||||
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
break;
|
||||
}
|
||||
case BG_AB_EVENT_ALLIANCE_TICK:
|
||||
case BG_AB_EVENT_HORDE_TICK:
|
||||
{
|
||||
auto teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
|
||||
uint8 controlledPoints = _controlledPoints[teamId];
|
||||
if (controlledPoints == 0)
|
||||
{
|
||||
_bgEvents.ScheduleEvent(eventId, 3000);
|
||||
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
|
||||
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
DeleteBanner(node);
|
||||
_capturePointInfo[node]._ownerTeamId = teamId;
|
||||
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
|
||||
_capturePointInfo[node]._captured = true;
|
||||
|
||||
CreateBanner(node, false);
|
||||
NodeOccupied(node);
|
||||
SendNodeUpdate(node);
|
||||
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, nullptr, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
|
||||
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
break;
|
||||
}
|
||||
|
||||
auto honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
|
||||
auto reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
|
||||
auto information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
|
||||
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
|
||||
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
|
||||
|
||||
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
|
||||
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
|
||||
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
|
||||
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
|
||||
case BG_AB_EVENT_ALLIANCE_TICK:
|
||||
case BG_AB_EVENT_HORDE_TICK:
|
||||
{
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||
auto teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
|
||||
uint8 controlledPoints = _controlledPoints[teamId];
|
||||
if (controlledPoints == 0)
|
||||
{
|
||||
_bgEvents.ScheduleEvent(eventId, 3000);
|
||||
break;
|
||||
}
|
||||
|
||||
auto honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
|
||||
auto reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
|
||||
auto information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
|
||||
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
|
||||
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
|
||||
|
||||
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
|
||||
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
|
||||
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
|
||||
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
|
||||
{
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||
}
|
||||
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
|
||||
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
|
||||
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
|
||||
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(teamId);
|
||||
|
||||
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
|
||||
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
|
||||
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
|
||||
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(teamId);
|
||||
|
||||
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -193,29 +193,29 @@ void BattlegroundAB::CreateBanner(uint8 node, bool delay)
|
|||
// Just put it into the queue
|
||||
if (delay)
|
||||
{
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_UPDATE_BANNER_STABLE+node, BG_AB_BANNER_UPDATE_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_UPDATE_BANNER_STABLE + node, BG_AB_BANNER_UPDATE_TIME);
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(node * BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(node * BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattlegroundAB::DeleteBanner(uint8 node)
|
||||
{
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(node * BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(node * BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
for (auto & node : _capturePointInfo)
|
||||
for (auto& node : _capturePointInfo)
|
||||
{
|
||||
if (node._state == BG_AB_NODE_STATE_NEUTRAL)
|
||||
data << uint32(node._iconNone) << uint32(1);
|
||||
|
||||
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
|
||||
data << uint32(node._iconCapture + i-1) << uint32(node._state == i);
|
||||
data << uint32(node._iconCapture + i - 1) << uint32(node._state == i);
|
||||
}
|
||||
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(_controlledPoints[TEAM_ALLIANCE]);
|
||||
|
|
@ -231,7 +231,7 @@ void BattlegroundAB::SendNodeUpdate(uint8 node)
|
|||
{
|
||||
UpdateWorldState(_capturePointInfo[node]._iconNone, 0);
|
||||
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
|
||||
UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i);
|
||||
UpdateWorldState(_capturePointInfo[node]._iconCapture + i - 1, _capturePointInfo[node]._state == i);
|
||||
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, _controlledPoints[TEAM_ALLIANCE]);
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, _controlledPoints[TEAM_HORDE]);
|
||||
|
|
@ -280,9 +280,9 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f)
|
||||
break;
|
||||
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT || _capturePointInfo[node]._ownerTeamId == player->GetTeamId() ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT || _capturePointInfo[node]._ownerTeamId == player->GetTeamId() ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
|
||||
return;
|
||||
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
|
@ -356,14 +356,14 @@ bool BattlegroundAB::SetupBattleground()
|
|||
{
|
||||
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_H + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_ALLY + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_CONTESTED + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_H + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_ALLY + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_HORDE + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_CONTESTED + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
AddObject(BG_AB_OBJECT_GATE_A, BG_AB_OBJECTID_GATE_A, BG_AB_DoorPositions[0][0], BG_AB_DoorPositions[0][1], BG_AB_DoorPositions[0][2], BG_AB_DoorPositions[0][3], BG_AB_DoorPositions[0][4], BG_AB_DoorPositions[0][5], BG_AB_DoorPositions[0][6], BG_AB_DoorPositions[0][7], RESPAWN_IMMEDIATELY);
|
||||
|
|
@ -371,9 +371,9 @@ bool BattlegroundAB::SetupBattleground()
|
|||
|
||||
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
|
||||
|
|
@ -434,14 +434,14 @@ GraveyardStruct const* BattlegroundAB::GetClosestGraveyard(Player* player)
|
|||
|
||||
float pX = player->GetPositionX();
|
||||
float pY = player->GetPositionY();
|
||||
float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY);
|
||||
float dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY);
|
||||
float minDist = dist;
|
||||
|
||||
for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
|
||||
{
|
||||
entry = sGraveyard->GetGraveyard(BG_AB_GraveyardIds[i]);
|
||||
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY);
|
||||
dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
|
|
@ -484,7 +484,7 @@ void BattlegroundAB::ApplyPhaseMask()
|
|||
uint32 phaseMask = 1;
|
||||
for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL)
|
||||
phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId);
|
||||
phaseMask |= 1 << (i * 2 + 1 + _capturePointInfo[i]._ownerTeamId);
|
||||
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (auto itr : bgPlayerMap)
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ enum BG_AB_Misc
|
|||
BG_AB_BANNER_UPDATE_TIME = 2000
|
||||
};
|
||||
|
||||
const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT+1] = {0, 12000, 9000, 6000, 3000, 1000};
|
||||
const uint32 BG_AB_TickPoints[BG_AB_DYNAMIC_NODES_COUNT+1] = {0, 10, 10, 10, 10, 30};
|
||||
const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT + 1] = {0, 12000, 9000, 6000, 3000, 1000};
|
||||
const uint32 BG_AB_TickPoints[BG_AB_DYNAMIC_NODES_COUNT + 1] = {0, 10, 10, 10, 10, 30};
|
||||
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899};
|
||||
|
||||
const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] =
|
||||
|
|
@ -223,58 +223,58 @@ struct BattlegroundABScore : public BattlegroundScore
|
|||
|
||||
class BattlegroundAB : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundAB();
|
||||
~BattlegroundAB() override;
|
||||
public:
|
||||
BattlegroundAB();
|
||||
~BattlegroundAB() override;
|
||||
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void Init() override;
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void Init() override;
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override;
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override;
|
||||
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const override;
|
||||
bool IsTeamScores500Disadvantage(TeamId teamId) const { return _teamScores500Disadvantage[teamId]; }
|
||||
|
||||
TeamId GetPrematureWinner() override;
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const override;
|
||||
bool IsTeamScores500Disadvantage(TeamId teamId) const { return _teamScores500Disadvantage[teamId]; }
|
||||
|
||||
void DeleteBanner(uint8 node);
|
||||
void CreateBanner(uint8 node, bool delay);
|
||||
void SendNodeUpdate(uint8 node);
|
||||
void NodeOccupied(uint8 node);
|
||||
void NodeDeoccupied(uint8 node);
|
||||
void ApplyPhaseMask();
|
||||
TeamId GetPrematureWinner() override;
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
struct CapturePointInfo
|
||||
void DeleteBanner(uint8 node);
|
||||
void CreateBanner(uint8 node, bool delay);
|
||||
void SendNodeUpdate(uint8 node);
|
||||
void NodeOccupied(uint8 node);
|
||||
void NodeDeoccupied(uint8 node);
|
||||
void ApplyPhaseMask();
|
||||
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
TeamId _ownerTeamId;
|
||||
uint32 _iconNone;
|
||||
uint32 _iconCapture;
|
||||
uint8 _state;
|
||||
TeamId _ownerTeamId;
|
||||
uint32 _iconNone;
|
||||
uint32 _iconCapture;
|
||||
uint8 _state;
|
||||
|
||||
bool _captured;
|
||||
};
|
||||
bool _captured;
|
||||
};
|
||||
|
||||
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint32 _reputationTics;
|
||||
uint8 _controlledPoints[BG_TEAMS_COUNT]{};
|
||||
bool _teamScores500Disadvantage[BG_TEAMS_COUNT]{};
|
||||
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint32 _reputationTics;
|
||||
uint8 _controlledPoints[BG_TEAMS_COUNT] {};
|
||||
bool _teamScores500Disadvantage[BG_TEAMS_COUNT] {};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
BattlegroundAV::BattlegroundAV()
|
||||
{
|
||||
BgObjects.resize(BG_AV_OBJECT_MAX);
|
||||
BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX);
|
||||
BgCreatures.resize(AV_CPLACE_MAX + AV_STATICCPLACE_MAX);
|
||||
|
||||
for (uint8 i = 0; i < 2; i++)
|
||||
{
|
||||
|
|
@ -100,13 +100,13 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
|
|||
sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
|
||||
return;
|
||||
}
|
||||
m_CaptainAlive[0]=false;
|
||||
m_CaptainAlive[0] = false;
|
||||
RewardReputationToTeam(729, BG_AV_REP_CAPTAIN, TEAM_HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), TEAM_HORDE);
|
||||
UpdateScore(TEAM_ALLIANCE, (-1)*BG_AV_RES_CAPTAIN);
|
||||
//spawn destroyed aura
|
||||
for (uint8 i=0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+i, RESPAWN_IMMEDIATELY);
|
||||
for (uint8 i = 0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + i, RESPAWN_IMMEDIATELY);
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if (creature)
|
||||
YellToAll(creature, GetAcoreString(LANG_BG_AV_A_CAPTAIN_DEAD), LANG_UNIVERSAL);
|
||||
|
|
@ -119,13 +119,13 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
|
|||
sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
|
||||
return;
|
||||
}
|
||||
m_CaptainAlive[1]=false;
|
||||
m_CaptainAlive[1] = false;
|
||||
RewardReputationToTeam(730, BG_AV_REP_CAPTAIN, TEAM_ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), TEAM_ALLIANCE);
|
||||
UpdateScore(TEAM_HORDE, (-1)*BG_AV_RES_CAPTAIN);
|
||||
//spawn destroyed aura
|
||||
for (uint8 i=0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_HORDE+i, RESPAWN_IMMEDIATELY);
|
||||
for (uint8 i = 0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_HORDE + i, RESPAWN_IMMEDIATELY);
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if (creature)
|
||||
YellToAll(creature, GetAcoreString(LANG_BG_AV_H_CAPTAIN_DEAD), LANG_UNIVERSAL);
|
||||
|
|
@ -152,7 +152,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
case AV_QUEST_A_SCRAPS2:
|
||||
case AV_QUEST_H_SCRAPS1:
|
||||
case AV_QUEST_H_SCRAPS2:
|
||||
m_Team_QuestStatus[teamId][0]+=20;
|
||||
m_Team_QuestStatus[teamId][0] += 20;
|
||||
if (m_Team_QuestStatus[teamId][0] == 500 || m_Team_QuestStatus[teamId][0] == 1000 || m_Team_QuestStatus[teamId][0] == 1500) //25, 50, 75 turn ins
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
|
|
@ -163,8 +163,8 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
{
|
||||
DePopulateNode(i);
|
||||
PopulateNode(i);
|
||||
//maybe this is bad, because it will instantly respawn all creatures on every grave..
|
||||
}
|
||||
//maybe this is bad, because it will instantly respawn all creatures on every grave..
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AV_QUEST_A_COMMANDER1:
|
||||
|
|
@ -268,20 +268,21 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
}
|
||||
|
||||
void BattlegroundAV::UpdateScore(TeamId teamId, int16 points)
|
||||
{ //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
|
||||
{
|
||||
//note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
|
||||
m_Team_Scores[teamId] += points;
|
||||
|
||||
UpdateWorldState(((teamId == TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamId]);
|
||||
UpdateWorldState(((teamId == TEAM_HORDE) ? AV_Horde_Score : AV_Alliance_Score), m_Team_Scores[teamId]);
|
||||
if (points < 0)
|
||||
{
|
||||
if (m_Team_Scores[teamId] < 1)
|
||||
{
|
||||
m_Team_Scores[teamId]=0;
|
||||
m_Team_Scores[teamId] = 0;
|
||||
EndBattleground(GetOtherTeamId(teamId));
|
||||
}
|
||||
else if (!m_IsInformedNearVictory[teamId] && m_Team_Scores[teamId] < SEND_MSG_NEAR_LOSE)
|
||||
{
|
||||
SendMessageToAll(teamId == TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamId == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
SendMessageToAll(teamId == TEAM_HORDE ? LANG_BG_AV_H_NEAR_LOSE : LANG_BG_AV_A_NEAR_LOSE, teamId == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
|
||||
m_IsInformedNearVictory[teamId] = true;
|
||||
}
|
||||
|
|
@ -296,7 +297,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
|
|||
if (type >= AV_CPLACE_MAX) //static
|
||||
{
|
||||
type -= AV_CPLACE_MAX;
|
||||
cinfoid=uint16(BG_AV_StaticCreaturePos[type][4]);
|
||||
cinfoid = uint16(BG_AV_StaticCreaturePos[type][4]);
|
||||
creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid],
|
||||
type + AV_CPLACE_MAX,
|
||||
BG_AV_StaticCreaturePos[type][0],
|
||||
|
|
@ -320,12 +321,12 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
|
|||
creature->SetRespawnDelay(RESPAWN_ONE_DAY); // TODO: look if this can be done by database + also add this for the wingcommanders
|
||||
|
||||
if ((isStatic && cinfoid >= 10 && cinfoid <= 14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) ||
|
||||
(cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
|
||||
(cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
|
||||
{
|
||||
if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3)
|
||||
|| (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
|
||||
|| (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
|
||||
{
|
||||
CreatureData &data = sObjectMgr->NewOrExistCreatureData(creature->GetDBTableGUIDLow());
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetDBTableGUIDLow());
|
||||
data.wander_distance = 5;
|
||||
}
|
||||
//else wander_distance will be 15, so creatures move maximum=10
|
||||
|
|
@ -380,7 +381,7 @@ void BattlegroundAV::PostUpdateImpl(uint32 diff)
|
|||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
for (uint8 i=0; i <= 1; i++)//0=alliance, 1=horde
|
||||
for (uint8 i = 0; i <= 1; i++) //0=alliance, 1=horde
|
||||
{
|
||||
if (!m_CaptainAlive[i])
|
||||
continue;
|
||||
|
|
@ -402,12 +403,12 @@ void BattlegroundAV::PostUpdateImpl(uint32 diff)
|
|||
if (creature)
|
||||
YellToAll(creature, LANG_BG_AV_H_CAPTAIN_BUFF, LANG_ORCISH);
|
||||
}
|
||||
m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
|
||||
m_CaptainBuffTimer[i] = 120000 + urand(0, 4) * 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
|
||||
}
|
||||
}
|
||||
//add points from mine owning, and look if he neutral team wanrts to reclaim the mine
|
||||
m_Mine_Timer -=diff;
|
||||
for (uint8 mine=0; mine <2; mine++)
|
||||
m_Mine_Timer -= diff;
|
||||
for (uint8 mine = 0; mine < 2; mine++)
|
||||
{
|
||||
if (m_Mine_Owner[mine] == TEAM_ALLIANCE || m_Mine_Owner[mine] == TEAM_HORDE)
|
||||
{
|
||||
|
|
@ -416,13 +417,14 @@ void BattlegroundAV::PostUpdateImpl(uint32 diff)
|
|||
|
||||
if (m_Mine_Reclaim_Timer[mine] > diff)
|
||||
m_Mine_Reclaim_Timer[mine] -= diff;
|
||||
else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
|
||||
else //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
|
||||
{
|
||||
ChangeMineOwner(mine, TEAM_NEUTRAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Mine_Timer <= 0)
|
||||
m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
|
||||
m_Mine_Timer = AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
|
||||
|
||||
//looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
|
|
@ -431,7 +433,7 @@ void BattlegroundAV::PostUpdateImpl(uint32 diff)
|
|||
if (m_Nodes[i].Timer > diff)
|
||||
m_Nodes[i].Timer -= diff;
|
||||
else
|
||||
EventPlayerDestroyedPoint(i);
|
||||
EventPlayerDestroyedPoint(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -450,9 +452,9 @@ void BattlegroundAV::StartingEventOpenDoors()
|
|||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning mine stuff");
|
||||
#endif
|
||||
for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_N_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_N_MAX; i++)
|
||||
for (uint16 i = BG_AV_OBJECT_MINE_SUPPLY_N_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_N_MAX; i++)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_S_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_S_MAX; i++)
|
||||
for (uint16 i = BG_AV_OBJECT_MINE_SUPPLY_S_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_S_MAX; i++)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population
|
||||
ChangeMineOwner(mine, TEAM_NEUTRAL, true);
|
||||
|
|
@ -482,22 +484,22 @@ void BattlegroundAV::EndBattleground(TeamId winnerTeamId)
|
|||
uint8 rep[2] = {0, 0}; // 0 = Alliance 1 = Horde
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
||||
{
|
||||
if (m_Nodes[i].State == POINT_CONTROLED)
|
||||
if (m_Nodes[i].State == POINT_CONTROLED)
|
||||
{
|
||||
if (m_Nodes[i].OwnerId == TEAM_ALLIANCE)
|
||||
{
|
||||
if (m_Nodes[i].OwnerId == TEAM_ALLIANCE)
|
||||
{
|
||||
rep[0] += BG_AV_REP_SURVIVING_TOWER;
|
||||
kills[0] += BG_AV_KILL_SURVIVING_TOWER;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep[0] += BG_AV_KILL_SURVIVING_TOWER;
|
||||
kills[1] += BG_AV_KILL_SURVIVING_TOWER;
|
||||
}
|
||||
rep[0] += BG_AV_REP_SURVIVING_TOWER;
|
||||
kills[0] += BG_AV_KILL_SURVIVING_TOWER;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep[0] += BG_AV_KILL_SURVIVING_TOWER;
|
||||
kills[1] += BG_AV_KILL_SURVIVING_TOWER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId+1))
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId + 1))
|
||||
{
|
||||
if (m_CaptainAlive[iTeamId])
|
||||
{
|
||||
|
|
@ -610,38 +612,38 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
|||
TeamId ownerId = m_Nodes[node].OwnerId;
|
||||
if (IsTower(node))
|
||||
{
|
||||
uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH;
|
||||
uint8 tmp = node - BG_AV_NODES_DUNBALDAR_SOUTH;
|
||||
//despawn marshal
|
||||
if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
|
||||
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
|
||||
else
|
||||
sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
|
||||
//spawn destroyed aura
|
||||
for (uint8 i=0; i <= 9; i++)
|
||||
for (uint8 i = 0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
|
||||
|
||||
UpdateScore((ownerId == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE, -1 * BG_AV_RES_TOWER);
|
||||
RewardReputationToTeam(ownerId == TEAM_ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, ownerId);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), ownerId);
|
||||
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+ownerId+(2*tmp), RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+ownerId+(2*tmp), RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + ownerId + (2 * tmp), RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + ownerId + (2 * tmp), RESPAWN_ONE_DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ownerId == TEAM_ALLIANCE)
|
||||
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(object - 11, RESPAWN_IMMEDIATELY);
|
||||
else
|
||||
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+ownerId+3*node, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(object + 11, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + ownerId + 3 * node, RESPAWN_IMMEDIATELY);
|
||||
PopulateNode(node);
|
||||
if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
|
||||
{
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
SpawnBGObject(((ownerId == TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(((ownerId == TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(((ownerId == TEAM_ALLIANCE) ? BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH) + i, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(((ownerId == TEAM_ALLIANCE) ? BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H) + i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -650,7 +652,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
|||
if (IsTower(node))
|
||||
sprintf(buf, GetAcoreString(LANG_BG_AV_TOWER_TAKEN), GetNodeName(node), (ownerId == TEAM_ALLIANCE) ? GetAcoreString(LANG_BG_AV_ALLY) : GetAcoreString(LANG_BG_AV_HORDE));
|
||||
else
|
||||
sprintf(buf, GetAcoreString(LANG_BG_AV_GRAVE_TAKEN), GetNodeName(node), (ownerId == TEAM_ALLIANCE) ? GetAcoreString(LANG_BG_AV_ALLY) :GetAcoreString(LANG_BG_AV_HORDE));
|
||||
sprintf(buf, GetAcoreString(LANG_BG_AV_GRAVE_TAKEN), GetNodeName(node), (ownerId == TEAM_ALLIANCE) ? GetAcoreString(LANG_BG_AV_ALLY) : GetAcoreString(LANG_BG_AV_HORDE));
|
||||
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if (creature)
|
||||
|
|
@ -665,7 +667,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
|||
|
||||
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
|
||||
if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE) ? AV_SOUND_ALLIANCE_GOOD : AV_SOUND_HORDE_GOOD);
|
||||
|
||||
if (m_Mine_Owner[mine] == teamId && !initial)
|
||||
return;
|
||||
|
|
@ -677,10 +679,10 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
|||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av depopulating mine %i (0=north, 1=south)", mine);
|
||||
#endif
|
||||
if (mine == AV_SOUTH_MINE)
|
||||
for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
|
||||
for (uint16 i = AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
|
||||
if (BgCreatures[i])
|
||||
DelCreature(i); //TODO just set the respawntime to 999999
|
||||
for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++)
|
||||
for (uint16 i = ((mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_1_MIN : AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_3 : AV_CPLACE_MINE_S_3); i++)
|
||||
if (BgCreatures[i])
|
||||
DelCreature(i); //TODO here also
|
||||
}
|
||||
|
|
@ -709,7 +711,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
|||
miner = AV_NPC_S_MINE_H_1;
|
||||
else
|
||||
miner = AV_NPC_S_MINE_N_1;
|
||||
//vermin
|
||||
//vermin
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "spawning vermin");
|
||||
#endif
|
||||
|
|
@ -719,19 +721,19 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
|||
cinfo = AV_NPC_S_MINE_H_3;
|
||||
else
|
||||
cinfo = AV_NPC_S_MINE_N_S;
|
||||
for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
|
||||
for (uint16 i = AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
|
||||
AddAVCreature(cinfo, i);
|
||||
}
|
||||
for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MAX:AV_CPLACE_MINE_S_1_MAX); i++)
|
||||
for (uint16 i = ((mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_1_MIN : AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_1_MAX : AV_CPLACE_MINE_S_1_MAX); i++)
|
||||
AddAVCreature(miner, i);
|
||||
//the next chooses randomly between 2 cretures
|
||||
for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MIN:AV_CPLACE_MINE_S_2_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MAX:AV_CPLACE_MINE_S_2_MAX); i++)
|
||||
AddAVCreature(miner+(urand(1, 2)), i);
|
||||
AddAVCreature(miner+3, (mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3);
|
||||
for (uint16 i = ((mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_2_MIN : AV_CPLACE_MINE_S_2_MIN); i <= ((mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_2_MAX : AV_CPLACE_MINE_S_2_MAX); i++)
|
||||
AddAVCreature(miner + (urand(1, 2)), i);
|
||||
AddAVCreature(miner + 3, (mine == AV_NORTH_MINE) ? AV_CPLACE_MINE_N_3 : AV_CPLACE_MINE_S_3);
|
||||
|
||||
if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
|
||||
{
|
||||
m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER;
|
||||
m_Mine_Reclaim_Timer[mine] = AV_MINE_RECLAIM_TIMER;
|
||||
char buf[256];
|
||||
sprintf(buf, GetAcoreString(LANG_BG_AV_MINE_TAKEN), GetAcoreString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH),
|
||||
(teamId == TEAM_ALLIANCE) ? GetAcoreString(LANG_BG_AV_ALLY) : GetAcoreString(LANG_BG_AV_HORDE));
|
||||
|
|
@ -752,9 +754,9 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
|||
bool BattlegroundAV::PlayerCanDoMineQuest(int32 GOId, TeamId teamId)
|
||||
{
|
||||
if (GOId == BG_AV_OBJECTID_MINE_N)
|
||||
return (m_Mine_Owner[AV_NORTH_MINE] == teamId);
|
||||
return (m_Mine_Owner[AV_NORTH_MINE] == teamId);
|
||||
if (GOId == BG_AV_OBJECTID_MINE_S)
|
||||
return (m_Mine_Owner[AV_SOUTH_MINE] == teamId);
|
||||
return (m_Mine_Owner[AV_SOUTH_MINE] == teamId);
|
||||
return true; //cause it's no mine'object it is ok if this is true
|
||||
}
|
||||
|
||||
|
|
@ -765,37 +767,37 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
|
||||
uint32 creatureid;
|
||||
if (IsTower(node))
|
||||
creatureid=(ownerId == TEAM_ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
|
||||
creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_TOWERDEFENSE : AV_NPC_H_TOWERDEFENSE;
|
||||
else
|
||||
{
|
||||
if (m_Team_QuestStatus[ownerId][0] < 500)
|
||||
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
|
||||
creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
|
||||
else if (m_Team_QuestStatus[ownerId][0] < 1000)
|
||||
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
|
||||
creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
|
||||
else if (m_Team_QuestStatus[ownerId][0] < 1500)
|
||||
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
|
||||
creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
|
||||
else
|
||||
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
|
||||
creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
|
||||
//spiritguide
|
||||
if (BgCreatures[node])
|
||||
DelCreature(node);
|
||||
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], ownerId))
|
||||
sLog->outError("AV: couldn't spawn spiritguide at node %i", node);
|
||||
}
|
||||
for (uint8 i=0; i<4; i++)
|
||||
AddAVCreature(creatureid, c_place+i);
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
AddAVCreature(creatureid, c_place + i);
|
||||
|
||||
if (node >= BG_AV_NODES_MAX)//fail safe
|
||||
return;
|
||||
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[node + 302]);//0-302 other creatures
|
||||
if (!trigger)
|
||||
{
|
||||
trigger = AddCreature(WORLD_TRIGGER,
|
||||
node + 302,
|
||||
BG_AV_CreaturePos[node + 302][0],
|
||||
BG_AV_CreaturePos[node + 302][1],
|
||||
BG_AV_CreaturePos[node + 302][2],
|
||||
BG_AV_CreaturePos[node + 302][3]);
|
||||
trigger = AddCreature(WORLD_TRIGGER,
|
||||
node + 302,
|
||||
BG_AV_CreaturePos[node + 302][0],
|
||||
BG_AV_CreaturePos[node + 302][1],
|
||||
BG_AV_CreaturePos[node + 302][2],
|
||||
BG_AV_CreaturePos[node + 302][3]);
|
||||
}
|
||||
|
||||
//add bonus honor aura trigger creature when node is accupied
|
||||
|
|
@ -815,9 +817,9 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
|
||||
{
|
||||
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
|
||||
for (uint8 i=0; i<4; i++)
|
||||
if (BgCreatures[c_place+i])
|
||||
DelCreature(c_place+i);
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
if (BgCreatures[c_place + i])
|
||||
DelCreature(c_place + i);
|
||||
//spiritguide
|
||||
if (!IsTower(node) && BgCreatures[node])
|
||||
DelCreature(node);
|
||||
|
|
@ -839,7 +841,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
|
|||
if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER)
|
||||
return BG_AV_Nodes(object - 7);
|
||||
if (object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER)
|
||||
return BG_AV_Nodes(object -22);
|
||||
return BG_AV_Nodes(object - 22);
|
||||
if (object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
|
||||
return BG_AV_Nodes(object - 33);
|
||||
if (object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER)
|
||||
|
|
@ -852,7 +854,8 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
|
|||
}
|
||||
|
||||
uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
||||
{ //this function is the counterpart to GetNodeThroughObject()
|
||||
{
|
||||
//this function is the counterpart to GetNodeThroughObject()
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_AV GetObjectThroughNode %i", node);
|
||||
#endif
|
||||
|
|
@ -861,9 +864,9 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
|||
if (m_Nodes[node].State == POINT_ASSAULTED)
|
||||
{
|
||||
if (node <= BG_AV_NODES_FROSTWOLF_HUT)
|
||||
return node+11;
|
||||
return node + 11;
|
||||
if (node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
|
||||
return node+7;
|
||||
return node + 7;
|
||||
}
|
||||
else if (m_Nodes[node].State == POINT_CONTROLED)
|
||||
if (node <= BG_AV_NODES_STONEHEART_BUNKER)
|
||||
|
|
@ -874,14 +877,14 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
|||
if (m_Nodes[node].State == POINT_ASSAULTED)
|
||||
{
|
||||
if (node <= BG_AV_NODES_STONEHEART_BUNKER)
|
||||
return node+22;
|
||||
return node + 22;
|
||||
}
|
||||
else if (m_Nodes[node].State == POINT_CONTROLED)
|
||||
{
|
||||
if (node <= BG_AV_NODES_FROSTWOLF_HUT)
|
||||
return node+33;
|
||||
return node + 33;
|
||||
if (node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
|
||||
return node+29;
|
||||
return node + 29;
|
||||
}
|
||||
}
|
||||
else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL)
|
||||
|
|
@ -931,7 +934,8 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
|||
if (ownerId == player->GetTeamId() || m_Nodes[node].State != POINT_ASSAULTED)
|
||||
return;
|
||||
if (m_Nodes[node].TotalOwnerId == TEAM_NEUTRAL)
|
||||
{ //until snowfall doesn't belong to anyone it is better handled in assault-code
|
||||
{
|
||||
//until snowfall doesn't belong to anyone it is better handled in assault-code
|
||||
ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
|
||||
EventPlayerAssaultsPoint(player, object);
|
||||
return;
|
||||
|
|
@ -945,18 +949,18 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
|||
return;
|
||||
}
|
||||
|
||||
//spawn new go :)
|
||||
//spawn new go :)
|
||||
if (m_Nodes[node].OwnerId == TEAM_ALLIANCE)
|
||||
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner
|
||||
SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY); //spawn horde banner
|
||||
else
|
||||
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner
|
||||
SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY); //spawn alliance banner
|
||||
|
||||
if (!IsTower(node))
|
||||
{
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+teamId+3*node, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + teamId + 3 * node, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
// despawn old go
|
||||
// despawn old go
|
||||
SpawnBGObject(object, RESPAWN_ONE_DAY);
|
||||
|
||||
DefendNode(node, teamId);
|
||||
|
|
@ -966,17 +970,17 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
|||
if (IsTower(node))
|
||||
{
|
||||
//spawn big flag+aura on top of tower
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
}
|
||||
else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
|
||||
{
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
SpawnBGObject(((ownerId == TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(((teamId == TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(((ownerId == TEAM_ALLIANCE) ? BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH) + i, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(((teamId == TEAM_ALLIANCE) ? BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H) + i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
}
|
||||
//send a nice message to all :)
|
||||
|
|
@ -990,7 +994,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
|||
if (IsTower(node))
|
||||
PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND);
|
||||
else
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE) ? AV_SOUND_ALLIANCE_GOOD : AV_SOUND_HORDE_GOOD);
|
||||
}
|
||||
|
||||
void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
|
|
@ -1017,7 +1021,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
|||
SpawnBGObject(BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
|
||||
else
|
||||
SpawnBGObject(BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_IMMEDIATELY); //neutral aura spawn
|
||||
}
|
||||
else if (m_Nodes[node].TotalOwnerId == TEAM_NEUTRAL) //recapping, when no team owns this node realy
|
||||
{
|
||||
|
|
@ -1025,26 +1029,26 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
|||
return;
|
||||
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(object - 11, RESPAWN_IMMEDIATELY);
|
||||
else
|
||||
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(object + 11, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
//eyecandy
|
||||
uint32 spawn, despawn;
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H;
|
||||
despawn = (m_Nodes[node].State == POINT_ASSAULTED) ? BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H;
|
||||
spawn = BG_AV_OBJECT_SNOW_EYECANDY_PA;
|
||||
}
|
||||
else
|
||||
{
|
||||
despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_A;
|
||||
despawn = (m_Nodes[node].State == POINT_ASSAULTED) ? BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_A;
|
||||
spawn = BG_AV_OBJECT_SNOW_EYECANDY_PH;
|
||||
}
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
SpawnBGObject(despawn+i, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(spawn+i, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(despawn + i, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(spawn + i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1056,21 +1060,22 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
|||
{
|
||||
ASSERT(prevOwnerId != TEAM_NEUTRAL);
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY);
|
||||
else
|
||||
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY);
|
||||
if (IsTower(node))
|
||||
{ //spawning/despawning of bigflag+aura
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
{
|
||||
//spawning/despawning of bigflag+aura
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_ALLIANCE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (node - BG_AV_NODES_DUNBALDAR_SOUTH)), (teamId == TEAM_HORDE) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
//spawning/despawning of aura
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+prevOwnerId+3*node, RESPAWN_ONE_DAY); //teeamaura despawn
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_IMMEDIATELY); //neutral aura spawn
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + prevOwnerId + 3 * node, RESPAWN_ONE_DAY); //teeamaura despawn
|
||||
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
}
|
||||
|
|
@ -1089,7 +1094,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
|||
YellToAll(creature, buf, LANG_UNIVERSAL);
|
||||
//update the statistic for the assaulting player
|
||||
UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS);
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE) ? AV_SOUND_ALLIANCE_ASSAULTS : AV_SOUND_HORDE_ASSAULTS);
|
||||
}
|
||||
|
||||
void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
|
||||
|
|
@ -1098,27 +1103,30 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
|
|||
//graveyards
|
||||
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; i++)
|
||||
{
|
||||
for (uint8 j =1; j <= 3; j+=2)
|
||||
{//j=1=assaulted j=3=controled
|
||||
for (uint8 j = 1; j <= 3; j += 2)
|
||||
{
|
||||
//j=1=assaulted j=3=controled
|
||||
stateok = (m_Nodes[i].State == j);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok)?1:0);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok)?1:0);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
//towers
|
||||
for (uint8 i = BG_AV_NODES_DUNBALDAR_SOUTH; i < BG_AV_NODES_MAX; ++i)
|
||||
for (uint8 j =1; j <= 3; j+=2)
|
||||
{//j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll
|
||||
for (uint8 j = 1; j <= 3; j += 2)
|
||||
{
|
||||
//j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll
|
||||
stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3));
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok)?1:0);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok)?1:0);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0);
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0);
|
||||
}
|
||||
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].OwnerId == TEAM_NEUTRAL) //cause neutral teams aren't handled generic
|
||||
data << uint32(AV_SNOWFALL_N) << uint32(1);
|
||||
data << uint32(AV_Alliance_Score) << uint32(m_Team_Scores[0]);
|
||||
data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]);
|
||||
if (GetStatus() == STATUS_IN_PROGRESS){ //only if game started the teamscores are displayed
|
||||
if (GetStatus() == STATUS_IN_PROGRESS) //only if game started the teamscores are displayed
|
||||
{
|
||||
data << uint32(AV_SHOW_A_SCORE) << uint32(1);
|
||||
data << uint32(AV_SHOW_H_SCORE) << uint32(1);
|
||||
}
|
||||
|
|
@ -1189,8 +1197,8 @@ GraveyardStruct const* BattlegroundAV::GetClosestGraveyard(Player* player)
|
|||
|
||||
player->GetPosition(x, y);
|
||||
|
||||
GraveyardStruct const* pGraveyard = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[player->GetTeamId()+7]);
|
||||
minDist = (pGraveyard->x - x)*(pGraveyard->x - x)+(pGraveyard->y - y)*(pGraveyard->y - y);
|
||||
GraveyardStruct const* pGraveyard = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[player->GetTeamId() + 7]);
|
||||
minDist = (pGraveyard->x - x) * (pGraveyard->x - x) + (pGraveyard->y - y) * (pGraveyard->y - y);
|
||||
|
||||
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||
if (m_Nodes[i].OwnerId == player->GetTeamId() && m_Nodes[i].State == POINT_CONTROLED)
|
||||
|
|
@ -1198,7 +1206,7 @@ GraveyardStruct const* BattlegroundAV::GetClosestGraveyard(Player* player)
|
|||
entry = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[i]);
|
||||
if (entry)
|
||||
{
|
||||
dist = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y);
|
||||
dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
|
|
@ -1218,14 +1226,14 @@ bool BattlegroundAV::SetupBattleground()
|
|||
{
|
||||
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
|
||||
{
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
//aura
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
//aura
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!2");
|
||||
return false;
|
||||
|
|
@ -1235,12 +1243,12 @@ bool BattlegroundAV::SetupBattleground()
|
|||
{
|
||||
if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
|
||||
{
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!3");
|
||||
return false;
|
||||
|
|
@ -1248,20 +1256,20 @@ bool BattlegroundAV::SetupBattleground()
|
|||
}
|
||||
else //horde towers
|
||||
{
|
||||
if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i + 7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!4");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint8 j=0; j <= 9; j++) //burning aura
|
||||
for (uint8 j = 0; j <= 9; j++) //burning aura
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
|
||||
return false;
|
||||
|
|
@ -1269,13 +1277,13 @@ bool BattlegroundAV::SetupBattleground()
|
|||
}
|
||||
}
|
||||
}
|
||||
for (uint8 i=0; i<2; i++) //burning aura for buildings
|
||||
for (uint8 i = 0; i < 2; i++) //burning aura for buildings
|
||||
{
|
||||
for (uint8 j=0; j <= 9; j++)
|
||||
for (uint8 j = 0; j <= 9; j++)
|
||||
{
|
||||
if (j<5)
|
||||
if (j < 5)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
|
||||
return false;
|
||||
|
|
@ -1283,7 +1291,7 @@ bool BattlegroundAV::SetupBattleground()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
|
||||
return false;
|
||||
|
|
@ -1291,34 +1299,34 @@ bool BattlegroundAV::SetupBattleground()
|
|||
}
|
||||
}
|
||||
}
|
||||
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
|
||||
for (uint16 i = 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX - BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN + i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
|
||||
for (uint16 i = 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX - BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN + i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
}
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A + i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H + i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
|
||||
return false;
|
||||
|
|
@ -1327,19 +1335,19 @@ bool BattlegroundAV::SetupBattleground()
|
|||
|
||||
// Handpacked snowdrift, only during holiday
|
||||
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
|
||||
for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
|
||||
for (uint16 i = 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX - BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN + i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Quest banners
|
||||
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
}
|
||||
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
|
|
@ -1355,7 +1363,7 @@ bool BattlegroundAV::SetupBattleground()
|
|||
|
||||
for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE; i++)
|
||||
{
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+3*i, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + 3 * i, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
|
|
@ -1366,19 +1374,19 @@ bool BattlegroundAV::SetupBattleground()
|
|||
{
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
if (i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i), RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION + 3 * GetNodeThroughObject(i), RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2)
|
||||
for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i += 2)
|
||||
{
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag
|
||||
SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
|
||||
SpawnBGObject(i + 16, RESPAWN_IMMEDIATELY); //aura
|
||||
}
|
||||
|
||||
for (i = BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER; i <= BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER; i+=2)
|
||||
for (i = BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER; i <= BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER; i += 2)
|
||||
{
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag
|
||||
SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
|
||||
SpawnBGObject(i + 16, RESPAWN_IMMEDIATELY); //aura
|
||||
}
|
||||
|
||||
//snowfall and the doors
|
||||
|
|
@ -1425,9 +1433,9 @@ bool BattlegroundAV::SetupBattleground()
|
|||
|
||||
if (
|
||||
// alliance gates
|
||||
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3]/2), cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
|
||||
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3] / 2), cos(BG_AV_DoorPositons[0][3] / 2), RESPAWN_IMMEDIATELY)
|
||||
// horde gates
|
||||
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
|
||||
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3] / 2), cos(BG_AV_DoorPositons[1][3] / 2), RESPAWN_IMMEDIATELY))
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundAV: Failed to spawn some object Battleground not created!1");
|
||||
return false;
|
||||
|
|
@ -1440,21 +1448,36 @@ char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
|
|||
{
|
||||
switch (node)
|
||||
{
|
||||
case BG_AV_NODES_FIRSTAID_STATION: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_STORM_AID);
|
||||
case BG_AV_NODES_DUNBALDAR_SOUTH: return GetAcoreString(LANG_BG_AV_NODE_TOWER_DUN_S);
|
||||
case BG_AV_NODES_DUNBALDAR_NORTH: return GetAcoreString(LANG_BG_AV_NODE_TOWER_DUN_N);
|
||||
case BG_AV_NODES_STORMPIKE_GRAVE: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_STORMPIKE);
|
||||
case BG_AV_NODES_ICEWING_BUNKER: return GetAcoreString(LANG_BG_AV_NODE_TOWER_ICEWING);
|
||||
case BG_AV_NODES_STONEHEART_GRAVE: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_STONE);
|
||||
case BG_AV_NODES_STONEHEART_BUNKER: return GetAcoreString(LANG_BG_AV_NODE_TOWER_STONE);
|
||||
case BG_AV_NODES_SNOWFALL_GRAVE: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_SNOW);
|
||||
case BG_AV_NODES_ICEBLOOD_TOWER: return GetAcoreString(LANG_BG_AV_NODE_TOWER_ICE);
|
||||
case BG_AV_NODES_ICEBLOOD_GRAVE: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_ICE);
|
||||
case BG_AV_NODES_TOWER_POINT: return GetAcoreString(LANG_BG_AV_NODE_TOWER_POINT);
|
||||
case BG_AV_NODES_FROSTWOLF_GRAVE: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_FROST);
|
||||
case BG_AV_NODES_FROSTWOLF_ETOWER: return GetAcoreString(LANG_BG_AV_NODE_TOWER_FROST_E);
|
||||
case BG_AV_NODES_FROSTWOLF_WTOWER: return GetAcoreString(LANG_BG_AV_NODE_TOWER_FROST_W);
|
||||
case BG_AV_NODES_FROSTWOLF_HUT: return GetAcoreString(LANG_BG_AV_NODE_GRAVE_FROST_HUT);
|
||||
case BG_AV_NODES_FIRSTAID_STATION:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_STORM_AID);
|
||||
case BG_AV_NODES_DUNBALDAR_SOUTH:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_DUN_S);
|
||||
case BG_AV_NODES_DUNBALDAR_NORTH:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_DUN_N);
|
||||
case BG_AV_NODES_STORMPIKE_GRAVE:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_STORMPIKE);
|
||||
case BG_AV_NODES_ICEWING_BUNKER:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_ICEWING);
|
||||
case BG_AV_NODES_STONEHEART_GRAVE:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_STONE);
|
||||
case BG_AV_NODES_STONEHEART_BUNKER:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_STONE);
|
||||
case BG_AV_NODES_SNOWFALL_GRAVE:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_SNOW);
|
||||
case BG_AV_NODES_ICEBLOOD_TOWER:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_ICE);
|
||||
case BG_AV_NODES_ICEBLOOD_GRAVE:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_ICE);
|
||||
case BG_AV_NODES_TOWER_POINT:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_POINT);
|
||||
case BG_AV_NODES_FROSTWOLF_GRAVE:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_FROST);
|
||||
case BG_AV_NODES_FROSTWOLF_ETOWER:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_FROST_E);
|
||||
case BG_AV_NODES_FROSTWOLF_WTOWER:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_TOWER_FROST_W);
|
||||
case BG_AV_NODES_FROSTWOLF_HUT:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_FROST_HUT);
|
||||
default:
|
||||
sLog->outError("tried to get name for node %u", node);
|
||||
break;
|
||||
|
|
@ -1486,8 +1509,8 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, TeamId teamId)
|
|||
ABORT();
|
||||
}
|
||||
//the timer gets another time, if the previous owner was 0 == Neutral
|
||||
m_Nodes[node].Timer = (m_Nodes[node].PrevOwnerId != TEAM_NEUTRAL)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
|
||||
m_Nodes[node].PrevOwnerId= m_Nodes[node].OwnerId;
|
||||
m_Nodes[node].Timer = (m_Nodes[node].PrevOwnerId != TEAM_NEUTRAL) ? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
|
||||
m_Nodes[node].PrevOwnerId = m_Nodes[node].OwnerId;
|
||||
m_Nodes[node].OwnerId = teamId;
|
||||
m_Nodes[node].PrevState = m_Nodes[node].State;
|
||||
m_Nodes[node].State = POINT_ASSAULTED;
|
||||
|
|
@ -1500,7 +1523,7 @@ void BattlegroundAV::DestroyNode(BG_AV_Nodes node)
|
|||
m_Nodes[node].TotalOwnerId = m_Nodes[node].OwnerId;
|
||||
m_Nodes[node].PrevOwnerId = m_Nodes[node].OwnerId;
|
||||
m_Nodes[node].PrevState = m_Nodes[node].State;
|
||||
m_Nodes[node].State = (m_Nodes[node].Tower)? POINT_DESTROYED : POINT_CONTROLED;
|
||||
m_Nodes[node].State = (m_Nodes[node].Tower) ? POINT_DESTROYED : POINT_CONTROLED;
|
||||
m_Nodes[node].Timer = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1520,7 +1543,7 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, TeamId teamId)
|
|||
ASSERT(m_Nodes[node].TotalOwnerId == teamId);
|
||||
ASSERT(m_Nodes[node].OwnerId != teamId);
|
||||
ASSERT(m_Nodes[node].State != POINT_CONTROLED && m_Nodes[node].State != POINT_DESTROYED);
|
||||
m_Nodes[node].PrevOwnerId= m_Nodes[node].OwnerId;
|
||||
m_Nodes[node].PrevOwnerId = m_Nodes[node].OwnerId;
|
||||
m_Nodes[node].OwnerId = teamId;
|
||||
m_Nodes[node].PrevState = m_Nodes[node].State;
|
||||
m_Nodes[node].State = POINT_CONTROLED;
|
||||
|
|
@ -1529,14 +1552,14 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, TeamId teamId)
|
|||
|
||||
void BattlegroundAV::ResetBGSubclass()
|
||||
{
|
||||
for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
|
||||
for (uint8 i = 0; i < 2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
|
||||
{
|
||||
for (uint8 j=0; j<9; j++)
|
||||
m_Team_QuestStatus[i][j]=0;
|
||||
m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS;
|
||||
m_IsInformedNearVictory[i]=false;
|
||||
for (uint8 j = 0; j < 9; j++)
|
||||
m_Team_QuestStatus[i][j] = 0;
|
||||
m_Team_Scores[i] = BG_AV_SCORE_INITIAL_POINTS;
|
||||
m_IsInformedNearVictory[i] = false;
|
||||
m_CaptainAlive[i] = true;
|
||||
m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
|
||||
m_CaptainBuffTimer[i] = 120000 + urand(0, 4) * 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
|
||||
m_Mine_Owner[i] = TEAM_NEUTRAL;
|
||||
}
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
|
||||
|
|
@ -1549,8 +1572,8 @@ void BattlegroundAV::ResetBGSubclass()
|
|||
InitNode(i, TEAM_HORDE, true);
|
||||
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, TEAM_NEUTRAL, false); //give snowfall neutral owner
|
||||
|
||||
m_Mine_Timer=AV_MINE_TICK_TIMER;
|
||||
for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
|
||||
m_Mine_Timer = AV_MINE_TICK_TIMER;
|
||||
for (uint16 i = 0; i < AV_CPLACE_MAX + AV_STATICCPLACE_MAX; i++)
|
||||
if (BgCreatures[i])
|
||||
DelCreature(i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,38 +41,39 @@
|
|||
#define AV_EVENT_START_BATTLE 9166 // Achievement: The Alterac Blitz
|
||||
|
||||
enum BG_AV_Sounds
|
||||
{ //TODO: get out if there comes a sound when neutral team captures mine
|
||||
{
|
||||
//TODO: get out if there comes a sound when neutral team captures mine
|
||||
|
||||
/*
|
||||
8212:
|
||||
alliance grave assault
|
||||
alliance tower assault
|
||||
drek "mlanzenabschaum! In meiner Burg?! Toetet sie all" - nicht immer der sound
|
||||
8333:
|
||||
galv "sterbt fuer euch ist kein platz hier"
|
||||
/*
|
||||
8212:
|
||||
alliance grave assault
|
||||
alliance tower assault
|
||||
drek "mlanzenabschaum! In meiner Burg?! Toetet sie all" - nicht immer der sound
|
||||
8333:
|
||||
galv "sterbt fuer euch ist kein platz hier"
|
||||
|
||||
8332:
|
||||
bal "Verschwinde, dreckiger Abschaum! Die Allianz wird im Alteractal "
|
||||
8174:
|
||||
horde tower assault
|
||||
horde grave assault
|
||||
van "es Sturmlanzenklans, euer General wird angegriffen! Ich fordere Unterst"
|
||||
8173:
|
||||
ally grave capture/defend
|
||||
tower destroy
|
||||
mine capture
|
||||
ally wins
|
||||
8192:
|
||||
ally tower destroy(only iceblood - found a bug^^)
|
||||
ally tower defend
|
||||
horde tower defend
|
||||
8213
|
||||
horde:
|
||||
grave defend/capture
|
||||
tower destroy
|
||||
mine capture
|
||||
horde wins
|
||||
*/
|
||||
8332:
|
||||
bal "Verschwinde, dreckiger Abschaum! Die Allianz wird im Alteractal "
|
||||
8174:
|
||||
horde tower assault
|
||||
horde grave assault
|
||||
van "es Sturmlanzenklans, euer General wird angegriffen! Ich fordere Unterst"
|
||||
8173:
|
||||
ally grave capture/defend
|
||||
tower destroy
|
||||
mine capture
|
||||
ally wins
|
||||
8192:
|
||||
ally tower destroy(only iceblood - found a bug^^)
|
||||
ally tower defend
|
||||
horde tower defend
|
||||
8213
|
||||
horde:
|
||||
grave defend/capture
|
||||
tower destroy
|
||||
mine capture
|
||||
horde wins
|
||||
*/
|
||||
|
||||
AV_SOUND_NEAR_VICTORY = 8456, //not confirmed yet
|
||||
|
||||
|
|
@ -223,7 +224,7 @@ enum BG_AV_ObjectTypes
|
|||
|
||||
BG_AV_OBJECT_DOOR_H = 45,
|
||||
BG_AV_OBJECT_DOOR_A = 46,
|
||||
//auras for graveyards (3auras per graveyard neutral, alliance, horde)
|
||||
//auras for graveyards (3auras per graveyard neutral, alliance, horde)
|
||||
BG_AV_OBJECT_AURA_N_FIRSTAID_STATION = 47,
|
||||
BG_AV_OBJECT_AURA_A_FIRSTAID_STATION = 48,
|
||||
BG_AV_OBJECT_AURA_H_FIRSTAID_STATION = 49,
|
||||
|
|
@ -486,7 +487,7 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] =
|
|||
{-62.9474f, -286.212f, 66.7288f, 0},
|
||||
{-5.05132f, -325.323f, 38.8536f, 0},
|
||||
{-64.2677f, -289.412f, 33.469f, 0},
|
||||
//horde
|
||||
//horde
|
||||
{-524.276f, -199.6f, 82.8733f, -1.46608f},
|
||||
{-518.196f, -173.085f, 102.43f, 0},
|
||||
{-500.732f, -145.358f, 88.5337f, 2.44346f},
|
||||
|
|
@ -498,7 +499,7 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] =
|
|||
{-501.775f, -151.581f, 81.2027f, 0},
|
||||
{-509.975f, -191.652f, 83.2978f, 0},
|
||||
|
||||
//snowfall eyecandy
|
||||
//snowfall eyecandy
|
||||
{-191.153f, -129.868f, 78.5595f, -1.25664f },
|
||||
{-201.282f, -134.319f, 78.6753f, -0.942478f },
|
||||
{-215.981f, -91.4101f, 80.8702f, -1.74533f },
|
||||
|
|
@ -562,7 +563,7 @@ enum BG_AV_CreaturePlace
|
|||
AV_CPLACE_SPIRIT_FROST_HUT = 6,
|
||||
AV_CPLACE_SPIRIT_MAIN_ALLIANCE = 7,
|
||||
AV_CPLACE_SPIRIT_MAIN_HORDE = 8,
|
||||
//i don't will add for all 4 positions a variable.. i think one is enough to compute the rest
|
||||
//i don't will add for all 4 positions a variable.. i think one is enough to compute the rest
|
||||
AV_CPLACE_DEFENSE_STORM_AID = 9,
|
||||
AV_CPLACE_DEFEMSE_STORM_GRAVE = 13,
|
||||
AV_CPLACE_DEFENSE_STONE_GRAVE = 17,
|
||||
|
|
@ -652,44 +653,44 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] =
|
|||
{-1496.065063f, -333.338409f, 101.134804f, -0.001854f},
|
||||
{873.001770f, -491.283630f, 96.541931f, -0.001854f},
|
||||
{-1437.670044f, -610.088989f, 51.161900f, -0.001854f},
|
||||
//grave
|
||||
//firstaid
|
||||
//grave
|
||||
//firstaid
|
||||
{635.17f, -29.5594f, 46.5056f, 4.81711f},
|
||||
{642.488f, -32.9437f, 46.365f, 4.67748f},
|
||||
{642.326f, -27.9442f, 46.9211f, 4.59022f},
|
||||
{635.945f, -33.6171f, 45.7164f, 4.97419f},
|
||||
//stormpike
|
||||
//stormpike
|
||||
{669.272f, -297.304f, 30.291f, 4.66604f},
|
||||
{674.08f, -292.328f, 30.4817f, 0.0918785f},
|
||||
{667.01f, -288.532f, 29.8809f, 1.81583f},
|
||||
{664.153f, -294.042f, 30.2851f, 3.28531f},
|
||||
//stone
|
||||
//stone
|
||||
{81.7027f, -406.135f, 47.7843f, 0.598464f},
|
||||
{78.1431f, -409.215f, 48.0401f, 5.05953f},
|
||||
{73.4135f, -407.035f, 46.7527f, 3.34736f},
|
||||
{78.2258f, -401.859f, 46.4202f, 2.05852f},
|
||||
//snowfall
|
||||
//snowfall
|
||||
{-207.412f, -110.616f, 78.7959f, 2.43251f},
|
||||
{-197.95f, -112.205f, 78.5686f, 6.22441f},
|
||||
{-202.709f, -116.829f, 78.4358f, 5.13742f},
|
||||
{-202.059f, -108.314f, 78.5783f, 5.91968f},
|
||||
//ice
|
||||
//ice
|
||||
{-615.501f, -393.802f, 60.4299f, 3.06147f},
|
||||
{-608.513f, -392.717f, 62.5724f, 2.06323f},
|
||||
{-609.769f, -400.072f, 60.7174f, 5.22367f},
|
||||
{-616.093f, -398.293f, 60.5628f, 3.73613f},
|
||||
//frost
|
||||
//frost
|
||||
{-1077.7f, -340.21f, 55.4682f, 6.25569f},
|
||||
{-1082.74f, -333.821f, 54.7962f, 2.05459f},
|
||||
{-1090.66f, -341.267f, 54.6768f, 3.27746f},
|
||||
{-1081.58f, -344.63f, 55.256f, 4.75636f},
|
||||
//frost hut
|
||||
//frost hut
|
||||
{-1408.95f, -311.69f, 89.2536f, 4.49954f},
|
||||
{-1407.15f, -305.323f, 89.1993f, 2.86827f},
|
||||
{-1400.64f, -304.3f, 89.7008f, 1.0595f},
|
||||
{-1400.4f, -311.35f, 89.3028f, 4.99434f},
|
||||
//towers
|
||||
//dun south - OK
|
||||
//towers
|
||||
//dun south - OK
|
||||
{569.395f, -101.064f, 52.8296f, 2.34974f},
|
||||
{574.85f, -92.9842f, 52.5869f, 3.09325f},
|
||||
{575.411f, -83.597f, 52.3626f, 6.26573f},
|
||||
|
|
@ -735,14 +736,14 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] =
|
|||
{723.058f, -14.1548f, 50.7046f, 3.40339f}, // north
|
||||
{715.691f, -4.72233f, 50.2187f, 3.47321f}, // icewing
|
||||
{720.046f, -19.9413f, 50.2187f, 3.36849f}, // stone
|
||||
//horde (coords not 100% ok)
|
||||
//horde (coords not 100% ok)
|
||||
{-1363.99f, -221.99f, 98.4053f, 4.93012f},
|
||||
{-1370.96f, -223.532f, 98.4266f, 4.93012f},
|
||||
{-1378.37f, -228.614f, 99.3546f, 5.38565f},
|
||||
{-1358.02f, -228.998f, 98.868f, 3.87768f},
|
||||
|
||||
//irondeep mine
|
||||
//Irondeep Trogg
|
||||
//irondeep mine
|
||||
//Irondeep Trogg
|
||||
{971.671f, -442.657f, 57.6951f, 3.1765f},
|
||||
{969.979f, -457.148f, 58.1119f, 4.5204f},
|
||||
{958.692f, -333.477f, 63.2276f, 5.77704f},
|
||||
|
|
@ -1024,7 +1025,7 @@ enum BG_AV_CreatureIds
|
|||
AV_NPC_H_MARSHAL_ICE = 18,
|
||||
AV_NPC_H_MARSHAL_TOWER = 19,
|
||||
AV_NPC_MARSHAL_ETOWER = 20,
|
||||
AV_NPC_H_MARSHAL_WTOWER= 21,
|
||||
AV_NPC_H_MARSHAL_WTOWER = 21,
|
||||
AV_NPC_N_MINE_N_1 = 22,
|
||||
AV_NPC_N_MINE_N_2 = 23,
|
||||
AV_NPC_N_MINE_N_3 = 24,
|
||||
|
|
@ -1312,7 +1313,7 @@ enum BG_AV_Graveyards
|
|||
AV_GRAVE_MAIN_HORDE = 610
|
||||
};
|
||||
|
||||
const uint32 BG_AV_GraveyardIds[9]=
|
||||
const uint32 BG_AV_GraveyardIds[9] =
|
||||
{
|
||||
AV_GRAVE_STORM_AID,
|
||||
AV_GRAVE_STORM_GRAVE,
|
||||
|
|
@ -1326,7 +1327,8 @@ const uint32 BG_AV_GraveyardIds[9]=
|
|||
};
|
||||
|
||||
enum BG_AV_BUFF
|
||||
{ //TODO add all other buffs here
|
||||
{
|
||||
//TODO add all other buffs here
|
||||
AV_BUFF_ARMOR = 21163,
|
||||
AV_BUFF_A_CAPTAIN = 23693, //the buff which the alliance captain does
|
||||
AV_BUFF_H_CAPTAIN = 22751 //the buff which the horde captain does
|
||||
|
|
@ -1346,110 +1348,110 @@ enum BG_AV_WorldStates
|
|||
AV_SHOW_H_SCORE = 3133,
|
||||
AV_SHOW_A_SCORE = 3134,
|
||||
|
||||
/*
|
||||
//the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (:)
|
||||
/*
|
||||
//the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (:)
|
||||
|
||||
// Graves
|
||||
// Graves
|
||||
|
||||
// Alliance
|
||||
//Stormpike first aid station
|
||||
AV_AID_A_C = 1325,
|
||||
AV_AID_A_A = 1326,
|
||||
AV_AID_H_C = 1327,
|
||||
AV_AID_H_A = 1328,
|
||||
//Stormpike Graveyard
|
||||
AV_PIKEGRAVE_A_C = 1333,
|
||||
AV_PIKEGRAVE_A_A = 1335,
|
||||
AV_PIKEGRAVE_H_C = 1334,
|
||||
AV_PIKEGRAVE_H_A = 1336,
|
||||
//Stoneheart Grave
|
||||
AV_STONEHEART_A_C = 1302,
|
||||
AV_STONEHEART_A_A = 1304, //over hc
|
||||
AV_STONEHEART_H_C = 1301, //over ac
|
||||
AV_STONEHEART_H_A = 1303, //over aa
|
||||
//Neutral
|
||||
//Snowfall Grave
|
||||
*/
|
||||
// Alliance
|
||||
//Stormpike first aid station
|
||||
AV_AID_A_C = 1325,
|
||||
AV_AID_A_A = 1326,
|
||||
AV_AID_H_C = 1327,
|
||||
AV_AID_H_A = 1328,
|
||||
//Stormpike Graveyard
|
||||
AV_PIKEGRAVE_A_C = 1333,
|
||||
AV_PIKEGRAVE_A_A = 1335,
|
||||
AV_PIKEGRAVE_H_C = 1334,
|
||||
AV_PIKEGRAVE_H_A = 1336,
|
||||
//Stoneheart Grave
|
||||
AV_STONEHEART_A_C = 1302,
|
||||
AV_STONEHEART_A_A = 1304, //over hc
|
||||
AV_STONEHEART_H_C = 1301, //over ac
|
||||
AV_STONEHEART_H_A = 1303, //over aa
|
||||
//Neutral
|
||||
//Snowfall Grave
|
||||
*/
|
||||
AV_SNOWFALL_N = 1966, //over aa
|
||||
/*
|
||||
AV_SNOWFALL_A_C = 1341, //over hc
|
||||
AV_SNOWFALL_A_A = 1343, //over ha
|
||||
AV_SNOWFALL_H_C = 1342,
|
||||
AV_SNOWFALL_H_A = 1344, //over ac
|
||||
//Horde
|
||||
//Iceblood grave
|
||||
AV_ICEBLOOD_A_C = 1346, //over hc
|
||||
AV_ICEBLOOD_A_A = 1348, //over ac
|
||||
AV_ICEBLOOD_H_C = 1347,
|
||||
AV_ICEBLOOD_H_A = 1349, //over aa
|
||||
//Frostwolf Grave
|
||||
AV_FROSTWOLF_A_C = 1337, //over hc
|
||||
AV_FROSTWOLF_A_A = 1339, //over ac
|
||||
AV_FROSTWOLF_H_C = 1338,
|
||||
AV_FROSTWOLF_H_A = 1340, //over aa
|
||||
//Frostwolf Hut
|
||||
AV_FROSTWOLFHUT_A_C = 1329, //over hc
|
||||
AV_FROSTWOLFHUT_A_A = 1331, //over ha
|
||||
AV_FROSTWOLFHUT_H_C = 1330,
|
||||
AV_FROSTWOLFHUT_H_A = 1332, //over ac
|
||||
/*
|
||||
AV_SNOWFALL_A_C = 1341, //over hc
|
||||
AV_SNOWFALL_A_A = 1343, //over ha
|
||||
AV_SNOWFALL_H_C = 1342,
|
||||
AV_SNOWFALL_H_A = 1344, //over ac
|
||||
//Horde
|
||||
//Iceblood grave
|
||||
AV_ICEBLOOD_A_C = 1346, //over hc
|
||||
AV_ICEBLOOD_A_A = 1348, //over ac
|
||||
AV_ICEBLOOD_H_C = 1347,
|
||||
AV_ICEBLOOD_H_A = 1349, //over aa
|
||||
//Frostwolf Grave
|
||||
AV_FROSTWOLF_A_C = 1337, //over hc
|
||||
AV_FROSTWOLF_A_A = 1339, //over ac
|
||||
AV_FROSTWOLF_H_C = 1338,
|
||||
AV_FROSTWOLF_H_A = 1340, //over aa
|
||||
//Frostwolf Hut
|
||||
AV_FROSTWOLFHUT_A_C = 1329, //over hc
|
||||
AV_FROSTWOLFHUT_A_A = 1331, //over ha
|
||||
AV_FROSTWOLFHUT_H_C = 1330,
|
||||
AV_FROSTWOLFHUT_H_A = 1332, //over ac
|
||||
|
||||
//Towers
|
||||
//Alliance
|
||||
//Dunbaldar South Bunker
|
||||
AV_DUNS_CONTROLLED = 1361,
|
||||
AV_DUNS_DESTROYED = 1370,
|
||||
AV_DUNS_ASSAULTED = 1378,
|
||||
//Dunbaldar North Bunker
|
||||
AV_DUNN_CONTROLLED = 1362,
|
||||
AV_DUNN_DESTROYED = 1371,
|
||||
AV_DUNN_ASSAULTED = 1379,
|
||||
//Icewing Bunker
|
||||
AV_ICEWING_CONTROLLED = 1363,
|
||||
AV_ICEWING_DESTROYED = 1372,
|
||||
AV_ICEWING_ASSAULTED = 1380,
|
||||
//Stoneheart Bunker
|
||||
AV_STONEH_CONTROLLED = 1364,
|
||||
AV_STONEH_DESTROYED = 1373,
|
||||
AV_STONEH_ASSAULTED = 1381,
|
||||
//Horde
|
||||
//Iceblood Tower
|
||||
AV_ICEBLOOD_CONTROLLED = 1385,
|
||||
AV_ICEBLOOD_DESTROYED = 1368,
|
||||
AV_ICEBLOOD_ASSAULTED = 1390,
|
||||
//Tower Point
|
||||
AV_TOWERPOINT_CONTROLLED = 1384,
|
||||
AV_TOWERPOINT_DESTROYED = 1367, //goes over controlled
|
||||
AV_TOWERPOINT_ASSAULTED = 1389, //goes over destroyed
|
||||
//Frostwolf West
|
||||
AV_FROSTWOLFW_CONTROLLED = 1382,
|
||||
AV_FROSTWOLFW_DESTROYED = 1365, //over controlled
|
||||
AV_FROSTWOLFW_ASSAULTED = 1387, //over destroyed
|
||||
//Frostwolf East
|
||||
AV_FROSTWOLFE_CONTROLLED = 1383,
|
||||
AV_FROSTWOLFE_DESTROYED = 1366,
|
||||
AV_FROSTWOLFE_ASSAULTED = 1388,
|
||||
//Towers
|
||||
//Alliance
|
||||
//Dunbaldar South Bunker
|
||||
AV_DUNS_CONTROLLED = 1361,
|
||||
AV_DUNS_DESTROYED = 1370,
|
||||
AV_DUNS_ASSAULTED = 1378,
|
||||
//Dunbaldar North Bunker
|
||||
AV_DUNN_CONTROLLED = 1362,
|
||||
AV_DUNN_DESTROYED = 1371,
|
||||
AV_DUNN_ASSAULTED = 1379,
|
||||
//Icewing Bunker
|
||||
AV_ICEWING_CONTROLLED = 1363,
|
||||
AV_ICEWING_DESTROYED = 1372,
|
||||
AV_ICEWING_ASSAULTED = 1380,
|
||||
//Stoneheart Bunker
|
||||
AV_STONEH_CONTROLLED = 1364,
|
||||
AV_STONEH_DESTROYED = 1373,
|
||||
AV_STONEH_ASSAULTED = 1381,
|
||||
//Horde
|
||||
//Iceblood Tower
|
||||
AV_ICEBLOOD_CONTROLLED = 1385,
|
||||
AV_ICEBLOOD_DESTROYED = 1368,
|
||||
AV_ICEBLOOD_ASSAULTED = 1390,
|
||||
//Tower Point
|
||||
AV_TOWERPOINT_CONTROLLED = 1384,
|
||||
AV_TOWERPOINT_DESTROYED = 1367, //goes over controlled
|
||||
AV_TOWERPOINT_ASSAULTED = 1389, //goes over destroyed
|
||||
//Frostwolf West
|
||||
AV_FROSTWOLFW_CONTROLLED = 1382,
|
||||
AV_FROSTWOLFW_DESTROYED = 1365, //over controlled
|
||||
AV_FROSTWOLFW_ASSAULTED = 1387, //over destroyed
|
||||
//Frostwolf East
|
||||
AV_FROSTWOLFE_CONTROLLED = 1383,
|
||||
AV_FROSTWOLFE_DESTROYED = 1366,
|
||||
AV_FROSTWOLFE_ASSAULTED = 1388,
|
||||
|
||||
//mines
|
||||
//mines
|
||||
|
||||
AV_N_MINE_N = 1360,
|
||||
AV_N_MINE_A = 1358,
|
||||
AV_N_MINE_H = 1359,
|
||||
AV_N_MINE_N = 1360,
|
||||
AV_N_MINE_A = 1358,
|
||||
AV_N_MINE_H = 1359,
|
||||
|
||||
AV_S_MINE_N = 1357,
|
||||
AV_S_MINE_A = 1355,
|
||||
AV_S_MINE_H = 1356,
|
||||
AV_S_MINE_N = 1357,
|
||||
AV_S_MINE_A = 1355,
|
||||
AV_S_MINE_H = 1356,
|
||||
|
||||
//towers assaulted by own team (unused)
|
||||
AV_STONEH_UNUSED = 1377,
|
||||
AV_ICEWING_UNUSED = 1376,
|
||||
AV_DUNS_UNUSED = 1375,
|
||||
AV_DUNN_UNUSED = 1374,
|
||||
//towers assaulted by own team (unused)
|
||||
AV_STONEH_UNUSED = 1377,
|
||||
AV_ICEWING_UNUSED = 1376,
|
||||
AV_DUNS_UNUSED = 1375,
|
||||
AV_DUNN_UNUSED = 1374,
|
||||
|
||||
AV_ICEBLOOD_UNUSED = 1395,
|
||||
AV_TOWERPOINT_UNUSED = 1394,
|
||||
AV_FROSTWOLFE_UNUSED = 1393,
|
||||
AV_FROSTWOLFW_UNUSED = 1392
|
||||
*/
|
||||
AV_ICEBLOOD_UNUSED = 1395,
|
||||
AV_TOWERPOINT_UNUSED = 1394,
|
||||
AV_FROSTWOLFE_UNUSED = 1393,
|
||||
AV_FROSTWOLFW_UNUSED = 1392
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1540,7 +1542,7 @@ struct BG_AV_NodeInfo
|
|||
bool Tower;
|
||||
};
|
||||
|
||||
inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); }
|
||||
inline BG_AV_Nodes& operator++(BG_AV_Nodes& i) { return i = BG_AV_Nodes(i + 1); }
|
||||
|
||||
struct BattlegroundAVScore : public BattlegroundScore
|
||||
{
|
||||
|
|
@ -1563,87 +1565,87 @@ struct BattlegroundAVScore : public BattlegroundScore
|
|||
|
||||
class BattlegroundAV : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundAV();
|
||||
~BattlegroundAV() override;
|
||||
public:
|
||||
BattlegroundAV();
|
||||
~BattlegroundAV() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void ResetBGSubclass() override;
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void ResetBGSubclass() override;
|
||||
|
||||
/*general stuff*/
|
||||
void UpdateScore(TeamId teamId, int16 points);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
/*general stuff*/
|
||||
void UpdateScore(TeamId teamId, int16 points);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
/*handlestuff*/ //these are functions which get called from extern
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
void HandleKillUnit(Creature* unit, Player* killer) override;
|
||||
void HandleQuestComplete(uint32 questid, Player* player);
|
||||
bool PlayerCanDoMineQuest(int32 GOId, TeamId teamId);
|
||||
/*handlestuff*/ //these are functions which get called from extern
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
void HandleKillUnit(Creature* unit, Player* killer) override;
|
||||
void HandleQuestComplete(uint32 questid, Player* player);
|
||||
bool PlayerCanDoMineQuest(int32 GOId, TeamId teamId);
|
||||
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
|
||||
/* achievement req. */
|
||||
bool IsBothMinesControlledByTeam(TeamId teamId) const;
|
||||
bool IsAllTowersControlledAndCaptainAlive(TeamId teamId) const;
|
||||
|
||||
TeamId GetPrematureWinner() override;
|
||||
/* achievement req. */
|
||||
bool IsBothMinesControlledByTeam(TeamId teamId) const;
|
||||
bool IsAllTowersControlledAndCaptainAlive(TeamId teamId) const;
|
||||
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
TeamId GetPrematureWinner() override;
|
||||
|
||||
/* Nodes occupying */
|
||||
void EventPlayerAssaultsPoint(Player* player, uint32 object);
|
||||
void EventPlayerDefendsPoint(Player* player, uint32 object);
|
||||
void EventPlayerDestroyedPoint(BG_AV_Nodes node);
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
void AssaultNode(BG_AV_Nodes node, TeamId teamId);
|
||||
void DestroyNode(BG_AV_Nodes node);
|
||||
void InitNode(BG_AV_Nodes node, TeamId teamId, bool tower);
|
||||
void DefendNode(BG_AV_Nodes node, TeamId teamId);
|
||||
/* Nodes occupying */
|
||||
void EventPlayerAssaultsPoint(Player* player, uint32 object);
|
||||
void EventPlayerDefendsPoint(Player* player, uint32 object);
|
||||
void EventPlayerDestroyedPoint(BG_AV_Nodes node);
|
||||
|
||||
void PopulateNode(BG_AV_Nodes node);
|
||||
void DePopulateNode(BG_AV_Nodes node);
|
||||
void AssaultNode(BG_AV_Nodes node, TeamId teamId);
|
||||
void DestroyNode(BG_AV_Nodes node);
|
||||
void InitNode(BG_AV_Nodes node, TeamId teamId, bool tower);
|
||||
void DefendNode(BG_AV_Nodes node, TeamId teamId);
|
||||
|
||||
BG_AV_Nodes GetNodeThroughObject(uint32 object);
|
||||
uint32 GetObjectThroughNode(BG_AV_Nodes node);
|
||||
char const* GetNodeName(BG_AV_Nodes node);
|
||||
bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; }
|
||||
void PopulateNode(BG_AV_Nodes node);
|
||||
void DePopulateNode(BG_AV_Nodes node);
|
||||
|
||||
/*mine*/
|
||||
void ChangeMineOwner(uint8 mine, TeamId teamId, bool initial=false);
|
||||
BG_AV_Nodes GetNodeThroughObject(uint32 object);
|
||||
uint32 GetObjectThroughNode(BG_AV_Nodes node);
|
||||
char const* GetNodeName(BG_AV_Nodes node);
|
||||
bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; }
|
||||
|
||||
/*worldstates*/
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
uint8 GetWorldStateType(uint8 state, TeamId teamId);
|
||||
void SendMineWorldStates(uint32 mine);
|
||||
void UpdateNodeWorldState(BG_AV_Nodes node);
|
||||
/*mine*/
|
||||
void ChangeMineOwner(uint8 mine, TeamId teamId, bool initial = false);
|
||||
|
||||
/*general */
|
||||
Creature* AddAVCreature(uint16 cinfoid, uint16 type);
|
||||
/*worldstates*/
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
uint8 GetWorldStateType(uint8 state, TeamId teamId);
|
||||
void SendMineWorldStates(uint32 mine);
|
||||
void UpdateNodeWorldState(BG_AV_Nodes node);
|
||||
|
||||
/*variables */
|
||||
int32 m_Team_Scores[2]{};
|
||||
uint32 m_Team_QuestStatus[2][9]{}; //[x][y] x=team y=questcounter
|
||||
/*general */
|
||||
Creature* AddAVCreature(uint16 cinfoid, uint16 type);
|
||||
|
||||
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]{};
|
||||
/*variables */
|
||||
int32 m_Team_Scores[2] {};
|
||||
uint32 m_Team_QuestStatus[2][9] {}; //[x][y] x=team y=questcounter
|
||||
|
||||
TeamId m_Mine_Owner[2]{};
|
||||
int32 m_Mine_Timer; //ticks for both teams
|
||||
uint32 m_Mine_Reclaim_Timer[2]{};
|
||||
uint32 m_CaptainBuffTimer[2]{};
|
||||
bool m_CaptainAlive[2]{};
|
||||
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX] {};
|
||||
|
||||
bool m_IsInformedNearVictory[2]{};
|
||||
TeamId m_Mine_Owner[2] {};
|
||||
int32 m_Mine_Timer; //ticks for both teams
|
||||
uint32 m_Mine_Reclaim_Timer[2] {};
|
||||
uint32 m_CaptainBuffTimer[2] {};
|
||||
bool m_CaptainAlive[2] {};
|
||||
|
||||
bool m_IsInformedNearVictory[2] {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||
}
|
||||
}
|
||||
|
||||
void BattlegroundBE::FillInitialWorldStates(WorldPacket &data)
|
||||
void BattlegroundBE::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0x9f3) << uint32(1); // 9
|
||||
Battleground::UpdateArenaWorldState();
|
||||
|
|
@ -143,15 +143,15 @@ bool BattlegroundBE::SetupBattleground()
|
|||
{
|
||||
// gates
|
||||
if (!AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|
||||
|| !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_BE_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 6189.47f, 235.54f, 5.52f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_BE_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 6287.19f, 288.25f, 5.33f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|
||||
|| !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_BE_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 6189.47f, 235.54f, 5.52f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_BE_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 6287.19f, 288.25f, 5.33f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundBE: Failed to spawn some object!");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -34,24 +34,24 @@ enum BattlegroundBEObjects
|
|||
|
||||
class BattlegroundBE : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundBE();
|
||||
~BattlegroundBE();
|
||||
public:
|
||||
BattlegroundBE();
|
||||
~BattlegroundBE();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket& d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ bool BattlegroundDS::HandlePlayerUnderMap(Player* player)
|
|||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundDS::FillInitialWorldStates(WorldPacket &data)
|
||||
void BattlegroundDS::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(3610) << uint32(1); // 9 show
|
||||
Battleground::UpdateArenaWorldState();
|
||||
|
|
@ -232,20 +232,20 @@ bool BattlegroundDS::SetupBattleground()
|
|||
{
|
||||
// gates
|
||||
if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95f, 817.2f, 20.8096f, 3.15f, 0, 0, 0.99627f, 0.0862864f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65f, 764.913f, 20.0729f, 6.3f, 0, 0, 0.0310211f, -0.999519f, RESPAWN_IMMEDIATELY)
|
||||
// water
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
|
||||
// buffs
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120)
|
||||
// knockback creatures
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_WATERFALL_KNOCKBACK, 1291.76f, 791.02f, 7.115f, 3.054326f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_DS_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 1229.44f, 759.35f, 17.89f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_DS_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 1352.90f, 822.77f, 17.96f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
|| !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65f, 764.913f, 20.0729f, 6.3f, 0, 0, 0.0310211f, -0.999519f, RESPAWN_IMMEDIATELY)
|
||||
// water
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
|
||||
// buffs
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120)
|
||||
// knockback creatures
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_WATERFALL_KNOCKBACK, 1291.76f, 791.02f, 7.115f, 3.054326f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_DS_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 1229.44f, 759.35f, 17.89f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_DS_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 1352.90f, 822.77f, 17.96f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ enum BattlegroundDSSpells
|
|||
};
|
||||
|
||||
enum BattlegroundDSData
|
||||
{ // These values are NOT blizzlike... need the correct data!
|
||||
{
|
||||
// These values are NOT blizzlike... need the correct data!
|
||||
BG_DS_WATERFALL_TIMER_MIN = 30000,
|
||||
BG_DS_WATERFALL_TIMER_MAX = 60000,
|
||||
BG_DS_WATERFALL_WARNING_DURATION = 5000,
|
||||
|
|
@ -71,40 +72,40 @@ enum BattlegroundDSData
|
|||
|
||||
class BattlegroundDS : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundDS();
|
||||
~BattlegroundDS();
|
||||
public:
|
||||
BattlegroundDS();
|
||||
~BattlegroundDS();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
private:
|
||||
uint32 _waterfallTimer;
|
||||
uint8 _waterfallStatus;
|
||||
uint32 _waterfallKnockbackTimer;
|
||||
uint32 _pipeKnockBackTimer;
|
||||
uint8 _pipeKnockBackCount;
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket& d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
private:
|
||||
uint32 _waterfallTimer;
|
||||
uint8 _waterfallStatus;
|
||||
uint32 _waterfallKnockbackTimer;
|
||||
uint32 _pipeKnockBackTimer;
|
||||
uint8 _pipeKnockBackCount;
|
||||
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
protected:
|
||||
uint32 getWaterFallStatus() { return _waterfallStatus; };
|
||||
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
|
||||
uint32 getWaterFallTimer() { return _waterfallTimer; };
|
||||
void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
|
||||
uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; };
|
||||
void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; };
|
||||
uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; };
|
||||
void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; };
|
||||
uint32 getPipeKnockBackTimer() { return _pipeKnockBackTimer; };
|
||||
void setPipeKnockBackTimer(uint32 timer) { _pipeKnockBackTimer = timer; };
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
protected:
|
||||
uint32 getWaterFallStatus() { return _waterfallStatus; };
|
||||
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
|
||||
uint32 getWaterFallTimer() { return _waterfallTimer; };
|
||||
void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
|
||||
uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; };
|
||||
void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; };
|
||||
uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; };
|
||||
void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; };
|
||||
uint32 getPipeKnockBackTimer() { return _pipeKnockBackTimer; };
|
||||
void setPipeKnockBackTimer(uint32 timer) { _pipeKnockBackTimer = timer; };
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void BattlegroundEY::StartingEventOpenDoors()
|
|||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
|
||||
for (uint32 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i*3 + urand(0, 2), RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + urand(0, 2), RESPAWN_IMMEDIATELY);
|
||||
|
||||
// Achievement: Flurry
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_EY_EVENT_START_BATTLE);
|
||||
|
|
@ -150,7 +150,7 @@ void BattlegroundEY::UpdatePointsState()
|
|||
pointOwnerTeamId = TEAM_HORDE;
|
||||
else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH)
|
||||
pointOwnerTeamId = TEAM_ALLIANCE;
|
||||
|
||||
|
||||
if (pointOwnerTeamId != _capturePointInfo[point]._ownerTeamId)
|
||||
{
|
||||
if (_capturePointInfo[point].IsUncontrolled())
|
||||
|
|
@ -248,10 +248,10 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||
|
||||
bool BattlegroundEY::SetupBattleground()
|
||||
{
|
||||
// doors
|
||||
// doors
|
||||
AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_EY_OBJECT_DOOR_H, BG_OBJECT_H_DOOR_EY_ENTRY, 1803.21f, 1539.49f, 1261.09f, 3.14159f, 0.173648f, 0, 0.984808f, 0, RESPAWN_IMMEDIATELY);
|
||||
// banners (alliance)
|
||||
// banners (alliance)
|
||||
AddObject(BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_A_BANNER_FEL_REAVER_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_A_BANNER_FEL_REAVER_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY);
|
||||
|
|
@ -264,7 +264,7 @@ bool BattlegroundEY::SetupBattleground()
|
|||
AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY);
|
||||
// banners (horde)
|
||||
// banners (horde)
|
||||
AddObject(BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_H_BANNER_FEL_REAVER_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_H_BANNER_FEL_REAVER_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY);
|
||||
|
|
@ -277,7 +277,7 @@ bool BattlegroundEY::SetupBattleground()
|
|||
AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY);
|
||||
// banners (natural)
|
||||
// banners (natural)
|
||||
AddObject(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_N_BANNER_FEL_REAVER_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_N_BANNER_FEL_REAVER_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY);
|
||||
|
|
@ -290,13 +290,13 @@ bool BattlegroundEY::SetupBattleground()
|
|||
AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY);
|
||||
// flags
|
||||
// flags
|
||||
AddObject(BG_EY_OBJECT_FLAG_NETHERSTORM, BG_OBJECT_FLAG2_EY_ENTRY, 2174.782227f, 1569.054688f, 1160.361938f, -1.448624f, 0, 0, 0.662620f, -0.748956f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_FLAG_FEL_REAVER, BG_OBJECT_FLAG1_EY_ENTRY, 2044.28f, 1729.68f, 1189.96f, -0.017453f, 0, 0, 0.008727f, -0.999962f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_FLAG_BLOOD_ELF, BG_OBJECT_FLAG1_EY_ENTRY, 2048.83f, 1393.65f, 1194.49f, 0.20944f, 0, 0, 0.104528f, 0.994522f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_FLAG_DRAENEI_RUINS, BG_OBJECT_FLAG1_EY_ENTRY, 2286.56f, 1402.36f, 1197.11f, 3.72381f, 0, 0, 0.957926f, -0.287016f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_FLAG_MAGE_TOWER, BG_OBJECT_FLAG1_EY_ENTRY, 2284.48f, 1731.23f, 1189.99f, 2.89725f, 0, 0, 0.992546f, 0.121869f, RESPAWN_ONE_DAY);
|
||||
// tower cap
|
||||
// tower cap
|
||||
AddObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER, BG_OBJECT_FR_TOWER_CAP_EY_ENTRY, 2024.600708f, 1742.819580f, 1195.157715f, 2.443461f, 0, 0, 0.939693f, 0.342020f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_TOWER_CAP_BLOOD_ELF, BG_OBJECT_BE_TOWER_CAP_EY_ENTRY, 2050.493164f, 1372.235962f, 1194.563477f, 1.710423f, 0, 0, 0.754710f, 0.656059f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_TOWER_CAP_DRAENEI_RUINS, BG_OBJECT_DR_TOWER_CAP_EY_ENTRY, 2301.010498f, 1386.931641f, 1197.183472f, 1.570796f, 0, 0, 0.707107f, 0.707107f, RESPAWN_ONE_DAY);
|
||||
|
|
@ -490,7 +490,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
|||
// Xinef: done this way to avoid errors in console
|
||||
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]);
|
||||
if (!trigger)
|
||||
trigger = AddCreature(WORLD_TRIGGER, BG_EY_TRIGGER_FEL_REAVER + point, BG_EY_TriggerPositions[point][0], BG_EY_TriggerPositions[point][1], BG_EY_TriggerPositions[point][2], BG_EY_TriggerPositions[point][3]);
|
||||
trigger = AddCreature(WORLD_TRIGGER, BG_EY_TRIGGER_FEL_REAVER + point, BG_EY_TriggerPositions[point][0], BG_EY_TriggerPositions[point][1], BG_EY_TriggerPositions[point][2], BG_EY_TriggerPositions[point][3]);
|
||||
|
||||
if (trigger)
|
||||
{
|
||||
|
|
@ -574,14 +574,14 @@ GraveyardStruct const* BattlegroundEY::GetClosestGraveyard(Player* player)
|
|||
float pX = player->GetPositionX();
|
||||
float pY = player->GetPositionY();
|
||||
float pZ = player->GetPositionZ();
|
||||
float dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
|
||||
float dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY) + (entry->z - pZ) * (entry->z - pZ);
|
||||
float minDist = dist;
|
||||
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
if (_capturePointInfo[i].IsUnderControl(player->GetTeamId()))
|
||||
{
|
||||
entry = sGraveyard->GetGraveyard(m_CapturingPointTypes[i].GraveYardId);
|
||||
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
|
||||
dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY) + (entry->z - pZ) * (entry->z - pZ);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ enum BG_EY_Events
|
|||
|
||||
enum BG_EY_Timers
|
||||
{
|
||||
BG_EY_FLAG_RESPAWN_TIME = 20*IN_MILLISECONDS,
|
||||
BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS,
|
||||
BG_EY_FPOINTS_CHECK_TIME = 2*IN_MILLISECONDS,
|
||||
BG_EY_FPOINTS_TICK_TIME = 1*IN_MILLISECONDS
|
||||
BG_EY_FLAG_RESPAWN_TIME = 20 * IN_MILLISECONDS,
|
||||
BG_EY_FLAG_ON_GROUND_TIME = 10 * IN_MILLISECONDS,
|
||||
BG_EY_FPOINTS_CHECK_TIME = 2 * IN_MILLISECONDS,
|
||||
BG_EY_FPOINTS_TICK_TIME = 1 * IN_MILLISECONDS
|
||||
};
|
||||
|
||||
enum BG_EY_WorldStates
|
||||
|
|
@ -249,8 +249,8 @@ struct BattlegroundEYLosingPointStruct
|
|||
{
|
||||
BattlegroundEYLosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde)
|
||||
: SpawnNeutralObjectType(_SpawnNeutralObjectType),
|
||||
DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
|
||||
DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde)
|
||||
DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
|
||||
DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde)
|
||||
{}
|
||||
|
||||
uint32 SpawnNeutralObjectType;
|
||||
|
|
@ -264,9 +264,9 @@ struct BattlegroundEYCapturingPointStruct
|
|||
{
|
||||
BattlegroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId)
|
||||
: DespawnNeutralObjectType(_DespawnNeutralObjectType),
|
||||
SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
|
||||
SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde),
|
||||
GraveYardId(_GraveYardId)
|
||||
SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
|
||||
SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde),
|
||||
GraveYardId(_GraveYardId)
|
||||
{}
|
||||
|
||||
uint32 DespawnNeutralObjectType;
|
||||
|
|
@ -316,84 +316,84 @@ struct BattlegroundEYScore : public BattlegroundScore
|
|||
|
||||
class BattlegroundEY : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundEY();
|
||||
~BattlegroundEY();
|
||||
public:
|
||||
BattlegroundEY();
|
||||
~BattlegroundEY();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return _flagKeeperGUID; }
|
||||
void SetFlagPicker(uint64 guid) { _flagKeeperGUID = guid; }
|
||||
uint8 GetFlagState() const { return _flagState; }
|
||||
void RespawnFlag();
|
||||
void RespawnFlagAfterDrop();
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return _flagKeeperGUID; }
|
||||
void SetFlagPicker(uint64 guid) { _flagKeeperGUID = guid; }
|
||||
uint8 GetFlagState() const { return _flagState; }
|
||||
void RespawnFlag();
|
||||
void RespawnFlagAfterDrop();
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleBuffUse(uint64 buff_guid);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
void SetDroppedFlagGUID(uint64 guid, TeamId /*teamId*/ = TEAM_NEUTRAL) { _droppedFlagGUID = guid; }
|
||||
uint64 GetDroppedFlagGUID() const { return _droppedFlagGUID; }
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleBuffUse(uint64 buff_guid);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
void SetDroppedFlagGUID(uint64 guid, TeamId /*teamId*/ = TEAM_NEUTRAL) { _droppedFlagGUID = guid; }
|
||||
uint64 GetDroppedFlagGUID() const { return _droppedFlagGUID; }
|
||||
|
||||
/* Battleground Events */
|
||||
void EventPlayerClickedOnFlag(Player* player, GameObject* gameObject);
|
||||
void EventPlayerDroppedFlag(Player* player);
|
||||
/* Battleground Events */
|
||||
void EventPlayerClickedOnFlag(Player* player, GameObject* gameObject);
|
||||
void EventPlayerDroppedFlag(Player* player);
|
||||
|
||||
/* achievement req. */
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const;
|
||||
TeamId GetPrematureWinner();
|
||||
/* achievement req. */
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const;
|
||||
TeamId GetPrematureWinner();
|
||||
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType);
|
||||
void EventTeamLostPoint(TeamId teamId, uint32 point);
|
||||
void EventTeamCapturedPoint(TeamId teamId, uint32 point);
|
||||
void UpdatePointsCount();
|
||||
void UpdatePointsIcons(uint32 point);
|
||||
void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType);
|
||||
void EventTeamLostPoint(TeamId teamId, uint32 point);
|
||||
void EventTeamCapturedPoint(TeamId teamId, uint32 point);
|
||||
void UpdatePointsCount();
|
||||
void UpdatePointsIcons(uint32 point);
|
||||
|
||||
/* Point status updating procedures */
|
||||
void UpdatePointsState();
|
||||
/* Point status updating procedures */
|
||||
void UpdatePointsState();
|
||||
|
||||
/* Scorekeeping */
|
||||
void AddPoints(TeamId teamId, uint32 points);
|
||||
/* Scorekeeping */
|
||||
void AddPoints(TeamId teamId, uint32 points);
|
||||
|
||||
struct CapturePointInfo
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
|
||||
{
|
||||
_playersCount[TEAM_ALLIANCE] = 0;
|
||||
_playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
_playersCount[TEAM_ALLIANCE] = 0;
|
||||
_playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
|
||||
TeamId _ownerTeamId;
|
||||
int8 _barStatus;
|
||||
uint32 _areaTrigger;
|
||||
int8 _playersCount[BG_TEAMS_COUNT];
|
||||
TeamId _ownerTeamId;
|
||||
int8 _barStatus;
|
||||
uint32 _areaTrigger;
|
||||
int8 _playersCount[BG_TEAMS_COUNT];
|
||||
|
||||
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
|
||||
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
|
||||
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
|
||||
};
|
||||
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
|
||||
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
|
||||
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
|
||||
};
|
||||
|
||||
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint8 _ownedPointsCount[BG_TEAMS_COUNT];
|
||||
uint64 _flagKeeperGUID;
|
||||
uint64 _droppedFlagGUID;
|
||||
uint8 _flagState;
|
||||
uint32 _flagCapturedObject;
|
||||
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint8 _ownedPointsCount[BG_TEAMS_COUNT];
|
||||
uint64 _flagKeeperGUID;
|
||||
uint64 _droppedFlagGUID;
|
||||
uint8 _flagState;
|
||||
uint32 _flagCapturedObject;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
GetBGObject(BG_IC_GO_HORDE_GATE_3)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
|
||||
|
||||
doorsClosed = true;
|
||||
} else closeFortressDoorsTimer -= diff;
|
||||
}
|
||||
else closeFortressDoorsTimer -= diff;
|
||||
}
|
||||
|
||||
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
|
||||
|
|
@ -114,14 +115,14 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
if (nodePoint[i].nodeType == NODE_TYPE_DOCKS)
|
||||
{
|
||||
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
{
|
||||
if (nodePoint[i].timer <= diff)
|
||||
{
|
||||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H) + j;
|
||||
if (Creature* catapult = GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
if (!catapult->IsAlive())
|
||||
{
|
||||
|
|
@ -139,7 +140,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
|
||||
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H) + j;
|
||||
if (Creature* glaiveThrower = GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
if (!glaiveThrower->IsAlive())
|
||||
{
|
||||
|
|
@ -164,7 +165,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
|
||||
{
|
||||
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
{
|
||||
if (siegeEngineWorkshopTimer <= diff)
|
||||
{
|
||||
|
|
@ -185,7 +186,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u;
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H) + u;
|
||||
if (Creature* demolisher = GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
if (!demolisher->IsAlive())
|
||||
{
|
||||
|
|
@ -237,7 +238,8 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
|
||||
nodePoint[i].needChange = false;
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
|
||||
} else nodePoint[i].timer -= diff;
|
||||
}
|
||||
else nodePoint[i].timer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +248,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
for (uint8 i = 0; i < NODE_TYPE_DOCKS; ++i)
|
||||
{
|
||||
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
{
|
||||
factionReinforcements[nodePoint[i].faction] += 1;
|
||||
RewardHonorToTeam(RESOURCE_HONOR_AMOUNT, nodePoint[i].faction);
|
||||
|
|
@ -254,7 +256,8 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
}
|
||||
}
|
||||
resourceTimer = IC_RESOURCE_TIME;
|
||||
} else resourceTimer -= diff;
|
||||
}
|
||||
else resourceTimer -= diff;
|
||||
}
|
||||
|
||||
void BattlegroundIC::StartingEventCloseDoors()
|
||||
|
|
@ -431,10 +434,10 @@ bool BattlegroundIC::SetupBattleground()
|
|||
}
|
||||
}
|
||||
|
||||
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[5][0], BG_IC_SpiritGuidePos[5][1], BG_IC_SpiritGuidePos[5][2], BG_IC_SpiritGuidePos[5][3], TEAM_ALLIANCE)
|
||||
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[6][0], BG_IC_SpiritGuidePos[6][1], BG_IC_SpiritGuidePos[6][2], BG_IC_SpiritGuidePos[6][3], TEAM_HORDE)
|
||||
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+5, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], TEAM_ALLIANCE)
|
||||
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+6, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], TEAM_HORDE))
|
||||
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + 3, BG_IC_SpiritGuidePos[5][0], BG_IC_SpiritGuidePos[5][1], BG_IC_SpiritGuidePos[5][2], BG_IC_SpiritGuidePos[5][3], TEAM_ALLIANCE)
|
||||
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + 4, BG_IC_SpiritGuidePos[6][0], BG_IC_SpiritGuidePos[6][1], BG_IC_SpiritGuidePos[6][2], BG_IC_SpiritGuidePos[6][3], TEAM_HORDE)
|
||||
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + 5, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], TEAM_ALLIANCE)
|
||||
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + 6, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], TEAM_HORDE))
|
||||
{
|
||||
sLog->outError("Isle of Conquest: Failed to spawn initial spirit guide!");
|
||||
return false;
|
||||
|
|
@ -496,7 +499,7 @@ void BattlegroundIC::TurnBosses(bool on)
|
|||
void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
return;
|
||||
|
||||
uint32 entry = unit->GetEntry();
|
||||
if (entry == NPC_HIGH_COMMANDER_HALFORD_WYRMBANE)
|
||||
|
|
@ -518,7 +521,7 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
|||
|
||||
// Xinef: Add to respawn list
|
||||
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
respawnMap[unit->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
|
@ -563,15 +566,15 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
|
||||
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
}
|
||||
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
|
||||
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -593,8 +596,8 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
// if we are here means that the point has been lost, or it is the first capture
|
||||
|
||||
if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
|
||||
if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2])
|
||||
DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2);
|
||||
if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + (nodePoint[i].nodeType) - 2])
|
||||
DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1 + (nodePoint[i].nodeType) - 2);
|
||||
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
|
||||
|
|
@ -603,7 +606,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
HandleContestedNodes(&nodePoint[i]);
|
||||
}
|
||||
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
|
||||
// if we are going to spawn the definitve faction banner, we dont need the timer anymore
|
||||
// if we are going to spawn the definitve faction banner, we dont need the timer anymore
|
||||
{
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
|
||||
nodePoint[i].needChange = false;
|
||||
|
|
@ -722,65 +725,65 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
{
|
||||
if (nodePoint->nodeType != NODE_TYPE_REFINERY && nodePoint->nodeType != NODE_TYPE_QUARRY)
|
||||
{
|
||||
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2,
|
||||
BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1],
|
||||
BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3],
|
||||
nodePoint->faction))
|
||||
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint->nodeType - 2,
|
||||
BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1],
|
||||
BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3],
|
||||
nodePoint->faction))
|
||||
sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
|
||||
}
|
||||
|
||||
switch (nodePoint->gameobject_type)
|
||||
{
|
||||
case BG_IC_GO_HANGAR_BANNER:
|
||||
{
|
||||
if (!gunshipAlliance || !gunshipHorde)
|
||||
{
|
||||
if (!gunshipAlliance || !gunshipHorde)
|
||||
break;
|
||||
|
||||
std::list<Creature*> cannons;
|
||||
if (nodePoint->faction == TEAM_ALLIANCE)
|
||||
gunshipAlliance->GetCreatureListWithEntryInGrid(cannons, NPC_ALLIANCE_GUNSHIP_CANNON, 150.0f);
|
||||
else
|
||||
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
|
||||
|
||||
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
|
||||
(*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_CAPTAIN_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u;
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1)
|
||||
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY))
|
||||
GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY);
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
|
||||
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
|
||||
}
|
||||
|
||||
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
|
||||
break;
|
||||
|
||||
std::list<Creature*> cannons;
|
||||
if (nodePoint->faction == TEAM_ALLIANCE)
|
||||
gunshipAlliance->GetCreatureListWithEntryInGrid(cannons, NPC_ALLIANCE_GUNSHIP_CANNON, 150.0f);
|
||||
else
|
||||
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
|
||||
|
||||
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
|
||||
(*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_CAPTAIN_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u;
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1)
|
||||
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY))
|
||||
GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY);
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
|
||||
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
|
||||
}
|
||||
|
||||
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
|
||||
break;
|
||||
}
|
||||
case BG_IC_GO_QUARRY_BANNER:
|
||||
RemoveAuraOnTeam(SPELL_QUARRY, GetOtherTeamId(nodePoint->faction));
|
||||
CastSpellOnTeam(SPELL_QUARRY, nodePoint->faction);
|
||||
|
|
@ -799,31 +802,31 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
// spawning glaive throwers
|
||||
for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H) + i;
|
||||
|
||||
if (GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
continue;
|
||||
|
||||
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type,
|
||||
BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(),
|
||||
BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(),
|
||||
RESPAWN_ONE_DAY))
|
||||
GetBGCreature(type)->setFaction(BG_IC_Factions[nodePoint->faction]);
|
||||
BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(),
|
||||
BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(),
|
||||
RESPAWN_ONE_DAY))
|
||||
GetBGCreature(type)->setFaction(BG_IC_Factions[nodePoint->faction]);
|
||||
}
|
||||
|
||||
// spawning catapults
|
||||
for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H) + i;
|
||||
|
||||
if (GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
continue;
|
||||
|
||||
if (AddCreature(NPC_CATAPULT, type,
|
||||
BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(),
|
||||
BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(),
|
||||
RESPAWN_ONE_DAY))
|
||||
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||
BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(),
|
||||
BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(),
|
||||
RESPAWN_ONE_DAY))
|
||||
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||
}
|
||||
break;
|
||||
case BG_IC_GO_WORKSHOP_BANNER:
|
||||
|
|
@ -835,15 +838,15 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
{
|
||||
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H) + i;
|
||||
|
||||
if (GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
continue;
|
||||
|
||||
if (AddCreature(NPC_DEMOLISHER, type,
|
||||
BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
|
||||
BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
|
||||
RESPAWN_ONE_DAY))
|
||||
BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
|
||||
BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
|
||||
RESPAWN_ONE_DAY))
|
||||
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||
}
|
||||
|
||||
|
|
@ -851,15 +854,15 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
if (!GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||
{
|
||||
AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
|
||||
BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
|
||||
BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
|
||||
RESPAWN_ONE_DAY);
|
||||
BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
|
||||
BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
|
||||
RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
if (Creature* siegeEngine = GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||
{
|
||||
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||
siegeEngine->SetCorpseDelay(5*MINUTE);
|
||||
siegeEngine->SetCorpseDelay(5 * MINUTE);
|
||||
|
||||
if (siegeEngine->IsAlive())
|
||||
if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit())
|
||||
|
|
@ -872,12 +875,12 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
|
||||
for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i, GO_SEAFORIUM_BOMBS,
|
||||
workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(),
|
||||
workshopBombs[i].GetPositionZ(), workshopBombs[i].GetOrientation(),
|
||||
0, 0, 0, 0, 10);
|
||||
AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1 + i, GO_SEAFORIUM_BOMBS,
|
||||
workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(),
|
||||
workshopBombs[i].GetPositionZ(), workshopBombs[i].GetOrientation(),
|
||||
0, 0, 0, 0, 10);
|
||||
|
||||
if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i))
|
||||
if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1 + i))
|
||||
{
|
||||
seaforiumBombs->SetRespawnTime(10);
|
||||
seaforiumBombs->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||
|
|
@ -968,10 +971,10 @@ GraveyardStruct const* BattlegroundIC::GetClosestGraveyard(Player* player)
|
|||
float mindist = 999999.0f;
|
||||
for (uint8 i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
GraveyardStruct const*entry = sGraveyard->GetGraveyard(BG_IC_GraveyardIds[nodes[i]]);
|
||||
GraveyardStruct const* entry = sGraveyard->GetGraveyard(BG_IC_GraveyardIds[nodes[i]]);
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
||||
float dist = (entry->x - plr_x) * (entry->x - plr_x) + (entry->y - plr_y) * (entry->y - plr_y);
|
||||
if (mindist > dist)
|
||||
{
|
||||
mindist = dist;
|
||||
|
|
@ -982,7 +985,7 @@ GraveyardStruct const* BattlegroundIC::GetClosestGraveyard(Player* player)
|
|||
}
|
||||
// If not, place ghost on starting location
|
||||
if (!good_entry)
|
||||
good_entry = sGraveyard->GetGraveyard(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
|
||||
good_entry = sGraveyard->GetGraveyard(BG_IC_GraveyardIds[player->GetTeamId() + MAX_NODE_TYPES]);
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,8 +434,8 @@ enum BannersTypes
|
|||
|
||||
enum BG_IC_MaxSpawns
|
||||
{
|
||||
MAX_NORMAL_GAMEOBJECTS_SPAWNS = BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR03+1,
|
||||
MAX_NORMAL_NPCS_SPAWNS = BG_IC_NPC_KEEP_CANNON_25+1,
|
||||
MAX_NORMAL_GAMEOBJECTS_SPAWNS = BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR03 + 1,
|
||||
MAX_NORMAL_NPCS_SPAWNS = BG_IC_NPC_KEEP_CANNON_25 + 1,
|
||||
MAX_WORKSHOP_SPAWNS = 10,
|
||||
MAX_DOCKS_SPAWNS = 12,
|
||||
MAX_SPIRIT_GUIDES_SPAWNS = 7,
|
||||
|
|
@ -828,9 +828,9 @@ enum ICNodeState
|
|||
NODE_STATE_CONTROLLED_H
|
||||
};
|
||||
|
||||
const uint32 BG_IC_GraveyardIds[MAX_NODE_TYPES+2] = {0, 0, 1480, 1481, 1482, 1485, 1486, 1483, 1484};
|
||||
const uint32 BG_IC_GraveyardIds[MAX_NODE_TYPES + 2] = {0, 0, 1480, 1481, 1482, 1485, 1486, 1483, 1484};
|
||||
|
||||
const float BG_IC_SpiritGuidePos[MAX_NODE_TYPES+2][4] =
|
||||
const float BG_IC_SpiritGuidePos[MAX_NODE_TYPES + 2][4] =
|
||||
{
|
||||
{0.0f, 0.0f, 0.0f, 0.0f}, // no grave
|
||||
{0.0f, 0.0f, 0.0f, 0.0f}, // no grave
|
||||
|
|
@ -889,107 +889,119 @@ struct BattlegroundICScore : public BattlegroundScore
|
|||
|
||||
class BattlegroundIC : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundIC();
|
||||
~BattlegroundIC();
|
||||
public:
|
||||
BattlegroundIC();
|
||||
~BattlegroundIC();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void SpawnLeader(uint32 teamid);
|
||||
void HandleKillUnit(Creature* unit, Player* killer);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* /*gameObject*/);
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void SpawnLeader(uint32 teamid);
|
||||
void HandleKillUnit(Creature* unit, Player* killer);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* /*gameObject*/);
|
||||
|
||||
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
|
||||
void DestroyGate(Player* player, GameObject* go);
|
||||
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
|
||||
void DestroyGate(Player* player, GameObject* go);
|
||||
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
void HandlePlayerResurrect(Player* player);
|
||||
void HandlePlayerResurrect(Player* player);
|
||||
|
||||
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
|
||||
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
|
||||
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const; // overwrited
|
||||
bool IsResourceGlutAllowed(TeamId teamId) const;
|
||||
void DoAction(uint32 action, uint64 guid);
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
uint32 docksTimer;
|
||||
uint32 resourceTimer;
|
||||
uint32 siegeEngineWorkshopTimer;
|
||||
uint16 factionReinforcements[2];
|
||||
BG_IC_GateState GateStatus[6];
|
||||
ICNodePoint nodePoint[7];
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const; // overwrited
|
||||
bool IsResourceGlutAllowed(TeamId teamId) const;
|
||||
void DoAction(uint32 action, uint64 guid);
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
uint32 docksTimer;
|
||||
uint32 resourceTimer;
|
||||
uint32 siegeEngineWorkshopTimer;
|
||||
uint16 factionReinforcements[2];
|
||||
BG_IC_GateState GateStatus[6];
|
||||
ICNodePoint nodePoint[7];
|
||||
|
||||
typedef std::map<uint32, uint32> RespawnMap;
|
||||
RespawnMap respawnMap;
|
||||
typedef std::map<uint32, uint32> RespawnMap;
|
||||
RespawnMap respawnMap;
|
||||
|
||||
MotionTransport* gunshipAlliance;
|
||||
MotionTransport* gunshipHorde;
|
||||
MotionTransport* gunshipAlliance;
|
||||
MotionTransport* gunshipHorde;
|
||||
|
||||
uint32 GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve);
|
||||
uint32 GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve);
|
||||
|
||||
uint32 GetGateIDFromEntry(uint32 id)
|
||||
uint32 GetGateIDFromEntry(uint32 id)
|
||||
{
|
||||
uint32 i = 0;
|
||||
switch (id)
|
||||
{
|
||||
uint32 i = 0;
|
||||
switch (id)
|
||||
{
|
||||
case GO_HORDE_GATE_1: i = BG_IC_H_FRONT; break;
|
||||
case GO_HORDE_GATE_2: i = BG_IC_H_EAST; break;
|
||||
case GO_HORDE_GATE_3: i = BG_IC_H_WEST; break;
|
||||
case GO_ALLIANCE_GATE_3: i = BG_IC_A_FRONT; break;
|
||||
case GO_ALLIANCE_GATE_1: i = BG_IC_A_WEST; break;
|
||||
case GO_ALLIANCE_GATE_2: i = BG_IC_A_EAST; break;
|
||||
}
|
||||
return i;
|
||||
case GO_HORDE_GATE_1:
|
||||
i = BG_IC_H_FRONT;
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
i = BG_IC_H_EAST;
|
||||
break;
|
||||
case GO_HORDE_GATE_3:
|
||||
i = BG_IC_H_WEST;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_3:
|
||||
i = BG_IC_A_FRONT;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_1:
|
||||
i = BG_IC_A_WEST;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_2:
|
||||
i = BG_IC_A_EAST;
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
uint32 GetWorldStateFromGateEntry(uint32 id, bool open)
|
||||
uint32 GetWorldStateFromGateEntry(uint32 id, bool open)
|
||||
{
|
||||
uint32 uws = 0;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
uint32 uws = 0;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case GO_HORDE_GATE_1:
|
||||
uws = (open ? BG_IC_GATE_FRONT_H_WS_OPEN : BG_IC_GATE_FRONT_H_WS_CLOSED);
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
uws = (open ? BG_IC_GATE_EAST_H_WS_OPEN : BG_IC_GATE_EAST_H_WS_CLOSED);
|
||||
break;
|
||||
case GO_HORDE_GATE_3:
|
||||
uws = (open ? BG_IC_GATE_WEST_H_WS_OPEN : BG_IC_GATE_WEST_H_WS_CLOSED);
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_3:
|
||||
uws = (open ? BG_IC_GATE_FRONT_A_WS_OPEN : BG_IC_GATE_FRONT_A_WS_CLOSED);
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_1:
|
||||
uws = (open ? BG_IC_GATE_WEST_A_WS_OPEN : BG_IC_GATE_WEST_A_WS_CLOSED);
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_2:
|
||||
uws = (open ? BG_IC_GATE_EAST_A_WS_OPEN : BG_IC_GATE_EAST_A_WS_CLOSED);
|
||||
break;
|
||||
}
|
||||
return uws;
|
||||
case GO_HORDE_GATE_1:
|
||||
uws = (open ? BG_IC_GATE_FRONT_H_WS_OPEN : BG_IC_GATE_FRONT_H_WS_CLOSED);
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
uws = (open ? BG_IC_GATE_EAST_H_WS_OPEN : BG_IC_GATE_EAST_H_WS_CLOSED);
|
||||
break;
|
||||
case GO_HORDE_GATE_3:
|
||||
uws = (open ? BG_IC_GATE_WEST_H_WS_OPEN : BG_IC_GATE_WEST_H_WS_CLOSED);
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_3:
|
||||
uws = (open ? BG_IC_GATE_FRONT_A_WS_OPEN : BG_IC_GATE_FRONT_A_WS_CLOSED);
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_1:
|
||||
uws = (open ? BG_IC_GATE_WEST_A_WS_OPEN : BG_IC_GATE_WEST_A_WS_CLOSED);
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_2:
|
||||
uws = (open ? BG_IC_GATE_EAST_A_WS_OPEN : BG_IC_GATE_EAST_A_WS_CLOSED);
|
||||
break;
|
||||
}
|
||||
return uws;
|
||||
}
|
||||
|
||||
void UpdateNodeWorldState(ICNodePoint* nodePoint);
|
||||
void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture);
|
||||
void HandleContestedNodes(ICNodePoint* nodePoint);
|
||||
void TurnBosses(bool on);
|
||||
void UpdateNodeWorldState(ICNodePoint* nodePoint);
|
||||
void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture);
|
||||
void HandleContestedNodes(ICNodePoint* nodePoint);
|
||||
void TurnBosses(bool on);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||
}
|
||||
}
|
||||
|
||||
void BattlegroundNA::FillInitialWorldStates(WorldPacket &data)
|
||||
void BattlegroundNA::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0xa11) << uint32(1); // 9
|
||||
Battleground::UpdateArenaWorldState();
|
||||
|
|
@ -121,15 +121,15 @@ bool BattlegroundNA::SetupBattleground()
|
|||
{
|
||||
// gates
|
||||
if ( !AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854f, 2966.833f, 12.0462f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179f, 2874.97f, 12.00171f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709f, 2981.777f, 10.70117f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064f, 2858.438f, 10.23631f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|
||||
|| !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_NA_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 4090.46f, 2875.43f, 12.16f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_NA_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 4022.82f, 2966.61f, 12.17f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179f, 2874.97f, 12.00171f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709f, 2981.777f, 10.70117f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064f, 2858.438f, 10.23631f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|
||||
|| !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_NA_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 4090.46f, 2875.43f, 12.16f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_NA_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 4022.82f, 2966.61f, 12.17f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundNA: Failed to spawn some object!");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -33,21 +33,21 @@ enum BattlegroundNAObjects
|
|||
|
||||
class BattlegroundNA : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundNA();
|
||||
~BattlegroundNA();
|
||||
public:
|
||||
BattlegroundNA();
|
||||
~BattlegroundNA();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket& d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||
}
|
||||
}
|
||||
|
||||
void BattlegroundRL::FillInitialWorldStates(WorldPacket &data)
|
||||
void BattlegroundRL::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0xbba) << uint32(1); // 9
|
||||
Battleground::UpdateArenaWorldState();
|
||||
|
|
@ -147,13 +147,13 @@ bool BattlegroundRL::SetupBattleground()
|
|||
{
|
||||
// gates
|
||||
if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561f, 1601.938f, 31.60557f, -1.457349f, 0, 0, -0.6658813f, 0.7460576f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648f, 1730.557f, 31.60557f, 1.684245f, 0, 0, 0.7460582f, 0.6658807f, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_RL_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 1298.61f, 1598.59f, 31.62f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_RL_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 1273.71f, 1734.05f, 31.61f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
|| !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648f, 1730.557f, 31.60557f, 1.684245f, 0, 0, 0.7460582f, 0.6658807f, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_RL_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 1298.61f, 1598.59f, 31.62f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_RL_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 1273.71f, 1734.05f, 31.61f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundRL: Failed to spawn some object!");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -29,21 +29,21 @@ enum BattlegroundRLObjects
|
|||
|
||||
class BattlegroundRL : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundRL();
|
||||
~BattlegroundRL();
|
||||
public:
|
||||
BattlegroundRL();
|
||||
~BattlegroundRL();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket& d);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void BattlegroundRV::CheckPositionForUnit(Unit* unit)
|
|||
{
|
||||
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
|
||||
if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f)
|
||||
TeleportUnitToNewZ(unit, groundZ+1.0f, true);
|
||||
TeleportUnitToNewZ(unit, groundZ + 1.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
|||
// fix ground on elevators (so aoe spells can be casted there)
|
||||
{
|
||||
uint32 objects[2] = {BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_ELEVATOR_2};
|
||||
for (uint8 i=0; i<2; ++i)
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
if (GameObject* go = GetBGObject(objects[i]))
|
||||
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_TRANSPORT);
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||
}
|
||||
}
|
||||
|
||||
void BattlegroundRV::FillInitialWorldStates(WorldPacket &data)
|
||||
void BattlegroundRV::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
|
|
@ -253,37 +253,37 @@ bool BattlegroundRV::SetupBattleground()
|
|||
{
|
||||
// elevators
|
||||
if (!AddObject(BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_TYPE_ELEVATOR_1, 763.536377f, -294.535767f, 0.505383f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_ELEVATOR_2, BG_RV_OBJECT_TYPE_ELEVATOR_2, 763.506348f, -273.873352f, 0.505383f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RV_OBJECT_BUFF_1, BG_RV_OBJECT_TYPE_BUFF_1, 735.551819f, -284.794678f, 28.276682f, 0.034906f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_BUFF_2, BG_RV_OBJECT_TYPE_BUFF_2, 791.224487f, -284.794464f, 28.276682f, 2.600535f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// fire
|
||||
|| !AddObject(BG_RV_OBJECT_FIRE_1, BG_RV_OBJECT_TYPE_FIRE_1, 743.543457f, -283.799469f, 28.286655f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIRE_2, BG_RV_OBJECT_TYPE_FIRE_2, 782.971802f, -283.799469f, 28.286655f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIREDOOR_1, BG_RV_OBJECT_TYPE_FIREDOOR_1, 743.711060f, -284.099609f, 27.542587f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIREDOOR_2, BG_RV_OBJECT_TYPE_FIREDOOR_2, 783.221252f, -284.133362f, 27.535686f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Gear
|
||||
|| !AddObject(BG_RV_OBJECT_GEAR_1, BG_RV_OBJECT_TYPE_GEAR_1, 763.664551f, -261.872986f, 26.686588f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_GEAR_2, BG_RV_OBJECT_TYPE_GEAR_2, 763.578979f, -306.146149f, 26.665222f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Pulley
|
||||
|| !AddObject(BG_RV_OBJECT_PULLEY_1, BG_RV_OBJECT_TYPE_PULLEY_1, 700.722290f, -283.990662f, 39.517582f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PULLEY_2, BG_RV_OBJECT_TYPE_PULLEY_2, 826.303833f, -283.996429f, 39.517582f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Pilars
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_1, BG_RV_OBJECT_TYPE_PILAR_1, 763.632385f, -306.162384f, 25.909504f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_2, BG_RV_OBJECT_TYPE_PILAR_2, 723.644287f, -284.493256f, 24.648525f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_3, BG_RV_OBJECT_TYPE_PILAR_3, 763.611145f, -261.856750f, 25.909504f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_TYPE_PILAR_4, 802.211609f, -284.493256f, 24.648525f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_ELEVATOR_2, BG_RV_OBJECT_TYPE_ELEVATOR_2, 763.506348f, -273.873352f, 0.505383f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RV_OBJECT_BUFF_1, BG_RV_OBJECT_TYPE_BUFF_1, 735.551819f, -284.794678f, 28.276682f, 0.034906f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_BUFF_2, BG_RV_OBJECT_TYPE_BUFF_2, 791.224487f, -284.794464f, 28.276682f, 2.600535f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// fire
|
||||
|| !AddObject(BG_RV_OBJECT_FIRE_1, BG_RV_OBJECT_TYPE_FIRE_1, 743.543457f, -283.799469f, 28.286655f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIRE_2, BG_RV_OBJECT_TYPE_FIRE_2, 782.971802f, -283.799469f, 28.286655f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIREDOOR_1, BG_RV_OBJECT_TYPE_FIREDOOR_1, 743.711060f, -284.099609f, 27.542587f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIREDOOR_2, BG_RV_OBJECT_TYPE_FIREDOOR_2, 783.221252f, -284.133362f, 27.535686f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Gear
|
||||
|| !AddObject(BG_RV_OBJECT_GEAR_1, BG_RV_OBJECT_TYPE_GEAR_1, 763.664551f, -261.872986f, 26.686588f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_GEAR_2, BG_RV_OBJECT_TYPE_GEAR_2, 763.578979f, -306.146149f, 26.665222f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Pulley
|
||||
|| !AddObject(BG_RV_OBJECT_PULLEY_1, BG_RV_OBJECT_TYPE_PULLEY_1, 700.722290f, -283.990662f, 39.517582f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PULLEY_2, BG_RV_OBJECT_TYPE_PULLEY_2, 826.303833f, -283.996429f, 39.517582f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Pilars
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_1, BG_RV_OBJECT_TYPE_PILAR_1, 763.632385f, -306.162384f, 25.909504f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_2, BG_RV_OBJECT_TYPE_PILAR_2, 723.644287f, -284.493256f, 24.648525f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_3, BG_RV_OBJECT_TYPE_PILAR_3, 763.611145f, -261.856750f, 25.909504f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_TYPE_PILAR_4, 802.211609f, -284.493256f, 24.648525f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_RV_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 769.93f, -301.04f, 2.80f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_RV_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 757.02f, -267.30f, 2.80f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
)
|
||||
// Arena Ready Marker
|
||||
|| !AddObject(BG_RV_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 769.93f, -301.04f, 2.80f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
|| !AddObject(BG_RV_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 757.02f, -267.30f, 2.80f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|
||||
)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint8 i=0; i<BG_RV_OBJECT_MAX; ++i)
|
||||
for (uint8 i = 0; i < BG_RV_OBJECT_MAX; ++i)
|
||||
if (GameObject* go = GetBGObject(i))
|
||||
go->SetPhaseMask(3, true);
|
||||
|
||||
|
|
@ -321,11 +321,11 @@ uint32 BattlegroundRV::GetPillarIdForPos(Position* p)
|
|||
float range = 1.75f;
|
||||
if (p->GetExactDist2d(763.632385f, -306.162384f) < range)
|
||||
return BG_RV_OBJECT_PILAR_1;
|
||||
if (p->GetExactDist2d(723.644287f, -284.493256f) < 2.0f*range)
|
||||
if (p->GetExactDist2d(723.644287f, -284.493256f) < 2.0f * range)
|
||||
return BG_RV_OBJECT_PILAR_2;
|
||||
if (p->GetExactDist2d(763.611145f, -261.856750f) < range)
|
||||
return BG_RV_OBJECT_PILAR_3;
|
||||
if (p->GetExactDist2d(802.211609f, -284.493256f) < 2.0f*range)
|
||||
if (p->GetExactDist2d(802.211609f, -284.493256f) < 2.0f * range)
|
||||
return BG_RV_OBJECT_PILAR_4;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,41 +76,41 @@ enum BattlegroundRVData
|
|||
|
||||
class BattlegroundRV : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundRV();
|
||||
~BattlegroundRV();
|
||||
public:
|
||||
BattlegroundRV();
|
||||
~BattlegroundRV();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void RemovePlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void UpdateArenaWorldState();
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void RemovePlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket& d);
|
||||
void UpdateArenaWorldState();
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
|
||||
GameObject* GetPillarAtPosition(Position* p);
|
||||
GameObject* GetPillarAtPosition(Position* p);
|
||||
|
||||
private:
|
||||
uint32 Timer;
|
||||
uint32 State;
|
||||
uint16 CheckPlayersTimer;
|
||||
private:
|
||||
uint32 Timer;
|
||||
uint32 State;
|
||||
uint16 CheckPlayersTimer;
|
||||
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
protected:
|
||||
uint32 getTimer() { return Timer; }
|
||||
void setTimer(uint32 timer) { Timer = timer; }
|
||||
uint32 getState() { return State; };
|
||||
void setState(uint32 state) { State = state; }
|
||||
protected:
|
||||
uint32 getTimer() { return Timer; }
|
||||
void setTimer(uint32 timer) { Timer = timer; }
|
||||
uint32 getState() { return State; };
|
||||
void setState(uint32 state) { State = state; }
|
||||
|
||||
void TeleportUnitToNewZ(Unit* unit, float newZ, bool casting);
|
||||
void CheckPositionForUnit(Unit* unit);
|
||||
void UpdatePillars();
|
||||
uint32 GetPillarIdForPos(Position* p);
|
||||
void TeleportUnitToNewZ(Unit* unit, float newZ, bool casting);
|
||||
void CheckPositionForUnit(Unit* unit);
|
||||
void UpdatePillars();
|
||||
uint32 GetPillarIdForPos(Position* p);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ bool BattlegroundSA::ResetObjs()
|
|||
uint32 atF = BG_SA_Factions[Attackers];
|
||||
uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE];
|
||||
|
||||
for (uint8 i = 0; i <BG_SA_MAXOBJ; i++)
|
||||
for (uint8 i = 0; i < BG_SA_MAXOBJ; i++)
|
||||
DelObject(i);
|
||||
|
||||
for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
|
||||
|
|
@ -99,30 +99,30 @@ bool BattlegroundSA::ResetObjs()
|
|||
|
||||
for (uint8 i = BG_SA_BOAT_ONE; i < BG_SA_SIGIL_1; i++)
|
||||
{
|
||||
uint32 boatid=0;
|
||||
uint32 boatid = 0;
|
||||
switch (i)
|
||||
{
|
||||
case BG_SA_BOAT_ONE:
|
||||
boatid= Attackers ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A;
|
||||
boatid = Attackers ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A;
|
||||
break;
|
||||
case BG_SA_BOAT_TWO:
|
||||
boatid= Attackers ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A;
|
||||
boatid = Attackers ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A;
|
||||
break;
|
||||
}
|
||||
if (!AddObject(i, boatid, BG_SA_ObjSpawnlocs[i][0],
|
||||
BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2]+(Attackers ? -3.750f: 0),
|
||||
BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2] + (Attackers ? -3.750f : 0),
|
||||
BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_SIGIL_1; i < BG_SA_CENTRAL_FLAG; i++)
|
||||
{
|
||||
if (!AddObject(i, BG_SA_ObjEntries[i],
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
|
||||
// MAD props for Kiper for discovering those values - 4 hours of his work.
|
||||
|
|
@ -136,9 +136,9 @@ bool BattlegroundSA::ResetObjs()
|
|||
for (uint8 i = 0; i < BG_SA_DEMOLISHER_5; i++)
|
||||
{
|
||||
if (!AddCreature(BG_SA_NpcEntries[i], i,
|
||||
BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
|
||||
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3], 600))
|
||||
return false;
|
||||
BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
|
||||
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3], 600))
|
||||
return false;
|
||||
}
|
||||
|
||||
OverrideGunFaction();
|
||||
|
|
@ -162,7 +162,7 @@ bool BattlegroundSA::ResetObjs()
|
|||
ShipsStarted = false;
|
||||
|
||||
//Graveyards!
|
||||
for (uint8 i = 0;i < BG_SA_MAX_GY; i++)
|
||||
for (uint8 i = 0; i < BG_SA_MAX_GY; i++)
|
||||
{
|
||||
GraveyardStruct const* sg = nullptr;
|
||||
sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
|
||||
|
|
@ -189,19 +189,19 @@ bool BattlegroundSA::ResetObjs()
|
|||
//GY capture points
|
||||
for (uint8 i = BG_SA_CENTRAL_FLAG; i < BG_SA_PORTAL_DEFFENDER_BLUE; i++)
|
||||
{
|
||||
AddObject(i, (BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1:0)),
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
AddObject(i, (BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1 : 0)),
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_PORTAL_DEFFENDER_BLUE; i < BG_SA_BOMB; i++)
|
||||
{
|
||||
AddObject(i, BG_SA_ObjEntries[i],
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
|
||||
}
|
||||
|
||||
|
|
@ -210,20 +210,20 @@ bool BattlegroundSA::ResetObjs()
|
|||
for (uint8 i = BG_SA_BOMB; i < BG_SA_MAXOBJ; i++)
|
||||
{
|
||||
AddObject(i, BG_SA_ObjEntries[BG_SA_BOMB],
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
|
||||
}
|
||||
|
||||
//Player may enter BEFORE we set up bG - lets update his worldstates anyway...
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
|
||||
UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
|
||||
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
|
||||
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
|
||||
|
||||
if (Attackers == TEAM_ALLIANCE)
|
||||
{
|
||||
|
|
@ -322,7 +322,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
|||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
Status = BG_SA_ROUND_ONE;
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702);
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE) ? 23748 : 21702);
|
||||
}
|
||||
if (TotalTime >= BG_SA_BOAT_START)
|
||||
StartShips();
|
||||
|
|
@ -330,7 +330,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
|||
}
|
||||
else if (Status == BG_SA_SECOND_WARMUP)
|
||||
{
|
||||
if (RoundScores[0].time<BG_SA_ROUNDLENGTH)
|
||||
if (RoundScores[0].time < BG_SA_ROUNDLENGTH)
|
||||
EndRoundTimer = RoundScores[0].time;
|
||||
else
|
||||
EndRoundTimer = BG_SA_ROUNDLENGTH;
|
||||
|
|
@ -342,8 +342,8 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
|||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
Status = BG_SA_ROUND_TWO;
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702);
|
||||
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE) ? 23748 : 21702);
|
||||
|
||||
// status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now
|
||||
SetStatus(STATUS_IN_PROGRESS);
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
|
|
@ -439,42 +439,42 @@ void BattlegroundSA::StartingEventOpenDoors()
|
|||
|
||||
void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
uint32 ally_attacks = uint32(Attackers == TEAM_ALLIANCE ? 1 : 0);
|
||||
uint32 horde_attacks = uint32(Attackers == TEAM_HORDE ? 1 : 0);
|
||||
uint32 ally_attacks = uint32(Attackers == TEAM_ALLIANCE ? 1 : 0);
|
||||
uint32 horde_attacks = uint32(Attackers == TEAM_HORDE ? 1 : 0);
|
||||
|
||||
data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]);
|
||||
data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]);
|
||||
data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]);
|
||||
data << uint32(BG_SA_BLUE_GATEWS) << uint32(GateStatus[BG_SA_BLUE_GATE]);
|
||||
data << uint32(BG_SA_RED_GATEWS) << uint32(GateStatus[BG_SA_RED_GATE]);
|
||||
data << uint32(BG_SA_PURPLE_GATEWS) << uint32(GateStatus[BG_SA_PURPLE_GATE]);
|
||||
data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]);
|
||||
data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]);
|
||||
data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]);
|
||||
data << uint32(BG_SA_BLUE_GATEWS) << uint32(GateStatus[BG_SA_BLUE_GATE]);
|
||||
data << uint32(BG_SA_RED_GATEWS) << uint32(GateStatus[BG_SA_RED_GATE]);
|
||||
data << uint32(BG_SA_PURPLE_GATEWS) << uint32(GateStatus[BG_SA_PURPLE_GATE]);
|
||||
|
||||
data << uint32(BG_SA_BONUS_TIMER) << uint32(0);
|
||||
data << uint32(BG_SA_BONUS_TIMER) << uint32(0);
|
||||
|
||||
data << uint32(BG_SA_HORDE_ATTACKS)<< horde_attacks;
|
||||
data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks;
|
||||
data << uint32(BG_SA_HORDE_ATTACKS) << horde_attacks;
|
||||
data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks;
|
||||
|
||||
//Time will be sent on first update...
|
||||
data << uint32(BG_SA_ENABLE_TIMER) << ((TimerEnabled) ? uint32(1) : uint32(0));
|
||||
data << uint32(BG_SA_TIMER_MINS) << uint32(0);
|
||||
data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0);
|
||||
data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0);
|
||||
//Time will be sent on first update...
|
||||
data << uint32(BG_SA_ENABLE_TIMER) << ((TimerEnabled) ? uint32(1) : uint32(0));
|
||||
data << uint32(BG_SA_TIMER_MINS) << uint32(0);
|
||||
data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0);
|
||||
data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0);
|
||||
|
||||
data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
|
||||
data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
|
||||
data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
|
||||
|
||||
data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
|
||||
data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
|
||||
data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
|
||||
|
||||
data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks;
|
||||
data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks;
|
||||
data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks;
|
||||
data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks;
|
||||
|
||||
data << uint32(BG_SA_LEFT_ATT_TOKEN_HRD) << horde_attacks;
|
||||
data << uint32(BG_SA_RIGHT_ATT_TOKEN_HRD) << horde_attacks;
|
||||
data << uint32(BG_SA_RIGHT_ATT_TOKEN_ALL) << ally_attacks;
|
||||
data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks;
|
||||
data << uint32(BG_SA_LEFT_ATT_TOKEN_HRD) << horde_attacks;
|
||||
data << uint32(BG_SA_RIGHT_ATT_TOKEN_HRD) << horde_attacks;
|
||||
data << uint32(BG_SA_RIGHT_ATT_TOKEN_ALL) << ally_attacks;
|
||||
data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks;
|
||||
}
|
||||
|
||||
void BattlegroundSA::AddPlayer(Player* player)
|
||||
|
|
@ -570,28 +570,28 @@ void BattlegroundSA::TeleportToEntrancePosition(Player* player)
|
|||
|
||||
void BattlegroundSA::DefendersPortalTeleport(GameObject* portal, Player* plr)
|
||||
{
|
||||
if (plr->GetTeamId() == Attackers)
|
||||
if (plr->GetTeamId() == Attackers)
|
||||
return;
|
||||
|
||||
uint32 portal_num = 0;
|
||||
//get it via X
|
||||
switch( (uint32)portal->GetPositionX() )
|
||||
{
|
||||
case 1394:
|
||||
portal_num = 0;
|
||||
break;
|
||||
case 1065:
|
||||
portal_num = 1;
|
||||
break;
|
||||
case 1468:
|
||||
portal_num = 2;
|
||||
break;
|
||||
case 1255:
|
||||
portal_num = 3;
|
||||
break;
|
||||
case 1216:
|
||||
portal_num = 4;
|
||||
break;
|
||||
case 1394:
|
||||
portal_num = 0;
|
||||
break;
|
||||
case 1065:
|
||||
portal_num = 1;
|
||||
break;
|
||||
case 1468:
|
||||
portal_num = 2;
|
||||
break;
|
||||
case 1255:
|
||||
portal_num = 3;
|
||||
break;
|
||||
case 1216:
|
||||
portal_num = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
plr->TeleportTo( plr->GetMapId(), SOTADefPortalDest[portal_num][0], SOTADefPortalDest[portal_num][1], SOTADefPortalDest[portal_num][2], SOTADefPortalDest[portal_num][3], TELE_TO_SPELL );
|
||||
|
|
@ -623,14 +623,14 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
|
|||
{
|
||||
case BG_SA_BLUE_GATE:
|
||||
case BG_SA_GREEN_GATE:
|
||||
{
|
||||
GameObject* go = nullptr;
|
||||
if ((go = GetBGObject(BG_SA_RED_GATE)))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if ((go = GetBGObject(BG_SA_PURPLE_GATE)))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
}
|
||||
{
|
||||
GameObject* go = nullptr;
|
||||
if ((go = GetBGObject(BG_SA_RED_GATE)))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if ((go = GetBGObject(BG_SA_PURPLE_GATE)))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
}
|
||||
case BG_SA_RED_GATE:
|
||||
case BG_SA_PURPLE_GATE:
|
||||
if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE))
|
||||
|
|
@ -666,13 +666,13 @@ void BattlegroundSA::OverrideGunFaction()
|
|||
if (!BgCreatures[0])
|
||||
return;
|
||||
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++)
|
||||
{
|
||||
if (Creature* gun = GetBGCreature(i))
|
||||
gun->setFaction(BG_SA_Factions[Attackers? TEAM_ALLIANCE : TEAM_HORDE]);
|
||||
gun->setFaction(BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++)
|
||||
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
|
||||
{
|
||||
if (Creature* dem = GetBGCreature(i))
|
||||
dem->setFaction(BG_SA_Factions[Attackers]);
|
||||
|
|
@ -693,7 +693,7 @@ void BattlegroundSA::DemolisherStartState(bool start)
|
|||
dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++)
|
||||
if (Creature* gun = GetBGCreature(i))
|
||||
{
|
||||
if (start)
|
||||
|
|
@ -704,7 +704,7 @@ void BattlegroundSA::DemolisherStartState(bool start)
|
|||
|
||||
// xinef: enable first gates damaging at start
|
||||
if (!start)
|
||||
{
|
||||
{
|
||||
if (GameObject* go = GetBGObject(BG_SA_GREEN_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE))
|
||||
|
|
@ -750,7 +750,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
|
|||
UpdateObjectInteractionFlags();
|
||||
|
||||
if (i < 5)
|
||||
DelObject(i+9);
|
||||
DelObject(i + 9);
|
||||
|
||||
if (player)
|
||||
{
|
||||
|
|
@ -776,7 +776,7 @@ GraveyardStruct const* BattlegroundSA::GetClosestGraveyard(Player* player)
|
|||
continue;
|
||||
|
||||
GraveyardStruct const* ret = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
|
||||
|
||||
|
||||
// if on beach
|
||||
if (i == BG_SA_BEACH_GY)
|
||||
{
|
||||
|
|
@ -802,9 +802,9 @@ GraveyardStruct const* BattlegroundSA::GetClosestGraveyard(Player* player)
|
|||
void BattlegroundSA::SendTime()
|
||||
{
|
||||
uint32 end_of_round = (EndRoundTimer - TotalTime);
|
||||
UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000);
|
||||
UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round%60000)/10000);
|
||||
UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000);
|
||||
UpdateWorldState(BG_SA_TIMER_MINS, end_of_round / 60000);
|
||||
UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round % 60000) / 10000);
|
||||
UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round % 60000) % 10000) / 1000);
|
||||
}
|
||||
|
||||
bool BattlegroundSA::CanInteractWithObject(uint32 objectId)
|
||||
|
|
@ -843,7 +843,7 @@ void BattlegroundSA::UpdateObjectInteractionFlags(uint32 objectId)
|
|||
if (GameObject* go = GetBGObject(objectId))
|
||||
{
|
||||
if (CanInteractWithObject(objectId))
|
||||
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE|GO_FLAG_INTERACT_COND|GO_FLAG_IN_USE);
|
||||
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE | GO_FLAG_INTERACT_COND | GO_FLAG_IN_USE);
|
||||
else
|
||||
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
|
@ -880,7 +880,7 @@ void BattlegroundSA::EventPlayerClickedOnFlag(Player* Source, GameObject* gameOb
|
|||
};
|
||||
}
|
||||
|
||||
void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
||||
void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
|
||||
{
|
||||
if (GraveyardStatus[i] == Attackers || Source->GetTeamId() != Attackers)
|
||||
return;
|
||||
|
|
@ -908,7 +908,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
|||
}
|
||||
|
||||
DelCreature(BG_SA_MAXNPC + i);
|
||||
|
||||
|
||||
GraveyardStruct const* sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
|
||||
if (!sg)
|
||||
{
|
||||
|
|
@ -925,20 +925,20 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
|||
case BG_SA_LEFT_CAPTURABLE_GY:
|
||||
flag = BG_SA_LEFT_FLAG;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
|
||||
npc = BG_SA_NPC_RIGSPARK;
|
||||
AddCreature(BG_SA_NpcEntries[npc], npc, Attackers,
|
||||
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
|
||||
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
|
||||
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
|
||||
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
|
||||
|
||||
for (uint8 j = BG_SA_DEMOLISHER_7; j <= BG_SA_DEMOLISHER_8; j++)
|
||||
{
|
||||
AddCreature(BG_SA_NpcEntries[j], j,
|
||||
BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1],
|
||||
BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
|
||||
BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1],
|
||||
BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
|
||||
|
||||
if (Creature* dem = GetBGCreature(j))
|
||||
dem->setFaction(BG_SA_Factions[Attackers]);
|
||||
|
|
@ -954,19 +954,19 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
|||
case BG_SA_RIGHT_CAPTURABLE_GY:
|
||||
flag = BG_SA_RIGHT_FLAG;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
|
||||
npc = BG_SA_NPC_SPARKLIGHT;
|
||||
AddCreature(BG_SA_NpcEntries[npc], npc,
|
||||
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
|
||||
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
|
||||
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
|
||||
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
|
||||
|
||||
for (uint8 j = BG_SA_DEMOLISHER_5; j <= BG_SA_DEMOLISHER_6; j++)
|
||||
{
|
||||
AddCreature(BG_SA_NpcEntries[j], j, BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1],
|
||||
BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
|
||||
BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
|
||||
|
||||
if (Creature* dem = GetBGCreature(j))
|
||||
dem->setFaction(BG_SA_Factions[Attackers]);
|
||||
|
|
@ -982,12 +982,12 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
|||
case BG_SA_CENTRAL_CAPTURABLE_GY:
|
||||
flag = BG_SA_CENTRAL_FLAG;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_SOUTH);
|
||||
else
|
||||
|
|
@ -1065,14 +1065,14 @@ void BattlegroundSA::UpdateDemolisherSpawns()
|
|||
// Demolisher is not in list
|
||||
if (DemoliserRespawnList.find(i) == DemoliserRespawnList.end())
|
||||
{
|
||||
DemoliserRespawnList[i] = World::GetGameTimeMS()+30000;
|
||||
DemoliserRespawnList[i] = World::GetGameTimeMS() + 30000;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DemoliserRespawnList[i] < World::GetGameTimeMS())
|
||||
{
|
||||
Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
|
||||
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);
|
||||
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);
|
||||
|
||||
Demolisher->SetVisible(true);
|
||||
Demolisher->Respawn();
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ enum BG_SA_Objects
|
|||
BG_SA_PORTAL_DEFFENDER_PURPLE,
|
||||
BG_SA_PORTAL_DEFFENDER_RED,
|
||||
BG_SA_BOMB,
|
||||
BG_SA_MAXOBJ = BG_SA_BOMB+68
|
||||
BG_SA_MAXOBJ = BG_SA_BOMB + 68
|
||||
};
|
||||
|
||||
float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
|
||||
|
|
@ -407,7 +407,8 @@ struct BG_SA_RoundScore
|
|||
uint32 time;
|
||||
};
|
||||
|
||||
const float SOTADefPortalDest[5][4] = {
|
||||
const float SOTADefPortalDest[5][4] =
|
||||
{
|
||||
{ 1388.94f, 103.067f, 34.49f, 5.4571f },
|
||||
{ 1043.69f, -87.95f, 87.12f, 0.003f },
|
||||
{ 1441.0411f, -240.974f, 35.264f, 0.949f },
|
||||
|
|
@ -418,180 +419,204 @@ const float SOTADefPortalDest[5][4] = {
|
|||
/// Class for manage Strand of Ancient battleground
|
||||
class BattlegroundSA : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundSA();
|
||||
~BattlegroundSA();
|
||||
public:
|
||||
BattlegroundSA();
|
||||
~BattlegroundSA();
|
||||
|
||||
/**
|
||||
* \brief Called every time for update battle data
|
||||
* -Update timer
|
||||
* -Round switch
|
||||
*/
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
/**
|
||||
* \brief Called every time for update battle data
|
||||
* -Update timer
|
||||
* -Round switch
|
||||
*/
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
/// Called when a player join battle
|
||||
void AddPlayer(Player* player);
|
||||
/// Called when battle start
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/// Called for ini battleground, after that the first player be entered
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
/// Called for generate packet contain worldstate data
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
/// Called when a player deal damage to building (door)
|
||||
void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
|
||||
/// Called when a player kill a unit in bg
|
||||
void HandleKillUnit(Creature* creature, Player* killer);
|
||||
/// Return the nearest graveyard where player can respawn
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
/// Called when a player click on flag (graveyard flag)
|
||||
void EventPlayerClickedOnFlag(Player* Source, GameObject* gameObject);
|
||||
/// Called when a player use a gamobject (relic)
|
||||
void EventPlayerUsedGO(Player* Source, GameObject* object);
|
||||
|
||||
/// Return worldstate id, according to door id
|
||||
uint32 GetWorldStateFromGateID(uint32 id)
|
||||
/* inherited from BattlegroundClass */
|
||||
/// Called when a player join battle
|
||||
void AddPlayer(Player* player);
|
||||
/// Called when battle start
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/// Called for ini battleground, after that the first player be entered
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
/// Called for generate packet contain worldstate data
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
/// Called when a player deal damage to building (door)
|
||||
void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
|
||||
/// Called when a player kill a unit in bg
|
||||
void HandleKillUnit(Creature* creature, Player* killer);
|
||||
/// Return the nearest graveyard where player can respawn
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
/// Called when a player click on flag (graveyard flag)
|
||||
void EventPlayerClickedOnFlag(Player* Source, GameObject* gameObject);
|
||||
/// Called when a player use a gamobject (relic)
|
||||
void EventPlayerUsedGO(Player* Source, GameObject* object);
|
||||
|
||||
/// Return worldstate id, according to door id
|
||||
uint32 GetWorldStateFromGateID(uint32 id)
|
||||
{
|
||||
uint32 uws = 0;
|
||||
switch (id)
|
||||
{
|
||||
uint32 uws = 0;
|
||||
switch (id)
|
||||
{
|
||||
case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break;
|
||||
case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break;
|
||||
case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break;
|
||||
case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break;
|
||||
case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break;
|
||||
case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break;
|
||||
}
|
||||
return uws;
|
||||
case BG_SA_GREEN_GATE:
|
||||
uws = BG_SA_GREEN_GATEWS;
|
||||
break;
|
||||
case BG_SA_YELLOW_GATE:
|
||||
uws = BG_SA_YELLOW_GATEWS;
|
||||
break;
|
||||
case BG_SA_BLUE_GATE:
|
||||
uws = BG_SA_BLUE_GATEWS;
|
||||
break;
|
||||
case BG_SA_RED_GATE:
|
||||
uws = BG_SA_RED_GATEWS;
|
||||
break;
|
||||
case BG_SA_PURPLE_GATE:
|
||||
uws = BG_SA_PURPLE_GATEWS;
|
||||
break;
|
||||
case BG_SA_ANCIENT_GATE:
|
||||
uws = BG_SA_ANCIENT_GATEWS;
|
||||
break;
|
||||
}
|
||||
return uws;
|
||||
}
|
||||
|
||||
/// Called on battleground ending
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
/// Called on battleground ending
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
|
||||
/// CAlled when a player leave battleground
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
/// CAlled when a player leave battleground
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
|
||||
/* Scorekeeping */
|
||||
/// Update score board
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
/* Scorekeeping */
|
||||
/// Update score board
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
// Teleporters
|
||||
void DefendersPortalTeleport(GameObject* portal, Player* plr);
|
||||
// Teleporters
|
||||
void DefendersPortalTeleport(GameObject* portal, Player* plr);
|
||||
|
||||
// Achievements
|
||||
bool AllowDefenseOfTheAncients(Player* source);
|
||||
// Achievements
|
||||
bool AllowDefenseOfTheAncients(Player* source);
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool notEvenAScratch(TeamId teamId) const { return _notEvenAScratch[teamId]; }
|
||||
// Achievement: Not Even a Scratch
|
||||
bool notEvenAScratch(TeamId teamId) const { return _notEvenAScratch[teamId]; }
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
/// Return gate id, relative to bg data, according to gameobject id
|
||||
uint32 GetGateIDFromEntry(uint32 id)
|
||||
/// Return gate id, relative to bg data, according to gameobject id
|
||||
uint32 GetGateIDFromEntry(uint32 id)
|
||||
{
|
||||
uint32 i = 0;
|
||||
switch(id)
|
||||
{
|
||||
uint32 i = 0;
|
||||
switch(id)
|
||||
{
|
||||
case 190722: i = BG_SA_GREEN_GATE; break; //Green gate destroyed
|
||||
case 190724: i = BG_SA_BLUE_GATE; break; //blue gate
|
||||
case 190726: i = BG_SA_RED_GATE; break; //red gate
|
||||
case 190723: i = BG_SA_PURPLE_GATE; break; //purple gate
|
||||
case 190727: i = BG_SA_YELLOW_GATE; break; //yellow gate
|
||||
case 192549: i = BG_SA_ANCIENT_GATE; break; //ancient gate
|
||||
}
|
||||
return i;
|
||||
case 190722:
|
||||
i = BG_SA_GREEN_GATE;
|
||||
break; //Green gate destroyed
|
||||
case 190724:
|
||||
i = BG_SA_BLUE_GATE;
|
||||
break; //blue gate
|
||||
case 190726:
|
||||
i = BG_SA_RED_GATE;
|
||||
break; //red gate
|
||||
case 190723:
|
||||
i = BG_SA_PURPLE_GATE;
|
||||
break; //purple gate
|
||||
case 190727:
|
||||
i = BG_SA_YELLOW_GATE;
|
||||
break; //yellow gate
|
||||
case 192549:
|
||||
i = BG_SA_ANCIENT_GATE;
|
||||
break; //ancient gate
|
||||
}
|
||||
/**
|
||||
* \brief Called on setup and between the two round
|
||||
* -Delete all gameobject / creature
|
||||
* -Respawn all gameobject / creature to have good faction
|
||||
*/
|
||||
bool ResetObjs();
|
||||
/// Called for start ship movement
|
||||
void StartShips();
|
||||
/**
|
||||
* \brief Called between the two round
|
||||
* -Teleport all players to good location
|
||||
*/
|
||||
void TeleportPlayers();
|
||||
void TeleportToEntrancePosition(Player* player);
|
||||
/**
|
||||
* \brief Called on start and between the two round
|
||||
* -Update faction of all vehicle
|
||||
*/
|
||||
void OverrideGunFaction();
|
||||
/// Set selectable or not demolisher, called on battle start, when boats arrive to dock
|
||||
void DemolisherStartState(bool start);
|
||||
/// Checks if a player can interact with the given object
|
||||
bool CanInteractWithObject(uint32 objectId);
|
||||
/// Updates interaction flags of specific objects
|
||||
void UpdateObjectInteractionFlags(uint32 objectId);
|
||||
void UpdateObjectInteractionFlags();
|
||||
/**
|
||||
* \brief Called when a gate is destroy
|
||||
* -Give honor to player witch destroy it
|
||||
* -Update worldstate
|
||||
* -Delete gameobject in front of door (lighting object, with different colours for each door)
|
||||
*/
|
||||
void DestroyGate(Player* player, GameObject* go);
|
||||
/// Update timer worldstate
|
||||
void SendTime();
|
||||
/**
|
||||
* \brief Called when a graveyard is capture
|
||||
* -Update spiritguide
|
||||
* -Update gameobject (flag)
|
||||
* -Update Worldstate
|
||||
* -Send warning for announce this
|
||||
* \param i : id of graveyard
|
||||
* \param Source : Player who capture gy
|
||||
*/
|
||||
void CaptureGraveyard(BG_SA_Graveyards i, Player* Source);
|
||||
/// Switch on/off timer worldstate
|
||||
void ToggleTimer();
|
||||
return i;
|
||||
}
|
||||
/**
|
||||
* \brief Called on setup and between the two round
|
||||
* -Delete all gameobject / creature
|
||||
* -Respawn all gameobject / creature to have good faction
|
||||
*/
|
||||
bool ResetObjs();
|
||||
/// Called for start ship movement
|
||||
void StartShips();
|
||||
/**
|
||||
* \brief Called between the two round
|
||||
* -Teleport all players to good location
|
||||
*/
|
||||
void TeleportPlayers();
|
||||
void TeleportToEntrancePosition(Player* player);
|
||||
/**
|
||||
* \brief Called on start and between the two round
|
||||
* -Update faction of all vehicle
|
||||
*/
|
||||
void OverrideGunFaction();
|
||||
/// Set selectable or not demolisher, called on battle start, when boats arrive to dock
|
||||
void DemolisherStartState(bool start);
|
||||
/// Checks if a player can interact with the given object
|
||||
bool CanInteractWithObject(uint32 objectId);
|
||||
/// Updates interaction flags of specific objects
|
||||
void UpdateObjectInteractionFlags(uint32 objectId);
|
||||
void UpdateObjectInteractionFlags();
|
||||
/**
|
||||
* \brief Called when a gate is destroy
|
||||
* -Give honor to player witch destroy it
|
||||
* -Update worldstate
|
||||
* -Delete gameobject in front of door (lighting object, with different colours for each door)
|
||||
*/
|
||||
void DestroyGate(Player* player, GameObject* go);
|
||||
/// Update timer worldstate
|
||||
void SendTime();
|
||||
/**
|
||||
* \brief Called when a graveyard is capture
|
||||
* -Update spiritguide
|
||||
* -Update gameobject (flag)
|
||||
* -Update Worldstate
|
||||
* -Send warning for announce this
|
||||
* \param i : id of graveyard
|
||||
* \param Source : Player who capture gy
|
||||
*/
|
||||
void CaptureGraveyard(BG_SA_Graveyards i, Player* Source);
|
||||
/// Switch on/off timer worldstate
|
||||
void ToggleTimer();
|
||||
|
||||
/// Respawn dead demolisher
|
||||
void UpdateDemolisherSpawns();
|
||||
/// Respawn dead demolisher
|
||||
void UpdateDemolisherSpawns();
|
||||
|
||||
/// Send packet to player for create boats (client part)
|
||||
void SendTransportInit(Player* player);
|
||||
/// Send packet to player for destroy boats (client part)
|
||||
void SendTransportsRemove(Player* player);
|
||||
/// Send packet to player for create boats (client part)
|
||||
void SendTransportInit(Player* player);
|
||||
/// Send packet to player for destroy boats (client part)
|
||||
void SendTransportsRemove(Player* player);
|
||||
|
||||
/// Id of attacker team
|
||||
TeamId Attackers;
|
||||
/// Totale elapsed time of current round
|
||||
uint32 TotalTime;
|
||||
/// Max time of round
|
||||
uint32 EndRoundTimer;
|
||||
/// For know if boats has start moving or not yet
|
||||
bool ShipsStarted;
|
||||
/// Status of each gate (Destroy/Damage/Intact)
|
||||
BG_SA_GateState GateStatus[6];
|
||||
/// Statu of battle (Start or not, and what round)
|
||||
BG_SA_Status Status;
|
||||
/// Team witch conntrol each graveyard
|
||||
TeamId GraveyardStatus[BG_SA_MAX_GY];
|
||||
/// Score of each round
|
||||
BG_SA_RoundScore RoundScores[2];
|
||||
/// used for know we are in timer phase or not (used for worldstate update)
|
||||
bool TimerEnabled;
|
||||
/// 5secs before starting the 1min countdown for second round
|
||||
uint32 UpdateWaitTimer;
|
||||
/// for know if warning about second round start has been sent
|
||||
bool SignaledRoundTwo;
|
||||
/// for know if warning about second round start has been sent
|
||||
bool SignaledRoundTwoHalfMin;
|
||||
/// for know if second round has been init
|
||||
bool InitSecondRound;
|
||||
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
|
||||
/// Id of attacker team
|
||||
TeamId Attackers;
|
||||
/// Totale elapsed time of current round
|
||||
uint32 TotalTime;
|
||||
/// Max time of round
|
||||
uint32 EndRoundTimer;
|
||||
/// For know if boats has start moving or not yet
|
||||
bool ShipsStarted;
|
||||
/// Status of each gate (Destroy/Damage/Intact)
|
||||
BG_SA_GateState GateStatus[6];
|
||||
/// Statu of battle (Start or not, and what round)
|
||||
BG_SA_Status Status;
|
||||
/// Team witch conntrol each graveyard
|
||||
TeamId GraveyardStatus[BG_SA_MAX_GY];
|
||||
/// Score of each round
|
||||
BG_SA_RoundScore RoundScores[2];
|
||||
/// used for know we are in timer phase or not (used for worldstate update)
|
||||
bool TimerEnabled;
|
||||
/// 5secs before starting the 1min countdown for second round
|
||||
uint32 UpdateWaitTimer;
|
||||
/// for know if warning about second round start has been sent
|
||||
bool SignaledRoundTwo;
|
||||
/// for know if warning about second round start has been sent
|
||||
bool SignaledRoundTwoHalfMin;
|
||||
/// for know if second round has been init
|
||||
bool InitSecondRound;
|
||||
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
|
||||
|
||||
// xinef:
|
||||
bool _relicClicked;
|
||||
// xinef:
|
||||
bool _relicClicked;
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool _notEvenAScratch[BG_TEAMS_COUNT];
|
||||
// Achievement: Not Even a Scratch
|
||||
bool _notEvenAScratch[BG_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
|
@ -49,7 +49,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
|||
{
|
||||
case BG_WS_EVENT_UPDATE_GAME_TIME:
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime());
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE * IN_MILLISECONDS)) + 1);
|
||||
break;
|
||||
case BG_WS_EVENT_NO_TIME_LEFT:
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE))
|
||||
|
|
@ -120,7 +120,7 @@ void BattlegroundWS::StartingEventOpenDoors()
|
|||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE);
|
||||
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2 * MINUTE * IN_MILLISECONDS); // 27 - 2 = 25 minutes
|
||||
}
|
||||
|
||||
void BattlegroundWS::AddPlayer(Player* player)
|
||||
|
|
@ -299,7 +299,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
if (uint32 assaultSpellId = GetAssaultSpellId())
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
|
@ -330,7 +330,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
if (uint32 assaultSpellId = GetAssaultSpellId())
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
|
|
@ -385,26 +385,26 @@ bool BattlegroundWS::SetupBattleground()
|
|||
// flags
|
||||
AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_WS_ENTRY, 916.0226f, 1434.405f, 345.413f, 0.01745329f, 0, 0, 0.008726535f, 0.9999619f, RESPAWN_IMMEDIATELY);
|
||||
// buffs
|
||||
// buffs
|
||||
AddObject(BG_WS_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1449.93f, 1470.71f, 342.6346f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME);
|
||||
AddObject(BG_WS_OBJECT_SPEEDBUFF_2, BG_OBJECTID_SPEEDBUFF_ENTRY, 1005.171f, 1447.946f, 335.9032f, 1.64061f, 0, 0, 0.7313537f, 0.6819984f, BUFF_RESPAWN_TIME);
|
||||
AddObject(BG_WS_OBJECT_REGENBUFF_1, BG_OBJECTID_REGENBUFF_ENTRY, 1317.506f, 1550.851f, 313.2344f, -0.2617996f, 0, 0, 0.1305263f, -0.9914448f, BUFF_RESPAWN_TIME);
|
||||
AddObject(BG_WS_OBJECT_REGENBUFF_2, BG_OBJECTID_REGENBUFF_ENTRY, 1110.451f, 1353.656f, 316.5181f, -0.6806787f, 0, 0, 0.333807f, -0.9426414f, BUFF_RESPAWN_TIME);
|
||||
AddObject(BG_WS_OBJECT_BERSERKBUFF_1, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1320.09f, 1378.79f, 314.7532f, 1.186824f, 0, 0, 0.5591929f, 0.8290376f, BUFF_RESPAWN_TIME);
|
||||
AddObject(BG_WS_OBJECT_BERSERKBUFF_2, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1139.688f, 1560.288f, 306.8432f, -2.443461f, 0, 0, 0.9396926f, -0.3420201f, BUFF_RESPAWN_TIME);
|
||||
// alliance gates
|
||||
// alliance gates
|
||||
AddObject(BG_WS_OBJECT_DOOR_A_1, BG_OBJECT_DOOR_A_1_WS_ENTRY, 1503.335f, 1493.466f, 352.1888f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_A_2, BG_OBJECT_DOOR_A_2_WS_ENTRY, 1492.478f, 1457.912f, 342.9689f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_A_3, BG_OBJECT_DOOR_A_3_WS_ENTRY, 1468.503f, 1494.357f, 351.8618f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_A_4, BG_OBJECT_DOOR_A_4_WS_ENTRY, 1471.555f, 1458.778f, 362.6332f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_A_5, BG_OBJECT_DOOR_A_5_WS_ENTRY, 1492.347f, 1458.34f, 342.3712f, -0.03490669f, 0, 0, 0.01745246f, -0.9998477f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_A_6, BG_OBJECT_DOOR_A_6_WS_ENTRY, 1503.466f, 1493.367f, 351.7352f, -0.03490669f, 0, 0, 0.01745246f, -0.9998477f, RESPAWN_IMMEDIATELY);
|
||||
// horde gates
|
||||
// horde gates
|
||||
AddObject(BG_WS_OBJECT_DOOR_H_1, BG_OBJECT_DOOR_H_1_WS_ENTRY, 949.1663f, 1423.772f, 345.6241f, -0.5756807f, -0.01673368f, -0.004956111f, -0.2839723f, 0.9586737f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_H_2, BG_OBJECT_DOOR_H_2_WS_ENTRY, 953.0507f, 1459.842f, 340.6526f, -1.99662f, -0.1971825f, 0.1575096f, -0.8239487f, 0.5073641f, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_H_3, BG_OBJECT_DOOR_H_3_WS_ENTRY, 949.9523f, 1422.751f, 344.9273f, 0.0f, 0, 0, 0, 1, RESPAWN_IMMEDIATELY);
|
||||
AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY);
|
||||
|
||||
|
||||
|
||||
GraveyardStruct const* sg = sGraveyard->GetGraveyard(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, TEAM_ALLIANCE);
|
||||
|
|
@ -531,9 +531,9 @@ TeamId BattlegroundWS::GetPrematureWinner()
|
|||
|
||||
uint32 BattlegroundWS::GetAssaultSpellId() const
|
||||
{
|
||||
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
|
||||
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
|
||||
return 0;
|
||||
|
||||
return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ enum BG_WS_TimerOrScore
|
|||
{
|
||||
BG_WS_MAX_TEAM_SCORE = 3,
|
||||
|
||||
BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS,
|
||||
BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS,
|
||||
BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS,
|
||||
BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS,
|
||||
BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS
|
||||
BG_WS_TOTAL_GAME_TIME = 27 * MINUTE * IN_MILLISECONDS,
|
||||
BG_WS_FLAG_RESPAWN_TIME = 23 * IN_MILLISECONDS,
|
||||
BG_WS_FLAG_DROP_TIME = 10 * IN_MILLISECONDS,
|
||||
BG_WS_SPELL_FORCE_TIME = 10 * MINUTE * IN_MILLISECONDS,
|
||||
BG_WS_SPELL_BRUTAL_TIME = 15 * MINUTE * IN_MILLISECONDS
|
||||
};
|
||||
|
||||
enum BG_WS_Sound
|
||||
|
|
@ -149,60 +149,60 @@ struct BattlegroundWGScore : public BattlegroundScore
|
|||
|
||||
class BattlegroundWS : public Battleground
|
||||
{
|
||||
public:
|
||||
/* Construction */
|
||||
BattlegroundWS();
|
||||
~BattlegroundWS();
|
||||
public:
|
||||
/* Construction */
|
||||
BattlegroundWS();
|
||||
~BattlegroundWS();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(TeamId teamId) const { return _flagKeepers[teamId]; }
|
||||
void SetFlagPicker(uint64 guid, TeamId teamId) { _flagKeepers[teamId] = guid; }
|
||||
void RespawnFlagAfterDrop(TeamId teamId);
|
||||
uint8 GetFlagState(TeamId teamId) const { return _flagState[teamId]; }
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(TeamId teamId) const { return _flagKeepers[teamId]; }
|
||||
void SetFlagPicker(uint64 guid, TeamId teamId) { _flagKeepers[teamId] = guid; }
|
||||
void RespawnFlagAfterDrop(TeamId teamId);
|
||||
uint8 GetFlagState(TeamId teamId) const { return _flagState[teamId]; }
|
||||
|
||||
/* Battleground Events */
|
||||
void EventPlayerDroppedFlag(Player* player);
|
||||
void EventPlayerClickedOnFlag(Player* player, GameObject* gameObject);
|
||||
void EventPlayerCapturedFlag(Player* player);
|
||||
/* Battleground Events */
|
||||
void EventPlayerDroppedFlag(Player* player);
|
||||
void EventPlayerClickedOnFlag(Player* player, GameObject* gameObject);
|
||||
void EventPlayerCapturedFlag(Player* player);
|
||||
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
void RemovePlayer(Player* player);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool SetupBattleground();
|
||||
void Init();
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
void UpdateFlagState(TeamId teamId, uint32 value);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void SetDroppedFlagGUID(uint64 guid, TeamId teamId) { _droppedFlagGUID[teamId] = guid; }
|
||||
uint64 GetDroppedFlagGUID(TeamId teamId) const { return _droppedFlagGUID[teamId];}
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
void UpdateFlagState(TeamId teamId, uint32 value);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void SetDroppedFlagGUID(uint64 guid, TeamId teamId) { _droppedFlagGUID[teamId] = guid; }
|
||||
uint64 GetDroppedFlagGUID(TeamId teamId) const { return _droppedFlagGUID[teamId];}
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
/* Scorekeeping */
|
||||
void AddPoints(TeamId teamId, uint32 points) { m_TeamScores[teamId] += points; }
|
||||
|
||||
TeamId GetPrematureWinner();
|
||||
uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); }
|
||||
uint32 GetAssaultSpellId() const;
|
||||
void RemoveAssaultAuras();
|
||||
/* Scorekeeping */
|
||||
void AddPoints(TeamId teamId, uint32 points) { m_TeamScores[teamId] += points; }
|
||||
|
||||
private:
|
||||
EventMap _bgEvents;
|
||||
TeamId GetPrematureWinner();
|
||||
uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE * IN_MILLISECONDS); }
|
||||
uint32 GetAssaultSpellId() const;
|
||||
void RemoveAssaultAuras();
|
||||
|
||||
uint64 _flagKeepers[2];
|
||||
uint64 _droppedFlagGUID[2];
|
||||
uint8 _flagState[2];
|
||||
TeamId _lastFlagCaptureTeam;
|
||||
uint32 _reputationCapture;
|
||||
uint32 _honorWinKills;
|
||||
uint32 _honorEndKills;
|
||||
private:
|
||||
EventMap _bgEvents;
|
||||
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
uint64 _flagKeepers[2];
|
||||
uint64 _droppedFlagGUID[2];
|
||||
uint8 _flagState[2];
|
||||
TeamId _lastFlagCaptureTeam;
|
||||
uint32 _reputationCapture;
|
||||
uint32 _honorWinKills;
|
||||
uint32 _honorEndKills;
|
||||
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ void CalendarMgr::LoadFromDB()
|
|||
_maxEventId = std::max(_maxEventId, eventId);
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u calendar events", count);
|
||||
count = 0;
|
||||
|
|
@ -101,8 +100,7 @@ void CalendarMgr::LoadFromDB()
|
|||
_maxInviteId = std::max(_maxInviteId, inviteId);
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u calendar invites", count);
|
||||
|
||||
|
|
@ -510,7 +508,7 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
|
|||
void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime)
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 +
|
||||
calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
|
||||
calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
|
||||
data << uint8(1); // unk
|
||||
data << uint64(calendarEvent.GetEventId());
|
||||
data.AppendPackedTime(oldEventTime);
|
||||
|
|
@ -593,9 +591,8 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
|
|||
if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
|
||||
guild->BroadcastPacket(&data);
|
||||
}
|
||||
else
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(invite.GetInviteeGUID()))
|
||||
player->SendDirectMessage(&data);
|
||||
else if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(invite.GetInviteeGUID()))
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
|
||||
|
|
|
|||
|
|
@ -121,142 +121,142 @@ enum CalendarLimits
|
|||
|
||||
struct CalendarInvite
|
||||
{
|
||||
public:
|
||||
CalendarInvite(CalendarInvite const& calendarInvite, uint64 inviteId, uint64 eventId)
|
||||
{
|
||||
_inviteId = inviteId;
|
||||
_eventId = eventId;
|
||||
_invitee = calendarInvite.GetInviteeGUID();
|
||||
_senderGUID = calendarInvite.GetSenderGUID();
|
||||
_statusTime = calendarInvite.GetStatusTime();
|
||||
_status = calendarInvite.GetStatus();
|
||||
_rank = calendarInvite.GetRank();
|
||||
_text = calendarInvite.GetText();
|
||||
}
|
||||
public:
|
||||
CalendarInvite(CalendarInvite const& calendarInvite, uint64 inviteId, uint64 eventId)
|
||||
{
|
||||
_inviteId = inviteId;
|
||||
_eventId = eventId;
|
||||
_invitee = calendarInvite.GetInviteeGUID();
|
||||
_senderGUID = calendarInvite.GetSenderGUID();
|
||||
_statusTime = calendarInvite.GetStatusTime();
|
||||
_status = calendarInvite.GetStatus();
|
||||
_rank = calendarInvite.GetRank();
|
||||
_text = calendarInvite.GetText();
|
||||
}
|
||||
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(nullptr)),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(nullptr)),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
|
||||
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
|
||||
_inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime),
|
||||
_status(status), _rank(rank), _text(text) { }
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
|
||||
_inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime),
|
||||
_status(status), _rank(rank), _text(text) { }
|
||||
|
||||
~CalendarInvite();
|
||||
~CalendarInvite();
|
||||
|
||||
void SetInviteId(uint64 inviteId) { _inviteId = inviteId; }
|
||||
uint64 GetInviteId() const { return _inviteId; }
|
||||
void SetInviteId(uint64 inviteId) { _inviteId = inviteId; }
|
||||
uint64 GetInviteId() const { return _inviteId; }
|
||||
|
||||
void SetEventId(uint64 eventId) { _eventId = eventId; }
|
||||
uint64 GetEventId() const { return _eventId; }
|
||||
void SetEventId(uint64 eventId) { _eventId = eventId; }
|
||||
uint64 GetEventId() const { return _eventId; }
|
||||
|
||||
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
|
||||
uint64 GetSenderGUID() const { return _senderGUID; }
|
||||
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
|
||||
uint64 GetSenderGUID() const { return _senderGUID; }
|
||||
|
||||
void SetInvitee(uint64 guid) { _invitee = guid; }
|
||||
uint64 GetInviteeGUID() const { return _invitee; }
|
||||
void SetInvitee(uint64 guid) { _invitee = guid; }
|
||||
uint64 GetInviteeGUID() const { return _invitee; }
|
||||
|
||||
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
|
||||
time_t GetStatusTime() const { return _statusTime; }
|
||||
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
|
||||
time_t GetStatusTime() const { return _statusTime; }
|
||||
|
||||
void SetText(const std::string& text) { _text = text; }
|
||||
std::string GetText() const { return _text; }
|
||||
void SetText(const std::string& text) { _text = text; }
|
||||
std::string GetText() const { return _text; }
|
||||
|
||||
void SetStatus(CalendarInviteStatus status) { _status = status; }
|
||||
CalendarInviteStatus GetStatus() const { return _status; }
|
||||
void SetStatus(CalendarInviteStatus status) { _status = status; }
|
||||
CalendarInviteStatus GetStatus() const { return _status; }
|
||||
|
||||
void SetRank(CalendarModerationRank rank) { _rank = rank; }
|
||||
CalendarModerationRank GetRank() const { return _rank; }
|
||||
void SetRank(CalendarModerationRank rank) { _rank = rank; }
|
||||
CalendarModerationRank GetRank() const { return _rank; }
|
||||
|
||||
private:
|
||||
uint64 _inviteId;
|
||||
uint64 _eventId;
|
||||
uint64 _invitee;
|
||||
uint64 _senderGUID;
|
||||
time_t _statusTime;
|
||||
CalendarInviteStatus _status;
|
||||
CalendarModerationRank _rank;
|
||||
std::string _text;
|
||||
private:
|
||||
uint64 _inviteId;
|
||||
uint64 _eventId;
|
||||
uint64 _invitee;
|
||||
uint64 _senderGUID;
|
||||
time_t _statusTime;
|
||||
CalendarInviteStatus _status;
|
||||
CalendarModerationRank _rank;
|
||||
std::string _text;
|
||||
};
|
||||
|
||||
struct CalendarEvent
|
||||
{
|
||||
public:
|
||||
CalendarEvent(CalendarEvent const& calendarEvent, uint64 eventId)
|
||||
{
|
||||
_eventId = eventId;
|
||||
_creatorGUID = calendarEvent.GetCreatorGUID();
|
||||
_guildId = calendarEvent.GetGuildId();
|
||||
_type = calendarEvent.GetType();
|
||||
_dungeonId = calendarEvent.GetDungeonId();
|
||||
_eventTime = calendarEvent.GetEventTime();
|
||||
_flags = calendarEvent.GetFlags();
|
||||
_timezoneTime = calendarEvent.GetTimeZoneTime();
|
||||
_title = calendarEvent.GetTitle();
|
||||
_description = calendarEvent.GetDescription();
|
||||
}
|
||||
public:
|
||||
CalendarEvent(CalendarEvent const& calendarEvent, uint64 eventId)
|
||||
{
|
||||
_eventId = eventId;
|
||||
_creatorGUID = calendarEvent.GetCreatorGUID();
|
||||
_guildId = calendarEvent.GetGuildId();
|
||||
_type = calendarEvent.GetType();
|
||||
_dungeonId = calendarEvent.GetDungeonId();
|
||||
_eventTime = calendarEvent.GetEventTime();
|
||||
_flags = calendarEvent.GetFlags();
|
||||
_timezoneTime = calendarEvent.GetTimeZoneTime();
|
||||
_title = calendarEvent.GetTitle();
|
||||
_description = calendarEvent.GetDescription();
|
||||
}
|
||||
|
||||
CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
|
||||
time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
|
||||
_eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
|
||||
_eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
|
||||
_description(description) { }
|
||||
CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
|
||||
time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
|
||||
_eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
|
||||
_eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
|
||||
_description(description) { }
|
||||
|
||||
CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
|
||||
_flags(0), _timezoneTime(0), _title(""), _description("") { }
|
||||
CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
|
||||
_flags(0), _timezoneTime(0), _title(""), _description("") { }
|
||||
|
||||
~CalendarEvent();
|
||||
~CalendarEvent();
|
||||
|
||||
void SetEventId(uint64 eventId) { _eventId = eventId; }
|
||||
uint64 GetEventId() const { return _eventId; }
|
||||
void SetEventId(uint64 eventId) { _eventId = eventId; }
|
||||
uint64 GetEventId() const { return _eventId; }
|
||||
|
||||
void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
|
||||
uint64 GetCreatorGUID() const { return _creatorGUID; }
|
||||
void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
|
||||
uint64 GetCreatorGUID() const { return _creatorGUID; }
|
||||
|
||||
void SetGuildId(uint32 guildId) { _guildId = guildId; }
|
||||
uint32 GetGuildId() const { return _guildId; }
|
||||
void SetGuildId(uint32 guildId) { _guildId = guildId; }
|
||||
uint32 GetGuildId() const { return _guildId; }
|
||||
|
||||
void SetTitle(const std::string& title) { _title = title; }
|
||||
std::string GetTitle() const { return _title; }
|
||||
void SetTitle(const std::string& title) { _title = title; }
|
||||
std::string GetTitle() const { return _title; }
|
||||
|
||||
void SetDescription(const std::string& description) { _description = description; }
|
||||
std::string GetDescription() const { return _description; }
|
||||
void SetDescription(const std::string& description) { _description = description; }
|
||||
std::string GetDescription() const { return _description; }
|
||||
|
||||
void SetType(CalendarEventType type) { _type = type; }
|
||||
CalendarEventType GetType() const { return _type; }
|
||||
void SetType(CalendarEventType type) { _type = type; }
|
||||
CalendarEventType GetType() const { return _type; }
|
||||
|
||||
void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; }
|
||||
int32 GetDungeonId() const { return _dungeonId; }
|
||||
void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; }
|
||||
int32 GetDungeonId() const { return _dungeonId; }
|
||||
|
||||
void SetEventTime(time_t eventTime) { _eventTime = eventTime; }
|
||||
time_t GetEventTime() const { return _eventTime; }
|
||||
void SetEventTime(time_t eventTime) { _eventTime = eventTime; }
|
||||
time_t GetEventTime() const { return _eventTime; }
|
||||
|
||||
void SetFlags(uint32 flags) { _flags = flags; }
|
||||
uint32 GetFlags() const { return _flags; }
|
||||
void SetFlags(uint32 flags) { _flags = flags; }
|
||||
uint32 GetFlags() const { return _flags; }
|
||||
|
||||
void SetTimeZoneTime(time_t timezoneTime) { _timezoneTime = timezoneTime; }
|
||||
time_t GetTimeZoneTime() const { return _timezoneTime; }
|
||||
void SetTimeZoneTime(time_t timezoneTime) { _timezoneTime = timezoneTime; }
|
||||
time_t GetTimeZoneTime() const { return _timezoneTime; }
|
||||
|
||||
bool IsGuildEvent() const { return _flags & CALENDAR_FLAG_GUILD_EVENT; }
|
||||
bool IsGuildAnnouncement() const { return _flags & CALENDAR_FLAG_WITHOUT_INVITES; }
|
||||
bool IsGuildEvent() const { return _flags & CALENDAR_FLAG_GUILD_EVENT; }
|
||||
bool IsGuildAnnouncement() const { return _flags & CALENDAR_FLAG_WITHOUT_INVITES; }
|
||||
|
||||
static bool IsGuildEvent(uint32 flags) { return (flags & CALENDAR_FLAG_GUILD_EVENT) != 0; }
|
||||
static bool IsGuildAnnouncement(uint32 flags) { return (flags & CALENDAR_FLAG_WITHOUT_INVITES) != 0; }
|
||||
static bool IsGuildEvent(uint32 flags) { return (flags & CALENDAR_FLAG_GUILD_EVENT) != 0; }
|
||||
static bool IsGuildAnnouncement(uint32 flags) { return (flags & CALENDAR_FLAG_WITHOUT_INVITES) != 0; }
|
||||
|
||||
std::string BuildCalendarMailSubject(uint64 remover) const;
|
||||
std::string BuildCalendarMailBody() const;
|
||||
std::string BuildCalendarMailSubject(uint64 remover) const;
|
||||
std::string BuildCalendarMailBody() const;
|
||||
|
||||
private:
|
||||
uint64 _eventId;
|
||||
uint64 _creatorGUID;
|
||||
uint32 _guildId;
|
||||
CalendarEventType _type;
|
||||
int32 _dungeonId;
|
||||
time_t _eventTime;
|
||||
uint32 _flags;
|
||||
time_t _timezoneTime;
|
||||
std::string _title;
|
||||
std::string _description;
|
||||
private:
|
||||
uint64 _eventId;
|
||||
uint64 _creatorGUID;
|
||||
uint32 _guildId;
|
||||
CalendarEventType _type;
|
||||
int32 _dungeonId;
|
||||
time_t _eventTime;
|
||||
uint32 _flags;
|
||||
time_t _timezoneTime;
|
||||
std::string _title;
|
||||
std::string _description;
|
||||
};
|
||||
typedef std::vector<CalendarInvite*> CalendarInviteStore;
|
||||
typedef std::unordered_set<CalendarEvent*> CalendarEventStore;
|
||||
|
|
@ -264,70 +264,70 @@ typedef std::unordered_map<uint64 /* eventId */, CalendarInviteStore > CalendarE
|
|||
|
||||
class CalendarMgr
|
||||
{
|
||||
private:
|
||||
CalendarMgr();
|
||||
~CalendarMgr();
|
||||
private:
|
||||
CalendarMgr();
|
||||
~CalendarMgr();
|
||||
|
||||
CalendarEventStore _events;
|
||||
CalendarEventInviteStore _invites;
|
||||
CalendarEventStore _events;
|
||||
CalendarEventInviteStore _invites;
|
||||
|
||||
std::deque<uint64> _freeEventIds;
|
||||
std::deque<uint64> _freeInviteIds;
|
||||
uint64 _maxEventId;
|
||||
uint64 _maxInviteId;
|
||||
std::deque<uint64> _freeEventIds;
|
||||
std::deque<uint64> _freeInviteIds;
|
||||
uint64 _maxEventId;
|
||||
uint64 _maxInviteId;
|
||||
|
||||
public:
|
||||
static CalendarMgr* instance();
|
||||
|
||||
void LoadFromDB();
|
||||
public:
|
||||
static CalendarMgr* instance();
|
||||
|
||||
CalendarEvent* GetEvent(uint64 eventId);
|
||||
CalendarEventStore const& GetEvents() const { return _events; }
|
||||
CalendarEventStore GetEventsCreatedBy(uint64 guid, bool includeGuildEvents = false);
|
||||
CalendarEventStore GetPlayerEvents(uint64 guid);
|
||||
CalendarEventStore GetGuildEvents(uint32 guildId);
|
||||
void LoadFromDB();
|
||||
|
||||
CalendarInvite* GetInvite(uint64 inviteId) const;
|
||||
CalendarEventInviteStore const& GetInvites() const { return _invites; }
|
||||
CalendarInviteStore const& GetEventInvites(uint64 eventId);
|
||||
CalendarInviteStore GetPlayerInvites(uint64 guid);
|
||||
CalendarEvent* GetEvent(uint64 eventId);
|
||||
CalendarEventStore const& GetEvents() const { return _events; }
|
||||
CalendarEventStore GetEventsCreatedBy(uint64 guid, bool includeGuildEvents = false);
|
||||
CalendarEventStore GetPlayerEvents(uint64 guid);
|
||||
CalendarEventStore GetGuildEvents(uint32 guildId);
|
||||
|
||||
void FreeEventId(uint64 id);
|
||||
uint64 GetFreeEventId();
|
||||
void FreeInviteId(uint64 id);
|
||||
uint64 GetFreeInviteId();
|
||||
CalendarInvite* GetInvite(uint64 inviteId) const;
|
||||
CalendarEventInviteStore const& GetInvites() const { return _invites; }
|
||||
CalendarInviteStore const& GetEventInvites(uint64 eventId);
|
||||
CalendarInviteStore GetPlayerInvites(uint64 guid);
|
||||
|
||||
void DeleteOldEvents();
|
||||
void FreeEventId(uint64 id);
|
||||
uint64 GetFreeEventId();
|
||||
void FreeInviteId(uint64 id);
|
||||
uint64 GetFreeInviteId();
|
||||
|
||||
uint32 GetPlayerNumPending(uint64 guid);
|
||||
void DeleteOldEvents();
|
||||
|
||||
void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType);
|
||||
void RemoveEvent(uint64 eventId, uint64 remover);
|
||||
void RemoveEvent(CalendarEvent* calendarEvent, uint64 remover);
|
||||
void UpdateEvent(CalendarEvent* calendarEvent);
|
||||
uint32 GetPlayerNumPending(uint64 guid);
|
||||
|
||||
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
|
||||
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans);
|
||||
void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
|
||||
void UpdateInvite(CalendarInvite* invite);
|
||||
void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
|
||||
void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType);
|
||||
void RemoveEvent(uint64 eventId, uint64 remover);
|
||||
void RemoveEvent(CalendarEvent* calendarEvent, uint64 remover);
|
||||
void UpdateEvent(CalendarEvent* calendarEvent);
|
||||
|
||||
void RemoveAllPlayerEventsAndInvites(uint64 guid);
|
||||
void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
|
||||
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
|
||||
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans);
|
||||
void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
|
||||
void UpdateInvite(CalendarInvite* invite);
|
||||
void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
|
||||
|
||||
void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
|
||||
void SendCalendarEventInvite(CalendarInvite const& invite);
|
||||
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags);
|
||||
void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
|
||||
void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime);
|
||||
void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
|
||||
void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarClearPendingAction(uint64 guid);
|
||||
void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = nullptr);
|
||||
void RemoveAllPlayerEventsAndInvites(uint64 guid);
|
||||
void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
|
||||
|
||||
void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent);
|
||||
void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
|
||||
void SendCalendarEventInvite(CalendarInvite const& invite);
|
||||
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags);
|
||||
void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
|
||||
void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime);
|
||||
void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
|
||||
void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarClearPendingAction(uint64 guid);
|
||||
void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = nullptr);
|
||||
|
||||
void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent);
|
||||
};
|
||||
|
||||
#define sCalendarMgr CalendarMgr::instance()
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ void Channel::CleanOldChannelsInDB()
|
|||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS_BANS);
|
||||
trans->Append(stmt);
|
||||
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
}
|
||||
|
|
@ -176,9 +176,9 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
|
|||
}
|
||||
|
||||
if (HasFlag(CHANNEL_FLAG_LFG) &&
|
||||
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
|
||||
AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) &&
|
||||
player->GetGroup())
|
||||
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
|
||||
AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) &&
|
||||
player->GetGroup())
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeNotInLfg(&data);
|
||||
|
|
@ -189,7 +189,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
|
|||
player->JoinedChannel(this);
|
||||
|
||||
if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
|
||||
!sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
!sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeJoined(&data, guid);
|
||||
|
|
@ -268,7 +268,7 @@ void Channel::LeaveChannel(Player* player, bool send)
|
|||
|
||||
playersStore.erase(guid);
|
||||
if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
|
||||
!sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
!sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeLeft(&data, guid);
|
||||
|
|
@ -593,10 +593,10 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
|||
uint64 victim = newp ? newp->GetGUID() : 0;
|
||||
|
||||
if (!victim || !IsOn(victim) ||
|
||||
// allow make moderator from another team only if both is GMs
|
||||
// at this moment this only way to show channel post for GM from another team
|
||||
((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && player->GetTeamId() != newp->GetTeamId() &&
|
||||
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
|
||||
// allow make moderator from another team only if both is GMs
|
||||
// at this moment this only way to show channel post for GM from another team
|
||||
((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && player->GetTeamId() != newp->GetTeamId() &&
|
||||
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerNotFound(&data, p2n);
|
||||
|
|
@ -662,7 +662,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
|
|||
uint64 victim = newp ? newp->GetGUID() : 0;
|
||||
|
||||
if (!victim || !IsOn(victim) || (newp->GetTeamId() != player->GetTeamId() &&
|
||||
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
|
||||
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerNotFound(&data, newname);
|
||||
|
|
@ -698,7 +698,7 @@ void Channel::List(Player const* player)
|
|||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_LIST %s Channel: %s", player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+playersStore.size()*(8+1));
|
||||
WorldPacket data(SMSG_CHANNEL_LIST, 1 + (GetName().size() + 1) + 1 + 4 + playersStore.size() * (8 + 1));
|
||||
data << uint8(1); // channel type?
|
||||
data << GetName(); // channel name
|
||||
data << uint8(GetFlags()); // channel flags?
|
||||
|
|
@ -742,7 +742,7 @@ void Channel::Announce(Player const* player)
|
|||
return;
|
||||
}
|
||||
|
||||
if (_channelRights.flags & (CHANNEL_RIGHT_FORCE_NO_ANNOUNCEMENTS|CHANNEL_RIGHT_FORCE_ANNOUNCEMENTS))
|
||||
if (_channelRights.flags & (CHANNEL_RIGHT_FORCE_NO_ANNOUNCEMENTS | CHANNEL_RIGHT_FORCE_ANNOUNCEMENTS))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeNotModerator(&data);
|
||||
|
|
@ -817,14 +817,14 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
|
|||
SendToAll(&data, pinfo.IsModerator() ? 0 : guid);
|
||||
}
|
||||
|
||||
void Channel::EveryoneSayToSelf(const char *what)
|
||||
void Channel::EveryoneSayToSelf(const char* what)
|
||||
{
|
||||
if (!what)
|
||||
return;
|
||||
|
||||
uint32 messageLength = strlen(what) + 1;
|
||||
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+_name.size()+1+8+4+messageLength+1);
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + _name.size() + 1 + 8 + 4 + messageLength + 1);
|
||||
data << (uint8)CHAT_MSG_CHANNEL;
|
||||
data << (uint32)LANG_UNIVERSAL;
|
||||
data << uint64(0); // put player guid here
|
||||
|
|
@ -838,7 +838,7 @@ void Channel::EveryoneSayToSelf(const char *what)
|
|||
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
|
||||
{
|
||||
data.put(5, i->first);
|
||||
data.put(17+_name.size()+1, i->first);
|
||||
data.put(17 + _name.size() + 1, i->first);
|
||||
i->second.plrPtr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
@ -1120,7 +1120,7 @@ void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
|
|||
*data << uint64(good);
|
||||
}
|
||||
|
||||
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name)
|
||||
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string& name)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
|
||||
*data << name;
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ enum ChannelFlags
|
|||
CHANNEL_FLAG_CITY = 0x20,
|
||||
CHANNEL_FLAG_LFG = 0x40,
|
||||
CHANNEL_FLAG_VOICE = 0x80
|
||||
// General 0x18 = 0x10 | 0x08
|
||||
// Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
|
||||
// LocalDefence 0x18 = 0x10 | 0x08
|
||||
// GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
|
||||
// LookingForGroup 0x50 = 0x40 | 0x10
|
||||
// General 0x18 = 0x10 | 0x08
|
||||
// Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
|
||||
// LocalDefence 0x18 = 0x10 | 0x08
|
||||
// GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
|
||||
// LookingForGroup 0x50 = 0x40 | 0x10
|
||||
};
|
||||
|
||||
enum ChannelDBCFlags
|
||||
|
|
@ -104,8 +104,8 @@ enum ChannelMemberFlags
|
|||
MEMBER_FLAG_MUTED = 0x08,
|
||||
MEMBER_FLAG_CUSTOM = 0x10,
|
||||
MEMBER_FLAG_MIC_MUTED = 0x20
|
||||
// 0x40
|
||||
// 0x80
|
||||
// 0x40
|
||||
// 0x80
|
||||
};
|
||||
|
||||
class ChannelRights
|
||||
|
|
@ -166,7 +166,7 @@ class Channel
|
|||
}
|
||||
bool IsAllowedToSpeak(uint32 speakDelay) // pussywizard
|
||||
{
|
||||
if (lastSpeakTime+speakDelay <= sWorld->GetGameTime())
|
||||
if (lastSpeakTime + speakDelay <= sWorld->GetGameTime())
|
||||
{
|
||||
lastSpeakTime = sWorld->GetGameTime();
|
||||
return true;
|
||||
|
|
@ -178,159 +178,159 @@ class Channel
|
|||
bool _gmStatus = false;
|
||||
};
|
||||
|
||||
public:
|
||||
Channel(std::string const& name, uint32 channel_id, uint32 channelDBId, TeamId teamId = TEAM_NEUTRAL, bool announce = true, bool ownership = true);
|
||||
std::string const& GetName() const { return _name; }
|
||||
uint32 GetChannelId() const { return _channelId; }
|
||||
bool IsConstant() const { return _channelId != 0; }
|
||||
bool IsAnnounce() const { return _announce; }
|
||||
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||
std::string const& GetPassword() const { return _password; }
|
||||
void SetPassword(std::string const& npassword) { _password = npassword; }
|
||||
uint32 GetNumPlayers() const { return playersStore.size(); }
|
||||
uint8 GetFlags() const { return _flags; }
|
||||
bool HasFlag(uint8 flag) const { return _flags & flag; }
|
||||
public:
|
||||
Channel(std::string const& name, uint32 channel_id, uint32 channelDBId, TeamId teamId = TEAM_NEUTRAL, bool announce = true, bool ownership = true);
|
||||
std::string const& GetName() const { return _name; }
|
||||
uint32 GetChannelId() const { return _channelId; }
|
||||
bool IsConstant() const { return _channelId != 0; }
|
||||
bool IsAnnounce() const { return _announce; }
|
||||
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||
std::string const& GetPassword() const { return _password; }
|
||||
void SetPassword(std::string const& npassword) { _password = npassword; }
|
||||
uint32 GetNumPlayers() const { return playersStore.size(); }
|
||||
uint8 GetFlags() const { return _flags; }
|
||||
bool HasFlag(uint8 flag) const { return _flags & flag; }
|
||||
|
||||
void JoinChannel(Player* player, std::string const& pass);
|
||||
void LeaveChannel(Player* player, bool send = true);
|
||||
void KickOrBan(Player const* player, std::string const& badname, bool ban);
|
||||
void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
|
||||
void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
|
||||
void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; }
|
||||
void UnBan(Player const* player, std::string const& badname);
|
||||
void UnBan(uint64 guid);
|
||||
void Password(Player const* player, std::string const& pass);
|
||||
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
|
||||
void SetOwner(uint64 guid, bool exclaim = true);
|
||||
void SetOwner(Player const* player, std::string const& name);
|
||||
void SendWhoOwner(uint64 guid);
|
||||
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
|
||||
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
|
||||
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
|
||||
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
|
||||
void List(Player const* player);
|
||||
void Announce(Player const* player);
|
||||
void Say(uint64 guid, std::string const& what, uint32 lang);
|
||||
void EveryoneSayToSelf(const char *what);
|
||||
void Invite(Player const* player, std::string const& newp);
|
||||
void Voice(uint64 guid1, uint64 guid2);
|
||||
void DeVoice(uint64 guid1, uint64 guid2);
|
||||
void JoinNotify(Player* p);
|
||||
void LeaveNotify(Player* p);
|
||||
void FlagsNotify(Player* p);
|
||||
static void CleanOldChannelsInDB();
|
||||
void JoinChannel(Player* player, std::string const& pass);
|
||||
void LeaveChannel(Player* player, bool send = true);
|
||||
void KickOrBan(Player const* player, std::string const& badname, bool ban);
|
||||
void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
|
||||
void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
|
||||
void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; }
|
||||
void UnBan(Player const* player, std::string const& badname);
|
||||
void UnBan(uint64 guid);
|
||||
void Password(Player const* player, std::string const& pass);
|
||||
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
|
||||
void SetOwner(uint64 guid, bool exclaim = true);
|
||||
void SetOwner(Player const* player, std::string const& name);
|
||||
void SendWhoOwner(uint64 guid);
|
||||
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
|
||||
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
|
||||
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
|
||||
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
|
||||
void List(Player const* player);
|
||||
void Announce(Player const* player);
|
||||
void Say(uint64 guid, std::string const& what, uint32 lang);
|
||||
void EveryoneSayToSelf(const char* what);
|
||||
void Invite(Player const* player, std::string const& newp);
|
||||
void Voice(uint64 guid1, uint64 guid2);
|
||||
void DeVoice(uint64 guid1, uint64 guid2);
|
||||
void JoinNotify(Player* p);
|
||||
void LeaveNotify(Player* p);
|
||||
void FlagsNotify(Player* p);
|
||||
static void CleanOldChannelsInDB();
|
||||
|
||||
// pussywizard:
|
||||
void AddWatching(Player* p);
|
||||
void RemoveWatching(Player* p);
|
||||
// pussywizard:
|
||||
void AddWatching(Player* p);
|
||||
void RemoveWatching(Player* p);
|
||||
|
||||
private:
|
||||
// initial packet data (notify type and channel name)
|
||||
void MakeNotifyPacket(WorldPacket* data, uint8 notify_type);
|
||||
// type specific packet data
|
||||
void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00
|
||||
void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01
|
||||
void MakeYouJoined(WorldPacket* data); //+ 0x02
|
||||
void MakeYouLeft(WorldPacket* data); //+ 0x03
|
||||
void MakeWrongPassword(WorldPacket* data); //? 0x04
|
||||
void MakeNotMember(WorldPacket* data); //? 0x05
|
||||
void MakeNotModerator(WorldPacket* data); //? 0x06
|
||||
void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
|
||||
void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
|
||||
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
|
||||
void MakeNotOwner(WorldPacket* data); //? 0x0A
|
||||
void MakeChannelOwner(WorldPacket* data); //? 0x0B
|
||||
void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
|
||||
void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D
|
||||
void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E
|
||||
void MakeMuted(WorldPacket* data); //? 0x11
|
||||
void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12
|
||||
void MakeBanned(WorldPacket* data); //? 0x13
|
||||
void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
|
||||
void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
|
||||
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
|
||||
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
|
||||
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
|
||||
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
|
||||
void MakeWrongFaction(WorldPacket* data); //? 0x1A
|
||||
void MakeInvalidName(WorldPacket* data); //? 0x1B
|
||||
void MakeNotModerated(WorldPacket* data); //? 0x1C
|
||||
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
|
||||
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E
|
||||
void MakeThrottled(WorldPacket* data); //? 0x1F
|
||||
void MakeNotInArea(WorldPacket* data); //? 0x20
|
||||
void MakeNotInLfg(WorldPacket* data); //? 0x21
|
||||
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
|
||||
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
|
||||
private:
|
||||
// initial packet data (notify type and channel name)
|
||||
void MakeNotifyPacket(WorldPacket* data, uint8 notify_type);
|
||||
// type specific packet data
|
||||
void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00
|
||||
void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01
|
||||
void MakeYouJoined(WorldPacket* data); //+ 0x02
|
||||
void MakeYouLeft(WorldPacket* data); //+ 0x03
|
||||
void MakeWrongPassword(WorldPacket* data); //? 0x04
|
||||
void MakeNotMember(WorldPacket* data); //? 0x05
|
||||
void MakeNotModerator(WorldPacket* data); //? 0x06
|
||||
void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
|
||||
void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
|
||||
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
|
||||
void MakeNotOwner(WorldPacket* data); //? 0x0A
|
||||
void MakeChannelOwner(WorldPacket* data); //? 0x0B
|
||||
void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
|
||||
void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D
|
||||
void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E
|
||||
void MakeMuted(WorldPacket* data); //? 0x11
|
||||
void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12
|
||||
void MakeBanned(WorldPacket* data); //? 0x13
|
||||
void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
|
||||
void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
|
||||
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
|
||||
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
|
||||
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
|
||||
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
|
||||
void MakeWrongFaction(WorldPacket* data); //? 0x1A
|
||||
void MakeInvalidName(WorldPacket* data); //? 0x1B
|
||||
void MakeNotModerated(WorldPacket* data); //? 0x1C
|
||||
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
|
||||
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E
|
||||
void MakeThrottled(WorldPacket* data); //? 0x1F
|
||||
void MakeNotInArea(WorldPacket* data); //? 0x20
|
||||
void MakeNotInLfg(WorldPacket* data); //? 0x21
|
||||
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
|
||||
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
|
||||
|
||||
void SendToAll(WorldPacket* data, uint64 guid = 0);
|
||||
void SendToAllButOne(WorldPacket* data, uint64 who);
|
||||
void SendToOne(WorldPacket* data, uint64 who);
|
||||
void SendToAllWatching(WorldPacket* data);
|
||||
void SendToAll(WorldPacket* data, uint64 guid = 0);
|
||||
void SendToAllButOne(WorldPacket* data, uint64 who);
|
||||
void SendToOne(WorldPacket* data, uint64 who);
|
||||
void SendToAllWatching(WorldPacket* data);
|
||||
|
||||
bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
bool IsBanned(uint64 guid) const;
|
||||
bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
bool IsBanned(uint64 guid) const;
|
||||
|
||||
void UpdateChannelInDB() const;
|
||||
void UpdateChannelUseageInDB() const;
|
||||
void AddChannelBanToDB(uint32 guid, uint32 time) const;
|
||||
void RemoveChannelBanFromDB(uint32 guid) const;
|
||||
void UpdateChannelInDB() const;
|
||||
void UpdateChannelUseageInDB() const;
|
||||
void AddChannelBanToDB(uint32 guid, uint32 time) const;
|
||||
void RemoveChannelBanFromDB(uint32 guid) const;
|
||||
|
||||
uint8 GetPlayerFlags(uint64 guid) const
|
||||
uint8 GetPlayerFlags(uint64 guid) const
|
||||
{
|
||||
PlayerContainer::const_iterator itr = playersStore.find(guid);
|
||||
return itr != playersStore.end() ? itr->second.flags : 0;
|
||||
}
|
||||
|
||||
void SetModerator(uint64 guid, bool set)
|
||||
{
|
||||
PlayerInfo& pinfo = playersStore[guid];
|
||||
if (pinfo.IsModerator() != set)
|
||||
{
|
||||
PlayerContainer::const_iterator itr = playersStore.find(guid);
|
||||
return itr != playersStore.end() ? itr->second.flags : 0;
|
||||
}
|
||||
uint8 oldFlag = pinfo.flags;
|
||||
pinfo.SetModerator(set);
|
||||
|
||||
void SetModerator(uint64 guid, bool set)
|
||||
WorldPacket data;
|
||||
MakeModeChange(&data, guid, oldFlag);
|
||||
SendToAll(&data);
|
||||
|
||||
FlagsNotify(pinfo.plrPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void SetMute(uint64 guid, bool set)
|
||||
{
|
||||
PlayerInfo& pinfo = playersStore[guid];
|
||||
if (pinfo.IsMuted() != set)
|
||||
{
|
||||
PlayerInfo& pinfo = playersStore[guid];
|
||||
if (pinfo.IsModerator() != set)
|
||||
{
|
||||
uint8 oldFlag = pinfo.flags;
|
||||
pinfo.SetModerator(set);
|
||||
uint8 oldFlag = pinfo.flags;
|
||||
pinfo.SetMuted(set);
|
||||
|
||||
WorldPacket data;
|
||||
MakeModeChange(&data, guid, oldFlag);
|
||||
SendToAll(&data);
|
||||
|
||||
FlagsNotify(pinfo.plrPtr);
|
||||
}
|
||||
WorldPacket data;
|
||||
MakeModeChange(&data, guid, oldFlag);
|
||||
SendToAll(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void SetMute(uint64 guid, bool set)
|
||||
{
|
||||
PlayerInfo& pinfo = playersStore[guid];
|
||||
if (pinfo.IsMuted() != set)
|
||||
{
|
||||
uint8 oldFlag = pinfo.flags;
|
||||
pinfo.SetMuted(set);
|
||||
typedef std::unordered_map<uint64, PlayerInfo> PlayerContainer;
|
||||
typedef std::unordered_map<uint32, uint32> BannedContainer;
|
||||
typedef std::unordered_set<Player*> PlayersWatchingContainer;
|
||||
|
||||
WorldPacket data;
|
||||
MakeModeChange(&data, guid, oldFlag);
|
||||
SendToAll(&data);
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::unordered_map<uint64, PlayerInfo> PlayerContainer;
|
||||
typedef std::unordered_map<uint32, uint32> BannedContainer;
|
||||
typedef std::unordered_set<Player*> PlayersWatchingContainer;
|
||||
|
||||
bool _announce;
|
||||
bool _ownership;
|
||||
bool _IsSaved;
|
||||
bool _isOwnerGM;
|
||||
uint8 _flags;
|
||||
uint32 _channelId;
|
||||
uint32 _channelDBId;
|
||||
TeamId _teamId;
|
||||
uint64 _ownerGUID;
|
||||
std::string _name;
|
||||
std::string _password;
|
||||
ChannelRights _channelRights;
|
||||
PlayerContainer playersStore;
|
||||
BannedContainer bannedStore;
|
||||
PlayersWatchingContainer playersWatchingStore;
|
||||
bool _announce;
|
||||
bool _ownership;
|
||||
bool _IsSaved;
|
||||
bool _isOwnerGM;
|
||||
uint8 _flags;
|
||||
uint32 _channelId;
|
||||
uint32 _channelDBId;
|
||||
TeamId _teamId;
|
||||
uint64 _ownerGUID;
|
||||
std::string _name;
|
||||
std::string _password;
|
||||
ChannelRights _channelRights;
|
||||
PlayerContainer playersStore;
|
||||
BannedContainer bannedStore;
|
||||
PlayersWatchingContainer playersWatchingStore;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -70,16 +70,14 @@ void ChannelMgr::LoadChannels()
|
|||
Field* banFields = banResult->Fetch();
|
||||
if (!banFields)
|
||||
break;
|
||||
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
|
||||
}
|
||||
while (banResult->NextRow());
|
||||
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
|
||||
} while (banResult->NextRow());
|
||||
}
|
||||
|
||||
if (channelDBId > ChannelMgr::_channelIdMax)
|
||||
if (channelDBId > ChannelMgr::_channelIdMax)
|
||||
ChannelMgr::_channelIdMax = channelDBId;
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
|
|
|
|||
|
|
@ -19,30 +19,30 @@ class ChannelMgr
|
|||
typedef std::unordered_map<std::wstring, Channel*> ChannelMap;
|
||||
typedef std::map<std::string, ChannelRights> ChannelRightsMap;
|
||||
|
||||
public:
|
||||
ChannelMgr(TeamId teamId) : _teamId(teamId)
|
||||
{ }
|
||||
public:
|
||||
ChannelMgr(TeamId teamId) : _teamId(teamId)
|
||||
{ }
|
||||
|
||||
~ChannelMgr();
|
||||
~ChannelMgr();
|
||||
|
||||
static ChannelMgr * forTeam(TeamId teamId);
|
||||
static ChannelMgr* forTeam(TeamId teamId);
|
||||
|
||||
Channel* GetJoinChannel(std::string const& name, uint32 channel_id);
|
||||
Channel* GetChannel(std::string const& name, Player* p, bool pkt = true);
|
||||
void LoadChannels();
|
||||
Channel* GetJoinChannel(std::string const& name, uint32 channel_id);
|
||||
Channel* GetChannel(std::string const& name, Player* p, bool pkt = true);
|
||||
void LoadChannels();
|
||||
|
||||
static void LoadChannelRights();
|
||||
static const ChannelRights& GetChannelRightsFor(const std::string& name);
|
||||
static void SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators);
|
||||
static uint32 _channelIdMax;
|
||||
static void LoadChannelRights();
|
||||
static const ChannelRights& GetChannelRightsFor(const std::string& name);
|
||||
static void SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators);
|
||||
static uint32 _channelIdMax;
|
||||
|
||||
private:
|
||||
ChannelMap channels;
|
||||
TeamId _teamId;
|
||||
static ChannelRightsMap channels_rights;
|
||||
static ChannelRights channelRightsEmpty; // when not found in the map, reference to this is returned
|
||||
private:
|
||||
ChannelMap channels;
|
||||
TeamId _teamId;
|
||||
static ChannelRightsMap channels_rights;
|
||||
static ChannelRights channelRightsEmpty; // when not found in the map, reference to this is returned
|
||||
|
||||
void MakeNotOnPacket(WorldPacket* data, std::string const& name);
|
||||
void MakeNotOnPacket(WorldPacket* data, std::string const& name);
|
||||
};
|
||||
|
||||
class AllianceChannelMgr : public ChannelMgr { public: AllianceChannelMgr() : ChannelMgr(TEAM_ALLIANCE) {} };
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ std::vector<ChatCommand> const& ChatHandler::getCommandTable()
|
|||
std::string name = fields[0].GetString();
|
||||
|
||||
SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt8(), fields[2].GetString(), name);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ std::vector<ChatCommand> const& ChatHandler::getCommandTable()
|
|||
|
||||
std::string ChatHandler::PGetParseString(uint32 entry, ...) const
|
||||
{
|
||||
const char *format = GetAcoreString(entry);
|
||||
const char* format = GetAcoreString(entry);
|
||||
char str[1024];
|
||||
va_list ap;
|
||||
va_start(ap, entry);
|
||||
|
|
@ -148,7 +147,8 @@ bool ChatHandler::hasStringAbbr(const char* name, const char* part)
|
|||
return false;
|
||||
else if (tolower(*name) != tolower(*part))
|
||||
return false;
|
||||
++name; ++part;
|
||||
++name;
|
||||
++part;
|
||||
}
|
||||
}
|
||||
// allow with any for ""
|
||||
|
|
@ -156,7 +156,7 @@ bool ChatHandler::hasStringAbbr(const char* name, const char* part)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ChatHandler::SendSysMessage(const char *str)
|
||||
void ChatHandler::SendSysMessage(const char* str)
|
||||
{
|
||||
WorldPacket data;
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ void ChatHandler::SendSysMessage(const char *str)
|
|||
free(buf);
|
||||
}
|
||||
|
||||
void ChatHandler::SendGlobalSysMessage(const char *str)
|
||||
void ChatHandler::SendGlobalSysMessage(const char* str)
|
||||
{
|
||||
// Chat output
|
||||
WorldPacket data;
|
||||
|
|
@ -191,7 +191,7 @@ void ChatHandler::SendGlobalSysMessage(const char *str)
|
|||
free(buf);
|
||||
}
|
||||
|
||||
void ChatHandler::SendGlobalGMSysMessage(const char *str)
|
||||
void ChatHandler::SendGlobalGMSysMessage(const char* str)
|
||||
{
|
||||
// Chat output
|
||||
WorldPacket data;
|
||||
|
|
@ -216,7 +216,7 @@ void ChatHandler::SendSysMessage(uint32 entry)
|
|||
|
||||
void ChatHandler::PSendSysMessage(uint32 entry, ...)
|
||||
{
|
||||
const char *format = GetAcoreString(entry);
|
||||
const char* format = GetAcoreString(entry);
|
||||
va_list ap;
|
||||
char str [2048];
|
||||
va_start(ap, entry);
|
||||
|
|
@ -225,7 +225,7 @@ void ChatHandler::PSendSysMessage(uint32 entry, ...)
|
|||
SendSysMessage(str);
|
||||
}
|
||||
|
||||
void ChatHandler::PSendSysMessage(const char *format, ...)
|
||||
void ChatHandler::PSendSysMessage(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char str [2048];
|
||||
|
|
@ -318,13 +318,13 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||
}
|
||||
|
||||
sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (%ul) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%ul)]",
|
||||
fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
|
||||
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
|
||||
player->GetPositionZ(), player->GetMapId(),
|
||||
player->GetMap()->GetMapName(),
|
||||
areaId, areaName.c_str(), zoneName.c_str(),
|
||||
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
|
||||
GUID_LOPART(guid));
|
||||
fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
|
||||
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
|
||||
player->GetPositionZ(), player->GetMapId(),
|
||||
player->GetMap()->GetMapName(),
|
||||
areaId, areaName.c_str(), zoneName.c_str(),
|
||||
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
|
||||
GUID_LOPART(guid));
|
||||
}
|
||||
}
|
||||
// some commands have custom error messages. Don't send the default one in these cases.
|
||||
|
|
@ -405,7 +405,7 @@ bool ChatHandler::ParseCommands(char const* text)
|
|||
std::string fullcmd = text;
|
||||
|
||||
if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS))
|
||||
return false;
|
||||
return false;
|
||||
|
||||
/// chat case (.command or !command format)
|
||||
if (m_session)
|
||||
|
|
@ -443,19 +443,19 @@ bool ChatHandler::ParseCommands(char const* text)
|
|||
|
||||
bool ChatHandler::isValidChatMessage(char const* message)
|
||||
{
|
||||
/*
|
||||
Valid examples:
|
||||
|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
|
||||
|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
|
||||
|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r
|
||||
|cff4e96f7|Htalent:2232:-1|h[Taste for Blood]|h|r
|
||||
|cff71d5ff|Hspell:21563|h[Command]|h|r
|
||||
|cffffd000|Henchant:3919|h[Engineering: Rough Dynamite]|h|r
|
||||
|cffffff00|Hachievement:546:0000000000000001:0:0:0:-1:0:0:0:0|h[Safe Deposit]|h|r
|
||||
|cff66bbff|Hglyph:21:762|h[Glyph of Bladestorm]|h|r
|
||||
/*
|
||||
Valid examples:
|
||||
|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
|
||||
|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
|
||||
|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r
|
||||
|cff4e96f7|Htalent:2232:-1|h[Taste for Blood]|h|r
|
||||
|cff71d5ff|Hspell:21563|h[Command]|h|r
|
||||
|cffffd000|Henchant:3919|h[Engineering: Rough Dynamite]|h|r
|
||||
|cffffff00|Hachievement:546:0000000000000001:0:0:0:-1:0:0:0:0|h[Safe Deposit]|h|r
|
||||
|cff66bbff|Hglyph:21:762|h[Glyph of Bladestorm]|h|r
|
||||
|
||||
| will be escaped to ||
|
||||
*/
|
||||
| will be escaped to ||
|
||||
*/
|
||||
|
||||
if (strlen(message) > 255)
|
||||
return false;
|
||||
|
|
@ -597,8 +597,8 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
|
|||
}
|
||||
|
||||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
|
||||
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
|
||||
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
|
||||
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
|
||||
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
|
||||
{
|
||||
size_t receiverGUIDPos = 0;
|
||||
data.Initialize(!gmMessage ? SMSG_MESSAGECHAT : SMSG_GM_MESSAGECHAT);
|
||||
|
|
@ -677,7 +677,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
}
|
||||
|
||||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message,
|
||||
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
|
||||
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
|
||||
{
|
||||
uint64 senderGUID = 0;
|
||||
std::string senderName = "";
|
||||
|
|
@ -774,7 +774,7 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** s
|
|||
return nullptr;
|
||||
|
||||
// skip spaces
|
||||
while (*text == ' '||*text == '\t'||*text == '\b')
|
||||
while (*text == ' ' || *text == '\t' || *text == '\b')
|
||||
++text;
|
||||
|
||||
if (!*text)
|
||||
|
|
@ -822,7 +822,7 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes,
|
|||
return nullptr;
|
||||
|
||||
// skip spaces
|
||||
while (*text == ' '||*text == '\t'||*text == '\b')
|
||||
while (*text == ' ' || *text == '\t' || *text == '\b')
|
||||
++text;
|
||||
|
||||
if (!*text)
|
||||
|
|
@ -849,7 +849,7 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes,
|
|||
tail = strtok(nullptr, ""); // tail
|
||||
}
|
||||
else
|
||||
tail = text+1; // skip first |
|
||||
tail = text + 1; // skip first |
|
||||
|
||||
char* cLinkType = strtok(tail, ":"); // linktype
|
||||
if (!cLinkType)
|
||||
|
|
@ -956,34 +956,34 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text)
|
|||
case SPELL_LINK_SPELL:
|
||||
return id;
|
||||
case SPELL_LINK_TALENT:
|
||||
{
|
||||
// talent
|
||||
TalentEntry const* talentEntry = sTalentStore.LookupEntry(id);
|
||||
if (!talentEntry)
|
||||
return 0;
|
||||
{
|
||||
// talent
|
||||
TalentEntry const* talentEntry = sTalentStore.LookupEntry(id);
|
||||
if (!talentEntry)
|
||||
return 0;
|
||||
|
||||
int32 rank = param1_str ? (uint32)atol(param1_str) : 0;
|
||||
if (rank >= MAX_TALENT_RANK)
|
||||
return 0;
|
||||
int32 rank = param1_str ? (uint32)atol(param1_str) : 0;
|
||||
if (rank >= MAX_TALENT_RANK)
|
||||
return 0;
|
||||
|
||||
if (rank < 0)
|
||||
rank = 0;
|
||||
if (rank < 0)
|
||||
rank = 0;
|
||||
|
||||
return talentEntry->RankID[rank];
|
||||
}
|
||||
return talentEntry->RankID[rank];
|
||||
}
|
||||
case SPELL_LINK_ENCHANT:
|
||||
case SPELL_LINK_TRADE:
|
||||
return id;
|
||||
case SPELL_LINK_GLYPH:
|
||||
{
|
||||
uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0;
|
||||
{
|
||||
uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0;
|
||||
|
||||
GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id);
|
||||
if (!glyphPropEntry)
|
||||
return 0;
|
||||
GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id);
|
||||
if (!glyphPropEntry)
|
||||
return 0;
|
||||
|
||||
return glyphPropEntry->SpellId;
|
||||
}
|
||||
return glyphPropEntry->SpellId;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown type?
|
||||
|
|
@ -1034,37 +1034,37 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
|
|||
switch (type)
|
||||
{
|
||||
case SPELL_LINK_PLAYER:
|
||||
{
|
||||
std::string name = idS;
|
||||
if (!normalizePlayerName(name))
|
||||
{
|
||||
std::string name = idS;
|
||||
if (!normalizePlayerName(name))
|
||||
return 0;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
|
||||
return player->GetGUID();
|
||||
|
||||
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
|
||||
return guid;
|
||||
|
||||
return 0;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
|
||||
return player->GetGUID();
|
||||
|
||||
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
|
||||
return guid;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
case SPELL_LINK_CREATURE:
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
|
||||
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
|
||||
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
case SPELL_LINK_GAMEOBJECT:
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
|
||||
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
|
||||
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
|
||||
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown type?
|
||||
|
|
@ -1162,7 +1162,7 @@ char* ChatHandler::extractQuotedArg(char* args)
|
|||
return nullptr;
|
||||
|
||||
if (*args == '"')
|
||||
return strtok(args+1, "\"");
|
||||
return strtok(args + 1, "\"");
|
||||
else
|
||||
{
|
||||
// skip spaces
|
||||
|
|
@ -1228,7 +1228,7 @@ bool CliHandler::isAvailable(ChatCommand const& cmd) const
|
|||
return cmd.AllowConsole;
|
||||
}
|
||||
|
||||
void CliHandler::SendSysMessage(const char *str)
|
||||
void CliHandler::SendSysMessage(const char* str)
|
||||
{
|
||||
m_print(m_callbackArg, str);
|
||||
m_print(m_callbackArg, "\r\n");
|
||||
|
|
@ -1244,7 +1244,7 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline)
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline)
|
||||
{
|
||||
player = nullptr;
|
||||
guid = 0;
|
||||
|
|
|
|||
|
|
@ -26,130 +26,130 @@ class ChatCommand
|
|||
{
|
||||
typedef bool(*pHandler)(ChatHandler*, char const*);
|
||||
|
||||
public:
|
||||
ChatCommand(char const* name, uint32 securityLevel, bool allowConsole, pHandler handler, std::string help, std::vector<ChatCommand> childCommands = std::vector<ChatCommand>())
|
||||
: Name(ASSERT_NOTNULL(name)), SecurityLevel(securityLevel), AllowConsole(allowConsole), Handler(handler), Help(std::move(help)), ChildCommands(std::move(childCommands)) { }
|
||||
public:
|
||||
ChatCommand(char const* name, uint32 securityLevel, bool allowConsole, pHandler handler, std::string help, std::vector<ChatCommand> childCommands = std::vector<ChatCommand>())
|
||||
: Name(ASSERT_NOTNULL(name)), SecurityLevel(securityLevel), AllowConsole(allowConsole), Handler(handler), Help(std::move(help)), ChildCommands(std::move(childCommands)) { }
|
||||
|
||||
char const* Name;
|
||||
uint32 SecurityLevel;
|
||||
bool AllowConsole;
|
||||
pHandler Handler;
|
||||
std::string Help;
|
||||
std::vector<ChatCommand> ChildCommands;
|
||||
char const* Name;
|
||||
uint32 SecurityLevel;
|
||||
bool AllowConsole;
|
||||
pHandler Handler;
|
||||
std::string Help;
|
||||
std::vector<ChatCommand> ChildCommands;
|
||||
};
|
||||
|
||||
class ChatHandler
|
||||
{
|
||||
public:
|
||||
WorldSession* GetSession() { return m_session; }
|
||||
explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
|
||||
virtual ~ChatHandler() { }
|
||||
public:
|
||||
WorldSession* GetSession() { return m_session; }
|
||||
explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
|
||||
virtual ~ChatHandler() { }
|
||||
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
|
||||
std::string const& senderName = "", std::string const& receiverName = "",
|
||||
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
|
||||
std::string const& senderName = "", std::string const& receiverName = "",
|
||||
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
|
||||
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE);
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE);
|
||||
|
||||
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
|
||||
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
|
||||
|
||||
// function with different implementation for chat/console
|
||||
virtual char const* GetAcoreString(uint32 entry) const;
|
||||
virtual void SendSysMessage(char const* str);
|
||||
// function with different implementation for chat/console
|
||||
virtual char const* GetAcoreString(uint32 entry) const;
|
||||
virtual void SendSysMessage(char const* str);
|
||||
|
||||
void SendSysMessage(uint32 entry);
|
||||
void PSendSysMessage(char const* format, ...) ATTR_PRINTF(2, 3);
|
||||
void PSendSysMessage(uint32 entry, ...);
|
||||
std::string PGetParseString(uint32 entry, ...) const;
|
||||
void SendSysMessage(uint32 entry);
|
||||
void PSendSysMessage(char const* format, ...) ATTR_PRINTF(2, 3);
|
||||
void PSendSysMessage(uint32 entry, ...);
|
||||
std::string PGetParseString(uint32 entry, ...) const;
|
||||
|
||||
bool ParseCommands(const char* text);
|
||||
bool ParseCommands(const char* text);
|
||||
|
||||
static std::vector<ChatCommand> const& getCommandTable();
|
||||
static std::vector<ChatCommand> const& getCommandTable();
|
||||
|
||||
bool isValidChatMessage(const char* msg);
|
||||
void SendGlobalSysMessage(const char *str);
|
||||
bool isValidChatMessage(const char* msg);
|
||||
void SendGlobalSysMessage(const char* str);
|
||||
|
||||
bool hasStringAbbr(const char* name, const char* part);
|
||||
bool hasStringAbbr(const char* name, const char* part);
|
||||
|
||||
// function with different implementation for chat/console
|
||||
virtual bool isAvailable(ChatCommand const& cmd) const;
|
||||
virtual std::string GetNameLink() const { return GetNameLink(m_session->GetPlayer()); }
|
||||
virtual bool needReportToTarget(Player* chr) const;
|
||||
virtual LocaleConstant GetSessionDbcLocale() const;
|
||||
virtual int GetSessionDbLocaleIndex() const;
|
||||
// function with different implementation for chat/console
|
||||
virtual bool isAvailable(ChatCommand const& cmd) const;
|
||||
virtual std::string GetNameLink() const { return GetNameLink(m_session->GetPlayer()); }
|
||||
virtual bool needReportToTarget(Player* chr) const;
|
||||
virtual LocaleConstant GetSessionDbcLocale() const;
|
||||
virtual int GetSessionDbLocaleIndex() const;
|
||||
|
||||
bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
|
||||
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
|
||||
bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
|
||||
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
|
||||
|
||||
void SendGlobalGMSysMessage(const char *str);
|
||||
Player* getSelectedPlayer();
|
||||
Creature* getSelectedCreature();
|
||||
Unit* getSelectedUnit();
|
||||
WorldObject* getSelectedObject();
|
||||
// Returns either the selected player or self if there is no selected player
|
||||
Player* getSelectedPlayerOrSelf();
|
||||
void SendGlobalGMSysMessage(const char* str);
|
||||
Player* getSelectedPlayer();
|
||||
Creature* getSelectedCreature();
|
||||
Unit* getSelectedUnit();
|
||||
WorldObject* getSelectedObject();
|
||||
// Returns either the selected player or self if there is no selected player
|
||||
Player* getSelectedPlayerOrSelf();
|
||||
|
||||
char* extractKeyFromLink(char* text, char const* linkType, char** something1 = nullptr);
|
||||
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = nullptr);
|
||||
char* extractKeyFromLink(char* text, char const* linkType, char** something1 = nullptr);
|
||||
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = nullptr);
|
||||
|
||||
// if args have single value then it return in arg2 and arg1 == NULL
|
||||
void extractOptFirstArg(char* args, char** arg1, char** arg2);
|
||||
char* extractQuotedArg(char* args);
|
||||
// if args have single value then it return in arg2 and arg1 == NULL
|
||||
void extractOptFirstArg(char* args, char** arg1, char** arg2);
|
||||
char* extractQuotedArg(char* args);
|
||||
|
||||
uint32 extractSpellIdFromLink(char* text);
|
||||
uint64 extractGuidFromLink(char* text);
|
||||
GameTele const* extractGameTeleFromLink(char* text);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false);
|
||||
std::string extractPlayerNameFromLink(char* text);
|
||||
// select by arg (name/link) or in-game selection online/offline player
|
||||
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = nullptr);
|
||||
uint32 extractSpellIdFromLink(char* text);
|
||||
uint64 extractGuidFromLink(char* text);
|
||||
GameTele const* extractGameTeleFromLink(char* text);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline = false);
|
||||
std::string extractPlayerNameFromLink(char* text);
|
||||
// select by arg (name/link) or in-game selection online/offline player
|
||||
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = nullptr);
|
||||
|
||||
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
|
||||
std::string GetNameLink(Player* chr) const;
|
||||
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r" : name; }
|
||||
std::string GetNameLink(Player* chr) const;
|
||||
|
||||
GameObject* GetNearbyGameObject();
|
||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
|
||||
bool HasSentErrorMessage() const { return sentErrorMessage; }
|
||||
void SetSentErrorMessage(bool val){ sentErrorMessage = val; }
|
||||
static bool LoadCommandTable() { return load_command_table; }
|
||||
static void SetLoadCommandTable(bool val) { load_command_table = val; }
|
||||
GameObject* GetNearbyGameObject();
|
||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
|
||||
bool HasSentErrorMessage() const { return sentErrorMessage; }
|
||||
void SetSentErrorMessage(bool val) { sentErrorMessage = val; }
|
||||
static bool LoadCommandTable() { return load_command_table; }
|
||||
static void SetLoadCommandTable(bool val) { load_command_table = val; }
|
||||
|
||||
bool ShowHelpForCommand(std::vector<ChatCommand> const& table, const char* cmd);
|
||||
protected:
|
||||
explicit ChatHandler() : m_session(nullptr), sentErrorMessage(false) {} // for CLI subclass
|
||||
static bool SetDataForCommandInTable(std::vector<ChatCommand>& table, const char* text, uint32 securityLevel, std::string const& help, std::string const& fullcommand);
|
||||
bool ExecuteCommandInTable(std::vector<ChatCommand> const& table, const char* text, std::string const& fullcmd);
|
||||
bool ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd);
|
||||
bool ShowHelpForCommand(std::vector<ChatCommand> const& table, const char* cmd);
|
||||
protected:
|
||||
explicit ChatHandler() : m_session(nullptr), sentErrorMessage(false) {} // for CLI subclass
|
||||
static bool SetDataForCommandInTable(std::vector<ChatCommand>& table, const char* text, uint32 securityLevel, std::string const& help, std::string const& fullcommand);
|
||||
bool ExecuteCommandInTable(std::vector<ChatCommand> const& table, const char* text, std::string const& fullcmd);
|
||||
bool ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd);
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
|
||||
WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
|
||||
|
||||
// common global flag
|
||||
static bool load_command_table;
|
||||
bool sentErrorMessage;
|
||||
// common global flag
|
||||
static bool load_command_table;
|
||||
bool sentErrorMessage;
|
||||
};
|
||||
|
||||
class CliHandler : public ChatHandler
|
||||
{
|
||||
public:
|
||||
typedef void Print(void*, char const*);
|
||||
explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
|
||||
public:
|
||||
typedef void Print(void*, char const*);
|
||||
explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
|
||||
|
||||
// overwrite functions
|
||||
char const* GetAcoreString(uint32 entry) const override;
|
||||
bool isAvailable(ChatCommand const& cmd) const override;
|
||||
void SendSysMessage(const char *str) override;
|
||||
std::string GetNameLink() const override;
|
||||
bool needReportToTarget(Player* chr) const override;
|
||||
LocaleConstant GetSessionDbcLocale() const override;
|
||||
int GetSessionDbLocaleIndex() const override;
|
||||
// overwrite functions
|
||||
char const* GetAcoreString(uint32 entry) const override;
|
||||
bool isAvailable(ChatCommand const& cmd) const override;
|
||||
void SendSysMessage(const char* str) override;
|
||||
std::string GetNameLink() const override;
|
||||
bool needReportToTarget(Player* chr) const override;
|
||||
LocaleConstant GetSessionDbcLocale() const override;
|
||||
int GetSessionDbLocaleIndex() const override;
|
||||
|
||||
private:
|
||||
void* m_callbackArg;
|
||||
Print* m_print;
|
||||
private:
|
||||
void* m_callbackArg;
|
||||
Print* m_print;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ bool LinkExtractor::IsValidMessage()
|
|||
{
|
||||
if (commandChar == *validSequenceIterator)
|
||||
{
|
||||
if (validSequenceIterator == validSequence+4)
|
||||
if (validSequenceIterator == validSequence + 4)
|
||||
validSequenceIterator = validSequence;
|
||||
else
|
||||
++validSequenceIterator;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ItemChatLink : public ChatLink
|
|||
{
|
||||
public:
|
||||
ItemChatLink() : ChatLink(), _item(nullptr), _suffix(nullptr), _property(nullptr)
|
||||
{
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
}
|
||||
virtual bool Initialize(std::istringstream& iss);
|
||||
|
|
@ -91,7 +91,7 @@ class AchievementChatLink : public ChatLink
|
|||
{
|
||||
public:
|
||||
AchievementChatLink() : ChatLink(), _guid(0), _achievement(nullptr)
|
||||
{
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
}
|
||||
virtual bool Initialize(std::istringstream& iss);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void HostileRefManager::deleteReference(Unit* creature)
|
|||
void HostileRefManager::deleteReferencesOutOfRange(float range)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
range = range*range;
|
||||
range = range * range;
|
||||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
|
|
@ -195,8 +195,8 @@ void HostileRefManager::UpdateVisibility(bool checkThreat)
|
|||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) &&
|
||||
!ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner()))
|
||||
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) &&
|
||||
!ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner()))
|
||||
{
|
||||
nextRef = ref->next();
|
||||
ref->removeReference();
|
||||
|
|
|
|||
|
|
@ -19,46 +19,46 @@ class SpellInfo;
|
|||
|
||||
class HostileRefManager : public RefManager<Unit, ThreatManager>
|
||||
{
|
||||
private:
|
||||
Unit* iOwner;
|
||||
public:
|
||||
explicit HostileRefManager(Unit* owner) { iOwner = owner; }
|
||||
~HostileRefManager();
|
||||
private:
|
||||
Unit* iOwner;
|
||||
public:
|
||||
explicit HostileRefManager(Unit* owner) { iOwner = owner; }
|
||||
~HostileRefManager();
|
||||
|
||||
Unit* GetOwner() { return iOwner; }
|
||||
Unit* GetOwner() { return iOwner; }
|
||||
|
||||
// send threat to all my hateres for the victim
|
||||
// The victim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
void threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell = nullptr);
|
||||
// send threat to all my hateres for the victim
|
||||
// The victim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
void threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell = nullptr);
|
||||
|
||||
void addTempThreat(float threat, bool apply);
|
||||
void addTempThreat(float threat, bool apply);
|
||||
|
||||
void addThreatPercent(int32 percent);
|
||||
void addThreatPercent(int32 percent);
|
||||
|
||||
// The references are not needed anymore
|
||||
// tell the source to remove them from the list and free the mem
|
||||
void deleteReferences();
|
||||
// The references are not needed anymore
|
||||
// tell the source to remove them from the list and free the mem
|
||||
void deleteReferences();
|
||||
|
||||
// Remove specific faction references
|
||||
void deleteReferencesForFaction(uint32 faction);
|
||||
// Remove specific faction references
|
||||
void deleteReferencesForFaction(uint32 faction);
|
||||
|
||||
// pussywizard: for combat bugs
|
||||
void deleteReferencesOutOfRange(float range);
|
||||
// pussywizard: for combat bugs
|
||||
void deleteReferencesOutOfRange(float range);
|
||||
|
||||
HostileReference* getFirst() { return ((HostileReference*) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
HostileReference* getFirst() { return ((HostileReference*) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
|
||||
void updateThreatTables();
|
||||
void updateThreatTables();
|
||||
|
||||
void setOnlineOfflineState(bool isOnline);
|
||||
void setOnlineOfflineState(bool isOnline);
|
||||
|
||||
// set state for one reference, defined by Unit
|
||||
void setOnlineOfflineState(Unit* creature, bool isOnline);
|
||||
// set state for one reference, defined by Unit
|
||||
void setOnlineOfflineState(Unit* creature, bool isOnline);
|
||||
|
||||
// delete one reference, defined by Unit
|
||||
void deleteReference(Unit* creature);
|
||||
// delete one reference, defined by Unit
|
||||
void deleteReference(Unit* creature);
|
||||
|
||||
void UpdateVisibility(bool checkThreat);
|
||||
void UpdateVisibility(bool checkThreat);
|
||||
};
|
||||
//=================================================
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -171,11 +171,11 @@ void HostileReference::updateOnlineStatus()
|
|||
// target is no player or not gamemaster
|
||||
// target is not in flight
|
||||
if (isValid()
|
||||
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->IsGameMaster())
|
||||
&& !getTarget()->IsInFlight()
|
||||
&& getTarget()->IsInMap(GetSourceUnit())
|
||||
&& getTarget()->InSamePhase(GetSourceUnit())
|
||||
)
|
||||
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->IsGameMaster())
|
||||
&& !getTarget()->IsInFlight()
|
||||
&& getTarget()->IsInMap(GetSourceUnit())
|
||||
&& getTarget()->InSamePhase(GetSourceUnit())
|
||||
)
|
||||
{
|
||||
Creature* creature = GetSourceUnit()->ToCreature();
|
||||
online = getTarget()->isInAccessiblePlaceFor(creature);
|
||||
|
|
@ -247,7 +247,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const
|
|||
uint64 const guid = victim->GetGUID();
|
||||
for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
|
||||
{
|
||||
HostileReference *ref = (*i);
|
||||
HostileReference* ref = (*i);
|
||||
if (ref && ref->getUnitGuid() == guid)
|
||||
return ref;
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ void ThreatManager::_addThreat(Unit* victim, float threat)
|
|||
|
||||
if (!ref) // there was no ref => create a new one
|
||||
{
|
||||
// threat has to be 0 here
|
||||
// threat has to be 0 here
|
||||
HostileReference* hostileRef = new HostileReference(victim, this, 0);
|
||||
iThreatContainer.addReference(hostileRef);
|
||||
hostileRef->addThreat(threat); // now we add the real threat
|
||||
|
|
@ -535,8 +535,8 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
|||
switch (threatRefStatusChangeEvent->getType())
|
||||
{
|
||||
case UEV_THREAT_REF_THREAT_CHANGE:
|
||||
if ((getCurrentVictim() == hostilRef && threatRefStatusChangeEvent->getFValue()<0.0f) ||
|
||||
(getCurrentVictim() != hostilRef && threatRefStatusChangeEvent->getFValue()>0.0f))
|
||||
if ((getCurrentVictim() == hostilRef && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
|
||||
(getCurrentVictim() != hostilRef && threatRefStatusChangeEvent->getFValue() > 0.0f))
|
||||
setDirty(true); // the order in the threat list might have changed
|
||||
break;
|
||||
case UEV_THREAT_REF_ONLINE_STATUS:
|
||||
|
|
@ -594,7 +594,7 @@ bool ThreatManager::isNeedUpdateToClient(uint32 time)
|
|||
// Reset all aggro without modifying the threatlist.
|
||||
void ThreatManager::resetAllAggro()
|
||||
{
|
||||
ThreatContainer::StorageType &threatList = iThreatContainer.iThreatList;
|
||||
ThreatContainer::StorageType& threatList = iThreatContainer.iThreatList;
|
||||
if (threatList.empty())
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,87 +35,87 @@ struct ThreatCalcHelper
|
|||
//==============================================================
|
||||
class HostileReference : public Reference<Unit, ThreatManager>
|
||||
{
|
||||
public:
|
||||
HostileReference(Unit* refUnit, ThreatManager* threatManager, float threat);
|
||||
public:
|
||||
HostileReference(Unit* refUnit, ThreatManager* threatManager, float threat);
|
||||
|
||||
//=================================================
|
||||
void addThreat(float modThreat);
|
||||
//=================================================
|
||||
void addThreat(float modThreat);
|
||||
|
||||
void setThreat(float threat) { addThreat(threat - getThreat()); }
|
||||
void setThreat(float threat) { addThreat(threat - getThreat()); }
|
||||
|
||||
void addThreatPercent(int32 percent);
|
||||
void addThreatPercent(int32 percent);
|
||||
|
||||
float getThreat() const { return iThreat; }
|
||||
float getThreat() const { return iThreat; }
|
||||
|
||||
bool isOnline() const { return iOnline; }
|
||||
bool isOnline() const { return iOnline; }
|
||||
|
||||
// used for temporary setting a threat and reducting it later again.
|
||||
// the threat modification is stored
|
||||
void setTempThreat(float threat)
|
||||
// used for temporary setting a threat and reducting it later again.
|
||||
// the threat modification is stored
|
||||
void setTempThreat(float threat)
|
||||
{
|
||||
addTempThreat(threat - getThreat());
|
||||
}
|
||||
|
||||
void addTempThreat(float threat)
|
||||
{
|
||||
iTempThreatModifier = threat;
|
||||
if (iTempThreatModifier != 0.0f)
|
||||
addThreat(iTempThreatModifier);
|
||||
}
|
||||
|
||||
void resetTempThreat()
|
||||
{
|
||||
if (iTempThreatModifier != 0.0f)
|
||||
{
|
||||
addTempThreat(threat - getThreat());
|
||||
addThreat(-iTempThreatModifier);
|
||||
iTempThreatModifier = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void addTempThreat(float threat)
|
||||
{
|
||||
iTempThreatModifier = threat;
|
||||
if (iTempThreatModifier != 0.0f)
|
||||
addThreat(iTempThreatModifier);
|
||||
}
|
||||
float getTempThreatModifier() { return iTempThreatModifier; }
|
||||
|
||||
void resetTempThreat()
|
||||
{
|
||||
if (iTempThreatModifier != 0.0f)
|
||||
{
|
||||
addThreat(-iTempThreatModifier);
|
||||
iTempThreatModifier = 0.0f;
|
||||
}
|
||||
}
|
||||
//=================================================
|
||||
// check, if source can reach target and set the status
|
||||
void updateOnlineStatus();
|
||||
|
||||
float getTempThreatModifier() { return iTempThreatModifier; }
|
||||
void setOnlineOfflineState(bool isOnline);
|
||||
//=================================================
|
||||
|
||||
//=================================================
|
||||
// check, if source can reach target and set the status
|
||||
void updateOnlineStatus();
|
||||
bool operator == (const HostileReference& hostileRef) const { return hostileRef.getUnitGuid() == getUnitGuid(); }
|
||||
|
||||
void setOnlineOfflineState(bool isOnline);
|
||||
//=================================================
|
||||
//=================================================
|
||||
|
||||
bool operator == (const HostileReference& hostileRef) const { return hostileRef.getUnitGuid() == getUnitGuid(); }
|
||||
uint64 getUnitGuid() const { return iUnitGuid; }
|
||||
|
||||
//=================================================
|
||||
//=================================================
|
||||
// reference is not needed anymore. realy delete it !
|
||||
|
||||
uint64 getUnitGuid() const { return iUnitGuid; }
|
||||
void removeReference();
|
||||
|
||||
//=================================================
|
||||
// reference is not needed anymore. realy delete it !
|
||||
//=================================================
|
||||
|
||||
void removeReference();
|
||||
HostileReference* next() { return ((HostileReference*) Reference<Unit, ThreatManager>::next()); }
|
||||
|
||||
//=================================================
|
||||
//=================================================
|
||||
|
||||
HostileReference* next() { return ((HostileReference*) Reference<Unit, ThreatManager>::next()); }
|
||||
// Tell our refTo (target) object that we have a link
|
||||
void targetObjectBuildLink();
|
||||
|
||||
//=================================================
|
||||
// Tell our refTo (taget) object, that the link is cut
|
||||
void targetObjectDestroyLink();
|
||||
|
||||
// Tell our refTo (target) object that we have a link
|
||||
void targetObjectBuildLink();
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
void sourceObjectDestroyLink();
|
||||
private:
|
||||
// Inform the source, that the status of that reference was changed
|
||||
void fireStatusChanged(ThreatRefStatusChangeEvent& threatRefStatusChangeEvent);
|
||||
|
||||
// Tell our refTo (taget) object, that the link is cut
|
||||
void targetObjectDestroyLink();
|
||||
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
void sourceObjectDestroyLink();
|
||||
private:
|
||||
// Inform the source, that the status of that reference was changed
|
||||
void fireStatusChanged(ThreatRefStatusChangeEvent& threatRefStatusChangeEvent);
|
||||
|
||||
Unit* GetSourceUnit();
|
||||
private:
|
||||
float iThreat;
|
||||
float iTempThreatModifier; // used for taunt
|
||||
uint64 iUnitGuid;
|
||||
bool iOnline;
|
||||
Unit* GetSourceUnit();
|
||||
private:
|
||||
float iThreat;
|
||||
float iTempThreatModifier; // used for taunt
|
||||
uint64 iUnitGuid;
|
||||
bool iOnline;
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
|
|
@ -123,138 +123,138 @@ class ThreatManager;
|
|||
|
||||
class ThreatContainer
|
||||
{
|
||||
friend class ThreatManager;
|
||||
friend class ThreatManager;
|
||||
|
||||
public:
|
||||
typedef std::list<HostileReference*> StorageType;
|
||||
public:
|
||||
typedef std::list<HostileReference*> StorageType;
|
||||
|
||||
ThreatContainer(): iDirty(false) { }
|
||||
ThreatContainer(): iDirty(false) { }
|
||||
|
||||
~ThreatContainer() { clearReferences(); }
|
||||
~ThreatContainer() { clearReferences(); }
|
||||
|
||||
HostileReference* addThreat(Unit* victim, float threat);
|
||||
HostileReference* addThreat(Unit* victim, float threat);
|
||||
|
||||
void modifyThreatPercent(Unit* victim, int32 percent);
|
||||
void modifyThreatPercent(Unit* victim, int32 percent);
|
||||
|
||||
HostileReference* selectNextVictim(Creature* attacker, HostileReference* currentVictim) const;
|
||||
HostileReference* selectNextVictim(Creature* attacker, HostileReference* currentVictim) const;
|
||||
|
||||
void setDirty(bool isDirty) { iDirty = isDirty; }
|
||||
void setDirty(bool isDirty) { iDirty = isDirty; }
|
||||
|
||||
bool isDirty() const { return iDirty; }
|
||||
bool isDirty() const { return iDirty; }
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return iThreatList.empty();
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return iThreatList.empty();
|
||||
}
|
||||
|
||||
HostileReference* getMostHated() const
|
||||
{
|
||||
return iThreatList.empty() ? NULL : iThreatList.front();
|
||||
}
|
||||
HostileReference* getMostHated() const
|
||||
{
|
||||
return iThreatList.empty() ? NULL : iThreatList.front();
|
||||
}
|
||||
|
||||
HostileReference* getReferenceByTarget(Unit* victim) const;
|
||||
HostileReference* getReferenceByTarget(Unit* victim) const;
|
||||
|
||||
StorageType const & getThreatList() const { return iThreatList; }
|
||||
StorageType const& getThreatList() const { return iThreatList; }
|
||||
|
||||
private:
|
||||
void remove(HostileReference* hostileRef)
|
||||
{
|
||||
iThreatList.remove(hostileRef);
|
||||
}
|
||||
private:
|
||||
void remove(HostileReference* hostileRef)
|
||||
{
|
||||
iThreatList.remove(hostileRef);
|
||||
}
|
||||
|
||||
void addReference(HostileReference* hostileRef)
|
||||
{
|
||||
iThreatList.push_back(hostileRef);
|
||||
}
|
||||
void addReference(HostileReference* hostileRef)
|
||||
{
|
||||
iThreatList.push_back(hostileRef);
|
||||
}
|
||||
|
||||
void clearReferences();
|
||||
void clearReferences();
|
||||
|
||||
// Sort the list if necessary
|
||||
void update();
|
||||
// Sort the list if necessary
|
||||
void update();
|
||||
|
||||
StorageType iThreatList;
|
||||
bool iDirty;
|
||||
StorageType iThreatList;
|
||||
bool iDirty;
|
||||
};
|
||||
|
||||
//=================================================
|
||||
|
||||
class ThreatManager
|
||||
{
|
||||
public:
|
||||
friend class HostileReference;
|
||||
public:
|
||||
friend class HostileReference;
|
||||
|
||||
explicit ThreatManager(Unit* owner);
|
||||
explicit ThreatManager(Unit* owner);
|
||||
|
||||
~ThreatManager() { clearReferences(); }
|
||||
~ThreatManager() { clearReferences(); }
|
||||
|
||||
void clearReferences();
|
||||
void clearReferences();
|
||||
|
||||
void addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
|
||||
void addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
|
||||
|
||||
void doAddThreat(Unit* victim, float threat);
|
||||
void doAddThreat(Unit* victim, float threat);
|
||||
|
||||
void modifyThreatPercent(Unit* victim, int32 percent);
|
||||
void modifyThreatPercent(Unit* victim, int32 percent);
|
||||
|
||||
float getThreat(Unit* victim, bool alsoSearchOfflineList = false);
|
||||
float getThreat(Unit* victim, bool alsoSearchOfflineList = false);
|
||||
|
||||
float getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList = false);
|
||||
float getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList = false);
|
||||
|
||||
bool isThreatListEmpty() const { return iThreatContainer.empty(); }
|
||||
bool areThreatListsEmpty() const { return iThreatContainer.empty() && iThreatOfflineContainer.empty(); }
|
||||
bool isThreatListEmpty() const { return iThreatContainer.empty(); }
|
||||
bool areThreatListsEmpty() const { return iThreatContainer.empty() && iThreatOfflineContainer.empty(); }
|
||||
|
||||
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
|
||||
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
|
||||
|
||||
bool isNeedUpdateToClient(uint32 time);
|
||||
bool isNeedUpdateToClient(uint32 time);
|
||||
|
||||
HostileReference* getCurrentVictim() const { return iCurrentVictim; }
|
||||
HostileReference* getCurrentVictim() const { return iCurrentVictim; }
|
||||
|
||||
Unit* GetOwner() const { return iOwner; }
|
||||
Unit* GetOwner() const { return iOwner; }
|
||||
|
||||
Unit* getHostilTarget();
|
||||
Unit* getHostilTarget();
|
||||
|
||||
void tauntApply(Unit* taunter);
|
||||
void tauntFadeOut(Unit* taunter);
|
||||
void tauntApply(Unit* taunter);
|
||||
void tauntFadeOut(Unit* taunter);
|
||||
|
||||
void setCurrentVictim(HostileReference* hostileRef);
|
||||
void setCurrentVictim(HostileReference* hostileRef);
|
||||
|
||||
void setDirty(bool isDirty) { iThreatContainer.setDirty(isDirty); }
|
||||
void setDirty(bool isDirty) { iThreatContainer.setDirty(isDirty); }
|
||||
|
||||
// Reset all aggro without modifying the threadlist.
|
||||
void resetAllAggro();
|
||||
// Reset all aggro without modifying the threadlist.
|
||||
void resetAllAggro();
|
||||
|
||||
// Reset all aggro of unit in threadlist satisfying the predicate.
|
||||
template<class PREDICATE> void resetAggro(PREDICATE predicate)
|
||||
// Reset all aggro of unit in threadlist satisfying the predicate.
|
||||
template<class PREDICATE> void resetAggro(PREDICATE predicate)
|
||||
{
|
||||
ThreatContainer::StorageType& threatList = iThreatContainer.iThreatList;
|
||||
if (threatList.empty())
|
||||
return;
|
||||
|
||||
for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
{
|
||||
ThreatContainer::StorageType &threatList = iThreatContainer.iThreatList;
|
||||
if (threatList.empty())
|
||||
return;
|
||||
HostileReference* ref = (*itr);
|
||||
|
||||
for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
if (predicate(ref->getTarget()))
|
||||
{
|
||||
HostileReference* ref = (*itr);
|
||||
|
||||
if (predicate(ref->getTarget()))
|
||||
{
|
||||
ref->setThreat(0);
|
||||
setDirty(true);
|
||||
}
|
||||
ref->setThreat(0);
|
||||
setDirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
|
||||
// I hope they are used as little as possible.
|
||||
ThreatContainer::StorageType const & getThreatList() const { return iThreatContainer.getThreatList(); }
|
||||
ThreatContainer::StorageType const & getOfflineThreatList() const { return iThreatOfflineContainer.getThreatList(); }
|
||||
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
|
||||
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
|
||||
private:
|
||||
void _addThreat(Unit* victim, float threat);
|
||||
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
|
||||
// I hope they are used as little as possible.
|
||||
ThreatContainer::StorageType const& getThreatList() const { return iThreatContainer.getThreatList(); }
|
||||
ThreatContainer::StorageType const& getOfflineThreatList() const { return iThreatOfflineContainer.getThreatList(); }
|
||||
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
|
||||
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
|
||||
private:
|
||||
void _addThreat(Unit* victim, float threat);
|
||||
|
||||
HostileReference* iCurrentVictim;
|
||||
Unit* iOwner;
|
||||
uint32 iUpdateTimer;
|
||||
ThreatContainer iThreatContainer;
|
||||
ThreatContainer iThreatOfflineContainer;
|
||||
HostileReference* iCurrentVictim;
|
||||
Unit* iOwner;
|
||||
uint32 iUpdateTimer;
|
||||
ThreatContainer iThreatContainer;
|
||||
ThreatContainer iThreatOfflineContainer;
|
||||
};
|
||||
|
||||
//=================================================
|
||||
|
|
@ -264,14 +264,14 @@ namespace acore
|
|||
// Binary predicate for sorting HostileReferences based on threat value
|
||||
class ThreatOrderPred
|
||||
{
|
||||
public:
|
||||
ThreatOrderPred(bool ascending = false) : m_ascending(ascending) {}
|
||||
bool operator() (HostileReference const* a, HostileReference const* b) const
|
||||
{
|
||||
return m_ascending ? a->getThreat() < b->getThreat() : a->getThreat() > b->getThreat();
|
||||
}
|
||||
private:
|
||||
const bool m_ascending;
|
||||
public:
|
||||
ThreatOrderPred(bool ascending = false) : m_ascending(ascending) {}
|
||||
bool operator() (HostileReference const* a, HostileReference const* b) const
|
||||
{
|
||||
return m_ascending ? a->getThreat() < b->getThreat() : a->getThreat() > b->getThreat();
|
||||
}
|
||||
private:
|
||||
const bool m_ascending;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,25 +19,25 @@ class HostileReference;
|
|||
enum UNIT_EVENT_TYPE
|
||||
{
|
||||
// Player/Pet changed on/offline status
|
||||
UEV_THREAT_REF_ONLINE_STATUS = 1<<0,
|
||||
UEV_THREAT_REF_ONLINE_STATUS = 1 << 0,
|
||||
|
||||
// Threat for Player/Pet changed
|
||||
UEV_THREAT_REF_THREAT_CHANGE = 1<<1,
|
||||
UEV_THREAT_REF_THREAT_CHANGE = 1 << 1,
|
||||
|
||||
// Player/Pet will be removed from list (dead) [for internal use]
|
||||
UEV_THREAT_REF_REMOVE_FROM_LIST = 1<<2,
|
||||
UEV_THREAT_REF_REMOVE_FROM_LIST = 1 << 2,
|
||||
|
||||
// Player/Pet entered/left water or some other place where it is/was not accessible for the creature
|
||||
UEV_THREAT_REF_ASSECCIBLE_STATUS = 1<<3,
|
||||
UEV_THREAT_REF_ASSECCIBLE_STATUS = 1 << 3,
|
||||
|
||||
// Threat list is going to be sorted (if dirty flag is set)
|
||||
UEV_THREAT_SORT_LIST = 1<<4,
|
||||
UEV_THREAT_SORT_LIST = 1 << 4,
|
||||
|
||||
// New target should be fetched, could tbe the current target as well
|
||||
UEV_THREAT_SET_NEXT_TARGET = 1<<5,
|
||||
UEV_THREAT_SET_NEXT_TARGET = 1 << 5,
|
||||
|
||||
// A new victim (target) was set. Could be NULL
|
||||
UEV_THREAT_VICTIM_CHANGED = 1<<6,
|
||||
UEV_THREAT_VICTIM_CHANGED = 1 << 6,
|
||||
|
||||
// Future use
|
||||
//UEV_UNIT_KILLED = 1<<7,
|
||||
|
|
@ -57,14 +57,14 @@ enum UNIT_EVENT_TYPE
|
|||
|
||||
class UnitBaseEvent
|
||||
{
|
||||
private:
|
||||
uint32 iType;
|
||||
public:
|
||||
UnitBaseEvent(uint32 pType) { iType = pType; }
|
||||
uint32 getType() const { return iType; }
|
||||
bool matchesTypeMask(uint32 pMask) const { return iType & pMask; }
|
||||
private:
|
||||
uint32 iType;
|
||||
public:
|
||||
UnitBaseEvent(uint32 pType) { iType = pType; }
|
||||
uint32 getType() const { return iType; }
|
||||
bool matchesTypeMask(uint32 pMask) const { return iType & pMask; }
|
||||
|
||||
void setType(uint32 pType) { iType = pType; }
|
||||
void setType(uint32 pType) { iType = pType; }
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -72,52 +72,52 @@ class UnitBaseEvent
|
|||
|
||||
class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
||||
{
|
||||
private:
|
||||
HostileReference* iHostileReference;
|
||||
union
|
||||
{
|
||||
float iFValue;
|
||||
int32 iIValue;
|
||||
bool iBValue;
|
||||
};
|
||||
ThreatManager* iThreatManager;
|
||||
public:
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = nullptr; }
|
||||
private:
|
||||
HostileReference* iHostileReference;
|
||||
union
|
||||
{
|
||||
float iFValue;
|
||||
int32 iIValue;
|
||||
bool iBValue;
|
||||
};
|
||||
ThreatManager* iThreatManager;
|
||||
public:
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = nullptr; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
|
||||
int32 getIValue() const { return iIValue; }
|
||||
int32 getIValue() const { return iIValue; }
|
||||
|
||||
float getFValue() const { return iFValue; }
|
||||
float getFValue() const { return iFValue; }
|
||||
|
||||
bool getBValue() const { return iBValue; }
|
||||
bool getBValue() const { return iBValue; }
|
||||
|
||||
void setBValue(bool pValue) { iBValue = pValue; }
|
||||
void setBValue(bool pValue) { iBValue = pValue; }
|
||||
|
||||
HostileReference* getReference() const { return iHostileReference; }
|
||||
HostileReference* getReference() const { return iHostileReference; }
|
||||
|
||||
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
|
||||
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
|
||||
|
||||
ThreatManager* getThreatManager() const { return iThreatManager; }
|
||||
ThreatManager* getThreatManager() const { return iThreatManager; }
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
|
||||
class ThreatManagerEvent : public ThreatRefStatusChangeEvent
|
||||
{
|
||||
private:
|
||||
ThreatContainer* iThreatContainer;
|
||||
public:
|
||||
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(nullptr) {}
|
||||
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(nullptr) {}
|
||||
private:
|
||||
ThreatContainer* iThreatContainer;
|
||||
public:
|
||||
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(nullptr) {}
|
||||
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(nullptr) {}
|
||||
|
||||
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
|
||||
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
|
||||
|
||||
ThreatContainer* getThreatContainer() const { return iThreatContainer; }
|
||||
ThreatContainer* getThreatContainer() const { return iThreatContainer; }
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,7 +19,8 @@ class LootTemplate;
|
|||
struct Condition;
|
||||
|
||||
enum ConditionTypes
|
||||
{ // value1 value2 value3
|
||||
{
|
||||
// value1 value2 value3
|
||||
CONDITION_NONE = 0, // 0 0 0 always true
|
||||
CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex
|
||||
CONDITION_ITEM = 2, // item_id count bank true if has #count of item_ids (if 'bank' is set it searches in bank slots too)
|
||||
|
|
@ -228,46 +229,46 @@ typedef std::map<uint32, ConditionList> ConditionReferenceContainer;//only used
|
|||
|
||||
class ConditionMgr
|
||||
{
|
||||
private:
|
||||
ConditionMgr();
|
||||
~ConditionMgr();
|
||||
private:
|
||||
ConditionMgr();
|
||||
~ConditionMgr();
|
||||
|
||||
public:
|
||||
static ConditionMgr* instance();
|
||||
public:
|
||||
static ConditionMgr* instance();
|
||||
|
||||
void LoadConditions(bool isReload = false);
|
||||
bool isConditionTypeValid(Condition* cond);
|
||||
ConditionList GetConditionReferences(uint32 refId);
|
||||
void LoadConditions(bool isReload = false);
|
||||
bool isConditionTypeValid(Condition* cond);
|
||||
ConditionList GetConditionReferences(uint32 refId);
|
||||
|
||||
uint32 GetSearcherTypeMaskForConditionList(ConditionList const& conditions);
|
||||
bool IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions);
|
||||
bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions);
|
||||
bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
|
||||
bool CanHaveSourceGroupSet(ConditionSourceType sourceType) const;
|
||||
bool CanHaveSourceIdSet(ConditionSourceType sourceType) const;
|
||||
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
|
||||
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
|
||||
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
|
||||
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
|
||||
ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
|
||||
uint32 GetSearcherTypeMaskForConditionList(ConditionList const& conditions);
|
||||
bool IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions);
|
||||
bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions);
|
||||
bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
|
||||
bool CanHaveSourceGroupSet(ConditionSourceType sourceType) const;
|
||||
bool CanHaveSourceIdSet(ConditionSourceType sourceType) const;
|
||||
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
|
||||
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
|
||||
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
|
||||
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
|
||||
ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
|
||||
|
||||
private:
|
||||
bool isSourceTypeValid(Condition* cond);
|
||||
bool addToLootTemplate(Condition* cond, LootTemplate* loot);
|
||||
bool addToGossipMenus(Condition* cond);
|
||||
bool addToGossipMenuItems(Condition* cond);
|
||||
bool addToSpellImplicitTargetConditions(Condition* cond);
|
||||
bool IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
|
||||
private:
|
||||
bool isSourceTypeValid(Condition* cond);
|
||||
bool addToLootTemplate(Condition* cond, LootTemplate* loot);
|
||||
bool addToGossipMenus(Condition* cond);
|
||||
bool addToGossipMenuItems(Condition* cond);
|
||||
bool addToSpellImplicitTargetConditions(Condition* cond);
|
||||
bool IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
|
||||
|
||||
void Clean(); // free up resources
|
||||
std::list<Condition*> AllocatedMemoryStore; // some garbage collection :)
|
||||
void Clean(); // free up resources
|
||||
std::list<Condition*> AllocatedMemoryStore; // some garbage collection :)
|
||||
|
||||
ConditionContainer ConditionStore;
|
||||
ConditionReferenceContainer ConditionReferenceStore;
|
||||
CreatureSpellConditionContainer VehicleSpellConditionStore;
|
||||
CreatureSpellConditionContainer SpellClickEventConditionStore;
|
||||
NpcVendorConditionContainer NpcVendorConditionContainerStore;
|
||||
SmartEventConditionContainer SmartEventConditionStore;
|
||||
ConditionContainer ConditionStore;
|
||||
ConditionReferenceContainer ConditionReferenceStore;
|
||||
CreatureSpellConditionContainer VehicleSpellConditionStore;
|
||||
CreatureSpellConditionContainer SpellClickEventConditionStore;
|
||||
NpcVendorConditionContainer NpcVendorConditionContainerStore;
|
||||
SmartEventConditionContainer SmartEventConditionStore;
|
||||
};
|
||||
|
||||
#define sConditionMgr ConditionMgr::instance()
|
||||
|
|
|
|||
|
|
@ -15,350 +15,349 @@
|
|||
namespace DisableMgr
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
struct DisableData
|
||||
namespace
|
||||
{
|
||||
uint8 flags;
|
||||
std::set<uint32> params[2]; // params0, params1
|
||||
};
|
||||
struct DisableData
|
||||
{
|
||||
uint8 flags;
|
||||
std::set<uint32> params[2]; // params0, params1
|
||||
};
|
||||
|
||||
// single disables here with optional data
|
||||
typedef std::map<uint32, DisableData> DisableTypeMap;
|
||||
// global disable map by source
|
||||
typedef std::map<DisableType, DisableTypeMap> DisableMap;
|
||||
// single disables here with optional data
|
||||
typedef std::map<uint32, DisableData> DisableTypeMap;
|
||||
// global disable map by source
|
||||
typedef std::map<DisableType, DisableTypeMap> DisableMap;
|
||||
|
||||
DisableMap m_DisableMap;
|
||||
DisableMap m_DisableMap;
|
||||
|
||||
uint8 MAX_DISABLE_TYPES = 9;
|
||||
}
|
||||
|
||||
void LoadDisables()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// reload case
|
||||
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
|
||||
itr->second.clear();
|
||||
|
||||
m_DisableMap.clear();
|
||||
|
||||
QueryResult result = WorldDatabase.Query("SELECT sourceType, entry, flags, params_0, params_1 FROM disables");
|
||||
|
||||
uint32 total_count = 0;
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!");
|
||||
sLog->outString();
|
||||
return;
|
||||
uint8 MAX_DISABLE_TYPES = 9;
|
||||
}
|
||||
|
||||
Field* fields;
|
||||
do
|
||||
void LoadDisables()
|
||||
{
|
||||
fields = result->Fetch();
|
||||
DisableType type = DisableType(fields[0].GetUInt32());
|
||||
if (type >= MAX_DISABLE_TYPES)
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// reload case
|
||||
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
|
||||
itr->second.clear();
|
||||
|
||||
m_DisableMap.clear();
|
||||
|
||||
QueryResult result = WorldDatabase.Query("SELECT sourceType, entry, flags, params_0, params_1 FROM disables");
|
||||
|
||||
uint32 total_count = 0;
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type);
|
||||
continue;
|
||||
sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!");
|
||||
sLog->outString();
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 entry = fields[1].GetUInt32();
|
||||
uint8 flags = fields[2].GetUInt8();
|
||||
std::string params_0 = fields[3].GetString();
|
||||
std::string params_1 = fields[4].GetString();
|
||||
Field* fields;
|
||||
do
|
||||
{
|
||||
fields = result->Fetch();
|
||||
DisableType type = DisableType(fields[0].GetUInt32());
|
||||
if (type >= MAX_DISABLE_TYPES)
|
||||
{
|
||||
sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
DisableData data;
|
||||
data.flags = flags;
|
||||
uint32 entry = fields[1].GetUInt32();
|
||||
uint8 flags = fields[2].GetUInt8();
|
||||
std::string params_0 = fields[3].GetString();
|
||||
std::string params_1 = fields[4].GetString();
|
||||
|
||||
DisableData data;
|
||||
data.flags = flags;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DISABLE_TYPE_GO_LOS:
|
||||
if (!sObjectMgr->GetGameObjectTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("Gameobject entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for gameobject %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_SPELL:
|
||||
if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
|
||||
{
|
||||
sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
|
||||
{
|
||||
sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (flags & SPELL_DISABLE_MAP)
|
||||
{
|
||||
Tokenizer tokens(params_0, ',');
|
||||
for (uint8 i = 0; i < tokens.size(); )
|
||||
data.params[0].insert(atoi(tokens[i++]));
|
||||
}
|
||||
|
||||
if (flags & SPELL_DISABLE_AREA)
|
||||
{
|
||||
Tokenizer tokens(params_1, ',');
|
||||
for (uint8 i = 0; i < tokens.size(); )
|
||||
data.params[1].insert(atoi(tokens[i++]));
|
||||
}
|
||||
|
||||
// xinef: if spell has disabled los, add flag
|
||||
if (flags & SPELL_DISABLE_LOS)
|
||||
{
|
||||
SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(entry));
|
||||
spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS;
|
||||
}
|
||||
|
||||
break;
|
||||
// checked later
|
||||
case DISABLE_TYPE_QUEST:
|
||||
break;
|
||||
case DISABLE_TYPE_MAP:
|
||||
case DISABLE_TYPE_LFG_MAP:
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||
if (!mapEntry)
|
||||
{
|
||||
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
bool isFlagInvalid = false;
|
||||
switch (mapEntry->map_type)
|
||||
{
|
||||
case MAP_COMMON:
|
||||
if (flags)
|
||||
isFlagInvalid = true;
|
||||
break;
|
||||
case MAP_INSTANCE:
|
||||
case MAP_RAID:
|
||||
if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC))
|
||||
isFlagInvalid = true;
|
||||
else if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC))
|
||||
isFlagInvalid = true;
|
||||
else if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC))
|
||||
isFlagInvalid = true;
|
||||
break;
|
||||
case MAP_BATTLEGROUND:
|
||||
case MAP_ARENA:
|
||||
sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (isFlagInvalid)
|
||||
{
|
||||
sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DISABLE_TYPE_BATTLEGROUND:
|
||||
if (!sBattlemasterListStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_OUTDOORPVP:
|
||||
if (entry > MAX_OUTDOORPVP_TYPES)
|
||||
{
|
||||
sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
||||
if (!sAchievementCriteriaStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_VMAP:
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||
if (!mapEntry)
|
||||
{
|
||||
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
switch (mapEntry->map_type)
|
||||
{
|
||||
case MAP_COMMON:
|
||||
if (flags & VMAP_DISABLE_AREAFLAG)
|
||||
sLog->outString("Areaflag disabled for world map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
|
||||
sLog->outString("Liquid status disabled for world map %u.", entry);
|
||||
break;
|
||||
case MAP_INSTANCE:
|
||||
case MAP_RAID:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
sLog->outString("Height disabled for instance map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
sLog->outString("LoS disabled for instance map %u.", entry);
|
||||
break;
|
||||
case MAP_BATTLEGROUND:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
sLog->outString("Height disabled for battleground map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
sLog->outString("LoS disabled for battleground map %u.", entry);
|
||||
break;
|
||||
case MAP_ARENA:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
sLog->outString("Height disabled for arena map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
sLog->outString("LoS disabled for arena map %u.", entry);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
|
||||
++total_count;
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void CheckQuestDisables()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
|
||||
if (!count)
|
||||
{
|
||||
sLog->outString(">> Checked 0 quest disables.");
|
||||
sLog->outString();
|
||||
return;
|
||||
}
|
||||
|
||||
// check only quests, rest already done at startup
|
||||
for (DisableTypeMap::iterator itr = m_DisableMap[DISABLE_TYPE_QUEST].begin(); itr != m_DisableMap[DISABLE_TYPE_QUEST].end();)
|
||||
{
|
||||
const uint32 entry = itr->first;
|
||||
if (!sObjectMgr->GetQuestTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry);
|
||||
m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++);
|
||||
continue;
|
||||
}
|
||||
if (itr->second.flags)
|
||||
sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry);
|
||||
++itr;
|
||||
}
|
||||
|
||||
sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
|
||||
{
|
||||
ASSERT(type < MAX_DISABLE_TYPES);
|
||||
if (m_DisableMap[type].empty())
|
||||
return false;
|
||||
|
||||
DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
|
||||
if (itr == m_DisableMap[type].end()) // not disabled
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DISABLE_TYPE_GO_LOS:
|
||||
if (!sObjectMgr->GetGameObjectTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("Gameobject entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for gameobject %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_SPELL:
|
||||
if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
|
||||
{
|
||||
sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
uint8 spellFlags = itr->second.flags;
|
||||
if (unit)
|
||||
{
|
||||
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
|
||||
(unit->GetTypeId() == TYPEID_UNIT && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
|
||||
{
|
||||
if (spellFlags & SPELL_DISABLE_MAP)
|
||||
{
|
||||
std::set<uint32> const& mapIds = itr->second.params[0];
|
||||
if (mapIds.find(unit->GetMapId()) != mapIds.end())
|
||||
return true; // Spell is disabled on current map
|
||||
|
||||
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
|
||||
{
|
||||
sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (!(spellFlags & SPELL_DISABLE_AREA))
|
||||
return false; // Spell is disabled on another map, but not this one, return false
|
||||
|
||||
if (flags & SPELL_DISABLE_MAP)
|
||||
{
|
||||
Tokenizer tokens(params_0, ',');
|
||||
for (uint8 i = 0; i < tokens.size(); )
|
||||
data.params[0].insert(atoi(tokens[i++]));
|
||||
}
|
||||
// Spell is disabled in an area, but not explicitly our current mapId. Continue processing.
|
||||
}
|
||||
|
||||
if (flags & SPELL_DISABLE_AREA)
|
||||
{
|
||||
Tokenizer tokens(params_1, ',');
|
||||
for (uint8 i = 0; i < tokens.size(); )
|
||||
data.params[1].insert(atoi(tokens[i++]));
|
||||
}
|
||||
if (spellFlags & SPELL_DISABLE_AREA)
|
||||
{
|
||||
std::set<uint32> const& areaIds = itr->second.params[1];
|
||||
if (areaIds.find(unit->GetAreaId()) != areaIds.end())
|
||||
return true; // Spell is disabled in this area
|
||||
return false; // Spell is disabled in another area, but not this one, return false
|
||||
}
|
||||
else
|
||||
return true; // Spell disabled for all maps
|
||||
}
|
||||
|
||||
// xinef: if spell has disabled los, add flag
|
||||
if (flags & SPELL_DISABLE_LOS)
|
||||
{
|
||||
SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(entry));
|
||||
spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
|
||||
return true;
|
||||
|
||||
break;
|
||||
// checked later
|
||||
case DISABLE_TYPE_QUEST:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case DISABLE_TYPE_MAP:
|
||||
case DISABLE_TYPE_LFG_MAP:
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||
if (!mapEntry)
|
||||
if (Player const* player = unit->ToPlayer())
|
||||
{
|
||||
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
bool isFlagInvalid = false;
|
||||
switch (mapEntry->map_type)
|
||||
{
|
||||
case MAP_COMMON:
|
||||
if (flags)
|
||||
isFlagInvalid = true;
|
||||
break;
|
||||
case MAP_INSTANCE:
|
||||
case MAP_RAID:
|
||||
if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC))
|
||||
isFlagInvalid = true;
|
||||
else if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC))
|
||||
isFlagInvalid = true;
|
||||
else if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC))
|
||||
isFlagInvalid = true;
|
||||
break;
|
||||
case MAP_BATTLEGROUND:
|
||||
case MAP_ARENA:
|
||||
sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (isFlagInvalid)
|
||||
{
|
||||
sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DISABLE_TYPE_BATTLEGROUND:
|
||||
if (!sBattlemasterListStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_OUTDOORPVP:
|
||||
if (entry > MAX_OUTDOORPVP_TYPES)
|
||||
{
|
||||
sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
||||
if (!sAchievementCriteriaStore.LookupEntry(entry))
|
||||
{
|
||||
sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
if (flags)
|
||||
sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
|
||||
break;
|
||||
case DISABLE_TYPE_VMAP:
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||
if (!mapEntry)
|
||||
{
|
||||
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||
continue;
|
||||
}
|
||||
switch (mapEntry->map_type)
|
||||
{
|
||||
case MAP_COMMON:
|
||||
if (flags & VMAP_DISABLE_AREAFLAG)
|
||||
sLog->outString("Areaflag disabled for world map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
|
||||
sLog->outString("Liquid status disabled for world map %u.", entry);
|
||||
break;
|
||||
case MAP_INSTANCE:
|
||||
case MAP_RAID:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
sLog->outString("Height disabled for instance map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
sLog->outString("LoS disabled for instance map %u.", entry);
|
||||
break;
|
||||
case MAP_BATTLEGROUND:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
sLog->outString("Height disabled for battleground map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
sLog->outString("LoS disabled for battleground map %u.", entry);
|
||||
break;
|
||||
case MAP_ARENA:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
sLog->outString("Height disabled for arena map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
sLog->outString("LoS disabled for arena map %u.", entry);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
|
||||
++total_count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void CheckQuestDisables()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
|
||||
if (!count)
|
||||
{
|
||||
sLog->outString(">> Checked 0 quest disables.");
|
||||
sLog->outString();
|
||||
return;
|
||||
}
|
||||
|
||||
// check only quests, rest already done at startup
|
||||
for (DisableTypeMap::iterator itr = m_DisableMap[DISABLE_TYPE_QUEST].begin(); itr != m_DisableMap[DISABLE_TYPE_QUEST].end();)
|
||||
{
|
||||
const uint32 entry = itr->first;
|
||||
if (!sObjectMgr->GetQuestTemplate(entry))
|
||||
{
|
||||
sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry);
|
||||
m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++);
|
||||
continue;
|
||||
}
|
||||
if (itr->second.flags)
|
||||
sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry);
|
||||
++itr;
|
||||
}
|
||||
|
||||
sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
|
||||
{
|
||||
ASSERT(type < MAX_DISABLE_TYPES);
|
||||
if (m_DisableMap[type].empty())
|
||||
return false;
|
||||
|
||||
DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
|
||||
if (itr == m_DisableMap[type].end()) // not disabled
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DISABLE_TYPE_SPELL:
|
||||
{
|
||||
uint8 spellFlags = itr->second.flags;
|
||||
if (unit)
|
||||
{
|
||||
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
|
||||
(unit->GetTypeId() == TYPEID_UNIT && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
|
||||
{
|
||||
if (spellFlags & SPELL_DISABLE_MAP)
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||
if (mapEntry->IsDungeon())
|
||||
{
|
||||
std::set<uint32> const& mapIds = itr->second.params[0];
|
||||
if (mapIds.find(unit->GetMapId()) != mapIds.end())
|
||||
return true; // Spell is disabled on current map
|
||||
|
||||
if (!(spellFlags & SPELL_DISABLE_AREA))
|
||||
return false; // Spell is disabled on another map, but not this one, return false
|
||||
|
||||
// Spell is disabled in an area, but not explicitly our current mapId. Continue processing.
|
||||
uint8 disabledModes = itr->second.flags;
|
||||
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
|
||||
GetDownscaledMapDifficultyData(entry, targetDifficulty);
|
||||
switch (targetDifficulty)
|
||||
{
|
||||
case DUNGEON_DIFFICULTY_NORMAL:
|
||||
return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
|
||||
case DUNGEON_DIFFICULTY_HEROIC:
|
||||
return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
|
||||
case RAID_DIFFICULTY_10MAN_HEROIC:
|
||||
return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
|
||||
case RAID_DIFFICULTY_25MAN_HEROIC:
|
||||
return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
|
||||
}
|
||||
}
|
||||
|
||||
if (spellFlags & SPELL_DISABLE_AREA)
|
||||
{
|
||||
std::set<uint32> const& areaIds = itr->second.params[1];
|
||||
if (areaIds.find(unit->GetAreaId()) != areaIds.end())
|
||||
return true; // Spell is disabled in this area
|
||||
return false; // Spell is disabled in another area, but not this one, return false
|
||||
}
|
||||
else
|
||||
return true; // Spell disabled for all maps
|
||||
else if (mapEntry->map_type == MAP_COMMON)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
|
||||
case DISABLE_TYPE_QUEST:
|
||||
return true;
|
||||
case DISABLE_TYPE_BATTLEGROUND:
|
||||
case DISABLE_TYPE_OUTDOORPVP:
|
||||
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
||||
return true;
|
||||
case DISABLE_TYPE_VMAP:
|
||||
return flags & itr->second.flags;
|
||||
case DISABLE_TYPE_GO_LOS:
|
||||
return true;
|
||||
|
||||
break;
|
||||
}
|
||||
case DISABLE_TYPE_MAP:
|
||||
case DISABLE_TYPE_LFG_MAP:
|
||||
if (Player const* player = unit->ToPlayer())
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||
if (mapEntry->IsDungeon())
|
||||
{
|
||||
uint8 disabledModes = itr->second.flags;
|
||||
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
|
||||
GetDownscaledMapDifficultyData(entry, targetDifficulty);
|
||||
switch (targetDifficulty)
|
||||
{
|
||||
case DUNGEON_DIFFICULTY_NORMAL:
|
||||
return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
|
||||
case DUNGEON_DIFFICULTY_HEROIC:
|
||||
return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
|
||||
case RAID_DIFFICULTY_10MAN_HEROIC:
|
||||
return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
|
||||
case RAID_DIFFICULTY_25MAN_HEROIC:
|
||||
return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
|
||||
}
|
||||
}
|
||||
else if (mapEntry->map_type == MAP_COMMON)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case DISABLE_TYPE_QUEST:
|
||||
return true;
|
||||
case DISABLE_TYPE_BATTLEGROUND:
|
||||
case DISABLE_TYPE_OUTDOORPVP:
|
||||
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
||||
return true;
|
||||
case DISABLE_TYPE_VMAP:
|
||||
return flags & itr->second.flags;
|
||||
case DISABLE_TYPE_GO_LOS:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
|
|
|
|||
|
|
@ -345,13 +345,13 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
LOAD_DBC(sVehicleSeatStore, "VehicleSeat.dbc", "vehicleseat_dbc");
|
||||
LOAD_DBC(sWMOAreaTableStore, "WMOAreaTable.dbc", "wmoareatable_dbc");
|
||||
LOAD_DBC(sWorldMapAreaStore, "WorldMapArea.dbc", "worldmaparea_dbc");
|
||||
LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
|
||||
LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
|
||||
|
||||
#undef LOAD_DBC
|
||||
|
||||
for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
|
||||
sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
|
||||
|
||||
|
||||
for (FactionEntry const* faction : sFactionStore)
|
||||
{
|
||||
if (faction->team)
|
||||
|
|
@ -360,7 +360,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
flist.push_back(faction->ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (GameObjectDisplayInfoEntry const* info : sGameObjectDisplayInfoStore)
|
||||
{
|
||||
if (info->maxX < info->minX)
|
||||
|
|
@ -372,7 +372,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
if (info->maxZ < info->minZ)
|
||||
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
|
||||
}
|
||||
|
||||
|
||||
// fill data
|
||||
for (MapDifficultyEntry const* entry : sMapDifficultyStore)
|
||||
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] != '\0');
|
||||
|
|
@ -380,7 +380,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
|
||||
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
|
||||
ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
|
||||
|
||||
|
||||
for (auto i : sSpellStore)
|
||||
if (i->Category)
|
||||
sSpellsByCategoryStore[i->Category].insert(i->Id);
|
||||
|
|
@ -459,12 +459,12 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
|
||||
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
|
||||
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price);
|
||||
|
||||
|
||||
|
||||
|
||||
// Calculate path nodes count
|
||||
uint32 pathCount = sTaxiPathStore.GetNumRows();
|
||||
|
|
@ -499,7 +499,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
memset(sHordeTaxiNodesMask, 0, sizeof(sHordeTaxiNodesMask));
|
||||
memset(sAllianceTaxiNodesMask, 0, sizeof(sAllianceTaxiNodesMask));
|
||||
memset(sDeathKnightTaxiNodesMask, 0, sizeof(sDeathKnightTaxiNodesMask));
|
||||
|
||||
|
||||
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
|
||||
{
|
||||
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
|
||||
|
|
@ -526,7 +526,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
|
||||
// valid taxi network node
|
||||
uint8 field = (uint8)((i - 1) / 32);
|
||||
uint32 submask = 1<<((i-1)%32);
|
||||
uint32 submask = 1 << ((i - 1) % 32);
|
||||
sTaxiNodesMask[field] |= submask;
|
||||
|
||||
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
|
||||
|
|
@ -550,7 +550,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
|
||||
for (TransportAnimationEntry const* anim : sTransportAnimationStore)
|
||||
sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);
|
||||
|
||||
|
||||
for (TransportRotationEntry const* rot : sTransportRotationStore)
|
||||
sTransportMgr->AddPathRotationToTransport(rot->TransportEntry, rot->TimeSeg, rot);
|
||||
|
||||
|
|
@ -575,11 +575,11 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
|
||||
// Check loaded DBC files proper version
|
||||
if (!sAreaTableStore.LookupEntry(4987) || // last area added in 3.3.5a
|
||||
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
|
||||
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
|
||||
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
|
||||
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
|
||||
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
|
||||
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
|
||||
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
|
||||
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
|
||||
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
|
||||
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
|
||||
{
|
||||
sLog->outError("You have _outdated_ DBC data. Please extract correct versions from current using client.");
|
||||
exit(1);
|
||||
|
|
@ -622,7 +622,7 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
|
|||
uint32 GetTalentSpellCost(uint32 spellId)
|
||||
{
|
||||
if (TalentSpellPos const* pos = GetTalentSpellPos(spellId))
|
||||
return pos->rank+1;
|
||||
return pos->rank + 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -659,9 +659,12 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
|
|||
|
||||
switch (mapEntry->Expansion())
|
||||
{
|
||||
default: return CONTENT_1_60;
|
||||
case 1: return CONTENT_61_70;
|
||||
case 2: return CONTENT_71_80;
|
||||
default:
|
||||
return CONTENT_1_60;
|
||||
case 1:
|
||||
return CONTENT_61_70;
|
||||
case 2:
|
||||
return CONTENT_71_80;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -674,8 +677,8 @@ void Zone2MapCoordinates(float& x, float& y, uint32 zone)
|
|||
return;
|
||||
|
||||
std::swap(x, y); // at client map coords swapped
|
||||
x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1;
|
||||
y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down
|
||||
x = x * ((maEntry->x2 - maEntry->x1) / 100) + maEntry->x1;
|
||||
y = y * ((maEntry->y2 - maEntry->y1) / 100) + maEntry->y1; // client y coord from top to down
|
||||
}
|
||||
|
||||
void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
|
||||
|
|
@ -686,8 +689,8 @@ void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
|
|||
if (!maEntry)
|
||||
return;
|
||||
|
||||
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
|
||||
y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down
|
||||
x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100);
|
||||
y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down
|
||||
std::swap(x, y); // client have map coords swapped
|
||||
}
|
||||
|
||||
|
|
@ -697,7 +700,7 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
|
|||
return itr != sMapDifficultyMap.end() ? &itr->second : nullptr;
|
||||
}
|
||||
|
||||
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
|
||||
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty& difficulty)
|
||||
{
|
||||
uint32 tmpDiff = difficulty;
|
||||
|
||||
|
|
@ -760,7 +763,7 @@ uint32 const* GetTalentTabPages(uint8 cls)
|
|||
}
|
||||
|
||||
bool IsSharedDifficultyMap(uint32 mapid)
|
||||
{
|
||||
{
|
||||
return sWorld->getBoolConfig(CONFIG_INSTANCE_SHARED_ID) && (mapid == 631 || mapid == 724);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ enum ContentLevels
|
|||
};
|
||||
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
|
||||
|
||||
void Zone2MapCoordinates(float &x, float &y, uint32 zone);
|
||||
void Map2ZoneCoordinates(float &x, float &y, uint32 zone);
|
||||
void Zone2MapCoordinates(float& x, float& y, uint32 zone);
|
||||
void Map2ZoneCoordinates(float& x, float& y, uint32 zone);
|
||||
|
||||
typedef std::map<uint32/*pair32(map, diff)*/, MapDifficulty> MapDifficultyMap;
|
||||
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
|
||||
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
|
||||
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty& difficulty);
|
||||
|
||||
bool IsSharedDifficultyMap(uint32 mapid);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,30 +65,30 @@ namespace lfg
|
|||
int32 entry = LANG_LFG_ERROR;
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
entry = LANG_LFG_STATE_NONE;
|
||||
break;
|
||||
case LFG_STATE_ROLECHECK:
|
||||
entry = LANG_LFG_STATE_ROLECHECK;
|
||||
break;
|
||||
case LFG_STATE_QUEUED:
|
||||
entry = LANG_LFG_STATE_QUEUED;
|
||||
break;
|
||||
case LFG_STATE_PROPOSAL:
|
||||
entry = LANG_LFG_STATE_PROPOSAL;
|
||||
break;
|
||||
case LFG_STATE_DUNGEON:
|
||||
entry = LANG_LFG_STATE_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_BOOT:
|
||||
entry = LANG_LFG_STATE_BOOT;
|
||||
break;
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
entry = LANG_LFG_STATE_FINISHED_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_RAIDBROWSER:
|
||||
entry = LANG_LFG_STATE_RAIDBROWSER;
|
||||
break;
|
||||
case LFG_STATE_NONE:
|
||||
entry = LANG_LFG_STATE_NONE;
|
||||
break;
|
||||
case LFG_STATE_ROLECHECK:
|
||||
entry = LANG_LFG_STATE_ROLECHECK;
|
||||
break;
|
||||
case LFG_STATE_QUEUED:
|
||||
entry = LANG_LFG_STATE_QUEUED;
|
||||
break;
|
||||
case LFG_STATE_PROPOSAL:
|
||||
entry = LANG_LFG_STATE_PROPOSAL;
|
||||
break;
|
||||
case LFG_STATE_DUNGEON:
|
||||
entry = LANG_LFG_STATE_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_BOOT:
|
||||
entry = LANG_LFG_STATE_BOOT;
|
||||
break;
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
entry = LANG_LFG_STATE_FINISHED_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_RAIDBROWSER:
|
||||
entry = LANG_LFG_STATE_RAIDBROWSER;
|
||||
break;
|
||||
}
|
||||
|
||||
return std::string(sObjectMgr->GetAcoreStringForDBCLocale(entry));
|
||||
|
|
|
|||
|
|
@ -15,163 +15,246 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
enum LFGEnum
|
||||
{
|
||||
LFG_TANKS_NEEDED = 1,
|
||||
LFG_HEALERS_NEEDED = 1,
|
||||
LFG_DPS_NEEDED = 3
|
||||
};
|
||||
|
||||
enum LfgRoles
|
||||
{
|
||||
PLAYER_ROLE_NONE = 0x00,
|
||||
PLAYER_ROLE_LEADER = 0x01,
|
||||
PLAYER_ROLE_TANK = 0x02,
|
||||
PLAYER_ROLE_HEALER = 0x04,
|
||||
PLAYER_ROLE_DAMAGE = 0x08
|
||||
};
|
||||
|
||||
enum LfgUpdateType
|
||||
{
|
||||
LFG_UPDATETYPE_DEFAULT = 0, // Internal Use
|
||||
LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave
|
||||
LFG_UPDATETYPE_LEAVE_RAIDBROWSER = 2,
|
||||
LFG_UPDATETYPE_JOIN_RAIDBROWSER = 3,
|
||||
LFG_UPDATETYPE_ROLECHECK_ABORTED = 4,
|
||||
LFG_UPDATETYPE_JOIN_QUEUE = 5,
|
||||
LFG_UPDATETYPE_ROLECHECK_FAILED = 6,
|
||||
LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7,
|
||||
LFG_UPDATETYPE_PROPOSAL_FAILED = 8,
|
||||
LFG_UPDATETYPE_PROPOSAL_DECLINED = 9,
|
||||
LFG_UPDATETYPE_GROUP_FOUND = 10,
|
||||
LFG_UPDATETYPE_ADDED_TO_QUEUE = 12,
|
||||
LFG_UPDATETYPE_PROPOSAL_BEGIN = 13,
|
||||
LFG_UPDATETYPE_UPDATE_STATUS = 14,
|
||||
LFG_UPDATETYPE_GROUP_MEMBER_OFFLINE = 15,
|
||||
LFG_UPDATETYPE_GROUP_DISBAND_UNK16 = 16, // FIXME: Sometimes at group disband
|
||||
};
|
||||
|
||||
enum LfgState
|
||||
{
|
||||
LFG_STATE_NONE, // Not using LFG / LFR
|
||||
LFG_STATE_ROLECHECK, // Rolecheck active
|
||||
LFG_STATE_QUEUED, // Queued
|
||||
LFG_STATE_PROPOSAL, // Proposal active
|
||||
LFG_STATE_BOOT, // Vote kick active
|
||||
LFG_STATE_DUNGEON, // In LFG Group, in a Dungeon
|
||||
LFG_STATE_FINISHED_DUNGEON, // In LFG Group, in a finished Dungeon
|
||||
LFG_STATE_RAIDBROWSER // Using Raid finder
|
||||
};
|
||||
|
||||
/// Instance lock types
|
||||
enum LfgLockStatusType
|
||||
{
|
||||
LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION = 1,
|
||||
LFG_LOCKSTATUS_TOO_LOW_LEVEL = 2,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_LEVEL = 3,
|
||||
LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE = 4,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE = 5,
|
||||
LFG_LOCKSTATUS_RAID_LOCKED = 6,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL = 1001,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL = 1002,
|
||||
LFG_LOCKSTATUS_QUEST_NOT_COMPLETED = 1022,
|
||||
LFG_LOCKSTATUS_MISSING_ITEM = 1025,
|
||||
LFG_LOCKSTATUS_NOT_IN_SEASON = 1031,
|
||||
LFG_LOCKSTATUS_MISSING_ACHIEVEMENT = 1034
|
||||
};
|
||||
|
||||
/// Answer state (Also used to check compatibilites)
|
||||
enum LfgAnswer
|
||||
{
|
||||
LFG_ANSWER_PENDING = -1,
|
||||
LFG_ANSWER_DENY = 0,
|
||||
LFG_ANSWER_AGREE = 1
|
||||
};
|
||||
|
||||
class Lfg5Guids;
|
||||
|
||||
typedef std::list<Lfg5Guids> Lfg5GuidsList;
|
||||
typedef std::set<uint32> LfgDungeonSet;
|
||||
typedef std::map<uint32, uint32> LfgLockMap;
|
||||
typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
|
||||
typedef std::set<uint64> LfgGuidSet;
|
||||
typedef std::list<uint64> LfgGuidList;
|
||||
typedef std::map<uint64, uint8> LfgRolesMap;
|
||||
typedef std::map<uint64, uint64> LfgGroupsMap;
|
||||
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids()
|
||||
enum LFGEnum
|
||||
{
|
||||
memset(&guid, 0, 5*8);
|
||||
roles = nullptr;
|
||||
}
|
||||
LFG_TANKS_NEEDED = 1,
|
||||
LFG_HEALERS_NEEDED = 1,
|
||||
LFG_DPS_NEEDED = 3
|
||||
};
|
||||
|
||||
Lfg5Guids(uint64 g)
|
||||
enum LfgRoles
|
||||
{
|
||||
memset(&guid, 0, 5*8);
|
||||
guid[0] = g;
|
||||
roles = nullptr;
|
||||
}
|
||||
PLAYER_ROLE_NONE = 0x00,
|
||||
PLAYER_ROLE_LEADER = 0x01,
|
||||
PLAYER_ROLE_TANK = 0x02,
|
||||
PLAYER_ROLE_HEALER = 0x04,
|
||||
PLAYER_ROLE_DAMAGE = 0x08
|
||||
};
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x)
|
||||
enum LfgUpdateType
|
||||
{
|
||||
memcpy(guid, x.guid, 5*8);
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
LFG_UPDATETYPE_DEFAULT = 0, // Internal Use
|
||||
LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave
|
||||
LFG_UPDATETYPE_LEAVE_RAIDBROWSER = 2,
|
||||
LFG_UPDATETYPE_JOIN_RAIDBROWSER = 3,
|
||||
LFG_UPDATETYPE_ROLECHECK_ABORTED = 4,
|
||||
LFG_UPDATETYPE_JOIN_QUEUE = 5,
|
||||
LFG_UPDATETYPE_ROLECHECK_FAILED = 6,
|
||||
LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7,
|
||||
LFG_UPDATETYPE_PROPOSAL_FAILED = 8,
|
||||
LFG_UPDATETYPE_PROPOSAL_DECLINED = 9,
|
||||
LFG_UPDATETYPE_GROUP_FOUND = 10,
|
||||
LFG_UPDATETYPE_ADDED_TO_QUEUE = 12,
|
||||
LFG_UPDATETYPE_PROPOSAL_BEGIN = 13,
|
||||
LFG_UPDATETYPE_UPDATE_STATUS = 14,
|
||||
LFG_UPDATETYPE_GROUP_MEMBER_OFFLINE = 15,
|
||||
LFG_UPDATETYPE_GROUP_DISBAND_UNK16 = 16, // FIXME: Sometimes at group disband
|
||||
};
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/)
|
||||
enum LfgState
|
||||
{
|
||||
memcpy(guid, x.guid, 5*8);
|
||||
roles = nullptr;
|
||||
}
|
||||
LFG_STATE_NONE, // Not using LFG / LFR
|
||||
LFG_STATE_ROLECHECK, // Rolecheck active
|
||||
LFG_STATE_QUEUED, // Queued
|
||||
LFG_STATE_PROPOSAL, // Proposal active
|
||||
LFG_STATE_BOOT, // Vote kick active
|
||||
LFG_STATE_DUNGEON, // In LFG Group, in a Dungeon
|
||||
LFG_STATE_FINISHED_DUNGEON, // In LFG Group, in a finished Dungeon
|
||||
LFG_STATE_RAIDBROWSER // Using Raid finder
|
||||
};
|
||||
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { memset(&guid, 0, 5*8); }
|
||||
bool empty() const { return guid[0] == 0; }
|
||||
uint64 front() const { return guid[0]; }
|
||||
|
||||
uint8 size() const
|
||||
/// Instance lock types
|
||||
enum LfgLockStatusType
|
||||
{
|
||||
if (guid[2])
|
||||
LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION = 1,
|
||||
LFG_LOCKSTATUS_TOO_LOW_LEVEL = 2,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_LEVEL = 3,
|
||||
LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE = 4,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE = 5,
|
||||
LFG_LOCKSTATUS_RAID_LOCKED = 6,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL = 1001,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL = 1002,
|
||||
LFG_LOCKSTATUS_QUEST_NOT_COMPLETED = 1022,
|
||||
LFG_LOCKSTATUS_MISSING_ITEM = 1025,
|
||||
LFG_LOCKSTATUS_NOT_IN_SEASON = 1031,
|
||||
LFG_LOCKSTATUS_MISSING_ACHIEVEMENT = 1034
|
||||
};
|
||||
|
||||
/// Answer state (Also used to check compatibilites)
|
||||
enum LfgAnswer
|
||||
{
|
||||
LFG_ANSWER_PENDING = -1,
|
||||
LFG_ANSWER_DENY = 0,
|
||||
LFG_ANSWER_AGREE = 1
|
||||
};
|
||||
|
||||
class Lfg5Guids;
|
||||
|
||||
typedef std::list<Lfg5Guids> Lfg5GuidsList;
|
||||
typedef std::set<uint32> LfgDungeonSet;
|
||||
typedef std::map<uint32, uint32> LfgLockMap;
|
||||
typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
|
||||
typedef std::set<uint64> LfgGuidSet;
|
||||
typedef std::list<uint64> LfgGuidList;
|
||||
typedef std::map<uint64, uint8> LfgRolesMap;
|
||||
typedef std::map<uint64, uint64> LfgGroupsMap;
|
||||
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids()
|
||||
{
|
||||
if (guid[4])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (guid[3])
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (guid[0])
|
||||
{
|
||||
return 1;
|
||||
memset(&guid, 0, 5 * 8);
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void insert(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0)
|
||||
Lfg5Guids(uint64 g)
|
||||
{
|
||||
memset(&guid, 0, 5 * 8);
|
||||
guid[0] = g;
|
||||
return;
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
if (g <= guid[0])
|
||||
Lfg5Guids(Lfg5Guids const& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { memset(&guid, 0, 5 * 8); }
|
||||
bool empty() const { return guid[0] == 0; }
|
||||
uint64 front() const { return guid[0]; }
|
||||
|
||||
uint8 size() const
|
||||
{
|
||||
if (guid[2])
|
||||
{
|
||||
if (guid[4])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (guid[3])
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (guid[0])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void insert(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0)
|
||||
{
|
||||
guid[0] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[0])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
}
|
||||
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == 0)
|
||||
{
|
||||
guid[1] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[1])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
|
||||
guid[2] = guid[1];
|
||||
guid[1] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == 0)
|
||||
{
|
||||
guid[2] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[2])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
guid[3] = guid[2];
|
||||
guid[2] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == 0)
|
||||
{
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = g;
|
||||
}
|
||||
|
||||
void force_insert_front(const uint64& g)
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
|
|
@ -188,296 +271,213 @@ public:
|
|||
guid[2] = guid[1];
|
||||
}
|
||||
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == 0)
|
||||
void remove(const uint64& g)
|
||||
{
|
||||
guid[1] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[1])
|
||||
{
|
||||
if (guid[3])
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g)
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
if (guid[1])
|
||||
{
|
||||
guid[0] = guid[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
if (guid[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[2] = guid[1];
|
||||
guid[1] = g;
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == 0)
|
||||
{
|
||||
guid[2] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[2])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
guid[3] = guid[2];
|
||||
guid[2] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == 0)
|
||||
{
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = g;
|
||||
}
|
||||
|
||||
void force_insert_front(const uint64& g)
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
}
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
}
|
||||
|
||||
void remove(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g)
|
||||
{
|
||||
if (guid[1])
|
||||
{
|
||||
guid[0] = guid[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[0] = 0;
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guid[1] == g)
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
if (guid[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
if (guid[2] == g)
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guid[3] == g)
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
if (guid[4] == g)
|
||||
{
|
||||
guid[4] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (guid[1] == g)
|
||||
bool hasGuid(const uint64& g) const
|
||||
{
|
||||
if (guid[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
}
|
||||
|
||||
if (guid[2] == g)
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
if (guid[3])
|
||||
if (guid[0] <= x.guid[0])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == g)
|
||||
{
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4] == g)
|
||||
{
|
||||
guid[4] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasGuid(const uint64& g) const
|
||||
{
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
}
|
||||
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
if (guid[0] <= x.guid[0])
|
||||
{
|
||||
if (guid[0] != x.guid[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[1] <= x.guid[1])
|
||||
{
|
||||
if (guid[1] != x.guid[1])
|
||||
if (guid[0] != x.guid[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[2] <= x.guid[2])
|
||||
if (guid[1] <= x.guid[1])
|
||||
{
|
||||
if (guid[2] != x.guid[2])
|
||||
if (guid[1] != x.guid[1])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[3] <= x.guid[3])
|
||||
if (guid[2] <= x.guid[2])
|
||||
{
|
||||
if (guid[3] != x.guid[3])
|
||||
if (guid[2] != x.guid[2])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[4] <= x.guid[4])
|
||||
if (guid[3] <= x.guid[3])
|
||||
{
|
||||
return !(guid[4] == x.guid[4]);
|
||||
if (guid[3] != x.guid[3])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[4] <= x.guid[4])
|
||||
{
|
||||
return !(guid[4] == x.guid[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
bool operator==(const Lfg5Guids& x) const
|
||||
{
|
||||
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
|
||||
}
|
||||
|
||||
bool operator==(const Lfg5Guids& x) const
|
||||
{
|
||||
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
|
||||
}
|
||||
void operator=(const Lfg5Guids& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
delete roles;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
void operator=(const Lfg5Guids& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5*8);
|
||||
delete roles;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
||||
std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
||||
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
|
||||
std::string GetRolesString(uint8 roles);
|
||||
std::string GetStateString(LfgState state);
|
||||
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
|
||||
std::string GetRolesString(uint8 roles);
|
||||
std::string GetStateString(LfgState state);
|
||||
|
||||
|
||||
} // namespace lfg
|
||||
|
|
|
|||
|
|
@ -10,110 +10,110 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
|
||||
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
{ }
|
||||
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
|
||||
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
{ }
|
||||
|
||||
LfgGroupData::~LfgGroupData()
|
||||
{ }
|
||||
LfgGroupData::~LfgGroupData()
|
||||
{ }
|
||||
|
||||
bool LfgGroupData::IsLfgGroup()
|
||||
{
|
||||
return m_OldState != LFG_STATE_NONE;
|
||||
}
|
||||
|
||||
void LfgGroupData::SetState(LfgState state)
|
||||
{
|
||||
switch (state)
|
||||
bool LfgGroupData::IsLfgGroup()
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
m_Dungeon = 0;
|
||||
m_KicksLeft = LFG_GROUP_MAX_KICKS;
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
return m_OldState != LFG_STATE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgGroupData::RestoreState()
|
||||
{
|
||||
m_State = m_OldState;
|
||||
}
|
||||
void LfgGroupData::SetState(LfgState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
m_Dungeon = 0;
|
||||
m_KicksLeft = LFG_GROUP_MAX_KICKS;
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgGroupData::AddPlayer(uint64 guid)
|
||||
{
|
||||
m_Players.insert(guid);
|
||||
}
|
||||
void LfgGroupData::RestoreState()
|
||||
{
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::RemovePlayer(uint64 guid)
|
||||
{
|
||||
LfgGuidSet::iterator it = m_Players.find(guid);
|
||||
if (it != m_Players.end())
|
||||
m_Players.erase(it);
|
||||
return uint8(m_Players.size());
|
||||
}
|
||||
void LfgGroupData::AddPlayer(uint64 guid)
|
||||
{
|
||||
m_Players.insert(guid);
|
||||
}
|
||||
|
||||
void LfgGroupData::RemoveAllPlayers()
|
||||
{
|
||||
m_Players.clear();
|
||||
}
|
||||
uint8 LfgGroupData::RemovePlayer(uint64 guid)
|
||||
{
|
||||
LfgGuidSet::iterator it = m_Players.find(guid);
|
||||
if (it != m_Players.end())
|
||||
m_Players.erase(it);
|
||||
return uint8(m_Players.size());
|
||||
}
|
||||
|
||||
void LfgGroupData::SetLeader(uint64 guid)
|
||||
{
|
||||
m_Leader = guid;
|
||||
}
|
||||
void LfgGroupData::RemoveAllPlayers()
|
||||
{
|
||||
m_Players.clear();
|
||||
}
|
||||
|
||||
void LfgGroupData::SetDungeon(uint32 dungeon)
|
||||
{
|
||||
m_Dungeon = dungeon;
|
||||
}
|
||||
void LfgGroupData::SetLeader(uint64 guid)
|
||||
{
|
||||
m_Leader = guid;
|
||||
}
|
||||
|
||||
void LfgGroupData::DecreaseKicksLeft()
|
||||
{
|
||||
if (m_KicksLeft)
|
||||
--m_KicksLeft;
|
||||
}
|
||||
void LfgGroupData::SetDungeon(uint32 dungeon)
|
||||
{
|
||||
m_Dungeon = dungeon;
|
||||
}
|
||||
|
||||
LfgState LfgGroupData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
void LfgGroupData::DecreaseKicksLeft()
|
||||
{
|
||||
if (m_KicksLeft)
|
||||
--m_KicksLeft;
|
||||
}
|
||||
|
||||
LfgState LfgGroupData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
LfgState LfgGroupData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
|
||||
LfgGuidSet const& LfgGroupData::GetPlayers() const
|
||||
{
|
||||
return m_Players;
|
||||
}
|
||||
LfgState LfgGroupData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetPlayerCount() const
|
||||
{
|
||||
return m_Players.size();
|
||||
}
|
||||
LfgGuidSet const& LfgGroupData::GetPlayers() const
|
||||
{
|
||||
return m_Players;
|
||||
}
|
||||
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
}
|
||||
uint8 LfgGroupData::GetPlayerCount() const
|
||||
{
|
||||
return m_Players.size();
|
||||
}
|
||||
|
||||
uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
|
||||
{
|
||||
if (asId)
|
||||
return (m_Dungeon & 0x00FFFFFF);
|
||||
else
|
||||
return m_Dungeon;
|
||||
}
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetKicksLeft() const
|
||||
{
|
||||
return m_KicksLeft;
|
||||
}
|
||||
uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
|
||||
{
|
||||
if (asId)
|
||||
return (m_Dungeon & 0x00FFFFFF);
|
||||
else
|
||||
return m_Dungeon;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetKicksLeft() const
|
||||
{
|
||||
return m_KicksLeft;
|
||||
}
|
||||
|
||||
} // namespace lfg
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
enum LfgGroupEnum
|
||||
{
|
||||
LFG_GROUP_MAX_KICKS = 3,
|
||||
};
|
||||
enum LfgGroupEnum
|
||||
{
|
||||
LFG_GROUP_MAX_KICKS = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
Stores all lfg data needed about a group.
|
||||
*/
|
||||
class LfgGroupData
|
||||
{
|
||||
/**
|
||||
Stores all lfg data needed about a group.
|
||||
*/
|
||||
class LfgGroupData
|
||||
{
|
||||
public:
|
||||
LfgGroupData();
|
||||
~LfgGroupData();
|
||||
|
|
@ -65,7 +65,7 @@ class LfgGroupData
|
|||
uint32 m_Dungeon; ///< Dungeon entry
|
||||
// Vote Kick
|
||||
uint8 m_KicksLeft; ///< Number of kicks left
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -22,362 +22,380 @@ class Quest;
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
enum LfgOptions
|
||||
{
|
||||
LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
|
||||
LFG_OPTION_ENABLE_RAID_BROWSER = 0x02,
|
||||
};
|
||||
enum LfgOptions
|
||||
{
|
||||
LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
|
||||
LFG_OPTION_ENABLE_RAID_BROWSER = 0x02,
|
||||
};
|
||||
|
||||
enum LFGMgrEnum
|
||||
{
|
||||
LFG_TIME_ROLECHECK = 45 * IN_MILLISECONDS,
|
||||
LFG_TIME_BOOT = 120,
|
||||
LFG_TIME_PROPOSAL = 40,
|
||||
LFG_QUEUEUPDATE_INTERVAL = 8 * IN_MILLISECONDS,
|
||||
LFG_SPELL_DUNGEON_COOLDOWN = 71328,
|
||||
LFG_SPELL_DUNGEON_DESERTER = 71041,
|
||||
LFG_SPELL_LUCK_OF_THE_DRAW = 72221,
|
||||
LFG_GROUP_KICK_VOTES_NEEDED = 3
|
||||
};
|
||||
enum LFGMgrEnum
|
||||
{
|
||||
LFG_TIME_ROLECHECK = 45 * IN_MILLISECONDS,
|
||||
LFG_TIME_BOOT = 120,
|
||||
LFG_TIME_PROPOSAL = 40,
|
||||
LFG_QUEUEUPDATE_INTERVAL = 8 * IN_MILLISECONDS,
|
||||
LFG_SPELL_DUNGEON_COOLDOWN = 71328,
|
||||
LFG_SPELL_DUNGEON_DESERTER = 71041,
|
||||
LFG_SPELL_LUCK_OF_THE_DRAW = 72221,
|
||||
LFG_GROUP_KICK_VOTES_NEEDED = 3
|
||||
};
|
||||
|
||||
enum LfgFlags
|
||||
{
|
||||
LFG_FLAG_UNK1 = 0x1,
|
||||
LFG_FLAG_UNK2 = 0x2,
|
||||
LFG_FLAG_SEASONAL = 0x4,
|
||||
LFG_FLAG_UNK3 = 0x8
|
||||
};
|
||||
enum LfgFlags
|
||||
{
|
||||
LFG_FLAG_UNK1 = 0x1,
|
||||
LFG_FLAG_UNK2 = 0x2,
|
||||
LFG_FLAG_SEASONAL = 0x4,
|
||||
LFG_FLAG_UNK3 = 0x8
|
||||
};
|
||||
|
||||
/// Determines the type of instance
|
||||
enum LfgType
|
||||
{
|
||||
LFG_TYPE_NONE = 0,
|
||||
LFG_TYPE_DUNGEON = 1,
|
||||
LFG_TYPE_RAID = 2,
|
||||
LFG_TYPE_HEROIC = 5,
|
||||
LFG_TYPE_RANDOM = 6
|
||||
};
|
||||
/// Determines the type of instance
|
||||
enum LfgType
|
||||
{
|
||||
LFG_TYPE_NONE = 0,
|
||||
LFG_TYPE_DUNGEON = 1,
|
||||
LFG_TYPE_RAID = 2,
|
||||
LFG_TYPE_HEROIC = 5,
|
||||
LFG_TYPE_RANDOM = 6
|
||||
};
|
||||
|
||||
/// Proposal states
|
||||
enum LfgProposalState
|
||||
{
|
||||
LFG_PROPOSAL_INITIATING = 0,
|
||||
LFG_PROPOSAL_FAILED = 1,
|
||||
LFG_PROPOSAL_SUCCESS = 2
|
||||
};
|
||||
/// Proposal states
|
||||
enum LfgProposalState
|
||||
{
|
||||
LFG_PROPOSAL_INITIATING = 0,
|
||||
LFG_PROPOSAL_FAILED = 1,
|
||||
LFG_PROPOSAL_SUCCESS = 2
|
||||
};
|
||||
|
||||
/// Teleport errors
|
||||
enum LfgTeleportError
|
||||
{
|
||||
// 7 = "You can't do that right now" | 5 = No client reaction
|
||||
LFG_TELEPORTERROR_OK = 0, // Internal use
|
||||
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
|
||||
LFG_TELEPORTERROR_FALLING = 2,
|
||||
LFG_TELEPORTERROR_IN_VEHICLE = 3,
|
||||
LFG_TELEPORTERROR_FATIGUE = 4,
|
||||
LFG_TELEPORTERROR_INVALID_LOCATION = 6,
|
||||
LFG_TELEPORTERROR_CHARMING = 8 // FIXME - It can be 7 or 8 (Need proper data)
|
||||
};
|
||||
/// Teleport errors
|
||||
enum LfgTeleportError
|
||||
{
|
||||
// 7 = "You can't do that right now" | 5 = No client reaction
|
||||
LFG_TELEPORTERROR_OK = 0, // Internal use
|
||||
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
|
||||
LFG_TELEPORTERROR_FALLING = 2,
|
||||
LFG_TELEPORTERROR_IN_VEHICLE = 3,
|
||||
LFG_TELEPORTERROR_FATIGUE = 4,
|
||||
LFG_TELEPORTERROR_INVALID_LOCATION = 6,
|
||||
LFG_TELEPORTERROR_CHARMING = 8 // FIXME - It can be 7 or 8 (Need proper data)
|
||||
};
|
||||
|
||||
/// Queue join results
|
||||
enum LfgJoinResult
|
||||
{
|
||||
// 3 = No client reaction | 18 = "Rolecheck failed"
|
||||
LFG_JOIN_OK = 0, // Joined (no client msg)
|
||||
LFG_JOIN_FAILED = 1, // RoleCheck Failed
|
||||
LFG_JOIN_GROUPFULL = 2, // Your group is full
|
||||
LFG_JOIN_INTERNAL_ERROR = 4, // Internal LFG Error
|
||||
LFG_JOIN_NOT_MEET_REQS = 5, // You do not meet the requirements for the chosen dungeons
|
||||
LFG_JOIN_PARTY_NOT_MEET_REQS = 6, // One or more party members do not meet the requirements for the chosen dungeons
|
||||
LFG_JOIN_MIXED_RAID_DUNGEON = 7, // You cannot mix dungeons, raids, and random when picking dungeons
|
||||
LFG_JOIN_MULTI_REALM = 8, // The dungeon you chose does not support players from multiple realms
|
||||
LFG_JOIN_DISCONNECTED = 9, // One or more party members are pending invites or disconnected
|
||||
LFG_JOIN_PARTY_INFO_FAILED = 10, // Could not retrieve information about some party members
|
||||
LFG_JOIN_DUNGEON_INVALID = 11, // One or more dungeons was not valid
|
||||
LFG_JOIN_DESERTER = 12, // You can not queue for dungeons until your deserter debuff wears off
|
||||
LFG_JOIN_PARTY_DESERTER = 13, // One or more party members has a deserter debuff
|
||||
LFG_JOIN_RANDOM_COOLDOWN = 14, // You can not queue for random dungeons while on random dungeon cooldown
|
||||
LFG_JOIN_PARTY_RANDOM_COOLDOWN = 15, // One or more party members are on random dungeon cooldown
|
||||
LFG_JOIN_TOO_MUCH_MEMBERS = 16, // You can not enter dungeons with more that 5 party members
|
||||
LFG_JOIN_USING_BG_SYSTEM = 17 // You can not use the dungeon system while in BG or arenas
|
||||
};
|
||||
/// Queue join results
|
||||
enum LfgJoinResult
|
||||
{
|
||||
// 3 = No client reaction | 18 = "Rolecheck failed"
|
||||
LFG_JOIN_OK = 0, // Joined (no client msg)
|
||||
LFG_JOIN_FAILED = 1, // RoleCheck Failed
|
||||
LFG_JOIN_GROUPFULL = 2, // Your group is full
|
||||
LFG_JOIN_INTERNAL_ERROR = 4, // Internal LFG Error
|
||||
LFG_JOIN_NOT_MEET_REQS = 5, // You do not meet the requirements for the chosen dungeons
|
||||
LFG_JOIN_PARTY_NOT_MEET_REQS = 6, // One or more party members do not meet the requirements for the chosen dungeons
|
||||
LFG_JOIN_MIXED_RAID_DUNGEON = 7, // You cannot mix dungeons, raids, and random when picking dungeons
|
||||
LFG_JOIN_MULTI_REALM = 8, // The dungeon you chose does not support players from multiple realms
|
||||
LFG_JOIN_DISCONNECTED = 9, // One or more party members are pending invites or disconnected
|
||||
LFG_JOIN_PARTY_INFO_FAILED = 10, // Could not retrieve information about some party members
|
||||
LFG_JOIN_DUNGEON_INVALID = 11, // One or more dungeons was not valid
|
||||
LFG_JOIN_DESERTER = 12, // You can not queue for dungeons until your deserter debuff wears off
|
||||
LFG_JOIN_PARTY_DESERTER = 13, // One or more party members has a deserter debuff
|
||||
LFG_JOIN_RANDOM_COOLDOWN = 14, // You can not queue for random dungeons while on random dungeon cooldown
|
||||
LFG_JOIN_PARTY_RANDOM_COOLDOWN = 15, // One or more party members are on random dungeon cooldown
|
||||
LFG_JOIN_TOO_MUCH_MEMBERS = 16, // You can not enter dungeons with more that 5 party members
|
||||
LFG_JOIN_USING_BG_SYSTEM = 17 // You can not use the dungeon system while in BG or arenas
|
||||
};
|
||||
|
||||
/// Role check states
|
||||
enum LfgRoleCheckState
|
||||
{
|
||||
LFG_ROLECHECK_DEFAULT = 0, // Internal use = Not initialized.
|
||||
LFG_ROLECHECK_FINISHED = 1, // Role check finished
|
||||
LFG_ROLECHECK_INITIALITING = 2, // Role check begins
|
||||
LFG_ROLECHECK_MISSING_ROLE = 3, // Someone didn't selected a role after 2 mins
|
||||
LFG_ROLECHECK_WRONG_ROLES = 4, // Can't form a group with that role selection
|
||||
LFG_ROLECHECK_ABORTED = 5, // Someone leave the group
|
||||
LFG_ROLECHECK_NO_ROLE = 6 // Someone selected no role
|
||||
};
|
||||
/// Role check states
|
||||
enum LfgRoleCheckState
|
||||
{
|
||||
LFG_ROLECHECK_DEFAULT = 0, // Internal use = Not initialized.
|
||||
LFG_ROLECHECK_FINISHED = 1, // Role check finished
|
||||
LFG_ROLECHECK_INITIALITING = 2, // Role check begins
|
||||
LFG_ROLECHECK_MISSING_ROLE = 3, // Someone didn't selected a role after 2 mins
|
||||
LFG_ROLECHECK_WRONG_ROLES = 4, // Can't form a group with that role selection
|
||||
LFG_ROLECHECK_ABORTED = 5, // Someone leave the group
|
||||
LFG_ROLECHECK_NO_ROLE = 6 // Someone selected no role
|
||||
};
|
||||
|
||||
enum LfgUpdateFlag // pussywizard: for raid browser
|
||||
{
|
||||
LFG_UPDATE_FLAG_NONE = 0x00,
|
||||
LFG_UPDATE_FLAG_CHARACTERINFO = 0x01,
|
||||
LFG_UPDATE_FLAG_COMMENT = 0x02,
|
||||
LFG_UPDATE_FLAG_GROUPLEADER = 0x04,
|
||||
LFG_UPDATE_FLAG_GROUPGUID = 0x08,
|
||||
LFG_UPDATE_FLAG_ROLES = 0x10,
|
||||
LFG_UPDATE_FLAG_AREA = 0x20,
|
||||
LFG_UPDATE_FLAG_STATUS = 0x40,
|
||||
LFG_UPDATE_FLAG_BINDED = 0x80
|
||||
};
|
||||
enum LfgUpdateFlag // pussywizard: for raid browser
|
||||
{
|
||||
LFG_UPDATE_FLAG_NONE = 0x00,
|
||||
LFG_UPDATE_FLAG_CHARACTERINFO = 0x01,
|
||||
LFG_UPDATE_FLAG_COMMENT = 0x02,
|
||||
LFG_UPDATE_FLAG_GROUPLEADER = 0x04,
|
||||
LFG_UPDATE_FLAG_GROUPGUID = 0x08,
|
||||
LFG_UPDATE_FLAG_ROLES = 0x10,
|
||||
LFG_UPDATE_FLAG_AREA = 0x20,
|
||||
LFG_UPDATE_FLAG_STATUS = 0x40,
|
||||
LFG_UPDATE_FLAG_BINDED = 0x80
|
||||
};
|
||||
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
uint8 _level;
|
||||
uint8 _class;
|
||||
uint8 _race;
|
||||
float _avgItemLevel;
|
||||
// --
|
||||
uint8 _talents0;
|
||||
uint8 _talents1;
|
||||
uint8 _talents2;
|
||||
uint32 _area;
|
||||
uint32 _armor;
|
||||
uint32 _spellDamage;
|
||||
uint32 _spellHeal;
|
||||
// --
|
||||
uint32 _critRatingMelee;
|
||||
uint32 _critRatingRanged;
|
||||
uint32 _critRatingSpell;
|
||||
float _mp5;
|
||||
float _mp5combat;
|
||||
// --
|
||||
uint32 _attackPower;
|
||||
uint32 _agility;
|
||||
uint32 _health;
|
||||
uint32 _mana;
|
||||
uint32 _defenseSkill;
|
||||
// --
|
||||
uint32 _dodgeRating;
|
||||
uint32 _blockRating;
|
||||
uint32 _parryRating;
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
uint8 _level;
|
||||
uint8 _class;
|
||||
uint8 _race;
|
||||
float _avgItemLevel;
|
||||
// --
|
||||
uint8 _talents0;
|
||||
uint8 _talents1;
|
||||
uint8 _talents2;
|
||||
uint32 _area;
|
||||
uint32 _armor;
|
||||
uint32 _spellDamage;
|
||||
uint32 _spellHeal;
|
||||
// --
|
||||
uint32 _critRatingMelee;
|
||||
uint32 _critRatingRanged;
|
||||
uint32 _critRatingSpell;
|
||||
float _mp5;
|
||||
float _mp5combat;
|
||||
// --
|
||||
uint32 _attackPower;
|
||||
uint32 _agility;
|
||||
uint32 _health;
|
||||
uint32 _mana;
|
||||
uint32 _defenseSkill;
|
||||
// --
|
||||
uint32 _dodgeRating;
|
||||
uint32 _blockRating;
|
||||
uint32 _parryRating;
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
{}
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5 - i._mp5) < 0.01f && fabs(_mp5combat - i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
void CopyStats(RBInternalInfo const& i)
|
||||
{
|
||||
_avgItemLevel = i._avgItemLevel;
|
||||
_talents0 = i._talents0;
|
||||
_talents1 = i._talents1;
|
||||
_talents2 = i._talents2;
|
||||
_area = i._area;
|
||||
_armor = i._armor;
|
||||
_spellDamage = i._spellDamage;
|
||||
_spellHeal = i._spellHeal;
|
||||
_critRatingMelee = i._critRatingMelee;
|
||||
_critRatingRanged = i._critRatingRanged;
|
||||
_critRatingSpell = i._critRatingSpell;
|
||||
_mp5 = i._mp5;
|
||||
_mp5combat = i._mp5combat;
|
||||
_attackPower = i._attackPower;
|
||||
_agility = i._agility;
|
||||
_health = i._health;
|
||||
_mana = i._mana;
|
||||
_defenseSkill = i._defenseSkill;
|
||||
_dodgeRating = i._dodgeRating;
|
||||
_blockRating = i._blockRating;
|
||||
_parryRating = i._parryRating;
|
||||
_hasteRating = i._hasteRating;
|
||||
_expertiseRating = i._expertiseRating;
|
||||
}
|
||||
};
|
||||
|
||||
// Forward declaration (just to have all typedef together)
|
||||
struct LFGDungeonData;
|
||||
struct LfgReward;
|
||||
struct LfgQueueInfo;
|
||||
struct LfgRoleCheck;
|
||||
struct LfgProposal;
|
||||
struct LfgProposalPlayer;
|
||||
struct LfgPlayerBoot;
|
||||
|
||||
typedef std::map<uint8, LFGQueue> LfgQueueContainer;
|
||||
typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
|
||||
typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
|
||||
typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
|
||||
typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
|
||||
typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
|
||||
typedef std::map<uint32, LfgProposal> LfgProposalContainer;
|
||||
typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
|
||||
typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
|
||||
typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
|
||||
typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
|
||||
typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
|
||||
|
||||
// Data needed by SMSG_LFG_JOIN_RESULT
|
||||
struct LfgJoinResultData
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
void CopyStats(RBInternalInfo const& i)
|
||||
LfgJoinResultData(LfgJoinResult _result = LFG_JOIN_OK, LfgRoleCheckState _state = LFG_ROLECHECK_DEFAULT):
|
||||
result(_result), state(_state) {}
|
||||
LfgJoinResult result;
|
||||
LfgRoleCheckState state;
|
||||
LfgLockPartyMap lockmap;
|
||||
};
|
||||
|
||||
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
|
||||
struct LfgUpdateData
|
||||
{
|
||||
_avgItemLevel = i._avgItemLevel;
|
||||
_talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal;
|
||||
_critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat;
|
||||
_attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill;
|
||||
_dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating;
|
||||
}
|
||||
};
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
|
||||
|
||||
// Forward declaration (just to have all typedef together)
|
||||
struct LFGDungeonData;
|
||||
struct LfgReward;
|
||||
struct LfgQueueInfo;
|
||||
struct LfgRoleCheck;
|
||||
struct LfgProposal;
|
||||
struct LfgProposalPlayer;
|
||||
struct LfgPlayerBoot;
|
||||
LfgUpdateType updateType;
|
||||
LfgState state;
|
||||
LfgDungeonSet dungeons;
|
||||
std::string comment;
|
||||
};
|
||||
|
||||
typedef std::map<uint8, LFGQueue> LfgQueueContainer;
|
||||
typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
|
||||
typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
|
||||
typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
|
||||
typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
|
||||
typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
|
||||
typedef std::map<uint32, LfgProposal> LfgProposalContainer;
|
||||
typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
|
||||
typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
|
||||
typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
|
||||
typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
|
||||
typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
|
||||
// Data needed by SMSG_LFG_QUEUE_STATUS
|
||||
struct LfgQueueStatusData
|
||||
{
|
||||
LfgQueueStatusData(uint32 _dungeonId = 0, int32 _waitTime = -1, int32 _waitTimeAvg = -1, int32 _waitTimeTank = -1, int32 _waitTimeHealer = -1,
|
||||
int32 _waitTimeDps = -1, uint32 _queuedTime = 0, uint8 _tanks = 0, uint8 _healers = 0, uint8 _dps = 0) :
|
||||
dungeonId(_dungeonId), waitTime(_waitTime), waitTimeAvg(_waitTimeAvg), waitTimeTank(_waitTimeTank), waitTimeHealer(_waitTimeHealer),
|
||||
waitTimeDps(_waitTimeDps), queuedTime(_queuedTime), tanks(_tanks), healers(_healers), dps(_dps) {}
|
||||
|
||||
// Data needed by SMSG_LFG_JOIN_RESULT
|
||||
struct LfgJoinResultData
|
||||
{
|
||||
LfgJoinResultData(LfgJoinResult _result = LFG_JOIN_OK, LfgRoleCheckState _state = LFG_ROLECHECK_DEFAULT):
|
||||
result(_result), state(_state) {}
|
||||
LfgJoinResult result;
|
||||
LfgRoleCheckState state;
|
||||
LfgLockPartyMap lockmap;
|
||||
};
|
||||
uint32 dungeonId;
|
||||
int32 waitTime;
|
||||
int32 waitTimeAvg;
|
||||
int32 waitTimeTank;
|
||||
int32 waitTimeHealer;
|
||||
int32 waitTimeDps;
|
||||
uint32 queuedTime;
|
||||
uint8 tanks;
|
||||
uint8 healers;
|
||||
uint8 dps;
|
||||
};
|
||||
|
||||
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
|
||||
struct LfgUpdateData
|
||||
{
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
|
||||
struct LfgPlayerRewardData
|
||||
{
|
||||
LfgPlayerRewardData(uint32 random, uint32 current, bool _done, Quest const* _quest):
|
||||
rdungeonEntry(random), sdungeonEntry(current), done(_done), quest(_quest) { }
|
||||
uint32 rdungeonEntry;
|
||||
uint32 sdungeonEntry;
|
||||
bool done;
|
||||
Quest const* quest;
|
||||
};
|
||||
|
||||
LfgUpdateType updateType;
|
||||
LfgState state;
|
||||
LfgDungeonSet dungeons;
|
||||
std::string comment;
|
||||
};
|
||||
/// Reward info
|
||||
struct LfgReward
|
||||
{
|
||||
LfgReward(uint32 _maxLevel = 0, uint32 _firstQuest = 0, uint32 _otherQuest = 0):
|
||||
maxLevel(_maxLevel), firstQuest(_firstQuest), otherQuest(_otherQuest) { }
|
||||
|
||||
// Data needed by SMSG_LFG_QUEUE_STATUS
|
||||
struct LfgQueueStatusData
|
||||
{
|
||||
LfgQueueStatusData(uint32 _dungeonId = 0, int32 _waitTime = -1, int32 _waitTimeAvg = -1, int32 _waitTimeTank = -1, int32 _waitTimeHealer = -1,
|
||||
int32 _waitTimeDps = -1, uint32 _queuedTime = 0, uint8 _tanks = 0, uint8 _healers = 0, uint8 _dps = 0) :
|
||||
dungeonId(_dungeonId), waitTime(_waitTime), waitTimeAvg(_waitTimeAvg), waitTimeTank(_waitTimeTank), waitTimeHealer(_waitTimeHealer),
|
||||
waitTimeDps(_waitTimeDps), queuedTime(_queuedTime), tanks(_tanks), healers(_healers), dps(_dps) {}
|
||||
uint32 maxLevel;
|
||||
uint32 firstQuest;
|
||||
uint32 otherQuest;
|
||||
};
|
||||
|
||||
uint32 dungeonId;
|
||||
int32 waitTime;
|
||||
int32 waitTimeAvg;
|
||||
int32 waitTimeTank;
|
||||
int32 waitTimeHealer;
|
||||
int32 waitTimeDps;
|
||||
uint32 queuedTime;
|
||||
uint8 tanks;
|
||||
uint8 healers;
|
||||
uint8 dps;
|
||||
};
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
|
||||
uint8 role; ///< Proposed role
|
||||
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 group; ///< Original group guid. 0 if no original group
|
||||
};
|
||||
|
||||
struct LfgPlayerRewardData
|
||||
{
|
||||
LfgPlayerRewardData(uint32 random, uint32 current, bool _done, Quest const* _quest):
|
||||
rdungeonEntry(random), sdungeonEntry(current), done(_done), quest(_quest) { }
|
||||
uint32 rdungeonEntry;
|
||||
uint32 sdungeonEntry;
|
||||
bool done;
|
||||
Quest const* quest;
|
||||
};
|
||||
|
||||
/// Reward info
|
||||
struct LfgReward
|
||||
{
|
||||
LfgReward(uint32 _maxLevel = 0, uint32 _firstQuest = 0, uint32 _otherQuest = 0):
|
||||
maxLevel(_maxLevel), firstQuest(_firstQuest), otherQuest(_otherQuest) { }
|
||||
|
||||
uint32 maxLevel;
|
||||
uint32 firstQuest;
|
||||
uint32 otherQuest;
|
||||
};
|
||||
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
|
||||
uint8 role; ///< Proposed role
|
||||
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 group; ///< Original group guid. 0 if no original group
|
||||
};
|
||||
|
||||
/// Stores group data related to proposal to join
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
|
||||
group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
|
||||
/// Stores group data related to proposal to join
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
|
||||
group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
|
||||
{ }
|
||||
|
||||
uint32 id; ///< Proposal Id
|
||||
uint32 dungeonId; ///< Dungeon to join
|
||||
LfgProposalState state; ///< State of the proposal
|
||||
uint64 group; ///< Proposal group (0 if new)
|
||||
uint64 leader; ///< Leader guid.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
Lfg5Guids queues; ///< Queue Ids to remove/readd
|
||||
LfgGuidList showorder; ///< Show order in update window
|
||||
LfgProposalPlayerContainer players; ///< Players data
|
||||
};
|
||||
uint32 id; ///< Proposal Id
|
||||
uint32 dungeonId; ///< Dungeon to join
|
||||
LfgProposalState state; ///< State of the proposal
|
||||
uint64 group; ///< Proposal group (0 if new)
|
||||
uint64 leader; ///< Leader guid.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
Lfg5Guids queues; ///< Queue Ids to remove/readd
|
||||
LfgGuidList showorder; ///< Show order in update window
|
||||
LfgProposalPlayerContainer players; ///< Players data
|
||||
};
|
||||
|
||||
/// Stores all rolecheck info of a group that wants to join
|
||||
struct LfgRoleCheck
|
||||
{
|
||||
time_t cancelTime; ///< Time when the rolecheck will fail
|
||||
LfgRolesMap roles; ///< Player selected roles
|
||||
LfgRoleCheckState state; ///< State of the rolecheck
|
||||
LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons)
|
||||
uint32 rDungeonId; ///< Random Dungeon Id.
|
||||
uint64 leader; ///< Leader of the group
|
||||
};
|
||||
/// Stores all rolecheck info of a group that wants to join
|
||||
struct LfgRoleCheck
|
||||
{
|
||||
time_t cancelTime; ///< Time when the rolecheck will fail
|
||||
LfgRolesMap roles; ///< Player selected roles
|
||||
LfgRoleCheckState state; ///< State of the rolecheck
|
||||
LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons)
|
||||
uint32 rDungeonId; ///< Random Dungeon Id.
|
||||
uint64 leader; ///< Leader of the group
|
||||
};
|
||||
|
||||
/// Stores information of a current vote to kick someone from a group
|
||||
struct LfgPlayerBoot
|
||||
{
|
||||
time_t cancelTime; ///< Time left to vote
|
||||
bool inProgress; ///< Vote in progress
|
||||
LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 victim; ///< Player guid to be kicked (can't vote)
|
||||
std::string reason; ///< kick reason
|
||||
};
|
||||
/// Stores information of a current vote to kick someone from a group
|
||||
struct LfgPlayerBoot
|
||||
{
|
||||
time_t cancelTime; ///< Time left to vote
|
||||
bool inProgress; ///< Vote in progress
|
||||
LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 victim; ///< Player guid to be kicked (can't vote)
|
||||
std::string reason; ///< kick reason
|
||||
};
|
||||
|
||||
struct LFGDungeonData
|
||||
{
|
||||
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
|
||||
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
struct LFGDungeonData
|
||||
{
|
||||
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
|
||||
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
{ }
|
||||
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
|
||||
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
|
||||
minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)),
|
||||
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
|
||||
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
|
||||
minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)),
|
||||
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
{ }
|
||||
|
||||
uint32 id;
|
||||
std::string name;
|
||||
uint16 map;
|
||||
uint8 type;
|
||||
uint8 expansion;
|
||||
uint8 group;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
Difficulty difficulty;
|
||||
bool seasonal;
|
||||
float x, y, z, o;
|
||||
uint32 id;
|
||||
std::string name;
|
||||
uint16 map;
|
||||
uint8 type;
|
||||
uint8 expansion;
|
||||
uint8 group;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
Difficulty difficulty;
|
||||
bool seasonal;
|
||||
float x, y, z, o;
|
||||
|
||||
// Helpers
|
||||
uint32 Entry() const { return id + (type << 24); }
|
||||
};
|
||||
// Helpers
|
||||
uint32 Entry() const { return id + (type << 24); }
|
||||
};
|
||||
|
||||
class LFGMgr
|
||||
{
|
||||
class LFGMgr
|
||||
{
|
||||
private:
|
||||
LFGMgr();
|
||||
~LFGMgr();
|
||||
|
|
@ -528,7 +546,7 @@ class LFGMgr
|
|||
/// Checks if all players are queued
|
||||
bool AllQueued(Lfg5Guids const& check);
|
||||
/// Checks if given roles match, modifies given roles map with new roles
|
||||
static uint8 CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||
static uint8 CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag = true);
|
||||
/// Checks if given players are ignoring each other
|
||||
static bool HasIgnore(uint64 guid1, uint64 guid2);
|
||||
/// Sends queue status to player
|
||||
|
|
@ -553,7 +571,7 @@ class LFGMgr
|
|||
void MakeNewGroup(LfgProposal const& proposal);
|
||||
|
||||
// Generic
|
||||
LFGQueue &GetQueue(uint64 guid);
|
||||
LFGQueue& GetQueue(uint64 guid);
|
||||
LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
|
||||
LfgType GetDungeonType(uint32 dungeon);
|
||||
|
||||
|
|
@ -585,7 +603,7 @@ class LFGMgr
|
|||
LfgPlayerBootContainer BootsStore; ///< Current player kicks
|
||||
LfgPlayerDataContainer PlayersStore; ///< Player data
|
||||
LfgGroupDataContainer GroupsStore; ///< Group data
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
|
|
|||
|
|
@ -10,126 +10,126 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), m_canOverrideRBState(false),
|
||||
m_TeamId(TEAM_ALLIANCE), m_Group(0), m_Roles(0), m_Comment("")
|
||||
{}
|
||||
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), m_canOverrideRBState(false),
|
||||
m_TeamId(TEAM_ALLIANCE), m_Group(0), m_Roles(0), m_Comment("")
|
||||
{}
|
||||
|
||||
LfgPlayerData::~LfgPlayerData()
|
||||
{
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetState(LfgState state)
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
switch (state)
|
||||
LfgPlayerData::~LfgPlayerData()
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
m_Roles = 0;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetState(LfgState state)
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
m_Roles = 0;
|
||||
m_SelectedDungeons.clear();
|
||||
m_Comment = "";
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgPlayerData::RestoreState()
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
if (m_OldState == LFG_STATE_NONE)
|
||||
{
|
||||
m_SelectedDungeons.clear();
|
||||
m_Comment = "";
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
m_Roles = 0;
|
||||
}
|
||||
m_State = m_OldState;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgPlayerData::RestoreState()
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
if (m_OldState == LFG_STATE_NONE)
|
||||
void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
|
||||
{
|
||||
m_SelectedDungeons.clear();
|
||||
m_Roles = 0;
|
||||
m_LockedDungeons = lockStatus;
|
||||
}
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
|
||||
{
|
||||
m_LockedDungeons = lockStatus;
|
||||
}
|
||||
void LfgPlayerData::SetTeam(TeamId teamId)
|
||||
{
|
||||
m_TeamId = teamId;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetTeam(TeamId teamId)
|
||||
{
|
||||
m_TeamId = teamId;
|
||||
}
|
||||
void LfgPlayerData::SetGroup(uint64 group)
|
||||
{
|
||||
m_Group = group;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetGroup(uint64 group)
|
||||
{
|
||||
m_Group = group;
|
||||
}
|
||||
void LfgPlayerData::SetRoles(uint8 roles)
|
||||
{
|
||||
m_Roles = roles;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetRoles(uint8 roles)
|
||||
{
|
||||
m_Roles = roles;
|
||||
}
|
||||
void LfgPlayerData::SetComment(std::string const& comment)
|
||||
{
|
||||
m_Comment = comment;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetComment(std::string const& comment)
|
||||
{
|
||||
m_Comment = comment;
|
||||
}
|
||||
void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
|
||||
{
|
||||
m_SelectedDungeons = dungeons;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
|
||||
{
|
||||
m_SelectedDungeons = dungeons;
|
||||
}
|
||||
void LfgPlayerData::SetRandomPlayersCount(uint8 count)
|
||||
{
|
||||
m_randomPlayers = count;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetRandomPlayersCount(uint8 count)
|
||||
{
|
||||
m_randomPlayers = count;
|
||||
}
|
||||
uint8 LfgPlayerData::GetRandomPlayersCount() const
|
||||
{
|
||||
return m_randomPlayers;
|
||||
}
|
||||
|
||||
uint8 LfgPlayerData::GetRandomPlayersCount() const
|
||||
{
|
||||
return m_randomPlayers;
|
||||
}
|
||||
LfgState LfgPlayerData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
|
||||
LfgState LfgPlayerData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
LfgState LfgPlayerData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
|
||||
LfgState LfgPlayerData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
const LfgLockMap& LfgPlayerData::GetLockedDungeons() const
|
||||
{
|
||||
return m_LockedDungeons;
|
||||
}
|
||||
|
||||
const LfgLockMap& LfgPlayerData::GetLockedDungeons() const
|
||||
{
|
||||
return m_LockedDungeons;
|
||||
}
|
||||
TeamId LfgPlayerData::GetTeam() const
|
||||
{
|
||||
return m_TeamId;
|
||||
}
|
||||
|
||||
TeamId LfgPlayerData::GetTeam() const
|
||||
{
|
||||
return m_TeamId;
|
||||
}
|
||||
uint64 LfgPlayerData::GetGroup() const
|
||||
{
|
||||
return m_Group;
|
||||
}
|
||||
|
||||
uint64 LfgPlayerData::GetGroup() const
|
||||
{
|
||||
return m_Group;
|
||||
}
|
||||
uint8 LfgPlayerData::GetRoles() const
|
||||
{
|
||||
return m_Roles;
|
||||
}
|
||||
|
||||
uint8 LfgPlayerData::GetRoles() const
|
||||
{
|
||||
return m_Roles;
|
||||
}
|
||||
std::string const& LfgPlayerData::GetComment() const
|
||||
{
|
||||
return m_Comment;
|
||||
}
|
||||
|
||||
std::string const& LfgPlayerData::GetComment() const
|
||||
{
|
||||
return m_Comment;
|
||||
}
|
||||
|
||||
LfgDungeonSet const& LfgPlayerData::GetSelectedDungeons() const
|
||||
{
|
||||
return m_SelectedDungeons;
|
||||
}
|
||||
LfgDungeonSet const& LfgPlayerData::GetSelectedDungeons() const
|
||||
{
|
||||
return m_SelectedDungeons;
|
||||
}
|
||||
|
||||
} // namespace lfg
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
/**
|
||||
Stores all lfg data needed about the player.
|
||||
*/
|
||||
/**
|
||||
Stores all lfg data needed about the player.
|
||||
*/
|
||||
|
||||
class LfgPlayerData
|
||||
{
|
||||
class LfgPlayerData
|
||||
{
|
||||
public:
|
||||
LfgPlayerData();
|
||||
~LfgPlayerData();
|
||||
|
|
@ -65,7 +65,7 @@ class LfgPlayerData
|
|||
uint8 m_Roles; ///< Roles the player selected when joined LFG
|
||||
std::string m_Comment; ///< Player comment used when joined LFG
|
||||
LfgDungeonSet m_SelectedDungeons; ///< Selected Dungeons when joined LFG
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue