Core/Battleground: Check battlegrounds disabled in db2 files

Port From (https://github.com/TrinityCore/TrinityCore/commit/5d57415951c4b6f7b86c97922c94b571a178f35a)
This commit is contained in:
hondacrx
2020-01-09 11:30:07 -05:00
parent 1a09ae3b69
commit 191d465eee
3 changed files with 18 additions and 6 deletions
+11
View File
@@ -986,6 +986,17 @@ namespace Framework.Constants
Max
}
public enum BattlemasterListFlags : sbyte
{
Disabled = 0x01,
SkipRoleCheck = 0x02,
Unk4 = 0x04,
CanInitWarGame = 0x08,
CanSpecificQueue = 0x10,
Brawl = 0x20,
Factional = 0x40
}
public enum ChrSpecializationFlag
{
Caster = 0x01,
+2 -1
View File
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
namespace Game.DataStorage
{
@@ -97,7 +98,7 @@ namespace Game.DataStorage
public sbyte GroupsAllowed;
public sbyte MaxGroupSize;
public ushort HolidayWorldState;
public sbyte Flags;
public BattlemasterListFlags Flags;
public int IconFileDataID;
public short RequiredPlayerConditionID;
public short[] MapId = new short[16];
+5 -5
View File
@@ -64,19 +64,19 @@ namespace Game
return;
}
uint bgTypeId_ = (uint)(battlemasterJoin.QueueIDs[0] & 0xFFFF);
if (!CliDB.BattlemasterListStorage.ContainsKey(bgTypeId_))
BattlegroundTypeId bgTypeId = (BattlegroundTypeId)(battlemasterJoin.QueueIDs[0] & 0xFFFF);
BattlemasterListRecord battlemasterListEntry = CliDB.BattlemasterListStorage.LookupByKey(bgTypeId);
if (battlemasterListEntry == null)
{
Log.outError(LogFilter.Network, "Battleground: invalid bgtype ({0}) received. possible cheater? player guid {1}", bgTypeId_, GetPlayer().GetGUID().ToString());
Log.outError(LogFilter.Network, "Battleground: invalid bgtype ({0}) received. possible cheater? player guid {1}", bgTypeId, GetPlayer().GetGUID().ToString());
return;
}
if (Global.DisableMgr.IsDisabledFor(DisableType.Battleground, bgTypeId_, null))
if (Global.DisableMgr.IsDisabledFor(DisableType.Battleground, (uint)bgTypeId, null) || battlemasterListEntry.Flags.HasAnyFlag(BattlemasterListFlags.Disabled))
{
GetPlayer().SendSysMessage(CypherStrings.BgDisabled);
return;
}
BattlegroundTypeId bgTypeId = (BattlegroundTypeId)bgTypeId_;
// can do this, since it's Battleground, not arena
BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(bgTypeId, 0);