mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
feat(Core): implement world availability option (#8755)
This commit is contained in:
@@ -665,17 +665,23 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (PlayerLoading() || GetPlayer() != nullptr)
|
||||
{
|
||||
LOG_ERROR("network", "Player tries to login again, AccountId = %d", GetAccountId());
|
||||
KickPlayer("WorldSession::HandlePlayerLoginOpcode Another client logging in");
|
||||
return;
|
||||
}
|
||||
|
||||
m_playerLoading = true;
|
||||
ObjectGuid playerGuid;
|
||||
recvData >> playerGuid;
|
||||
|
||||
if (PlayerLoading() || GetPlayer() != nullptr || !playerGuid.IsPlayer())
|
||||
{
|
||||
// limit player interaction with the world
|
||||
if (!sWorld->getBoolConfig(CONFIG_REALM_LOGIN_ENABLED))
|
||||
{
|
||||
WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1);
|
||||
// see LoginFailureReason enum for more reasons
|
||||
data << uint8(LoginFailureReason::NoWorld);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!playerGuid.IsPlayer() || !IsLegitCharacterForAccount(playerGuid))
|
||||
{
|
||||
LOG_ERROR("network", "Account (%u) can't login with that character (%s).", GetAccountId(), playerGuid.ToString().c_str());
|
||||
|
||||
@@ -170,6 +170,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID,
|
||||
CONFIG_SET_BOP_ITEM_TRADEABLE,
|
||||
CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE,
|
||||
CONFIG_REALM_LOGIN_ENABLED,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -1436,6 +1436,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
LOG_ERROR("server.loading", "LFG.KickPreventionTimer can't be higher than 15 minutes.");
|
||||
}
|
||||
|
||||
// Realm Availability
|
||||
m_bool_configs[CONFIG_REALM_LOGIN_ENABLED] = sConfigMgr->GetOption<bool>("World.RealmAvailability", false);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
sScriptMgr->OnAfterConfigLoad(reload);
|
||||
}
|
||||
|
||||
@@ -3597,6 +3597,19 @@ enum ServerProcessTypes
|
||||
NUM_SERVER_PROCESS_TYPES
|
||||
};
|
||||
|
||||
// Login Failure Reasons
|
||||
enum class LoginFailureReason : uint8
|
||||
{
|
||||
Failed = 0,
|
||||
NoWorld = 1,
|
||||
DuplicateCharacter = 2,
|
||||
NoInstances = 3,
|
||||
Disabled = 4,
|
||||
NoCharacter = 5,
|
||||
LockedForTransfer = 6,
|
||||
LockedByBilling = 7
|
||||
};
|
||||
|
||||
namespace Acore::Impl
|
||||
{
|
||||
struct AC_SHARED_API CurrentServerProcessHolder
|
||||
|
||||
@@ -3587,6 +3587,15 @@ LFG.MaxKickCount = 2
|
||||
|
||||
LFG.KickPreventionTimer = 900
|
||||
|
||||
#
|
||||
# World.RealmAvailability
|
||||
# Description: If enabled, players will enter the realm normally.
|
||||
# Character creation will still be possible even when realm is disabled.
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
|
||||
World.RealmAvailability = 1
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user