Inheritance: Server.Gumps.Gump
示例#1
0
        public static void HelpStuck_OnCommand(CommandEventArgs e)
        {
            try
            {
                if (!HelpGump.TryMoveStuckPlayer(e.Mobile, 4))
                {
                    e.Mobile.SendMessage("Auto move failed.");
                }
                else
                {
                    e.Mobile.SendMessage("Auto move ok.");
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            return;
        }
示例#2
0
        public override void OnResponse(NetState state, int index)
        {
            //pla, 03/10/07
            // Log help stuck attempt
            if (index != 2)
            {
                LogHelper log = new LogHelper("HelpStuck.log");
                if (log != null)
                {
                    log.Log(LogType.Mobile, state.Mobile);
                    log.Finish();
                }
            }
            if (index == 0)
            {
                bool bGood = false;
                if (m_From.Alive == false)                 //dead: always allow to transport
                {
                    bGood = true;
                }
                else if (m_From.Region.IsDungeonRules)                 //alive and in dungeon
                {
                    m_From.SendMessage("You have chosen to die.");
                    m_From.Kill();
                    bGood = true;
                }
                else if (m_From.TotalWeight < StuckMenu.MAXHELPSTUCKALIVEWEIGHT)                 //alive and out of dungeon and not over weight limit
                {
                    bGood = true;
                }
                else                 // alive, out of dungeon, over weight limit
                {
                    m_From.SendMessage("You are too encumbered to be moved, drop most of your stuff and help-stuck again.");
                }

                if (bGood)
                {
                    //auto-choose destination now, so don't give them this message
                    //m_From.SendMessage("You will now be given the standard help-stuck menu.");

                    StuckMenu menu = new StuckMenu(m_From, m_From, true, true);
                    //menu.BeginClose();
                    //m_From.SendGump(menu);
                    menu.AutoSelect();
                }
            }
            else if (index == 1)
            {
                if (!HelpGump.TryMoveStuckPlayer(m_From, 4))
                {
                    int staffonline = 0;
                    foreach (NetState ns in NetState.Instances)
                    {
                        Mobile m = ns.Mobile;
                        if (m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify)
                        {
                            staffonline++;
                        }
                    }

                    if (staffonline == 0)
                    {
                        StuckMenu menu = new StuckMenu(m_From, m_From, true);
                        //menu.BeginClose();
                        //m_From.SendGump(menu);
                        menu.AutoSelect();
                    }
                }
            }
            else if (index == 2)
            {
                m_From.SendMessage("Help Stuck request cancelled.");
            }
        }