aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2023-11-16 10:32:27 +0100
committerOvahlord <dreadkiller@gmx.de>2023-11-16 10:51:59 +0100
commit9dd8ced81c21af34c3b578b66768f04701b23a44 (patch)
tree76b29dcc69e335b87df3e05fceff9429237a8e68 /src
parent59af16fd047fe3f5c2857b1a17705f0ddc9e6a1d (diff)
Core/Players: fixed structure of CMSG_SET_ACTION_BUTTON and downgraded player actions
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 f17561bd77b..46554a6f506 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -6120,7 +6120,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)
{
@@ -6196,7 +6196,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;
@@ -17713,7 +17713,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))
@@ -19505,7 +19505,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);
@@ -19514,7 +19514,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 2fd292adc0d..bc583322569 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -304,9 +304,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
{
@@ -317,10 +317,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 = action | (uint32(type) << 24);
if (newData != packedData || uState == ACTIONBUTTON_DELETED)
{
packedData = newData;
@@ -330,7 +330,7 @@ struct ActionButton
}
};
-#define MAX_ACTION_BUTTONS 180
+#define MAX_ACTION_BUTTONS 180 //checked in 3.4.3
typedef std::map<uint8, ActionButton> ActionButtonList;
@@ -1903,12 +1903,12 @@ class TC_GAME_API Player : 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 40a1626edb4..7f230a2bb8f 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 bc0e8a6f24b..8b882666a91 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 uint16 (action and type)
uint8 Index = 0;
};