Beispiel #1
0
        private void onInteractButton(InputEventMouse e, AEntity overEntity, Vector2 overEntityPoint)
        {
            if (e.EventType == MouseEvent.Down)
            {
                // prepare to pick this item up.
                m_DraggingEntity = overEntity;
                m_dragOffset     = overEntityPoint;
            }
            else if (e.EventType == MouseEvent.Click)
            {
                if (overEntity is Ground)
                {
                    // no action.
                }
                else if (overEntity is StaticItem)
                {
                    // pop up name of item.
                    overEntity.AddOverhead(MessageTypes.Label, overEntity.Name, 3, 0, false);
                    WorldModel.Statics.AddStaticThatNeedsUpdating(overEntity as StaticItem);
                }
                else if (overEntity is Item)
                {
                    // request context menu
                    World.Interaction.SingleClick(overEntity);
                }
                else if (overEntity is Mobile)
                {
                    // request context menu
                    World.Interaction.SingleClick(overEntity);
                }
            }
            else if (e.EventType == MouseEvent.DoubleClick)
            {
                if (overEntity is Ground)
                {
                    // no action.
                }
                else if (overEntity is StaticItem)
                {
                    // no action.
                }
                else if (overEntity is Item)
                {
                    // request context menu
                    World.Interaction.DoubleClick(overEntity);
                }
                else if (overEntity is Mobile)
                {
                    // Send double click packet.
                    // Set LastTarget == targeted Mobile.
                    // If in WarMode, set Attacking == true.
                    World.Interaction.DoubleClick(overEntity);
                    World.Interaction.LastTarget = overEntity.Serial;

                    if (WorldModel.Entities.GetPlayerEntity().Flags.IsWarMode)
                    {
                        m_Network.Send(new AttackRequestPacket(overEntity.Serial));
                    }
                }
            }
            else if (e.EventType == MouseEvent.DragBegin)
            {
                if (overEntity is Ground)
                {
                    // no action.
                }
                else if (overEntity is StaticItem)
                {
                    // no action.
                }
                else if (overEntity is Item)
                {
                    // attempt to pick up item.
                    World.Interaction.PickupItem((Item)overEntity, new Point((int)m_dragOffset.X, (int)m_dragOffset.Y));
                }
                else if (overEntity is Mobile)
                {
                    // request basic stats - gives us the name rename flag
                    m_Network.Send(new MobileQueryPacket(MobileQueryPacket.StatusType.BasicStatus, overEntity.Serial));
                    // drag off a status gump for this mobile.
                    MobileHealthTrackerGump gump = new MobileHealthTrackerGump(overEntity as Mobile);
                    m_UserInterface.AddControl(gump, e.X - 77, e.Y - 30);
                    m_UserInterface.AttemptDragControl(gump, new Point(e.X, e.Y), true);
                }
            }

            e.Handled = true;
        }
Beispiel #2
0
        void onInteractButton(InputEventMouse e, AEntity overEntity, Vector2Int overEntityPoint)
        {
            if (e.EventType == MouseEvent.Down)
            {
                // prepare to pick this item up.
                _draggingEntity = overEntity;
                m_DragOffset    = overEntityPoint;
            }
            else if (e.EventType == MouseEvent.Click)
            {
                if (overEntity is Ground)
                {
                }                             // no action.
                else if (overEntity is StaticItem)
                {
                    // pop up name of item.
                    overEntity.AddOverhead(MessageTypes.Label, overEntity.Name, 3, 0, false);
                    WorldModel.Statics.AddStaticThatNeedsUpdating(overEntity as StaticItem);
                }
                else if (overEntity is Item)
                {
                    World.Interaction.SingleClick(overEntity);
                }
                else if (overEntity is Mobile)
                {
                    World.Interaction.SingleClick(overEntity);
                }
            }
            else if (e.EventType == MouseEvent.DoubleClick)
            {
                if (overEntity is Ground)
                {
                }                             // no action.
                else if (overEntity is StaticItem)
                {
                }                                      // no action.
                else if (overEntity is Item)
                {
                    World.Interaction.DoubleClick(overEntity);                          // request context menu
                }
                else if (overEntity is Mobile)
                {
                    // Send double click packet.
                    // Set LastTarget == targeted Mobile.
                    // If in WarMode, set Attacking == true.
                    var mobile = overEntity as Mobile;
                    World.Interaction.LastTarget = overEntity.Serial;
                    if (WorldModel.Entities.GetPlayerEntity().Flags.IsWarMode)
                    {
                        World.Interaction.AttackRequest(mobile);
                    }
                    else
                    {
                        World.Interaction.DoubleClick(overEntity);
                    }
                }
            }
            else if (e.EventType == MouseEvent.DragBegin)
            {
                if (overEntity is Ground)
                {
                }                             // no action.
                else if (overEntity is StaticItem)
                {
                }                                      // no action.
                else if (overEntity is Item)
                {
                    World.Interaction.PickupItem((Item)overEntity, new Vector2Int((int)m_DragOffset.x, (int)m_DragOffset.y));                          // attempt to pick up item.
                }
                else if (overEntity is Mobile)
                {
                    if (PlayerState.Partying.GetMember(overEntity.Serial) != null)//is he in your party// number of 0x11 packet dont have information about stamina/mana k(IMPORTANT!!!)
                    {
                        return;
                    }
                    // request basic stats - gives us the name rename flag
                    _network.Send(new MobileQueryPacket(MobileQueryPacket.StatusType.BasicStatus, overEntity.Serial));
                    // drag off a status gump for this mobile.
                    var gump = new MobileHealthTrackerGump(overEntity as Mobile);
                    _userInterface.AddControl(gump, e.X - 77, e.Y - 30);
                    _userInterface.AttemptDragControl(gump, new Vector2Int(e.X, e.Y), true);
                }
            }

            e.Handled = true;
        }