Пример #1
0
        private Bitmap GetSkillImage(Enums.Skill skillId)
        {
            var img = Properties.Resources.ResourceManager.GetObject(
                        String.Format("Skill_{0:D3}", (byte)skillId));

            return (Bitmap)img;
        }
Пример #2
0
        public void Remove(Enums.Skill skillId)
        {
            var skillInfo = Data.Database.Skills.GetByID(skillId);

            _raw[skillInfo.LearnedSkillByteOffset] = (byte)(_raw[skillInfo.LearnedSkillByteOffset] & ~skillInfo.LearnedSkillBitMask);
            UpdateNoneSkill();
        }
Пример #3
0
        public Skill GetByID(Enums.Skill skillId)
        {
            var row = _data
                      .Elements("skill")
                      .Where((x) => x.Attribute("id").Value == ((byte)skillId).ToString())
                      .First();

            return(FromElement(row));
        }
Пример #4
0
        public Skill GetByID(Enums.Skill skillId)
        {
            var row = _data
                      .Elements("skill")
                      .Where((x) => x.Attribute("id").Value == ((byte)skillId).ToString())
                      .First();

            var displayName = GetDisplayName(row);

            return(new Skill
            {
                SkillID = (Enums.Skill)row.GetAttribute <byte>("id"),
                DisplayName = displayName
            });
        }
Пример #5
0
        private Bitmap GetSkillImage(Enums.Skill skillId)
        {
            var id = ((byte)skillId).ToString();

            if (id.Length == 1)
            {
                id = "00" + id;
            }
            else if (id.Length == 2)
            {
                id = "0" + id;
            }
            var img = Properties.Resources.ResourceManager.GetObject("Skill_" + id);

            return((Bitmap)img);
        }
Пример #6
0
        private void TrySkill(Enums.Skill skill)
        {
            var skillCost = Player.SkillCosts[skill];

            if (!player.Skills.Contains(skill))
            {
                SpeakAndPrint($"You haven't learned {skill.ToString()}.");
            }
            else if (player.CurrentSkillPoints < skillCost)
            {
                SpeakAndPrint($"Not enough skill points (have {player.CurrentSkillPoints}, need {skillCost})");
            }
            else
            {
                var message = SkillExecutor.Execute(skill, player, currentRoom.Monsters);
                player.CurrentSkillPoints -= skillCost;
                SpeakAndPrint(message);
            }
        }
Пример #7
0
        public bool Contains(Enums.Skill skillId)
        {
            var skillInfo = Data.Database.Skills.GetByID(skillId);

            return((byte)(_raw[skillInfo.LearnedSkillByteOffset] & skillInfo.LearnedSkillBitMask) == skillInfo.LearnedSkillBitMask);
        }
Пример #8
0
        private void timerExperienceSkillCounter_Tick(object sender, EventArgs e)
        {
            if (Memory.ReadByte(Addresses.Client.Connection) == 8)
            {
                if (btnExpCounterStart.Text == "Stop")
                {
                    if (comboboxSettingsExpCounter.Text == "Titlebar" || comboboxSettingsExpCounter.Text == "")
                    {
                        WinApi.SetWindowText(Client.Tibia.MainWindowHandle, "Exp to lvl " + (Memory.ReadInt(Addresses.Player.Level) + 1) + ": " + Utils.ExperienceCounter.GetExperienceTNL() +
                                                                            " [" + Utils.ExperienceCounter.GetLevelPercentTNL() + "%] | Exp/h: " + Utils.ExperienceCounter.GetExperiencePerHour() +
                                                                            " [" + Utils.ExperienceCounter.GetLevelPercentPerHour() + "%/h] | Exp gained: " + Utils.ExperienceCounter.GetGainedExperience() +
                                                                            " [" + Utils.ExperienceCounter.GetGainedLevelPercent() + "%] | Active since: " +
                                                                            string.Format("{0:D2}:{1:D2}:{2:D2}", Utils.ExperienceCounter.GetTotalRunningTime().Hours,
                                                                                                                  Utils.ExperienceCounter.GetTotalRunningTime().Minutes,
                                                                                                                  Utils.ExperienceCounter.GetTotalRunningTime().Seconds) +
                                                                            " | Time left: " + Utils.ExperienceCounter.GetTimeLeftTNL());
                    }
                    else if (comboboxSettingsExpCounter.Text == "Statusbar")
                    {
                        Client.Misc.WriteStatusBar("Exp to lvl " + (Memory.ReadInt(Addresses.Player.Level) + 1) + ": " + Utils.ExperienceCounter.GetExperienceTNL() +
                                                   " [" + Utils.ExperienceCounter.GetLevelPercentTNL() + "%] | Exp/h: " + Utils.ExperienceCounter.GetExperiencePerHour() +
                                                   " [" + Utils.ExperienceCounter.GetLevelPercentPerHour() + "%/h] | Exp gained: " + Utils.ExperienceCounter.GetGainedExperience() +
                                                   " [" + Utils.ExperienceCounter.GetGainedLevelPercent() + "%] | Active since: " +
                                                   string.Format("{0:D2}:{1:D2}:{2:D2}", Utils.ExperienceCounter.GetTotalRunningTime().Hours,
                                                                                         Utils.ExperienceCounter.GetTotalRunningTime().Minutes,
                                                                                         Utils.ExperienceCounter.GetTotalRunningTime().Seconds) +
                                                   " | Time left: " + Utils.ExperienceCounter.GetTimeLeftTNL(), 2);
                    }
                }
                if (btnSkillCounterStart.Text == "Stop")
                {
                    Enums.Skill highestSkillType = new Enums.Skill();
                    highestSkill = 0;
                    int Axe = Memory.ReadInt(Addresses.Player.Axe), Club = Memory.ReadInt(Addresses.Player.Club),
                        Sword = Memory.ReadInt(Addresses.Player.Sword), Fist = Memory.ReadInt(Addresses.Player.Fist);
                    if (Axe > highestSkill)
                    {
                        highestSkill = Axe;
                        highestSkillType = Enums.Skill.Axe;
                    }
                    if (Club > highestSkill)
                    {
                        highestSkill = Club;
                        highestSkillType = Enums.Skill.Club;
                    }
                    if (Sword > highestSkill)
                    {
                        highestSkill = Sword;
                        highestSkillType = Enums.Skill.Sword;
                    }
                    if (Fist > highestSkill)
                    {
                        highestSkill = Fist;
                        highestSkillType = Enums.Skill.Fist;
                    }
                    Structs.Skill Melee = Utils.SkillCounter.GetSkillInfo(highestSkillType);
                    progbarSkillCounterMelee.Value = 100 - Melee.PercentLeft;
                    lblSkillCounterMeleeSkill.Text = Melee.Name + ":";

                    Structs.Skill MLVL = Utils.SkillCounter.GetSkillInfo(Enums.Skill.MagicLevel);
                    Structs.Skill Distance = Utils.SkillCounter.GetSkillInfo(Enums.Skill.Distance);
                    Structs.Skill Fishing = Utils.SkillCounter.GetSkillInfo(Enums.Skill.Fishing);
                    Structs.Skill Shielding = Utils.SkillCounter.GetSkillInfo(Enums.Skill.Shielding);

                    progbarSkillCounterDistance.Value = 100 - Distance.PercentLeft;
                    progbarSkillCounterFishing.Value = 100 - Fishing.PercentLeft;
                    progbarSkillCounterMLVL.Value = 100 - MLVL.PercentLeft;
                    progbarSkillCounterShielding.Value = 100 - Shielding.PercentLeft;

                    lblSkillCounterMelee.Text = Melee.CurrentSkill + " [" + Melee.PercentLeft + "%, " + Melee.PercentGained + "% gained, " +
                                                Melee.PercentPerHour + "%/h, " + Melee.TimeLeft + " left]";
                    lblSkillCounterMLVL.Text = MLVL.CurrentSkill + " [" + MLVL.PercentLeft + "%, " + MLVL.PercentGained + "% gained, " +
                                                MLVL.PercentPerHour + "%/h, " + MLVL.TimeLeft + " left]";
                    lblSkillCounterDistance.Text = Distance.CurrentSkill + " [" + Distance.PercentLeft + "%, " + Distance.PercentGained + "% gained, " +
                                                   Distance.PercentPerHour + "%/h, " + Distance.TimeLeft + " left]";
                    lblSkillCounterShielding.Text = Shielding.CurrentSkill + " [" + Shielding.PercentLeft + "%, " + Shielding.PercentGained + "% gained, " +
                                                   Shielding.PercentPerHour + "%/h, " + Shielding.TimeLeft + " left]";
                    lblSkillCounterFishing.Text = Fishing.CurrentSkill + " [" + Fishing.PercentLeft + "%, " + Fishing.PercentGained + "% gained, " +
                                                   Fishing.PercentPerHour + "%/h, " + Fishing.TimeLeft + " left]";

                    lblSkillCounterActive.Text = "Active since: " + string.Format("{0:D2}:{1:D2}:{2:D2}",
                                                                                  Utils.SkillCounter.GetTotalRunningTime().Hours,
                                                                                  Utils.SkillCounter.GetTotalRunningTime().Minutes,
                                                                                  Utils.SkillCounter.GetTotalRunningTime().Seconds);
                }
                else if (btnSkillCounterStart.Text == "Start" && btnExpCounterStart.Text == "Start")
                {
                    timerExperienceSkillCounter.Stop();
                }
            }
            else
            {
                if (Client.Tibia.MainWindowTitle != "Tibia")
                {
                    WinApi.SetWindowText(Client.Tibia.MainWindowHandle, "Tibia");
                }
                if (lblSkillCounterDistance.Text.Length > 0)
                {
                    lblSkillCounterDistance.Text = "";
                    lblSkillCounterFishing.Text = "";
                    lblSkillCounterMelee.Text = "";
                    lblSkillCounterMeleeSkill.Text = "Melee:";
                    lblSkillCounterMLVL.Text = "";
                    lblSkillCounterShielding.Text = "";
                    progbarSkillCounterDistance.Value = 0;
                    progbarSkillCounterFishing.Value = 0;
                    progbarSkillCounterMelee.Value = 0;
                    progbarSkillCounterMLVL.Value = 0;
                    progbarSkillCounterShielding.Value = 0;
                }
            }
        }