mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
feat(Core/CFBG): Added support module mod-cfbg (#2064)
https://github.com/Winfidonarleyan/mod-cfbg - Original module https://github.com/azerothcore/mod-cfbg - the fork in AC
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "Player.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include "Channel.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include <unordered_map>
|
||||
|
||||
struct BGSpamProtectionS
|
||||
@@ -23,7 +24,7 @@ struct BGSpamProtectionS
|
||||
uint32 last_queue = 0; // CHAT DISABLED BY DEFAULT
|
||||
};
|
||||
|
||||
std::unordered_map<uint32, BGSpamProtectionS>BGSpamProtection;
|
||||
std::unordered_map<uint32, BGSpamProtectionS> BGSpamProtection;
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
@@ -152,6 +153,8 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
||||
if (ginfo->teamId == TEAM_HORDE)
|
||||
index++;
|
||||
|
||||
sScriptMgr->OnAddGroup(this, ginfo, index, leader, grp, bracketEntry, isPremade);
|
||||
|
||||
// pussywizard: store indices at which GroupQueueInfo is in m_QueuedGroups
|
||||
ginfo->_bracketId = bracketId;
|
||||
ginfo->_groupType = index;
|
||||
@@ -185,40 +188,12 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
||||
//add GroupInfo to m_QueuedGroups
|
||||
m_QueuedGroups[bracketId][index].push_back(ginfo);
|
||||
|
||||
//announce current queue status
|
||||
if (!isRated && !isPremade && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
|
||||
if (Battleground * bgt = sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId))
|
||||
{
|
||||
char const* bgName = bgt->GetName();
|
||||
uint32 MinPlayers = bgt->GetMinPlayersPerTeam();
|
||||
uint32 MaxPlayers = MinPlayers * 2;
|
||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
||||
uint32 qHorde = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_HORDE);
|
||||
uint32 qAlliance = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_ALLIANCE);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId);
|
||||
if (!bg)
|
||||
return ginfo;
|
||||
|
||||
// Show queue status to player only (when joining battleground queue or Arena and arena world announcer is disabled)
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) || (bgt->isArena() && !sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)))
|
||||
{
|
||||
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
|
||||
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
||||
}
|
||||
else if (!bgt->isArena()) // Show queue status to server (when joining battleground queue)
|
||||
{
|
||||
if (BGSpamProtection[leader->GetGUID()].last_queue == 0)
|
||||
{
|
||||
BGSpamProtection[leader->GetGUID()].last_queue = sWorld->GetGameTime();
|
||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level,
|
||||
qAlliance + qHorde, MaxPlayers);
|
||||
}
|
||||
else if (sWorld->GetGameTime() - BGSpamProtection[leader->GetGUID()].last_queue >= 30)
|
||||
{
|
||||
BGSpamProtection[leader->GetGUID()].last_queue = 0;
|
||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level,
|
||||
qAlliance + qHorde, MaxPlayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isRated && !isPremade && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
|
||||
SendMessageQueue(leader, bg, bracketEntry);
|
||||
|
||||
return ginfo;
|
||||
}
|
||||
@@ -400,7 +375,8 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo * gin
|
||||
// this function is filling pools given free slots on both sides, result is ballanced
|
||||
void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id)
|
||||
{
|
||||
UNUSED(bg);
|
||||
if (!sScriptMgr->CanFillPlayersToBG(this, bg, aliFree, hordeFree, bracket_id))
|
||||
return;
|
||||
|
||||
// clear selection pools
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
@@ -456,9 +432,10 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, c
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue * specificQueue, BattlegroundBracketId specificBracketId)
|
||||
void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId)
|
||||
{
|
||||
UNUSED(bg);
|
||||
if (!sScriptMgr->CanFillPlayersToBGWithSpecific(this, bg, aliFree, hordeFree, thisBracketId, specificQueue, specificBracketId))
|
||||
return;
|
||||
|
||||
// clear selection pools
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
@@ -579,6 +556,12 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
||||
// this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
|
||||
bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
|
||||
{
|
||||
uint32 Coef = 1;
|
||||
|
||||
sScriptMgr->OnCheckNormalMatch(this, Coef, bgTemplate, bracket_id, minPlayers, maxPlayers);
|
||||
|
||||
minPlayers = minPlayers * Coef;
|
||||
|
||||
// if current queue is BATTLEGROUND_QUEUE_RB, then we are trying to create bg using players from 2 queues
|
||||
if (bgTemplate->GetBgTypeID() == BATTLEGROUND_RB)
|
||||
{
|
||||
@@ -593,7 +576,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, Battleground
|
||||
return false;
|
||||
|
||||
// specific queue
|
||||
BattlegroundQueue & specificQueue = sBattlegroundMgr->GetBattlegroundQueue(BattlegroundMgr::BGQueueTypeId(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(), 0));
|
||||
BattlegroundQueue& specificQueue = sBattlegroundMgr->GetBattlegroundQueue(BattlegroundMgr::BGQueueTypeId(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(), 0));
|
||||
|
||||
FillPlayersToBGWithSpecific(specificTemplate, specificTemplate->GetMaxPlayersPerTeam(), specificTemplate->GetMaxPlayersPerTeam(), bracket_id, &specificQueue, BattlegroundBracketId(specificBracket->bracketId));
|
||||
|
||||
@@ -601,10 +584,9 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, Battleground
|
||||
if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
||||
return true;
|
||||
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= std::min<uint32>(specificTemplate->GetMinPlayersPerTeam(), 15) && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= std::min<uint32>(specificTemplate->GetMinPlayersPerTeam(), 15);
|
||||
}
|
||||
// if this is not random bg queue - use players only from this queue
|
||||
else
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= std::min<uint32>(specificTemplate->GetMinPlayersPerTeam() * Coef, 15) && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= std::min<uint32>(specificTemplate->GetMinPlayersPerTeam() * Coef, 15);
|
||||
}
|
||||
else // if this is not random bg queue - use players only from this queue
|
||||
{
|
||||
FillPlayersToBG(bgTemplate, maxPlayers, maxPlayers, bracket_id);
|
||||
|
||||
@@ -980,6 +962,43 @@ bool BattlegroundQueue::IsAllQueuesEmpty(BattlegroundBracketId bracket_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
void BattlegroundQueue::SendMessageQueue(Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry)
|
||||
{
|
||||
if (!sScriptMgr->CanSendMessageQueue(this, leader, bg, bracketEntry))
|
||||
return;
|
||||
|
||||
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
char const* bgName = bg->GetName();
|
||||
uint32 MinPlayers = bg->GetMinPlayersPerTeam();
|
||||
uint32 MaxPlayers = MinPlayers * 2;
|
||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
||||
uint32 qHorde = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_HORDE);
|
||||
uint32 qAlliance = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_ALLIANCE);
|
||||
|
||||
// Show queue status to player only (when joining battleground queue or Arena and arena world announcer is disabled)
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) || (bg->isArena() && !sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)))
|
||||
{
|
||||
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
|
||||
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
||||
}
|
||||
else if (!bg->isArena()) // Show queue status to server (when joining battleground queue)
|
||||
{
|
||||
if (BGSpamProtection[leader->GetGUID()].last_queue == 0)
|
||||
{
|
||||
BGSpamProtection[leader->GetGUID()].last_queue = sWorld->GetGameTime();
|
||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level,
|
||||
qAlliance + qHorde, MaxPlayers);
|
||||
}
|
||||
else if (sWorld->GetGameTime() - BGSpamProtection[leader->GetGUID()].last_queue >= 30)
|
||||
{
|
||||
BGSpamProtection[leader->GetGUID()].last_queue = 0;
|
||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level,
|
||||
qAlliance + qHorde, MaxPlayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE EVENTS ***/
|
||||
/*********************************************************/
|
||||
|
||||
@@ -45,7 +45,7 @@ enum BattlegroundQueueGroupTypes
|
||||
BG_QUEUE_NORMAL_ALLIANCE,
|
||||
BG_QUEUE_NORMAL_HORDE,
|
||||
|
||||
BG_QUEUE_MAX
|
||||
BG_QUEUE_MAX = 10
|
||||
};
|
||||
|
||||
class Battleground;
|
||||
@@ -72,6 +72,7 @@ class BattlegroundQueue
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||
uint32 GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue);
|
||||
bool IsAllQueuesEmpty(BattlegroundBracketId bracket_id);
|
||||
void SendMessageQueue(Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||
|
||||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Battleground.h"
|
||||
@@ -134,6 +133,14 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
|
||||
// queue result (default ok)
|
||||
GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult(bgt->GetBgTypeID());
|
||||
|
||||
if (!sScriptMgr->CanJoinInBattlegroundQueue(_player, guid, bgTypeId, joinAsGroup, err) && err <= 0)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
||||
// check if player can queue:
|
||||
if (!joinAsGroup)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
#include "CellImpl.h"
|
||||
#include "Chat.h"
|
||||
#include "ChannelMgr.h"
|
||||
@@ -28,6 +27,7 @@
|
||||
#include "Util.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "AccountMgr.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
@@ -106,6 +106,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))
|
||||
{
|
||||
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
|
||||
@@ -333,6 +334,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
sScriptMgr->OnBeforeSendChatMessage(_player, type, lang, msg);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "AccountMgr.h"
|
||||
#include "Spell.h"
|
||||
#include "WhoListCache.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
@@ -213,7 +214,6 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
|
||||
|
||||
@@ -32,10 +32,12 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
|
||||
data << uint8(0); // name known
|
||||
data << playerData->name; // played name
|
||||
data << uint8(0); // realm name - only set for cross realm interaction (such as Battlegrounds)
|
||||
data << uint8(playerData->race);
|
||||
data << uint8(player ? player->getRace() : playerData->race);
|
||||
data << uint8(playerData->gender);
|
||||
data << uint8(playerData->playerClass);
|
||||
|
||||
|
||||
@@ -1379,7 +1379,6 @@ bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target, u
|
||||
}
|
||||
|
||||
// Player
|
||||
|
||||
void ScriptMgr::OnPlayerCompleteQuest(Player* player, Quest const* quest)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnPlayerCompleteQuest(player, quest);
|
||||
@@ -1511,6 +1510,11 @@ void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::stri
|
||||
FOREACH_SCRIPT(PlayerScript)->OnChat(player, type, lang, msg);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeSendChatMessage(Player* player, uint32& type, uint32& lang, std::string& msg)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBeforeSendChatMessage(player, type, lang, msg);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* receiver)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnChat(player, type, lang, msg, receiver);
|
||||
@@ -1729,6 +1733,17 @@ void ScriptMgr::OnFirstLogin(Player* player)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnFirstLogin(player);
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanJoinInBattlegroundQueue(Player* player, uint64 BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
FOR_SCRIPTS_RET(PlayerScript, itr, end, ret) // return true by default if not scripts
|
||||
if (!itr->second->CanJoinInBattlegroundQueue(player, BattlemasterGuid, BGTypeID, joinAsGroup, err))
|
||||
ret = false; // we change ret value only when scripts return false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Account
|
||||
void ScriptMgr::OnAccountLogin(uint32 accountId)
|
||||
{
|
||||
@@ -2003,7 +2018,6 @@ void ScriptMgr::OnAfterStoreOrEquipNewItem(Player* player, uint32 vendorslot, ui
|
||||
FOREACH_SCRIPT(PlayerScript)->OnAfterStoreOrEquipNewItem(player, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
|
||||
}
|
||||
|
||||
|
||||
void ScriptMgr::OnAfterUpdateMaxPower(Player* player, Powers& power, float& value)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnAfterUpdateMaxPower(player, power, value);
|
||||
@@ -2065,6 +2079,50 @@ void ScriptMgr::OnBattlegroundRemovePlayerAtLeave(Battleground* bg, Player* play
|
||||
FOREACH_SCRIPT(BGScript)->OnBattlegroundRemovePlayerAtLeave(bg, player);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnAddGroup(BattlegroundQueue* queue, GroupQueueInfo* ginfo, uint32& index, Player* leader, Group* grp, PvPDifficultyEntry const* bracketEntry, bool isPremade)
|
||||
{
|
||||
FOREACH_SCRIPT(BGScript)->OnAddGroup(queue, ginfo, index, leader, grp, bracketEntry, isPremade);
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanFillPlayersToBG(BattlegroundQueue* queue, Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
FOR_SCRIPTS_RET(BGScript, itr, end, ret) // return true by default if not scripts
|
||||
if (!itr->second->CanFillPlayersToBG(queue, bg, aliFree, hordeFree, bracket_id))
|
||||
ret = false; // we change ret value only when scripts return false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanFillPlayersToBGWithSpecific(BattlegroundQueue* queue, Battleground* bg, const int32 aliFree, const int32 hordeFree,
|
||||
BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
FOR_SCRIPTS_RET(BGScript, itr, end, ret) // return true by default if not scripts
|
||||
if (!itr->second->CanFillPlayersToBGWithSpecific(queue, bg, aliFree, hordeFree, thisBracketId, specificQueue, specificBracketId))
|
||||
ret = false; // we change ret value only when scripts return false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ScriptMgr::OnCheckNormalMatch(BattlegroundQueue* queue, uint32& Coef, Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32& minPlayers, uint32& maxPlayers)
|
||||
{
|
||||
FOREACH_SCRIPT(BGScript)->OnCheckNormalMatch(queue, Coef, bgTemplate, bracket_id, minPlayers, maxPlayers);
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanSendMessageQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
FOR_SCRIPTS_RET(BGScript, itr, end, ret) // return true by default if not scripts
|
||||
if (!itr->second->CanSendMessageQueue(queue, leader, bg, bracketEntry))
|
||||
ret = false; // we change ret value only when scripts return false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// SpellSC
|
||||
void ScriptMgr::OnCalcMaxDuration(Aura const* aura, int32& maxDuration)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ class AuctionHouseObject;
|
||||
class AuraScript;
|
||||
class Battleground;
|
||||
class BattlegroundMap;
|
||||
class BattlegroundQueue;
|
||||
class Channel;
|
||||
class ChatCommand;
|
||||
class Creature;
|
||||
@@ -62,10 +63,10 @@ struct ConditionSourceInfo;
|
||||
struct Condition;
|
||||
struct ItemTemplate;
|
||||
struct OutdoorPvPData;
|
||||
struct GroupQueueInfo;
|
||||
|
||||
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
|
||||
|
||||
|
||||
/*
|
||||
TODO: Add more script type classes.
|
||||
|
||||
@@ -836,6 +837,8 @@ class PlayerScript : public ScriptObject
|
||||
// The following methods are called when a player sends a chat message.
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/) { }
|
||||
|
||||
virtual void OnBeforeSendChatMessage(Player* /*player*/, uint32& /*type*/, uint32& /*lang*/, std::string& /*msg*/) { }
|
||||
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Player* /*receiver*/) { }
|
||||
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Group* /*group*/) { }
|
||||
@@ -958,6 +961,8 @@ class PlayerScript : public ScriptObject
|
||||
virtual void OnBeforeInitTalentForLevel(Player* /*player*/, uint8& /*level*/, uint32& /*talentPointsForLevel*/) { }
|
||||
|
||||
virtual void OnFirstLogin(Player* /*player*/) { }
|
||||
|
||||
virtual bool CanJoinInBattlegroundQueue(Player* /*player*/, uint64 /*BattlemasterGuid*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
};
|
||||
|
||||
class AccountScript : public ScriptObject
|
||||
@@ -1116,6 +1121,17 @@ public:
|
||||
|
||||
// Remove player at leave BG
|
||||
virtual void OnBattlegroundRemovePlayerAtLeave(Battleground* /*bg*/, Player* /*player*/) { }
|
||||
|
||||
virtual void OnAddGroup(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/, uint32& /*index*/, Player* /*leader*/, Group* /*grp*/, PvPDifficultyEntry const* /*bracketEntry*/, bool /*isPremade*/) { }
|
||||
|
||||
virtual bool CanFillPlayersToBG(BattlegroundQueue* /*queue*/, Battleground* /*bg*/, const int32 /*aliFree*/, const int32 /*hordeFree*/, BattlegroundBracketId /*bracket_id*/) { return true; }
|
||||
|
||||
virtual bool CanFillPlayersToBGWithSpecific(BattlegroundQueue* /*queue*/, Battleground* /*bg*/, const int32 /*aliFree*/, const int32 /*hordeFree*/,
|
||||
BattlegroundBracketId /*thisBracketId*/, BattlegroundQueue* /*specificQueue*/, BattlegroundBracketId /*specificBracketId*/) { return true; }
|
||||
|
||||
virtual void OnCheckNormalMatch(BattlegroundQueue* /*queue*/, uint32& /*Coef*/, Battleground* /*bgTemplate*/, BattlegroundBracketId /*bracket_id*/, uint32& /*minPlayers*/, uint32& /*maxPlayers*/) { }
|
||||
|
||||
virtual bool CanSendMessageQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, Battleground* /*bg*/, PvPDifficultyEntry const* /*bracketEntry*/) { return true; }
|
||||
};
|
||||
|
||||
class SpellSC : public ScriptObject
|
||||
@@ -1335,7 +1351,6 @@ class ScriptMgr
|
||||
|
||||
public: /* PlayerScript */
|
||||
|
||||
|
||||
void OnBeforePlayerUpdate(Player* player, uint32 p_time);
|
||||
void OnPlayerReleasedGhost(Player* player);
|
||||
void OnPVPKill(Player* killer, Player* killed);
|
||||
@@ -1355,6 +1370,7 @@ class ScriptMgr
|
||||
void OnPlayerDuelStart(Player* player1, Player* player2);
|
||||
void OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType type);
|
||||
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg);
|
||||
void OnBeforeSendChatMessage(Player* player, uint32& type, uint32& lang, std::string& msg);
|
||||
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* receiver);
|
||||
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group);
|
||||
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild);
|
||||
@@ -1400,6 +1416,7 @@ class ScriptMgr
|
||||
void OnBeforeInitTalentForLevel(Player* player, uint8& level, uint32& talentPointsForLevel);
|
||||
void OnFirstLogin(Player* player);
|
||||
void OnPlayerCompleteQuest(Player* player, Quest const* quest);
|
||||
bool CanJoinInBattlegroundQueue(Player* player, uint64 BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err);
|
||||
|
||||
public: /* AccountScript */
|
||||
|
||||
@@ -1488,8 +1505,14 @@ class ScriptMgr
|
||||
void OnBattlegroundAddPlayer(Battleground* bg, Player* player);
|
||||
void OnBattlegroundBeforeAddPlayer(Battleground* bg, Player* player);
|
||||
void OnBattlegroundRemovePlayerAtLeave(Battleground* bg, Player* player);
|
||||
void OnAddGroup(BattlegroundQueue* queue, GroupQueueInfo* ginfo, uint32& index, Player* leader, Group* grp, PvPDifficultyEntry const* bracketEntry, bool isPremade);
|
||||
bool CanFillPlayersToBG(BattlegroundQueue* queue, Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||
bool CanFillPlayersToBGWithSpecific(BattlegroundQueue* queue, Battleground* bg, const int32 aliFree, const int32 hordeFree,
|
||||
BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
|
||||
void OnCheckNormalMatch(BattlegroundQueue* queue, uint32& Coef, Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32& minPlayers, uint32& maxPlayers);
|
||||
bool CanSendMessageQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||
|
||||
public: /* SpellSC */
|
||||
public: /* SpellSC */
|
||||
|
||||
void OnCalcMaxDuration(Aura const* aura, int32& maxDuration);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user