public static void HandleSetActionButton(ref PacketReader packet, ref WorldClass session) { var pChar = session.Character; byte[] actionMask = { 4, 0, 3, 7, 1, 6, 2, 5 }; byte[] actionBytes = { 3, 0, 1, 4, 7, 2, 6, 5 }; var slotId = packet.ReadByte(); BitUnpack actionUnpacker = new BitUnpack(packet); var actionId = actionUnpacker.GetValue(actionMask, actionBytes); if (actionId == 0) { var action = pChar.ActionButtons.Where(button => button.SlotId == slotId && button.SpecGroup == pChar.ActiveSpecGroup).Select(button => button).First(); ActionMgr.RemoveActionButton(pChar, action, true); Log.Message(LogType.DEBUG, "Character (Guid: {0}) removed action button {1} from slot {2}.", pChar.Guid, actionId, slotId); return; } var newAction = new ActionButton { Action = actionId, SlotId = slotId, SpecGroup = pChar.ActiveSpecGroup }; ActionMgr.AddActionButton(pChar, newAction, true); Log.Message(LogType.DEBUG, "Character (Guid: {0}) added action button {1} to slot {2}.", pChar.Guid, actionId, slotId); }