aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-03-19 20:08:00 +0100
committerOvahlord <dreadkiller@gmx.de>2024-03-19 20:08:00 +0100
commit88ff1e7cff39675b6433d156715cff772314a2d1 (patch)
tree0f7bb866712f68981ab9e8681d1dc43cf07f42af /src
parentcc6fb985954d54ecb95c64f3c174fa78a18dbe30 (diff)
Core/Packets: fixed CMSG_SET_ACTION_BUTTON packet structure and downgraded player actions for classic
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp10
-rw-r--r--src/server/game/Entities/Player/Player.h18
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp4
-rw-r--r--src/server/game/Server/Packets/SpellPackets.h2
4 files changed, 17 insertions, 17 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index fb2b8c0d78e..3c02bd2371d 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -6065,7 +6065,7 @@ void Player::SendActionButtons(uint32 state) const
SendDirectMessage(packet.Write());
}
-bool Player::IsActionButtonDataValid(uint8 button, uint64 action, uint8 type) const
+bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) const
{
if (button >= MAX_ACTION_BUTTONS)
{
@@ -6141,7 +6141,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint64 action, uint8 type) co
return true;
}
-ActionButton* Player::AddActionButton(uint8 button, uint64 action, uint8 type)
+ActionButton* Player::AddActionButton(uint8 button, uint32 action, uint8 type)
{
if (!IsActionButtonDataValid(button, action, type))
return nullptr;
@@ -18205,7 +18205,7 @@ void Player::_LoadActions(PreparedQueryResult result)
{
Field* fields = result->Fetch();
uint8 button = fields[0].GetUInt8();
- uint64 action = fields[1].GetUInt64();
+ uint32 action = fields[1].GetUInt32();
uint8 type = fields[2].GetUInt8();
if (ActionButton* ab = AddActionButton(button, action, type))
@@ -19999,7 +19999,7 @@ void Player::_SaveActions(CharacterDatabaseTransaction trans)
stmt->setUInt8(1, GetActiveTalentGroup());
stmt->setInt32(2, traitConfigId);
stmt->setUInt8(3, itr->first);
- stmt->setUInt64(4, itr->second.GetAction());
+ stmt->setUInt32(4, itr->second.GetAction());
stmt->setUInt8(5, uint8(itr->second.GetType()));
trans->Append(stmt);
@@ -20008,7 +20008,7 @@ void Player::_SaveActions(CharacterDatabaseTransaction trans)
break;
case ACTIONBUTTON_CHANGED:
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACTION);
- stmt->setUInt64(0, itr->second.GetAction());
+ stmt->setUInt32(0, itr->second.GetAction());
stmt->setUInt8(1, uint8(itr->second.GetType()));
stmt->setUInt64(2, GetGUID().GetCounter());
stmt->setUInt8(3, itr->first);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index f8079305193..8b496f0bb0f 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -310,9 +310,9 @@ enum ReputationSource
REPUTATION_SOURCE_SPELL
};
-#define ACTION_BUTTON_ACTION(X) (uint64(X) & 0x00FFFFFFFFFFFFFF)
-#define ACTION_BUTTON_TYPE(X) ((uint64(X) & 0xFF00000000000000) >> 56)
-#define MAX_ACTION_BUTTON_ACTION_VALUE UI64LIT(0xFFFFFFFFFFFFFF)
+#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
+#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
+#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
struct ActionButton
{
@@ -323,10 +323,10 @@ struct ActionButton
// helpers
ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); }
- uint64 GetAction() const { return ACTION_BUTTON_ACTION(packedData); }
- void SetActionAndType(uint64 action, ActionButtonType type)
+ uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); }
+ void SetActionAndType(uint32 action, ActionButtonType type)
{
- uint64 newData = uint64(action) | (uint64(type) << 56);
+ uint32 newData = uint32(action) | (uint32(type) << 24);
if (newData != packedData || uState == ACTIONBUTTON_DELETED)
{
packedData = newData;
@@ -336,7 +336,7 @@ struct ActionButton
}
};
-#define MAX_ACTION_BUTTONS 180
+#define MAX_ACTION_BUTTONS 180 //checked in 4.4.0
typedef std::map<uint8, ActionButton> ActionButtonList;
@@ -1918,12 +1918,12 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
uint32 GetMovie() const { return m_movie; }
void SetMovie(uint32 movie) { m_movie = movie; }
- ActionButton* AddActionButton(uint8 button, uint64 action, uint8 type);
+ ActionButton* AddActionButton(uint8 button, uint32 action, uint8 type);
void RemoveActionButton(uint8 button);
ActionButton const* GetActionButton(uint8 button);
void SendInitialActionButtons() const { SendActionButtons(0); }
void SendActionButtons(uint32 state) const;
- bool IsActionButtonDataValid(uint8 button, uint64 action, uint8 type) const;
+ bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) const;
void SetMultiActionBars(uint8 mask) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::MultiActionBars), mask); }
PvPInfo pvpInfo;
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index fcb0ed610ed..d67c146c2f2 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -748,8 +748,8 @@ void WorldSession::HandleRequestAccountData(WorldPackets::ClientConfig::RequestA
void WorldSession::HandleSetActionButtonOpcode(WorldPackets::Spells::SetActionButton& packet)
{
- uint64 action = ACTION_BUTTON_ACTION(packet.Action);
- uint8 type = ACTION_BUTTON_TYPE(packet.Action);
+ uint32 action = ACTION_BUTTON_ACTION(packet.Action);
+ uint32 type = ACTION_BUTTON_TYPE(packet.Action);
TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: {} Action: {} Type: {}", packet.Index, action, uint32(type));
diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h
index 4d874db30cf..357487f92e4 100644
--- a/src/server/game/Server/Packets/SpellPackets.h
+++ b/src/server/game/Server/Packets/SpellPackets.h
@@ -141,7 +141,7 @@ namespace WorldPackets
void Read() override;
- uint64 Action = 0; ///< two packed values (action and type)
+ uint32 Action = 0; ///< two packed values (action and type)
uint8 Index = 0;
};