예제 #1
0
파일: AVIRec.cs 프로젝트: uvbs/Razor
        public static bool Record(int fps, double sizeFactor)
        {
            IntPtr hBmp = ClientCommunication.CaptureScreen(false, "");

            using (Bitmap bmp = Bitmap.FromHbitmap(hBmp))
            {
                m_ResX = (int)(bmp.Width * sizeFactor);
                m_ResY = (int)(bmp.Height * sizeFactor);
            }
            DeleteObject(hBmp);

            string filename;
            string name = "Unknown";
            string path = Config.GetString("RecFolder");

            if (World.Player != null)
            {
                name = World.Player.Name;
            }
            if (name == null || name.Trim() == "" || name.IndexOfAny(Path.GetInvalidPathChars()) != -1)
            {
                name = "Unknown";
            }

            name = String.Format("{0}_{1}", name, DateTime.Now.ToString("M-d_HH.mm"));
            Engine.EnsureDirectory(path);
            int count = 0;

            do
            {
                filename = Path.Combine(path, String.Format("{0}{1}.avi", name, count != 0 ? count.ToString() : ""));
                count--;                 // cause a - to be put in front of the number
            }while (File.Exists(filename));

            m_Avi = new AVIFile();
            if (!m_Avi.Open(filename, fps, m_ResX, m_ResY))
            {
                return(false);
            }

            UpdateFlip();

            m_RecTimer = new RecordTimer(fps);
            m_RecTimer.Start();

            return(true);
        }
예제 #2
0
        public static void OverheadTargetMessage(TargetInfo info)
        {
            if (info == null)
            {
                return;
            }

            if (Config.GetBool("ShowAttackTargetNewOnly") && info.Serial == _lastOverheadMessageTarget.Serial)
            {
                return;
            }

            Mobile m = null;

            if (Config.GetBool("ShowAttackTargetOverhead") && info.Serial != 0 && info.Serial.IsMobile)
            {
                m = World.FindMobile(info.Serial);

                if (m == null)
                {
                    return;
                }

                World.Player.OverheadMessage(FriendsManager.IsFriend(m.Serial) ? 63 : m.GetNotorietyColorInt(),
                                             $"Target: {m.Name}");
            }

            if (Config.GetBool("ShowTextTargetIndicator") && info.Serial != 0 && info.Serial.IsMobile)
            {
                // lets not look it up again they had the previous feature enabled
                if (m == null)
                {
                    m = World.FindMobile(info.Serial);
                }

                if (m == null)
                {
                    return;
                }

                m.OverheadMessage(Config.GetInt("TargetIndicatorHue"),
                                  Config.GetString("TargetIndicatorFormat").Replace("{name}", m.Name));
            }

            _lastOverheadMessageTarget = info;
        }
예제 #3
0
        public static bool IsFiltered(string name)
        {
            foreach (string filter in Config.GetString("BuffDebuffFilter").ToLower().Split(','))
            {
                if (string.IsNullOrEmpty(filter))
                {
                    continue;
                }

                if (name.ToLower().Contains(filter))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #4
0
파일: BandageTimer.cs 프로젝트: roxya/Razor
        public static void OnAsciiMessage(string msg)
        {
            if (Running)
            {
                if (msg == "You heal what little damage you had." ||
                    msg == "You heal what little damage the patient had.")
                {
                    Stop();

                    if (Config.GetBool("ShowBandageTimer") && Config.GetBool("ShowBandageEnd"))
                    {
                        ShowBandagingStatusMessage(Config.GetString("BandageEndMessage"));
                    }

                    return;
                }

                foreach (var t in m_ClilocNums)
                {
                    if (Language.GetCliloc(t) == msg)
                    {
                        Stop();

                        if (Config.GetBool("ShowBandageTimer") && Config.GetBool("ShowBandageEnd"))
                        {
                            ShowBandagingStatusMessage(Config.GetString("BandageEndMessage"));
                        }

                        break;
                    }
                }
            }
            else
            {
                // Start timer as soon as there is the "You begin applying the bandages." message
                if (msg == "You begin applying the bandages.")
                {
                    Start();

                    if (Config.GetBool("ShowBandageTimer") && Config.GetBool("ShowBandageStart"))
                    {
                        ShowBandagingStatusMessage(Config.GetString("BandageStartMessage"));
                    }
                }
            }
        }
예제 #5
0
        public static void OnLocalizedMessage(int num)
        {
            if (Running)
            {
                if (num == 500955 || (num >= 500962 && num <= 500969) || (num >= 503252 && num <= 503261) ||
                    num == 1010058 || num == 1010648 || num == 1010650 || num == 1060088 || num == 1060167)
                {
                    Stop();

                    if (Config.GetBool("ShowBandageTimer") && Config.GetBool("ShowBandageEnd"))
                    {
                        ShowBandagingStatusMessage(Config.GetString("BandageEndMessage"));
                    }

                    return;
                }

                // Check if they are re-healing before the timer ends
                if (num == 500956)
                {
                    Start();

                    if (Config.GetBool("ShowBandageTimer") && Config.GetBool("ShowBandageStart"))
                    {
                        ShowBandagingStatusMessage(Config.GetString("BandageStartMessage"));
                    }
                }
            }
            else
            {
                // Start timer as soon as there is the "You begin applying the bandages." message
                if (num == 500956)
                {
                    Start();

                    if (Config.GetBool("ShowBandageTimer") && Config.GetBool("ShowBandageStart"))
                    {
                        ShowBandagingStatusMessage(Config.GetString("BandageStartMessage"));
                    }
                }
            }
        }
예제 #6
0
        public static void DisplayTo(ListBox list)
        {
            string path = Config.GetString("CapPath");
            Engine.EnsureDirectory(path);

            //list.BeginUpdate();
            list.Items.Clear();

            AddFiles(list, path, "jpeg");
            AddFiles(list, path, "jpg");
            AddFiles(list, path, "png");
            AddFiles(list, path, "bmp");
            AddFiles(list, path, "gif");
            AddFiles(list, path, "tiff");
            AddFiles(list, path, "tif");
            AddFiles(list, path, "wmf");
            AddFiles(list, path, "exif");
            AddFiles(list, path, "emf");
            //list.EndUpdate();
        }
예제 #7
0
            protected override void OnTick()
            {
                Client.Instance.RequestTitlebarUpdate();

                if (!Config.GetBool("BuffDebuffEveryXSeconds") || !Config.GetBool("ShowBuffDebuffOverhead"))
                {
                    return;
                }

                foreach (BuffsDebuffs buffsDebuff in World.Player.BuffsDebuffs)
                {
                    TimeSpan diff     = DateTime.UtcNow - buffsDebuff.Timestamp;
                    int      timeLeft = buffsDebuff.Duration - (int)diff.TotalSeconds;

                    if (!IsFiltered(buffsDebuff.ClilocMessage1) && timeLeft % Config.GetInt("BuffDebuffSeconds") == 0)
                    {
                        World.Player.OverheadMessage(Config.GetInt("BuffHue"),
                                                     Config.GetString("BuffDebuffFormat").Replace("{action}", string.Empty)
                                                     .Replace("{name}", buffsDebuff.ClilocMessage1)
                                                     .Replace("{duration}", timeLeft.ToString()));
                    }
                }
            }
예제 #8
0
 public void ResetTitleBarBuilder()
 {
     // reuse the same sb each time for less damn allocations
     TitleBarBuilder.Remove(0, TitleBarBuilder.Length);
     TitleBarBuilder.Insert(0, $"{Config.GetString("TitleBarText")}");
 }
예제 #9
0
        public static void CaptureNow()
        {
            string filename;
            string playerName = "Unknown";
            string path = Config.GetString("CapPath");
            string type = Config.GetString("ImageFormat").ToLower();

            if (World.Player != null)
                playerName = World.Player.Name;

            if (playerName == null || playerName.Trim() == "" ||
                playerName.IndexOfAny(Path.GetInvalidPathChars()) != -1)
                playerName = "Unknown";

            string imageTimestampTag = Config.GetBool("CapTimeStamp")
                ? $"{playerName} ({World.ShardName}) - {Engine.MistedDateTime:M/dd/yy - HH:mm:ss}"
                : "";

            playerName = !string.IsNullOrEmpty(LastMobileDeathName)
                ? $"{playerName}_{LastMobileDeathName}_{Engine.MistedDateTime:M-d_HH.mm}"
                : $"{playerName}_{Engine.MistedDateTime:M-d_HH.mm}";

            try
            {
                Engine.EnsureDirectory(path);
            }
            catch
            {
                try
                {
                    path = Config.GetUserDirectory("ScreenShots");
                    Config.SetProperty("CapPath", path);
                }
                catch
                {
                    path = "";
                }
            }

            int count = 0;
            do
            {
                filename = Path.Combine(path,
                    $"{playerName}{(count != 0 ? count.ToString() : "")}.{type}");
                count--; // cause a - to be put in front of the number
            } while (File.Exists(filename));

            try
            {
                IntPtr hBmp = Platform.CaptureScreen(Client.Instance.GetWindowHandle(), Config.GetBool("CapFullScreen"),
                    imageTimestampTag);
                using (Image img = Image.FromHbitmap(hBmp))
                    img.Save(filename, GetFormat(type));
                DeleteObject(hBmp);
            }
            catch
            {
                // ignored
            }

            LastMobileDeathName = string.Empty;

            Engine.MainWindow.SafeAction(s => s.ReloadScreenShotsList());
        }
예제 #10
0
        public static void CaptureNow()
        {
            string filename;
            string timestamp;
            string name = "Unknown";
            string path = Config.GetString("CapPath");
            string type = Config.GetString("ImageFormat").ToLower();

            if (World.Player != null)
            {
                name = World.Player.Name;
            }
            if (name == null || name.Trim() == "" || name.IndexOfAny(Path.GetInvalidPathChars()) != -1)
            {
                name = "Unknown";
            }

            if (Config.GetBool("CapTimeStamp"))
            {
                timestamp = String.Format("{0} ({1}) - {2}", name, World.ShardName, Engine.MistedDateTime.ToString(@"M/dd/yy - HH:mm:ss"));
            }
            else
            {
                timestamp = "";
            }

            name = String.Format("{0}_{1}", name, Engine.MistedDateTime.ToString("M-d_HH.mm"));
            try
            {
                Engine.EnsureDirectory(path);
            }
            catch
            {
                try
                {
                    path = Config.GetUserDirectory("ScreenShots");
                    Config.SetProperty("CapPath", path);
                }
                catch
                {
                    path = "";
                }
            }

            int count = 0;

            do
            {
                filename = Path.Combine(path, String.Format("{0}{1}.{2}", name, count != 0 ? count.ToString() : "", type));
                count--;                 // cause a - to be put in front of the number
            }while (File.Exists(filename));

            try
            {
                IntPtr hBmp = ClientCommunication.CaptureScreen(Config.GetBool("CapFullScreen"), timestamp);
                using (Image img = Image.FromHbitmap(hBmp))
                    img.Save(filename, GetFormat(type));
                DeleteObject(hBmp);
            }
            catch
            {
            }

            Engine.MainWindow.ReloadScreenShotsList();
        }
예제 #11
0
        public static void Record()
        {
            if (m_Recording || Playing || World.Player == null)
            {
                return;
            }

            btnRec.Text     = "Stop Recording (PV)";
            btnPlay.Enabled = btnStop.Enabled = false;

            m_HouseDataWritten.Clear();

            string filename;
            string name = "Unknown";
            string path = Config.GetString("RecFolder");

            if (World.Player != null)
            {
                name = World.Player.Name;
            }
            if (name == null || name.Trim() == "" || name.IndexOfAny(Path.GetInvalidPathChars()) != -1)
            {
                name = "Unknown";
            }

            name = String.Format("{0}_{1}", name, Engine.MistedDateTime.ToString("M-d_HH.mm"));
            try
            {
                Engine.EnsureDirectory(path);
            }
            catch
            {
                try
                {
                    path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "RazorScreenShots");
                    Config.SetProperty("RecFolder", path);
                }
                catch
                {
                    path = "";
                }
            }
            int count = 0;

            do
            {
                filename = Path.Combine(path, String.Format("{0}{1}.rpv", name, count != 0 ? count.ToString() : ""));
                count--;                 // cause a - to be put in front of the number
            }while (File.Exists(filename));

            m_Recording = true;
            m_StartTime = m_LastTime = DateTime.UtcNow;

            try
            {
                //m_OutStream = new BinaryWriter( new FileStream( filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None ) );
                m_GZOut = new GZBlockOut(filename, 2048);

                m_GZOut.Raw.Write((byte)PlayerVersion);
                m_GZOut.Raw.Seek(16, SeekOrigin.Current);      // md5
                m_GZOut.Raw.Write((long)m_StartTime.ToFileTime());
                m_GZOut.Raw.Write((int)(0));                   // length

                m_GZOut.BufferAll = true;
                m_GZOut.Compressed.Write(World.Player.Name);
                m_GZOut.Compressed.Write(World.ShardName);
                byte[] addr;
                try
                {
                    addr = ClientCommunication.LastConnection.GetAddressBytes();
                }
                catch
                {
                    addr = new byte[4] {
                        0, 0, 0, 0
                    };
                }
                m_GZOut.Compressed.Write(addr, 0, 4);
                SaveWorldState();
                m_GZOut.BufferAll = false;
                m_GZOut.Flush();
            }
            catch (Exception e)
            {
                MessageBox.Show(Engine.MainWindow, Language.GetString(LocString.RecError), "Rec Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Engine.LogCrash(e);
            }
        }
예제 #12
0
            protected override void OnTick()
            {
                m_Count++;

                if (Config.GetBool("ShowBandageTimer"))
                {
                    bool showMessage = !(Config.GetBool("OnlyShowBandageTimerEvery") &&
                                         m_Count % Config.GetInt("OnlyShowBandageTimerSeconds") != 0);

                    if (showMessage)
                    {
                        if (Config.GetInt("ShowBandageTimerLocation") == 0)
                        {
                            World.Player.OverheadMessage(Config.GetInt("ShowBandageTimerHue"), Config.GetString("ShowBandageTimerFormat").Replace("{count}", m_Count.ToString()));
                        }
                        else
                        {
                            World.Player.SendMessage(Config.GetInt("ShowBandageTimerHue"), Config.GetString("ShowBandageTimerFormat").Replace("{count}", m_Count.ToString()));
                        }
                    }
                }

                if (m_Count > 30)
                {
                    Stop();
                }

                Client.Instance.RequestTitlebarUpdate();
            }
예제 #13
0
        private void UpdateTitleBar()
        {
            if (!m_Ready)
            {
                return;
            }

            if (World.Player != null && Config.GetBool("TitleBarDisplay"))
            {
                // reuse the same sb each time for less damn allocations
                m_TBBuilder.Remove(0, m_TBBuilder.Length);
                m_TBBuilder.Insert(0, Config.GetString("TitleBarText"));
                StringBuilder sb = m_TBBuilder;
                //StringBuilder sb = new StringBuilder( Config.GetString( "TitleBarText" ) ); // m_TitleCapacity

                PlayerData p = World.Player;

                if (p.Name != m_LastPlayerName)
                {
                    m_LastPlayerName = p.Name;

                    Engine.MainWindow.UpdateTitle();
                }

                sb.Replace(@"{char}",
                           Config.GetBool("ShowNotoHue") ? $"~#{p.GetNotorietyColor() & 0x00FFFFFF:X6}{p.Name}~#~" : p.Name);

                sb.Replace(@"{shard}", World.ShardName);

                sb.Replace(@"{crimtime}", p.CriminalTime != 0 ? $"~^C0C0C0{p.CriminalTime}~#~" : "-");

                sb.Replace(@"{str}", p.Str.ToString());
                sb.Replace(@"{hpmax}", p.HitsMax.ToString());

                sb.Replace(@"{hp}", p.Poisoned ? $"~#FF8000{p.Hits}~#~" : EncodeColorStat(p.Hits, p.HitsMax));

                sb.Replace(@"{dex}", World.Player.Dex.ToString());
                sb.Replace(@"{stammax}", World.Player.StamMax.ToString());
                sb.Replace(@"{stam}", EncodeColorStat(p.Stam, p.StamMax));
                sb.Replace(@"{int}", World.Player.Int.ToString());
                sb.Replace(@"{manamax}", World.Player.ManaMax.ToString());
                sb.Replace(@"{mana}", EncodeColorStat(p.Mana, p.ManaMax));

                sb.Replace(@"{ar}", p.AR.ToString());
                sb.Replace(@"{tithe}", p.Tithe.ToString());

                sb.Replace(@"{physresist}", p.AR.ToString());
                sb.Replace(@"{fireresist}", p.FireResistance.ToString());
                sb.Replace(@"{coldresist}", p.ColdResistance.ToString());
                sb.Replace(@"{poisonresist}", p.PoisonResistance.ToString());
                sb.Replace(@"{energyresist}", p.EnergyResistance.ToString());

                sb.Replace(@"{luck}", p.Luck.ToString());

                sb.Replace(@"{damage}", String.Format("{0}-{1}", p.DamageMin, p.DamageMax));

                sb.Replace(@"{weight}",
                           World.Player.Weight >= World.Player.MaxWeight
                        ? $"~#FF0000{World.Player.Weight}~#~"
                        : World.Player.Weight.ToString());

                sb.Replace(@"{maxweight}", World.Player.MaxWeight.ToString());

                sb.Replace(@"{followers}", World.Player.Followers.ToString());
                sb.Replace(@"{followersmax}", World.Player.FollowersMax.ToString());

                sb.Replace(@"{gold}", World.Player.Gold.ToString());

                sb.Replace(@"{gps}", GoldPerHourTimer.Running ? $"{GoldPerHourTimer.GoldPerSecond:N2}" : "-");
                sb.Replace(@"{gpm}", GoldPerHourTimer.Running ? $"{GoldPerHourTimer.GoldPerMinute:N2}" : "-");
                sb.Replace(@"{gph}", GoldPerHourTimer.Running ? $"{GoldPerHourTimer.GoldPerHour:N2}" : "-");
                sb.Replace(@"{goldtotal}", GoldPerHourTimer.Running ? $"{GoldPerHourTimer.GoldSinceStart}" : "-");
                sb.Replace(@"{goldtotalmin}", GoldPerHourTimer.Running ? $"{GoldPerHourTimer.TotalMinutes:N2} min" : "-");

                sb.Replace(@"{bandage}", BandageTimer.Running ? $"~#FF8000{BandageTimer.Count}~#~" : "-");

                sb.Replace(@"{skill}", SkillTimer.Running ? $"{SkillTimer.Count}" : "-");
                sb.Replace(@"{gate}", GateTimer.Running ? $"{GateTimer.Count}" : "-");

                sb.Replace(@"{stealthsteps}", StealthSteps.Counting ? StealthSteps.Count.ToString() : "-");
                //Client.ConnectionStart != DateTime.MinValue )
                //time = (int)((DateTime.UtcNow - Client.ConnectionStart).TotalSeconds);
                sb.Replace(@"{uptime}", ConnectionStart != DateTime.MinValue ? Utility.FormatTime((int)((DateTime.UtcNow - ConnectionStart).TotalSeconds)) : "-");

                sb.Replace(@"{dps}", DamageTracker.Running ? $"{DamageTracker.DamagePerSecond:N2}" : "-");
                sb.Replace(@"{maxdps}", DamageTracker.Running ? $"{DamageTracker.MaxDamagePerSecond:N2}" : "-");
                sb.Replace(@"{maxdamagedealt}", DamageTracker.Running ? $"{DamageTracker.MaxSingleDamageDealt}" : "-");
                sb.Replace(@"{maxdamagetaken}", DamageTracker.Running ? $"{DamageTracker.MaxSingleDamageTaken}" : "-");
                sb.Replace(@"{totaldamagedealt}", DamageTracker.Running ? $"{DamageTracker.TotalDamageDealt}" : "-");
                sb.Replace(@"{totaldamagetaken}", DamageTracker.Running ? $"{DamageTracker.TotalDamageTaken}" : "-");


                string buffList = string.Empty;

                if (BuffsTimer.Running)
                {
                    StringBuilder buffs = new StringBuilder();
                    foreach (BuffsDebuffs buff in World.Player.BuffsDebuffs)
                    {
                        int timeLeft = 0;

                        if (buff.Duration > 0)
                        {
                            TimeSpan diff = DateTime.UtcNow - buff.Timestamp;
                            timeLeft = buff.Duration - (int)diff.TotalSeconds;
                        }

                        buffs.Append(timeLeft <= 0
                            ? $"{buff.ClilocMessage1}, "
                            : $"{buff.ClilocMessage1} ({timeLeft}), ");
                    }

                    buffs.Length = buffs.Length - 2;
                    buffList     = buffs.ToString();
                    sb.Replace(@"{buffsdebuffs}", buffList);
                }
                else
                {
                    sb.Replace(@"{buffsdebuffs}", "-");
                    buffList = string.Empty;
                }

                string statStr = String.Format("{0}{1:X2}{2:X2}{3:X2}",
                                               (int)(p.GetStatusCode()),
                                               (int)(World.Player.HitsMax == 0 ? 0 : (double)World.Player.Hits / World.Player.HitsMax * 99),
                                               (int)(World.Player.ManaMax == 0 ? 0 : (double)World.Player.Mana / World.Player.ManaMax * 99),
                                               (int)(World.Player.StamMax == 0 ? 0 : (double)World.Player.Stam / World.Player.StamMax * 99));

                sb.Replace(@"{statbar}", $"~SR{statStr}");
                sb.Replace(@"{mediumstatbar}", $"~SL{statStr}");
                sb.Replace(@"{largestatbar}", $"~SX{statStr}");

                bool dispImg = Config.GetBool("TitlebarImages");
                for (int i = 0; i < Counter.List.Count; i++)
                {
                    Counter c = Counter.List[i];
                    if (c.Enabled)
                    {
                        sb.Replace($"{{{c.Format}}}", c.GetTitlebarString(dispImg && c.DisplayImage));
                    }
                }

                SetTitleStr(sb.ToString());
            }
            else
            {
                SetTitleStr("");
            }
        }
예제 #14
0
        private static void UpdateTitleBar()
        {
            if (World.Player != null && Config.GetBool("TitleBarDisplay"))
            {
                // reuse the same sb each time for less damn allocations
                m_TBBuilder.Remove(0, m_TBBuilder.Length);
                m_TBBuilder.Insert(0, Config.GetString("TitleBarText"));
                StringBuilder sb = m_TBBuilder;
                //StringBuilder sb = new StringBuilder( Config.GetString( "TitleBarText" ) ); // m_TitleCapacity

                PlayerData p = World.Player;

                if (p.Name != m_LastPlayerName)
                {
                    m_LastPlayerName = p.Name;

                    Engine.MainWindow.UpdateTitle();
                }

                if (Config.GetBool("ShowNotoHue"))
                {
                    sb.Replace(@"{char}", String.Format("~#{0:X6}{1}~#~", p.GetNotorietyColor() & 0x00FFFFFF, p.Name));
                }
                else
                {
                    sb.Replace(@"{char}", p.Name);
                }
                sb.Replace(@"{shard}", World.ShardName);

                if (p.CriminalTime != 0)
                {
                    sb.Replace(@"{crimtime}", String.Format("~^C0C0C0{0}~#~", p.CriminalTime));
                }
                else
                {
                    sb.Replace(@"{crimtime}", "-");
                }

                sb.Replace(@"{str}", p.Str.ToString());
                sb.Replace(@"{hpmax}", p.HitsMax.ToString());
                if (p.Poisoned)
                {
                    sb.Replace(@"{hp}", String.Format("~#FF8000{0}~#~", p.Hits));
                }
                else
                {
                    sb.Replace(@"{hp}", EncodeColorStat(p.Hits, p.HitsMax));
                }
                sb.Replace(@"{dex}", World.Player.Dex.ToString());
                sb.Replace(@"{stammax}", World.Player.StamMax.ToString());
                sb.Replace(@"{stam}", EncodeColorStat(p.Stam, p.StamMax));
                sb.Replace(@"{int}", World.Player.Int.ToString());
                sb.Replace(@"{manamax}", World.Player.ManaMax.ToString());
                sb.Replace(@"{mana}", EncodeColorStat(p.Mana, p.ManaMax));

                sb.Replace(@"{ar}", p.AR.ToString());
                sb.Replace(@"{tithe}", p.Tithe.ToString());

                sb.Replace(@"{physresist}", p.AR.ToString());
                sb.Replace(@"{fireresist}", p.FireResistance.ToString());
                sb.Replace(@"{coldresist}", p.ColdResistance.ToString());
                sb.Replace(@"{poisonresist}", p.PoisonResistance.ToString());
                sb.Replace(@"{energyresist}", p.EnergyResistance.ToString());

                sb.Replace(@"{luck}", p.Luck.ToString());

                sb.Replace(@"{damage}", String.Format("{0}-{1}", p.DamageMin, p.DamageMax));

                if (World.Player.Weight >= World.Player.MaxWeight)
                {
                    sb.Replace(@"{weight}", String.Format("~#FF0000{0}~#~", World.Player.Weight));
                }
                else
                {
                    sb.Replace(@"{weight}", World.Player.Weight.ToString());
                }
                sb.Replace(@"{maxweight}", World.Player.MaxWeight.ToString());

                sb.Replace(@"{followers}", World.Player.Followers.ToString());
                sb.Replace(@"{followersmax}", World.Player.FollowersMax.ToString());

                sb.Replace(@"{gold}", World.Player.Gold.ToString());
                if (BandageTimer.Running)
                {
                    sb.Replace(@"{bandage}", String.Format("~#FF8000{0}~#~", BandageTimer.Count));
                }
                else
                {
                    sb.Replace(@"{bandage}", "-");
                }

                if (StealthSteps.Counting)
                {
                    sb.Replace(@"{stealthsteps}", StealthSteps.Count.ToString());
                }
                else
                {
                    sb.Replace(@"{stealthsteps}", "-");
                }

                string statStr = String.Format("{0}{1:X2}{2:X2}{3:X2}",
                                               (int)(p.GetStatusCode()),
                                               (int)(World.Player.HitsMax == 0 ? 0 : (double)World.Player.Hits / World.Player.HitsMax * 99),
                                               (int)(World.Player.ManaMax == 0 ? 0 : (double)World.Player.Mana / World.Player.ManaMax * 99),
                                               (int)(World.Player.StamMax == 0 ? 0 : (double)World.Player.Stam / World.Player.StamMax * 99));

                sb.Replace(@"{statbar}", String.Format("~SR{0}", statStr));
                sb.Replace(@"{mediumstatbar}", String.Format("~SL{0}", statStr));
                sb.Replace(@"{largestatbar}", String.Format("~SX{0}", statStr));

                bool dispImg = Config.GetBool("TitlebarImages");
                for (int i = 0; i < Counter.List.Count; i++)
                {
                    Counter c = (Counter)Counter.List[i];
                    if (c.Enabled)
                    {
                        sb.Replace(String.Format("{{{0}}}", c.Format), c.GetTitlebarString(dispImg && c.DisplayImage));
                    }
                }

                SetTitleStr(sb.ToString());
            }
            else
            {
                SetTitleStr("");
            }
        }