feat(Core/Packet): CMSG_SET_SHEATHED

This commit is contained in:
IntelligentQuantum
2022-03-11 20:42:21 +03:30
committed by GitHub
parent a775ddcb5b
commit 1f90a18a58
8 changed files with 78 additions and 11 deletions

View File

@@ -16,6 +16,7 @@
*/
#include "CreatureAI.h"
#include "CombatPackets.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectDefines.h"
@@ -70,18 +71,15 @@ void WorldSession::HandleAttackStopOpcode(WorldPacket& /*recvData*/)
GetPlayer()->AttackStop();
}
void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData)
void WorldSession::HandleSetSheathedOpcode(WorldPackets::Combat::SetSheathed& packet)
{
uint32 sheathed;
recvData >> sheathed;
if (sheathed >= MAX_SHEATH_STATE)
if (packet.CurrentSheathState >= MAX_SHEATH_STATE)
{
LOG_ERROR("network.opcode", "Unknown sheath state {} ??", sheathed);
LOG_ERROR("network.opcode", "Unknown sheath state {} ??", packet.CurrentSheathState);
return;
}
GetPlayer()->SetSheath(SheathState(sheathed));
_player->SetSheath(SheathState(packet.CurrentSheathState));
}
void WorldSession::SendAttackStop(Unit const* enemy)

View File

@@ -24,6 +24,7 @@
#include "ChatPackets.h"
#include "PetPackets.h"
#include "CombatLogPackets.h"
#include "CombatPackets.h"
#include "GuildPackets.h"
#include "MiscPackets.h"
#include "TotemPackets.h"

View File

@@ -0,0 +1,23 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CombatPackets.h"
void WorldPackets::Combat::SetSheathed::Read()
{
_worldPacket >> CurrentSheathState;
}

View File

@@ -0,0 +1,40 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CombatPackets_h__
#define CombatPackets_h__
#include "Packet.h"
#include "ObjectGuid.h"
namespace WorldPackets
{
namespace Combat
{
class SetSheathed final : public ClientPacket
{
public:
SetSheathed(WorldPacket&& packet) : ClientPacket(CMSG_SET_SHEATHED, std::move(packet)) { }
void Read() override;
uint32 CurrentSheathState = 0;
};
}
}
#endif // CombatPackets_h__

View File

@@ -608,7 +608,7 @@ void OpcodeTable::Initialize()
/*0x1DD*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PONG, STATUS_NEVER);
/*0x1DE*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWN, STATUS_NEVER);
/*0x1DF*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_GAMEOBJECT_PAGETEXT, STATUS_NEVER);
/*0x1E0*/ DEFINE_HANDLER(CMSG_SETSHEATHED, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleSetSheathedOpcode );
/*0x1E0*/ DEFINE_HANDLER(CMSG_SET_SHEATHED, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleSetSheathedOpcode );
/*0x1E1*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_COOLDOWN_CHEAT, STATUS_NEVER);
/*0x1E2*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_DELAYED, STATUS_NEVER);
/*0x1E3*/ DEFINE_HANDLER(CMSG_QUEST_POI_QUERY, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestPOIQuery );

View File

@@ -507,7 +507,7 @@ enum Opcodes : uint16
SMSG_PONG = 0x1DD,
SMSG_CLEAR_COOLDOWN = 0x1DE,
SMSG_GAMEOBJECT_PAGETEXT = 0x1DF,
CMSG_SETSHEATHED = 0x1E0,
CMSG_SET_SHEATHED = 0x1E0,
SMSG_COOLDOWN_CHEAT = 0x1E1,
SMSG_SPELL_DELAYED = 0x1E2,
CMSG_QUEST_POI_QUERY = 0x1E3,

View File

@@ -1363,7 +1363,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
case CMSG_CORPSE_MAP_POSITION_QUERY: // 0 1
case CMSG_MOVE_TIME_SKIPPED: // 0 1
case MSG_QUERY_NEXT_MAIL_TIME: // 0 1
case CMSG_SETSHEATHED: // 0 1
case CMSG_SET_SHEATHED: // 0 1
case MSG_RAID_TARGET_UPDATE: // 0 1
case CMSG_PLAYER_LOGOUT: // 0 1
case CMSG_LOGOUT_REQUEST: // 0 1

View File

@@ -104,6 +104,11 @@ namespace WorldPackets
class BuyBankSlot;
}
namespace Combat
{
class SetSheathed;
}
namespace Guild
{
class QueryGuildInfo;
@@ -794,7 +799,7 @@ public: // opcodes handlers
void HandleAttackSwingOpcode(WorldPacket& recvPacket);
void HandleAttackStopOpcode(WorldPacket& recvPacket);
void HandleSetSheathedOpcode(WorldPacket& recvPacket);
void HandleSetSheathedOpcode(WorldPackets::Combat::SetSheathed& packet);
void HandleUseItemOpcode(WorldPacket& recvPacket);
void HandleOpenItemOpcode(WorldPacket& recvPacket);