Ejemplo n.º 1
0
 private void HanldeServerTargetCursorPacket(TargetCursorPacket packet)
 {
     targetFromServerReceivedEvent.Set();
     lastCursorId = packet.CursorId;
     lastTargetCursorPacketTime = DateTime.UtcNow;
     eventSource.Publish(new ServerRequestedTargetEvent(packet.CursorId));
 }
Ejemplo n.º 2
0
        public static unsafe CursorHandle LoadCursor(CursorId id)
        {
            HCURSOR handle = Imports.LoadCursorW(ModuleInstance.Null, (char *)(uint)id);

            if (handle.IsInvalid)
            {
                Error.ThrowLastError(id.ToString());
            }

            return(new CursorHandle(handle, ownsHandle: false));
        }
Ejemplo n.º 3
0
        public static unsafe CursorHandle LoadCursor(CursorId id)
        {
            HCURSOR handle = Imports.LoadCursorW(ModuleInstance.Null, (char *)(uint)id);

            if (handle.IsInvalid)
            {
                throw Error.GetExceptionForLastError();
            }

            return(new CursorHandle(handle, ownsHandle: false));
        }
Ejemplo n.º 4
0
        public static CursorHandle LoadCursor(CursorId id)
        {
            CursorHandle handle = Imports.LoadCursorW(ModuleInstance.Null, (IntPtr)id);

            if (handle.IsInvalid)
            {
                throw Errors.GetIoExceptionForLastError();
            }

            return(handle);
        }
Ejemplo n.º 5
0
        public TargetCursorPacket(CursorTarget cursorTarget, CursorId cursorId, CursorType cursorType)
        {
            CursorTarget = cursorTarget;
            CursorId     = cursorId;
            CursorType   = cursorType;
            byte[] payload = new byte[19];
            var    writer  = new ArrayPacketWriter(payload);

            writer.WriteByte((byte)PacketDefinitions.TargetCursor.Id);
            writer.WriteByte((byte)cursorTarget);
            writer.WriteUInt(cursorId.Value);
            writer.WriteByte((byte)cursorType);

            rawPacket = new Packet(PacketDefinitions.TargetCursor.Id, payload);
        }
Ejemplo n.º 6
0
        public TargetLocationRequest(CursorId cursorId, Location3D location, ModelId tileType, CursorType cursorType)
        {
            var payload = new byte[19];
            var writer  = new ArrayPacketWriter(payload);

            writer.WriteByte((byte)PacketDefinitions.TargetCursor.Id);
            writer.WriteByte((byte)CursorTarget.Location);
            writer.WriteUInt(cursorId.Value);
            writer.WriteByte((byte)cursorType);
            writer.WriteInt(0); // clicked on item = 0 (using location click)
            writer.WriteUShort((ushort)location.X);
            writer.WriteUShort((ushort)location.Y);
            writer.WriteByte(0); // unknown
            writer.WriteSByte((sbyte)location.Z);
            writer.WriteModelId(tileType);

            RawPacket = new Packet(PacketDefinitions.TargetCursor.Id, payload);
        }
Ejemplo n.º 7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (CursorId != 0)
            {
                hash ^= CursorId.GetHashCode();
            }
            if (FetchRows != 0UL)
            {
                hash ^= FetchRows.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 8
0
        public TargetLocationRequest(CursorId cursorId, ObjectId itemId, CursorType cursorType, Location3D location,
                                     ModelId itemType)
        {
            var payload = new byte[19];

            var writer = new ArrayPacketWriter(payload);

            writer.WriteByte((byte)PacketDefinitions.TargetCursor.Id);
            writer.WriteByte((byte)CursorTarget.Object);
            writer.WriteUInt(cursorId.Value);
            writer.WriteByte((byte)cursorType);
            writer.WriteId(itemId);
            writer.WriteUShort((ushort)location.X);
            writer.WriteUShort((ushort)location.Y);
            writer.WriteByte(0); // unknown
            writer.WriteSByte((sbyte)location.Z);
            writer.WriteModelId(itemType);

            RawPacket = new Packet(PacketDefinitions.TargetCursor.Id, payload);
        }
Ejemplo n.º 9
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);

            CursorTarget = (CursorTarget)reader.ReadByte();
            CursorId     = new CursorId(reader.ReadUInt());
            CursorType   = (CursorType)reader.ReadByte();
            ClickedOnId  = reader.ReadObjectId();

            ushort xloc    = reader.ReadUShort();
            ushort yloc    = reader.ReadUShort();
            byte   unknown = reader.ReadByte();
            sbyte  zloc    = reader.ReadSByte();

            Location = new Location3D(xloc, yloc, zloc);

            ClickedOnType = reader.ReadModelId();
        }
Ejemplo n.º 10
0
 public override void Visit(CursorId node) { this.action(node); }
 public override void ExplicitVisit(CursorId fragment)
 {
     _fragments.Add(fragment);
 }
Ejemplo n.º 12
0
 internal ServerRequestedTargetEvent(CursorId cursorId)
 {
     CursorId = cursorId;
 }
Ejemplo n.º 13
0
 private static void SetMouseCursor(CursorId cursorId)
 {
     IMouseCursor cursor = new MouseCursorClass();
     cursor.SetCursor((int) cursorId);
 }
Ejemplo n.º 14
0
 public static CursorHandle SetCursor(CursorId id) => ResourceMethods.SetCursor(ResourceMethods.LoadCursor(id));