DPS Meter Problem

10/21/2020 08:49 NorseGodTyr#1
1 Problem the first attacker is adding in table but not record the dmg
2 Problem popup only if a second char attack
3 Problem its update all chars dmg if one char attack

Does anyone know where the problem is?

Code:
#region UNIQUE_SELECT
                                else if (_pck.Opcode == 0xB070)
                                {
                                    try
                                    {
                                        DataTable dame = Task.Run(async () => await sqlCon.GetList($"SELECT * FROM SRO_VT_MAIN.._DPSMetterDame Where TargetID = {this.uinque078} ORDER BY DameCount DESC")).Result;
                                        byte isSuccess = _pck.ReadUInt8();
                                        if (isSuccess == 1) //
                                        {
                                            _pck.ReadUInt8();
                                            _pck.ReadUInt8();
                                            this.Skill_ID = _pck.ReadInt32();
                                            this.uinque = _pck.ReadUInt32(); //char unique id 
                                            _pck.ReadUInt32();
                                            this.uinque2 = _pck.ReadInt32(); //boss uniqueid
                                            _pck.ReadUInt8();
                                            byte atackType = _pck.ReadUInt8();
                                            if (atackType == 2)
                                            {
                                                _pck.ReadUInt8();
                                                _pck.ReadUInt32();
                                                _pck.ReadUInt8();
                                                _pck.ReadUInt32();
                                                _pck.ReadUInt32();
                                                _pck.ReadUInt8();
                                                _pck.ReadUInt8();
                                                this.dame1 = _pck.ReadUInt16();
                                            }
                                            Task.Run(async () => await sqlCon.exec($"EXEC [SRO_VT_MAIN].[dbo].[_UpdateDPS] '{this.sqlCharName}', {dame1},{this.uinque},'{this.uinque2}'"));
                                            if (MainForm.UniqueSkills.Contains(Skill_ID))//check if in list unique_skill
                                            {
                                                Task.Run(async () => await sqlCon.exec($"EXEC [SRO_VT_MAIN].[dbo].[_UpdateDPS] '{this.sqlCharName}', {dame1},{this.uinque},'{this.uinque2}'"));
                                                this.updateDPS();
                                                this.UniqueSelectST = true;
                                                this.UniqueSELECT2();
                                                Send(true);
                                            }
                                            else
                                            {
                                                this.UniqueSelectST = false;
                                                this.UniqueSELECT0();
                                                Send(true);
                                            }
                                        }
                                    }
                                    catch { }
                                }
                                else if (_pck.Opcode == 0x3057)
                                {
                                    _pck.ReadUInt32();
                                    if (_pck.ReadUInt8() == 0x10)
                                    {
                                        this.updateDPS();
                                        UniqueSELECT0();
                                        Send(true);
                                    }
                                    //else if(!this.UniqueSelectST)
                                    //{
                                    //    this.HideControl(5011, 5);
                                    //    this.CleanDPS();
                                    //}
                                }
                                else if (_pck.Opcode == 0x3013)
                                {
                                    this.updateDPS();
                                    UniqueSELECT0();
                                    Send(true);
                                }
                                else if (_pck.Opcode == 0xB071)
                                {
                                    try
                                    {
                                        byte isSuccess = _pck.ReadUInt8();
                                        if (isSuccess == 1)
                                        {
                                            uint uinque071 = _pck.ReadUInt32();
                                            uint uinque073 = _pck.ReadUInt32();
                                            //MainForm.WriteLine(2, "uinque073 ID [" + uinque073 + "]");
                                            byte hasDmg = _pck.ReadUInt8();
                                            if (hasDmg == 1)
                                            {
                                                byte hitcount = _pck.ReadUInt8();

                                                byte targetCount = _pck.ReadUInt8();

                                                for (uint i = 0; i < targetCount; i++)
                                                {
                                                    uint uinque072 = _pck.ReadUInt32(); //boss id
                                                    //MainForm.WriteLine(2, "SKILL ID 071 [" + this.Skill_ID + "]");
                                                    for (uint ii = 0; ii < hitcount; ii++)
                                                    {
                                                        byte effects = _pck.ReadUInt8();   // bitmask --> ATTACK_STATE_KNOCKBACK = 0x01,    ATTACK_STATE_BLOCK = 0x02,    ATTACK_STATE_POSITION = 0x04,   abort ? --> 0x08   ATTACK_STATE_DEAD = 0x80

                                                        byte dmgSource = _pck.ReadUInt8();// bitmask --> DAMAGE_STATE_NORMAL = 0x01,    DAMAGE_STATE_CRIT = 0x02,    DAMAGE_STATE_STATUS = 0x10
                                                        if ((effects & 0x0A) != 0x00)  // if ATTACK_STATE_BLOCK or abort --> no more data
                                                        {
                                                            continue;
                                                        }

                                                        this.targetCoun7t = _pck.ReadUInt32();
                                                        if (uinque072 != this.uniqueID && this.uniqueID == this.uinque)
                                                        {
                                                            this.uinque078 = uinque072;
                                                            
                                                            if (this.UniqueSelectST&& this.targetCoun7t<3000000)
                                                            {
                                                                Task.Run(async () => await sqlCon.exec($"EXEC [SRO_VT_MAIN].[dbo].[_UpdateDPS] '{sqlCon.clean(this.sqlCharName)}', {this.targetCoun7t},{uinque078},'{this.uniqueID}'"));
                                                            }
                                                        }
                                                        else
                                                        {
                                                            this.targetCoun7t = 0;
                                                        }
                                                        _pck.ReadUInt8();
                                                        _pck.ReadUInt8();
                                                        _pck.ReadUInt8();
                                                    }
                                                }
                                            }
                                            else if (isSuccess == 2)
                                            {
                                                MainForm.WriteLine(2, "a3 [" + isSuccess + "]");
                                            }
                                        }
                                    }
                                    catch { }
                                }
                                #endregion
Code:
 public void updateDPS()
        {
            DataTable dame = Task.Run(async () => await sqlCon.GetList($"SELECT * FROM SRO_VT_MAIN.._DPSMetterDame Where TargetID = {this.uinque078} ORDER BY DameCount DESC")).Result;
            int i = 1;
            foreach (DataRow dts in dame.Rows)
            {

                string Name = dts["CharName"].ToString();
                string DameCount = dts["DameCount"].ToString();
                string TargetID = dts["TargetID"].ToString();
                int code;
                int.TryParse(DameCount.ToString(), out code);
                uint TargetIDS;
                uint.TryParse(TargetID.ToString(), out TargetIDS);
                if (i == 1)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a1 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 1);
                }
                if (i == 2)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a2 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 2);
                }
                if (i == 3)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a3 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 3);
                }
                if (i == 4)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a3 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 4);
                }
                if (i == 5)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a3 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 5);
                }
                if (i == 6)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a3 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 6);
                }
                if (i == 7)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a3 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 7);
                }
                if (i == 8)
                {
                    if (TargetIDS == uinque078)
                        //MainForm.WriteLine(2, "a3 [" + i + "]");
                        this.ShowControl(5011, 1, Name, code, 8);
                }
                if (i > 9)
                    break;
                i++;

            }
        }
10/21/2020 13:44 NorseGodTyr#2
Quote:
Originally Posted by thaidu0ngpr0 View Post
:lul::lul:

not doing but asking for food
i have do more for the community than you will ever do

Quote:
Originally Posted by thaidu0ngpr0 View Post
:lul::lul:

not doing but asking for food
Are you talking about yourself :facepalm:
[Only registered and activated users can see links. Click Here To Register...]
10/21/2020 15:56 #HB#3
Oh no! Are you seriously updating SQL each hit done on a unique!!

Never do that dude, that will exhaust both your SQL and tool and result errors on traffic.
10/21/2020 16:33 NorseGodTyr#4
Quote:
Originally Posted by #HB View Post
Oh no! Are you seriously updating SQL each hit done on a unique!!

Never do that dude, that will exhaust both your SQL and tool and result errors on traffic.
the dps source is from thaidu0ngpr0 i know its buggy that why i ask
12/14/2020 06:29 JellyBitz#5
The code looks pretty weird actually.

0xB070 it's checking if the SKILL_ID exist on a UNIQUES SKILL LIST?
I don't know, kind tracking if the unique attacks a player but not when player is attacking?

This is a better example about how to parse skill start/end.
[Only registered and activated users can see links. Click Here To Register...]
You won't need to parse any other packet to do the job.

You'll have to check if at least one TargetUniqueID from the skill belongs to a Unique Mob to track the damage from it, otherwise just ignore it.
02/01/2021 12:22 Exner.#6
If you find a solution, let us know I have the same problem