aboutsummaryrefslogtreecommitdiff
path: root/src/game/MiscHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/MiscHandler.cpp')
-rw-r--r--src/game/MiscHandler.cpp53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index f5a1013f085..3ba7f81a8c2 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1040,40 +1040,41 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
CHECK_PACKET_SIZE(recv_data,1+2+1+1);
sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" );
- uint8 button, misc, type;
- uint16 action;
- recv_data >> button >> action >> misc >> type;
- sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u MISC: %u", button, action, type, misc );
- if(action==0)
+ uint8 button;
+ uint32 packetData;
+ recv_data >> button >> packetData;
+
+ uint32 action = ACTION_BUTTON_ACTION(packetData);
+ uint8 type = ACTION_BUTTON_TYPE(packetData);
+
+ sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u", button, action, type );
+ if (!packetData)
{
sLog.outDetail( "MISC: Remove action from button %u", button );
-
GetPlayer()->removeActionButton(button);
}
else
{
- if(type==ACTION_BUTTON_MACRO || type==ACTION_BUTTON_CMACRO)
- {
- sLog.outDetail( "MISC: Added Macro %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
- }
- else if(type==ACTION_BUTTON_EQSET)
- {
- sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
- }
- else if(type==ACTION_BUTTON_SPELL)
+ switch(type)
{
- sLog.outDetail( "MISC: Added Spell %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
- }
- else if(type==ACTION_BUTTON_ITEM)
- {
- sLog.outDetail( "MISC: Added Item %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
+ case ACTION_BUTTON_MACRO:
+ case ACTION_BUTTON_CMACRO:
+ sLog.outDetail( "MISC: Added Macro %u into button %u", action, button );
+ break;
+ case ACTION_BUTTON_EQSET:
+ sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button );
+ break;
+ case ACTION_BUTTON_SPELL:
+ sLog.outDetail( "MISC: Added Spell %u into button %u", action, button );
+ break;
+ case ACTION_BUTTON_ITEM:
+ sLog.outDetail( "MISC: Added Item %u into button %u", action, button );
+ break;
+ default:
+ sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button );
+ return;
}
- else
- sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button );
+ GetPlayer()->addActionButton(button,action,type);
}
}