public override void ActivateByButton(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Help:
                break;

            case Buttons.Options:
                break;

            case Buttons.LogOut:
                MsgBox g = m_UserInterface.MsgBox("Quit Ultima Online?", MsgBoxTypes.OkCancel);
                g.OnClose = logout_OnClose;
                break;

            case Buttons.Quests:
                break;

            case Buttons.Skills:
                m_UserInterface.AddControl(new SkillsGump(), 80, 80, UserInterfaceService.AddControlType.Toggle);
                break;

            case Buttons.Guild:
                break;

            case Buttons.PeaceWarToggle:
                m_World.Interaction.ToggleWarMode();
                break;

            case Buttons.Status:
                m_UserInterface.AddControl(new StatusGump(), 200, 400, UserInterfaceService.AddControlType.Toggle);
                break;
            }
        }
Example #2
0
        public Gump OpenContainerGump(AEntity entity) // used by ultimaclient.
        {
            Gump gump;

            if ((gump = (Gump)m_UserInterface.GetControl(entity.Serial)) != null)
            {
                gump.Dispose();
            }
            else
            {
                if (entity is Corpse)
                {
                    gump = new ContainerGump(entity, 0x2006);
                    m_UserInterface.AddControl(gump, 96, 96);
                }
                else if (entity is SpellBook)
                {
                    gump = new SpellbookGump((SpellBook)entity, ((Container)entity).ItemID);
                    m_UserInterface.AddControl(gump, 96, 96);
                }
                else
                {
                    gump = new ContainerGump(entity, ((Container)entity).ItemID);
                    m_UserInterface.AddControl(gump, 64, 64);
                }
            }
            return(gump);
        }
Example #3
0
        public override void ActivateByButton(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Map:
                m_UserInterface.AddControl(new MiniMap(), 566, 25, UserInterfaceService.AddControlType.Toggle);
                break;

            case Buttons.Paperdoll:
                m_UserInterface.AddControl(new PaperDollGump((Mobile)EntityManager.GetPlayerObject()), 400, 100, UserInterfaceService.AddControlType.Toggle);
                break;

            case Buttons.Inventory:
                // opens the player's backpack.
                PlayerMobile mobile   = (PlayerMobile)EntityManager.GetPlayerObject();
                Container    backpack = mobile.Backpack;
                m_World.Interaction.DoubleClick(backpack);
                break;

            case Buttons.Journal:
                m_UserInterface.AddControl(new JournalGump(), 80, 80, UserInterfaceService.AddControlType.Toggle);
                break;

            case Buttons.Chat:
                break;

            case Buttons.Help:
                break;

            case Buttons.Question:
                m_UserInterface.AddControl(new DebugGump(), 50, 50, UserInterfaceService.AddControlType.Toggle);
                break;
            }
        }
 public void LoginSequence()
 {
     m_UserInterface.AddControl(new TopMenu(0), 0, 0);
     m_UserInterface.AddControl(new ChatWindow(), 0, 0);
     Client.SendWorldLoginPackets();
     EngineVars.InWorld = true;
 }
Example #5
0
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Map:
                MiniMapGump.Toggle();
                break;

            case Buttons.Paperdoll:
                Mobile player = (Mobile)WorldModel.Entities.GetPlayerEntity();
                if (m_UserInterface.GetControl <PaperDollGump>(player.Serial) == null)
                {
                    m_Client.Send(new DoubleClickPacket(player.Serial | Serial.ProtectedAction));     // additional flag keeps us from being dismounted.
                }
                else
                {
                    m_UserInterface.RemoveControl <PaperDollGump>(player.Serial);
                }
                break;

            case Buttons.Inventory:
                // opens the player's backpack.
                Mobile    mobile   = WorldModel.Entities.GetPlayerEntity();
                Container backpack = mobile.Backpack;
                m_World.Interaction.DoubleClick(backpack);
                break;

            case Buttons.Journal:
                if (m_UserInterface.GetControl <JournalGump>() == null)
                {
                    m_UserInterface.AddControl(new JournalGump(), 80, 80);
                }
                else
                {
                    m_UserInterface.RemoveControl <JournalGump>();
                }
                break;

            case Buttons.Chat:
                break;

            case Buttons.Help:
                break;

            case Buttons.Question:
                if (m_UserInterface.GetControl <DebugGump>() == null)
                {
                    m_UserInterface.AddControl(new DebugGump(), 50, 50);
                }
                else
                {
                    m_UserInterface.RemoveControl <DebugGump>();
                }
                break;
            }
        }
Example #6
0
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Help:
                m_Client.Send(new RequestHelpPacket());
                break;

            case Buttons.Options:
                if (m_UserInterface.GetControl <OptionsGump>() == null)
                {
                    m_UserInterface.AddControl(new OptionsGump(), 80, 80);
                }
                else
                {
                    m_UserInterface.RemoveControl <OptionsGump>();
                }
                break;

            case Buttons.LogOut:
                // MsgBoxGump g = MsgBoxGump.Show("Quit Ultima Online?", MsgBoxTypes.OkCancel);
                // g.OnClose = logout_OnClose;
                m_UserInterface.AddControl(new LogoutGump(), 0, 0);
                break;

            case Buttons.Quests:
                m_Client.Send(new QuestGumpRequestPacket(Mobile.Serial));
                break;

            case Buttons.Skills:
                m_Client.Send(new GetPlayerStatusPacket(0x05, Mobile.Serial));
                if (m_UserInterface.GetControl <SkillsGump>() == null)
                {
                    m_UserInterface.AddControl(new SkillsGump(), 80, 80);
                }
                else
                {
                    m_UserInterface.RemoveControl <SkillsGump>();
                }
                break;

            case Buttons.Guild:
                m_Client.Send(new GuildGumpRequestPacket(Mobile.Serial));
                break;

            case Buttons.PeaceWarToggle:
                m_World.Interaction.ToggleWarMode();
                break;

            case Buttons.Status:
                StatusGump.Toggle(Mobile.Serial);
                break;
            }
        }
Example #7
0
        public Gump OpenContainerGump(AEntity entity) // used by ultimaclient.
        {
            Gump gump;

            if ((gump = (Gump)m_UserInterface.GetControl(entity.Serial)) != null)
            {
                gump.Dispose();
            }

            gump = new ContainerGump(entity, ((Container)entity).ItemID);
            m_UserInterface.AddControl(gump, 64, 64);
            return(gump);
        }
Example #8
0
 // ============================================================================================================
 // Public Methods
 // ============================================================================================================
 public void LoginToWorld()
 {
     _userInterface.AddControl(new WorldViewGump(), 0, 0); // world gump will restore its position on load.
     if (!UltimaGameSettings.UserInterface.MenuBarDisabled)
     {
         _userInterface.AddControl(new TopMenuGump(), 0, 0); // by default at the top of the screen.
     }
     Client.SendWorldLoginPackets();
     IsInWorld = true;
     Client.StartKeepAlivePackets();
     // wait until we've received information about the entities around us before restoring saved gumps.
     DelayedAction.Start(RestoreSavedGumps, 1000);
 }
Example #9
0
        public override void Intitialize()
        {
            base.Intitialize();

            m_LoginGump          = (LoginGump)m_UserInterface.AddControl(new LoginGump(), 0, 0);
            m_LoginGump.OnLogin += OnLogin;
        }
Example #10
0
        public void RefreshPartyGumps()
        {
            UserInterfaceService ui = Service.Get <UserInterfaceService>();

            ui.RemoveControl <PartyHealthTrackerGump>();
            for (int i = 0; i < Members.Count; i++)
            {
                ui.AddControl(new PartyHealthTrackerGump(Members[i]), 5, 40 + (48 * i));
            }
            Gump gump;

            if ((gump = ui.GetControl <PartyGump>()) != null)
            {
                int x = gump.X;
                int y = gump.Y;
                ui.RemoveControl <PartyGump>();
                ui.AddControl(new PartyGump(), x, y);
            }
        }
 void openSkillsGump()
 {
     m_CreateSkillsGump             = (CreateCharSkillsGump)m_UserInterface.AddControl(new CreateCharSkillsGump(), 0, 0);
     m_CreateSkillsGump.OnForward  += OnForward;
     m_CreateSkillsGump.OnBackward += OnBackward;
     m_Status = CreateCharacterSceneStates.ChooseSkills;
     // restore values
     if (m_skillsSet)
     {
         m_CreateSkillsGump.Strength     = m_attributes[0];
         m_CreateSkillsGump.Dexterity    = m_attributes[1];
         m_CreateSkillsGump.Intelligence = m_attributes[2];
         m_CreateSkillsGump.SkillIndex0  = m_skillIndexes[0];
         m_CreateSkillsGump.SkillIndex1  = m_skillIndexes[1];
         m_CreateSkillsGump.SkillIndex2  = m_skillIndexes[2];
         m_CreateSkillsGump.SkillPoints0 = m_skillValues[0];
         m_CreateSkillsGump.SkillPoints1 = m_skillValues[1];
         m_CreateSkillsGump.SkillPoints2 = m_skillValues[2];
     }
 }
Example #12
0
 public void SwitchTopMenuGump()
 {
     if (!Settings.UserInterface.MenuBarDisabled && m_UserInterface.GetControl <TopMenuGump>() == null)
     {
         m_UserInterface.AddControl(new TopMenuGump(), 0, 0); // by default at the top of the screen.
     }
     else if (Settings.UserInterface.MenuBarDisabled && m_UserInterface.GetControl <TopMenuGump>() != null)
     {
         m_UserInterface.GetControl <TopMenuGump>().Dispose();
     }
 }
Example #13
0
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>();
            m_Login         = ServiceRegistry.GetService <LoginModel>();

            m_SelectServerGump = (SelectServerGump)m_UserInterface.AddControl(new SelectServerGump(), 0, 0);
            m_SelectServerGump.OnBackToLoginScreen += OnBackToLoginScreen;
            m_SelectServerGump.OnSelectLastServer  += OnSelectLastServer;
            m_SelectServerGump.OnSelectServer      += OnSelectServer;
        }
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService<UserInterfaceService>();
            m_Login = ServiceRegistry.GetService<LoginModel>();

            m_SelectServerGump = (SelectServerGump)m_UserInterface.AddControl(new SelectServerGump(), 0, 0);
            m_SelectServerGump.OnBackToLoginScreen += OnBackToLoginScreen;
            m_SelectServerGump.OnSelectLastServer += OnSelectLastServer;
            m_SelectServerGump.OnSelectServer += OnSelectServer;
        }
Example #15
0
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService<UserInterfaceService>();
            m_Login = ServiceRegistry.GetService<LoginModel>();

            m_Gump = (LoggingInGump)m_UserInterface.AddControl(new LoggingInGump(), 0, 0);
            m_Gump.OnCancelLogin += OnCancelLogin;

            m_Login.Client.Disconnect();
        }
Example #16
0
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>();
            m_Login         = ServiceRegistry.GetService <LoginModel>();

            m_Gump = (LoginStatusGump)m_UserInterface.AddControl(new LoginStatusGump(), 0, 0);
            m_Gump.OnCancelLogin += OnCancelLogin;

            m_Login.Client.Disconnect();
        }
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = UltimaServices.GetService <UserInterfaceService>();
            m_Login         = UltimaServices.GetService <LoginModel>();

            m_Gump = (LoggingInGump)m_UserInterface.AddControl(new LoggingInGump(), 0, 0);
            m_Gump.OnCancelLogin += OnCancelLogin;

            m_Login.Client.Disconnect();
        }
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService<UserInterfaceService>();
            m_Login = ServiceRegistry.GetService<LoginModel>();

            m_CharListGump = (CharacterListGump)m_UserInterface.AddControl(new CharacterListGump(), 0, 0);
            m_CharListGump.OnBackToSelectServer += OnBackToSelectServer;
            m_CharListGump.OnLoginWithCharacter += OnLoginWithCharacter;
            m_CharListGump.OnDeleteCharacter += OnDeleteCharacter;
            m_CharListGump.OnNewCharacter += OnNewCharacter;
        }
 public void AttackRequest(Mobile mobile)
 {
     // Do nothing on Invulnerable
     if (mobile.Notoriety == 0x7)
     {
     }
     // Attack Innocents, Reds and Greys
     else if (mobile.Notoriety == 0x1 || mobile.Notoriety == 0x3 || mobile.Notoriety == 0x4 || mobile.Notoriety == 0x5 || mobile.Notoriety == 0x6)
     {
         m_Network.Send(new AttackRequestPacket(mobile.Serial));
     }
     // CrimeQuery is enabled, ask before attacking others
     else if (Settings.UserInterface.CrimeQuery)
     {
         m_UserInterface.AddControl(new CrimeQueryGump(mobile), 0, 0);
     }
     // CrimeQuery is disabled, so attack without asking
     else
     {
         m_Network.Send(new AttackRequestPacket(mobile.Serial));
     }
 }
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = UltimaServices.GetService <UserInterfaceService>();
            m_Login         = UltimaServices.GetService <LoginModel>();

            m_CharListGump = (CharacterListGump)m_UserInterface.AddControl(new CharacterListGump(), 0, 0);
            m_CharListGump.OnBackToSelectServer += OnBackToSelectServer;
            m_CharListGump.OnLoginWithCharacter += OnLoginWithCharacter;
            m_CharListGump.OnDeleteCharacter    += OnDeleteCharacter;
            m_CharListGump.OnNewCharacter       += OnNewCharacter;
        }
Example #21
0
 /// <summary>
 /// Picks up an item. For stacks, picks up entire stack if shift is down or picking up from a corpse.
 /// Otherwise, shows "pick up how many?" gump unless amountToPickUp param is set or amount is 1.
 /// </summary>
 void PickUpItem(Item item, int x, int y, int?amountToPickUp = null)
 {
     if (!_input.IsShiftDown && !amountToPickUp.HasValue && !(item is Corpse) && item.Amount > 1)
     {
         var gump = new SplitItemStackGump(item, new Vector2Int(x, y));
         _userInterface.AddControl(gump, _input.MousePosition.x - 80, _input.MousePosition.y - 40);
         _userInterface.AttemptDragControl(gump, _input.MousePosition, true);
     }
     else
     {
         PickupItemWithoutAmountCheck(item, x, y, amountToPickUp.HasValue ? amountToPickUp.Value : item.Amount);
     }
 }
Example #22
0
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>();
            m_Login         = ServiceRegistry.GetService <LoginModel>();
            m_Login.Client.StartKeepAlivePackets();

            m_CharListGump = (CharacterListGump)m_UserInterface.AddControl(new CharacterListGump(), 0, 0);
            m_CharListGump.OnBackToSelectServer += OnBackToSelectServer;
            m_CharListGump.OnLoginWithCharacter += OnLoginWithCharacter;
            m_CharListGump.OnDeleteCharacter    += OnDeleteCharacter;
            m_CharListGump.OnNewCharacter       += OnNewCharacter;
        }
Example #23
0
 /// <summary>
 /// Picks up an item.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="amount">Optional, defaults to null. If null, and the item amount is greater than 1, a 'pick up how many' gump will appear?</param>
 private void PickUpItem(Item item, int x, int y, int?amount = null)
 {
     // hold 'shift' to pick up an entire stack.
     // if in a bag and is a quantity, then show the 'lift amount' prompt, else just lift it outright.
     if (!m_Input.IsShiftDown && !amount.HasValue && !(item is Corpse) && item.Amount > 1)
     {
         SplitItemStackGump gump = new SplitItemStackGump(item, new Point(x, y));
         m_UserInterface.AddControl(gump, m_Input.MousePosition.X - 80, m_Input.MousePosition.Y - 40);
         m_UserInterface.AttemptDragControl(gump, m_Input.MousePosition, true);
     }
     else
     {
         PickupItemWithoutAmountCheck(item, x, y, amount.HasValue ? amount.Value : item.Amount);
     }
 }
Example #24
0
        public static void Toggle(Serial serial)
        {
            UserInterfaceService ui = ServiceRegistry.GetService <UserInterfaceService>();

            if (ui.GetControl <StatusGump>() == null)
            {
                INetworkClient client = ServiceRegistry.GetService <INetworkClient>();
                client.Send(new GetPlayerStatusPacket(0x04, serial));
                ui.AddControl(new StatusGump(), 200, 400);
            }
            else
            {
                ui.RemoveControl <StatusGump>();
            }
        }
Example #25
0
        public static void Toggle(Serial serial)
        {
            UserInterfaceService ui = Service.Get <UserInterfaceService>();

            if (ui.GetControl <StatusGump>() == null)
            {
                INetworkClient client = Service.Get <INetworkClient>();
                client.Send(new MobileQueryPacket(MobileQueryPacket.StatusType.BasicStatus, serial));
                ui.AddControl(new StatusGump(), 200, 400);
            }
            else
            {
                ui.RemoveControl <StatusGump>();
            }
        }
Example #26
0
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>();
            m_Login         = ServiceRegistry.GetService <LoginModel>();

            m_SelectServerGump = (SelectServerGump)m_UserInterface.AddControl(new SelectServerGump(), 0, 0);
            m_SelectServerGump.OnBackToLoginScreen += OnBackToLoginScreen;
            m_SelectServerGump.OnSelectLastServer  += OnSelectLastServer;
            m_SelectServerGump.OnSelectServer      += OnSelectServer;

            m_Login.Client.OnWaitingForRelay  += DoRelay;
            m_Login.Client.OnHasCharacterList += SwitchToSelectChar;

            SelectAServerIfOnlyOneServer();
        }
        public override void Intitialize()
        {
            base.Intitialize();

            m_UserInterface = ServiceRegistry.GetService<UserInterfaceService>();
            m_Login = ServiceRegistry.GetService<LoginModel>();

            m_SelectServerGump = (SelectServerGump)m_UserInterface.AddControl(new SelectServerGump(), 0, 0);
            m_SelectServerGump.OnBackToLoginScreen += OnBackToLoginScreen;
            m_SelectServerGump.OnSelectLastServer += OnSelectLastServer;
            m_SelectServerGump.OnSelectServer += OnSelectServer;

            m_Login.Client.OnWaitingForRelay += DoRelay;
            m_Login.Client.OnHasCharacterList += SwitchToSelectChar;

            SelectAServerIfOnlyOneServer();
        }
Example #28
0
        public static void Toggle()
        {
            UserInterfaceService ui = Service.Get <UserInterfaceService>();

            if (ui.GetControl <MiniMapGump>() == null)
            {
                ui.AddControl(new MiniMapGump(), 566, 25);
            }
            else
            {
                if (MiniMapGump.MiniMap_LargeFormat == false)
                {
                    MiniMapGump.MiniMap_LargeFormat = true;
                }
                else
                {
                    ui.RemoveControl <MiniMapGump>();
                    MiniMapGump.MiniMap_LargeFormat = false;
                }
            }
        }
Example #29
0
 void ResetToLogin()
 {
     Client.Disconnect();
     _userInterface.Reset();
     CurrentGump = _userInterface.AddControl(new LoginGump(OnLogin), 0, 0) as Gump;
 }
Example #30
0
        public override void Draw(double frameTime)
        {
            var player = WorldModel.Entities.GetPlayerEntity();

            if (player == null)
            {
                return;
            }
            if (Model.Map == null)
            {
                return;
            }
            var center = player.Position;

            if ((player as Mobile).IsAlive)
            {
                AEntityView.Technique = Techniques.Default;
                _showingDeathEffect   = false;
                if (_youAreDead != null)
                {
                    _youAreDead.Dispose();
                    _youAreDead = null;
                }
            }
            else
            {
                if (!_showingDeathEffect)
                {
                    _showingDeathEffect        = true;
                    _deathEffectTime           = 0;
                    _lightingGlobal            = Isometric.Lighting.OverallLightning;
                    _lightingPersonal          = Isometric.Lighting.PersonalLightning;
                    _ui.AddControl(_youAreDead = new YouAreDeadGump(), 0, 0);
                }
                var msFade = 2000d;
                var msHold = 1000d;
                if (_deathEffectTime < msFade)
                {
                    AEntityView.Technique = Techniques.Default;
                    Isometric.Lighting.OverallLightning  = (int)(_lightingGlobal + (0x1f - _lightingGlobal) * ((_deathEffectTime / msFade)));
                    Isometric.Lighting.PersonalLightning = (int)(_lightingPersonal * (1d - (_deathEffectTime / msFade)));
                }
                else if (_deathEffectTime < msFade + msHold)
                {
                    Isometric.Lighting.OverallLightning  = 0x1f;
                    Isometric.Lighting.PersonalLightning = 0x00;
                }
                else
                {
                    AEntityView.Technique = Techniques.Grayscale;
                    Isometric.Lighting.OverallLightning  = (int)_lightingGlobal;
                    Isometric.Lighting.PersonalLightning = (int)_lightingPersonal;
                    if (_youAreDead != null)
                    {
                        _youAreDead.Dispose();
                        _youAreDead = null;
                    }
                }
                _deathEffectTime += frameTime;
            }
            Isometric.Update(Model.Map, center, Model.Input.MousePick);
            MiniMap.Update(Model.Map, center);
        }
Example #31
0
        private void ReceiveOpenPaperdoll(IRecvPacket packet)
        {
            OpenPaperdollPacket opp = packet as OpenPaperdollPacket;

            m_UserInterface.AddControl(new PaperDollGump(EntityManager.GetObject <Mobile>(opp.Serial, false)), 400, 100, UserInterfaceService.AddControlType.OnlyAllowOne);
        }
Example #32
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;
        }
Example #33
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;
        }