From 002a2fc5fc124b67b94048bc94a8eaeef36e8d77 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 27 Oct 2008 09:08:25 +0300 Subject: [PATCH] Fixed SMSG_TRANSFER_ABORT opcode --- src/game/MapManager.cpp | 3 ++- src/game/MiscHandler.cpp | 2 +- src/game/Player.cpp | 14 +++++++++++--- src/game/Player.h | 19 ++++++++++--------- src/game/World.cpp | 8 ++++---- src/game/WorldSocket.cpp | 6 +++--- src/game/debugcmds.cpp | 4 ++-- 7 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index a8d897bad..d8a628978 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -173,7 +173,8 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) //The player has a heroic mode and tries to enter into instance which has no a heroic mode if (!entry->SupportsHeroicMode() && player->GetDifficulty() == DIFFICULTY_HEROIC) { - player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY2); //Send aborted message + //Send aborted message + player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, DIFFICULTY_HEROIC); return false; } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 89c6fb1c7..b45384424 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1054,7 +1054,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if(missingItem) SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); else if(missingKey) - GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY2); + GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, DIFFICULTY_HEROIC); else if(missingQuest) SendAreaTriggerMessage(at->requiredFailedText.c_str()); else if(missingLevel) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 72da1740f..2a83ed57a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1464,7 +1464,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if(GetTransport()) RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :) - SendTransferAborted(mapid, TRANSFER_ABORT_INSUF_EXPAN_LVL1); + SendTransferAborted(mapid, TRANSFER_ABORT_INSUF_EXPAN_LVL, mEntry->Expansion()); return false; // normal client can't teleport to this map... } @@ -17521,11 +17521,19 @@ void Player::SendUpdateToOutOfRangeGroupMembers() pet->ResetAuraUpdateMask(); } -void Player::SendTransferAborted(uint32 mapid, uint16 reason) +void Player::SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg) { WorldPacket data(SMSG_TRANSFER_ABORTED, 4+2); data << uint32(mapid); - data << uint16(reason); // transfer abort reason + data << uint8(reason); // transfer abort reason + switch(reason) + { + case TRANSFER_ABORT_INSUF_EXPAN_LVL: + case TRANSFER_ABORT_DIFFICULTY: + case TRANSFER_ABORT_UNIQUE_MESSAGE: + data << uint8(arg); + break; + } GetSession()->SendPacket(&data); } diff --git a/src/game/Player.h b/src/game/Player.h index f1d9d0cec..d026143d1 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -710,14 +710,15 @@ enum TradeSlots enum TransferAbortReason { - TRANSFER_ABORT_MAX_PLAYERS = 0x0001, // Transfer Aborted: instance is full - TRANSFER_ABORT_NOT_FOUND = 0x0002, // Transfer Aborted: instance not found - TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x0003, // You have entered too many instances recently. - TRANSFER_ABORT_ZONE_IN_COMBAT = 0x0005, // Unable to zone in while an encounter is in progress. - TRANSFER_ABORT_INSUF_EXPAN_LVL1 = 0x0106, // You must have TBC expansion installed to access this area. - TRANSFER_ABORT_DIFFICULTY1 = 0x0007, // Normal difficulty mode is not available for %s. - TRANSFER_ABORT_DIFFICULTY2 = 0x0107, // Heroic difficulty mode is not available for %s. - TRANSFER_ABORT_DIFFICULTY3 = 0x0207 // Epic difficulty mode is not available for %s. + TRANSFER_ABORT_ERROR = 0x00, + TRANSFER_ABORT_MAX_PLAYERS = 0x01, // Transfer Aborted: instance is full + TRANSFER_ABORT_NOT_FOUND = 0x02, // Transfer Aborted: instance not found + TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x03, // You have entered too many instances recently. + TRANSFER_ABORT_ZONE_IN_COMBAT = 0x05, // Unable to zone in while an encounter is in progress. + TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x06, // You must have expansion installed to access this area. + TRANSFER_ABORT_DIFFICULTY = 0x07, // difficulty mode is not available for %s. + TRANSFER_ABORT_UNIQUE_MESSAGE = 0x08, // Until you've escaped TLK's grasp, you cannot leave this place! + TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x09 // Additional instances cannot be launched, please try again later. }; enum InstanceResetWarningType @@ -949,7 +950,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendInitialPacketsBeforeAddToMap(); void SendInitialPacketsAfterAddToMap(); - void SendTransferAborted(uint32 mapid, uint16 reason); + void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0); void SendInstanceResetWarning(uint32 mapid, uint32 time); bool CanInteractWithNPCs(bool alive = true) const; diff --git a/src/game/World.cpp b/src/game/World.cpp index 7cad831ef..f0b9ada8c 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -178,7 +178,7 @@ bool World::RemoveSession(uint32 id) void World::AddSession(WorldSession* s) { - addSessQueue.add(s); + addSessQueue.add(s); } void @@ -223,10 +223,10 @@ World::AddSession_ (WorldSession* s) WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1); packet << uint8 (AUTH_OK); - packet << uint32 (0); // unknown random value... + packet << uint32 (0); // unknown random value... packet << uint8 (0); packet << uint32 (0); - packet << uint8 (s->Expansion()); // 0 - normal, 1 - TBC, must be set in database manually for each account + packet << uint8 (s->Expansion()); // 0 - normal, 1 - TBC, must be set in database manually for each account s->SendPacket (&packet); UpdateMaxSessionCounters (); @@ -234,7 +234,7 @@ World::AddSession_ (WorldSession* s) // Updates the population if (pLimit > 0) { - float popu = GetActiveSessionCount (); //updated number of users on the server + float popu = GetActiveSessionCount (); // updated number of users on the server popu /= pLimit; popu *= 2; loginDatabase.PExecute ("UPDATE realmlist SET population = '%f' WHERE id = '%d'", popu, realmID); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 31ce36130..e8b11cb99 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -713,7 +713,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) Field* fields = result->Fetch (); - expansion = fields[8].GetUInt8 () && sWorld.getConfig (CONFIG_EXPANSION) > 0; + expansion = ((sWorld.getConfig(CONFIG_EXPANSION) > fields[8].GetUInt8()) ? fields[8].GetUInt8() : sWorld.getConfig(CONFIG_EXPANSION)); N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); g.SetDword (7); @@ -735,8 +735,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) x.SetBinary (sha1.GetDigest (), sha1.GetLength ()); v = g.ModExp (x, N); - const char* sStr = s.AsHexStr (); //Must be freed by OPENSSL_free() - const char* vStr = v.AsHexStr (); //Must be freed by OPENSSL_free() + const char* sStr = s.AsHexStr (); //Must be freed by OPENSSL_free() + const char* vStr = v.AsHexStr (); //Must be freed by OPENSSL_free() const char* vold = fields[6].GetString (); DEBUG_LOG ("WorldSocket::HandleAuthSession: (s,v) check s: %s v_old: %s v_new: %s", diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index d7a97447f..02f883d20 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -148,9 +148,9 @@ bool ChatHandler::HandleSendOpcodeCommand(const char* args) if(type == "uint8") { - uint8 val1; + uint16 val1; ifs >> val1; - data << val1; + data << uint8(val1); } else if(type == "uint16") {