Exemplo n.º 1
0
        private void BuildSubtitle()
        {
            int y = 190;

            Guild guild = User.Guild as Guild;

            AddHtmlLocalized(55, y, 160, 16, 1115030, 0xFFFF, false, false); // Skills
            AddCallbackButton(20, y, 4005, 4007, 400, GumpButtonType.Reply, 0, b =>
            {
                Category           = TitleCategory.Skills;
                ShowingDescription = false;
                TitleClearing      = false;
                Refresh();
            });

            y += 22;

            if (guild != null && User.GuildTitle != null)
            {
                AddHtmlLocalized(55, y, 160, 16, 1115033, 0xFFFF, false, false); // GUILD
                AddCallbackButton(20, y, 4005, 4007, 401, GumpButtonType.Reply, 0, b =>
                {
                    Category           = TitleCategory.Guild;
                    ShowingDescription = false;
                    TitleClearing      = false;
                    Refresh();
                });

                y += 22;
            }

            if (User.CollectionTitles != null && User.CollectionTitles.Count > 0)
            {
                AddHtmlLocalized(55, y, 160, 16, 1115034, 0xFFFF, false, false); // Rewards
                AddCallbackButton(20, y, 4005, 4007, 402, GumpButtonType.Reply, 0, b =>
                {
                    Category           = TitleCategory.RewardTitles;
                    ShowingDescription = false;
                    TitleClearing      = false;
                    Refresh();
                });

                y += 22;
            }

            List <VeteranTitle> vetTitles = Titles.GetVeteranTitles(User);

            if (vetTitles != null && vetTitles.Count > 0)
            {
                AddHtml(55, y, 160, 16, Color("#FFFFFF", "Veterans"), false, false); // Rewards
                AddCallbackButton(20, y, 4005, 4007, 403, GumpButtonType.Reply, 0, b =>
                {
                    Category           = TitleCategory.Veteran;
                    ShowingDescription = false;
                    TitleClearing      = false;
                    Refresh();
                });
            }

            if (Category == TitleCategory.Skills)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int index = 0;
                    int page  = 1;

                    AddPage(page);

                    foreach (Skill sk in User.Skills)
                    {
                        if (sk.Base < 30)
                        {
                            continue;
                        }

                        AddHtml(260, 70 + (index * 22), 245, 16, Color("#FFFFFF", Titles.GetSkillTitle(User, sk)), false, false);
                        AddCallbackButton(225, 70 + (index * 22), 4005, 4007, sk.Info.SkillID + 404, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 404;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                        CheckPage(ref index, ref page);
                    }
                }
                else
                {
                    string title = Titles.GetSkillTitle(User, User.Skills[(SkillName)TitleSelected]);

                    AddHtmlLocalized(225, 70, 270, 140, 1115056 + TitleSelected, 0xFFFF, false, false);
                    AddHtmlLocalized(225, 220, 160, 16, 1115029, 0xFFFF, false, false); // Subtitle
                    AddHtml(275, 240, 245, 16, Color("#FFFFFF", title), false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 102, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        title = Titles.GetSkillTitle(User, User.Skills[(SkillName)TitleSelected]);
                        User.SubtitleSkillTitle = title;

                        User.SelectCollectionTitle(-1, true);
                        User.DisplayGuildTitle = false;

                        Refresh(false);
                    });
                }
            }
            else if (Category == TitleCategory.Guild && guild != null && User.GuildTitle != null)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    AddHtml(260, 70, 245, 16, Color("#FFFFFF", String.Format("{0}, {1}", Utility.FixHtml(User.GuildTitle), Utility.FixHtml(guild.Name))), false, false);
                    AddCallbackButton(225, 70, 4005, 4007, 500, GumpButtonType.Reply, 0, b =>
                    {
                        TitleSelected      = 1;
                        ShowingDescription = true;
                        Refresh();
                    });
                }
                else
                {
                    AddHtmlLocalized(225, 70, 270, 140, 1115039, 0xFFFF, false, false); // This is a custom guild title assigned by your guild leader.
                    AddHtmlLocalized(225, 220, 160, 16, 1115029, 0xFFFF, false, false); // Subtitle
                    AddHtml(275, 240, 245, 16, Color("#FFFFFF", String.Format("{0}, {1}", Utility.FixHtml(User.GuildTitle), Utility.FixHtml(guild.Name))), false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 599, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        User.DisplayGuildTitle = true;

                        if (User.SubtitleSkillTitle != null)
                        {
                            User.SubtitleSkillTitle = null;
                        }

                        User.SelectCollectionTitle(-1, true);

                        Refresh(false);
                    });
                }
            }
            else if (Category == TitleCategory.RewardTitles && User.CollectionTitles != null && User.CollectionTitles.Count > 0)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int index = 0;
                    int page  = 1;

                    AddPage(page);

                    for (int i = 0; i < User.CollectionTitles.Count; i++)
                    {
                        object title = User.CollectionTitles[i];

                        if (title is int)
                        {
                            string cust = null;

                            if ((int)title == 1154017 && Scripts.Mythik.Systems.CityLoyalty.CityLoyaltySystem.HasCustomTitle(User, out cust))
                            {
                                AddHtmlLocalized(260, 70 + (index * 22), 245, 16, 1154017, cust, 0xFFFF, false, false);
                            }
                            else
                            {
                                AddHtmlLocalized(260, 70 + (index * 22), 245, 16, (int)title, 0xFFFF, false, false);
                            }
                        }
                        else if (title is string)
                        {
                            AddHtml(260, 70 + (index * 22), 245, 16, Color("#FFFFFF", (string)title), false, false);
                        }

                        AddCallbackButton(225, 70 + (index * 22), 4005, 4007, i + 600, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 600;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                        CheckPage(ref index, ref page);
                    }
                }
                else if (TitleSelected >= 0 && User.CollectionTitles != null && TitleSelected < User.CollectionTitles.Count)
                {
                    object title       = User.CollectionTitles[TitleSelected];
                    object description = GetRewardTitleInfo(title);

                    if (description is int)
                    {
                        AddHtmlLocalized(225, 70, 270, 140, (int)description, 0xFFFF, false, false);
                    }
                    else if (description is string)
                    {
                        AddHtml(225, 70, 270, 140, Color("#FFFFFF", (string)description), false, false);
                    }

                    AddHtmlLocalized(225, 220, 160, 16, 1115029, 0xFFFF, false, false); // Subtitle

                    if (title is int)
                    {
                        string cust = null;

                        if ((int)title == 1154017 && Scripts.Mythik.Systems.CityLoyalty.CityLoyaltySystem.HasCustomTitle(User, out cust))
                        {
                            AddHtmlLocalized(275, 240, 245, 16, 1154017, cust, 0xFFFF, false, false);
                        }
                        else
                        {
                            AddHtmlLocalized(275, 240, 160, 32, (int)title, 0xFFFF, false, false);
                        }
                    }
                    else
                    {
                        AddHtml(275, 240, 245, 16, Color("#FFFFFF", (string)title), false, false);
                    }

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 699, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        Refresh(false);

                        User.SelectCollectionTitle(TitleSelected, true);

                        if (User.SubtitleSkillTitle != null)
                        {
                            User.SubtitleSkillTitle = null;
                        }

                        User.DisplayGuildTitle = false;
                    });
                }
            }
            else if (Category == TitleCategory.Veteran && vetTitles != null && vetTitles.Count > 0)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int index = 0;
                    int page  = 1;

                    AddPage(page);

                    for (int i = 0; i < vetTitles.Count; i++)
                    {
                        AddHtmlLocalized(260, 70 + (index * 22), 245, 16, vetTitles[i].Title, 0xFFFF, false, false);
                        AddCallbackButton(225, 70 + (index * 22), 4005, 4007, i + 700, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 700;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                        CheckPage(ref index, ref page);
                    }
                }
                else if (TitleSelected >= 0 && TitleSelected < vetTitles.Count)
                {
                    VeteranTitle title = vetTitles[TitleSelected];

                    AddHtmlLocalized(225, 70, 270, 200, title.Title + 410, 0xFFFF, false, false);
                    AddHtmlLocalized(225, 220, 160, 16, 1115029, 0xFFFF, false, false); // Subtitle

                    AddHtmlLocalized(275, 240, 160, 32, title.Title, 0xFFFF, false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 799, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        title = vetTitles[TitleSelected];
                        User.CurrentVeteranTitle = title.Title;

                        Refresh(false);
                    });
                }
            }
        }
Exemplo n.º 2
0
        private void BuildPaperdollSuffix()
        {
            AddHtmlLocalized(55, 190, 160, 16, 1115030, 0xFFFF, false, false); // Skills
            AddCallbackButton(20, 190, 4005, 4007, 100, GumpButtonType.Reply, 0, b =>
            {
                Category = TitleCategory.Skills;
                Reset();
                Refresh();
            });

            PlayerMobile.ChampionTitleInfo info = User.ChampionTitles;

            if (info != null && info.HasChampionTitle(User))
            {
                AddHtmlLocalized(55, 212, 160, 16, 1115032, 0xFFFF, false, false); // Monster
                AddCallbackButton(20, 212, 4005, 4007, 101, GumpButtonType.Reply, 0, b =>
                {
                    Category = TitleCategory.Champion;
                    Reset();
                    Refresh();
                });
            }

            if (Category == TitleCategory.Skills)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int index = 0;
                    int page  = 1;

                    AddPage(page);

                    foreach (Skill sk in User.Skills)
                    {
                        if (sk.Base < 30)
                        {
                            continue;
                        }

                        AddHtml(260, 70 + (index * 22), 245, 16, Color("#FFFFFF", Titles.GetSkillTitle(User, sk)), false, false);
                        AddCallbackButton(225, 70 + (index * 22), 4005, 4007, sk.Info.SkillID + 102, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 102;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;

                        CheckPage(ref index, ref page);
                    }
                }
                else
                {
                    string str = Titles.GetSkillTitle(User, User.Skills[(SkillName)TitleSelected]);

                    AddHtmlLocalized(225, 70, 270, 200, 1115056 + TitleSelected, 0xFFFF, false, false);
                    AddHtmlLocalized(225, 220, 160, 16, 1115027, 0xFFFF, false, false); // Paperdoll Name (Suffix)
                    AddHtml(275, 240, 245, 16, Color("#FFFFFF", str), false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 199, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        str = Titles.GetSkillTitle(User, User.Skills[(SkillName)TitleSelected]);
                        Refresh(false);

                        User.PaperdollSkillTitle = str;
                    });
                }
            }
            else if (Category == TitleCategory.Champion && info != null)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int y     = 70;
                    int page  = 1;
                    int index = 0;

                    AddPage(page);

                    if (info.Harrower > 0)
                    {
                        AddHtml(260, y, 245, 16, Color("#FFFFFF", String.Format(": {0} of Evil", Titles.HarrowerTitles[Math.Min(Titles.HarrowerTitles.Length, info.Harrower) - 1])), false, false);
                        AddCallbackButton(225, y, 4005, 4007, 295, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = 295;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                    }

                    for (int i = 0; i < ChampionSpawnInfo.Table.Length; i++)
                    {
                        int v = info.GetValue(i);

                        if (v == 0)
                        {
                            continue;
                        }

                        int offset = 0;
                        if (v > 800)
                        {
                            offset = 3;
                        }
                        else if (v > 300)
                        {
                            offset = (int)(v / 300);
                        }

                        if (offset <= 0)
                        {
                            continue;
                        }

                        ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo((ChampionSpawnType)i);

                        AddHtml(260, y + (index * 22), 245, 16, Color("#FFFFFF", String.Format(": {0} of the {1}", champInfo.LevelNames[Math.Min(offset, champInfo.LevelNames.Length) - 1], champInfo.Name)), false, false);
                        AddCallbackButton(225, y + (index * 22), 4005, 4007, i + 251, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 251;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                        CheckPage(ref index, ref page);
                    }
                }
                else
                {
                    string str         = GetChampionTitle();
                    object description = GetChampInfo();

                    if (description is int)
                    {
                        AddHtmlLocalized(225, 70, 270, 140, (int)description, 0xFFFF, false, false);
                    }
                    else if (description is string)
                    {
                        AddHtml(250, 70, 270, 140, Color("#FFFFFF", (string)description), false, false);
                    }

                    AddHtmlLocalized(225, 220, 160, 16, 1115027, 0xFFFF, false, false); // Paperdoll Name (Suffix)
                    AddHtml(275, 240, 245, 16, Color("#FFFFFF", str), false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 299, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        str = GetChampionTitle();
                        User.DisplayChampionTitle = true;
                        User.CurrentChampTitle    = str;

                        Refresh(false);
                    });
                }
            }
        }
Exemplo n.º 3
0
        protected override void OnTick()
        {
            if (!Directory.Exists("web"))
            {
                Directory.CreateDirectory("web");
            }

            using (var op = new StreamWriter("web/status.html"))
            {
                op.WriteLine("<!DOCTYPE html>");
                op.WriteLine("<html>");
                op.WriteLine("   <head>");
                op.WriteLine("      <meta charset='utf-8'>");
                op.WriteLine("      <meta http-equiv='refresh' content='{0}'>", UpdateIntervalInSeconds);
                op.WriteLine("      <title>{0} Shard Status</title>", Encode(ServerList.ServerName));
                op.WriteLine("      <link href='//fonts.googleapis.com/css?family=Raleway:400,300,600' rel='stylesheet' type='text/css'>");
                op.WriteLine("   </head>");
                op.WriteLine("   <link crossorigin='anonymous' href='https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css' rel='stylesheet'>");
                op.WriteLine("   <body>");
                op.WriteLine("      <h1>{0} Shard Status</h1>", Encode(ServerList.ServerName));
                op.WriteLine("      <h3>Characters Online: {0}</h3>", NetState.Instances.Count);
                if (NetState.Instances.Count > 0)
                {
                    op.WriteLine("      <table class='u-full-width'>");
                    op.WriteLine("         <thead><tr><th>Name</th><th>Title</th><th>Location</th></tr></thead>");
                    op.WriteLine("         <tbody>");

                    var index = 0;

                    foreach (var m in NetState.Instances.Where(state => state.Mobile != null).Select(state => state.Mobile))
                    {
                        ++index;

                        var g = m.Guild as Guild;

                        op.Write("         <tr><td>");

                        if (g != null)
                        {
                            op.Write(Encode(m.Name));
                            op.Write(" [");

                            var title = m.GuildTitle;

                            title = title != null?title.Trim() : String.Empty;

                            if (title.Length > 0)
                            {
                                op.Write(Encode(title));
                                op.Write(", ");
                            }

                            op.Write(Encode(g.Abbreviation));

                            op.Write(']');
                        }
                        else
                        {
                            op.Write(Encode(m.Name));
                        }

                        op.Write("</td><td>");
                        if (m.AccessLevel == AccessLevel.Player)
                        {
                            op.Write(Titles.GetSkillTitle(m));
                        }
                        else
                        {
                            op.Write("Shard {0}", Enum.GetName(typeof(AccessLevel), m.AccessLevel));
                        }
                        op.Write("</td><td>");
                        if (m.Map == Map.Felucca)
                        {
                            op.Write("Somewhere in Felucca");
                        }
                        else
                        {
                            if (m.Region.Name != null)
                            {
                                op.Write("{0} ({1})", m.Region.Name, m.Map);
                            }
                            else
                            {
                                op.Write("{0}, {1}, {2} ({3})", m.X, m.Y, m.Z, m.Map);
                            }
                        }
                        op.Write("</td></tr>");
                    }
                    op.WriteLine("         </tbody>");
                    op.WriteLine("      </table>");
                }
                op.WriteLine("      <h3>Shard Statistics</h3>");
                op.WriteLine("      <b>Shard Age:</b> {0:n0} days, {1:n0} hours and {2:n0} minutes<br/>", Statistics.ShardAge.Days, Statistics.ShardAge.Hours, Statistics.ShardAge.Minutes);
                op.WriteLine("      <b>Total Game Time:</b> {0:n0} hours and {1:n0} minutes<br/>", Statistics.TotalGameTime.TotalHours, Statistics.TotalGameTime.Minutes);
                op.WriteLine("      <b>Last Restart:</b> {0}<br/>", Statistics.LastRestart);
                op.WriteLine("      <b>Uptime:</b> {0:n0} days, {1:n0} hours and {2:n0} minutes<br/>", Statistics.Uptime.Days, Statistics.Uptime.Hours, Statistics.Uptime.Minutes);
                op.WriteLine("      <b>Active Accounts:</b> {0:n0} [{1:n0} Players Online]<br/>", Statistics.ActiveAccounts, Statistics.PlayersOnline);
                op.WriteLine("      <b>Active Staff Members:</b> {0:n0} [{1:n0} Staff Online]<br/>", Statistics.ActiveStaffMembers, Statistics.StaffOnline);
                op.WriteLine("      <b>Active Parties:</b> {0:n0} [{1:n0} Players in Parties]<br/>", Statistics.ActiveParties, Statistics.PlayersInParty);
                op.WriteLine("      <b>Active Guilds:</b> {0:n0}<br/>", Statistics.ActiveGuilds);
                op.WriteLine("      <b>Player Houses:</b> {0:n0}<br/>", Statistics.PlayerHouses);
                op.WriteLine("      <b>Player Gold:</b> {0:n0}<br/>", Statistics.PlayerGold);
                op.WriteLine("   </body>");
                op.WriteLine("</html>");
            }

            lock (_StatusLock)
            {
                _StatusPage   = File.ReadAllText("web/status.html");
                _StatusBuffer = Encoding.UTF8.GetBytes(_StatusPage);
            }
        }
Exemplo n.º 4
0
        public static string BuildStatus()
        {
            StringBuilder   resultsBuilder = new StringBuilder("<status>");
            List <NetState> userList       = new List <NetState>(NetState.Instances);

            userList.Sort(NetStateComparer.Instance);

            Mobile m;
            int    serial;
            string name, guild, accessLevel, mapName, fullName, profile;

            for (int i = 0; i < userList.Count; i++)
            {
                m    = userList[i].Mobile;
                name = guild = accessLevel = mapName = fullName = profile = "";

                if (m == null)
                {
                    continue;
                }

                serial = m.Serial;
                name   = Encode(m.RawName);

                if (((Guild)m.Guild) != null)
                {
                    guild = Encode(((Guild)m.Guild).Abbreviation);
                }

                if (m.AccessLevel > AccessLevel.Player)
                {
                    accessLevel = Encode(m.AccessLevel.ToString());
                }

                if (IsHidden(m))
                {
                    mapName = "unknown";
                }
                else
                {
                    Region reg = Region.Find(m.Location, m.Map);

                    if (reg != null)
                    {
                        if (reg.Name != null && reg.Name != "world")
                        {
                            mapName = Encode(Util.SplitString(reg.Name));
                        }
                        else if (reg is HouseRegion && Server.Multis.BaseHouse.FindHouseAt(m) != null)
                        {
                            mapName = "inside a house";
                        }
                    }
                }

                if (String.IsNullOrEmpty(mapName))
                {
                    mapName = Encode(String.Format("somewhere in {0}", m.Map.Name));
                }

                fullName = Encode(String.Format("{0}\n{1}", Titles.GetNameTitle(m, m), Titles.GetSkillTitle(m)));
                profile  = Encode(m.Profile);

                resultsBuilder.AppendFormat("<mobile name='{0}' guild='{1}' access='{2}' map='{3}' fullName='{4}' profile='{5}' serial='{6}'/>",
                                            name, guild, accessLevel, mapName, fullName, profile, serial);
            }

            userList.Clear();

            Dictionary <string, uint>  colorList       = LoadRegionColors();
            List <RegionWatcherObject> regionWatchList = RegionPopularityWatcher.Load(false);
            RegionWatcherObject        obj;

            regionWatchList.Sort(
                delegate(RegionWatcherObject x, RegionWatcherObject y)
            {
                return(GetRegionColor(x, colorList).CompareTo(GetRegionColor(y, colorList)));
            });

            for (int i = 0; i < regionWatchList.Count; i++)
            {
                obj = regionWatchList[i];

                resultsBuilder.AppendFormat("<region name='{0}' map='{1}' popularity='{2}' color='{3}'/>",
                                            Encode(Util.SplitString(obj.Name)), obj.Map == Map.Ilshenar ? Encode(Map.Backtrol.Name) : Encode(obj.Map.Name), obj.PopularityPercent, GetRegionColor(obj, colorList));
            }

            string uptime   = Util.FormatLongTimeSpan(DateTime.Now - Server.Items.Clock.ServerStart);
            string ramUsage = Util.FormatByteAmount(System.Diagnostics.Process.GetCurrentProcess().WorkingSet64);
            string cycles   = Core.AverageCPS.ToString("N2");

            resultsBuilder.AppendFormat("<stats uptime='{0}' ram='{1}' cycles='{2}'/>", uptime, ramUsage, cycles);
            resultsBuilder.Append("</status>");

            return(resultsBuilder.ToString());
        }
Exemplo n.º 5
0
        public CharacterProfileGump(Mobile beholder, Mobile beheld, int numEntries, bool editMode)
            : base(0, 0)
        {
            if (beheld.Profile == null)
            {
                beheld.Profile = "";
            }

            if (numEntries < MinTextEntries)
            {
                _numEntries = MinTextEntries;
            }
            else if (numEntries > MaxTextEntries)
            {
                _numEntries = MaxTextEntries;
            }
            else
            {
                _numEntries = numEntries;
            }

            _beheld   = beheld;
            _canEdit  = (beholder == beheld);
            _editMode = (editMode && _canEdit);

            int height = DefaultBackgroundHeight + ((DefaultTextEntryHeight + 10) * _numEntries);

            string[] profileSlices = SliceString(beheld.Profile, MaxTextLength);

            AddPage(1);
            AddBackground(10, 10, 300, height, 9380);
            AddImage(35, 55, 52);

            AddLabelCropped(85, 40, 195, 20, 0, Titles.GetNameTitle(beholder, beheld));
            AddLabelCropped(85, 55, 195, 20, 0, Titles.GetSkillTitle(beheld));

            if (_canEdit)
            {
                AddLabel(40, 10, 0, (_editMode ? "Editing Mode" : "Reading Mode"));
                AddButton(270, 95, 5411, 5411, 5, GumpButtonType.Reply, 0);
            }

            if (_canEdit && _editMode)
            {
                for (int i = 0, x = 40, y = 120; i < _numEntries; i++, y += (DefaultTextEntryHeight + 10))
                {
                    int slices = profileSlices.Length - 1;
                    AddTextEntry(x, y, 235, DefaultTextEntryHeight, 0, (i + 100), (slices >= i ? profileSlices[i] : ""), MaxTextLength);

                    if (i != (_numEntries - 1))
                    {
                        AddImage(28, (y + DefaultTextEntryHeight - 3), 57);
                    }
                }
            }
            else
            {
                AddHtml(40, 120, 235, (DefaultTextEntryHeight * _numEntries), String.Format("<BASEFONT COLOR=#111111>{0}</BASEFONT>", beheld.Profile), false, true);
            }

            AddButton(255, (height - 10), 55, 55, 10, GumpButtonType.Reply, 0);
            AddButton(275, (height - 10), 56, 56, 20, GumpButtonType.Reply, 0);
        }