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:
Kargatum
2019-08-06 09:21:11 +07:00
committed by GitHub
parent 34184d4afe
commit d40e894618
8 changed files with 164 additions and 52 deletions

View File

@@ -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)
{