Core/PacketIO: Updated remaining packet structures and enums appearing in packets

This commit is contained in:
Shauren
2016-03-28 15:23:41 +02:00
parent 13db756f9d
commit 619669c620
19 changed files with 339 additions and 348 deletions

View File

@@ -34,6 +34,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH);
PrepareStatement(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_ACCOUNT_INFO_CONTINUED_SESSION, "UPDATE account SET sessionkey = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_CONTINUED_SESSION, "SELECT username, sessionkey FROM account WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH);

View File

@@ -37,6 +37,7 @@ enum LoginDatabaseStatements
LOGIN_SEL_ACCOUNT_BANNED_ALL,
LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME,
LOGIN_DEL_ACCOUNT_BANNED,
LOGIN_UPD_ACCOUNT_INFO_CONTINUED_SESSION,
LOGIN_SEL_ACCOUNT_INFO_CONTINUED_SESSION,
LOGIN_UPD_VS,
LOGIN_SEL_LOGON_COUNTRY,

View File

@@ -22,60 +22,78 @@
#include <sstream>
#include <iomanip>
char const* TypeNames[] =
namespace
{
"Null",
"Uniq",
"Player",
"Item",
"StaticDoor",
"Transport",
"Conversation",
"Creature",
"Vehicle",
"Pet",
"GameObject",
"DynamicObject",
"AreaTrigger",
"Corpse",
"LootObject",
"SceneObject",
"Scenario",
"AIGroup",
"DynamicDoor",
"ClientActor",
"Vignette",
"CallForHelp",
"AIResource",
"AILock",
"AILockTicket",
"ChatChannel",
"Party",
"Guild",
"WowAccount",
"BNetAccount",
"GMTask",
"MobileSession",
"RaidGroup",
"Spell",
"Mail",
"WebObj",
"LFGObject",
"LFGList",
"UserRouter",
"PVPQueueGroup",
"UserClient",
"PetBattle",
"UniqueUserClient",
"BattlePet",
};
struct GuidTypeNames
{
char const* Values[uint32(HighGuid::Count)];
GuidTypeNames();
} Names;
GuidTypeNames::GuidTypeNames()
{
#define SET_GUID_NAME(type) Values[uint32(HighGuid::type)] = #type;
SET_GUID_NAME(Null);
SET_GUID_NAME(Uniq);
SET_GUID_NAME(Player);
SET_GUID_NAME(Item);
SET_GUID_NAME(WorldTransaction);
SET_GUID_NAME(StaticDoor);
SET_GUID_NAME(Transport);
SET_GUID_NAME(Conversation);
SET_GUID_NAME(Creature);
SET_GUID_NAME(Vehicle);
SET_GUID_NAME(Pet);
SET_GUID_NAME(GameObject);
SET_GUID_NAME(DynamicObject);
SET_GUID_NAME(AreaTrigger);
SET_GUID_NAME(Corpse);
SET_GUID_NAME(LootObject);
SET_GUID_NAME(SceneObject);
SET_GUID_NAME(Scenario);
SET_GUID_NAME(AIGroup);
SET_GUID_NAME(DynamicDoor);
SET_GUID_NAME(ClientActor);
SET_GUID_NAME(Vignette);
SET_GUID_NAME(CallForHelp);
SET_GUID_NAME(AIResource);
SET_GUID_NAME(AILock);
SET_GUID_NAME(AILockTicket);
SET_GUID_NAME(ChatChannel);
SET_GUID_NAME(Party);
SET_GUID_NAME(Guild);
SET_GUID_NAME(WowAccount);
SET_GUID_NAME(BNetAccount);
SET_GUID_NAME(GMTask);
SET_GUID_NAME(MobileSession);
SET_GUID_NAME(RaidGroup);
SET_GUID_NAME(Spell);
SET_GUID_NAME(Mail);
SET_GUID_NAME(WebObj);
SET_GUID_NAME(LFGObject);
SET_GUID_NAME(LFGList);
SET_GUID_NAME(UserRouter);
SET_GUID_NAME(PVPQueueGroup);
SET_GUID_NAME(UserClient);
SET_GUID_NAME(PetBattle);
SET_GUID_NAME(UniqUserClient);
SET_GUID_NAME(BattlePet);
SET_GUID_NAME(CommerceObj);
SET_GUID_NAME(ClientSession);
#undef SET_GUID_NAME
}
}
char const* ObjectGuid::GetTypeName(HighGuid high)
{
if (high >= HighGuid::Count)
return "<unknown>";
return TypeNames[uint32(high)];
return Names.Values[uint32(high)];
}
std::string ObjectGuid::ToString() const

View File

@@ -63,46 +63,49 @@ enum class HighGuid
Uniq = 1,
Player = 2,
Item = 3,
StaticDoor = 4, //NYI
Transport = 5,
Conversation = 6,
Creature = 7,
Vehicle = 8,
Pet = 9,
GameObject = 10,
DynamicObject = 11,
AreaTrigger = 12,
Corpse = 13,
LootObject = 14,
SceneObject = 15,
Scenario = 16,
AIGroup = 17,
DynamicDoor = 18,
ClientActor = 19, //NYI
Vignette = 20,
CallForHelp = 21,
AIResource = 22,
AILock = 23,
AILockTicket = 24,
ChatChannel = 25,
Party = 26,
Guild = 27,
WowAccount = 28,
BNetAccount = 29,
GMTask = 30,
MobileSession = 31, //NYI
RaidGroup = 32,
Spell = 33,
Mail = 34,
WebObj = 35, //NYI
LFGObject = 36, //NYI
LFGList = 37, //NYI
UserRouter = 38,
PVPQueueGroup = 39,
UserClient = 40,
PetBattle = 41, //NYI
UniqueUserClient = 42,
BattlePet = 43,
WorldTransaction = 4,
StaticDoor = 5, //NYI
Transport = 6,
Conversation = 7,
Creature = 8,
Vehicle = 9,
Pet = 10,
GameObject = 11,
DynamicObject = 12,
AreaTrigger = 13,
Corpse = 14,
LootObject = 15,
SceneObject = 16,
Scenario = 17,
AIGroup = 18,
DynamicDoor = 19,
ClientActor = 20, //NYI
Vignette = 21,
CallForHelp = 22,
AIResource = 23,
AILock = 24,
AILockTicket = 25,
ChatChannel = 26,
Party = 27,
Guild = 28,
WowAccount = 29,
BNetAccount = 30,
GMTask = 31,
MobileSession = 32, //NYI
RaidGroup = 33,
Spell = 34,
Mail = 35,
WebObj = 36, //NYI
LFGObject = 37, //NYI
LFGList = 38, //NYI
UserRouter = 39,
PVPQueueGroup = 40,
UserClient = 41,
PetBattle = 42, //NYI
UniqUserClient = 43,
BattlePet = 44,
CommerceObj = 45,
ClientSession = 46,
Count,
};
@@ -150,12 +153,15 @@ GUID_TRAIT_GLOBAL(HighGuid::Mail)
GUID_TRAIT_GLOBAL(HighGuid::UserRouter)
GUID_TRAIT_GLOBAL(HighGuid::PVPQueueGroup)
GUID_TRAIT_GLOBAL(HighGuid::UserClient)
GUID_TRAIT_GLOBAL(HighGuid::UniqueUserClient)
GUID_TRAIT_GLOBAL(HighGuid::UniqUserClient)
GUID_TRAIT_GLOBAL(HighGuid::BattlePet)
GUID_TRAIT_GLOBAL(HighGuid::CommerceObj)
GUID_TRAIT_GLOBAL(HighGuid::ClientSession)
GUID_TRAIT_REALM_SPECIFIC(HighGuid::Player)
GUID_TRAIT_REALM_SPECIFIC(HighGuid::Item) // This is not exactly correct, there are 2 more unknown parts in highguid: (high >> 10 & 0xFF), (high >> 18 & 0xFFFFFF)
GUID_TRAIT_REALM_SPECIFIC(HighGuid::Transport)
GUID_TRAIT_REALM_SPECIFIC(HighGuid::Guild)
GUID_TRAIT_MAP_SPECIFIC(HighGuid::WorldTransaction)
GUID_TRAIT_MAP_SPECIFIC(HighGuid::Conversation)
GUID_TRAIT_MAP_SPECIFIC(HighGuid::Creature)
GUID_TRAIT_MAP_SPECIFIC(HighGuid::Vehicle)

View File

@@ -845,39 +845,26 @@ typedef std::vector<ItemPosCount> ItemPosCountVec;
enum TransferAbortReason
{
TRANSFER_ABORT_NONE = 0,
TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE = 1, // You are already locked to %s
TRANSFER_ABORT_MAP_NOT_ALLOWED = 2, // Map cannot be entered at this time.
TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER = 3, // You are ineligible to participate in at least one encounter in this instance because you are already locked to an instance in which it has been defeated.
TRANSFER_ABORT_NOT_FOUND = 4, // Transfer Aborted: instance not found
TRANSFER_ABORT_NEED_GROUP = 5, // Transfer Aborted: you must be in a raid group to enter this instance
TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 6, // Additional instances cannot be launched, please try again later.
TRANSFER_ABORT_DIFFICULTY = 7, // <Normal, Heroic, Epic> difficulty mode is not available for %s.
TRANSFER_ABORT_REALM_ONLY = 8, // All players in the party must be from the same realm to enter %s.
TRANSFER_ABORT_NOT_FOUND_2 = 13, // Transfer Aborted: instance not found
TRANSFER_ABORT_SOLO_PLAYER_SWITCH_DIFFICULTY = 15, // This instance is already in progress. You may only switch difficulties from inside the instance.
TRANSFER_ABORT_TOO_MANY_INSTANCES = 16, // You have entered too many instances recently.
TRANSFER_ABORT_MAX_PLAYERS = 17, // Transfer Aborted: instance is full
TRANSFER_ABORT_NOT_FOUND_3 = 19, // Transfer Aborted: instance not found
TRANSFER_ABORT_ERROR = 21,
TRANSFER_ABORT_NOT_FOUND_4 = 23, // Transfer Aborted: instance not found
TRANSFER_ABORT_UNIQUE_MESSAGE = 24, // Until you've escaped TLK's grasp, you cannot leave this place!
TRANSFER_ABORT_DIFFICULTY_NOT_FOUND = 27, // client writes to console "Unable to resolve requested difficultyID %u to actual difficulty for map %d"
TRANSFER_ABORT_XREALM_ZONE_DOWN = 28, // Transfer Aborted: cross-realm zone is down
TRANSFER_ABORT_ZONE_IN_COMBAT = 29, // Unable to zone in while an encounter is in progress.
TRANSFER_ABORT_INSUF_EXPAN_LVL = 31, // You must have <TBC, WotLK> expansion installed to access this area.
/*
// Unknown values - not used by the client to display any error
TRANSFER_ABORT_MANY_REALM_INSTANCES
TRANSFER_ABORT_AREA_NOT_ZONED
TRANSFER_ABORT_TIMEOUT
TRANSFER_ABORT_SHUTTING_DOWN
TRANSFER_ABORT_PLAYER_CONDITION
TRANSFER_ABORT_BUSY
TRANSFER_ABORT_DISCONNECTED
TRANSFER_ABORT_LOGGING_OUT
TRANSFER_ABORT_NEED_SERVER
*/
TRANSFER_ABORT_ERROR = 1,
TRANSFER_ABORT_MAX_PLAYERS = 2, // Transfer Aborted: instance is full
TRANSFER_ABORT_NOT_FOUND = 3, // Transfer Aborted: instance not found
TRANSFER_ABORT_TOO_MANY_INSTANCES = 4, // You have entered too many instances recently.
TRANSFER_ABORT_ZONE_IN_COMBAT = 6, // Unable to zone in while an encounter is in progress.
TRANSFER_ABORT_INSUF_EXPAN_LVL = 7, // You must have <TBC, WotLK> expansion installed to access this area.
TRANSFER_ABORT_DIFFICULTY = 8, // <Normal, Heroic, Epic> difficulty mode is not available for %s.
TRANSFER_ABORT_UNIQUE_MESSAGE = 9, // Until you've escaped TLK's grasp, you cannot leave this place!
TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 10, // Additional instances cannot be launched, please try again later.
TRANSFER_ABORT_NEED_GROUP = 11, // Transfer Aborted: you must be in a raid group to enter this instance
TRANSFER_ABORT_NOT_FOUND_2 = 12, // Transfer Aborted: instance not found
TRANSFER_ABORT_NOT_FOUND_3 = 13, // Transfer Aborted: instance not found
TRANSFER_ABORT_NOT_FOUND_4 = 14, // Transfer Aborted: instance not found
TRANSFER_ABORT_REALM_ONLY = 15, // All players in the party must be from the same realm to enter %s.
TRANSFER_ABORT_MAP_NOT_ALLOWED = 16, // Map cannot be entered at this time.
TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE = 18, // You are already locked to %s
TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER = 19, // You are ineligible to participate in at least one encounter in this instance because you are already locked to an instance in which it has been defeated.
TRANSFER_ABORT_DIFFICULTY_NOT_FOUND = 22, // client writes to console "Unable to resolve requested difficultyID %u to actual difficulty for map %d"
TRANSFER_ABORT_XREALM_ZONE_DOWN = 24, // Transfer Aborted: cross-realm zone is down
TRANSFER_ABORT_SOLO_PLAYER_SWITCH_DIFFICULTY = 26, // This instance is already in progress. You may only switch difficulties from inside the instance.
};
enum NewWorldReason

View File

@@ -16,12 +16,13 @@
*/
#include "WorldSession.h"
#include "ObjectMgr.h"
#include "AuthenticationPackets.h"
#include "BattlenetRpcErrorCodes.h"
#include "ClientConfigPackets.h"
#include "ObjectMgr.h"
#include "SystemPackets.h"
void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
void WorldSession::SendAuthResponse(uint32 code, bool queued, uint32 queuePos)
{
WorldPackets::Auth::AuthResponse response;
response.Result = code;
@@ -31,8 +32,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
response.WaitInfo = boost::in_place();
response.WaitInfo->WaitCount = queuePos;
}
if (code == AUTH_OK)
else if (code == ERROR_OK)
{
response.SuccessInfo = boost::in_place();
@@ -59,14 +59,12 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
void WorldSession::SendAuthWaitQue(uint32 position)
{
WorldPackets::Auth::AuthResponse response;
response.Result = ERROR_OK;
if (position == 0)
response.Result = AUTH_OK;
else
if (position)
{
response.WaitInfo = boost::in_place();
response.WaitInfo->WaitCount = position;
response.Result = AUTH_WAIT_QUEUE;
}
SendPacket(response.Write());

View File

@@ -121,11 +121,11 @@ enum LootError
// type of Loot Item in Loot View
enum LootSlotType
{
LOOT_SLOT_TYPE_ALLOW_LOOT = 4, // player can loot the item.
LOOT_SLOT_TYPE_ROLL_ONGOING = 7, // roll is ongoing. player cannot loot.
LOOT_SLOT_TYPE_MASTER = 6, // item can only be distributed by group loot master.
LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
LOOT_SLOT_TYPE_OWNER = 5 // ignore binding confirmation and etc, for single player looting
LOOT_SLOT_TYPE_ALLOW_LOOT = 0, // player can loot the item.
LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
LOOT_SLOT_TYPE_MASTER = 3, // item can only be distributed by group loot master.
LOOT_SLOT_TYPE_LOCKED = 2, // item is shown in red. player cannot loot.
LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
};
class Player;

View File

@@ -1262,7 +1262,7 @@ enum SpellEffectName
TOTAL_SPELL_EFFECTS = 252,
};
enum SpellCastResult // 20444
enum SpellCastResult // 21355
{
SPELL_FAILED_SUCCESS = 0,
SPELL_FAILED_AFFECTING_COMBAT = 1,
@@ -4435,114 +4435,88 @@ enum ResponseCodes
CSTATUS_NEGOTIATION_FAILED = 10,
CSTATUS_AUTHENTICATING = 11,
AUTH_OK = 12,
AUTH_FAILED = 13,
AUTH_REJECT = 14,
AUTH_BAD_SERVER_PROOF = 15,
AUTH_UNAVAILABLE = 16,
AUTH_SYSTEM_ERROR = 17,
AUTH_BILLING_ERROR = 18,
AUTH_BILLING_EXPIRED = 19,
AUTH_VERSION_MISMATCH = 20,
AUTH_UNKNOWN_ACCOUNT = 21,
AUTH_INCORRECT_PASSWORD = 22,
AUTH_SESSION_EXPIRED = 23,
AUTH_SERVER_SHUTTING_DOWN = 24,
AUTH_ALREADY_LOGGING_IN = 25,
AUTH_LOGIN_SERVER_NOT_FOUND = 26,
AUTH_WAIT_QUEUE = 27,
AUTH_BANNED = 28,
AUTH_ALREADY_ONLINE = 29,
AUTH_NO_TIME = 30,
AUTH_DB_BUSY = 31,
AUTH_SUSPENDED = 32,
AUTH_PARENTAL_CONTROL = 33,
AUTH_LOCKED_ENFORCED = 34,
REALM_LIST_IN_PROGRESS = 12,
REALM_LIST_SUCCESS = 13,
REALM_LIST_FAILED = 14,
REALM_LIST_INVALID = 15,
REALM_LIST_REALM_NOT_FOUND = 16,
REALM_LIST_IN_PROGRESS = 35,
REALM_LIST_SUCCESS = 36,
REALM_LIST_FAILED = 37,
REALM_LIST_INVALID = 38,
REALM_LIST_REALM_NOT_FOUND = 39,
ACCOUNT_CREATE_IN_PROGRESS = 17,
ACCOUNT_CREATE_SUCCESS = 18,
ACCOUNT_CREATE_FAILED = 19,
ACCOUNT_CREATE_IN_PROGRESS = 40,
ACCOUNT_CREATE_SUCCESS = 41,
ACCOUNT_CREATE_FAILED = 42,
CHAR_LIST_RETRIEVING = 20,
CHAR_LIST_RETRIEVED = 21,
CHAR_LIST_FAILED = 22,
CHAR_LIST_RETRIEVING = 43,
CHAR_LIST_RETRIEVED = 44,
CHAR_LIST_FAILED = 45,
CHAR_CREATE_IN_PROGRESS = 23,
CHAR_CREATE_SUCCESS = 24,
CHAR_CREATE_ERROR = 25,
CHAR_CREATE_FAILED = 26,
CHAR_CREATE_NAME_IN_USE = 27,
CHAR_CREATE_DISABLED = 28,
CHAR_CREATE_PVP_TEAMS_VIOLATION = 29,
CHAR_CREATE_SERVER_LIMIT = 30,
CHAR_CREATE_ACCOUNT_LIMIT = 31,
CHAR_CREATE_SERVER_QUEUE = 32,
CHAR_CREATE_ONLY_EXISTING = 33,
CHAR_CREATE_EXPANSION = 34,
CHAR_CREATE_EXPANSION_CLASS = 35,
CHAR_CREATE_LEVEL_REQUIREMENT = 36,
CHAR_CREATE_UNIQUE_CLASS_LIMIT = 37,
CHAR_CREATE_CHARACTER_IN_GUILD = 38,
CHAR_CREATE_RESTRICTED_RACECLASS = 39,
CHAR_CREATE_CHARACTER_CHOOSE_RACE = 40,
CHAR_CREATE_CHARACTER_ARENA_LEADER = 41,
CHAR_CREATE_CHARACTER_DELETE_MAIL = 42,
CHAR_CREATE_CHARACTER_SWAP_FACTION = 43,
CHAR_CREATE_CHARACTER_RACE_ONLY = 44,
CHAR_CREATE_CHARACTER_GOLD_LIMIT = 45,
CHAR_CREATE_FORCE_LOGIN = 46,
CHAR_CREATE_TRIAL = 47,
CHAR_CREATE_IN_PROGRESS = 46,
CHAR_CREATE_SUCCESS = 47,
CHAR_CREATE_ERROR = 48,
CHAR_CREATE_FAILED = 49,
CHAR_CREATE_NAME_IN_USE = 50,
CHAR_CREATE_DISABLED = 51,
CHAR_CREATE_PVP_TEAMS_VIOLATION = 52,
CHAR_CREATE_SERVER_LIMIT = 53,
CHAR_CREATE_ACCOUNT_LIMIT = 54,
CHAR_CREATE_SERVER_QUEUE = 55,
CHAR_CREATE_ONLY_EXISTING = 56,
CHAR_CREATE_EXPANSION = 57,
CHAR_CREATE_EXPANSION_CLASS = 58,
CHAR_CREATE_LEVEL_REQUIREMENT = 59,
CHAR_CREATE_UNIQUE_CLASS_LIMIT = 60,
CHAR_CREATE_CHARACTER_IN_GUILD = 61,
CHAR_CREATE_RESTRICTED_RACECLASS = 62,
CHAR_CREATE_CHARACTER_CHOOSE_RACE = 63,
CHAR_CREATE_CHARACTER_ARENA_LEADER = 64,
CHAR_CREATE_CHARACTER_DELETE_MAIL = 65,
CHAR_CREATE_CHARACTER_SWAP_FACTION = 66,
CHAR_CREATE_CHARACTER_RACE_ONLY = 67,
CHAR_CREATE_CHARACTER_GOLD_LIMIT = 68,
CHAR_CREATE_FORCE_LOGIN = 69,
CHAR_CREATE_TRIAL = 70,
CHAR_DELETE_IN_PROGRESS = 48,
CHAR_DELETE_SUCCESS = 49,
CHAR_DELETE_FAILED = 50,
CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 51,
CHAR_DELETE_FAILED_GUILD_LEADER = 52,
CHAR_DELETE_FAILED_ARENA_CAPTAIN = 53,
CHAR_DELETE_FAILED_HAS_HEIRLOOM_OR_MAIL = 54,
CHAR_DELETE_FAILED_UPGRADE_IN_PROGRESS = 55,
CHAR_DELETE_FAILED_HAS_WOW_TOKEN = 56,
CHAR_DELETE_FAILED_VAS_TRANSACTION_IN_PROGRESS = 57,
CHAR_DELETE_IN_PROGRESS = 71,
CHAR_DELETE_SUCCESS = 72,
CHAR_DELETE_FAILED = 73,
CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 74,
CHAR_DELETE_FAILED_GUILD_LEADER = 75,
CHAR_DELETE_FAILED_ARENA_CAPTAIN = 76,
CHAR_DELETE_FAILED_HAS_HEIRLOOM_OR_MAIL = 77,
CHAR_DELETE_FAILED_UPGRADE_IN_PROGRESS = 78,
CHAR_DELETE_FAILED_HAS_WOW_TOKEN = 79,
CHAR_DELETE_FAILED_VAS_TRANSACTION_IN_PROGRESS = 80,
CHAR_LOGIN_IN_PROGRESS = 58,
CHAR_LOGIN_SUCCESS = 59,
CHAR_LOGIN_NO_WORLD = 60,
CHAR_LOGIN_DUPLICATE_CHARACTER = 61,
CHAR_LOGIN_NO_INSTANCES = 62,
CHAR_LOGIN_FAILED = 63,
CHAR_LOGIN_DISABLED = 64,
CHAR_LOGIN_NO_CHARACTER = 65,
CHAR_LOGIN_LOCKED_FOR_TRANSFER = 66,
CHAR_LOGIN_LOCKED_BY_BILLING = 67,
CHAR_LOGIN_LOCKED_BY_MOBILE_AH = 68,
CHAR_LOGIN_TEMPORARY_GM_LOCK = 69,
CHAR_LOGIN_LOCKED_BY_CHARACTER_UPGRADE = 70,
CHAR_LOGIN_LOCKED_BY_REVOKED_CHARACTER_UPGRADE = 71,
CHAR_LOGIN_LOCKED_BY_REVOKED_VAS_TRANSACTION = 72,
CHAR_LOGIN_IN_PROGRESS = 81,
CHAR_LOGIN_SUCCESS = 82,
CHAR_LOGIN_NO_WORLD = 83,
CHAR_LOGIN_DUPLICATE_CHARACTER = 84,
CHAR_LOGIN_NO_INSTANCES = 85,
CHAR_LOGIN_FAILED = 86,
CHAR_LOGIN_DISABLED = 87,
CHAR_LOGIN_NO_CHARACTER = 88,
CHAR_LOGIN_LOCKED_FOR_TRANSFER = 89,
CHAR_LOGIN_LOCKED_BY_BILLING = 90,
CHAR_LOGIN_LOCKED_BY_MOBILE_AH = 91,
CHAR_LOGIN_TEMPORARY_GM_LOCK = 92,
CHAR_LOGIN_LOCKED_BY_CHARACTER_UPGRADE = 93,
CHAR_LOGIN_LOCKED_BY_REVOKED_CHARACTER_UPGRADE = 94,
CHAR_LOGIN_LOCKED_BY_REVOKED_VAS_TRANSACTION = 95,
CHAR_NAME_SUCCESS = 96,
CHAR_NAME_FAILURE = 97,
CHAR_NAME_NO_NAME = 98,
CHAR_NAME_TOO_SHORT = 99,
CHAR_NAME_TOO_LONG = 100,
CHAR_NAME_INVALID_CHARACTER = 101,
CHAR_NAME_MIXED_LANGUAGES = 102,
CHAR_NAME_PROFANE = 103,
CHAR_NAME_RESERVED = 104,
CHAR_NAME_INVALID_APOSTROPHE = 105,
CHAR_NAME_MULTIPLE_APOSTROPHES = 106,
CHAR_NAME_THREE_CONSECUTIVE = 107,
CHAR_NAME_INVALID_SPACE = 108,
CHAR_NAME_CONSECUTIVE_SPACES = 109,
CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 110,
CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 111,
CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 112
CHAR_NAME_SUCCESS = 73,
CHAR_NAME_FAILURE = 74,
CHAR_NAME_NO_NAME = 75,
CHAR_NAME_TOO_SHORT = 76,
CHAR_NAME_TOO_LONG = 77,
CHAR_NAME_INVALID_CHARACTER = 78,
CHAR_NAME_MIXED_LANGUAGES = 79,
CHAR_NAME_PROFANE = 80,
CHAR_NAME_RESERVED = 81,
CHAR_NAME_INVALID_APOSTROPHE = 82,
CHAR_NAME_MULTIPLE_APOSTROPHES = 83,
CHAR_NAME_THREE_CONSECUTIVE = 84,
CHAR_NAME_INVALID_SPACE = 85,
CHAR_NAME_CONSECUTIVE_SPACES = 86,
CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 87,
};
enum CharacterUndeleteResult
@@ -4671,32 +4645,32 @@ enum SpellFamilyNames
enum TradeStatus
{
TRADE_STATUS_LOGGING_OUT = 0,
TRADE_STATUS_CURRENCY_NOT_TRADABLE = 1,
TRADE_STATUS_RESTRICTED_ACCOUNT = 2,
TRADE_STATUS_DEAD = 3,
TRADE_STATUS_TARGET_LOGGING_OUT = 4,
TRADE_STATUS_UNACCEPTED = 5,
TRADE_STATUS_ALREADY_TRADING = 6,
TRADE_STATUS_FAILED = 10,
TRADE_STATUS_CANCELLED = 11,
TRADE_STATUS_TARGET_STUNNED = 12,
TRADE_STATUS_TARGET_DEAD = 15,
TRADE_STATUS_WRONG_REALM = 16,
TRADE_STATUS_ACCEPTED = 17,
TRADE_STATUS_NOT_ENOUGH_CURRENCY = 18,
TRADE_STATUS_NOT_ON_TAPLIST = 19,
TRADE_STATUS_WRONG_FACTION = 20,
TRADE_STATUS_STATE_CHANGED = 22,
TRADE_STATUS_PROPOSED = 23,
TRADE_STATUS_STUNNED = 24,
TRADE_STATUS_INITIATED = 25,
TRADE_STATUS_PLAYER_IGNORED = 26,
TRADE_STATUS_PETITION = 27,
TRADE_STATUS_COMPLETE = 28,
TRADE_STATUS_PLAYER_BUSY = 29,
TRADE_STATUS_TOO_FAR_AWAY = 30,
TRADE_STATUS_NO_TARGET = 31,
TRADE_STATUS_PLAYER_BUSY = 0,
TRADE_STATUS_PROPOSED = 1,
TRADE_STATUS_INITIATED = 2,
TRADE_STATUS_CANCELLED = 3,
TRADE_STATUS_ACCEPTED = 4,
TRADE_STATUS_ALREADY_TRADING = 5,
TRADE_STATUS_NO_TARGET = 6,
TRADE_STATUS_UNACCEPTED = 7,
TRADE_STATUS_COMPLETE = 8,
TRADE_STATUS_STATE_CHANGED = 9,
TRADE_STATUS_TOO_FAR_AWAY = 10,
TRADE_STATUS_WRONG_FACTION = 11,
TRADE_STATUS_FAILED = 12,
TRADE_STATUS_PETITION = 13,
TRADE_STATUS_PLAYER_IGNORED = 14,
TRADE_STATUS_STUNNED = 15,
TRADE_STATUS_TARGET_STUNNED = 16,
TRADE_STATUS_DEAD = 17,
TRADE_STATUS_TARGET_DEAD = 18,
TRADE_STATUS_LOGGING_OUT = 19,
TRADE_STATUS_TARGET_LOGGING_OUT = 20,
TRADE_STATUS_RESTRICTED_ACCOUNT = 21,
TRADE_STATUS_WRONG_REALM = 22,
TRADE_STATUS_NOT_ON_TAPLIST = 23,
TRADE_STATUS_CURRENCY_NOT_TRADABLE = 24,
TRADE_STATUS_NOT_ENOUGH_CURRENCY = 25,
};
enum XPColorChar
@@ -4718,27 +4692,27 @@ enum RemoveMethod
enum ActivateTaxiReply
{
ERR_TAXINOVENDORNEARBY = 13,
ERR_TAXIPLAYERMOVING = 10,
ERR_TAXIPLAYERALREADYMOUNTED = 5,
ERR_TAXIPLAYERBUSY = 14,
ERR_TAXINOTENOUGHMONEY = 2,
ERR_TAXINOTSTANDING = 11,
ERR_TAXIPLAYERSHAPESHIFTED = 4,
ERR_TAXIOK = 0,
ERR_TAXIUNSPECIFIEDSERVERERROR = 1,
ERR_TAXINOSUCHPATH = 3,
ERR_TAXIOK = 8,
ERR_TAXISAMENODE = 12,
ERR_TAXITOOFARAWAY = 7,
ERR_TAXINOTVISITED = 9
ERR_TAXINOSUCHPATH = 2,
ERR_TAXINOTENOUGHMONEY = 3,
ERR_TAXITOOFARAWAY = 4,
ERR_TAXINOVENDORNEARBY = 5,
ERR_TAXINOTVISITED = 6,
ERR_TAXIPLAYERBUSY = 7,
ERR_TAXIPLAYERALREADYMOUNTED = 8,
ERR_TAXIPLAYERSHAPESHIFTED = 9,
ERR_TAXIPLAYERMOVING = 10,
ERR_TAXISAMENODE = 11,
ERR_TAXINOTSTANDING = 12
};
enum TaxiNodeStatus
{
TAXISTATUS_NOT_ELIGIBLE = 2,
TAXISTATUS_UNLEARNED = 1,
TAXISTATUS_LEARNED = 3,
TAXISTATUS_NONE = 0
TAXISTATUS_NONE = 0,
TAXISTATUS_LEARNED = 1,
TAXISTATUS_UNLEARNED = 2,
TAXISTATUS_NOT_ELIGIBLE = 3,
};
enum ProfessionUI

View File

@@ -71,8 +71,6 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
{
_worldPacket << uint32(SuccessInfo->VirtualRealmAddress);
_worldPacket << uint32(SuccessInfo->VirtualRealms.size());
_worldPacket << uint32(SuccessInfo->TimeRemain);
_worldPacket << uint32(SuccessInfo->TimeOptions);
_worldPacket << uint32(SuccessInfo->TimeRested);
_worldPacket << uint8(SuccessInfo->ActiveExpansionLevel);
_worldPacket << uint8(SuccessInfo->AccountExpansionLevel);
@@ -82,6 +80,16 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
_worldPacket << uint32(SuccessInfo->Templates.size());
_worldPacket << uint32(SuccessInfo->CurrencyID);
{
_worldPacket << uint32(SuccessInfo->Billing.BillingPlan);
_worldPacket << uint32(SuccessInfo->Billing.TimeRemain);
// 3x same bit is not a mistake - preserves legacy client behavior of BillingPlanFlags::SESSION_IGR
_worldPacket.WriteBit(SuccessInfo->Billing.InGameRoom); // inGameRoom check in function checking which lua event to fire when remaining time is near end - BILLING_NAG_DIALOG vs IGR_BILLING_NAG_DIALOG
_worldPacket.WriteBit(SuccessInfo->Billing.InGameRoom); // inGameRoom lua return from Script_GetBillingPlan
_worldPacket.WriteBit(SuccessInfo->Billing.InGameRoom); // not used anywhere in the client
_worldPacket.FlushBits();
}
for (auto& virtualRealm : SuccessInfo->VirtualRealms)
{
_worldPacket << uint32(virtualRealm.RealmAddress);
@@ -129,7 +137,6 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
_worldPacket.WriteBit(SuccessInfo->ForceCharacterTemplate);
_worldPacket.WriteBit(SuccessInfo->NumPlayersHorde.is_initialized());
_worldPacket.WriteBit(SuccessInfo->NumPlayersAlliance.is_initialized());
_worldPacket.WriteBit(SuccessInfo->IsVeteranTrial);
_worldPacket.FlushBits();
if (SuccessInfo->NumPlayersHorde)
@@ -142,6 +149,7 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
if (WaitInfo)
{
_worldPacket << uint32(WaitInfo->WaitCount);
_worldPacket << uint32(WaitInfo->WaitTime);
_worldPacket.WriteBit(WaitInfo->HasFCM);
_worldPacket.FlushBits();
}

View File

@@ -86,17 +86,23 @@ namespace WorldPackets
struct AuthSuccessInfo
{
uint32 TimeRemain = 0; ///< the remaining game time that the account has in seconds. It is not currently implemented and probably won't ever be.
struct BillingInfo
{
uint32 BillingPlan = 0;
uint32 TimeRemain = 0;
bool InGameRoom = false;
};
uint8 AccountExpansionLevel = 0; ///< the current expansion of this account, the possible values are in @ref Expansions
uint8 ActiveExpansionLevel = 0; ///< the current server expansion, the possible values are in @ref Expansions
uint32 TimeRested = 0; ///< affects the return value of the GetBillingTimeRested() client API call, it is the number of seconds you have left until the experience points and loot you receive from creatures and quests is reduced. It is only used in the Asia region in retail, it's not implemented in TC and will probably never be.
uint8 TimeOptions = 0; ///< controls the behavior of the client regarding billing, used in Asia realms, as they don't have monthly subscriptions, possible values are in @ref BillingPlanFlags. It is not currently implemented and will probably never be.
uint32 VirtualRealmAddress = 0; ///< a special identifier made from the Index, BattleGroup and Region.
uint32 RealmNamesCount = 0; ///< the number of realms connected to this one (inclusive). @todo implement
uint32 TimeSecondsUntilPCKick = 0; ///< @todo research
uint32 CurrencyID = 0; ///< this is probably used for the ingame shop. @todo implement
BillingInfo Billing;
std::vector<RealmInfo> VirtualRealms; ///< list of realms connected to this one (inclusive) @todo implement
std::vector<CharacterTemplate> Templates; ///< list of pre-made character templates.
@@ -107,12 +113,12 @@ namespace WorldPackets
bool ForceCharacterTemplate = false; ///< forces the client to always use a character template when creating a new character. @see Templates. @todo implement
Optional<uint16> NumPlayersHorde; ///< number of horde players in this realm. @todo implement
Optional<uint16> NumPlayersAlliance; ///< number of alliance players in this realm. @todo implement
bool IsVeteranTrial = false; ///< @todo research
};
struct AuthWaitInfo
{
uint32 WaitCount = 0; ///< position of the account in the login queue
uint32 WaitTime = 0; ///< Wait time in login queue in minutes, if sent queued and this value is 0 client displays "unknown time"
bool HasFCM = false; ///< true if the account has a forced character migration pending. @todo implement
};
@@ -122,7 +128,7 @@ namespace WorldPackets
Optional<AuthSuccessInfo> SuccessInfo; ///< contains the packet data in case that it has account information (It is never set when WaitInfo is set), otherwise its contents are undefined.
Optional<AuthWaitInfo> WaitInfo; ///< contains the queue wait information in case the account is in the login queue.
uint32 Result = 0; ///< the result of the authentication process, it is AUTH_OK if it succeeded and the account is ready to log in. It can also be AUTH_WAIT_QUEUE if the account entered the login queue (Queued, QueuePos), possible values are @ref ResponseCodes
uint32 Result = 0; ///< the result of the authentication process, possible values are @ref BattlenetRpcErrorCode
};
enum class ConnectToSerial : uint32

View File

@@ -38,8 +38,8 @@ namespace WorldPackets
struct LootItemData
{
uint8 Type = 2;
uint8 UIType = 7;
uint8 Type = 0;
uint8 UIType = 0;
uint32 Quantity = 0;
uint8 LootItemType = 0;
uint8 LootListID = 0;

View File

@@ -43,6 +43,7 @@
#include "ScriptMgr.h"
#include "WardenWin.h"
#include "AuthenticationPackets.h"
#include "BattlenetRpcErrorCodes.h"
#include "CharacterPackets.h"
#include "ClientConfigPackets.h"
#include "MiscPackets.h"
@@ -103,7 +104,8 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
}
/// WorldSession constructor
WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter):
WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time,
std::string os, LocaleConstant locale, uint32 recruiter, bool isARecruiter):
m_muteTime(mute_time),
m_timeOutTime(0),
AntiDOS(this),
@@ -114,6 +116,7 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
_accountName(std::move(name)),
_battlenetAccountId(battlenetAccountId),
m_expansion(expansion),
_os(os),
_warden(NULL),
_logoutTime(0),
m_inQueue(false),
@@ -1069,27 +1072,21 @@ void WorldSession::ProcessQueryCallbacks()
}
}
void WorldSession::InitWarden(BigNumber* k, std::string const& os)
void WorldSession::InitWarden(BigNumber* k)
{
if (os == "Win")
if (_os == "Win")
{
_warden = new WardenWin();
_warden->Init(this, k);
}
else if (os == "Wn64")
else if (_os == "Wn64")
{
// Not implemented
}
else if (os == "Mc64")
else if (_os == "Mc64")
{
// Not implemented
}
else if (os == "Mac")
{
// Disabled as it is causing the client to crash
// _warden = new WardenMac();
// _warden->Init(this, k);
}
}
void WorldSession::LoadPermissions()
@@ -1190,7 +1187,7 @@ void WorldSession::InitializeSession()
if (!realmHolder->Initialize(GetAccountId(), GetBattlenetAccountId()))
{
delete realmHolder;
SendAuthResponse(AUTH_SYSTEM_ERROR, false);
SendAuthResponse(ERROR_INTERNAL, false);
return;
}
@@ -1199,7 +1196,7 @@ void WorldSession::InitializeSession()
{
delete realmHolder;
delete holder;
SendAuthResponse(AUTH_SYSTEM_ERROR, false);
SendAuthResponse(ERROR_INTERNAL, false);
return;
}
@@ -1215,7 +1212,7 @@ void WorldSession::InitializeSessionCallback(SQLQueryHolder* realmHolder, SQLQue
_collectionMgr->LoadAccountHeirlooms(holder->GetPreparedResult(AccountInfoQueryHolder::GLOBAL_ACCOUNT_HEIRLOOMS));
if (!m_inQueue)
SendAuthResponse(AUTH_OK, false);
SendAuthResponse(ERROR_OK, false);
else
SendAuthWaitQue(0);

View File

@@ -866,7 +866,8 @@ struct PacketCounter
class TC_GAME_API WorldSession
{
public:
WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter);
WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time,
std::string os, LocaleConstant locale, uint32 recruiter, bool isARecruiter);
~WorldSession();
bool PlayerLoading() const { return !m_playerLoading.IsEmpty(); }
@@ -889,7 +890,7 @@ class TC_GAME_API WorldSession
void SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps, std::set<uint32> const& worldMapAreaSwaps);
void SendQueryTimeResponse();
void SendAuthResponse(uint8 code, bool queued, uint32 queuePos = 0);
void SendAuthResponse(uint32 code, bool queued, uint32 queuePos = 0);
void SendClientCacheVersion(uint32 version);
void InitializeSession();
@@ -904,6 +905,7 @@ class TC_GAME_API WorldSession
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
ObjectGuid GetAccountGUID() const { return ObjectGuid::Create<HighGuid::WowAccount>(GetAccountId()); }
std::string const& GetAccountName() const { return _accountName; }
uint32 GetBattlenetAccountId() const { return _battlenetAccountId; }
ObjectGuid GetBattlenetAccountGUID() const { return ObjectGuid::Create<HighGuid::BNetAccount>(GetBattlenetAccountId()); }
Player* GetPlayer() const { return _player; }
@@ -915,7 +917,7 @@ class TC_GAME_API WorldSession
void SetPlayer(Player* player);
uint8 GetExpansion() const { return m_expansion; }
void InitWarden(BigNumber* k, std::string const& os);
void InitWarden(BigNumber* k);
/// Session in auth.queue currently
void SetInQueue(bool state) { m_inQueue = state; }
@@ -1519,7 +1521,7 @@ class TC_GAME_API WorldSession
void HandleBfQueueInviteResponse(WorldPackets::Battlefield::BFMgrQueueInviteResponse& bfMgrQueueInviteResponse);
void HandleBfQueueExitRequest(WorldPackets::Battlefield::BFMgrQueueExitRequest& bfMgrQueueExitRequest);
void HandleWorldTeleportOpcode(WorldPackets::Misc::WorldTeleport& worldTeleport);
void HandleMinimapPingOpcode(WorldPackets::Party::MinimapPingClient& packet);
void HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet);
@@ -1771,6 +1773,7 @@ class TC_GAME_API WorldSession
std::string _accountName;
uint32 _battlenetAccountId;
uint8 m_expansion;
std::string _os;
typedef std::list<AddonInfo> AddonsList;

View File

@@ -18,6 +18,7 @@
#include "WorldSocket.h"
#include "AuthenticationPackets.h"
#include "BattlenetRpcErrorCodes.h"
#include "BigNumber.h"
#include "CharacterPackets.h"
#include "HmacHash.h"
@@ -57,7 +58,7 @@ using boost::asio::ip::tcp;
uint32 const WorldSocket::ConnectionInitializeMagic = 0xF5EB1CE;
std::string const WorldSocket::ServerConnectionInitialize("WORLD OF WARCRAFT CONNECTION - SERVER TO CLIENT");
std::string const WorldSocket::ClientConnectionInitialize("WORLD OF WARCRAFT CONNECTION - CLIENT TO SERVER");
std::string const WorldSocket::ClientConnectionInitialize("WORLD OF WARCRAFT CONNECTION - CLIENT TO SERVER", 48);
uint32 const WorldSocket::MinSizeForCompression = 0x400;
uint32 const SizeOfClientHeader[2] = { sizeof(uint16) + sizeof(uint16), sizeof(uint32) + sizeof(uint16) };
@@ -113,14 +114,13 @@ void WorldSocket::CheckIpCallback(PreparedQueryResult result)
if (banned)
{
SendAuthResponseError(AUTH_REJECT);
TC_LOG_ERROR("network", "WorldSocket::CheckIpCallback: Sent Auth Response (IP %s banned).", GetRemoteIpAddress().to_string().c_str());
DelayedCloseSocket();
return;
}
}
_packetBuffer.Resize(4 + 2 + ClientConnectionInitialize.length() + 1);
_packetBuffer.Resize(4 + 2 + ClientConnectionInitialize.length());
AsyncReadWithCallback(&WorldSocket::InitializeHandler);
@@ -688,6 +688,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
hmac.UpdateData(AuthCheckSeed, 16);
hmac.Finalize();
// Check that Key and account name are the same on client and server
if (memcmp(hmac.GetDigest(), authSession->Digest.data(), authSession->Digest.size()) != 0)
{
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", account.Game.Id, authSession->RealmJoinTicket.c_str(), address.c_str());
@@ -708,8 +709,6 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
BigNumber K;
K.SetBinary(sessionKey, 40);
// Check that Key and account name are the same on client and server
// only do this after verifying credentials - no error message is better than bad encryption making the client crash
_authCrypt.Init(&K);
// As we don't know if attempted login process by ip works, we update last_attempt_ip right away
@@ -719,10 +718,15 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
LoginDatabase.Execute(stmt);
// This also allows to check for possible "hack" attempts on account
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_INFO_CONTINUED_SESSION);
stmt->setString(0, K.AsHexStr());
stmt->setUInt32(1, account.Game.Id);
LoginDatabase.Execute(stmt);
// First reject the connection if packet contains invalid data or realm state doesn't allow logging in
if (sWorld->IsClosed())
{
SendAuthResponseError(AUTH_REJECT);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteIpAddress().to_string().c_str());
DelayedCloseSocket();
return;
@@ -730,7 +734,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
if (authSession->RealmID != realm.Id.Realm)
{
SendAuthResponseError(REALM_LIST_REALM_NOT_FOUND);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.",
GetRemoteIpAddress().to_string().c_str(), authSession->RealmID, realm.Id.Realm);
DelayedCloseSocket();
@@ -741,7 +745,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
bool wardenActive = sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED);
if (wardenActive && account.Game.OS != "Win" && account.Game.OS != "Wn64" && account.Game.OS != "Mc64")
{
SendAuthResponseError(AUTH_REJECT);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), account.Game.OS.c_str());
DelayedCloseSocket();
return;
@@ -752,7 +756,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
{
if (account.BattleNet.LastIP != address)
{
SendAuthResponseError(AUTH_FAILED);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", account.BattleNet.LastIP.c_str(), address.c_str());
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
sScriptMgr->OnFailedAccountLogin(account.Game.Id);
@@ -764,7 +768,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
{
if (account.BattleNet.LockCountry != _ipCountry)
{
SendAuthResponseError(AUTH_FAILED);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.BattleNet.LockCountry.c_str(), _ipCountry.c_str());
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
sScriptMgr->OnFailedAccountLogin(account.Game.Id);
@@ -787,7 +791,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
if (account.IsBanned())
{
SendAuthResponseError(AUTH_BANNED);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
sScriptMgr->OnFailedAccountLogin(account.Game.Id);
DelayedCloseSocket();
@@ -799,7 +803,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
TC_LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, account.Game.Security);
if (allowedAccountType > SEC_PLAYER && account.Game.Security < allowedAccountType)
{
SendAuthResponseError(AUTH_UNAVAILABLE);
SendAuthResponseError(ERROR_DENIED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
sScriptMgr->OnFailedAccountLogin(account.Game.Id);
DelayedCloseSocket();
@@ -821,12 +825,12 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
_authed = true;
_worldSession = new WorldSession(account.Game.Id, std::move(authSession->RealmJoinTicket), account.BattleNet.Id, shared_from_this(), account.Game.Security,
account.Game.Expansion, mutetime, account.BattleNet.Locale, account.Game.Recruiter, account.Game.IsRectuiter);
account.Game.Expansion, mutetime, account.Game.OS, account.BattleNet.Locale, account.Game.Recruiter, account.Game.IsRectuiter);
_worldSession->ReadAddonsInfo(authSession->AddonInfo);
// Initialize Warden system only if it is enabled by config
if (wardenActive)
_worldSession->InitWarden(&account.Game.SessionKey, account.Game.OS);
_worldSession->InitWarden(&account.Game.SessionKey);
_queryCallback = std::bind(&WorldSocket::LoadSessionPermissionsCallback, this, std::placeholders::_1);
_queryFuture = _worldSession->LoadPermissionsAsync();
@@ -849,7 +853,7 @@ void WorldSocket::HandleAuthContinuedSession(std::shared_ptr<WorldPackets::Auth:
_type = ConnectionType(key.Fields.ConnectionType);
if (_type != CONNECTION_TYPE_INSTANCE)
{
SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT);
SendAuthResponseError(ERROR_DENIED);
DelayedCloseSocket();
return;
}
@@ -869,7 +873,7 @@ void WorldSocket::HandleAuthContinuedSessionCallback(std::shared_ptr<WorldPacket
{
if (!result)
{
SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT);
SendAuthResponseError(ERROR_DENIED);
DelayedCloseSocket();
return;
}
@@ -894,7 +898,6 @@ void WorldSocket::HandleAuthContinuedSessionCallback(std::shared_ptr<WorldPacket
if (memcmp(hmac.GetDigest(), authSession->Digest.data(), authSession->Digest.size()))
{
SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthContinuedSession: Authentication failed for account: %u ('%s') address: %s", accountId, login.c_str(), GetRemoteIpAddress().to_string().c_str());
DelayedCloseSocket();
return;
@@ -942,7 +945,7 @@ void WorldSocket::HandleConnectToFailed(WorldPackets::Auth::ConnectToFailed& con
}
}
void WorldSocket::SendAuthResponseError(uint8 code)
void WorldSocket::SendAuthResponseError(uint32 code)
{
WorldPackets::Auth::AuthResponse response;
response.Result = code;

View File

@@ -94,7 +94,7 @@ public:
ConnectionType GetConnectionType() const { return _type; }
void SendAuthResponseError(uint8 code);
void SendAuthResponseError(uint32 code);
void SetWorldSession(WorldSession* session);
protected:

View File

@@ -27,6 +27,7 @@
#include "AuctionHouseMgr.h"
#include "BattlefieldMgr.h"
#include "BattlegroundMgr.h"
#include "BattlenetRpcErrorCodes.h"
#include "BattlePetMgr.h"
#include "CalendarMgr.h"
#include "Channel.h"
@@ -319,7 +320,7 @@ void World::ProcessLinkInstanceSocket(std::pair<std::weak_ptr<WorldSocket>, uint
WorldSession* session = FindSession(uint32(key.Fields.AccountId));
if (!session || session->GetConnectToInstanceKey() != linkInfo.second)
{
sock->SendAuthResponseError(AUTH_SESSION_EXPIRED);
sock->SendAuthResponseError(ERROR_TIMED_OUT);
sock->DelayedCloseSocket();
return;
}
@@ -369,7 +370,7 @@ void World::AddQueuedPlayer(WorldSession* sess)
m_QueuedPlayer.push_back(sess);
// The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
sess->SendAuthResponse(AUTH_WAIT_QUEUE, true, GetQueuePos(sess));
sess->SendAuthResponse(ERROR_OK, true, GetQueuePos(sess));
}
bool World::RemoveQueuedPlayer(WorldSession* sess)

View File

@@ -448,20 +448,6 @@ enum Rates
MAX_RATES
};
/// Can be used in SMSG_AUTH_RESPONSE packet
enum BillingPlanFlags
{
SESSION_NONE = 0x00,
SESSION_UNUSED = 0x01,
SESSION_RECURRING_BILL = 0x02,
SESSION_FREE_TRIAL = 0x04,
SESSION_IGR = 0x08,
SESSION_USAGE = 0x10,
SESSION_TIME_MIXTURE = 0x20,
SESSION_RESTRICTED = 0x40,
SESSION_ENABLE_CAIS = 0x80
};
enum RealmZone
{
REALM_ZONE_UNKNOWN = 0, // any language

View File

@@ -31,6 +31,12 @@ RealmList::~RealmList()
delete _updateTimer;
}
RealmList* RealmList::Instance()
{
static RealmList instance;
return &instance;
}
// Load the realm list from the database
void RealmList::Initialize(boost::asio::io_service& ioService, uint32 updateInterval)
{

View File

@@ -34,11 +34,7 @@ class TC_SHARED_API RealmList
public:
typedef std::map<Battlenet::RealmHandle, Realm> RealmMap;
static RealmList* instance()
{
static RealmList instance;
return &instance;
}
static RealmList* Instance();
~RealmList();
@@ -61,5 +57,5 @@ private:
boost::asio::ip::tcp::resolver* _resolver;
};
#define sRealmList RealmList::instance()
#define sRealmList RealmList::Instance()
#endif