mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[Sync] Some minor project sync
This commit is contained in:
parent
7332173b6e
commit
461923f632
35 changed files with 3690 additions and 1585 deletions
|
|
@ -130,7 +130,7 @@ class Grid
|
||||||
*/
|
*/
|
||||||
bool AddGridObject(SPECIFIC_OBJECT* obj)
|
bool AddGridObject(SPECIFIC_OBJECT* obj)
|
||||||
{
|
{
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
{ m_activeGridObjects.insert(obj); }
|
{ m_activeGridObjects.insert(obj); }
|
||||||
|
|
||||||
return i_container.template insert<SPECIFIC_OBJECT>(obj);
|
return i_container.template insert<SPECIFIC_OBJECT>(obj);
|
||||||
|
|
@ -145,7 +145,7 @@ class Grid
|
||||||
*/
|
*/
|
||||||
bool RemoveGridObject(SPECIFIC_OBJECT* obj)
|
bool RemoveGridObject(SPECIFIC_OBJECT* obj)
|
||||||
{
|
{
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
{ m_activeGridObjects.erase(obj); }
|
{ m_activeGridObjects.erase(obj); }
|
||||||
|
|
||||||
return i_container.template remove<SPECIFIC_OBJECT>(obj);
|
return i_container.template remove<SPECIFIC_OBJECT>(obj);
|
||||||
|
|
|
||||||
|
|
@ -64,20 +64,9 @@ typedef ACE_SHLIB_HANDLE MANGOS_LIBRARY_HANDLE;
|
||||||
# define MANGOS_EXPORT __declspec(dllexport)
|
# define MANGOS_EXPORT __declspec(dllexport)
|
||||||
# define MANGOS_IMPORT __cdecl
|
# define MANGOS_IMPORT __cdecl
|
||||||
#else // PLATFORM != PLATFORM_WINDOWS
|
#else // PLATFORM != PLATFORM_WINDOWS
|
||||||
# include <dlfcn.h>
|
|
||||||
typedef void* MANGOS_LIBRARY_HANDLE;
|
|
||||||
# define MANGOS_LOAD_LIBRARY(libname) dlopen(libname, RTLD_LAZY)
|
|
||||||
# define MANGOS_CLOSE_LIBRARY(hlib) dlclose(hlib)
|
|
||||||
# define MANGOS_GET_PROC_ADDR(hlib, name) dlsym(hlib, name)
|
|
||||||
# define MANGOS_EXPORT export
|
# define MANGOS_EXPORT export
|
||||||
# if PLATFORM == PLATFORM_APPLE
|
# if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
|
||||||
# define MANGOS_SCRIPT_SUFFIX ".dylib"
|
# if (defined(__ppc__) || defined(__powerpc__))
|
||||||
# else
|
|
||||||
# define MANGOS_SCRIPT_SUFFIX ".so"
|
|
||||||
# endif
|
|
||||||
# define MANGOS_SCRIPT_PREFIX "lib"
|
|
||||||
# if defined(__APPLE_CC__) && defined(BIG_ENDIAN) // TODO:: more work to do with byte order. Have to be rechecked after boost integration.
|
|
||||||
# if (defined (__ppc__) || defined (__powerpc__))
|
|
||||||
# define MANGOS_IMPORT __attribute__ ((longcall))
|
# define MANGOS_IMPORT __attribute__ ((longcall))
|
||||||
# else
|
# else
|
||||||
# define MANGOS_IMPORT
|
# define MANGOS_IMPORT
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -35,6 +35,9 @@
|
||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
#include "DBCStores.h" // TODO REMOVE this when graveyard handling for pvp is updated
|
#include "DBCStores.h" // TODO REMOVE this when graveyard handling for pvp is updated
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="BattleGroundAB"/> class.
|
||||||
|
/// </summary>
|
||||||
BattleGroundAB::BattleGroundAB()
|
BattleGroundAB::BattleGroundAB()
|
||||||
{
|
{
|
||||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
|
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
|
||||||
|
|
@ -43,10 +46,17 @@ BattleGroundAB::BattleGroundAB()
|
||||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN;
|
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finalizes an instance of the <see cref="BattleGroundAB"/> class.
|
||||||
|
/// </summary>
|
||||||
BattleGroundAB::~BattleGroundAB()
|
BattleGroundAB::~BattleGroundAB()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the specified diff.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="diff">The diff.</param>
|
||||||
void BattleGroundAB::Update(uint32 diff)
|
void BattleGroundAB::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
BattleGround::Update(diff);
|
BattleGround::Update(diff);
|
||||||
|
|
@ -61,7 +71,7 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
if (m_BannerTimers[node].timer)
|
if (m_BannerTimers[node].timer)
|
||||||
{
|
{
|
||||||
if (m_BannerTimers[node].timer > diff)
|
if (m_BannerTimers[node].timer > diff)
|
||||||
m_BannerTimers[node].timer -= diff;
|
{ m_BannerTimers[node].timer -= diff; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_BannerTimers[node].timer = 0;
|
m_BannerTimers[node].timer = 0;
|
||||||
|
|
@ -73,7 +83,7 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
if (m_NodeTimers[node])
|
if (m_NodeTimers[node])
|
||||||
{
|
{
|
||||||
if (m_NodeTimers[node] > diff)
|
if (m_NodeTimers[node] > diff)
|
||||||
m_NodeTimers[node] -= diff;
|
{ m_NodeTimers[node] -= diff; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_NodeTimers[node] = 0;
|
m_NodeTimers[node] = 0;
|
||||||
|
|
@ -102,7 +112,7 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
|
|
||||||
for (uint8 team = 0; team < PVP_TEAM_COUNT; ++team)
|
for (uint8 team = 0; team < PVP_TEAM_COUNT; ++team)
|
||||||
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
||||||
++team_points[team];
|
{ ++team_points[team]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accumulate points
|
// Accumulate points
|
||||||
|
|
@ -110,7 +120,7 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
int points = team_points[team];
|
int points = team_points[team];
|
||||||
if (!points)
|
if (!points)
|
||||||
continue;
|
{ continue; }
|
||||||
m_lastTick[team] += diff;
|
m_lastTick[team] += diff;
|
||||||
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
||||||
{
|
{
|
||||||
|
|
@ -131,19 +141,19 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||||
{
|
{
|
||||||
if (team == TEAM_INDEX_ALLIANCE)
|
if (team == TEAM_INDEX_ALLIANCE)
|
||||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
{ SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||||
else
|
else
|
||||||
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
{ SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||||
m_IsInformedNearVictory = true;
|
m_IsInformedNearVictory = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
{ m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE; }
|
||||||
if (team == TEAM_INDEX_ALLIANCE)
|
if (team == TEAM_INDEX_ALLIANCE)
|
||||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
{ UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]); }
|
||||||
if (team == TEAM_INDEX_HORDE)
|
if (team == TEAM_INDEX_HORDE)
|
||||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
{ UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]); }
|
||||||
|
|
||||||
// update achievement flags
|
// update achievement flags
|
||||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||||
|
|
@ -156,12 +166,15 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
|
|
||||||
// Test win condition
|
// Test win condition
|
||||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
if (m_TeamScores[TEAM_INDEX_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||||
EndBattleGround(ALLIANCE);
|
{ EndBattleGround(ALLIANCE); }
|
||||||
if (m_TeamScores[TEAM_INDEX_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
if (m_TeamScores[TEAM_INDEX_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||||
EndBattleGround(HORDE);
|
{ EndBattleGround(HORDE); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Startings the event open doors.
|
||||||
|
/// </summary>
|
||||||
void BattleGroundAB::StartingEventOpenDoors()
|
void BattleGroundAB::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
OpenDoorEvent(BG_EVENT_DOOR);
|
OpenDoorEvent(BG_EVENT_DOOR);
|
||||||
|
|
@ -170,6 +183,10 @@ void BattleGroundAB::StartingEventOpenDoors()
|
||||||
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, AB_EVENT_START_BATTLE);
|
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, AB_EVENT_START_BATTLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the player.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plr">The PLR.</param>
|
||||||
void BattleGroundAB::AddPlayer(Player* plr)
|
void BattleGroundAB::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
|
|
@ -179,25 +196,35 @@ void BattleGroundAB::AddPlayer(Player* plr)
|
||||||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the player.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="">The .</param>
|
||||||
|
/// <param name="">The .</param>
|
||||||
void BattleGroundAB::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/)
|
void BattleGroundAB::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the area trigger.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The source.</param>
|
||||||
|
/// <param name="trigger">The trigger.</param>
|
||||||
bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
{
|
{
|
||||||
switch (trigger)
|
switch (trigger)
|
||||||
{
|
{
|
||||||
case 3948: // Arathi Basin Alliance Exit.
|
case 3948: // Arathi Basin Alliance Exit.
|
||||||
if (source->GetTeam() != ALLIANCE)
|
if (source->GetTeam() != ALLIANCE)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE); }
|
||||||
else
|
else
|
||||||
source->LeaveBattleground();
|
{ source->LeaveBattleground(); }
|
||||||
break;
|
break;
|
||||||
case 3949: // Arathi Basin Horde Exit.
|
case 3949: // Arathi Basin Horde Exit.
|
||||||
if (source->GetTeam() != HORDE)
|
if (source->GetTeam() != HORDE)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE); }
|
||||||
else
|
else
|
||||||
source->LeaveBattleground();
|
{ source->LeaveBattleground(); }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -205,8 +232,13 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* type: 0-neutral, 1-contested, 3-occupied
|
/// <summary>
|
||||||
teamIndex: 0-ally, 1-horde */
|
/// Creates the banner.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">The node.</param>
|
||||||
|
/// <param name="type">The type. 0-neutral, 1-contested, 3-occupied</param>
|
||||||
|
/// <param name="teamIndex">Index of the team. 0-ally, 1-horde</param>
|
||||||
|
/// <param name="delay">The delay.</param>
|
||||||
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
|
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
|
||||||
{
|
{
|
||||||
// Just put it into the queue
|
// Just put it into the queue
|
||||||
|
|
@ -221,11 +253,16 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool
|
||||||
// cause the node-type is in the generic form
|
// cause the node-type is in the generic form
|
||||||
// please see in the headerfile for the ids
|
// please see in the headerfile for the ids
|
||||||
if (type != BG_AB_NODE_TYPE_NEUTRAL)
|
if (type != BG_AB_NODE_TYPE_NEUTRAL)
|
||||||
type += teamIndex;
|
{ type += teamIndex; }
|
||||||
|
|
||||||
SpawnEvent(node, type, true); // will automaticly despawn other events
|
SpawnEvent(node, type, true); // will automaticly despawn other events
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// _s the get node name id.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">The node.</param>
|
||||||
|
/// <returns></returns>
|
||||||
int32 BattleGroundAB::_GetNodeNameId(uint8 node)
|
int32 BattleGroundAB::_GetNodeNameId(uint8 node)
|
||||||
{
|
{
|
||||||
switch (node)
|
switch (node)
|
||||||
|
|
@ -241,26 +278,31 @@ int32 BattleGroundAB::_GetNodeNameId(uint8 node)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fills the initial world states.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">The data.</param>
|
||||||
|
/// <param name="count">The count.</param>
|
||||||
void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
{
|
{
|
||||||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||||
|
|
||||||
// Node icons
|
// Node icons
|
||||||
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
||||||
FillInitialWorldState(data, count, BG_AB_OP_NODEICONS[node], m_Nodes[node] == 0);
|
{ FillInitialWorldState(data, count, BG_AB_OP_NODEICONS[node], m_Nodes[node] == 0); }
|
||||||
|
|
||||||
// Node occupied states
|
// Node occupied states
|
||||||
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
||||||
for (uint8 i = 1; i < BG_AB_NODES_MAX; ++i)
|
for (uint8 i = 1; i < BG_AB_NODES_MAX; ++i)
|
||||||
FillInitialWorldState(data, count, BG_AB_OP_NODESTATES[node] + plusArray[i], m_Nodes[node] == i);
|
{ FillInitialWorldState(data, count, BG_AB_OP_NODESTATES[node] + plusArray[i], m_Nodes[node] == i); }
|
||||||
|
|
||||||
// How many bases each team owns
|
// How many bases each team owns
|
||||||
uint8 ally = 0, horde = 0;
|
uint8 ally = 0, horde = 0;
|
||||||
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
||||||
if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||||
++ally;
|
{ ++ally; }
|
||||||
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||||
++horde;
|
{ ++horde; }
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||||
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
||||||
|
|
@ -275,15 +317,19 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
FillInitialWorldState(data, count, 0x745, 0x2); // 37 1861 unk
|
FillInitialWorldState(data, count, 0x745, 0x2); // 37 1861 unk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// _s the send node update.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">The node.</param>
|
||||||
void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||||
{
|
{
|
||||||
// Send node owner state update to refresh map icons on client
|
// Send node owner state update to refresh map icons on client
|
||||||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||||
|
|
||||||
if (m_prevNodes[node])
|
if (m_prevNodes[node])
|
||||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], WORLD_STATE_REMOVE);
|
{ UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], WORLD_STATE_REMOVE); }
|
||||||
else
|
else
|
||||||
UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE);
|
{ UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE); }
|
||||||
|
|
||||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], WORLD_STATE_ADD);
|
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], WORLD_STATE_ADD);
|
||||||
|
|
||||||
|
|
@ -291,44 +337,54 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||||
uint8 ally = 0, horde = 0;
|
uint8 ally = 0, horde = 0;
|
||||||
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||||
if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||||
++ally;
|
{ ++ally; }
|
||||||
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||||
++horde;
|
{ ++horde; }
|
||||||
|
|
||||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// _s the node occupied.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">The node.</param>
|
||||||
|
/// <param name="team">The team.</param>
|
||||||
void BattleGroundAB::_NodeOccupied(uint8 node, Team team)
|
void BattleGroundAB::_NodeOccupied(uint8 node, Team team)
|
||||||
{
|
{
|
||||||
uint8 capturedNodes = 0;
|
uint8 capturedNodes = 0;
|
||||||
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||||
{
|
{
|
||||||
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||||
++capturedNodes;
|
{ ++capturedNodes; }
|
||||||
}
|
}
|
||||||
if (capturedNodes >= 5)
|
if (capturedNodes >= 5)
|
||||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
|
{ CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team); }
|
||||||
if (capturedNodes >= 4)
|
if (capturedNodes >= 4)
|
||||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
|
{ CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoked if a player used a banner as a gameobject */
|
/* Invoked if a player used a banner as a gameobject */
|
||||||
|
/// <summary>
|
||||||
|
/// Events the player clicked on flag.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The source.</param>
|
||||||
|
/// <param name="target_obj">The target_obj.</param>
|
||||||
void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
||||||
if (event >= BG_AB_NODES_MAX) // not a node
|
if (event >= BG_AB_NODES_MAX) // not a node
|
||||||
return;
|
{ return; }
|
||||||
BG_AB_Nodes node = BG_AB_Nodes(event);
|
BG_AB_Nodes node = BG_AB_Nodes(event);
|
||||||
|
|
||||||
PvpTeamIndex teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
PvpTeamIndex teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||||
|
|
||||||
// Check if player really could use this banner, not cheated
|
// Check if player really could use this banner, not cheated
|
||||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node] % 2))
|
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node] % 2))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||||
uint32 sound = 0;
|
uint32 sound = 0;
|
||||||
|
|
@ -347,9 +403,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||||
|
|
||||||
if (teamIndex == 0)
|
if (teamIndex == 0)
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY);
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY); }
|
||||||
else
|
else
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE);
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE); }
|
||||||
|
|
||||||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||||
}
|
}
|
||||||
|
|
@ -368,9 +424,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||||
|
|
||||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); }
|
||||||
else
|
else
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
||||||
}
|
}
|
||||||
// If contested, change back to occupied
|
// If contested, change back to occupied
|
||||||
else
|
else
|
||||||
|
|
@ -385,9 +441,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
_NodeOccupied(node, (teamIndex == TEAM_INDEX_ALLIANCE) ? ALLIANCE : HORDE);
|
_NodeOccupied(node, (teamIndex == TEAM_INDEX_ALLIANCE) ? ALLIANCE : HORDE);
|
||||||
|
|
||||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); }
|
||||||
else
|
else
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
||||||
}
|
}
|
||||||
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||||
}
|
}
|
||||||
|
|
@ -403,9 +459,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||||
|
|
||||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); }
|
||||||
else
|
else
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
||||||
|
|
||||||
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||||
}
|
}
|
||||||
|
|
@ -414,13 +470,16 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
||||||
{
|
{
|
||||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node)); }
|
||||||
else
|
else
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node));
|
{ SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node)); }
|
||||||
}
|
}
|
||||||
PlaySoundToAll(sound);
|
PlaySoundToAll(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets this instance.
|
||||||
|
/// </summary>
|
||||||
void BattleGroundAB::Reset()
|
void BattleGroundAB::Reset()
|
||||||
{
|
{
|
||||||
// call parent's class reset
|
// call parent's class reset
|
||||||
|
|
@ -452,6 +511,10 @@ void BattleGroundAB::Reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ends the battle ground.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="winner">The winner.</param>
|
||||||
void BattleGroundAB::EndBattleGround(Team winner)
|
void BattleGroundAB::EndBattleGround(Team winner)
|
||||||
{
|
{
|
||||||
// win reward
|
// win reward
|
||||||
|
|
@ -466,6 +529,11 @@ void BattleGroundAB::EndBattleGround(Team winner)
|
||||||
BattleGround::EndBattleGround(winner);
|
BattleGround::EndBattleGround(winner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the closest grave yard.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="player">The player.</param>
|
||||||
|
/// <returns></returns>
|
||||||
WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||||
{
|
{
|
||||||
PvpTeamIndex teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
PvpTeamIndex teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||||
|
|
@ -474,7 +542,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||||
std::vector<uint8> nodes;
|
std::vector<uint8> nodes;
|
||||||
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||||
if (m_Nodes[i] == teamIndex + 3)
|
if (m_Nodes[i] == teamIndex + 3)
|
||||||
nodes.push_back(i);
|
{ nodes.push_back(i); }
|
||||||
|
|
||||||
WorldSafeLocsEntry const* good_entry = NULL;
|
WorldSafeLocsEntry const* good_entry = NULL;
|
||||||
// If so, select the closest node to place ghost on
|
// If so, select the closest node to place ghost on
|
||||||
|
|
@ -488,7 +556,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||||
{
|
{
|
||||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]);
|
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
continue;
|
{ 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)
|
if (mindist > dist)
|
||||||
{
|
{
|
||||||
|
|
@ -500,16 +568,22 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||||
}
|
}
|
||||||
// If not, place ghost on starting location
|
// If not, place ghost on starting location
|
||||||
if (!good_entry)
|
if (!good_entry)
|
||||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex + 5]);
|
{ good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex + 5]); }
|
||||||
|
|
||||||
return good_entry;
|
return good_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the player score.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The source.</param>
|
||||||
|
/// <param name="type">The type.</param>
|
||||||
|
/// <param name="value">The value.</param>
|
||||||
void BattleGroundAB::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
|
void BattleGroundAB::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
|
||||||
{
|
{
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
if (itr == m_PlayerScores.end()) // player not found...
|
if (itr == m_PlayerScores.end()) // player not found...
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -535,17 +609,20 @@ bool BattleGroundAB::IsAllNodesControlledByTeam(Team team) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the premature finish winning team.
|
||||||
|
/// </summary>
|
||||||
Team BattleGroundAB::GetPrematureWinner()
|
Team BattleGroundAB::GetPrematureWinner()
|
||||||
{
|
{
|
||||||
int32 hordeScore = m_TeamScores[TEAM_INDEX_HORDE];
|
int32 hordeScore = m_TeamScores[TEAM_INDEX_HORDE];
|
||||||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||||
|
|
||||||
if (hordeScore > allianceScore)
|
if (hordeScore > allianceScore)
|
||||||
return HORDE;
|
{ return HORDE; }
|
||||||
|
|
||||||
if (allianceScore > hordeScore)
|
if (allianceScore > hordeScore)
|
||||||
return ALLIANCE;
|
{ return ALLIANCE; }
|
||||||
|
|
||||||
// If the values are equal, fall back to number of players on each team
|
// If the values are equal, fall back to number of players on each team
|
||||||
return BattleGround::GetPrematureWinner();
|
return BattleGround::GetPrematureWinner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,17 @@
|
||||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
#ifndef __BATTLEGROUNDAB_H
|
|
||||||
#define __BATTLEGROUNDAB_H
|
#ifndef MANGOS_H_BATTLEGROUNDAB
|
||||||
|
#define MANGOS_H_BATTLEGROUNDAB
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "BattleGround.h"
|
#include "BattleGround.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AB_WorldStates
|
enum BG_AB_WorldStates
|
||||||
{
|
{
|
||||||
BG_AB_OP_OCCUPIED_BASES_HORDE = 1778,
|
BG_AB_OP_OCCUPIED_BASES_HORDE = 1778,
|
||||||
|
|
@ -65,19 +70,27 @@ enum BG_AB_WorldStates
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787};
|
const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787}; /**< TODO */
|
||||||
|
|
||||||
const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843};
|
const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843}; /**< TODO */
|
||||||
|
|
||||||
/* node events */
|
/* node events */
|
||||||
// node-events are just event1=BG_AB_Nodes, event2=BG_AB_NodeStatus
|
// node-events are just event1=BG_AB_Nodes, event2=BG_AB_NodeStatus
|
||||||
// so we don't need to define the constants here :)
|
// so we don't need to define the constants here :)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AB_Timers
|
enum BG_AB_Timers
|
||||||
{
|
{
|
||||||
BG_AB_FLAG_CAPTURING_TIME = 60000,
|
BG_AB_FLAG_CAPTURING_TIME = 60000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AB_Score
|
enum BG_AB_Score
|
||||||
{
|
{
|
||||||
BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
|
BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
|
||||||
|
|
@ -85,6 +98,10 @@ enum BG_AB_Score
|
||||||
};
|
};
|
||||||
|
|
||||||
/* do NOT change the order, else wrong behaviour */
|
/* do NOT change the order, else wrong behaviour */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AB_Nodes
|
enum BG_AB_Nodes
|
||||||
{
|
{
|
||||||
BG_AB_NODE_STABLES = 0,
|
BG_AB_NODE_STABLES = 0,
|
||||||
|
|
@ -97,6 +114,10 @@ enum BG_AB_Nodes
|
||||||
|
|
||||||
#define BG_AB_NODES_MAX 5
|
#define BG_AB_NODES_MAX 5
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AB_NodeStatus
|
enum BG_AB_NodeStatus
|
||||||
{
|
{
|
||||||
BG_AB_NODE_TYPE_NEUTRAL = 0,
|
BG_AB_NODE_TYPE_NEUTRAL = 0,
|
||||||
|
|
@ -108,6 +129,10 @@ enum BG_AB_NodeStatus
|
||||||
BG_AB_NODE_STATUS_HORDE_OCCUPIED = 4
|
BG_AB_NODE_STATUS_HORDE_OCCUPIED = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AB_Sounds
|
enum BG_AB_Sounds
|
||||||
{
|
{
|
||||||
BG_AB_SOUND_NODE_CLAIMED = 8192,
|
BG_AB_SOUND_NODE_CLAIMED = 8192,
|
||||||
|
|
@ -125,14 +150,14 @@ enum BG_AB_Sounds
|
||||||
#define AB_EVENT_START_BATTLE 9158
|
#define AB_EVENT_START_BATTLE 9158
|
||||||
|
|
||||||
// Tick intervals and given points: case 0,1,2,3,4,5 captured nodes
|
// Tick intervals and given points: case 0,1,2,3,4,5 captured nodes
|
||||||
const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000};
|
const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000}; /**< TODO */
|
||||||
const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30};
|
const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30}; /**< TODO */
|
||||||
|
|
||||||
// WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location
|
// WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location
|
||||||
const uint32 BG_AB_GraveyardIds[7] = {895, 894, 893, 897, 896, 898, 899};
|
const uint32 BG_AB_GraveyardIds[7] = {895, 894, 893, 897, 896, 898, 899}; /**< TODO */
|
||||||
|
|
||||||
// x, y, z, o
|
// x, y, z, o
|
||||||
const float BG_AB_BuffPositions[BG_AB_NODES_MAX][4] =
|
const float BG_AB_BuffPositions[BG_AB_NODES_MAX][4] = /**< TODO */
|
||||||
{
|
{
|
||||||
{1185.71f, 1185.24f, -56.36f, 2.56f}, // stables
|
{1185.71f, 1185.24f, -56.36f, 2.56f}, // stables
|
||||||
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
|
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
|
||||||
|
|
@ -141,66 +166,185 @@ const float BG_AB_BuffPositions[BG_AB_NODES_MAX][4] =
|
||||||
{1146.62f, 816.94f, -98.49f, 6.14f} // gold mine
|
{1146.62f, 816.94f, -98.49f, 6.14f} // gold mine
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
struct BG_AB_BannerTimer
|
struct BG_AB_BannerTimer
|
||||||
{
|
{
|
||||||
uint32 timer;
|
uint32 timer; /**< TODO */
|
||||||
uint8 type;
|
uint8 type; /**< TODO */
|
||||||
uint8 teamIndex;
|
uint8 teamIndex; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundABScore : public BattleGroundScore
|
class BattleGroundABScore : public BattleGroundScore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
|
BattleGroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual ~BattleGroundABScore() {};
|
virtual ~BattleGroundABScore() {};
|
||||||
|
|
||||||
uint32 GetAttr1() const { return BasesAssaulted; }
|
uint32 GetAttr1() const { return BasesAssaulted; }
|
||||||
uint32 GetAttr2() const { return BasesDefended; }
|
uint32 GetAttr2() const { return BasesDefended; }
|
||||||
|
|
||||||
uint32 BasesAssaulted;
|
uint32 BasesAssaulted; /**< TODO */
|
||||||
uint32 BasesDefended;
|
uint32 BasesDefended; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundAB : public BattleGround
|
class BattleGroundAB : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundAB();
|
BattleGroundAB();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
~BattleGroundAB();
|
~BattleGroundAB();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param diff
|
||||||
|
*/
|
||||||
void Update(uint32 diff) override;
|
void Update(uint32 diff) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
*/
|
||||||
void AddPlayer(Player* plr) override;
|
void AddPlayer(Player* plr) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual void StartingEventOpenDoors() override;
|
virtual void StartingEventOpenDoors() override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
* @param guid
|
||||||
|
*/
|
||||||
void RemovePlayer(Player* plr, ObjectGuid guid) override;
|
void RemovePlayer(Player* plr, ObjectGuid guid) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param trigger
|
||||||
|
*/
|
||||||
bool HandleAreaTrigger(Player* source, uint32 trigger) override;
|
bool HandleAreaTrigger(Player* source, uint32 trigger) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual void Reset() override;
|
virtual void Reset() override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param winner
|
||||||
|
*/
|
||||||
void EndBattleGround(Team winner) override;
|
void EndBattleGround(Team winner) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @return const WorldSafeLocsEntry
|
||||||
|
*/
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override;
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override;
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param type
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
virtual void UpdatePlayerScore(Player* source, uint32 type, uint32 value) override;
|
virtual void UpdatePlayerScore(Player* source, uint32 type, uint32 value) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param count
|
||||||
|
*/
|
||||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
|
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
|
||||||
|
|
||||||
/* Nodes occupying */
|
/* Nodes occupying */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param target_obj
|
||||||
|
*/
|
||||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
||||||
|
|
||||||
/* achievement req. */
|
/* achievement req. */
|
||||||
bool IsAllNodesControlledByTeam(Team team) const override;
|
bool IsAllNodesControlledByTeam(Team team) const override;
|
||||||
bool IsTeamScores500Disadvantage(Team team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
|
bool IsTeamScores500Disadvantage(Team team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
|
||||||
|
|
||||||
|
/* Premature finish */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual Team GetPrematureWinner() override;
|
virtual Team GetPrematureWinner() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Gameobject spawning/despawning */
|
/* Gameobject spawning/despawning */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param type
|
||||||
|
* @param teamIndex
|
||||||
|
* @param delay
|
||||||
|
*/
|
||||||
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
|
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
|
||||||
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
|
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void _SendNodeUpdate(uint8 node);
|
void _SendNodeUpdate(uint8 node);
|
||||||
|
|
||||||
/* Creature spawning/despawning */
|
/* Creature spawning/despawning */
|
||||||
// TODO: working, scripted peons spawning
|
// TODO: working, scripted peons spawning
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param team
|
||||||
|
*/
|
||||||
void _NodeOccupied(uint8 node, Team team);
|
void _NodeOccupied(uint8 node, Team team);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @return int32
|
||||||
|
*/
|
||||||
int32 _GetNodeNameId(uint8 node);
|
int32 _GetNodeNameId(uint8 node);
|
||||||
|
|
||||||
/* Nodes info:
|
/* Nodes info:
|
||||||
|
|
@ -209,16 +353,16 @@ class BattleGroundAB : public BattleGround
|
||||||
2: horde contested
|
2: horde contested
|
||||||
3: ally occupied
|
3: ally occupied
|
||||||
4: horde occupied */
|
4: horde occupied */
|
||||||
uint8 m_Nodes[BG_AB_NODES_MAX];
|
uint8 m_Nodes[BG_AB_NODES_MAX]; /**< TODO */
|
||||||
uint8 m_prevNodes[BG_AB_NODES_MAX]; // used for performant wordlstate-updating
|
uint8 m_prevNodes[BG_AB_NODES_MAX]; /**< used for performant wordlstate-updating */
|
||||||
BG_AB_BannerTimer m_BannerTimers[BG_AB_NODES_MAX];
|
BG_AB_BannerTimer m_BannerTimers[BG_AB_NODES_MAX]; /**< TODO */
|
||||||
uint32 m_NodeTimers[BG_AB_NODES_MAX];
|
uint32 m_NodeTimers[BG_AB_NODES_MAX]; /**< TODO */
|
||||||
uint32 m_lastTick[PVP_TEAM_COUNT];
|
uint32 m_lastTick[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
uint32 m_honorScoreTicks[PVP_TEAM_COUNT];
|
uint32 m_honorScoreTicks[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
uint32 m_ReputationScoreTics[PVP_TEAM_COUNT];
|
uint32 m_ReputationScoreTics[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
bool m_IsInformedNearVictory;
|
bool m_IsInformedNearVictory; /**< TODO */
|
||||||
uint32 m_honorTicks;
|
uint32 m_honorTicks; /**< TODO */
|
||||||
uint32 m_ReputationTics;
|
uint32 m_ReputationTics; /**< TODO */
|
||||||
// need for achievements
|
// need for achievements
|
||||||
bool m_TeamScores500Disadvantage[PVP_TEAM_COUNT];
|
bool m_TeamScores500Disadvantage[PVP_TEAM_COUNT];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ BattleGroundAV::BattleGroundAV(): m_HonorMapComplete(0), m_RepTowerDestruction(0
|
||||||
void BattleGroundAV::HandleKillPlayer(Player* player, Player* killer)
|
void BattleGroundAV::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
BattleGround::HandleKillPlayer(player, killer);
|
BattleGround::HandleKillPlayer(player, killer);
|
||||||
UpdateScore(GetTeamIndexByTeamId(player->GetTeam()), -1);
|
UpdateScore(GetTeamIndexByTeamId(player->GetTeam()), -1);
|
||||||
|
|
@ -53,10 +53,10 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry());
|
DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry());
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
|
uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
|
||||||
if (event1 == BG_EVENT_NONE)
|
if (event1 == BG_EVENT_NONE)
|
||||||
return;
|
{ return; }
|
||||||
switch (event1)
|
switch (event1)
|
||||||
{
|
{
|
||||||
case BG_AV_BOSS_A:
|
case BG_AV_BOSS_A:
|
||||||
|
|
@ -75,7 +75,7 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
||||||
break;
|
break;
|
||||||
case BG_AV_CAPTAIN_A:
|
case BG_AV_CAPTAIN_A:
|
||||||
if (IsActiveEvent(BG_AV_NodeEventCaptainDead_A, 0))
|
if (IsActiveEvent(BG_AV_NodeEventCaptainDead_A, 0))
|
||||||
return;
|
{ return; }
|
||||||
RewardReputationToTeam(BG_AV_FACTION_H, m_RepCaptain, HORDE);
|
RewardReputationToTeam(BG_AV_FACTION_H, m_RepCaptain, HORDE);
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE);
|
||||||
UpdateScore(TEAM_INDEX_ALLIANCE, (-1) * BG_AV_RES_CAPTAIN);
|
UpdateScore(TEAM_INDEX_ALLIANCE, (-1) * BG_AV_RES_CAPTAIN);
|
||||||
|
|
@ -84,7 +84,7 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
||||||
break;
|
break;
|
||||||
case BG_AV_CAPTAIN_H:
|
case BG_AV_CAPTAIN_H:
|
||||||
if (IsActiveEvent(BG_AV_NodeEventCaptainDead_H, 0))
|
if (IsActiveEvent(BG_AV_NodeEventCaptainDead_H, 0))
|
||||||
return;
|
{ return; }
|
||||||
RewardReputationToTeam(BG_AV_FACTION_A, m_RepCaptain, ALLIANCE);
|
RewardReputationToTeam(BG_AV_FACTION_A, m_RepCaptain, ALLIANCE);
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE);
|
||||||
UpdateScore(TEAM_INDEX_HORDE, (-1) * BG_AV_RES_CAPTAIN);
|
UpdateScore(TEAM_INDEX_HORDE, (-1) * BG_AV_RES_CAPTAIN);
|
||||||
|
|
@ -103,7 +103,7 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
||||||
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(player->GetTeam());
|
BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(player->GetTeam());
|
||||||
MANGOS_ASSERT(teamIdx != BG_AV_TEAM_NEUTRAL);
|
MANGOS_ASSERT(teamIdx != BG_AV_TEAM_NEUTRAL);
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid);
|
DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid);
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||||
if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED)
|
if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED)
|
||||||
PopulateNode(i);
|
{ PopulateNode(i); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_COMMANDER1:
|
case BG_AV_QUEST_A_COMMANDER1:
|
||||||
|
|
@ -131,21 +131,21 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
m_Team_QuestStatus[teamIdx][1]++;
|
m_Team_QuestStatus[teamIdx][1]++;
|
||||||
reputation = 1;
|
reputation = 1;
|
||||||
if (m_Team_QuestStatus[teamIdx][1] == 120)
|
if (m_Team_QuestStatus[teamIdx][1] == 120)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_COMMANDER2:
|
case BG_AV_QUEST_A_COMMANDER2:
|
||||||
case BG_AV_QUEST_H_COMMANDER2:
|
case BG_AV_QUEST_H_COMMANDER2:
|
||||||
m_Team_QuestStatus[teamIdx][2]++;
|
m_Team_QuestStatus[teamIdx][2]++;
|
||||||
reputation = 2;
|
reputation = 2;
|
||||||
if (m_Team_QuestStatus[teamIdx][2] == 60)
|
if (m_Team_QuestStatus[teamIdx][2] == 60)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_COMMANDER3:
|
case BG_AV_QUEST_A_COMMANDER3:
|
||||||
case BG_AV_QUEST_H_COMMANDER3:
|
case BG_AV_QUEST_H_COMMANDER3:
|
||||||
m_Team_QuestStatus[teamIdx][3]++;
|
m_Team_QuestStatus[teamIdx][3]++;
|
||||||
reputation = 5;
|
reputation = 5;
|
||||||
if (m_Team_QuestStatus[teamIdx][1] == 30)
|
if (m_Team_QuestStatus[teamIdx][1] == 30)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_BOSS1:
|
case BG_AV_QUEST_A_BOSS1:
|
||||||
case BG_AV_QUEST_H_BOSS1:
|
case BG_AV_QUEST_H_BOSS1:
|
||||||
|
|
@ -156,7 +156,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
m_Team_QuestStatus[teamIdx][4]++;
|
m_Team_QuestStatus[teamIdx][4]++;
|
||||||
reputation += 1;
|
reputation += 1;
|
||||||
if (m_Team_QuestStatus[teamIdx][4] >= 200)
|
if (m_Team_QuestStatus[teamIdx][4] >= 200)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_NEAR_MINE:
|
case BG_AV_QUEST_A_NEAR_MINE:
|
||||||
case BG_AV_QUEST_H_NEAR_MINE:
|
case BG_AV_QUEST_H_NEAR_MINE:
|
||||||
|
|
@ -166,7 +166,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||||
if (m_Team_QuestStatus[teamIdx][6] == 7)
|
if (m_Team_QuestStatus[teamIdx][6] == 7)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_OTHER_MINE:
|
case BG_AV_QUEST_A_OTHER_MINE:
|
||||||
|
|
@ -177,7 +177,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||||
if (m_Team_QuestStatus[teamIdx][5] == 20)
|
if (m_Team_QuestStatus[teamIdx][5] == 20)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_RIDER_HIDE:
|
case BG_AV_QUEST_A_RIDER_HIDE:
|
||||||
|
|
@ -188,7 +188,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||||
if (m_Team_QuestStatus[teamIdx][8] == 25)
|
if (m_Team_QuestStatus[teamIdx][8] == 25)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BG_AV_QUEST_A_RIDER_TAME:
|
case BG_AV_QUEST_A_RIDER_TAME:
|
||||||
|
|
@ -199,7 +199,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||||
if (m_Team_QuestStatus[teamIdx][7] == 25)
|
if (m_Team_QuestStatus[teamIdx][7] == 25)
|
||||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid);
|
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -208,7 +208,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (reputation)
|
if (reputation)
|
||||||
RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam());
|
{ RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAV::UpdateScore(PvpTeamIndex teamIdx, int32 points)
|
void BattleGroundAV::UpdateScore(PvpTeamIndex teamIdx, int32 points)
|
||||||
|
|
@ -241,7 +241,7 @@ void BattleGroundAV::Update(uint32 diff)
|
||||||
BattleGround::Update(diff);
|
BattleGround::Update(diff);
|
||||||
|
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// add points from mine owning, and look if the neutral team can reclaim the mine
|
// add points from mine owning, and look if the neutral team can reclaim the mine
|
||||||
for (uint8 mine = 0; mine < BG_AV_MAX_MINES; ++mine)
|
for (uint8 mine = 0; mine < BG_AV_MAX_MINES; ++mine)
|
||||||
|
|
@ -256,9 +256,9 @@ void BattleGroundAV::Update(uint32 diff)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Mine_Reclaim_Timer[mine] > diff)
|
if (m_Mine_Reclaim_Timer[mine] > diff)
|
||||||
m_Mine_Reclaim_Timer[mine] -= diff;
|
{ m_Mine_Reclaim_Timer[mine] -= diff; }
|
||||||
else
|
else
|
||||||
ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL);
|
{ ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,9 +268,9 @@ void BattleGroundAV::Update(uint32 diff)
|
||||||
if (m_Nodes[i].State == POINT_ASSAULTED)
|
if (m_Nodes[i].State == POINT_ASSAULTED)
|
||||||
{
|
{
|
||||||
if (m_Nodes[i].Timer > diff)
|
if (m_Nodes[i].Timer > diff)
|
||||||
m_Nodes[i].Timer -= diff;
|
{ m_Nodes[i].Timer -= diff; }
|
||||||
else
|
else
|
||||||
EventPlayerDestroyedPoint(i);
|
{ EventPlayerDestroyedPoint(i); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -303,20 +303,20 @@ void BattleGroundAV::EndBattleGround(Team winner)
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
|
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
|
||||||
if (m_Nodes[i].State == POINT_CONTROLLED)
|
if (m_Nodes[i].State == POINT_CONTROLLED)
|
||||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE)
|
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE)
|
||||||
++tower_survived[TEAM_INDEX_ALLIANCE];
|
{ ++tower_survived[TEAM_INDEX_ALLIANCE]; }
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
||||||
if (m_Nodes[i].State == POINT_CONTROLLED)
|
if (m_Nodes[i].State == POINT_CONTROLLED)
|
||||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE)
|
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE)
|
||||||
++tower_survived[TEAM_INDEX_HORDE];
|
{ ++tower_survived[TEAM_INDEX_HORDE]; }
|
||||||
|
|
||||||
// graves all controlled
|
// graves all controlled
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||||
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL)
|
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL)
|
||||||
++graves_owned[m_Nodes[i].Owner];
|
{ ++graves_owned[m_Nodes[i].Owner]; }
|
||||||
|
|
||||||
for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i)
|
for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i)
|
||||||
if (m_Mine_Owner[i] != BG_AV_TEAM_NEUTRAL)
|
if (m_Mine_Owner[i] != BG_AV_TEAM_NEUTRAL)
|
||||||
++mines_owned[m_Mine_Owner[i]];
|
{ ++mines_owned[m_Mine_Owner[i]]; }
|
||||||
|
|
||||||
// now we have the values give the honor/reputation to the teams:
|
// now we have the values give the honor/reputation to the teams:
|
||||||
Team team[PVP_TEAM_COUNT] = { ALLIANCE, HORDE };
|
Team team[PVP_TEAM_COUNT] = { ALLIANCE, HORDE };
|
||||||
|
|
@ -330,9 +330,9 @@ void BattleGroundAV::EndBattleGround(Team winner)
|
||||||
}
|
}
|
||||||
DEBUG_LOG("BattleGroundAV: EndbattleGround: bgteam: %u towers:%u honor:%u rep:%u", i, tower_survived[i], GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), tower_survived[i] * BG_AV_REP_SURVIVING_TOWER);
|
DEBUG_LOG("BattleGroundAV: EndbattleGround: bgteam: %u towers:%u honor:%u rep:%u", i, tower_survived[i], GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), tower_survived[i] * BG_AV_REP_SURVIVING_TOWER);
|
||||||
if (graves_owned[i])
|
if (graves_owned[i])
|
||||||
RewardReputationToTeam(faction[i], graves_owned[i] * m_RepOwnedGrave, team[i]);
|
{ RewardReputationToTeam(faction[i], graves_owned[i] * m_RepOwnedGrave, team[i]); }
|
||||||
if (mines_owned[i])
|
if (mines_owned[i])
|
||||||
RewardReputationToTeam(faction[i], mines_owned[i] * m_RepOwnedMine, team[i]);
|
{ RewardReputationToTeam(faction[i], mines_owned[i] * m_RepOwnedMine, team[i]); }
|
||||||
// captain survived?:
|
// captain survived?:
|
||||||
if (!IsActiveEvent(BG_AV_NodeEventCaptainDead_A + GetTeamIndexByTeamId(team[i]), 0))
|
if (!IsActiveEvent(BG_AV_NodeEventCaptainDead_A + GetTeamIndexByTeamId(team[i]), 0))
|
||||||
{
|
{
|
||||||
|
|
@ -358,15 +358,15 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
case 95:
|
case 95:
|
||||||
case 2608:
|
case 2608:
|
||||||
if (source->GetTeam() != ALLIANCE)
|
if (source->GetTeam() != ALLIANCE)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE); }
|
||||||
else
|
else
|
||||||
source->LeaveBattleground();
|
{ source->LeaveBattleground(); }
|
||||||
break;
|
break;
|
||||||
case 2606:
|
case 2606:
|
||||||
if (source->GetTeam() != HORDE)
|
if (source->GetTeam() != HORDE)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE); }
|
||||||
else
|
else
|
||||||
source->LeaveBattleground();
|
{ source->LeaveBattleground(); }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -378,7 +378,7 @@ void BattleGroundAV::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
{
|
{
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
if (itr == m_PlayerScores.end()) // player not found...
|
if (itr == m_PlayerScores.end()) // player not found...
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -441,7 +441,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx
|
||||||
// TODO changing the owner should result in setting respawntime to infinite for current creatures (they should fight the new ones), spawning new mine owners creatures and changing the chest - objects so that the current owning team can use them
|
// TODO changing the owner should result in setting respawntime to infinite for current creatures (they should fight the new ones), spawning new mine owners creatures and changing the chest - objects so that the current owning team can use them
|
||||||
MANGOS_ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
|
MANGOS_ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
|
||||||
if (m_Mine_Owner[mine] == teamIdx)
|
if (m_Mine_Owner[mine] == teamIdx)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
|
m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
|
||||||
m_Mine_Owner[mine] = teamIdx;
|
m_Mine_Owner[mine] = teamIdx;
|
||||||
|
|
@ -464,9 +464,9 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx
|
||||||
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId, Team team)
|
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId, Team team)
|
||||||
{
|
{
|
||||||
if (GOId == BG_AV_OBJECTID_MINE_N)
|
if (GOId == BG_AV_OBJECTID_MINE_N)
|
||||||
return (m_Mine_Owner[BG_AV_NORTH_MINE] == GetAVTeamIndexByTeamId(team));
|
{ return (m_Mine_Owner[BG_AV_NORTH_MINE] == GetAVTeamIndexByTeamId(team)); }
|
||||||
if (GOId == BG_AV_OBJECTID_MINE_S)
|
if (GOId == BG_AV_OBJECTID_MINE_S)
|
||||||
return (m_Mine_Owner[BG_AV_SOUTH_MINE] == GetAVTeamIndexByTeamId(team));
|
{ return (m_Mine_Owner[BG_AV_SOUTH_MINE] == GetAVTeamIndexByTeamId(team)); }
|
||||||
return true; // cause it's no mine'object it is ok if this is true
|
return true; // cause it's no mine'object it is ok if this is true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -479,18 +479,18 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
||||||
{
|
{
|
||||||
uint32 graveDefenderType;
|
uint32 graveDefenderType;
|
||||||
if (m_Team_QuestStatus[teamIdx][0] < 500)
|
if (m_Team_QuestStatus[teamIdx][0] < 500)
|
||||||
graveDefenderType = 0;
|
{ graveDefenderType = 0; }
|
||||||
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
||||||
graveDefenderType = 1;
|
{ graveDefenderType = 1; }
|
||||||
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
||||||
graveDefenderType = 2;
|
{ graveDefenderType = 2; }
|
||||||
else
|
else
|
||||||
graveDefenderType = 3;
|
{ graveDefenderType = 3; }
|
||||||
|
|
||||||
if (m_Nodes[node].State == POINT_CONTROLLED) // we can spawn the current owner event
|
if (m_Nodes[node].State == POINT_CONTROLLED) // we can spawn the current owner event
|
||||||
SpawnEvent(BG_AV_NODES_MAX + node, teamIdx * BG_AV_MAX_GRAVETYPES + graveDefenderType, true);
|
{ SpawnEvent(BG_AV_NODES_MAX + node, teamIdx * BG_AV_MAX_GRAVETYPES + graveDefenderType, true); }
|
||||||
else // we despawn the event from the prevowner
|
else // we despawn the event from the prevowner
|
||||||
SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false);
|
{ SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false); }
|
||||||
}
|
}
|
||||||
SpawnEvent(node, (teamIdx * BG_AV_MAX_STATES) + m_Nodes[node].State, true);
|
SpawnEvent(node, (teamIdx * BG_AV_MAX_STATES) + m_Nodes[node].State, true);
|
||||||
}
|
}
|
||||||
|
|
@ -499,11 +499,11 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
||||||
void BattleGroundAV::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
void BattleGroundAV::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
DEBUG_LOG("BattleGroundAV: using gameobject %i", target_obj->GetEntry());
|
DEBUG_LOG("BattleGroundAV: using gameobject %i", target_obj->GetEntry());
|
||||||
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
||||||
if (event >= BG_AV_NODES_MAX) // not a node
|
if (event >= BG_AV_NODES_MAX) // not a node
|
||||||
return;
|
{ return; }
|
||||||
BG_AV_Nodes node = BG_AV_Nodes(event);
|
BG_AV_Nodes node = BG_AV_Nodes(event);
|
||||||
switch ((sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event2 % BG_AV_MAX_STATES)
|
switch ((sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event2 % BG_AV_MAX_STATES)
|
||||||
{
|
{
|
||||||
|
|
@ -525,7 +525,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
|
||||||
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
|
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
|
||||||
|
|
||||||
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
|
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
|
||||||
return;
|
{ return; }
|
||||||
if (m_Nodes[node].TotalOwner == BG_AV_TEAM_NEUTRAL) // initial snowfall capture
|
if (m_Nodes[node].TotalOwner == BG_AV_TEAM_NEUTRAL) // initial snowfall capture
|
||||||
{
|
{
|
||||||
// until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
|
// until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
|
||||||
|
|
@ -571,7 +571,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node)
|
||||||
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
|
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
|
||||||
DEBUG_LOG("BattleGroundAV: player assaults node %i", node);
|
DEBUG_LOG("BattleGroundAV: player assaults node %i", node);
|
||||||
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || BattleGroundAVTeamIndex(teamIdx) == m_Nodes[node].TotalOwner)
|
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || BattleGroundAVTeamIndex(teamIdx) == m_Nodes[node].TotalOwner)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
AssaultNode(node, teamIdx); // update nodeinfo variables
|
AssaultNode(node, teamIdx); // update nodeinfo variables
|
||||||
UpdateNodeWorldState(node); // send mapicon
|
UpdateNodeWorldState(node); // send mapicon
|
||||||
|
|
@ -612,7 +612,7 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_TEAM_NEUTRAL) // cause neutral teams aren't handled generic
|
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_TEAM_NEUTRAL) // cause neutral teams aren't handled generic
|
||||||
FillInitialWorldState(data, count, AV_SNOWFALL_N, WORLD_STATE_ADD);
|
{ FillInitialWorldState(data, count, AV_SNOWFALL_N, WORLD_STATE_ADD); }
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[TEAM_INDEX_ALLIANCE]);
|
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[TEAM_INDEX_ALLIANCE]);
|
||||||
FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[TEAM_INDEX_HORDE]);
|
FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[TEAM_INDEX_HORDE]);
|
||||||
|
|
@ -629,20 +629,20 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_Owner[BG_AV_NORTH_MINE]], WORLD_STATE_ADD);
|
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_Owner[BG_AV_NORTH_MINE]], WORLD_STATE_ADD);
|
||||||
if (m_Mine_Owner[BG_AV_NORTH_MINE] != m_Mine_PrevOwner[BG_AV_NORTH_MINE])
|
if (m_Mine_Owner[BG_AV_NORTH_MINE] != m_Mine_PrevOwner[BG_AV_NORTH_MINE])
|
||||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], WORLD_STATE_REMOVE);
|
{ FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], WORLD_STATE_REMOVE); }
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_Owner[BG_AV_SOUTH_MINE]], WORLD_STATE_ADD);
|
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_Owner[BG_AV_SOUTH_MINE]], WORLD_STATE_ADD);
|
||||||
if (m_Mine_Owner[BG_AV_SOUTH_MINE] != m_Mine_PrevOwner[BG_AV_SOUTH_MINE])
|
if (m_Mine_Owner[BG_AV_SOUTH_MINE] != m_Mine_PrevOwner[BG_AV_SOUTH_MINE])
|
||||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], WORLD_STATE_REMOVE);
|
{ FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], WORLD_STATE_REMOVE); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||||
{
|
{
|
||||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], WORLD_STATE_ADD);
|
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], WORLD_STATE_ADD);
|
||||||
if (m_Nodes[node].PrevOwner == BG_AV_TEAM_NEUTRAL) // currently only snowfall is supported as neutral node
|
if (m_Nodes[node].PrevOwner == BG_AV_TEAM_NEUTRAL) // currently only snowfall is supported as neutral node
|
||||||
UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE);
|
{ UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE); }
|
||||||
else
|
else
|
||||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE);
|
{ UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
||||||
|
|
@ -651,7 +651,7 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
||||||
|
|
||||||
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], WORLD_STATE_ADD);
|
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], WORLD_STATE_ADD);
|
||||||
if (m_Mine_Owner[mine] != m_Mine_PrevOwner[mine])
|
if (m_Mine_Owner[mine] != m_Mine_PrevOwner[mine])
|
||||||
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], WORLD_STATE_REMOVE);
|
{ UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], WORLD_STATE_REMOVE); }
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
||||||
|
|
@ -667,10 +667,10 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
||||||
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||||
{
|
{
|
||||||
if (m_Nodes[i].Owner != teamIdx || m_Nodes[i].State != POINT_CONTROLLED)
|
if (m_Nodes[i].Owner != teamIdx || m_Nodes[i].State != POINT_CONTROLLED)
|
||||||
continue;
|
{ continue; }
|
||||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
|
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
continue;
|
{ continue; }
|
||||||
float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
|
float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
|
||||||
if (mindist > dist)
|
if (mindist > dist)
|
||||||
{
|
{
|
||||||
|
|
@ -681,7 +681,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
||||||
}
|
}
|
||||||
// If not, place ghost in the starting-cave
|
// If not, place ghost in the starting-cave
|
||||||
if (!good_entry)
|
if (!good_entry)
|
||||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[teamIdx + 7]);
|
{ good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[teamIdx + 7]); }
|
||||||
|
|
||||||
return good_entry;
|
return good_entry;
|
||||||
}
|
}
|
||||||
|
|
@ -746,7 +746,7 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, BattleGroundAVTeamIndex teamIdx,
|
||||||
m_Nodes[node].Tower = tower;
|
m_Nodes[node].Tower = tower;
|
||||||
m_ActiveEvents[node] = teamIdx * BG_AV_MAX_STATES + m_Nodes[node].State;
|
m_ActiveEvents[node] = teamIdx * BG_AV_MAX_STATES + m_Nodes[node].State;
|
||||||
if (IsGrave(node)) // grave-creatures are special cause of a quest
|
if (IsGrave(node)) // grave-creatures are special cause of a quest
|
||||||
m_ActiveEvents[node + BG_AV_NODES_MAX] = teamIdx * BG_AV_MAX_GRAVETYPES;
|
{ m_ActiveEvents[node + BG_AV_NODES_MAX] = teamIdx * BG_AV_MAX_GRAVETYPES; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAV::DefendNode(BG_AV_Nodes node, PvpTeamIndex teamIdx)
|
void BattleGroundAV::DefendNode(BG_AV_Nodes node, PvpTeamIndex teamIdx)
|
||||||
|
|
@ -779,7 +779,7 @@ void BattleGroundAV::Reset()
|
||||||
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
||||||
{
|
{
|
||||||
for (uint8 j = 0; j < 9; ++j) // 9 quests getting tracked
|
for (uint8 j = 0; j < 9; ++j) // 9 quests getting tracked
|
||||||
m_Team_QuestStatus[i][j] = 0;
|
{ m_Team_QuestStatus[i][j] = 0; }
|
||||||
m_TeamScores[i] = BG_AV_SCORE_INITIAL_POINTS;
|
m_TeamScores[i] = BG_AV_SCORE_INITIAL_POINTS;
|
||||||
m_IsInformedNearLose[i] = false;
|
m_IsInformedNearLose[i] = false;
|
||||||
m_ActiveEvents[BG_AV_NodeEventCaptainDead_A + i] = BG_EVENT_NONE;
|
m_ActiveEvents[BG_AV_NodeEventCaptainDead_A + i] = BG_EVENT_NONE;
|
||||||
|
|
@ -800,17 +800,17 @@ void BattleGroundAV::Reset()
|
||||||
m_ActiveEvents[BG_AV_BOSS_A] = 0;
|
m_ActiveEvents[BG_AV_BOSS_A] = 0;
|
||||||
m_ActiveEvents[BG_AV_BOSS_H] = 0;
|
m_ActiveEvents[BG_AV_BOSS_H] = 0;
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // towers
|
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // towers
|
||||||
m_ActiveEvents[BG_AV_MARSHAL_A_SOUTH + i - BG_AV_NODES_DUNBALDAR_SOUTH] = 0;
|
{ m_ActiveEvents[BG_AV_MARSHAL_A_SOUTH + i - BG_AV_NODES_DUNBALDAR_SOUTH] = 0; }
|
||||||
|
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) // alliance graves
|
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) // alliance graves
|
||||||
InitNode(i, BG_AV_TEAM_ALLIANCE, false);
|
{ InitNode(i, BG_AV_TEAM_ALLIANCE, false); }
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers
|
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers
|
||||||
InitNode(i, BG_AV_TEAM_ALLIANCE, true);
|
{ InitNode(i, BG_AV_TEAM_ALLIANCE, true); }
|
||||||
|
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) // horde graves
|
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) // horde graves
|
||||||
InitNode(i, BG_AV_TEAM_HORDE, false);
|
{ InitNode(i, BG_AV_TEAM_HORDE, false); }
|
||||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers
|
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers
|
||||||
InitNode(i, BG_AV_TEAM_HORDE, true);
|
{ InitNode(i, BG_AV_TEAM_HORDE, true); }
|
||||||
|
|
||||||
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_TEAM_NEUTRAL, false); // give snowfall neutral owner
|
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_TEAM_NEUTRAL, false); // give snowfall neutral owner
|
||||||
}
|
}
|
||||||
|
|
@ -821,9 +821,9 @@ Team BattleGroundAV::GetPrematureWinner()
|
||||||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||||
|
|
||||||
if (hordeScore > allianceScore)
|
if (hordeScore > allianceScore)
|
||||||
return HORDE;
|
{ return HORDE; }
|
||||||
if (allianceScore > hordeScore)
|
if (allianceScore > hordeScore)
|
||||||
return ALLIANCE;
|
{ return ALLIANCE; }
|
||||||
|
|
||||||
// If the values are equal, fall back to number of players on each team
|
// If the values are equal, fall back to number of players on each team
|
||||||
return BattleGround::GetPrematureWinner();
|
return BattleGround::GetPrematureWinner();
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BATTLEGROUNDAV_H
|
#ifndef MANGOS_H_BATTLEGROUNDAV
|
||||||
#define __BATTLEGROUNDAV_H
|
#define MANGOS_H_BATTLEGROUNDAV
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "BattleGround.h"
|
#include "BattleGround.h"
|
||||||
|
|
@ -75,6 +75,10 @@
|
||||||
#define BG_AV_REP_OWNED_MINE_HOLIDAY 36
|
#define BG_AV_REP_OWNED_MINE_HOLIDAY 36
|
||||||
|
|
||||||
#define BG_AV_EVENT_START_BATTLE 9166
|
#define BG_AV_EVENT_START_BATTLE 9166
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_Sounds
|
enum BG_AV_Sounds
|
||||||
{
|
{
|
||||||
BG_AV_SOUND_NEAR_LOSE = 8456, // not confirmed yet
|
BG_AV_SOUND_NEAR_LOSE = 8456, // not confirmed yet
|
||||||
|
|
@ -86,9 +90,13 @@ enum BG_AV_Sounds
|
||||||
BG_AV_SOUND_BOTH_TOWER_DEFEND = 8192,
|
BG_AV_SOUND_BOTH_TOWER_DEFEND = 8192,
|
||||||
|
|
||||||
BG_AV_SOUND_ALLIANCE_CAPTAIN = 8232, // gets called when someone attacks them and at the beginning after 3min + rand(x) * 10sec (maybe buff)
|
BG_AV_SOUND_ALLIANCE_CAPTAIN = 8232, // gets called when someone attacks them and at the beginning after 3min + rand(x) * 10sec (maybe buff)
|
||||||
BG_AV_SOUND_HORDE_CAPTAIN = 8333,
|
BG_AV_SOUND_HORDE_CAPTAIN = 8333
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_OTHER_VALUES
|
enum BG_AV_OTHER_VALUES
|
||||||
{
|
{
|
||||||
BG_AV_NORTH_MINE = 0,
|
BG_AV_NORTH_MINE = 0,
|
||||||
|
|
@ -96,17 +104,25 @@ enum BG_AV_OTHER_VALUES
|
||||||
BG_AV_MINE_TICK_TIMER = 45000,
|
BG_AV_MINE_TICK_TIMER = 45000,
|
||||||
BG_AV_MINE_RECLAIM_TIMER = 1200000, // TODO: get the right value.. this is currently 20 minutes
|
BG_AV_MINE_RECLAIM_TIMER = 1200000, // TODO: get the right value.. this is currently 20 minutes
|
||||||
BG_AV_FACTION_A = 730,
|
BG_AV_FACTION_A = 730,
|
||||||
BG_AV_FACTION_H = 729,
|
BG_AV_FACTION_H = 729
|
||||||
};
|
};
|
||||||
#define BG_AV_MAX_MINES 2
|
#define BG_AV_MAX_MINES 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_ObjectIds
|
enum BG_AV_ObjectIds
|
||||||
{
|
{
|
||||||
// mine supplies
|
// mine supplies
|
||||||
BG_AV_OBJECTID_MINE_N = 178785,
|
BG_AV_OBJECTID_MINE_N = 178785,
|
||||||
BG_AV_OBJECTID_MINE_S = 178784,
|
BG_AV_OBJECTID_MINE_S = 178784
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_Nodes
|
enum BG_AV_Nodes
|
||||||
{
|
{
|
||||||
BG_AV_NODES_FIRSTAID_STATION = 0,
|
BG_AV_NODES_FIRSTAID_STATION = 0,
|
||||||
|
|
@ -124,7 +140,7 @@ enum BG_AV_Nodes
|
||||||
BG_AV_NODES_TOWER_POINT = 12,
|
BG_AV_NODES_TOWER_POINT = 12,
|
||||||
BG_AV_NODES_FROSTWOLF_ETOWER = 13,
|
BG_AV_NODES_FROSTWOLF_ETOWER = 13,
|
||||||
BG_AV_NODES_FROSTWOLF_WTOWER = 14,
|
BG_AV_NODES_FROSTWOLF_WTOWER = 14,
|
||||||
BG_AV_NODES_ERROR = 255,
|
BG_AV_NODES_ERROR = 255
|
||||||
};
|
};
|
||||||
#define BG_AV_NODES_MAX 15
|
#define BG_AV_NODES_MAX 15
|
||||||
|
|
||||||
|
|
@ -166,6 +182,10 @@ enum BG_AV_Nodes
|
||||||
#define BG_AV_NodeEventCaptainDead_A 63
|
#define BG_AV_NodeEventCaptainDead_A 63
|
||||||
#define BG_AV_NodeEventCaptainDead_H 64
|
#define BG_AV_NodeEventCaptainDead_H 64
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_Graveyards
|
enum BG_AV_Graveyards
|
||||||
{
|
{
|
||||||
BG_AV_GRAVE_STORM_AID = 751,
|
BG_AV_GRAVE_STORM_AID = 751,
|
||||||
|
|
@ -179,7 +199,7 @@ enum BG_AV_Graveyards
|
||||||
BG_AV_GRAVE_MAIN_HORDE = 610
|
BG_AV_GRAVE_MAIN_HORDE = 610
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32 BG_AV_GraveyardIds[9] =
|
const uint32 BG_AV_GraveyardIds[9] = /**< TODO */
|
||||||
{
|
{
|
||||||
BG_AV_GRAVE_STORM_AID,
|
BG_AV_GRAVE_STORM_AID,
|
||||||
BG_AV_GRAVE_STORM_GRAVE,
|
BG_AV_GRAVE_STORM_GRAVE,
|
||||||
|
|
@ -192,6 +212,10 @@ const uint32 BG_AV_GraveyardIds[9] =
|
||||||
BG_AV_GRAVE_MAIN_HORDE
|
BG_AV_GRAVE_MAIN_HORDE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_States
|
enum BG_AV_States
|
||||||
{
|
{
|
||||||
POINT_ASSAULTED = 0,
|
POINT_ASSAULTED = 0,
|
||||||
|
|
@ -199,18 +223,26 @@ enum BG_AV_States
|
||||||
};
|
};
|
||||||
#define BG_AV_MAX_STATES 2
|
#define BG_AV_MAX_STATES 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_WorldStates
|
enum BG_AV_WorldStates
|
||||||
{
|
{
|
||||||
BG_AV_Alliance_Score = 3127,
|
BG_AV_Alliance_Score = 3127,
|
||||||
BG_AV_Horde_Score = 3128,
|
BG_AV_Horde_Score = 3128,
|
||||||
BG_AV_SHOW_H_SCORE = 3133,
|
BG_AV_SHOW_H_SCORE = 3133,
|
||||||
BG_AV_SHOW_A_SCORE = 3134,
|
BG_AV_SHOW_A_SCORE = 3134,
|
||||||
AV_SNOWFALL_N = 1966,
|
AV_SNOWFALL_N = 1966
|
||||||
};
|
};
|
||||||
|
|
||||||
// special version with more wide values range that PvpTeamIndex
|
/**
|
||||||
// BattleGroundAVTeamIndex <- PvpTeamIndex cast safe
|
* @brief special version with more wide values range that BattleGroundTeamIndex
|
||||||
// BattleGroundAVTeamIndex -> PvpTeamIndex cast safe and array with PVP_TEAM_COUNT elements must checked != BG_AV_TEAM_NEUTRAL before used
|
*
|
||||||
|
* BattleGroundAVTeamIndex <- BattleGroundTeamIndex cast safe
|
||||||
|
* BattleGroundAVTeamIndex -> BattleGroundTeamIndex cast safe and array with BG_TEAMS_COUNT elements must checked != BG_AV_TEAM_NEUTRAL before used
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BattleGroundAVTeamIndex
|
enum BattleGroundAVTeamIndex
|
||||||
{
|
{
|
||||||
BG_AV_TEAM_ALLIANCE = TEAM_INDEX_ALLIANCE,
|
BG_AV_TEAM_ALLIANCE = TEAM_INDEX_ALLIANCE,
|
||||||
|
|
@ -220,15 +252,13 @@ enum BattleGroundAVTeamIndex
|
||||||
|
|
||||||
#define BG_AV_TEAMS_COUNT 3
|
#define BG_AV_TEAMS_COUNT 3
|
||||||
|
|
||||||
// alliance_control horde_control neutral_control
|
const uint32 BG_AV_MineWorldStates[2][BG_AV_TEAMS_COUNT] = /**< alliance_control horde_control neutral_control */
|
||||||
const uint32 BG_AV_MineWorldStates[2][BG_AV_TEAMS_COUNT] =
|
|
||||||
{
|
{
|
||||||
{1358, 1359, 1360},
|
{1358, 1359, 1360},
|
||||||
{1355, 1356, 1357}
|
{1355, 1356, 1357}
|
||||||
};
|
};
|
||||||
|
|
||||||
// alliance_control alliance_assault h_control h_assault
|
const uint32 BG_AV_NodeWorldStates[BG_AV_NODES_MAX][4] = /**< alliance_control alliance_assault h_control h_assault */
|
||||||
const uint32 BG_AV_NodeWorldStates[BG_AV_NODES_MAX][4] =
|
|
||||||
{
|
{
|
||||||
// Stormpike first aid station
|
// Stormpike first aid station
|
||||||
{1326, 1325, 1328, 1327},
|
{1326, 1325, 1328, 1327},
|
||||||
|
|
@ -262,8 +292,11 @@ const uint32 BG_AV_NodeWorldStates[BG_AV_NODES_MAX][4] =
|
||||||
{1387, 1365, 1392, 1382},
|
{1387, 1365, 1392, 1382},
|
||||||
};
|
};
|
||||||
|
|
||||||
// through the armorscap-quest 4 different gravedefender exist
|
|
||||||
#define BG_AV_MAX_GRAVETYPES 4
|
#define BG_AV_MAX_GRAVETYPES 4
|
||||||
|
/**
|
||||||
|
* @brief through the armorscap-quest 4 different gravedefender exist
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_AV_QuestIds
|
enum BG_AV_QuestIds
|
||||||
{
|
{
|
||||||
BG_AV_QUEST_A_SCRAPS1 = 7223, // first quest
|
BG_AV_QUEST_A_SCRAPS1 = 7223, // first quest
|
||||||
|
|
@ -290,26 +323,48 @@ enum BG_AV_QuestIds
|
||||||
BG_AV_QUEST_H_RIDER_TAME = 7001
|
BG_AV_QUEST_H_RIDER_TAME = 7001
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
struct BG_AV_NodeInfo
|
struct BG_AV_NodeInfo
|
||||||
{
|
{
|
||||||
BattleGroundAVTeamIndex TotalOwner;
|
BattleGroundAVTeamIndex TotalOwner; /**< TODO */
|
||||||
BattleGroundAVTeamIndex Owner;
|
BattleGroundAVTeamIndex Owner; /**< TODO */
|
||||||
BattleGroundAVTeamIndex PrevOwner;
|
BattleGroundAVTeamIndex PrevOwner; /**< TODO */
|
||||||
BG_AV_States State;
|
BG_AV_States State; /**< TODO */
|
||||||
BG_AV_States PrevState;
|
BG_AV_States PrevState; /**< TODO */
|
||||||
uint32 Timer;
|
uint32 Timer; /**< TODO */
|
||||||
bool Tower;
|
bool Tower; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param i
|
||||||
|
* @return BG_AV_Nodes &operator
|
||||||
|
*/
|
||||||
inline BG_AV_Nodes& operator++(BG_AV_Nodes& i)
|
inline BG_AV_Nodes& operator++(BG_AV_Nodes& i)
|
||||||
{
|
{
|
||||||
return i = BG_AV_Nodes(i + 1);
|
return i = BG_AV_Nodes(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundAVScore : public BattleGroundScore
|
class BattleGroundAVScore : public BattleGroundScore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), SecondaryObjectives(0) {};
|
BattleGroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), SecondaryObjectives(0) {};
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual ~BattleGroundAVScore() {};
|
virtual ~BattleGroundAVScore() {};
|
||||||
|
|
||||||
uint32 GetAttr1() const { return GraveyardsAssaulted; }
|
uint32 GetAttr1() const { return GraveyardsAssaulted; }
|
||||||
|
|
@ -318,95 +373,284 @@ class BattleGroundAVScore : public BattleGroundScore
|
||||||
uint32 GetAttr4() const { return TowersDefended; }
|
uint32 GetAttr4() const { return TowersDefended; }
|
||||||
uint32 GetAttr5() const { return SecondaryObjectives; }
|
uint32 GetAttr5() const { return SecondaryObjectives; }
|
||||||
|
|
||||||
uint32 GraveyardsAssaulted;
|
uint32 GraveyardsAssaulted; /**< TODO */
|
||||||
uint32 GraveyardsDefended;
|
uint32 GraveyardsDefended; /**< TODO */
|
||||||
uint32 TowersAssaulted;
|
uint32 TowersAssaulted; /**< TODO */
|
||||||
uint32 TowersDefended;
|
uint32 TowersDefended; /**< TODO */
|
||||||
uint32 SecondaryObjectives;
|
uint32 SecondaryObjectives; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundAV : public BattleGround
|
class BattleGroundAV : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundAV();
|
BattleGroundAV();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param diff
|
||||||
|
*/
|
||||||
void Update(uint32 diff) override;
|
void Update(uint32 diff) override;
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/**
|
||||||
|
* @brief inherited from BattlegroundClass
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
*/
|
||||||
virtual void AddPlayer(Player* plr) override;
|
virtual void AddPlayer(Player* plr) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual void StartingEventOpenDoors() override;
|
virtual void StartingEventOpenDoors() override;
|
||||||
// world states
|
/**
|
||||||
|
* @brief world states
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param count
|
||||||
|
*/
|
||||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
|
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param trigger
|
||||||
|
*/
|
||||||
bool HandleAreaTrigger(Player* source, uint32 trigger) override;
|
bool HandleAreaTrigger(Player* source, uint32 trigger) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual void Reset() override;
|
virtual void Reset() override;
|
||||||
|
|
||||||
/*general stuff*/
|
/*general stuff*/
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param teamIdx
|
||||||
|
* @param points
|
||||||
|
*/
|
||||||
void UpdateScore(PvpTeamIndex teamIdx, int32 points);
|
void UpdateScore(PvpTeamIndex teamIdx, int32 points);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param type
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
void UpdatePlayerScore(Player* source, uint32 type, uint32 value) override;
|
void UpdatePlayerScore(Player* source, uint32 type, uint32 value) override;
|
||||||
|
|
||||||
/*handle stuff*/ // these are functions which get called from extern scripts
|
/*handle stuff*/ // these are functions which get called from extern scripts
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param target_obj
|
||||||
|
*/
|
||||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param killer
|
||||||
|
*/
|
||||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param creature
|
||||||
|
* @param killer
|
||||||
|
*/
|
||||||
void HandleKillUnit(Creature* creature, Player* killer) override;
|
void HandleKillUnit(Creature* creature, Player* killer) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param questid
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
void HandleQuestComplete(uint32 questid, Player* player);
|
void HandleQuestComplete(uint32 questid, Player* player);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param GOId
|
||||||
|
* @param team
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool PlayerCanDoMineQuest(int32 GOId, Team team);
|
bool PlayerCanDoMineQuest(int32 GOId, Team team);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param winner
|
||||||
|
*/
|
||||||
void EndBattleGround(Team winner) override;
|
void EndBattleGround(Team winner) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
* @return const WorldSafeLocsEntry
|
||||||
|
*/
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* plr) override;
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* plr) override;
|
||||||
|
|
||||||
static BattleGroundAVTeamIndex GetAVTeamIndexByTeamId(Team team) { return BattleGroundAVTeamIndex(GetTeamIndexByTeamId(team)); }
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return Team
|
||||||
|
*/
|
||||||
virtual Team GetPrematureWinner() override;
|
virtual Team GetPrematureWinner() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
* @return BattleGroundAVTeamIndex
|
||||||
|
*/
|
||||||
|
static BattleGroundAVTeamIndex GetAVTeamIndexByTeamId(Team team) { return BattleGroundAVTeamIndex(GetTeamIndexByTeamId(team)); }
|
||||||
private:
|
private:
|
||||||
/* Nodes occupying */
|
/* Nodes occupying */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node);
|
void EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node);
|
void EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void EventPlayerDestroyedPoint(BG_AV_Nodes node);
|
void EventPlayerDestroyedPoint(BG_AV_Nodes node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param teamIdx
|
||||||
|
*/
|
||||||
void AssaultNode(BG_AV_Nodes node, PvpTeamIndex teamIdx);
|
void AssaultNode(BG_AV_Nodes node, PvpTeamIndex teamIdx);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void DestroyNode(BG_AV_Nodes node);
|
void DestroyNode(BG_AV_Nodes node);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param teamIdx
|
||||||
|
* @param tower
|
||||||
|
*/
|
||||||
void InitNode(BG_AV_Nodes node, BattleGroundAVTeamIndex teamIdx, bool tower);
|
void InitNode(BG_AV_Nodes node, BattleGroundAVTeamIndex teamIdx, bool tower);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param teamIdx
|
||||||
|
*/
|
||||||
void DefendNode(BG_AV_Nodes node, PvpTeamIndex teamIdx);
|
void DefendNode(BG_AV_Nodes node, PvpTeamIndex teamIdx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void PopulateNode(BG_AV_Nodes node);
|
void PopulateNode(BG_AV_Nodes node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @return uint32
|
||||||
|
*/
|
||||||
uint32 GetNodeName(BG_AV_Nodes node) const;
|
uint32 GetNodeName(BG_AV_Nodes node) const;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool IsTower(BG_AV_Nodes node) const { return (node == BG_AV_NODES_ERROR) ? false : m_Nodes[node].Tower; }
|
bool IsTower(BG_AV_Nodes node) const { return (node == BG_AV_NODES_ERROR) ? false : m_Nodes[node].Tower; }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool IsGrave(BG_AV_Nodes node) const { return (node == BG_AV_NODES_ERROR) ? false : !m_Nodes[node].Tower; }
|
bool IsGrave(BG_AV_Nodes node) const { return (node == BG_AV_NODES_ERROR) ? false : !m_Nodes[node].Tower; }
|
||||||
|
|
||||||
/*mine*/
|
/*mine*/
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param mine
|
||||||
|
* @param teamIdx
|
||||||
|
*/
|
||||||
void ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx);
|
void ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx);
|
||||||
|
|
||||||
/*worldstates*/
|
/*worldstates*/
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @param teamIdx
|
||||||
|
* @return uint8
|
||||||
|
*/
|
||||||
uint8 GetWorldStateType(uint8 state, BattleGroundAVTeamIndex teamIdx) const { return teamIdx * BG_AV_MAX_STATES + state; }
|
uint8 GetWorldStateType(uint8 state, BattleGroundAVTeamIndex teamIdx) const { return teamIdx * BG_AV_MAX_STATES + state; }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param mine
|
||||||
|
*/
|
||||||
void SendMineWorldStates(uint32 mine);
|
void SendMineWorldStates(uint32 mine);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
*/
|
||||||
void UpdateNodeWorldState(BG_AV_Nodes node);
|
void UpdateNodeWorldState(BG_AV_Nodes node);
|
||||||
|
|
||||||
/*variables */
|
/*variables */
|
||||||
uint32 m_Team_QuestStatus[PVP_TEAM_COUNT][9]; // [x][y] x=team y=questcounter
|
uint32 m_Team_QuestStatus[PVP_TEAM_COUNT][9]; /**< [x][y] x=team y=questcounter */
|
||||||
|
|
||||||
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX];
|
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]; /**< TODO */
|
||||||
|
|
||||||
// only for worldstates needed
|
// only for worldstates needed
|
||||||
BattleGroundAVTeamIndex m_Mine_Owner[BG_AV_MAX_MINES];
|
BattleGroundAVTeamIndex m_Mine_Owner[BG_AV_MAX_MINES]; /**< TODO */
|
||||||
BattleGroundAVTeamIndex m_Mine_PrevOwner[BG_AV_MAX_MINES];
|
BattleGroundAVTeamIndex m_Mine_PrevOwner[BG_AV_MAX_MINES]; /**< TODO */
|
||||||
int32 m_Mine_Timer[BG_AV_MAX_MINES];
|
int32 m_Mine_Timer[BG_AV_MAX_MINES]; /**< TODO */
|
||||||
uint32 m_Mine_Reclaim_Timer[BG_AV_MAX_MINES];
|
uint32 m_Mine_Reclaim_Timer[BG_AV_MAX_MINES]; /**< TODO */
|
||||||
|
|
||||||
bool m_IsInformedNearLose[PVP_TEAM_COUNT];
|
bool m_IsInformedNearLose[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
|
|
||||||
uint32 m_HonorMapComplete;
|
uint32 m_HonorMapComplete; /**< TODO */
|
||||||
uint32 m_RepTowerDestruction;
|
uint32 m_RepTowerDestruction; /**< TODO */
|
||||||
uint32 m_RepCaptain;
|
uint32 m_RepCaptain; /**< TODO */
|
||||||
uint32 m_RepBoss;
|
uint32 m_RepBoss; /**< TODO */
|
||||||
uint32 m_RepOwnedGrave;
|
uint32 m_RepOwnedGrave; /**< TODO */
|
||||||
uint32 m_RepOwnedMine;
|
uint32 m_RepOwnedMine; /**< TODO */
|
||||||
uint32 m_RepSurviveCaptain;
|
uint32 m_RepSurviveCaptain; /**< TODO */
|
||||||
uint32 m_RepSurviveTower;
|
uint32 m_RepSurviveTower; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recv_data)
|
||||||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
|
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
|
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
if (!pCreature->IsBattleMaster()) // it's not battlemaster
|
if (!pCreature->IsBattleMaster()) // it's not battlemaster
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// Stop the npc if moving
|
// Stop the npc if moving
|
||||||
pCreature->StopMoving();
|
pCreature->StopMoving();
|
||||||
|
|
@ -118,7 +118,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
// get bg instance or bg template if instance not found
|
// get bg instance or bg template if instance not found
|
||||||
BattleGround* bg = NULL;
|
BattleGround* bg = NULL;
|
||||||
if (instanceId)
|
if (instanceId)
|
||||||
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
|
{ bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId); }
|
||||||
|
|
||||||
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||||
{
|
{
|
||||||
|
|
@ -147,17 +147,17 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
// check if already in queue
|
// check if already in queue
|
||||||
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||||
// player is already in this queue
|
// player is already in this queue
|
||||||
return;
|
{ return; }
|
||||||
// check if has free queue slots
|
// check if has free queue slots
|
||||||
if (!_player->HasFreeBattleGroundQueueId())
|
if (!_player->HasFreeBattleGroundQueueId())
|
||||||
return;
|
{ return; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grp = _player->GetGroup();
|
grp = _player->GetGroup();
|
||||||
// no group found, error
|
// no group found, error
|
||||||
if (!grp)
|
if (!grp)
|
||||||
return;
|
{ return; }
|
||||||
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
||||||
return;
|
return;
|
||||||
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||||
|
|
@ -187,10 +187,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
Player* member = itr->getSource();
|
Player* member = itr->getSource();
|
||||||
if (!member)
|
if (!member)
|
||||||
continue; // this should never happen
|
{ continue; } // this should never happen
|
||||||
|
|
||||||
// add to queue
|
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
|
||||||
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
|
|
||||||
|
|
||||||
// send status packet (in queue)
|
// send status packet (in queue)
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -216,14 +215,14 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket& /*recv_data*/)
|
void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
|
||||||
{
|
{
|
||||||
// empty opcode
|
// empty opcode
|
||||||
DEBUG_LOG("WORLD: Received opcode CMSG_BATTLEGROUND_PLAYER_POSITIONS");
|
DEBUG_LOG("WORLD: Received opcode CMSG_BATTLEGROUND_PLAYER_POSITIONS");
|
||||||
|
|
||||||
BattleGround* bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg) // can't be received if player not in battleground
|
if (!bg) // can't be received if player not in battleground
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
Player* flagCarrierA = NULL;
|
Player* flagCarrierA = NULL;
|
||||||
Player* flagCarrierH = NULL;
|
Player* flagCarrierH = NULL;
|
||||||
|
|
@ -282,13 +281,13 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket& /*recv_d
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandlePVPLogDataOpcode(WorldPacket& /*recv_data*/)
|
void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: Received opcode CMSG_PVP_LOG_DATA");
|
DEBUG_LOG("WORLD: Received opcode CMSG_PVP_LOG_DATA");
|
||||||
|
|
||||||
BattleGround* bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// arena finish version will send in BattleGround::EndBattleGround directly
|
// arena finish version will send in BattleGround::EndBattleGround directly
|
||||||
if (bg->isArena())
|
if (bg->isArena())
|
||||||
|
|
@ -381,7 +380,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||||
if (!bg && action == 0)
|
if (!bg && action == 0)
|
||||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
{ bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); }
|
||||||
if (!bg)
|
if (!bg)
|
||||||
{
|
{
|
||||||
sLog.outError("BattlegroundHandler: bg_template not found for instance id %u type id %u.", ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
sLog.outError("BattlegroundHandler: bg_template not found for instance id %u type id %u.", ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||||
|
|
@ -422,7 +421,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
case 1: // port to battleground
|
case 1: // port to battleground
|
||||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||||
return; // cheating?
|
{ return; } // cheating?
|
||||||
|
|
||||||
if (!_player->InBattleGround())
|
if (!_player->InBattleGround())
|
||||||
_player->SetBattleGroundEntryPoint();
|
_player->SetBattleGroundEntryPoint();
|
||||||
|
|
@ -447,7 +446,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
||||||
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
||||||
if (BattleGround* currentBg = _player->GetBattleGround())
|
if (BattleGround* currentBg = _player->GetBattleGround())
|
||||||
currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true);
|
{ currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true); }
|
||||||
|
|
||||||
// set the destination instance id
|
// set the destination instance id
|
||||||
_player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId);
|
_player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId);
|
||||||
|
|
@ -494,15 +493,15 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
|
||||||
if (_player->IsInCombat())
|
if (_player->IsInCombat())
|
||||||
if (BattleGround* bg = _player->GetBattleGround())
|
if (BattleGround* bg = _player->GetBattleGround())
|
||||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
_player->LeaveBattleground();
|
_player->LeaveBattleground();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recv_data*/)
|
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
||||||
{
|
{
|
||||||
// empty opcode
|
// empty opcode
|
||||||
DEBUG_LOG("WORLD: CMSG_BATTLEFIELD_STATUS");
|
DEBUG_LOG("WORLD: Battleground status");
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
// we must update all queues here
|
// we must update all queues here
|
||||||
|
|
@ -511,14 +510,14 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recv_data*/)
|
||||||
{
|
{
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||||
if (!bgQueueTypeId)
|
if (!bgQueueTypeId)
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||||
ArenaType arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
ArenaType arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||||
if (bgTypeId == _player->GetBattleGroundTypeId())
|
if (bgTypeId == _player->GetBattleGroundTypeId())
|
||||||
{
|
{
|
||||||
bg = _player->GetBattleGround();
|
bg = _player->GetBattleGround();
|
||||||
// i cannot check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
|
// i can not check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
|
||||||
// so i must use bg pointer to get that information
|
// so i must use bg pointer to get that information
|
||||||
if (bg && bg->GetArenaType() == arenaType)
|
if (bg && bg->GetArenaType() == arenaType)
|
||||||
{
|
{
|
||||||
|
|
@ -534,12 +533,12 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recv_data*/)
|
||||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||||
GroupQueueInfo ginfo;
|
GroupQueueInfo ginfo;
|
||||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetObjectGuid(), &ginfo))
|
if (!bgQueue.GetPlayerGroupInfoData(_player->GetObjectGuid(), &ginfo))
|
||||||
continue;
|
{ continue; }
|
||||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||||
{
|
{
|
||||||
bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||||
if (!bg)
|
if (!bg)
|
||||||
continue;
|
{ continue; }
|
||||||
uint32 remainingTime = WorldTimer::getMSTimeDiff(WorldTimer::getMSTime(), ginfo.RemoveInviteTime);
|
uint32 remainingTime = WorldTimer::getMSTimeDiff(WorldTimer::getMSTime(), ginfo.RemoveInviteTime);
|
||||||
// send status invited to BattleGround
|
// send status invited to BattleGround
|
||||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, _player, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
|
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, _player, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
|
||||||
|
|
@ -549,7 +548,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recv_data*/)
|
||||||
{
|
{
|
||||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||||
if (!bg)
|
if (!bg)
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
// expected bracket entry
|
// expected bracket entry
|
||||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||||
|
|
@ -570,17 +569,17 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
BattleGround* bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
if (!unit->IsSpiritService()) // it's not spirit service
|
if (!unit->IsSpiritService()) // it's not spirit service
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
|
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
|
||||||
}
|
}
|
||||||
|
|
@ -591,17 +590,17 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
BattleGround* bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
if (!unit->IsSpiritService()) // it's not spirit service
|
if (!unit->IsSpiritService()) // it's not spirit service
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
sScriptMgr.OnGossipHello(GetPlayer(), unit);
|
sScriptMgr.OnGossipHello(GetPlayer(), unit);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ BattleGroundQueue::BattleGroundQueue()
|
||||||
m_SumOfWaitTimes[i][j] = 0;
|
m_SumOfWaitTimes[i][j] = 0;
|
||||||
m_WaitTimeLastPlayer[i][j] = 0;
|
m_WaitTimeLastPlayer[i][j] = 0;
|
||||||
for (uint8 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)
|
for (uint8 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)
|
||||||
m_WaitTimes[i][j][k] = 0;
|
{ m_WaitTimes[i][j][k] = 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ BattleGroundQueue::~BattleGroundQueue()
|
||||||
for (uint8 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
|
for (uint8 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
|
||||||
{
|
{
|
||||||
for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr != m_QueuedGroups[i][j].end(); ++itr)
|
for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr != m_QueuedGroups[i][j].end(); ++itr)
|
||||||
delete(*itr);
|
{ delete(*itr); }
|
||||||
m_QueuedGroups[i][j].clear();
|
m_QueuedGroups[i][j].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +116,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else if (!found && (*itr)->Players.size() >= (*groupToKick)->Players.size())
|
else if (!found && (*itr)->Players.size() >= (*groupToKick)->Players.size())
|
||||||
groupToKick = itr;
|
{ groupToKick = itr; }
|
||||||
}
|
}
|
||||||
// if pool is empty, do nothing
|
// if pool is empty, do nothing
|
||||||
if (GetPlayerCount())
|
if (GetPlayerCount())
|
||||||
|
|
@ -127,7 +127,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
||||||
PlayerCount -= ginfo->Players.size();
|
PlayerCount -= ginfo->Players.size();
|
||||||
// return false if we kicked smaller group or there are enough players in selection pool
|
// return false if we kicked smaller group or there are enough players in selection pool
|
||||||
if (ginfo->Players.size() <= size + 1)
|
if (ginfo->Players.size() <= size + 1)
|
||||||
return false;
|
{ return false; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +147,7 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 de
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (PlayerCount < desiredCount)
|
if (PlayerCount < desiredCount)
|
||||||
return true;
|
{ return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,10 +178,10 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
||||||
// compute index (if group is premade or joined a rated match) to queues
|
// compute index (if group is premade or joined a rated match) to queues
|
||||||
uint32 index = 0;
|
uint32 index = 0;
|
||||||
if (!isRated && !isPremade)
|
if (!isRated && !isPremade)
|
||||||
index += PVP_TEAM_COUNT; // BG_QUEUE_PREMADE_* -> BG_QUEUE_NORMAL_*
|
{ index += PVP_TEAM_COUNT; } // BG_QUEUE_PREMADE_* -> BG_QUEUE_NORMAL_*
|
||||||
|
|
||||||
if (ginfo->GroupTeam == HORDE)
|
if (ginfo->GroupTeam == HORDE)
|
||||||
++index; // BG_QUEUE_*_ALLIANCE -> BG_QUEUE_*_HORDE
|
{ ++index; } // BG_QUEUE_*_ALLIANCE -> BG_QUEUE_*_HORDE
|
||||||
|
|
||||||
DEBUG_LOG("Adding Group to BattleGroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
|
DEBUG_LOG("Adding Group to BattleGroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
||||||
{
|
{
|
||||||
Player* member = itr->getSource();
|
Player* member = itr->getSource();
|
||||||
if (!member)
|
if (!member)
|
||||||
continue; // this should never happen
|
{ continue; } // this should never happen
|
||||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
||||||
pl_info.LastOnlineTime = lastOnlineTime;
|
pl_info.LastOnlineTime = lastOnlineTime;
|
||||||
pl_info.GroupInfo = ginfo;
|
pl_info.GroupInfo = ginfo;
|
||||||
|
|
@ -235,10 +235,10 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
||||||
GroupsQueueType::const_iterator itr;
|
GroupsQueueType::const_iterator itr;
|
||||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
||||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||||
qAlliance += (*itr)->Players.size();
|
{ qAlliance += (*itr)->Players.size(); }
|
||||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
||||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||||
qHorde += (*itr)->Players.size();
|
{ qHorde += (*itr)->Players.size(); }
|
||||||
|
|
||||||
// Show queue status to player only (when joining queue)
|
// Show queue status to player only (when joining queue)
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_QUEUE_ANNOUNCER_JOIN) == 1)
|
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_QUEUE_ANNOUNCER_JOIN) == 1)
|
||||||
|
|
@ -303,10 +303,10 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
||||||
}
|
}
|
||||||
// check if there is enought values(we always add values > 0)
|
// check if there is enought values(we always add values > 0)
|
||||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
|
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
|
||||||
return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME);
|
{ return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME); }
|
||||||
else
|
else
|
||||||
// if there aren't enough values return 0 - not available
|
// if there aren't enough values return 0 - not available
|
||||||
return 0;
|
{ return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove player from queue and from group info, if group info is empty then remove it too
|
// remove player from queue and from group info, if group info is empty then remove it too
|
||||||
|
|
@ -355,7 +355,7 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
||||||
// player can't be in queue without group, but just in case
|
// player can't be in queue without group, but just in case
|
||||||
if (bracket_id == -1)
|
if (bracket_id == -1)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for %s", guid.GetString().c_str());
|
sLog.outError("BattleGroundQueue: ERROR Can not find groupinfo for %s", guid.GetString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DEBUG_LOG("BattleGroundQueue: Removing %s, from bracket_id %u", guid.GetString().c_str(), (uint32)bracket_id);
|
DEBUG_LOG("BattleGroundQueue: Removing %s, from bracket_id %u", guid.GetString().c_str(), (uint32)bracket_id);
|
||||||
|
|
@ -368,14 +368,14 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
||||||
// remove player queue info from group queue info
|
// remove player queue info from group queue info
|
||||||
GroupQueueInfoPlayers::iterator pitr = group->Players.find(guid);
|
GroupQueueInfoPlayers::iterator pitr = group->Players.find(guid);
|
||||||
if (pitr != group->Players.end())
|
if (pitr != group->Players.end())
|
||||||
group->Players.erase(pitr);
|
{ group->Players.erase(pitr); }
|
||||||
|
|
||||||
// if invited to bg, and should decrease invited count, then do it
|
// if invited to bg, and should decrease invited count, then do it
|
||||||
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
|
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
|
||||||
{
|
{
|
||||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
|
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
|
||||||
if (bg)
|
if (bg)
|
||||||
bg->DecreaseInvitedCount(group->GroupTeam);
|
{ bg->DecreaseInvitedCount(group->GroupTeam); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove player queue info
|
// remove player queue info
|
||||||
|
|
@ -445,7 +445,7 @@ bool BattleGroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo*
|
||||||
// ACE_Guard<ACE_Recursive_Thread_Mutex> g(m_Lock);
|
// ACE_Guard<ACE_Recursive_Thread_Mutex> g(m_Lock);
|
||||||
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
|
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
|
||||||
if (qItr == m_QueuedPlayers.end())
|
if (qItr == m_QueuedPlayers.end())
|
||||||
return false;
|
{ return false; }
|
||||||
*ginfo = *(qItr->second.GroupInfo);
|
*ginfo = *(qItr->second.GroupInfo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +454,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
|
||||||
{
|
{
|
||||||
// set side if needed
|
// set side if needed
|
||||||
if (side)
|
if (side)
|
||||||
ginfo->GroupTeam = side;
|
{ ginfo->GroupTeam = side; }
|
||||||
|
|
||||||
if (!ginfo->IsInvitedToBGInstanceGUID)
|
if (!ginfo->IsInvitedToBGInstanceGUID)
|
||||||
{
|
{
|
||||||
|
|
@ -478,7 +478,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
|
||||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
// if offline, skip him, this should not happen - player is removed from queue when he logs out
|
// if offline, skip him, this should not happen - player is removed from queue when he logs out
|
||||||
if (!plr)
|
if (!plr)
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
// invite the player
|
// invite the player
|
||||||
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id);
|
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id);
|
||||||
|
|
@ -530,17 +530,17 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
||||||
// index to queue which group is current
|
// index to queue which group is current
|
||||||
uint32 aliIndex = 0;
|
uint32 aliIndex = 0;
|
||||||
for (; aliIndex < aliCount && m_SelectionPools[TEAM_INDEX_ALLIANCE].AddGroup((*Ali_itr), aliFree); ++aliIndex)
|
for (; aliIndex < aliCount && m_SelectionPools[TEAM_INDEX_ALLIANCE].AddGroup((*Ali_itr), aliFree); ++aliIndex)
|
||||||
++Ali_itr;
|
{ ++Ali_itr; }
|
||||||
// the same thing for horde
|
// the same thing for horde
|
||||||
GroupsQueueType::const_iterator Horde_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].begin();
|
GroupsQueueType::const_iterator Horde_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].begin();
|
||||||
uint32 hordeCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].size();
|
uint32 hordeCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].size();
|
||||||
uint32 hordeIndex = 0;
|
uint32 hordeIndex = 0;
|
||||||
for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_INDEX_HORDE].AddGroup((*Horde_itr), hordeFree); ++hordeIndex)
|
for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_INDEX_HORDE].AddGroup((*Horde_itr), hordeFree); ++hordeIndex)
|
||||||
++Horde_itr;
|
{ ++Horde_itr; }
|
||||||
|
|
||||||
// if ofc like BG queue invitation is set in config, then we are happy
|
// if ofc like BG queue invitation is set in config, then we are happy
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE) == 0)
|
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE) == 0)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if we reached this code, then we have to solve NP - complete problem called Subset sum problem
|
if we reached this code, then we have to solve NP - complete problem called Subset sum problem
|
||||||
|
|
@ -562,13 +562,13 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
||||||
if (m_SelectionPools[TEAM_INDEX_ALLIANCE].KickGroup(diffHorde - diffAli))
|
if (m_SelectionPools[TEAM_INDEX_ALLIANCE].KickGroup(diffHorde - diffAli))
|
||||||
{
|
{
|
||||||
for (; aliIndex < aliCount && m_SelectionPools[TEAM_INDEX_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); ++aliIndex)
|
for (; aliIndex < aliCount && m_SelectionPools[TEAM_INDEX_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); ++aliIndex)
|
||||||
++Ali_itr;
|
{ ++Ali_itr; }
|
||||||
}
|
}
|
||||||
// if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
|
// if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
|
||||||
if (!m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())
|
if (!m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())
|
||||||
{
|
{
|
||||||
if (aliFree <= diffHorde + 1)
|
if (aliFree <= diffHorde + 1)
|
||||||
break;
|
{ break; }
|
||||||
m_SelectionPools[TEAM_INDEX_HORDE].KickGroup(diffHorde - diffAli);
|
m_SelectionPools[TEAM_INDEX_HORDE].KickGroup(diffHorde - diffAli);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -578,12 +578,12 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
||||||
if (m_SelectionPools[TEAM_INDEX_HORDE].KickGroup(diffAli - diffHorde))
|
if (m_SelectionPools[TEAM_INDEX_HORDE].KickGroup(diffAli - diffHorde))
|
||||||
{
|
{
|
||||||
for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_INDEX_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); ++hordeIndex)
|
for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_INDEX_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); ++hordeIndex)
|
||||||
++Horde_itr;
|
{ ++Horde_itr; }
|
||||||
}
|
}
|
||||||
if (!m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount())
|
if (!m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount())
|
||||||
{
|
{
|
||||||
if (hordeFree <= diffAli + 1)
|
if (hordeFree <= diffAli + 1)
|
||||||
break;
|
{ break; }
|
||||||
m_SelectionPools[TEAM_INDEX_ALLIANCE].KickGroup(diffAli - diffHorde);
|
m_SelectionPools[TEAM_INDEX_ALLIANCE].KickGroup(diffAli - diffHorde);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -606,10 +606,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
||||||
GroupsQueueType::const_iterator ali_group, horde_group;
|
GroupsQueueType::const_iterator ali_group, horde_group;
|
||||||
for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||||
if (!(*ali_group)->IsInvitedToBGInstanceGUID)
|
if (!(*ali_group)->IsInvitedToBGInstanceGUID)
|
||||||
break;
|
{ break; }
|
||||||
for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||||
if (!(*horde_group)->IsInvitedToBGInstanceGUID)
|
if (!(*horde_group)->IsInvitedToBGInstanceGUID)
|
||||||
break;
|
{ break; }
|
||||||
|
|
||||||
if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end())
|
if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end())
|
||||||
{
|
{
|
||||||
|
|
@ -624,7 +624,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
||||||
{
|
{
|
||||||
// if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
|
// if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
|
||||||
if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers))
|
if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers))
|
||||||
break;
|
{ break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// premade selection pools are set
|
// premade selection pools are set
|
||||||
|
|
@ -666,16 +666,16 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
|
||||||
{
|
{
|
||||||
m_SelectionPools[i].AddGroup(*(itr_team[i]), maxPlayers);
|
m_SelectionPools[i].AddGroup(*(itr_team[i]), maxPlayers);
|
||||||
if (m_SelectionPools[i].GetPlayerCount() >= minPlayers)
|
if (m_SelectionPools[i].GetPlayerCount() >= minPlayers)
|
||||||
break;
|
{ break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
|
// try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
|
||||||
uint32 j = TEAM_INDEX_ALLIANCE;
|
uint32 j = TEAM_INDEX_ALLIANCE;
|
||||||
if (m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() < m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())
|
if (m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() < m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())
|
||||||
j = TEAM_INDEX_HORDE;
|
{ j = TEAM_INDEX_HORDE; }
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE) != 0
|
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||||
&& m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() >= minPlayers)
|
&& m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() >= minPlayers)
|
||||||
{
|
{
|
||||||
// we will try to invite more groups to team with less players indexed by j
|
// we will try to invite more groups to team with less players indexed by j
|
||||||
++(itr_team[j]); // this will not cause a crash, because for cycle above reached break;
|
++(itr_team[j]); // this will not cause a crash, because for cycle above reached break;
|
||||||
|
|
@ -683,15 +683,15 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
|
||||||
{
|
{
|
||||||
if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
|
if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
|
||||||
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % PVP_TEAM_COUNT].GetPlayerCount()))
|
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % PVP_TEAM_COUNT].GetPlayerCount()))
|
||||||
break;
|
{ break; }
|
||||||
}
|
}
|
||||||
// do not allow to start bg with more than 2 players more on 1 faction
|
// do not allow to start bg with more than 2 players more on 1 faction
|
||||||
if (abs((int32)(m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() - m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())) > 2)
|
if (abs((int32)(m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() - m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())) > 2)
|
||||||
return false;
|
{ return false; }
|
||||||
}
|
}
|
||||||
// allow 1v0 if debug bg
|
// allow 1v0 if debug bg
|
||||||
if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount()))
|
if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount()))
|
||||||
return true;
|
{ return true; }
|
||||||
// return true if there are enough players in selection pools - enable to work .debug bg command correctly
|
// return true if there are enough players in selection pools - enable to work .debug bg command correctly
|
||||||
return m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() >= minPlayers;
|
return m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() >= minPlayers;
|
||||||
}
|
}
|
||||||
|
|
@ -765,10 +765,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
// ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
// ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||||
// if no players in queue - do nothing
|
// if no players in queue - do nothing
|
||||||
if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// battleground with free slot for player should be always in the beggining of the queue
|
// battleground with free slot for player should be always in the beggining of the queue
|
||||||
// maybe it would be better to create bgfreeslotqueue for each bracket_id
|
// maybe it would be better to create bgfreeslotqueue for each bracket_id
|
||||||
|
|
@ -779,7 +779,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
++next;
|
++next;
|
||||||
// DO NOT allow queue manager to invite new player to arena
|
// DO NOT allow queue manager to invite new player to arena
|
||||||
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
|
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
|
||||||
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||||
{
|
{
|
||||||
BattleGround* bg = *itr; // we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
|
BattleGround* bg = *itr; // we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
|
||||||
// and iterator is invalid
|
// and iterator is invalid
|
||||||
|
|
@ -793,9 +793,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
|
|
||||||
// now everything is set, invite players
|
// now everything is set, invite players
|
||||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE].SelectedGroups.end(); ++citr)
|
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE].SelectedGroups.end(); ++citr)
|
||||||
InviteGroupToBG((*citr), bg, (*citr)->GroupTeam);
|
{ InviteGroupToBG((*citr), bg, (*citr)->GroupTeam); }
|
||||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_HORDE].SelectedGroups.end(); ++citr)
|
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_HORDE].SelectedGroups.end(); ++citr)
|
||||||
InviteGroupToBG((*citr), bg, (*citr)->GroupTeam);
|
{ InviteGroupToBG((*citr), bg, (*citr)->GroupTeam); }
|
||||||
|
|
||||||
if (!bg->HasFreeSlots())
|
if (!bg->HasFreeSlots())
|
||||||
{
|
{
|
||||||
|
|
@ -825,7 +825,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
||||||
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
||||||
if (sBattleGroundMgr.isTesting())
|
if (sBattleGroundMgr.isTesting())
|
||||||
MinPlayersPerTeam = 1;
|
{ MinPlayersPerTeam = 1; }
|
||||||
if (bg_template->isArena())
|
if (bg_template->isArena())
|
||||||
{
|
{
|
||||||
if (sBattleGroundMgr.isArenaTesting())
|
if (sBattleGroundMgr.isArenaTesting())
|
||||||
|
|
@ -868,13 +868,13 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
BattleGround* bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, ARENA_TYPE_NONE, false);
|
BattleGround* bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, ARENA_TYPE_NONE, false);
|
||||||
if (!bg2)
|
if (!bg2)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
sLog.outError("BattleGroundQueue::Update - Can not create battleground: %u", bgTypeId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// invite those selection pools
|
// invite those selection pools
|
||||||
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
||||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||||
InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
|
{ InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam); }
|
||||||
// start bg
|
// start bg
|
||||||
bg2->StartBattleGround();
|
bg2->StartBattleGround();
|
||||||
// clear structures
|
// clear structures
|
||||||
|
|
@ -894,14 +894,14 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
BattleGround* bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false);
|
BattleGround* bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false);
|
||||||
if (!bg2)
|
if (!bg2)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
sLog.outError("BattleGroundQueue::Update - Can not create battleground: %u", bgTypeId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// invite those selection pools
|
// invite those selection pools
|
||||||
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
||||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||||
InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
|
{ InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam); }
|
||||||
// start bg
|
// start bg
|
||||||
bg2->StartBattleGround();
|
bg2->StartBattleGround();
|
||||||
}
|
}
|
||||||
|
|
@ -1051,12 +1051,12 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||||
if (!plr)
|
if (!plr)
|
||||||
return true;
|
{ return true; }
|
||||||
|
|
||||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||||
// if battleground ended and its instance deleted - do nothing
|
// if battleground ended and its instance deleted - do nothing
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return true;
|
{ return true; }
|
||||||
|
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||||
|
|
@ -1094,7 +1094,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||||
return true;
|
{ return true; }
|
||||||
|
|
||||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||||
// battleground can be deleted already when we are removing queue info
|
// battleground can be deleted already when we are removing queue info
|
||||||
|
|
@ -1137,9 +1137,7 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
|
||||||
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
|
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
|
||||||
{
|
{
|
||||||
for (uint8 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
for (uint8 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
||||||
{
|
{ m_BattleGrounds[i].clear(); }
|
||||||
m_BattleGrounds[i].clear();
|
|
||||||
}
|
|
||||||
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
|
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
|
||||||
m_Testing = false;
|
m_Testing = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1239,7 +1237,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGro
|
||||||
data->WriteGuidBytes<0, 4>(playerGuid);
|
data->WriteGuidBytes<0, 4>(playerGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATUS_WAIT_QUEUE:
|
case STATUS_WAIT_QUEUE: // status_in_queue
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED);
|
data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED);
|
||||||
|
|
||||||
|
|
@ -1285,7 +1283,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGro
|
||||||
data->WriteGuidBytes<4>(playerGuid);
|
data->WriteGuidBytes<4>(playerGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATUS_WAIT_JOIN:
|
case STATUS_WAIT_JOIN: // status_invite
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_BATTLEFIELD_STATUS_NEEDCONFIRMATION, 44);
|
data->Initialize(SMSG_BATTLEFIELD_STATUS_NEEDCONFIRMATION, 44);
|
||||||
|
|
||||||
|
|
@ -1672,7 +1670,7 @@ BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 insta
|
||||||
// SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
|
// SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
|
||||||
BattleGround* bg = GetBattleGroundTemplate(bgTypeId);
|
BattleGround* bg = GetBattleGroundTemplate(bgTypeId);
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return NULL;
|
{ return NULL; }
|
||||||
|
|
||||||
if (bg->isArena())
|
if (bg->isArena())
|
||||||
return GetBattleGround(instanceId, bgTypeId);
|
return GetBattleGround(instanceId, bgTypeId);
|
||||||
|
|
@ -1680,7 +1678,7 @@ BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 insta
|
||||||
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second->GetClientInstanceID() == instanceId)
|
if (itr->second->GetClientInstanceID() == instanceId)
|
||||||
return itr->second;
|
{ return itr->second; }
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1695,7 +1693,7 @@ BattleGround* BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTy
|
||||||
{
|
{
|
||||||
itr = m_BattleGrounds[i].find(InstanceID);
|
itr = m_BattleGrounds[i].find(InstanceID);
|
||||||
if (itr != m_BattleGrounds[i].end())
|
if (itr != m_BattleGrounds[i].end())
|
||||||
return itr->second;
|
{ return itr->second; }
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1725,7 +1723,7 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
|
||||||
for (ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();)
|
for (ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();)
|
||||||
{
|
{
|
||||||
if ((++lastId) != *itr) // if there is a gap between the ids, we will break..
|
if ((++lastId) != *itr) // if there is a gap between the ids, we will break..
|
||||||
break;
|
{ break; }
|
||||||
lastId = *itr;
|
lastId = *itr;
|
||||||
}
|
}
|
||||||
ids.insert(lastId + 1);
|
ids.insert(lastId + 1);
|
||||||
|
|
@ -1973,7 +1971,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||||
|
|
||||||
// sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
// sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
||||||
if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, bl->minLevel, bl->maxLevel, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, bl->minLevel, bl->maxLevel, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
@ -2062,7 +2060,7 @@ void BattleGroundMgr::DistributeArenaPoints()
|
||||||
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId)
|
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId)
|
||||||
{
|
{
|
||||||
if (!plr)
|
if (!plr)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||||
|
|
||||||
|
|
@ -2119,7 +2117,7 @@ void BattleGroundMgr::SendToBattleGround(Player* pl, uint32 instanceId, BattleGr
|
||||||
float x, y, z, O;
|
float x, y, z, O;
|
||||||
Team team = pl->GetBGTeam();
|
Team team = pl->GetBGTeam();
|
||||||
if (team == 0)
|
if (team == 0)
|
||||||
team = pl->GetTeam();
|
{ team = pl->GetTeam(); }
|
||||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||||
|
|
||||||
DETAIL_LOG("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O);
|
DETAIL_LOG("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O);
|
||||||
|
|
@ -2239,9 +2237,9 @@ void BattleGroundMgr::ToggleTesting()
|
||||||
{
|
{
|
||||||
m_Testing = !m_Testing;
|
m_Testing = !m_Testing;
|
||||||
if (m_Testing)
|
if (m_Testing)
|
||||||
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
|
{ sWorld.SendWorldText(LANG_DEBUG_BG_ON); }
|
||||||
else
|
else
|
||||||
sWorld.SendWorldText(LANG_DEBUG_BG_OFF);
|
{ sWorld.SendWorldText(LANG_DEBUG_BG_OFF); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundMgr::ToggleArenaTesting()
|
void BattleGroundMgr::ToggleArenaTesting()
|
||||||
|
|
@ -2268,7 +2266,7 @@ void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
m_QueueUpdateScheduler.push_back(schedule_id);
|
{ m_QueueUpdateScheduler.push_back(schedule_id); }
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 BattleGroundMgr::GetMaxRatingDifference() const
|
uint32 BattleGroundMgr::GetMaxRatingDifference() const
|
||||||
|
|
@ -2302,9 +2300,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
|
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
|
||||||
|
sLog.outString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2331,8 +2328,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded %u battlemaster entries", count);
|
sLog.outString(">> Loaded %u battlemaster entries", count);
|
||||||
|
sLog.outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
|
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
|
||||||
|
|
@ -2420,9 +2417,8 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
|
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
|
||||||
|
sLog.outString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2433,7 +2429,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
bar.step();
|
bar.step();
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
if (fields[2].GetUInt8() == BG_EVENT_NONE || fields[3].GetUInt8() == BG_EVENT_NONE)
|
if (fields[2].GetUInt8() == BG_EVENT_NONE || fields[3].GetUInt8() == BG_EVENT_NONE)
|
||||||
continue; // we don't need to add those to the eventmap
|
{ continue; } // we don't need to add those to the eventmap
|
||||||
|
|
||||||
bool gameobject = (fields[0].GetUInt8() == 1);
|
bool gameobject = (fields[0].GetUInt8() == 1);
|
||||||
uint32 dbTableGuidLow = fields[1].GetUInt32();
|
uint32 dbTableGuidLow = fields[1].GetUInt32();
|
||||||
|
|
@ -2473,15 +2469,15 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameobject)
|
if (gameobject)
|
||||||
m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events;
|
{ m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events; }
|
||||||
else
|
else
|
||||||
m_CreatureBattleEventIndexMap[dbTableGuidLow] = events;
|
{ m_CreatureBattleEventIndexMap[dbTableGuidLow] = events; }
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded %u battleground eventindexes", count);
|
sLog.outString(">> Loaded %u battleground eventindexes", count);
|
||||||
|
sLog.outString();
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BATTLEGROUNDMGR_H
|
#ifndef MANGOS_H_BATTLEGROUNDMGR
|
||||||
#define __BATTLEGROUNDMGR_H
|
#define MANGOS_H_BATTLEGROUNDMGR
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Policies/Singleton.h"
|
#include "Policies/Singleton.h"
|
||||||
|
|
@ -35,42 +35,77 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef std::map<uint32, BattleGround*> BattleGroundSet;
|
typedef std::map<uint32, BattleGround*> BattleGroundSet;
|
||||||
|
|
||||||
// this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
|
/**
|
||||||
|
* @brief this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef std::list<BattleGround*> BGFreeSlotQueueType;
|
typedef std::list<BattleGround*> BGFreeSlotQueueType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef UNORDERED_MAP<uint32, BattleGroundTypeId> BattleMastersMap;
|
typedef UNORDERED_MAP<uint32, BattleGroundTypeId> BattleMastersMap;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef UNORDERED_MAP<uint32, BattleGroundEventIdx> CreatureBattleEventIndexesMap;
|
typedef UNORDERED_MAP<uint32, BattleGroundEventIdx> CreatureBattleEventIndexesMap;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef UNORDERED_MAP<uint32, BattleGroundEventIdx> GameObjectBattleEventIndexesMap;
|
typedef UNORDERED_MAP<uint32, BattleGroundEventIdx> GameObjectBattleEventIndexesMap;
|
||||||
|
|
||||||
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day
|
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day
|
||||||
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
|
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
|
||||||
|
|
||||||
struct GroupQueueInfo; // type predefinition
|
struct GroupQueueInfo; // type predefinition
|
||||||
struct PlayerQueueInfo // stores information for players in queue
|
/**
|
||||||
|
* @brief stores information for players in queue
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
struct PlayerQueueInfo
|
||||||
{
|
{
|
||||||
uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes
|
uint32 LastOnlineTime; /**< for tracking and removing offline players from queue after 5 minutes */
|
||||||
GroupQueueInfo* GroupInfo; // pointer to the associated groupqueueinfo
|
GroupQueueInfo* GroupInfo; /**< pointer to the associated groupqueueinfo */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef std::map<ObjectGuid, PlayerQueueInfo*> GroupQueueInfoPlayers;
|
typedef std::map<ObjectGuid, PlayerQueueInfo*> GroupQueueInfoPlayers;
|
||||||
|
|
||||||
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
|
/**
|
||||||
|
* @brief stores information about the group in queue (also used when joined as solo!)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
struct GroupQueueInfo
|
||||||
{
|
{
|
||||||
GroupQueueInfoPlayers Players; // player queue info map
|
GroupQueueInfoPlayers Players; /**< player queue info map */
|
||||||
Team GroupTeam; // Player team (ALLIANCE/HORDE)
|
Team GroupTeam; /**< Player team (ALLIANCE/HORDE) */
|
||||||
BattleGroundTypeId BgTypeId; // battleground type id
|
BattleGroundTypeId BgTypeId; /**< battleground type id */
|
||||||
bool IsRated; // rated
|
bool IsRated; // rated
|
||||||
ArenaType arenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
ArenaType arenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
||||||
uint32 ArenaTeamId; // team id if rated match
|
uint32 ArenaTeamId; // team id if rated match
|
||||||
uint32 JoinTime; // time when group was added
|
uint32 JoinTime; /**< time when group was added */
|
||||||
uint32 RemoveInviteTime; // time when we will remove invite for players in group
|
uint32 RemoveInviteTime; /**< time when we will remove invite for players in group */
|
||||||
uint32 IsInvitedToBGInstanceGUID; // was invited to certain BG
|
uint32 IsInvitedToBGInstanceGUID; /**< was invited to certain BG */
|
||||||
uint32 ArenaTeamRating; // if rated match, inited to the rating of the team
|
uint32 ArenaTeamRating; // if rated match, inited to the rating of the team
|
||||||
uint32 OpponentsTeamRating; // for rated arena matches
|
uint32 OpponentsTeamRating; // for rated arena matches
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BattleGroundQueueGroupTypes
|
enum BattleGroundQueueGroupTypes
|
||||||
{
|
{
|
||||||
BG_QUEUE_PREMADE_ALLIANCE = 0,
|
BG_QUEUE_PREMADE_ALLIANCE = 0,
|
||||||
|
|
@ -81,33 +116,99 @@ enum BattleGroundQueueGroupTypes
|
||||||
#define BG_QUEUE_GROUP_TYPES_COUNT 4
|
#define BG_QUEUE_GROUP_TYPES_COUNT 4
|
||||||
|
|
||||||
class BattleGround;
|
class BattleGround;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundQueue
|
class BattleGroundQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundQueue();
|
BattleGroundQueue();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
~BattleGroundQueue();
|
~BattleGroundQueue();
|
||||||
|
|
||||||
void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, ArenaType arenaType = ARENA_TYPE_NONE, bool isRated = false, uint32 minRating = 0);
|
void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, ArenaType arenaType = ARENA_TYPE_NONE, bool isRated = false, uint32 minRating = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bg
|
||||||
|
* @param bracket_id
|
||||||
|
*/
|
||||||
void FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id);
|
void FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bracket_id
|
||||||
|
* @param MinPlayersPerTeam
|
||||||
|
* @param MaxPlayersPerTeam
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||||
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||||
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||||
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param guid
|
||||||
|
* @param decreaseInvitedCount
|
||||||
|
*/
|
||||||
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
|
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param pl_guid
|
||||||
|
* @param bgInstanceGuid
|
||||||
|
* @param removeTime
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param guid
|
||||||
|
* @param ginfo
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param ginfo
|
||||||
|
* @param bracket_id
|
||||||
|
*/
|
||||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
|
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param ginfo
|
||||||
|
* @param bracket_id
|
||||||
|
* @return uint32
|
||||||
|
*/
|
||||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
|
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// mutex that should not allow changing private data, nor allowing to update Queue during private data change.
|
ACE_Recursive_Thread_Mutex m_Lock; /**< mutex that should not allow changing private data, nor allowing to update Queue during private data change. */
|
||||||
ACE_Recursive_Thread_Mutex m_Lock;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap;
|
typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap;
|
||||||
QueuedPlayersMap m_QueuedPlayers;
|
QueuedPlayersMap m_QueuedPlayers; /**< TODO */
|
||||||
|
|
||||||
// we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well
|
/**
|
||||||
|
* @brief we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef std::list<GroupQueueInfo*> GroupsQueueType;
|
typedef std::list<GroupQueueInfo*> GroupsQueueType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -119,35 +220,72 @@ class BattleGroundQueue
|
||||||
BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches
|
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
|
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_GROUP_TYPES_COUNT];
|
GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_GROUP_TYPES_COUNT]; /**< TODO */
|
||||||
|
|
||||||
// class to select and invite groups to bg
|
/**
|
||||||
|
* @brief class to select and invite groups to bg
|
||||||
|
*
|
||||||
|
*/
|
||||||
class SelectionPool
|
class SelectionPool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
SelectionPool() : PlayerCount(0) {}
|
SelectionPool() : PlayerCount(0) {}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void Init();
|
void Init();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param ginfo
|
||||||
|
* @param desiredCount
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param size
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool KickGroup(uint32 size);
|
bool KickGroup(uint32 size);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return uint32
|
||||||
|
*/
|
||||||
uint32 GetPlayerCount() const {return PlayerCount;}
|
uint32 GetPlayerCount() const {return PlayerCount;}
|
||||||
GroupsQueueType SelectedGroups;
|
GroupsQueueType SelectedGroups; /**< TODO */
|
||||||
private:
|
private:
|
||||||
uint32 PlayerCount;
|
uint32 PlayerCount; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
// one selection pool for horde, other one for alliance
|
SelectionPool m_SelectionPools[PVP_TEAM_COUNT]; /**< one selection pool for horde, other one for alliance */
|
||||||
SelectionPool m_SelectionPools[PVP_TEAM_COUNT];
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param ginfo
|
||||||
|
* @param bg
|
||||||
|
* @param side
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg, Team side);
|
bool InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg, Team side);
|
||||||
uint32 m_WaitTimes[PVP_TEAM_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
uint32 m_WaitTimes[PVP_TEAM_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; /**< TODO */
|
||||||
uint32 m_WaitTimeLastPlayer[PVP_TEAM_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
uint32 m_WaitTimeLastPlayer[PVP_TEAM_COUNT][MAX_BATTLEGROUND_BRACKETS]; /**< TODO */
|
||||||
uint32 m_SumOfWaitTimes[PVP_TEAM_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
uint32 m_SumOfWaitTimes[PVP_TEAM_COUNT][MAX_BATTLEGROUND_BRACKETS]; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/**
|
||||||
This class is used to invite player to BG again, when minute lasts from his first invitation
|
* @brief This class is used to invite player to BG again, when minute lasts from his first invitation it is capable to solve all possibilities
|
||||||
it is capable to solve all possibilities
|
*
|
||||||
*/
|
*/
|
||||||
class BGQueueInviteEvent : public BasicEvent
|
class BGQueueInviteEvent : public BasicEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -155,87 +293,247 @@ class BGQueueInviteEvent : public BasicEvent
|
||||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual ~BGQueueInviteEvent() {};
|
virtual ~BGQueueInviteEvent() {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param e_time
|
||||||
|
* @param p_time
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
virtual bool Execute(uint64 e_time, uint32 p_time) override;
|
virtual bool Execute(uint64 e_time, uint32 p_time) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param e_time
|
||||||
|
*/
|
||||||
virtual void Abort(uint64 e_time) override;
|
virtual void Abort(uint64 e_time) override;
|
||||||
private:
|
private:
|
||||||
ObjectGuid m_PlayerGuid;
|
ObjectGuid m_PlayerGuid; /**< TODO */
|
||||||
uint32 m_BgInstanceGUID;
|
uint32 m_BgInstanceGUID; /**< TODO */
|
||||||
BattleGroundTypeId m_BgTypeId;
|
BattleGroundTypeId m_BgTypeId; /**< TODO */
|
||||||
ArenaType m_ArenaType;
|
ArenaType m_ArenaType;
|
||||||
uint32 m_RemoveTime;
|
uint32 m_RemoveTime; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/**
|
||||||
This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation
|
* @brief This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation
|
||||||
We must store removeInvite time in case player left queue and joined and is invited again
|
*
|
||||||
We must store bgQueueTypeId, because battleground can be deleted already, when player entered it
|
* We must store removeInvite time in case player left queue and joined and is invited again
|
||||||
*/
|
* We must store bgQueueTypeId, because battleground can be deleted already, when player entered it
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BGQueueRemoveEvent : public BasicEvent
|
class BGQueueRemoveEvent : public BasicEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param plGuid
|
||||||
|
* @param bgInstanceGUID
|
||||||
|
* @param BgTypeId
|
||||||
|
* @param bgQueueTypeId
|
||||||
|
* @param removeTime
|
||||||
|
*/
|
||||||
BGQueueRemoveEvent(ObjectGuid plGuid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime)
|
BGQueueRemoveEvent(ObjectGuid plGuid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime)
|
||||||
: m_PlayerGuid(plGuid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
|
: m_PlayerGuid(plGuid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual ~BGQueueRemoveEvent() {}
|
virtual ~BGQueueRemoveEvent() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param e_time
|
||||||
|
* @param p_time
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
virtual bool Execute(uint64 e_time, uint32 p_time) override;
|
virtual bool Execute(uint64 e_time, uint32 p_time) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param e_time
|
||||||
|
*/
|
||||||
virtual void Abort(uint64 e_time) override;
|
virtual void Abort(uint64 e_time) override;
|
||||||
private:
|
private:
|
||||||
ObjectGuid m_PlayerGuid;
|
ObjectGuid m_PlayerGuid; /**< TODO */
|
||||||
uint32 m_BgInstanceGUID;
|
uint32 m_BgInstanceGUID; /**< TODO */
|
||||||
uint32 m_RemoveTime;
|
uint32 m_RemoveTime; /**< TODO */
|
||||||
BattleGroundTypeId m_BgTypeId;
|
BattleGroundTypeId m_BgTypeId; /**< TODO */
|
||||||
BattleGroundQueueTypeId m_BgQueueTypeId;
|
BattleGroundQueueTypeId m_BgQueueTypeId; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundMgr
|
class BattleGroundMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/* Construction */
|
/**
|
||||||
|
* @brief Construction
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundMgr();
|
BattleGroundMgr();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
~BattleGroundMgr();
|
~BattleGroundMgr();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param diff
|
||||||
|
*/
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* Packet Building */
|
/* Packet Building */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param plr
|
||||||
|
*/
|
||||||
void BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* plr);
|
void BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* plr);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param guid
|
||||||
|
*/
|
||||||
void BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid);
|
void BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param guid
|
||||||
|
* @param plr
|
||||||
|
* @param bgTypeId
|
||||||
|
*/
|
||||||
void BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId);
|
void BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param field
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param bg
|
||||||
|
*/
|
||||||
void BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg);
|
void BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg);
|
||||||
void BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, Player* player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
void BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, Player* player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
||||||
void BuildBattleGroundStatusFailedPacket(WorldPacket* data, BattleGround* bg, Player* player, uint8 QueueSlot, GroupJoinBattlegroundResult result);
|
void BuildBattleGroundStatusFailedPacket(WorldPacket* data, BattleGround* bg, Player* player, uint8 QueueSlot, GroupJoinBattlegroundResult result);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param soundid
|
||||||
|
*/
|
||||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||||
|
|
||||||
/* Battlegrounds */
|
/* Battlegrounds */
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param instanceId
|
||||||
|
* @param bgTypeId
|
||||||
|
* @return BattleGround
|
||||||
|
*/
|
||||||
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
|
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param InstanceID
|
||||||
|
* @param bgTypeId
|
||||||
|
* @return BattleGround
|
||||||
|
*/
|
||||||
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); // there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
|
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); // there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bgTypeId
|
||||||
|
* @return BattleGround
|
||||||
|
*/
|
||||||
BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
||||||
BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated);
|
BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated);
|
||||||
|
|
||||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param InstanceID
|
||||||
|
* @param bgTypeId
|
||||||
|
* @param BG
|
||||||
|
*/
|
||||||
void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; };
|
void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; };
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param instanceID
|
||||||
|
* @param bgTypeId
|
||||||
|
*/
|
||||||
void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); }
|
void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bgTypeId
|
||||||
|
* @param bracket_id
|
||||||
|
* @return uint32
|
||||||
|
*/
|
||||||
uint32 CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
|
uint32 CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bgTypeId
|
||||||
|
* @param bracket_id
|
||||||
|
* @param clientInstanceID
|
||||||
|
*/
|
||||||
void DeleteClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint32 clientInstanceID)
|
void DeleteClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint32 clientInstanceID)
|
||||||
{
|
{
|
||||||
m_ClientBattleGroundIds[bgTypeId][bracket_id].erase(clientInstanceID);
|
m_ClientBattleGroundIds[bgTypeId][bracket_id].erase(clientInstanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void CreateInitialBattleGrounds();
|
void CreateInitialBattleGrounds();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void DeleteAllBattleGrounds();
|
void DeleteAllBattleGrounds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param pl
|
||||||
|
* @param InstanceID
|
||||||
|
* @param bgTypeId
|
||||||
|
*/
|
||||||
void SendToBattleGround(Player* pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
void SendToBattleGround(Player* pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
||||||
|
|
||||||
/* Battleground queues */
|
/* Battleground queues */
|
||||||
// these queues are instantiated when creating BattlegroundMrg
|
// these queues are instantiated when creating BattlegroundMrg
|
||||||
BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code
|
BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; /**< public, because we need to access them in BG handler code */
|
||||||
|
|
||||||
BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID];
|
BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID]; /**< TODO */
|
||||||
|
|
||||||
void ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
|
void ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
|
||||||
uint32 GetMaxRatingDifference() const;
|
uint32 GetMaxRatingDifference() const;
|
||||||
|
|
@ -245,61 +543,125 @@ class BattleGroundMgr
|
||||||
void InitAutomaticArenaPointDistribution();
|
void InitAutomaticArenaPointDistribution();
|
||||||
// void DistributeArenaPoints(); // there does not appear to be a way to do this in Three
|
// void DistributeArenaPoints(); // there does not appear to be a way to do this in Three
|
||||||
void ToggleArenaTesting();
|
void ToggleArenaTesting();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ToggleTesting();
|
void ToggleTesting();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void LoadBattleMastersEntry();
|
void LoadBattleMastersEntry();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param entry
|
||||||
|
* @return BattleGroundTypeId
|
||||||
|
*/
|
||||||
BattleGroundTypeId GetBattleMasterBG(uint32 entry) const
|
BattleGroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||||
{
|
{
|
||||||
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
||||||
if (itr != mBattleMastersMap.end())
|
if (itr != mBattleMastersMap.end())
|
||||||
return itr->second;
|
{ return itr->second; }
|
||||||
return BATTLEGROUND_TYPE_NONE;
|
return BATTLEGROUND_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void LoadBattleEventIndexes();
|
void LoadBattleEventIndexes();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param dbTableGuidLow
|
||||||
|
* @return const BattleGroundEventIdx
|
||||||
|
*/
|
||||||
const BattleGroundEventIdx GetCreatureEventIndex(uint32 dbTableGuidLow) const
|
const BattleGroundEventIdx GetCreatureEventIndex(uint32 dbTableGuidLow) const
|
||||||
{
|
{
|
||||||
CreatureBattleEventIndexesMap::const_iterator itr = m_CreatureBattleEventIndexMap.find(dbTableGuidLow);
|
CreatureBattleEventIndexesMap::const_iterator itr = m_CreatureBattleEventIndexMap.find(dbTableGuidLow);
|
||||||
if (itr != m_CreatureBattleEventIndexMap.end())
|
if (itr != m_CreatureBattleEventIndexMap.end())
|
||||||
return itr->second;
|
{ return itr->second; }
|
||||||
return m_CreatureBattleEventIndexMap.find(-1)->second;
|
return m_CreatureBattleEventIndexMap.find(-1)->second;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param dbTableGuidLow
|
||||||
|
* @return const BattleGroundEventIdx
|
||||||
|
*/
|
||||||
const BattleGroundEventIdx GetGameObjectEventIndex(uint32 dbTableGuidLow) const
|
const BattleGroundEventIdx GetGameObjectEventIndex(uint32 dbTableGuidLow) const
|
||||||
{
|
{
|
||||||
GameObjectBattleEventIndexesMap::const_iterator itr = m_GameObjectBattleEventIndexMap.find(dbTableGuidLow);
|
GameObjectBattleEventIndexesMap::const_iterator itr = m_GameObjectBattleEventIndexMap.find(dbTableGuidLow);
|
||||||
if (itr != m_GameObjectBattleEventIndexMap.end())
|
if (itr != m_GameObjectBattleEventIndexMap.end())
|
||||||
return itr->second;
|
{ return itr->second; }
|
||||||
return m_GameObjectBattleEventIndexMap.find(-1)->second;
|
return m_GameObjectBattleEventIndexMap.find(-1)->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isArenaTesting() const { return m_ArenaTesting; }
|
bool isArenaTesting() const { return m_ArenaTesting; }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool isTesting() const { return m_Testing; }
|
bool isTesting() const { return m_Testing; }
|
||||||
|
|
||||||
static bool IsArenaType(BattleGroundTypeId bgTypeId);
|
static bool IsArenaType(BattleGroundTypeId bgTypeId);
|
||||||
static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !IsArenaType(bgTypeId); }
|
static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !IsArenaType(bgTypeId); }
|
||||||
static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, ArenaType arenaType);
|
static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, ArenaType arenaType);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bgQueueTypeId
|
||||||
|
* @return BattleGroundTypeId
|
||||||
|
*/
|
||||||
static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId);
|
static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId);
|
||||||
static ArenaType BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
|
static ArenaType BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bgTypeId
|
||||||
|
* @return HolidayIds
|
||||||
|
*/
|
||||||
static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId);
|
static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param holiday
|
||||||
|
* @return BattleGroundTypeId
|
||||||
|
*/
|
||||||
static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param bgTypeId
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
static bool IsBGWeekend(BattleGroundTypeId bgTypeId);
|
static bool IsBGWeekend(BattleGroundTypeId bgTypeId);
|
||||||
private:
|
private:
|
||||||
ACE_Thread_Mutex SchedulerLock;
|
ACE_Thread_Mutex SchedulerLock; /**< TODO */
|
||||||
BattleMastersMap mBattleMastersMap;
|
BattleMastersMap mBattleMastersMap; /**< TODO */
|
||||||
CreatureBattleEventIndexesMap m_CreatureBattleEventIndexMap;
|
CreatureBattleEventIndexesMap m_CreatureBattleEventIndexMap; /**< TODO */
|
||||||
GameObjectBattleEventIndexesMap m_GameObjectBattleEventIndexMap;
|
GameObjectBattleEventIndexesMap m_GameObjectBattleEventIndexMap; /**< TODO */
|
||||||
|
|
||||||
/* Battlegrounds */
|
/* Battlegrounds */
|
||||||
BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID];
|
BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; /**< TODO */
|
||||||
std::vector<uint64> m_QueueUpdateScheduler;
|
std::vector<uint64> m_QueueUpdateScheduler;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef std::set<uint32> ClientBattleGroundIdSet;
|
typedef std::set<uint32> ClientBattleGroundIdSet;
|
||||||
ClientBattleGroundIdSet m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; // the instanceids just visible for the client
|
ClientBattleGroundIdSet m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; /**< the instanceids just visible for the client */
|
||||||
uint32 m_NextRatingDiscardUpdate;
|
uint32 m_NextRatingDiscardUpdate;
|
||||||
time_t m_NextAutoDistributionTime;
|
time_t m_NextAutoDistributionTime;
|
||||||
uint32 m_AutoDistributionTimeChecker;
|
uint32 m_AutoDistributionTimeChecker;
|
||||||
bool m_ArenaTesting;
|
bool m_ArenaTesting;
|
||||||
bool m_Testing;
|
bool m_Testing; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sBattleGroundMgr MaNGOS::Singleton<BattleGroundMgr>::Instance()
|
#define sBattleGroundMgr MaNGOS::Singleton<BattleGroundMgr>::Instance()
|
||||||
|
|
|
||||||
|
|
@ -164,21 +164,21 @@ void BattleGroundWS::RespawnFlag(Team team, bool captured)
|
||||||
void BattleGroundWS::RespawnDroppedFlag(Team team)
|
void BattleGroundWS::RespawnDroppedFlag(Team team)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
RespawnFlag(team, false);
|
RespawnFlag(team, false);
|
||||||
if (team == ALLIANCE)
|
if (team == ALLIANCE)
|
||||||
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
{ SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||||
else
|
else
|
||||||
SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
{ SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||||
|
|
||||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||||
|
|
||||||
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
||||||
if (obj)
|
if (obj)
|
||||||
obj->Delete();
|
{ obj->Delete(); }
|
||||||
else
|
else
|
||||||
sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str());
|
{ sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str()); }
|
||||||
|
|
||||||
ClearDroppedFlagGuid(team);
|
ClearDroppedFlagGuid(team);
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +186,7 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
|
||||||
void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
m_LastCapturedFlagTeam = source->GetTeam();
|
m_LastCapturedFlagTeam = source->GetTeam();
|
||||||
|
|
||||||
|
|
@ -194,28 +194,28 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||||
if (source->GetTeam() == ALLIANCE)
|
if (source->GetTeam() == ALLIANCE)
|
||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedUp())
|
if (!IsHordeFlagPickedUp())
|
||||||
return;
|
{ return; }
|
||||||
ClearHordeFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
ClearHordeFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||||
// horde flag in base (but not respawned yet)
|
// horde flag in base (but not respawned yet)
|
||||||
m_FlagState[TEAM_INDEX_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
m_FlagState[TEAM_INDEX_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||||
// Drop Horde Flag from Player
|
// Drop Horde Flag from Player
|
||||||
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] < BG_WS_MAX_TEAM_SCORE)
|
if (m_TeamScores[TEAM_INDEX_ALLIANCE] < BG_WS_MAX_TEAM_SCORE)
|
||||||
m_TeamScores[TEAM_INDEX_ALLIANCE] += 1;
|
{ m_TeamScores[TEAM_INDEX_ALLIANCE] += 1; }
|
||||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsAllianceFlagPickedUp())
|
if (!IsAllianceFlagPickedUp())
|
||||||
return;
|
{ return; }
|
||||||
ClearAllianceFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
ClearAllianceFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||||
// alliance flag in base (but not respawned yet)
|
// alliance flag in base (but not respawned yet)
|
||||||
m_FlagState[TEAM_INDEX_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
m_FlagState[TEAM_INDEX_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||||
// Drop Alliance Flag from Player
|
// Drop Alliance Flag from Player
|
||||||
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||||
if (m_TeamScores[TEAM_INDEX_HORDE] < BG_WS_MAX_TEAM_SCORE)
|
if (m_TeamScores[TEAM_INDEX_HORDE] < BG_WS_MAX_TEAM_SCORE)
|
||||||
m_TeamScores[TEAM_INDEX_HORDE] += 1;
|
{ m_TeamScores[TEAM_INDEX_HORDE] += 1; }
|
||||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||||
}
|
}
|
||||||
|
|
@ -227,9 +227,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||||
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
|
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
|
||||||
|
|
||||||
if (source->GetTeam() == ALLIANCE)
|
if (source->GetTeam() == ALLIANCE)
|
||||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
|
{ SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); }
|
||||||
else
|
else
|
||||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source);
|
{ SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source); }
|
||||||
|
|
||||||
UpdateFlagState(source->GetTeam(), 1); // flag state none
|
UpdateFlagState(source->GetTeam(), 1); // flag state none
|
||||||
UpdateTeamScore(source->GetTeam());
|
UpdateTeamScore(source->GetTeam());
|
||||||
|
|
@ -238,9 +238,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||||
|
|
||||||
Team winner = TEAM_NONE;
|
Team winner = TEAM_NONE;
|
||||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] == BG_WS_MAX_TEAM_SCORE)
|
if (m_TeamScores[TEAM_INDEX_ALLIANCE] == BG_WS_MAX_TEAM_SCORE)
|
||||||
winner = ALLIANCE;
|
{ winner = ALLIANCE; }
|
||||||
else if (m_TeamScores[TEAM_INDEX_HORDE] == BG_WS_MAX_TEAM_SCORE)
|
else if (m_TeamScores[TEAM_INDEX_HORDE] == BG_WS_MAX_TEAM_SCORE)
|
||||||
winner = HORDE;
|
{ winner = HORDE; }
|
||||||
|
|
||||||
if (winner)
|
if (winner)
|
||||||
{
|
{
|
||||||
|
|
@ -266,7 +266,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
||||||
if (source->GetTeam() == ALLIANCE)
|
if (source->GetTeam() == ALLIANCE)
|
||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedUp())
|
if (!IsHordeFlagPickedUp())
|
||||||
return;
|
{ return; }
|
||||||
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
||||||
{
|
{
|
||||||
ClearHordeFlagCarrier();
|
ClearHordeFlagCarrier();
|
||||||
|
|
@ -276,7 +276,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsAllianceFlagPickedUp())
|
if (!IsAllianceFlagPickedUp())
|
||||||
return;
|
{ return; }
|
||||||
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
||||||
{
|
{
|
||||||
ClearAllianceFlagCarrier();
|
ClearAllianceFlagCarrier();
|
||||||
|
|
@ -291,7 +291,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
||||||
if (source->GetTeam() == ALLIANCE)
|
if (source->GetTeam() == ALLIANCE)
|
||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedUp())
|
if (!IsHordeFlagPickedUp())
|
||||||
return;
|
{ return; }
|
||||||
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
||||||
{
|
{
|
||||||
ClearHordeFlagCarrier();
|
ClearHordeFlagCarrier();
|
||||||
|
|
@ -304,7 +304,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsAllianceFlagPickedUp())
|
if (!IsAllianceFlagPickedUp())
|
||||||
return;
|
{ return; }
|
||||||
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
||||||
{
|
{
|
||||||
ClearAllianceFlagCarrier();
|
ClearAllianceFlagCarrier();
|
||||||
|
|
@ -338,7 +338,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
||||||
void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
int32 message_id = 0;
|
int32 message_id = 0;
|
||||||
ChatMsg type;
|
ChatMsg type;
|
||||||
|
|
@ -347,7 +347,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
|
|
||||||
// alliance flag picked up from base
|
// alliance flag picked up from base
|
||||||
if (source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
if (source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||||
&& event == WS_EVENT_FLAG_A)
|
&& event == WS_EVENT_FLAG_A)
|
||||||
{
|
{
|
||||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||||
|
|
@ -363,7 +363,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
|
|
||||||
// horde flag picked up from base
|
// horde flag picked up from base
|
||||||
if (source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
if (source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
||||||
&& event == WS_EVENT_FLAG_H)
|
&& event == WS_EVENT_FLAG_H)
|
||||||
{
|
{
|
||||||
message_id = LANG_BG_WS_PICKEDUP_HF;
|
message_id = LANG_BG_WS_PICKEDUP_HF;
|
||||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||||
|
|
@ -434,7 +434,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!message_id)
|
if (!message_id)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
SendMessageToAll(message_id, type, source);
|
SendMessageToAll(message_id, type, source);
|
||||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||||
|
|
@ -452,7 +452,7 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||||
RespawnFlag(ALLIANCE, false);
|
RespawnFlag(ALLIANCE, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
EventPlayerDroppedFlag(plr);
|
{ EventPlayerDroppedFlag(plr); }
|
||||||
}
|
}
|
||||||
if (IsHordeFlagPickedUp() && m_flagCarrierHorde == guid)
|
if (IsHordeFlagPickedUp() && m_flagCarrierHorde == guid)
|
||||||
{
|
{
|
||||||
|
|
@ -463,16 +463,16 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||||
RespawnFlag(HORDE, false);
|
RespawnFlag(HORDE, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
EventPlayerDroppedFlag(plr);
|
{ EventPlayerDroppedFlag(plr); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
|
void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
|
||||||
{
|
{
|
||||||
if (team == ALLIANCE)
|
if (team == ALLIANCE)
|
||||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
{ UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value); }
|
||||||
else
|
else
|
||||||
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
|
{ UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::UpdateTeamScore(Team team)
|
void BattleGroundWS::UpdateTeamScore(Team team)
|
||||||
|
|
@ -487,19 +487,19 @@ bool BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
{
|
{
|
||||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
switch (trigger)
|
switch (trigger)
|
||||||
{
|
{
|
||||||
case 3646: // Alliance Flag spawn
|
case 3646: // Alliance Flag spawn
|
||||||
if (m_FlagState[TEAM_INDEX_HORDE] && !m_FlagState[TEAM_INDEX_ALLIANCE])
|
if (m_FlagState[TEAM_INDEX_HORDE] && !m_FlagState[TEAM_INDEX_ALLIANCE])
|
||||||
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
||||||
EventPlayerCapturedFlag(source);
|
{ EventPlayerCapturedFlag(source); }
|
||||||
break;
|
break;
|
||||||
case 3647: // Horde Flag spawn
|
case 3647: // Horde Flag spawn
|
||||||
if (m_FlagState[TEAM_INDEX_ALLIANCE] && !m_FlagState[TEAM_INDEX_HORDE])
|
if (m_FlagState[TEAM_INDEX_ALLIANCE] && !m_FlagState[TEAM_INDEX_HORDE])
|
||||||
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
||||||
EventPlayerCapturedFlag(source);
|
{ EventPlayerCapturedFlag(source); }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -553,7 +553,7 @@ void BattleGroundWS::EndBattleGround(Team winner)
|
||||||
void BattleGroundWS::HandleKillPlayer(Player* player, Player* killer)
|
void BattleGroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
EventPlayerDroppedFlag(player);
|
EventPlayerDroppedFlag(player);
|
||||||
|
|
||||||
|
|
@ -564,7 +564,7 @@ void BattleGroundWS::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
{
|
{
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
if (itr == m_PlayerScores.end()) // player not found
|
if (itr == m_PlayerScores.end()) // player not found
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -590,16 +590,16 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
||||||
if (player->GetTeam() == ALLIANCE)
|
if (player->GetTeam() == ALLIANCE)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); }
|
||||||
else
|
else
|
||||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
|
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); }
|
||||||
else
|
else
|
||||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
|
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -609,30 +609,30 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_HORDE, m_TeamScores[TEAM_INDEX_HORDE]);
|
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_HORDE, m_TeamScores[TEAM_INDEX_HORDE]);
|
||||||
|
|
||||||
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, -1);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, -1); }
|
||||||
else if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
else if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1); }
|
||||||
else
|
else
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0); }
|
||||||
|
|
||||||
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, -1);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, -1); }
|
||||||
else if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
else if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1); }
|
||||||
else
|
else
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0); }
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
|
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
|
||||||
|
|
||||||
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2); }
|
||||||
else
|
else
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1); }
|
||||||
|
|
||||||
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2); }
|
||||||
else
|
else
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1);
|
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); }
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, WORLD_STATE_ADD);
|
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, WORLD_STATE_ADD);
|
||||||
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());
|
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());
|
||||||
|
|
@ -644,9 +644,9 @@ Team BattleGroundWS::GetPrematureWinner()
|
||||||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||||
|
|
||||||
if (hordeScore > allianceScore)
|
if (hordeScore > allianceScore)
|
||||||
return HORDE;
|
{ return HORDE; }
|
||||||
if (allianceScore > hordeScore)
|
if (allianceScore > hordeScore)
|
||||||
return ALLIANCE;
|
{ return ALLIANCE; }
|
||||||
|
|
||||||
// If the values are equal, fall back to number of players on each team
|
// If the values are equal, fall back to number of players on each team
|
||||||
return BattleGround::GetPrematureWinner();
|
return BattleGround::GetPrematureWinner();
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BATTLEGROUNDWS_H
|
#ifndef MANGOS_H_BATTLEGROUNDWS
|
||||||
#define __BATTLEGROUNDWS_H
|
#define MANGOS_H_BATTLEGROUNDWS
|
||||||
|
|
||||||
#include "BattleGround.h"
|
#include "BattleGround.h"
|
||||||
|
|
||||||
|
|
@ -33,6 +33,10 @@
|
||||||
#define BG_WS_TIME_LIMIT (25*MINUTE*IN_MILLISECONDS)
|
#define BG_WS_TIME_LIMIT (25*MINUTE*IN_MILLISECONDS)
|
||||||
#define BG_WS_EVENT_START_BATTLE 8563
|
#define BG_WS_EVENT_START_BATTLE 8563
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_WS_Sound
|
enum BG_WS_Sound
|
||||||
{
|
{
|
||||||
BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173,
|
BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173,
|
||||||
|
|
@ -44,6 +48,10 @@ enum BG_WS_Sound
|
||||||
BG_WS_SOUND_FLAGS_RESPAWNED = 8232
|
BG_WS_SOUND_FLAGS_RESPAWNED = 8232
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_WS_SpellId
|
enum BG_WS_SpellId
|
||||||
{
|
{
|
||||||
BG_WS_SPELL_WARSONG_FLAG = 23333,
|
BG_WS_SPELL_WARSONG_FLAG = 23333,
|
||||||
|
|
@ -52,11 +60,15 @@ enum BG_WS_SpellId
|
||||||
BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336
|
BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_WS_WorldStates
|
enum BG_WS_WorldStates
|
||||||
{
|
{
|
||||||
BG_WS_FLAG_UNK_ALLIANCE = 1545,
|
BG_WS_FLAG_UNK_ALLIANCE = 1545,
|
||||||
BG_WS_FLAG_UNK_HORDE = 1546,
|
BG_WS_FLAG_UNK_HORDE = 1546,
|
||||||
// FLAG_UNK = 1547,
|
// BG_FLAG_UNK = 1547,
|
||||||
BG_WS_FLAG_CAPTURES_ALLIANCE = 1581,
|
BG_WS_FLAG_CAPTURES_ALLIANCE = 1581,
|
||||||
BG_WS_FLAG_CAPTURES_HORDE = 1582,
|
BG_WS_FLAG_CAPTURES_HORDE = 1582,
|
||||||
BG_WS_FLAG_CAPTURES_MAX = 1601,
|
BG_WS_FLAG_CAPTURES_MAX = 1601,
|
||||||
|
|
@ -66,6 +78,10 @@ enum BG_WS_WorldStates
|
||||||
BG_WS_TIME_REMAINING = 4248
|
BG_WS_TIME_REMAINING = 4248
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_WS_FlagState
|
enum BG_WS_FlagState
|
||||||
{
|
{
|
||||||
BG_WS_FLAG_STATE_ON_BASE = 0,
|
BG_WS_FLAG_STATE_ON_BASE = 0,
|
||||||
|
|
@ -74,6 +90,10 @@ enum BG_WS_FlagState
|
||||||
BG_WS_FLAG_STATE_ON_GROUND = 3
|
BG_WS_FLAG_STATE_ON_GROUND = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_WS_Graveyards
|
enum BG_WS_Graveyards
|
||||||
{
|
{
|
||||||
WS_GRAVEYARD_FLAGROOM_ALLIANCE = 769,
|
WS_GRAVEYARD_FLAGROOM_ALLIANCE = 769,
|
||||||
|
|
@ -82,19 +102,35 @@ enum BG_WS_Graveyards
|
||||||
WS_GRAVEYARD_MAIN_HORDE = 772
|
WS_GRAVEYARD_MAIN_HORDE = 772
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundWGScore : public BattleGroundScore
|
class BattleGroundWGScore : public BattleGroundScore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
|
BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual ~BattleGroundWGScore() {};
|
virtual ~BattleGroundWGScore() {};
|
||||||
|
|
||||||
uint32 GetAttr1() const { return FlagCaptures; }
|
uint32 GetAttr1() const { return FlagCaptures; }
|
||||||
uint32 GetAttr2() const { return FlagReturns; }
|
uint32 GetAttr2() const { return FlagReturns; }
|
||||||
|
|
||||||
uint32 FlagCaptures;
|
uint32 FlagCaptures; /**< TODO */
|
||||||
uint32 FlagReturns;
|
uint32 FlagReturns; /**< TODO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum BG_WS_Events
|
enum BG_WS_Events
|
||||||
{
|
{
|
||||||
WS_EVENT_FLAG_A = 0,
|
WS_EVENT_FLAG_A = 0,
|
||||||
|
|
@ -103,71 +139,238 @@ enum BG_WS_Events
|
||||||
WS_EVENT_SPIRITGUIDES_SPAWN = 2
|
WS_EVENT_SPIRITGUIDES_SPAWN = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
class BattleGroundWS : public BattleGround
|
class BattleGroundWS : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Construction */
|
/**
|
||||||
|
* @brief Construction
|
||||||
|
*
|
||||||
|
*/
|
||||||
BattleGroundWS();
|
BattleGroundWS();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param diff
|
||||||
|
*/
|
||||||
void Update(uint32 diff) override;
|
void Update(uint32 diff) override;
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/**
|
||||||
|
* @brief inherited from BattlegroundClass
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
*/
|
||||||
virtual void AddPlayer(Player* plr) override;
|
virtual void AddPlayer(Player* plr) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual void StartingEventOpenDoors() override;
|
virtual void StartingEventOpenDoors() override;
|
||||||
|
|
||||||
/* BG Flags */
|
/**
|
||||||
|
* @brief BG Flags
|
||||||
|
*
|
||||||
|
* @return ObjectGuid
|
||||||
|
*/
|
||||||
ObjectGuid GetAllianceFlagCarrierGuid() const { return m_flagCarrierAlliance; }
|
ObjectGuid GetAllianceFlagCarrierGuid() const { return m_flagCarrierAlliance; }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return ObjectGuid
|
||||||
|
*/
|
||||||
ObjectGuid GetHordeFlagCarrierGuid() const { return m_flagCarrierHorde; }
|
ObjectGuid GetHordeFlagCarrierGuid() const { return m_flagCarrierHorde; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param guid
|
||||||
|
*/
|
||||||
void SetAllianceFlagCarrier(ObjectGuid guid) { m_flagCarrierAlliance = guid; }
|
void SetAllianceFlagCarrier(ObjectGuid guid) { m_flagCarrierAlliance = guid; }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param guid
|
||||||
|
*/
|
||||||
void SetHordeFlagCarrier(ObjectGuid guid) { m_flagCarrierHorde = guid; }
|
void SetHordeFlagCarrier(ObjectGuid guid) { m_flagCarrierHorde = guid; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ClearAllianceFlagCarrier() { m_flagCarrierAlliance.Clear(); }
|
void ClearAllianceFlagCarrier() { m_flagCarrierAlliance.Clear(); }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ClearHordeFlagCarrier() { m_flagCarrierHorde.Clear(); }
|
void ClearHordeFlagCarrier() { m_flagCarrierHorde.Clear(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool IsAllianceFlagPickedUp() const { return !m_flagCarrierAlliance.IsEmpty(); }
|
bool IsAllianceFlagPickedUp() const { return !m_flagCarrierAlliance.IsEmpty(); }
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool IsHordeFlagPickedUp() const { return !m_flagCarrierHorde.IsEmpty(); }
|
bool IsHordeFlagPickedUp() const { return !m_flagCarrierHorde.IsEmpty(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
* @param captured
|
||||||
|
*/
|
||||||
void RespawnFlag(Team team, bool captured);
|
void RespawnFlag(Team team, bool captured);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
*/
|
||||||
void RespawnDroppedFlag(Team team);
|
void RespawnDroppedFlag(Team team);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
* @return uint8
|
||||||
|
*/
|
||||||
uint8 GetFlagState(Team team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
|
uint8 GetFlagState(Team team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
|
||||||
|
|
||||||
/* Battleground Events */
|
/**
|
||||||
|
* @brief Battleground Events
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
*/
|
||||||
virtual void EventPlayerDroppedFlag(Player* source) override;
|
virtual void EventPlayerDroppedFlag(Player* source) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param target_obj
|
||||||
|
*/
|
||||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
*/
|
||||||
virtual void EventPlayerCapturedFlag(Player* source) override;
|
virtual void EventPlayerCapturedFlag(Player* source) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
* @param guid
|
||||||
|
*/
|
||||||
void RemovePlayer(Player* plr, ObjectGuid guid) override;
|
void RemovePlayer(Player* plr, ObjectGuid guid) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param trigger
|
||||||
|
*/
|
||||||
bool HandleAreaTrigger(Player* source, uint32 trigger) override;
|
bool HandleAreaTrigger(Player* source, uint32 trigger) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param killer
|
||||||
|
*/
|
||||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual void Reset() override;
|
virtual void Reset() override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param winner
|
||||||
|
*/
|
||||||
void EndBattleGround(Team winner) override;
|
void EndBattleGround(Team winner) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @return const WorldSafeLocsEntry
|
||||||
|
*/
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override;
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override;
|
||||||
uint32 GetRemainingTimeInMinutes() { return m_EndTimer ? (m_EndTimer - 1) / (MINUTE * IN_MILLISECONDS) + 1 : 0; }
|
uint32 GetRemainingTimeInMinutes() { return m_EndTimer ? (m_EndTimer - 1) / (MINUTE * IN_MILLISECONDS) + 1 : 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
void UpdateFlagState(Team team, uint32 value);
|
void UpdateFlagState(Team team, uint32 value);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
*/
|
||||||
void UpdateTeamScore(Team team);
|
void UpdateTeamScore(Team team);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* @param type
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
void UpdatePlayerScore(Player* source, uint32 type, uint32 value) override;
|
void UpdatePlayerScore(Player* source, uint32 type, uint32 value) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param guid
|
||||||
|
* @param team
|
||||||
|
*/
|
||||||
void SetDroppedFlagGuid(ObjectGuid guid, Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)] = guid;}
|
void SetDroppedFlagGuid(ObjectGuid guid, Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)] = guid;}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
*/
|
||||||
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
|
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param team
|
||||||
|
* @return const ObjectGuid
|
||||||
|
*/
|
||||||
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
|
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param count
|
||||||
|
*/
|
||||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
|
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual Team GetPrematureWinner() override;
|
virtual Team GetPrematureWinner() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectGuid m_flagCarrierAlliance;
|
ObjectGuid m_flagCarrierAlliance; /**< TODO */
|
||||||
ObjectGuid m_flagCarrierHorde;
|
ObjectGuid m_flagCarrierHorde; /**< TODO */
|
||||||
|
|
||||||
ObjectGuid m_DroppedFlagGuid[PVP_TEAM_COUNT];
|
ObjectGuid m_DroppedFlagGuid[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
uint8 m_FlagState[PVP_TEAM_COUNT];
|
uint8 m_FlagState[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
int32 m_FlagsTimer[PVP_TEAM_COUNT];
|
int32 m_FlagsTimer[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
int32 m_FlagsDropTimer[PVP_TEAM_COUNT];
|
int32 m_FlagsDropTimer[PVP_TEAM_COUNT]; /**< TODO */
|
||||||
|
|
||||||
uint32 m_ReputationCapture;
|
uint32 m_ReputationCapture; /**< TODO */
|
||||||
uint32 m_HonorWinKills;
|
uint32 m_HonorWinKills; /**< TODO */
|
||||||
uint32 m_HonorEndKills;
|
uint32 m_HonorEndKills; /**< TODO */
|
||||||
uint32 m_EndTimer;
|
uint32 m_EndTimer;
|
||||||
Team m_LastCapturedFlagTeam;
|
Team m_LastCapturedFlagTeam;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,8 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
||||||
Player* player = itr->second;
|
Player* player = itr->second;
|
||||||
AccountTypes security = player->GetSession()->GetSecurity();
|
AccountTypes security = player->GetSession()->GetSecurity();
|
||||||
if ((player->isGameMaster() || (security > SEC_PLAYER && security <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
|
if ((player->isGameMaster() || (security > SEC_PLAYER && security <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
|
||||||
(!m_session || player->IsVisibleGloballyFor(m_session->GetPlayer())))
|
(!m_session || player->IsVisibleGloballyFor(m_session->GetPlayer())))
|
||||||
names.push_back(std::make_pair<std::string, bool>(GetNameLink(player), player->isAcceptWhispers()));
|
{ names.push_back(std::make_pair<std::string, bool>(GetNameLink(player), player->isAcceptWhispers())); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,10 +190,10 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
||||||
char const* accepts = GetMangosString(LANG_GM_ACCEPTS_WHISPER);
|
char const* accepts = GetMangosString(LANG_GM_ACCEPTS_WHISPER);
|
||||||
char const* not_accept = GetMangosString(LANG_GM_NO_WHISPER);
|
char const* not_accept = GetMangosString(LANG_GM_NO_WHISPER);
|
||||||
for (std::list<std::pair< std::string, bool> >::const_iterator iter = names.begin(); iter != names.end(); ++iter)
|
for (std::list<std::pair< std::string, bool> >::const_iterator iter = names.begin(); iter != names.end(); ++iter)
|
||||||
PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept);
|
{ PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SendSysMessage(LANG_GMS_NOT_LOGGED);
|
{ SendSysMessage(LANG_GMS_NOT_LOGGED); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -41,28 +41,28 @@
|
||||||
bool ChatHandler::HandleDebugSendSpellFailCommand(char* args)
|
bool ChatHandler::HandleDebugSendSpellFailCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 failnum;
|
uint32 failnum;
|
||||||
if (!ExtractUInt32(&args, failnum) || failnum > 255)
|
if (!ExtractUInt32(&args, failnum) || failnum > 255)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 failarg1;
|
uint32 failarg1;
|
||||||
if (!ExtractOptUInt32(&args, failarg1, 0))
|
if (!ExtractOptUInt32(&args, failarg1, 0))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 failarg2;
|
uint32 failarg2;
|
||||||
if (!ExtractOptUInt32(&args, failarg2, 0))
|
if (!ExtractOptUInt32(&args, failarg2, 0))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
WorldPacket data(SMSG_CAST_FAILED, 5);
|
WorldPacket data(SMSG_CAST_FAILED, 5);
|
||||||
data << uint8(0);
|
data << uint8(0);
|
||||||
data << uint32(133);
|
data << uint32(133);
|
||||||
data << uint8(failnum);
|
data << uint8(failnum);
|
||||||
if (failarg1 || failarg2)
|
if (failarg1 || failarg2)
|
||||||
data << uint32(failarg1);
|
{ data << uint32(failarg1); }
|
||||||
if (failarg2)
|
if (failarg2)
|
||||||
data << uint32(failarg2);
|
{ data << uint32(failarg2); }
|
||||||
|
|
||||||
m_session->SendPacket(&data);
|
m_session->SendPacket(&data);
|
||||||
|
|
||||||
|
|
@ -81,11 +81,11 @@ bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
||||||
|
|
||||||
uint32 icon;
|
uint32 icon;
|
||||||
if (!ExtractUInt32(&args, icon))
|
if (!ExtractUInt32(&args, icon))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
if (!ExtractUInt32(&args, flags))
|
if (!ExtractUInt32(&args, flags))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
DETAIL_LOG("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon, flags);
|
DETAIL_LOG("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon, flags);
|
||||||
pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
|
pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
|
||||||
|
|
@ -95,7 +95,7 @@ bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
||||||
bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args)
|
bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint8 msg = atoi(args);
|
uint8 msg = atoi(args);
|
||||||
m_session->GetPlayer()->SendEquipError(InventoryResult(msg), NULL, NULL);
|
m_session->GetPlayer()->SendEquipError(InventoryResult(msg), NULL, NULL);
|
||||||
|
|
@ -105,7 +105,7 @@ bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args)
|
||||||
bool ChatHandler::HandleDebugSendSellErrorCommand(char* args)
|
bool ChatHandler::HandleDebugSendSellErrorCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint8 msg = atoi(args);
|
uint8 msg = atoi(args);
|
||||||
m_session->GetPlayer()->SendSellError(SellResult(msg), 0, ObjectGuid(), 0);
|
m_session->GetPlayer()->SendSellError(SellResult(msg), 0, ObjectGuid(), 0);
|
||||||
|
|
@ -115,7 +115,7 @@ bool ChatHandler::HandleDebugSendSellErrorCommand(char* args)
|
||||||
bool ChatHandler::HandleDebugSendBuyErrorCommand(char* args)
|
bool ChatHandler::HandleDebugSendBuyErrorCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint8 msg = atoi(args);
|
uint8 msg = atoi(args);
|
||||||
m_session->GetPlayer()->SendBuyError(BuyResult(msg), 0, 0, 0);
|
m_session->GetPlayer()->SendBuyError(BuyResult(msg), 0, 0, 0);
|
||||||
|
|
@ -126,11 +126,11 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
Unit* unit = getSelectedUnit();
|
Unit* unit = getSelectedUnit();
|
||||||
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
||||||
unit = m_session->GetPlayer();
|
{ unit = m_session->GetPlayer(); }
|
||||||
|
|
||||||
std::ifstream stream("opcode.txt");
|
std::ifstream stream("opcode.txt");
|
||||||
if (!stream.is_open())
|
if (!stream.is_open())
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 opcode = 0;
|
uint32 opcode = 0;
|
||||||
if (!(stream >> opcode))
|
if (!(stream >> opcode))
|
||||||
|
|
@ -145,7 +145,7 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
||||||
while (stream >> type)
|
while (stream >> type)
|
||||||
{
|
{
|
||||||
if (type.empty())
|
if (type.empty())
|
||||||
break;
|
{ break; }
|
||||||
|
|
||||||
if (type == "uint8")
|
if (type == "uint8")
|
||||||
{
|
{
|
||||||
|
|
@ -209,11 +209,11 @@ bool ChatHandler::HandleDebugUpdateWorldStateCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 world;
|
uint32 world;
|
||||||
if (!ExtractUInt32(&args, world))
|
if (!ExtractUInt32(&args, world))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 state;
|
uint32 state;
|
||||||
if (!ExtractUInt32(&args, state))
|
if (!ExtractUInt32(&args, state))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
m_session->GetPlayer()->SendUpdateWorldState(world, state);
|
m_session->GetPlayer()->SendUpdateWorldState(world, state);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -225,7 +225,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args)
|
||||||
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
|
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
|
||||||
uint32 dwId;
|
uint32 dwId;
|
||||||
if (!ExtractUInt32(&args, dwId))
|
if (!ExtractUInt32(&args, dwId))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (!sCinematicSequencesStore.LookupEntry(dwId))
|
if (!sCinematicSequencesStore.LookupEntry(dwId))
|
||||||
{
|
{
|
||||||
|
|
@ -264,7 +264,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
||||||
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
||||||
uint32 dwSoundId;
|
uint32 dwSoundId;
|
||||||
if (!ExtractUInt32(&args, dwSoundId))
|
if (!ExtractUInt32(&args, dwSoundId))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
|
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||||
{
|
{
|
||||||
|
|
@ -282,9 +282,9 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_session->GetPlayer()->GetSelectionGuid())
|
if (m_session->GetPlayer()->GetSelectionGuid())
|
||||||
unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer());
|
{ unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer()); }
|
||||||
else
|
else
|
||||||
unit->PlayDirectSound(dwSoundId, m_session->GetPlayer());
|
{ unit->PlayDirectSound(dwSoundId, m_session->GetPlayer()); }
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
|
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -297,7 +297,7 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args)
|
||||||
|
|
||||||
uint32 code;
|
uint32 code;
|
||||||
if (!ExtractUInt32(&args, code) || code > 255)
|
if (!ExtractUInt32(&args, code) || code > 255)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
|
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
|
||||||
data << uint8(code); // notify type
|
data << uint8(code); // notify type
|
||||||
|
|
@ -315,7 +315,7 @@ bool ChatHandler::HandleDebugSendChatMsgCommand(char* args)
|
||||||
|
|
||||||
uint32 type;
|
uint32 type;
|
||||||
if (!ExtractUInt32(&args, type) || type > 255)
|
if (!ExtractUInt32(&args, type) || type > 255)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), msg, LANG_UNIVERSAL, CHAT_TAG_NONE, m_session->GetPlayer()->GetObjectGuid(), m_session->GetPlayerName());
|
ChatHandler::BuildChatPacket(data, ChatMsg(type), msg, LANG_UNIVERSAL, CHAT_TAG_NONE, m_session->GetPlayer()->GetObjectGuid(), m_session->GetPlayerName());
|
||||||
|
|
@ -327,7 +327,7 @@ bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 msg;
|
uint32 msg;
|
||||||
if (!ExtractUInt32(&args, msg))
|
if (!ExtractUInt32(&args, msg))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
|
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -337,17 +337,17 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
Creature* target = getSelectedCreature();
|
Creature* target = getSelectedCreature();
|
||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (!target->HasLootRecipient())
|
if (!target->HasLootRecipient())
|
||||||
SendSysMessage("loot recipient: no loot recipient");
|
{ SendSysMessage("loot recipient: no loot recipient"); }
|
||||||
else if (Player* recipient = target->GetLootRecipient())
|
else if (Player* recipient = target->GetLootRecipient())
|
||||||
PSendSysMessage("loot recipient: %s with raw data %s from group %u",
|
PSendSysMessage("loot recipient: %s with raw data %s from group %u",
|
||||||
recipient->GetGuidStr().c_str(),
|
recipient->GetGuidStr().c_str(),
|
||||||
target->GetLootRecipientGuid().GetString().c_str(),
|
target->GetLootRecipientGuid().GetString().c_str(),
|
||||||
target->GetLootGroupRecipientId());
|
target->GetLootGroupRecipientId());
|
||||||
else
|
else
|
||||||
SendSysMessage("loot recipient: offline ");
|
{ SendSysMessage("loot recipient: offline "); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -362,7 +362,7 @@ bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(char* args)
|
||||||
bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
ItemUpdateState state = ITEM_UNCHANGED;
|
ItemUpdateState state = ITEM_UNCHANGED;
|
||||||
bool list_queue = false, check_all = false;
|
bool list_queue = false, check_all = false;
|
||||||
|
|
@ -390,14 +390,14 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
state_str = "removed";
|
state_str = "removed";
|
||||||
}
|
}
|
||||||
else if (strncmp(args, "queue", strlen(args)) == 0)
|
else if (strncmp(args, "queue", strlen(args)) == 0)
|
||||||
list_queue = true;
|
{ list_queue = true; }
|
||||||
else if (strncmp(args, "all", strlen(args)) == 0)
|
else if (strncmp(args, "all", strlen(args)) == 0)
|
||||||
check_all = true;
|
{ check_all = true; }
|
||||||
else
|
else
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Player* player = getSelectedPlayer();
|
Player* player = getSelectedPlayer();
|
||||||
if (!player) player = m_session->GetPlayer();
|
if (!player) { player = m_session->GetPlayer(); }
|
||||||
|
|
||||||
if (!list_queue && !check_all)
|
if (!list_queue && !check_all)
|
||||||
{
|
{
|
||||||
|
|
@ -406,10 +406,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
||||||
{
|
{
|
||||||
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
|
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||||
if (!item) continue;
|
if (!item) { continue; }
|
||||||
if (!item->IsBag())
|
if (!item->IsBag())
|
||||||
{
|
{
|
||||||
if (item->GetState() == state)
|
if (item->GetState() == state)
|
||||||
|
|
@ -433,11 +433,11 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
|
|
||||||
if (list_queue)
|
if (list_queue)
|
||||||
{
|
{
|
||||||
std::vector<Item*> &updateQueue = player->GetItemUpdateQueue();
|
std::vector<Item*>& updateQueue = player->GetItemUpdateQueue();
|
||||||
for (size_t i = 0; i < updateQueue.size(); ++i)
|
for (size_t i = 0; i < updateQueue.size(); ++i)
|
||||||
{
|
{
|
||||||
Item* item = updateQueue[i];
|
Item* item = updateQueue[i];
|
||||||
if (!item) continue;
|
if (!item) { continue; }
|
||||||
|
|
||||||
Bag* container = item->GetContainer();
|
Bag* container = item->GetContainer();
|
||||||
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
|
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
|
||||||
|
|
@ -455,20 +455,20 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
item->GetGuidStr().c_str(), bag_slot, item->GetSlot(), st.c_str());
|
item->GetGuidStr().c_str(), bag_slot, item->GetSlot(), st.c_str());
|
||||||
}
|
}
|
||||||
if (updateQueue.empty())
|
if (updateQueue.empty())
|
||||||
PSendSysMessage("updatequeue empty");
|
{ PSendSysMessage("updatequeue empty"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_all)
|
if (check_all)
|
||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
std::vector<Item*> &updateQueue = player->GetItemUpdateQueue();
|
std::vector<Item*>& updateQueue = player->GetItemUpdateQueue();
|
||||||
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
||||||
{
|
{
|
||||||
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
|
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||||
if (!item) continue;
|
if (!item) { continue; }
|
||||||
|
|
||||||
if (item->GetSlot() != i)
|
if (item->GetSlot() != i)
|
||||||
{
|
{
|
||||||
|
|
@ -531,7 +531,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
|
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
|
||||||
{
|
{
|
||||||
Item* item2 = bag->GetItemByPos(j);
|
Item* item2 = bag->GetItemByPos(j);
|
||||||
if (!item2) continue;
|
if (!item2) { continue; }
|
||||||
|
|
||||||
if (item2->GetSlot() != j)
|
if (item2->GetSlot() != j)
|
||||||
{
|
{
|
||||||
|
|
@ -602,7 +602,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
for (size_t i = 0; i < updateQueue.size(); ++i)
|
for (size_t i = 0; i < updateQueue.size(); ++i)
|
||||||
{
|
{
|
||||||
Item* item = updateQueue[i];
|
Item* item = updateQueue[i];
|
||||||
if (!item) continue;
|
if (!item) { continue; }
|
||||||
|
|
||||||
if (item->GetOwnerGuid() != player->GetObjectGuid())
|
if (item->GetOwnerGuid() != player->GetObjectGuid())
|
||||||
{
|
{
|
||||||
|
|
@ -619,7 +619,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
error = true; continue;
|
error = true; continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetState() == ITEM_REMOVED) continue;
|
if (item->GetState() == ITEM_REMOVED) { continue; }
|
||||||
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
||||||
|
|
||||||
if (test == NULL)
|
if (test == NULL)
|
||||||
|
|
@ -638,7 +638,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!error)
|
if (!error)
|
||||||
SendSysMessage("All OK!");
|
{ SendSysMessage("All OK!"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -702,7 +702,7 @@ bool ChatHandler::HandleDebugAnimCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 emote_id;
|
uint32 emote_id;
|
||||||
if (!ExtractUInt32(&args, emote_id))
|
if (!ExtractUInt32(&args, emote_id))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
m_session->GetPlayer()->HandleEmoteCommand(emote_id);
|
m_session->GetPlayer()->HandleEmoteCommand(emote_id);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -712,7 +712,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
||||||
{
|
{
|
||||||
int32 state;
|
int32 state;
|
||||||
if (!ExtractInt32(&args, state))
|
if (!ExtractInt32(&args, state))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Unit* unit = getSelectedUnit();
|
Unit* unit = getSelectedUnit();
|
||||||
if (!unit)
|
if (!unit)
|
||||||
|
|
@ -726,7 +726,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
||||||
{
|
{
|
||||||
// reset all states
|
// reset all states
|
||||||
for (int i = 1; i <= 32; ++i)
|
for (int i = 1; i <= 32; ++i)
|
||||||
unit->ModifyAuraState(AuraState(i), false);
|
{ unit->ModifyAuraState(AuraState(i), false); }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -747,23 +747,23 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
|
||||||
|
|
||||||
uint32 base; // 0 -> float
|
uint32 base; // 0 -> float
|
||||||
if (!typeStr)
|
if (!typeStr)
|
||||||
base = 10;
|
{ base = 10; }
|
||||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||||
base = 10;
|
{ base = 10; }
|
||||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||||
base = 16;
|
{ base = 16; }
|
||||||
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
||||||
base = 2;
|
{ base = 2; }
|
||||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||||
base = 0;
|
{ base = 0; }
|
||||||
else
|
else
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (base)
|
if (base)
|
||||||
{
|
{
|
||||||
uint32 iValue;
|
uint32 iValue;
|
||||||
if (!ExtractUInt32Base(&valStr, iValue, base))
|
if (!ExtractUInt32Base(&valStr, iValue, base))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
DEBUG_LOG(GetMangosString(LANG_SET_UINT), guid.GetString().c_str(), field, iValue);
|
DEBUG_LOG(GetMangosString(LANG_SET_UINT), guid.GetString().c_str(), field, iValue);
|
||||||
target->SetUInt32Value(field , iValue);
|
target->SetUInt32Value(field , iValue);
|
||||||
|
|
@ -773,7 +773,7 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
|
||||||
{
|
{
|
||||||
float fValue;
|
float fValue;
|
||||||
if (!ExtractFloat(&valStr, fValue))
|
if (!ExtractFloat(&valStr, fValue))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
DEBUG_LOG(GetMangosString(LANG_SET_FLOAT), guid.GetString().c_str(), field, fValue);
|
DEBUG_LOG(GetMangosString(LANG_SET_FLOAT), guid.GetString().c_str(), field, fValue);
|
||||||
target->SetFloatValue(field , fValue);
|
target->SetFloatValue(field , fValue);
|
||||||
|
|
@ -787,23 +787,23 @@ bool ChatHandler::HandleDebugSetItemValueCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 guid;
|
uint32 guid;
|
||||||
if (!ExtractUInt32(&args, guid))
|
if (!ExtractUInt32(&args, guid))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 field;
|
uint32 field;
|
||||||
if (!ExtractUInt32(&args, field))
|
if (!ExtractUInt32(&args, field))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* typeStr = ExtractOptNotLastArg(&args);
|
char* typeStr = ExtractOptNotLastArg(&args);
|
||||||
if (!typeStr)
|
if (!typeStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* valStr = ExtractLiteralArg(&args);
|
char* valStr = ExtractLiteralArg(&args);
|
||||||
if (!valStr)
|
if (!valStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||||
if (!item)
|
if (!item)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
return HandleSetValueHelper(item, field, typeStr, valStr);
|
return HandleSetValueHelper(item, field, typeStr, valStr);
|
||||||
}
|
}
|
||||||
|
|
@ -820,15 +820,15 @@ bool ChatHandler::HandleDebugSetValueCommand(char* args)
|
||||||
|
|
||||||
uint32 field;
|
uint32 field;
|
||||||
if (!ExtractUInt32(&args, field))
|
if (!ExtractUInt32(&args, field))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* typeStr = ExtractOptNotLastArg(&args);
|
char* typeStr = ExtractOptNotLastArg(&args);
|
||||||
if (!typeStr)
|
if (!typeStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* valStr = ExtractLiteralArg(&args);
|
char* valStr = ExtractLiteralArg(&args);
|
||||||
if (!valStr)
|
if (!valStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
return HandleSetValueHelper(target, field, typeStr, valStr);
|
return HandleSetValueHelper(target, field, typeStr, valStr);
|
||||||
}
|
}
|
||||||
|
|
@ -845,17 +845,17 @@ bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeS
|
||||||
|
|
||||||
uint32 base; // 0 -> float
|
uint32 base; // 0 -> float
|
||||||
if (!typeStr)
|
if (!typeStr)
|
||||||
base = 10;
|
{ base = 10; }
|
||||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||||
base = 10;
|
{ base = 10; }
|
||||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||||
base = 16;
|
{ base = 16; }
|
||||||
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
||||||
base = 2;
|
{ base = 2; }
|
||||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||||
base = 0;
|
{ base = 0; }
|
||||||
else
|
else
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (base)
|
if (base)
|
||||||
{
|
{
|
||||||
|
|
@ -870,7 +870,7 @@ bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeS
|
||||||
res.reserve(1 + 32 + 1);
|
res.reserve(1 + 32 + 1);
|
||||||
res = iValue & (1 << (32 - 1)) ? "0" : " ";
|
res = iValue & (1 << (32 - 1)) ? "0" : " ";
|
||||||
for (int i = 32; i > 0; --i)
|
for (int i = 32; i > 0; --i)
|
||||||
res += iValue & (1 << (i - 1)) ? "1" : "0";
|
{ res += iValue & (1 << (i - 1)) ? "1" : "0"; }
|
||||||
DEBUG_LOG(GetMangosString(LANG_GET_BITSTR), guid.GetString().c_str(), field, res.c_str());
|
DEBUG_LOG(GetMangosString(LANG_GET_BITSTR), guid.GetString().c_str(), field, res.c_str());
|
||||||
PSendSysMessage(LANG_GET_BITSTR_FIELD, guid.GetString().c_str(), field, res.c_str());
|
PSendSysMessage(LANG_GET_BITSTR_FIELD, guid.GetString().c_str(), field, res.c_str());
|
||||||
break;
|
break;
|
||||||
|
|
@ -899,19 +899,19 @@ bool ChatHandler::HandleDebugGetItemValueCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 guid;
|
uint32 guid;
|
||||||
if (!ExtractUInt32(&args, guid))
|
if (!ExtractUInt32(&args, guid))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 field;
|
uint32 field;
|
||||||
if (!ExtractUInt32(&args, field))
|
if (!ExtractUInt32(&args, field))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* typeStr = ExtractLiteralArg(&args);
|
char* typeStr = ExtractLiteralArg(&args);
|
||||||
if (!typeStr && *args) // optional arg but check format fail case
|
if (!typeStr && *args) // optional arg but check format fail case
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||||
if (!item)
|
if (!item)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
return HandleGetValueHelper(item, field, typeStr);
|
return HandleGetValueHelper(item, field, typeStr);
|
||||||
}
|
}
|
||||||
|
|
@ -928,11 +928,11 @@ bool ChatHandler::HandleDebugGetValueCommand(char* args)
|
||||||
|
|
||||||
uint32 field;
|
uint32 field;
|
||||||
if (!ExtractUInt32(&args, field))
|
if (!ExtractUInt32(&args, field))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* typeStr = ExtractLiteralArg(&args);
|
char* typeStr = ExtractLiteralArg(&args);
|
||||||
if (!typeStr && *args) // optional arg but check format fail case
|
if (!typeStr && *args) // optional arg but check format fail case
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
return HandleGetValueHelper(target, field, typeStr);
|
return HandleGetValueHelper(target, field, typeStr);
|
||||||
}
|
}
|
||||||
|
|
@ -950,23 +950,23 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
|
||||||
|
|
||||||
uint32 type; // 0 -> float 1 -> int add 2-> bit or 3 -> bit and 4 -> bit and not
|
uint32 type; // 0 -> float 1 -> int add 2-> bit or 3 -> bit and 4 -> bit and not
|
||||||
if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||||
type = 1;
|
{ type = 1; }
|
||||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||||
type = 0;
|
{ type = 0; }
|
||||||
else if (strncmp(typeStr, "|=", strlen("|=") + 1) == 0) // exactly copy
|
else if (strncmp(typeStr, "|=", strlen("|=") + 1) == 0) // exactly copy
|
||||||
type = 2;
|
{ type = 2; }
|
||||||
else if (strncmp(typeStr, "&=", strlen("&=") + 1) == 0) // exactly copy
|
else if (strncmp(typeStr, "&=", strlen("&=") + 1) == 0) // exactly copy
|
||||||
type = 3;
|
{ type = 3; }
|
||||||
else if (strncmp(typeStr, "&=~", strlen("&=~") + 1) == 0) // exactly copy
|
else if (strncmp(typeStr, "&=~", strlen("&=~") + 1) == 0) // exactly copy
|
||||||
type = 4;
|
{ type = 4; }
|
||||||
else
|
else
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (type)
|
if (type)
|
||||||
{
|
{
|
||||||
uint32 iValue;
|
uint32 iValue;
|
||||||
if (!ExtractUInt32Base(&valStr, iValue, type == 1 ? 10 : 16))
|
if (!ExtractUInt32Base(&valStr, iValue, type == 1 ? 10 : 16))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 value = target->GetUInt32Value(field);
|
uint32 value = target->GetUInt32Value(field);
|
||||||
const char* guidString = guid.GetString().c_str();
|
const char* guidString = guid.GetString().c_str();
|
||||||
|
|
@ -1002,7 +1002,7 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
|
||||||
{
|
{
|
||||||
float fValue;
|
float fValue;
|
||||||
if (!ExtractFloat(&valStr, fValue))
|
if (!ExtractFloat(&valStr, fValue))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
float value = target->GetFloatValue(field);
|
float value = target->GetFloatValue(field);
|
||||||
|
|
||||||
|
|
@ -1021,23 +1021,23 @@ bool ChatHandler::HandleDebugModItemValueCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 guid;
|
uint32 guid;
|
||||||
if (!ExtractUInt32(&args, guid))
|
if (!ExtractUInt32(&args, guid))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 field;
|
uint32 field;
|
||||||
if (!ExtractUInt32(&args, field))
|
if (!ExtractUInt32(&args, field))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* typeStr = ExtractLiteralArg(&args);
|
char* typeStr = ExtractLiteralArg(&args);
|
||||||
if (!typeStr)
|
if (!typeStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* valStr = ExtractLiteralArg(&args);
|
char* valStr = ExtractLiteralArg(&args);
|
||||||
if (!valStr)
|
if (!valStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||||
if (!item)
|
if (!item)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
return HandlerDebugModValueHelper(item, field, typeStr, valStr);
|
return HandlerDebugModValueHelper(item, field, typeStr, valStr);
|
||||||
}
|
}
|
||||||
|
|
@ -1054,15 +1054,15 @@ bool ChatHandler::HandleDebugModValueCommand(char* args)
|
||||||
|
|
||||||
uint32 field;
|
uint32 field;
|
||||||
if (!ExtractUInt32(&args, field))
|
if (!ExtractUInt32(&args, field))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* typeStr = ExtractLiteralArg(&args);
|
char* typeStr = ExtractLiteralArg(&args);
|
||||||
if (!typeStr && *args) // optional arg but check format fail case
|
if (!typeStr && *args) // optional arg but check format fail case
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
char* valStr = ExtractLiteralArg(&args);
|
char* valStr = ExtractLiteralArg(&args);
|
||||||
if (!valStr)
|
if (!valStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
return HandlerDebugModValueHelper(target, field, typeStr, valStr);
|
return HandlerDebugModValueHelper(target, field, typeStr, valStr);
|
||||||
}
|
}
|
||||||
|
|
@ -1071,11 +1071,11 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 spellid = ExtractSpellIdFromLink(&args);
|
uint32 spellid = ExtractSpellIdFromLink(&args);
|
||||||
if (!spellid)
|
if (!spellid)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid);
|
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid);
|
||||||
if (!spellEntry)
|
if (!spellEntry)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellid);
|
SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellid);
|
||||||
|
|
||||||
|
|
@ -1128,27 +1128,27 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
||||||
{
|
{
|
||||||
char* typeStr = ExtractLiteralArg(&args);
|
char* typeStr = ExtractLiteralArg(&args);
|
||||||
if (!typeStr)
|
if (!typeStr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Opcodes opcode;
|
Opcodes opcode;
|
||||||
if (strncmp(typeStr, "flat", strlen(typeStr)) == 0)
|
if (strncmp(typeStr, "flat", strlen(typeStr)) == 0)
|
||||||
opcode = SMSG_SET_FLAT_SPELL_MODIFIER;
|
{ opcode = SMSG_SET_FLAT_SPELL_MODIFIER; }
|
||||||
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
|
||||||
opcode = SMSG_SET_PCT_SPELL_MODIFIER;
|
{ opcode = SMSG_SET_PCT_SPELL_MODIFIER; }
|
||||||
else
|
else
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 effidx;
|
uint32 effidx;
|
||||||
if (!ExtractUInt32(&args, effidx) || effidx >= 64 + 32)
|
if (!ExtractUInt32(&args, effidx) || effidx >= 64 + 32)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
uint32 spellmodop;
|
uint32 spellmodop;
|
||||||
if (!ExtractUInt32(&args, spellmodop) || spellmodop >= MAX_SPELLMOD)
|
if (!ExtractUInt32(&args, spellmodop) || spellmodop >= MAX_SPELLMOD)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
int32 value;
|
int32 value;
|
||||||
if (!ExtractInt32(&args, value))
|
if (!ExtractInt32(&args, value))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
Player* chr = getSelectedPlayer();
|
Player* chr = getSelectedPlayer();
|
||||||
if (chr == NULL)
|
if (chr == NULL)
|
||||||
|
|
@ -1160,7 +1160,7 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr))
|
if (HasLowerSecurity(chr))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_SPELLMODS, opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct",
|
PSendSysMessage(LANG_YOU_CHANGE_SPELLMODS, opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct",
|
||||||
spellmodop, value, effidx, GetNameLink(chr).c_str());
|
spellmodop, value, effidx, GetNameLink(chr).c_str());
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ void FlightPathMovementGenerator::Finalize(Player& player)
|
||||||
|
|
||||||
if (player.m_taxi.empty())
|
if (player.m_taxi.empty())
|
||||||
{
|
{
|
||||||
player.getHostileRefManager().setOnlineOfflineState(true);
|
player.GetHostileRefManager().setOnlineOfflineState(true);
|
||||||
if (player.pvpInfo.inHostileArea)
|
if (player.pvpInfo.inHostileArea)
|
||||||
player.CastSpell(&player, 2479, true);
|
player.CastSpell(&player, 2479, true);
|
||||||
|
|
||||||
|
|
@ -416,7 +416,7 @@ void FlightPathMovementGenerator::Interrupt(Player& player)
|
||||||
|
|
||||||
void FlightPathMovementGenerator::Reset(Player& player)
|
void FlightPathMovementGenerator::Reset(Player& player)
|
||||||
{
|
{
|
||||||
player.getHostileRefManager().setOnlineOfflineState(false);
|
player.GetHostileRefManager().setOnlineOfflineState(false);
|
||||||
player.addUnitState(UNIT_STAT_TAXI_FLIGHT);
|
player.addUnitState(UNIT_STAT_TAXI_FLIGHT);
|
||||||
player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||||
player.SetClientControl(&player, 0);
|
player.SetClientControl(&player, 0);
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,12 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/)
|
||||||
|
|
||||||
// detach and deregister from active objects if there are no more reasons to be active
|
// detach and deregister from active objects if there are no more reasons to be active
|
||||||
m_source->GetViewPoint().Detach(this);
|
m_source->GetViewPoint().Detach(this);
|
||||||
if (!m_source->isActiveObject())
|
if (!m_source->IsActiveObject())
|
||||||
m_source->GetMap()->RemoveFromActive(m_source);
|
m_source->GetMap()->RemoveFromActive(m_source);
|
||||||
|
|
||||||
m_source = obj;
|
m_source = obj;
|
||||||
|
|
||||||
if (!m_source->isActiveObject())
|
if (!m_source->IsActiveObject())
|
||||||
m_source->GetMap()->AddToActive(m_source);
|
m_source->GetMap()->AddToActive(m_source);
|
||||||
|
|
||||||
m_source->GetViewPoint().Attach(this);
|
m_source->GetViewPoint().Attach(this);
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class Camera
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GridReference<Camera>& GetGridRef() { return m_gridRef; }
|
GridReference<Camera>& GetGridRef() { return m_gridRef; }
|
||||||
bool isActiveObject() const { return false; }
|
bool IsActiveObject() const { return false; }
|
||||||
private:
|
private:
|
||||||
GridReference<Camera> m_gridRef;
|
GridReference<Camera> m_gridRef;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1110,7 +1110,7 @@ WorldObject::WorldObject() :
|
||||||
m_transportInfo(NULL),
|
m_transportInfo(NULL),
|
||||||
m_currMap(NULL),
|
m_currMap(NULL),
|
||||||
m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL),
|
m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL),
|
||||||
m_isActiveObject(false)
|
m_IsActiveObject(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2159,17 +2159,17 @@ bool WorldObject::PrintCoordinatesError(float x, float y, float z, char const* d
|
||||||
|
|
||||||
void WorldObject::SetActiveObjectState(bool active)
|
void WorldObject::SetActiveObjectState(bool active)
|
||||||
{
|
{
|
||||||
if (m_isActiveObject == active || (isType(TYPEMASK_PLAYER) && !active)) // player shouldn't became inactive, never
|
if (m_IsActiveObject == active || (isType(TYPEMASK_PLAYER) && !active)) // player shouldn't became inactive, never
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
if (IsInWorld() && !isType(TYPEMASK_PLAYER))
|
if (IsInWorld() && !isType(TYPEMASK_PLAYER))
|
||||||
// player's update implemented in a different from other active worldobject's way
|
// player's update implemented in a different from other active worldobject's way
|
||||||
// it's considired to use generic way in future
|
// it's considired to use generic way in future
|
||||||
{
|
{
|
||||||
if (isActiveObject() && !active)
|
if (IsActiveObject() && !active)
|
||||||
{ GetMap()->RemoveFromActive(this); }
|
{ GetMap()->RemoveFromActive(this); }
|
||||||
else if (!isActiveObject() && active)
|
else if (!IsActiveObject() && active)
|
||||||
{ GetMap()->AddToActive(this); }
|
{ GetMap()->AddToActive(this); }
|
||||||
}
|
}
|
||||||
m_isActiveObject = active;
|
m_IsActiveObject = active;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -658,7 +658,7 @@ class WorldObject : public Object
|
||||||
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false, bool setRun = false);
|
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false, bool setRun = false);
|
||||||
GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime);
|
GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime);
|
||||||
|
|
||||||
bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }
|
bool IsActiveObject() const { return m_IsActiveObject || m_viewPoint.hasViewers(); }
|
||||||
void SetActiveObjectState(bool active);
|
void SetActiveObjectState(bool active);
|
||||||
|
|
||||||
ViewPoint& GetViewPoint() { return m_viewPoint; }
|
ViewPoint& GetViewPoint() { return m_viewPoint; }
|
||||||
|
|
@ -696,7 +696,7 @@ class WorldObject : public Object
|
||||||
Position m_position;
|
Position m_position;
|
||||||
ViewPoint m_viewPoint;
|
ViewPoint m_viewPoint;
|
||||||
WorldUpdateCounter m_updateTracker;
|
WorldUpdateCounter m_updateTracker;
|
||||||
bool m_isActiveObject;
|
bool m_IsActiveObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2390,7 +2390,7 @@ void Player::SetInWater(bool apply)
|
||||||
// remove auras that need water/land
|
// remove auras that need water/land
|
||||||
RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
|
RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
|
||||||
|
|
||||||
getHostileRefManager().updateThreatTables();
|
GetHostileRefManager().updateThreatTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SetGameMasterOnHelper
|
struct SetGameMasterOnHelper
|
||||||
|
|
@ -2399,7 +2399,7 @@ struct SetGameMasterOnHelper
|
||||||
void operator()(Unit* unit) const
|
void operator()(Unit* unit) const
|
||||||
{
|
{
|
||||||
unit->setFaction(35);
|
unit->setFaction(35);
|
||||||
unit->getHostileRefManager().setOnlineOfflineState(false);
|
unit->GetHostileRefManager().setOnlineOfflineState(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2409,7 +2409,7 @@ struct SetGameMasterOffHelper
|
||||||
void operator()(Unit* unit) const
|
void operator()(Unit* unit) const
|
||||||
{
|
{
|
||||||
unit->setFaction(faction);
|
unit->setFaction(faction);
|
||||||
unit->getHostileRefManager().setOnlineOfflineState(true);
|
unit->GetHostileRefManager().setOnlineOfflineState(true);
|
||||||
}
|
}
|
||||||
uint32 faction;
|
uint32 faction;
|
||||||
};
|
};
|
||||||
|
|
@ -2427,7 +2427,7 @@ void Player::SetGameMaster(bool on)
|
||||||
SetFFAPvP(false);
|
SetFFAPvP(false);
|
||||||
ResetContestedPvP();
|
ResetContestedPvP();
|
||||||
|
|
||||||
getHostileRefManager().setOnlineOfflineState(false);
|
GetHostileRefManager().setOnlineOfflineState(false);
|
||||||
CombatStopWithPets();
|
CombatStopWithPets();
|
||||||
|
|
||||||
SetPhaseMask(PHASEMASK_ANYWHERE, false); // see and visible in all phases
|
SetPhaseMask(PHASEMASK_ANYWHERE, false); // see and visible in all phases
|
||||||
|
|
@ -2458,7 +2458,7 @@ void Player::SetGameMaster(bool on)
|
||||||
// restore FFA PvP area state, remove not allowed for GM mounts
|
// restore FFA PvP area state, remove not allowed for GM mounts
|
||||||
UpdateArea(m_areaUpdateId);
|
UpdateArea(m_areaUpdateId);
|
||||||
|
|
||||||
getHostileRefManager().setOnlineOfflineState(true);
|
GetHostileRefManager().setOnlineOfflineState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_camera.UpdateVisibilityForOwner();
|
m_camera.UpdateVisibilityForOwner();
|
||||||
|
|
|
||||||
|
|
@ -1108,7 +1108,7 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||||
// stop combat
|
// stop combat
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DealDamageAttackStop");
|
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DealDamageAttackStop");
|
||||||
pVictim->CombatStop();
|
pVictim->CombatStop();
|
||||||
pVictim->getHostileRefManager().deleteReferences();
|
pVictim->GetHostileRefManager().deleteReferences();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions for the killer
|
* Actions for the killer
|
||||||
|
|
@ -10592,9 +10592,9 @@ void Unit::CleanupsBeforeDelete()
|
||||||
ClearComboPointHolders();
|
ClearComboPointHolders();
|
||||||
DeleteThreatList();
|
DeleteThreatList();
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
getHostileRefManager().setOnlineOfflineState(false);
|
GetHostileRefManager().setOnlineOfflineState(false);
|
||||||
else
|
else
|
||||||
getHostileRefManager().deleteReferences();
|
GetHostileRefManager().deleteReferences();
|
||||||
RemoveAllAuras(AURA_REMOVE_BY_DELETE);
|
RemoveAllAuras(AURA_REMOVE_BY_DELETE);
|
||||||
}
|
}
|
||||||
WorldObject::CleanupsBeforeDelete();
|
WorldObject::CleanupsBeforeDelete();
|
||||||
|
|
@ -11259,7 +11259,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, uint32 /*spellID*/)
|
||||||
if (casterGuid == GetObjectGuid())
|
if (casterGuid == GetObjectGuid())
|
||||||
FinishSpell(CURRENT_GENERIC_SPELL, false);
|
FinishSpell(CURRENT_GENERIC_SPELL, false);
|
||||||
InterruptNonMeleeSpells(true);
|
InterruptNonMeleeSpells(true);
|
||||||
getHostileRefManager().deleteReferences();
|
GetHostileRefManager().deleteReferences();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -11912,7 +11912,7 @@ void Unit::StopAttackFaction(uint32 faction_id)
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHostileRefManager().deleteReferencesForFaction(faction_id);
|
GetHostileRefManager().deleteReferencesForFaction(faction_id);
|
||||||
|
|
||||||
CallForAllControlledUnits(StopAttackFactionHelper(faction_id), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_CHARM);
|
CallForAllControlledUnits(StopAttackFactionHelper(faction_id), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_CHARM);
|
||||||
}
|
}
|
||||||
|
|
@ -12425,7 +12425,7 @@ bool Unit::TakePossessOf(Unit* possessed)
|
||||||
|
|
||||||
possessed->CombatStop(true);
|
possessed->CombatStop(true);
|
||||||
possessed->DeleteThreatList();
|
possessed->DeleteThreatList();
|
||||||
possessed->getHostileRefManager().deleteReferences();
|
possessed->GetHostileRefManager().deleteReferences();
|
||||||
|
|
||||||
if (possessedCreature)
|
if (possessedCreature)
|
||||||
{
|
{
|
||||||
|
|
@ -12490,7 +12490,7 @@ void Unit::ResetControlState(bool attackCharmer /*= true*/)
|
||||||
|
|
||||||
possessed->CombatStop(true);
|
possessed->CombatStop(true);
|
||||||
possessed->DeleteThreatList();
|
possessed->DeleteThreatList();
|
||||||
possessed->getHostileRefManager().deleteReferences();
|
possessed->GetHostileRefManager().deleteReferences();
|
||||||
|
|
||||||
if (possessed->GetTypeId() == TYPEID_PLAYER)
|
if (possessed->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3286,7 +3286,7 @@ class Unit : public WorldObject
|
||||||
ThreatManager const& GetThreatManager() const { return m_ThreatManager; }
|
ThreatManager const& GetThreatManager() const { return m_ThreatManager; }
|
||||||
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
|
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
|
||||||
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
|
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
|
||||||
HostileRefManager& getHostileRefManager() { return m_HostileRefManager; }
|
HostileRefManager& GetHostileRefManager() { return m_HostileRefManager; }
|
||||||
|
|
||||||
SpellAuraHolder* GetVisibleAura(uint8 slot) const
|
SpellAuraHolder* GetVisibleAura(uint8 slot) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -437,9 +437,9 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
|
||||||
|
|
||||||
if (threat > 0.0f)
|
if (threat > 0.0f)
|
||||||
{
|
{
|
||||||
if (float redirectedMod = pVictim->getHostileRefManager().GetThreatRedirectionMod())
|
if (float redirectedMod = pVictim->GetHostileRefManager().GetThreatRedirectionMod())
|
||||||
{
|
{
|
||||||
if (Unit* redirectedTarget = pVictim->getHostileRefManager().GetThreatRedirectionTarget())
|
if (Unit* redirectedTarget = pVictim->GetHostileRefManager().GetThreatRedirectionTarget())
|
||||||
{
|
{
|
||||||
if (redirectedTarget != getOwner() && redirectedTarget->IsAlive())
|
if (redirectedTarget != getOwner() && redirectedTarget->IsAlive())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -426,14 +426,14 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
// FIXME: logout must be delayed in case lost connection with client in time of combat
|
// FIXME: logout must be delayed in case lost connection with client in time of combat
|
||||||
if (_player->GetDeathTimer())
|
if (_player->GetDeathTimer())
|
||||||
{
|
{
|
||||||
_player->getHostileRefManager().deleteReferences();
|
_player->GetHostileRefManager().deleteReferences();
|
||||||
_player->BuildPlayerRepop();
|
_player->BuildPlayerRepop();
|
||||||
_player->RepopAtGraveyard();
|
_player->RepopAtGraveyard();
|
||||||
}
|
}
|
||||||
else if (!_player->getAttackers().empty())
|
else if (!_player->getAttackers().empty())
|
||||||
{
|
{
|
||||||
_player->CombatStop();
|
_player->CombatStop();
|
||||||
_player->getHostileRefManager().setOnlineOfflineState(false);
|
_player->GetHostileRefManager().setOnlineOfflineState(false);
|
||||||
_player->RemoveAllAurasOnDeath();
|
_player->RemoveAllAurasOnDeath();
|
||||||
|
|
||||||
// build set of player who attack _player or who have pet attacking of _player
|
// build set of player who attack _player or who have pet attacking of _player
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ Map::Add(T* obj)
|
||||||
obj->SetMap(this);
|
obj->SetMap(this);
|
||||||
|
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
{ EnsureGridLoadedAtEnter(cell); }
|
{ EnsureGridLoadedAtEnter(cell); }
|
||||||
else
|
else
|
||||||
{ EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); }
|
{ EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); }
|
||||||
|
|
@ -369,7 +369,7 @@ Map::Add(T* obj)
|
||||||
AddToGrid(obj, grid, cell);
|
AddToGrid(obj, grid, cell);
|
||||||
obj->AddToWorld();
|
obj->AddToWorld();
|
||||||
|
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
{ AddToActive(obj); }
|
{ AddToActive(obj); }
|
||||||
|
|
||||||
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY());
|
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY());
|
||||||
|
|
@ -685,7 +685,7 @@ Map::Remove(T* obj, bool remove)
|
||||||
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
||||||
MANGOS_ASSERT(grid != NULL);
|
MANGOS_ASSERT(grid != NULL);
|
||||||
|
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
{ RemoveFromActive(obj); }
|
{ RemoveFromActive(obj); }
|
||||||
|
|
||||||
if (remove)
|
if (remove)
|
||||||
|
|
@ -776,7 +776,7 @@ bool Map::CreatureCellRelocation(Creature* c, const Cell& new_cell)
|
||||||
Cell const& old_cell = c->GetCurrentCell();
|
Cell const& old_cell = c->GetCurrentCell();
|
||||||
if (old_cell.DiffGrid(new_cell))
|
if (old_cell.DiffGrid(new_cell))
|
||||||
{
|
{
|
||||||
if (!c->isActiveObject() && !loaded(new_cell.gridPair()))
|
if (!c->IsActiveObject() && !loaded(new_cell.gridPair()))
|
||||||
{
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_CREATURE_MOVES, "Creature (GUID: %u Entry: %u) attempt move from grid[%u,%u]cell[%u,%u] to unloaded grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
DEBUG_FILTER_LOG(LOG_FILTER_CREATURE_MOVES, "Creature (GUID: %u Entry: %u) attempt move from grid[%u,%u]cell[%u,%u] to unloaded grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair& cell, GridRefManager<T>&
|
||||||
addUnitState(obj, cell);
|
addUnitState(obj, cell);
|
||||||
obj->SetMap(map);
|
obj->SetMap(map);
|
||||||
obj->AddToWorld();
|
obj->AddToWorld();
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
map->AddToActive(obj);
|
map->AddToActive(obj);
|
||||||
|
|
||||||
obj->GetViewPoint().Event_AddedToWorld(&grid);
|
obj->GetViewPoint().Event_AddedToWorld(&grid);
|
||||||
|
|
@ -167,7 +167,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair& cell, CorpseMapType
|
||||||
addUnitState(obj, cell);
|
addUnitState(obj, cell);
|
||||||
obj->SetMap(map);
|
obj->SetMap(map);
|
||||||
obj->AddToWorld();
|
obj->AddToWorld();
|
||||||
if (obj->isActiveObject())
|
if (obj->IsActiveObject())
|
||||||
map->AddToActive(obj);
|
map->AddToActive(obj);
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|
|
||||||
|
|
@ -1194,7 +1194,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||||
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit, absorb);
|
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit, absorb);
|
||||||
|
|
||||||
if (real_caster)
|
if (real_caster)
|
||||||
unitTarget->getHostileRefManager().threatAssist(real_caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(m_spellInfo), m_spellInfo);
|
unitTarget->GetHostileRefManager().threatAssist(real_caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(m_spellInfo), m_spellInfo);
|
||||||
}
|
}
|
||||||
// Do damage and triggers
|
// Do damage and triggers
|
||||||
else if (m_damage)
|
else if (m_damage)
|
||||||
|
|
@ -1392,7 +1392,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask)
|
||||||
if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO))
|
if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO))
|
||||||
{
|
{
|
||||||
realCaster->SetInCombatState(unit->GetCombatTimer() > 0);
|
realCaster->SetInCombatState(unit->GetCombatTimer() > 0);
|
||||||
unit->getHostileRefManager().threatAssist(realCaster, 0.0f, m_spellInfo);
|
unit->GetHostileRefManager().threatAssist(realCaster, 0.0f, m_spellInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5054,7 +5054,7 @@ void Spell::HandleThreatSpells()
|
||||||
// positive spells distribute threat among all units that are in combat with target, like healing
|
// positive spells distribute threat among all units that are in combat with target, like healing
|
||||||
if (positive)
|
if (positive)
|
||||||
{
|
{
|
||||||
target->getHostileRefManager().threatAssist(m_caster /*real_caster ??*/, threat, m_spellInfo);
|
target->GetHostileRefManager().threatAssist(m_caster /*real_caster ??*/, threat, m_spellInfo);
|
||||||
}
|
}
|
||||||
// for negative spells threat gets distributed among affected targets
|
// for negative spells threat gets distributed among affected targets
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2786,7 +2786,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
case 59628: // Tricks of the Trade, triggered buff
|
case 59628: // Tricks of the Trade, triggered buff
|
||||||
{
|
{
|
||||||
if (Unit* pCaster = GetCaster())
|
if (Unit* pCaster = GetCaster())
|
||||||
pCaster->getHostileRefManager().ResetThreatRedirection();
|
pCaster->GetHostileRefManager().ResetThreatRedirection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 36730: // Flame Strike
|
case 36730: // Flame Strike
|
||||||
|
|
@ -3375,7 +3375,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
// used for direct in code aura removes and spell proc event charges expire
|
// used for direct in code aura removes and spell proc event charges expire
|
||||||
if (m_removeMode != AURA_REMOVE_BY_DEFAULT)
|
if (m_removeMode != AURA_REMOVE_BY_DEFAULT)
|
||||||
target->getHostileRefManager().ResetThreatRedirection();
|
target->GetHostileRefManager().ResetThreatRedirection();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -3393,7 +3393,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
// used for direct in code aura removes and spell proc event charges expire
|
// used for direct in code aura removes and spell proc event charges expire
|
||||||
if (m_removeMode != AURA_REMOVE_BY_DEFAULT)
|
if (m_removeMode != AURA_REMOVE_BY_DEFAULT)
|
||||||
target->getHostileRefManager().ResetThreatRedirection();
|
target->GetHostileRefManager().ResetThreatRedirection();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -4393,7 +4393,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||||
|
|
||||||
target->CombatStop(true);
|
target->CombatStop(true);
|
||||||
target->DeleteThreatList();
|
target->DeleteThreatList();
|
||||||
target->getHostileRefManager().deleteReferences();
|
target->GetHostileRefManager().deleteReferences();
|
||||||
|
|
||||||
if (target->GetTypeId() == TYPEID_UNIT)
|
if (target->GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
|
|
@ -4470,7 +4470,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||||
|
|
||||||
target->CombatStop(true);
|
target->CombatStop(true);
|
||||||
target->DeleteThreatList();
|
target->DeleteThreatList();
|
||||||
target->getHostileRefManager().deleteReferences();
|
target->GetHostileRefManager().deleteReferences();
|
||||||
|
|
||||||
if (target->GetTypeId() == TYPEID_UNIT)
|
if (target->GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
|
|
@ -4999,7 +4999,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
|
||||||
|
|
||||||
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
|
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
|
||||||
|
|
||||||
target->getHostileRefManager().threatAssist(caster, threatMod, GetSpellProto());
|
target->GetHostileRefManager().threatAssist(caster, threatMod, GetSpellProto());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aura::HandleModTaunt(bool apply, bool Real)
|
void Aura::HandleModTaunt(bool apply, bool Real)
|
||||||
|
|
@ -5358,7 +5358,7 @@ void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real)
|
||||||
target->CastSpell(caster, 59665, true);
|
target->CastSpell(caster, 59665, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
target->getHostileRefManager().ResetThreatRedirection();
|
target->GetHostileRefManager().ResetThreatRedirection();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -7520,7 +7520,7 @@ void Aura::PeriodicTick()
|
||||||
// Health Leech effects do not generate healing aggro
|
// Health Leech effects do not generate healing aggro
|
||||||
if (m_modifier.m_auraname == SPELL_AURA_PERIODIC_LEECH)
|
if (m_modifier.m_auraname == SPELL_AURA_PERIODIC_LEECH)
|
||||||
break;
|
break;
|
||||||
pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
pCaster->GetHostileRefManager().threatAssist(pCaster, gain * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_PERIODIC_HEAL:
|
case SPELL_AURA_PERIODIC_HEAL:
|
||||||
|
|
@ -7596,7 +7596,7 @@ void Aura::PeriodicTick()
|
||||||
if (BattleGround* bg = ((Player*)pCaster)->GetBattleGround())
|
if (BattleGround* bg = ((Player*)pCaster)->GetBattleGround())
|
||||||
bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain);
|
bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain);
|
||||||
|
|
||||||
target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
target->GetHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
||||||
|
|
||||||
// apply damage part to caster if needed (ex. health funnel)
|
// apply damage part to caster if needed (ex. health funnel)
|
||||||
if (target != pCaster && spellProto->SpellVisual[0] == 163)
|
if (target != pCaster && spellProto->SpellVisual[0] == 163)
|
||||||
|
|
@ -7767,7 +7767,7 @@ void Aura::PeriodicTick()
|
||||||
int32 gain = target->ModifyPower(power, pdamage);
|
int32 gain = target->ModifyPower(power, pdamage);
|
||||||
|
|
||||||
if (Unit* pCaster = GetCaster())
|
if (Unit* pCaster = GetCaster())
|
||||||
target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
target->GetHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_OBS_MOD_MANA:
|
case SPELL_AURA_OBS_MOD_MANA:
|
||||||
|
|
@ -7793,7 +7793,7 @@ void Aura::PeriodicTick()
|
||||||
int32 gain = target->ModifyPower(POWER_MANA, pdamage);
|
int32 gain = target->ModifyPower(POWER_MANA, pdamage);
|
||||||
|
|
||||||
if (Unit* pCaster = GetCaster())
|
if (Unit* pCaster = GetCaster())
|
||||||
target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
target->GetHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_POWER_BURN_MANA:
|
case SPELL_AURA_POWER_BURN_MANA:
|
||||||
|
|
@ -7855,7 +7855,7 @@ void Aura::PeriodicTick()
|
||||||
|
|
||||||
int32 gain = target->ModifyHealth(m_modifier.m_amount);
|
int32 gain = target->ModifyHealth(m_modifier.m_amount);
|
||||||
if (Unit* caster = GetCaster())
|
if (Unit* caster = GetCaster())
|
||||||
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
target->GetHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_MOD_POWER_REGEN:
|
case SPELL_AURA_MOD_POWER_REGEN:
|
||||||
|
|
|
||||||
|
|
@ -4843,7 +4843,7 @@ void Spell::EffectHealPct(SpellEffectEntry const* /*effect*/)
|
||||||
unitTarget->CalculateHealAbsorb(addhealth, &absorb);
|
unitTarget->CalculateHealAbsorb(addhealth, &absorb);
|
||||||
|
|
||||||
int32 gain = caster->DealHeal(unitTarget, addhealth - absorb, m_spellInfo, false, absorb);
|
int32 gain = caster->DealHeal(unitTarget, addhealth - absorb, m_spellInfo, false, absorb);
|
||||||
unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(m_spellInfo), m_spellInfo);
|
unitTarget->GetHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(m_spellInfo), m_spellInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10129,7 +10129,7 @@ void Spell::EffectSanctuary(SpellEffectEntry const* /*effect*/)
|
||||||
// unitTarget->CombatStop();
|
// unitTarget->CombatStop();
|
||||||
|
|
||||||
unitTarget->CombatStop();
|
unitTarget->CombatStop();
|
||||||
unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting
|
unitTarget->GetHostileRefManager().deleteReferences(); // stop all fighting
|
||||||
|
|
||||||
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
|
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
|
||||||
if (m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000000000800)))
|
if (m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000000000800)))
|
||||||
|
|
@ -11812,7 +11812,7 @@ void Spell::EffectRedirectThreat(SpellEffectEntry const* effect)
|
||||||
if (Aura* glyph = unitTarget->GetDummyAura(63326)) // Glyph of Vigilance
|
if (Aura* glyph = unitTarget->GetDummyAura(63326)) // Glyph of Vigilance
|
||||||
damage += glyph->GetModifier()->m_amount;
|
damage += glyph->GetModifier()->m_amount;
|
||||||
|
|
||||||
m_caster->getHostileRefManager().SetThreatRedirection(unitTarget->GetObjectGuid(), uint32(damage));
|
m_caster->GetHostileRefManager().SetThreatRedirection(unitTarget->GetObjectGuid(), uint32(damage));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectTeachTaxiNode(SpellEffectEntry const* effect)
|
void Spell::EffectTeachTaxiNode(SpellEffectEntry const* effect)
|
||||||
|
|
|
||||||
|
|
@ -1800,7 +1800,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
|
||||||
case 57934:
|
case 57934:
|
||||||
{
|
{
|
||||||
triggered_spell_id = 57933; // Tricks of the Trade, increased damage buff
|
triggered_spell_id = 57933; // Tricks of the Trade, increased damage buff
|
||||||
target = getHostileRefManager().GetThreatRedirectionTarget();
|
target = GetHostileRefManager().GetThreatRedirectionTarget();
|
||||||
if (!target)
|
if (!target)
|
||||||
return SPELL_AURA_PROC_FAILED;
|
return SPELL_AURA_PROC_FAILED;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace LuaGameObject
|
||||||
*/
|
*/
|
||||||
int IsActive(Eluna* /*E*/, lua_State* L, GameObject* go)
|
int IsActive(Eluna* /*E*/, lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, go->isActiveObject());
|
Eluna::Push(L, go->IsActiveObject());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue