public static void Initialize() { if (Enabled) { RegionPopularityWatcher.Load(true); } }
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()); }